| Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
May 2006: [Freeciv-Dev] Re: (PR#16868) Bug Report and Feedback on Freeciv-gtk2-2.1 |   | 
| [Freeciv-Dev] Re: (PR#16868) Bug Report and Feedback on Freeciv-gtk2-2.1[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index] 
 <URL: http://bugs.freeciv.org/Ticket/Display.html?id=16868 > On Sat, 6 May 2006, cp@xxxxxxxxx wrote: > AI-Diplomany asks me to declare war on dead players. I see this could happen if a player died while on a countdown to war against that player. The attached patch should fix this. - Per Index: ai/advdiplomacy.c
===================================================================
--- ai/advdiplomacy.c   (revision 11981)
+++ ai/advdiplomacy.c   (working copy)
@@ -1070,6 +1070,7 @@
   struct ai_dip_intel *adip = &ai->diplomacy.player_intel[target->player_no];
 
   assert(pplayer != target);
+  assert(target->is_alive);
 
   switch (reason) {
   case WAR_REASON_SPACE:
@@ -1397,6 +1398,10 @@
     struct ai_dip_intel *adip = 
                         &ai->diplomacy.player_intel[aplayer->player_no];
 
+    if (!aplayer->is_alive) {
+      adip->countdown = -1;
+      continue;
+    }
     if (adip->countdown > 0) {
       adip->countdown--;
     } else if (adip->countdown == 0) {
 
 
 |