Browse Source

Endless Loop Emergency Quick Fix (#9098)

- Units will now move at least one cell before trying to attack through a movement event
  * Other triggers of an attack such as the AI are unaffected
- This serves as a quick fix for an endless loop that is caused by movement that starts when target is already in range
  * Proper fix of the "Official Walkpath" will come later
- Fixes #9097
- Follow-up to 322bd2c
Playtester 2 months ago
parent
commit
5e6d6bf9b7
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/map/unit.cpp

+ 1 - 1
src/map/unit.cpp

@@ -113,7 +113,7 @@ bool unit_update_chase(block_list& bl, t_tick tick, bool fullcheck) {
 		tbl = map_id2bl(ud->target_to);
 		tbl = map_id2bl(ud->target_to);
 
 
 	// Reached destination, start attacking
 	// Reached destination, start attacking
-	if (tbl != nullptr && tbl->m == bl.m && check_distance_bl(&bl, tbl, ud->chaserange) && status_check_visibility(&bl, tbl, false)) {
+	if (tbl != nullptr && tbl->m == bl.m && ud->walkpath.path_pos > 0 && check_distance_bl(&bl, tbl, ud->chaserange) && status_check_visibility(&bl, tbl, false)) {
 		ud->to_x = bl.x;
 		ud->to_x = bl.x;
 		ud->to_y = bl.y;
 		ud->to_y = bl.y;
 		ud->target_to = 0;
 		ud->target_to = 0;