[Freeciv-Dev] Re: (PR#18261) Trying to attack ally
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=18261 >
Marko Lindqvist wrote:
> 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.
- Parameters to handle_diplomacy_cancel_pact() were swapped. This was
also true for code where I copied call from.
Even this particular problem fixed, sanity check occasionally fails:
Failed sanity check: pplayer_can_make_treaty(pplayer, pplayer2,
DS_ALLIANCE) != DIPL_ALLIANCE_PROBLEM (server/sanitycheck.c:478)
- ML
diff -Nurd -X.diff_ignore freeciv/server/plrhand.c freeciv/server/plrhand.c
--- freeciv/server/plrhand.c 2006-07-18 15:11:07.312500000 +0300
+++ freeciv/server/plrhand.c 2006-07-19 04:27:05.703125000 +0300
@@ -637,7 +637,7 @@
"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(pplayer, other->player_no,
+ handle_diplomacy_cancel_pact(other, pplayer->player_no,
CLAUSE_ALLIANCE);
} else {
/* We are in the same team as the agressor; we cannot break
@@ -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(pplayer3, pplayer1->player_no,
CLAUSE_ALLIANCE);
+ handle_diplomacy_cancel_pact(pplayer3, pplayer2->player_no,
CLAUSE_ALLIANCE);
+ }
+ } players_iterate_end;
+
return;
} else {
assert(pplayer_get_diplstate(pplayer2, pplayer1)->type != DS_NO_CONTACT);
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally, Marko Lindqvist, 2006/07/09
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally, Marko Lindqvist, 2006/07/09
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally, Marko Lindqvist, 2006/07/14
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally, Per I. Mathisen, 2006/07/14
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally, Jason Dorje Short, 2006/07/14
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally, Marko Lindqvist, 2006/07/16
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally, Per I. Mathisen, 2006/07/17
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally,
Marko Lindqvist <=
- [Freeciv-Dev] Re: (PR#18261) Trying to attack ally, Marko Lindqvist, 2006/07/19
|
|