Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] (PR#4738) alliance requirements bug
Home

[Freeciv-Dev] (PR#4738) alliance requirements bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#4738) alliance requirements bug
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Fri, 1 Aug 2003 04:41:52 -0700
Reply-to: rt@xxxxxxxxxxxxxx

This fixes a bug with the new alliance requirements code. We required that
our potential ally not only is not at war with any of your current allies,
but also that he has contact with them! The problem is pplayers_at_war()
which, problematically, thinks 'never met' equals 'at war'. I also added a
notification so that you know the difference between a declaration of war
against you particularily and when it happens as a fallout when declaring
someone declares war on one of your allies.

Unless I get protests, this will go in soon, since it is needed for the
new version of the AI diplomacy patch coming soon.

  - Per

"This is the future for the world we're in at the moment,"
promised Lawrence Di Rita, special assistant to Rumsfeld.
"We'll get better as we do it more often."

Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.120
diff -u -r1.120 player.c
--- common/player.c     2003/07/03 18:18:51     1.120
+++ common/player.c     2003/08/01 11:01:14
@@ -47,10 +47,11 @@
 bool pplayer_can_ally(struct player *p1, struct player *p2)
 {
   players_iterate(pplayer) {
+    enum diplstate_type ds = pplayer_get_diplstate(p1, pplayer)->type;
     if (pplayer != p1
         && pplayer != p2
         && pplayers_allied(p2, pplayer)
-        && pplayers_at_war(p1, pplayer)
+        && ds == DS_WAR /* do not count 'never met' as war here */
         && pplayer->is_alive) {
       return FALSE;
     }
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.281
diff -u -r1.281 plrhand.c
--- server/plrhand.c    2003/07/21 01:43:52     1.281
+++ server/plrhand.c    2003/08/01 11:26:25
@@ -967,6 +967,10 @@
        * war against all of B's allies. Yes, A gets the blame. */
       packet.id = other->player_no;
       packet.value1 = CLAUSE_LAST;
+      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_player_cancel_pact(pplayer, &packet);
     }
   } players_iterate_end;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#4738) alliance requirements bug, Per I. Mathisen <=