Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#10980) Fix rampage bug
Home

[Freeciv-Dev] (PR#10980) Fix rampage bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#10980) Fix rampage bug
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Thu, 11 Nov 2004 10:24:04 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10980 >

We might die while doing goto in bodyguard function, and proceed to try
rampaging while dead, with predictable results.

  - Per

Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.337
diff -u -r1.337 aiunit.c
--- ai/aiunit.c 29 Sep 2004 02:24:18 -0000      1.337
+++ ai/aiunit.c 11 Nov 2004 18:22:16 -0000
@@ -804,7 +804,10 @@
 
   if (!same_pos(punit->tile, ptile)) {
     if (goto_is_sane(punit, ptile, TRUE)) {
-      (void) ai_unit_goto(punit, ptile);
+      if (!ai_unit_goto(punit, ptile)) {
+        /* We died */
+        return;
+      }
     } else {
       /* can't possibly get there to help */
       ai_unit_new_role(punit, AIUNIT_NONE, NULL);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10980) Fix rampage bug, Per I. Mathisen <=