Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10123) Alliance broken between team mates
Home

[Freeciv-Dev] (PR#10123) Alliance broken between team mates

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10123) Alliance broken between team mates
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Wed, 15 Sep 2004 02:16:31 -0700
Reply-to: rt@xxxxxxxxxxx

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

10086 removal of cascading war declaration contains a bug which can lead
to alliance break inside a team. This is similar to PR#8285
Fix attached
--
mateusz
? civgame-3700.sav.gz
? civgame-3950.sav.gz
Index: plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.323
diff -u -r1.323 plrhand.c
--- plrhand.c   15 Sep 2004 08:58:33 -0000      1.323
+++ plrhand.c   15 Sep 2004 09:14:51 -0000
@@ -1148,19 +1148,31 @@
   /* Check fall-out of a war declaration. */
   players_iterate(other) {
     if (other->is_alive && other != pplayer && other != pplayer2
-        && !pplayers_in_the_same_team(pplayer, pplayer2)
         && new_type == DS_WAR && pplayers_allied(pplayer2, other)
         && pplayers_allied(pplayer, other)) {
-      /* If an ally declares war on another ally, break off your alliance
-       * to the aggressor. This prevents in-alliance wars, which are not
-       * permitted. */
-      notify_player_ex(other, -1, -1, E_TREATY_BROKEN,
-                       _("Game: %s has attacked your ally %s! "
-                         "You cancel your alliance to the aggressor."),
+      if (!pplayers_in_the_same_team(pplayer, other)) {
+        /* If an ally declares war on another ally, break off your alliance
+         * to the aggressor. This prevents in-alliance wars, which are not
+         * permitted. */
+        notify_player_ex(other, -1, -1, E_TREATY_BROKEN,
+                         _("Game: %s has attacked your ally %s! "
+                           "You cancel your alliance to the aggressor."),
                        pplayer->name, pplayer2->name);
-      other->diplstates[pplayer->player_no].has_reason_to_cancel = 1;
-      handle_diplomacy_cancel_pact(other, pplayer->player_no,
-                                   CLAUSE_ALLIANCE);
+        other->diplstates[pplayer->player_no].has_reason_to_cancel = 1;
+        handle_diplomacy_cancel_pact(pplayer, other->player_no,
+                                     CLAUSE_ALLIANCE);
+      } else {
+        /* We are in the same team as the agressor; we cannot break 
+         * alliance with him. We trust our team mate and break alliance
+         * with the attacked player */
+        notify_player_ex(other, -1, -1, E_TREATY_BROKEN,
+                         _("Game: Your team mate %s declared war on %s. "
+                           "You are obligated to cancel alliance with %s."),
+                         pplayer->name,
+                         get_nation_name_plural(pplayer2->nation),
+                         pplayer2->name);
+        handle_diplomacy_cancel_pact(other, pplayer2, CLAUSE_ALLIANCE);
+      }
     }
   } players_iterate_end;
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10123) Alliance broken between team mates, Mateusz Stefek <=