Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] (PR#11875) Clean up teams
Home

[Freeciv-Dev] (PR#11875) Clean up teams

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11875) Clean up teams
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 9 Jan 2005 14:04:07 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch removes the option of breaking out from a team research
collective. That also means that we no longer need the code to be able to
rejoin one, probably fixing a lot of bugs in the process. This latter code
was only present in the gtk clients anyway.

Lots of lines of code removed, one changed.

  - Per

Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.55
diff -u -r1.55 advdiplomacy.c
--- ai/advdiplomacy.c   6 Jan 2005 15:44:30 -0000       1.55
+++ ai/advdiplomacy.c   9 Jan 2005 22:01:28 -0000
@@ -243,10 +243,6 @@
     } players_iterate_end;
   break;
 
-  case CLAUSE_TEAM:
-    worth = 1;
-    break;
-
   case CLAUSE_ALLIANCE:
   case CLAUSE_PEACE:
   case CLAUSE_CEASEFIRE:
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.148
diff -u -r1.148 climisc.c
--- client/climisc.c    25 Dec 2004 20:38:14 -0000      1.148
+++ client/climisc.c    9 Jan 2005 22:01:28 -0000
@@ -280,9 +280,6 @@
   case CLAUSE_ALLIANCE:
     my_snprintf(buf, bufsiz, _("The parties create an alliance"));
     break;
-  case CLAUSE_TEAM:
-    my_snprintf(buf, bufsiz, _("The parties resume the research pool"));
-    break;
   case CLAUSE_VISION:
     my_snprintf(buf, bufsiz, _("The %s gives shared vision"),
                get_nation_name_plural(pclause->from->nation));
Index: client/gui-gtk/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/diplodlg.c,v
retrieving revision 1.45
diff -u -r1.45 diplodlg.c
--- client/gui-gtk/diplodlg.c   5 Jan 2005 14:01:43 -0000       1.45
+++ client/gui-gtk/diplodlg.c   9 Jan 2005 22:01:29 -0000
@@ -108,7 +108,6 @@
 static void diplomacy_dialog_ceasefire_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_peace_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_alliance_callback(GtkWidget *w, gpointer data);
-static void diplomacy_dialog_team_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_vision_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_embassy_callback(GtkWidget *w, gpointer data);
 static void close_diplomacy_dialog(struct Diplomacy_dialog *pdialog);
@@ -498,19 +497,6 @@
   gtk_signal_connect(GTK_OBJECT(item),"activate",
        GTK_SIGNAL_FUNC(diplomacy_dialog_alliance_callback),(gpointer)pdialog);
 
-  if (plr0->team != TEAM_NONE && plr0->team == plr1->team) {
-    const struct player_diplstate *ds = pplayer_get_diplstate(plr0, plr1);
-
-    item = gtk_menu_item_new_with_label(Q_("?diplomatic_state:Team"));
-    gtk_menu_append(GTK_MENU(pdialog->dip_pact_menu), item);
-    gtk_signal_connect(GTK_OBJECT(item), "activate",
-                     GTK_SIGNAL_FUNC(diplomacy_dialog_team_callback), 
-                     (gpointer)pdialog);
-    if (ds->type == DS_TEAM) {
-      gtk_widget_set_sensitive(item, FALSE);
-    }
-  }
-
   gtk_widget_show_all(pdialog->dip_pact_menu);
 
   button=gtk_button_new_with_label(_("Pacts"));
@@ -792,14 +778,6 @@
 /****************************************************************
 ...
 *****************************************************************/
-static void diplomacy_dialog_team_callback(GtkWidget *w, gpointer data)
-{
-  diplomacy_dialog_add_pact_clause(w, data, CLAUSE_TEAM);
-}
-
-/****************************************************************
-...
-*****************************************************************/
 static void diplomacy_dialog_vision_callback(GtkWidget *w, gpointer data)
 {
   struct Diplomacy_dialog *pdialog=(struct Diplomacy_dialog *)data;
Index: client/gui-gtk-2.0/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/diplodlg.c,v
retrieving revision 1.24
diff -u -r1.24 diplodlg.c
--- client/gui-gtk-2.0/diplodlg.c       8 Dec 2004 20:48:33 -0000       1.24
+++ client/gui-gtk-2.0/diplodlg.c       9 Jan 2005 22:01:29 -0000
@@ -80,7 +80,6 @@
 static void diplomacy_dialog_ceasefire_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_peace_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_alliance_callback(GtkWidget *w, gpointer data);
-static void diplomacy_dialog_team_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_vision_callback(GtkWidget *w, gpointer data);
 static void diplomacy_dialog_embassy_callback(GtkWidget *w, gpointer data);
 static void close_diplomacy_dialog(struct Diplomacy_dialog *pdialog);
@@ -356,18 +355,6 @@
     g_signal_connect(item, "activate",
                     G_CALLBACK(diplomacy_dialog_alliance_callback), pdialog);
 
-    if (plr0->team != TEAM_NONE && plr0->team == plr1->team) {
-      const struct player_diplstate *ds = pplayer_get_diplstate(plr0, plr1);
-
-      item = gtk_menu_item_new_with_mnemonic(Q_("?diplomatic_state:Team"));
-      gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-      g_signal_connect(item, "activate",
-                       G_CALLBACK(diplomacy_dialog_team_callback), pdialog);
-      if (ds->type == DS_TEAM) {
-        gtk_widget_set_sensitive(item, FALSE);
-      }
-    }
-
     item = gtk_menu_item_new_with_mnemonic(_("_Pacts"));
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);
     gtk_menu_shell_append(GTK_MENU_SHELL(parent), item);
@@ -773,14 +760,6 @@
 /****************************************************************
 ...
 *****************************************************************/
-static void diplomacy_dialog_team_callback(GtkWidget *w, gpointer data)
-{
-  diplomacy_dialog_add_pact_clause(w, data, CLAUSE_TEAM);
-}
-
-/****************************************************************
-...
-*****************************************************************/
 static void diplomacy_dialog_vision_callback(GtkWidget *w, gpointer data)
 {
   struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
Index: common/diptreaty.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/diptreaty.h,v
retrieving revision 1.17
diff -u -r1.17 diptreaty.h
--- common/diptreaty.h  12 Dec 2004 03:44:47 -0000      1.17
+++ common/diptreaty.h  9 Jan 2005 22:01:29 -0000
@@ -18,11 +18,10 @@
 enum clause_type { CLAUSE_ADVANCE, CLAUSE_GOLD, CLAUSE_MAP,
                   CLAUSE_SEAMAP, CLAUSE_CITY, 
                   CLAUSE_CEASEFIRE, CLAUSE_PEACE, CLAUSE_ALLIANCE,
-                  CLAUSE_VISION, CLAUSE_TEAM, CLAUSE_EMBASSY, CLAUSE_LAST };
+                  CLAUSE_VISION, CLAUSE_EMBASSY, CLAUSE_LAST };
 
 #define is_pact_clause(x)                                                   \
-  ((x == CLAUSE_CEASEFIRE) || (x == CLAUSE_PEACE) || (x == CLAUSE_ALLIANCE) \
-   || (x == CLAUSE_TEAM))
+  ((x == CLAUSE_CEASEFIRE) || (x == CLAUSE_PEACE) || (x == CLAUSE_ALLIANCE))
 
 /* For when we need to iterate over treaties */
 struct Clause;
Index: data/trident/units.png
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident/units.png,v
retrieving revision 1.3
diff -u -r1.3 units.png
Binary files /tmp/cvsOsREU1 and units.png differ
Index: server/diplhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplhand.c,v
retrieving revision 1.89
diff -u -r1.89 diplhand.c
--- server/diplhand.c   9 Dec 2004 16:38:35 -0000       1.89
+++ server/diplhand.c   9 Jan 2005 22:01:29 -0000
@@ -278,13 +278,6 @@
          }
 
          break;
-       case CLAUSE_TEAM:
-          /* Limitation: Only for teams */
-          if (!players_on_same_team(pother, pplayer)) {
-            freelog(LOG_ERROR, "Attempted to make team in-game!");
-            goto cleanup;
-          }
-          break;
        case CLAUSE_ALLIANCE:
           /* We need to recheck this way since things might have
            * changed. */
@@ -453,48 +446,6 @@
        check_city_workers(pplayer);
        check_city_workers(pother);
        break;
-      case CLAUSE_TEAM:
-        notify_player_ex(pgiver, NULL, E_TREATY_ALLIANCE,
-                         _("Game: You start a research pool with %s."),
-                         pdest->name);
-        notify_player_ex(pdest, NULL, E_TREATY_ALLIANCE,
-                         _("Game: You start a research pool with %s."),
-                         pgiver->name);
-        gamelog(GAMELOG_TREATY, GL_TEAM, pgiver, pdest);
-        /* We must share and average research */
-        {
-          int average = (pplayer->research.bulbs_researched
-                         + pother->research.bulbs_researched) / 2;
-          int average2 = (pplayer->research.bulbs_researched_before
-                          + pother->research.bulbs_researched_before) / 2;
-          int tech;
- 
-          for (tech = 0; tech < A_LAST; tech++) {
-            if (!tech_exists(tech)) {
-              continue;
-            }
-            if (get_invention(pplayer, tech) != TECH_KNOWN
-                && get_invention(pother, tech) == TECH_KNOWN) {
-              found_new_tech(pplayer, tech, FALSE, TRUE, A_NONE);
-            }
-            if (get_invention(pother, tech) != TECH_KNOWN
-                && get_invention(pplayer, tech) == TECH_KNOWN) {
-              found_new_tech(pother, tech, FALSE, TRUE, A_NONE);
-            }
-          }
-          pplayer->research.bulbs_researched = average;
-          pother->research.bulbs_researched = average;
-          pother->research.researching = pplayer->research.researching;
-          pother->research.changed_from = pplayer->research.changed_from;
-          pplayer->research.bulbs_researched_before = average2;
-          pother->research.bulbs_researched_before = average2;
-          pother->ai.tech_goal = pplayer->ai.tech_goal;
-        }
-        pgiver->diplstates[pdest->player_no].type = DS_TEAM;
-        pdest->diplstates[pgiver->player_no].type = DS_TEAM;
-        check_city_workers(pplayer);
-        check_city_workers(pother);
-        break;
       case CLAUSE_VISION:
        give_shared_vision(pgiver, pdest);
        notify_player_ex(pgiver, NULL, E_TREATY_SHARED_VISION,
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.349
diff -u -r1.349 plrhand.c
--- server/plrhand.c    1 Jan 2005 21:48:10 -0000       1.349
+++ server/plrhand.c    9 Jan 2005 22:01:30 -0000
@@ -1104,9 +1104,8 @@
     return;
   }
 
-  /* Can't break alliance with a team member, but can reduce a team
-   * research to an alliance for stand-alone research. */
-  if (players_on_same_team(pplayer, pplayer2) && old_type != DS_TEAM) {
+  /* Can't break up a team, period. */
+  if (players_on_same_team(pplayer, pplayer2)) {
     return;
   }
 
@@ -1143,9 +1142,6 @@
     new_type = DS_PEACE;
     reppenalty += GAME_MAX_REPUTATION/4;
     break;
-  case DS_TEAM:
-    new_type = DS_ALLIANCE;
-    break;
   default:
     freelog(LOG_ERROR, "non-pact diplstate in handle_player_cancel_pact");
     return;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11875) Clean up teams, Per I. Mathisen <=