<URL: http://bugs.freeciv.org/Ticket/Display.html?id=34563 >

 ai_activate_passengers() need to use unit_list_iterate_safe() as
managed unit might die or move out of tile.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aiferry.c freeciv/ai/aiferry.c
--- freeciv/ai/aiferry.c	2006-07-17 23:56:47.000000000 +0300
+++ freeciv/ai/aiferry.c	2007-01-25 23:36:14.000000000 +0200
@@ -425,13 +425,13 @@
 **************************************************************************/
 static void ai_activate_passengers(struct unit *ferry)
 {
-  unit_list_iterate(ferry->tile->units, aunit) {
+  unit_list_iterate_safe(ferry->tile->units, aunit) {
     if (aunit->transported_by == ferry->id) {
       handle_unit_activity_request(aunit, ACTIVITY_IDLE);
       aunit->ai.done = FALSE;
       ai_manage_unit(unit_owner(aunit), aunit);
     }
-  } unit_list_iterate_end;
+  } unit_list_iterate_safe_end;
 }
 
 /**************************************************************************
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to