Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2000:
[Freeciv-Dev] [BUG + PATCH] ai_manage_explorer might kill unit
Home

[Freeciv-Dev] [BUG + PATCH] ai_manage_explorer might kill unit

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] [BUG + PATCH] ai_manage_explorer might kill unit
From: Markus Linnala <maage@xxxxxxxxx>
Date: Sat, 05 Feb 2000 14:03:46 +0200
Reply-to: Markus Linnala <maage@xxxxxxxxx>

Sorry not to use correct channel to report bugs, but it seems
www.freeciv.org is down or unreachable at the moment.

After ai_manage_explorer we must check if unit exists any more.
Maybe we should give some return value and check it. But here is
quick patch to fix this.

Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.98
diff -u -b -r1.98 aiunit.c
--- aiunit.c    2000/02/01 13:25:57     1.98
+++ aiunit.c    2000/02/05 11:59:43
@@ -1346,7 +1346,9 @@
             ai_manage_explorer(pplayer, punit); /* nothing else to do */
             /* you can still have some moves left here, but barbarians should
                not sit helplessly, but advance towards nearest known enemy 
city */
-            if( punit->moves_left && is_barbarian(pplayer) ) {
+           /* unit might die when exploring */
+           punit = find_unit_by_id(id);
+           if (punit && punit->moves_left && is_barbarian(pplayer)) {
               struct city *pc;
               int fx, fy;
               freelog(LOG_DEBUG,"Barbarians looking for target");

-- 
//Markus

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] [BUG + PATCH] ai_manage_explorer might kill unit, Markus Linnala <=