Now have an autowalker class that allows me to drive the game from an external source.
This commit is contained in:
parent
1aba26831b
commit
d4355a608d
6 changed files with 137 additions and 121 deletions
10
main.cpp
10
main.cpp
|
@ -1,6 +1,7 @@
|
|||
#include "gui_fsm.hpp"
|
||||
#include "textures.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "autowalker.hpp"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
textures::init();
|
||||
|
@ -8,9 +9,10 @@ int main(int argc, char* argv[]) {
|
|||
sound::mute(true);
|
||||
gui::FSM main;
|
||||
main.event(gui::Event::STARTED);
|
||||
Autowalker walker(main);
|
||||
|
||||
if(argc > 1 && argv[1][0] == 't') {
|
||||
main.start_autowalk(0.1);
|
||||
walker.start_autowalk();
|
||||
}
|
||||
|
||||
while(main.active()) {
|
||||
|
@ -22,7 +24,11 @@ int main(int argc, char* argv[]) {
|
|||
|| main.in_state(gui::State::MAPPING)
|
||||
|| main.in_state(gui::State::IN_COMBAT))
|
||||
{
|
||||
main.keyboard_mouse();
|
||||
if(main.autowalking) {
|
||||
walker.autowalk();
|
||||
} else {
|
||||
main.keyboard_mouse();
|
||||
}
|
||||
} else{
|
||||
main.event(gui::Event::TICK);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue