Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#8285) War with team members
Home

[Freeciv-Dev] (PR#8285) War with team members

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8285) War with team members
From: "mateusz stefek" <matusik_s@xxxxx>
Date: Mon, 22 Mar 2004 04:16:15 -0800
Reply-to: rt@xxxxxxxxxxx

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

It is possible.
Suppose that A and B are playing in the same team.
A forms an alliance with C. Then B declares war on C.
Through cascading war declaration B also declares war on A.

Patch attached.
Solution: In cascading war declaration code we check if B is in the same team 
as A. If so A cancels alliance and gets the blame.

--
mateusz

--- freeorig/server/plrhand.c   2004-02-24 14:57:18.000000000 +0100
+++ freeciv/server/plrhand.c    2004-03-22 12:28:42.000000000 +0100
@@ -1097,12 +1097,26 @@
         && new_type == DS_WAR && pplayers_allied(pplayer2, other)
         && !pplayers_at_war(pplayer, other)) {
       /* A declaration of war by A against B also means A declares
-       * war against all of B's allies. Yes, A gets the blame. */
-      notify_player_ex(other, -1, -1, E_TREATY_BROKEN,
-                      _("Game: %s has attacked one of your allies! "
-                         "The alliance brings you into the war as well."),
-                       pplayer->name);
-      handle_diplomacy_cancel_pact(pplayer, other->player_no, CLAUSE_LAST);
+       * war against all of B's allies. Yes, A gets the blame.
+       * But if A is in the same team as B's ally we break that alliance
+       * and B gets the blame.
+       */
+      if (other->team != pplayer->team) {
+        notify_player_ex(other, -1, -1, E_TREATY_BROKEN,
+                        _("Game: %s has attacked one of your allies! "
+                           "The alliance brings you into the war as well."),
+                         pplayer->name);
+        handle_diplomacy_cancel_pact(pplayer, other->player_no, CLAUSE_LAST);
+      } else {
+        notify_player_ex(other, -1, -1, E_TREATY_BROKEN,
+                        _("Game: Your teammate %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->player_no,
+                                    CLAUSE_ALLIANCE);
+      }
     }
   } players_iterate_end;
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8285) War with team members, mateusz stefek <=