Fix the map opening and closing all the time.

This commit is contained in:
Zed A. Shaw 2025-09-02 13:56:19 -04:00
parent a11e7de14e
commit 0c8cb197c2
3 changed files with 11 additions and 5 deletions

View file

@ -244,13 +244,19 @@ void Autowalker::craft_weapon() {
}
void Autowalker::open_map() {
if(map_opened_once) return;
if(!map_opened_once) {
if(!fsm.$map_open) {
send_event(gui::Event::MAP_OPEN);
map_opened_once = true;
}
}
}
void Autowalker::close_map() {
if(fsm.$map_open) {
send_event(gui::Event::MAP_OPEN);
}
}
void Autowalker::autowalk() {
handle_window_events();
@ -272,7 +278,7 @@ void Autowalker::autowalk() {
handle_boss_fight();
handle_player_walk(start, goal);
if(map_opened_once && move_attempts > 20) send_event(gui::Event::MAP_OPEN);
close_map();
move_attempts++;
} while(move_attempts < 100 && fsm.autowalking);

View file

@ -21,6 +21,7 @@ struct Autowalker {
void start_autowalk();
void craft_weapon();
void open_map();
void close_map();
bool found_enemy();
bool found_item();

View file

@ -226,7 +226,6 @@ TEST_CASE("SpatialMap::neighbors", "[spatialmap-neighbors]") {
}
TEST_CASE("SpatialMap::distance_sorted", "[spatialmap]") {
DinkyECS::World world;
SpatialMap map;