Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] Re: (PR#5114) advdiplomacy.c:904: ai_diplomacy_actions: As
Home

[Freeciv-Dev] Re: (PR#5114) advdiplomacy.c:904: ai_diplomacy_actions: As

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rt-guest@xxxxxxxxxxxxxx
Cc: maage@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#5114) advdiplomacy.c:904: ai_diplomacy_actions: Assertion `!pplayers_allied(target, pplayer)' failed.
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 19 Aug 2003 08:34:49 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Sat, 16 Aug 2003, Guest wrote:
> > civserver: ../../../freeciv-cvs/ai/advdiplomacy.c:904:
> ai_diplomacy_actions: Assertion `!pplayers_allied(target, pplayer)' failed.

This patch should help.

  - Per

Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.3
diff -u -r1.3 advdiplomacy.c
--- ai/advdiplomacy.c   14 Aug 2003 21:13:28 -0000      1.3
+++ ai/advdiplomacy.c   19 Aug 2003 15:33:22 -0000
@@ -491,6 +491,9 @@
     total_balance += balance;
     gift = (gift && (balance >= 0));
     ai_treaty_react(pplayer, aplayer, pclause);
+    if (pclause->type == CLAUSE_ALLIANCE && ai->diplomacy.target == aplayer) {
+      ai->diplomacy.target = NULL; /* Oooops... */
+    }
   } clause_list_iterate_end;
 
   /* Rather arbitrary algorithm to increase our love for a player if
@@ -901,7 +904,10 @@
 
   if (target && !pplayers_at_war(pplayer, target)
       && ai->diplomacy.countdown-- <= 0) {
-    assert(!pplayers_allied(target, pplayer));
+    if (pplayers_allied(pplayer, target)) {
+      freelog(LOG_ERROR, "%s: Went to war against %s, who is an ally!",
+              pplayer->name, target->name); /* Oh, my. */
+    }
     if (pplayer->diplstates[target->player_no].has_reason_to_cancel > 0) {
       /* We have good reason */
       notify(target, _("*%s (AI)* Your despicable actions will not go "

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