Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] Re: (PR#18261) Trying to attack ally
Home

[Freeciv-Dev] Re: (PR#18261) Trying to attack ally

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: marko.lindqvist@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#18261) Trying to attack ally
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Wed, 19 Jul 2006 05:55:59 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=18261 >


  Either ceasefire should be considered 'hate' when resolving 
love-love-hate triangles or alliances should break when ceasefire runs 
out. Attached patch implements latter.

  This has minor problem that third player gets two messages about 
ceasefire running out. Unless someone else wants to fix that, I'm going 
to commit this patch in its current form.


  - ML

diff -Nurd -X.diff_ignore freeciv/server/srv_main.c freeciv/server/srv_main.c
--- freeciv/server/srv_main.c   2006-07-18 15:22:30.390625000 +0300
+++ freeciv/server/srv_main.c   2006-07-19 15:41:59.265625000 +0300
@@ -489,6 +489,20 @@
           state->type = DS_WAR;
           check_city_workers(plr1);
           check_city_workers(plr2);
+
+          /* Avoid love-love-hate triangles */
+          players_iterate(plr3) {
+            if (plr3->is_alive && plr3 != plr1 && plr3 != plr2
+                && pplayers_allied(plr3, plr1)
+                && pplayers_allied(plr3, plr2)) {
+              notify_player(plr3, NULL, E_TREATY_BROKEN,
+                            _("Ceasefire between %s and %s has run out. "
+                              "They are at war. You cancel alliance with %s."),
+                            plr1->name, plr2->name, plr1->name);
+              plr3->diplstates[plr1->player_no].has_reason_to_cancel = TRUE;
+              handle_diplomacy_cancel_pact(plr3, plr1->player_no, 
CLAUSE_ALLIANCE);
+            }
+          } players_iterate_end;
           break;
         }
       }

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