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: Sun, 16 Jul 2006 14:53:20 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Jason Dorje Short wrote:
> Per I. Mathisen wrote:
>> On Fri, 14 Jul 2006, Marko Lindqvist wrote:
>>> Marko Lindqvist wrote:
>>>>   I think this is one possible cause:
>>>>   A & B allied, A & C no contact -> B & C ally ->
>>>>   A & B allied, B & C allied, A & C no contact -> A & C meet ->
>>>>   A & B allied, B & C allied, A & C war
>>>  How this should work? Is it ok to just cancel both alliances when A &
>>> C meet, even if they then immediately go for peace?
>> First thought is that A & C should immediately be at peace, too.
> 
> A rather complicated thing to test for, and for the player a bit bizarre 
> (meeting new players puts me at war, why am I at peace this one time?).
> 
> IMO whatever function is used to declare war (and breaks alliances to 
> avoid love-love-hate) should be used when war is created on contact. 
> Then the alliance will be automatically snipped.

  That's what I thought. There's difference between declaring war and 
first contact, thought. In war declaration another party is aggressor 
and another victim, in first contact both parties are equal.
  Patch attached.


  - ML


diff -Nurd -X.diff_ignore freeciv/server/plrhand.c freeciv/server/plrhand.c
--- freeciv/server/plrhand.c    2006-07-16 18:50:52.937500000 +0300
+++ freeciv/server/plrhand.c    2006-07-17 00:46:18.812500000 +0300
@@ -1175,6 +1175,22 @@
     send_player_info(pplayer2, pplayer1);
     send_player_info(pplayer1, pplayer1);
     send_player_info(pplayer2, pplayer2);
+
+    /* Check for new love-love-hate triangles and resolve them */
+    players_iterate(pplayer3) {
+      if (pplayer1 != pplayer3 && pplayer2 != pplayer3 && pplayer3->is_alive
+          && pplayers_allied(pplayer1, pplayer3)
+          && pplayers_allied(pplayer2, pplayer3)) {
+        notify_player(pplayer3, NULL, E_TREATY_BROKEN,
+                      _("%s and %s meet and go to instant war. You cancel your 
alliance "
+                        "with both."), pplayer1->name, pplayer2->name);
+        pplayer3->diplstates[pplayer1->player_no].has_reason_to_cancel = TRUE;
+        pplayer3->diplstates[pplayer2->player_no].has_reason_to_cancel = TRUE;
+        handle_diplomacy_cancel_pact(pplayer1, pplayer3->player_no, 
CLAUSE_ALLIANCE);
+        handle_diplomacy_cancel_pact(pplayer2, pplayer3->player_no, 
CLAUSE_ALLIANCE);
+      }
+    } players_iterate_end;
+
     return;
   } else {
     assert(pplayer_get_diplstate(pplayer2, pplayer1)->type != DS_NO_CONTACT);

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