Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: New alliances v3 (PR#8394)
Home

[Freeciv-Dev] Re: New alliances v3 (PR#8394)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: New alliances v3 (PR#8394)
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 18 Apr 2004 15:37:24 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8394 >

Attached is a patch on top of v3 which adds one ruleset-specified default
team name for each nation, and some examples.

It adds some flavour, but I am not sure about the usefulness of it.

  - Per

diff -urNX diff_ignore freeciv-alliances/ai/advdiplomacy.c 
freeciv-2alliances/ai/advdiplomacy.c
--- freeciv-alliances/ai/advdiplomacy.c 2004-04-18 15:24:29.000000000 +0200
+++ freeciv-2alliances/ai/advdiplomacy.c        2004-04-19 00:12:36.000000000 
+0200
@@ -1081,8 +1081,7 @@
       } else if (pplayer->team == TEAM_NONE) {
         char teamname[MAX_LEN_NAME];
 
-        snprintf(teamname, sizeof(teamname), _("Pax %s"), 
-                 get_nation_name(pplayer->nation));
+        sz_strlcpy(teamname, get_nation_by_plr(pplayer)->default_team_name);
         /* Fallback in case a human player tries to be clever
          * on us. */
         while (team_find_by_name(teamname) != TEAM_NONE) {
diff -urNX diff_ignore freeciv-alliances/client/gui-gtk-2.0/plrdlg.c 
freeciv-2alliances/client/gui-gtk-2.0/plrdlg.c
--- freeciv-alliances/client/gui-gtk-2.0/plrdlg.c       2004-04-13 
17:54:07.000000000 +0200
+++ freeciv-2alliances/client/gui-gtk-2.0/plrdlg.c      2004-04-19 
00:22:21.000000000 +0200
@@ -743,7 +743,7 @@
   input_dialog_create(GTK_WINDOW(toplevel),
                      _("Create new alliance"),
                      _("What should we call our new alliance?"), 
-                     "Alliance",
+                     get_nation_by_plr(game.player_ptr)->default_team_name,
                      G_CALLBACK(name_new_alliance_callback),
                      GINT_TO_POINTER(1),
                      G_CALLBACK(name_new_alliance_callback),
diff -urNX diff_ignore freeciv-alliances/client/packhand.c 
freeciv-2alliances/client/packhand.c
--- freeciv-alliances/client/packhand.c 2004-04-18 21:24:19.000000000 +0200
+++ freeciv-2alliances/client/packhand.c        2004-04-19 00:32:17.000000000 
+0200
@@ -2601,6 +2601,7 @@
 
   sz_strlcpy(pl->name, p->name);
   sz_strlcpy(pl->name_plural, p->name_plural);
+  sz_strlcpy(pl->default_team_name, p->default_team_name);
   sz_strlcpy(pl->flag_graphic_str, p->graphic_str);
   sz_strlcpy(pl->flag_graphic_alt, p->graphic_alt);
   pl->leader_count = p->leader_count;
diff -urNX diff_ignore freeciv-alliances/common/nation.h 
freeciv-2alliances/common/nation.h
--- freeciv-alliances/common/nation.h   2004-04-18 22:55:25.000000000 +0200
+++ freeciv-2alliances/common/nation.h  2004-04-18 23:47:49.000000000 +0200
@@ -76,6 +76,7 @@
   struct Sprite *flag_sprite;
   char *class;                         /* may be empty */
   char *legend;                                /* may be empty */
+  char default_team_name[MAX_LEN_NAME];
 
   /* civilwar_nations is a NO_NATION_SELECTED-terminated list of index of
    * the nations that can fork from this one.  parent_nations is the inverse
diff -urNX diff_ignore freeciv-alliances/common/packets.def 
freeciv-2alliances/common/packets.def
--- freeciv-alliances/common/packets.def        2004-04-18 21:18:57.000000000 
+0200
+++ freeciv-2alliances/common/packets.def       2004-04-19 00:31:10.000000000 
+0200
@@ -1097,6 +1097,7 @@
   STRING graphic_alt[MAX_LEN_NAME];
   STRING class[MAX_LEN_NAME];
   STRING legend[MAX_LEN_MSG];
+  STRING default_team_name[MAX_LEN_NAME];
 
   UINT8 city_style;
   TECH_LIST init_techs[MAX_NUM_TECH_LIST];
diff -urNX diff_ignore freeciv-alliances/data/nation/american.ruleset 
freeciv-2alliances/data/nation/american.ruleset
--- freeciv-alliances/data/nation/american.ruleset      2003-11-15 
13:41:51.000000000 +0100
+++ freeciv-2alliances/data/nation/american.ruleset     2004-04-19 
00:00:05.000000000 +0200
@@ -71,6 +71,7 @@
 wonder="Statue of Liberty"
 government="Democracy"
 civilwar_nations = "filipino"
+team_name = "Monroe Doctrine"
 
 cities =
   "Washington", "New York", "Boston", "Philadelphia", "Los Angeles",
diff -urNX diff_ignore freeciv-alliances/data/nation/english.ruleset 
freeciv-2alliances/data/nation/english.ruleset
--- freeciv-alliances/data/nation/english.ruleset       2003-11-15 
13:41:51.000000000 +0100
+++ freeciv-2alliances/data/nation/english.ruleset      2004-04-18 
23:57:21.000000000 +0200
@@ -26,6 +26,7 @@
 wonder="King Richard's Crusade"
 government="Democracy"
 civilwar_nations = "american", "australian", "canadian"
+team_name = "The Commonwealth"
 
 cities =
   "London", "Birmingham", "Liverpool", "Manchester", "Leeds", "York",
diff -urNX diff_ignore freeciv-alliances/data/nation/roman.ruleset 
freeciv-2alliances/data/nation/roman.ruleset
--- freeciv-alliances/data/nation/roman.ruleset 2003-11-15 13:41:51.000000000 
+0100
+++ freeciv-2alliances/data/nation/roman.ruleset        2004-04-18 
23:56:54.000000000 +0200
@@ -23,6 +23,7 @@
 wonder="Leonardo's Workshop"
 government="Republic"
 civilwar_nations = "italian", "spanish", "french"
+team_name = "Pax Romana"
 
 cities =
   "Roma", "Capua", "Veii", "Beneventum", "Corfinium", "Ancona",
diff -urNX diff_ignore freeciv-alliances/data/nation/russian.ruleset 
freeciv-2alliances/data/nation/russian.ruleset
--- freeciv-alliances/data/nation/russian.ruleset       2003-11-15 
13:41:51.000000000 +0100
+++ freeciv-2alliances/data/nation/russian.ruleset      2004-04-19 
00:04:34.000000000 +0200
@@ -23,6 +23,7 @@
 wonder="Women's Suffrage"
 government="Communism"
 civilwar_nations = "ukrainian", "polish"
+team_name = "Warsaw Pact"
 
 cities =
   "Moskva", "St. Petersburg", "Tver", "Novgorod",
diff -urNX diff_ignore freeciv-alliances/server/ruleset.c 
freeciv-2alliances/server/ruleset.c
--- freeciv-alliances/server/ruleset.c  2004-04-14 13:39:15.000000000 +0200
+++ freeciv-2alliances/server/ruleset.c 2004-04-19 00:31:48.000000000 +0200
@@ -2339,6 +2339,15 @@
 
     pl->civilwar_nations[j] = NO_NATION_SELECTED;
 
+    /* Load default alliance name */
+    if (section_file_lookup(file, "%s.team_name", sec[i])) {
+      sz_strlcpy(pl->default_team_name, 
+                 secfile_lookup_str(file, "%s.team_name", sec[i]));
+    } else {
+      snprintf(pl->default_team_name, sizeof(pl->default_team_name),
+               _("Pax %s"), pl->name);
+    }
+
     /* Load nation specific initial techs */
 
     lookup_tech_list(file, sec[i], "init_techs", pl->init_techs, filename);
@@ -3013,6 +3022,7 @@
     packet.id = k;
     sz_strlcpy(packet.name, n->name_orig);
     sz_strlcpy(packet.name_plural, n->name_plural_orig);
+    sz_strlcpy(packet.default_team_name, n->default_team_name);
     sz_strlcpy(packet.graphic_str, n->flag_graphic_str);
     sz_strlcpy(packet.graphic_alt, n->flag_graphic_alt);
     packet.leader_count = n->leader_count;

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