Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#14489) civserver Arithmetic exception
Home

[Freeciv-Dev] (PR#14489) civserver Arithmetic exception

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#14489) civserver Arithmetic exception
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Sat, 29 Oct 2005 12:46:00 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch seems to help.
Can someone familiar with the ai ferry code look at this?
Why aiferry_goto_amphibious() returns TRUE when the unit dies?
It's barbarian musketers in a boat.
--
mateusz
Index: ai/aiferry.c
===================================================================
--- ai/aiferry.c        (wersja 11198)
+++ ai/aiferry.c        (kopia robocza)
@@ -602,6 +602,7 @@
   if (punit->transported_by > 0) {
     /* We are on a boat, ride it! */
     struct unit *ferryboat = find_unit_by_id(punit->transported_by);
+    int punit_id;
 
     /* Check if we are the passenger-in-charge */
     if (is_boat_free(ferryboat, punit, 0)) {
@@ -638,10 +639,15 @@
         assert(same_pos(punit->tile, bodyguard->tile));
        handle_unit_load(pplayer, bodyguard->id, ferryboat->id);
       }
+      punit_id = punit->id;
       if (!aiferry_goto_amphibious(ferryboat, punit, dest_tile)) {
         /* died */
         return FALSE;
       }
+      if (!find_unit_by_id(punit_id)) {
+        /* died */
+        return FALSE;
+      }
       if (same_pos(punit->tile, dest_tile)) {
         /* Arrived */
         handle_unit_activity_request(punit, ACTIVITY_IDLE);

[Prev in Thread] Current Thread [Next in Thread]