Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2006:
[Freeciv-Dev] (PR#16475) Fix team bug
Home

[Freeciv-Dev] (PR#16475) Fix team bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#16475) Fix team bug
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 16 Apr 2006 10:07:38 -0700
Reply-to: bugs@xxxxxxxxxxx

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

In r10736 / PR#13429 team research was made mandatory for teams. However,
some utility functions remained unchanged since the original design, which
means that they allow cancellation of team -> alliance. This introduces a
subtle bug in some games. This patch fixes the problem.

  - Per

Index: common/player.c
===================================================================
--- common/player.c     (revision 11855)
+++ common/player.c     (working copy)
@@ -50,12 +52,10 @@
   if (p1 == p2 || ds == DS_WAR) {
     return DIPL_ERROR;
   }
-  if (players_on_same_team(p1, p2)
-      && ds == DS_ALLIANCE) {
+  if (players_on_same_team(p1, p2)) {
     return DIPL_ERROR;
   }
   if (p1->diplstates[p2->player_no].has_reason_to_cancel == 0
-      && ds != DS_TEAM
       && get_player_bonus(p1, EFT_HAS_SENATE) > 0
       && get_player_bonus(p1, EFT_ANY_GOVERNMENT) == 0) {
     return DIPL_SENATE_BLOCKING;
@@ -117,8 +118,9 @@
   if (treaty == DS_WAR 
       || treaty == DS_NO_CONTACT 
       || treaty == DS_ARMISTICE 
+      || treaty == DS_TEAM
       || treaty == DS_LAST) {
-    return DIPL_ERROR; /* these are not positive treaties */
+    return DIPL_ERROR; /* these are not negotiable treaties */
   }
   if (treaty == DS_CEASEFIRE && existing != DS_WAR) {
     return DIPL_ERROR; /* only available from war */
@@ -127,11 +129,6 @@
       && (existing != DS_WAR && existing != DS_CEASEFIRE)) {
     return DIPL_ERROR;
   }
-  if (treaty == DS_TEAM
-      && (!players_on_same_team(p1, p2)
-          || existing == DS_TEAM)) {
-    return DIPL_ERROR;
-  }
   if (treaty == DS_ALLIANCE
       && (!is_valid_alliance(p1, p2) || !is_valid_alliance(p2, p1))) {
     return DIPL_ALLIANCE_PROBLEM;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#16475) Fix team bug, Per I. Mathisen <=