[Freeciv-Dev] capital cities in intelligence report
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
This patch adds the name of the capital city to the intelligence
report (that is, for players who you have an embassy with).
This is particularly useful now for civil wars and spaceraces.
The capital city name is only shown if the client knows about
that city -- that is, if the capital city is on the known part
of the map. (This is because its easier, because the client
actually already has the information, so I don't have to make
any protocol changes.)
If the capital isn't on your map, _or_ if there is no capital,
its shown as "(Unknown)". (That is, in general "(Unknown)" could
mean either of these two cases).
For this patch I moved find_capital() from server/citytools to
common/player.
-- David
diff -u -r --exclude-from exclude freeciv-cvs/client/Freeciv.h
freeciv-mod/client/Freeciv.h
--- freeciv-cvs/client/Freeciv.h Fri Feb 19 22:51:48 1999
+++ freeciv-mod/client/Freeciv.h Sat Feb 20 14:28:44 1999
@@ -107,7 +107,9 @@
"Freeciv*intelluxlabel.background: lightgrey",
"Freeciv*intelreslabel.fromVert: intelgoldlabel",
"Freeciv*intelreslabel.background: lightgrey",
-"Freeciv*inteltechlist.fromVert: intelreslabel",
+"Freeciv*intelcapitallabel.fromVert: intelreslabel",
+"Freeciv*intelcapitallabel.background: lightgrey",
+"Freeciv*inteltechlist.fromVert: intelcapitallabel",
"Freeciv*inteltechlist.forceColumns: true",
"Freeciv*inteltechlist.defaultColumns: 3",
"Freeciv*inteltechlist.verticalList: true",
diff -u -r --exclude-from exclude freeciv-cvs/client/inteldlg.c
freeciv-mod/client/inteldlg.c
--- freeciv-cvs/client/inteldlg.c Fri Oct 16 22:18:01 1998
+++ freeciv-mod/client/inteldlg.c Sat Feb 20 14:44:02 1999
@@ -68,6 +68,7 @@
{
Widget form, title, close;
char buf[64];
+ struct city *pcity;
static char *tech_list_names_ptrs[A_LAST+1];
static char tech_list_names[A_LAST+1][200];
@@ -149,7 +150,13 @@
XtNlabel, buf,
NULL);
-
+ pcity = find_palace(p);
+ sprintf(buf, "Capital: %s", (pcity==NULL)?"(Unknown)":pcity->name);
+ XtVaCreateManagedWidget("intelcapitallabel",
+ labelWidgetClass,
+ form,
+ XtNlabel, buf,
+ NULL);
for(i=1, j=0; i<A_LAST; i++)
if(get_invention(p, i)==TECH_KNOWN) {
diff -u -r --exclude-from exclude freeciv-cvs/common/player.c
freeciv-mod/common/player.c
--- freeciv-cvs/common/player.c Tue Feb 16 21:50:57 1999
+++ freeciv-mod/common/player.c Sat Feb 20 14:34:05 1999
@@ -376,6 +376,18 @@
}
/**************************************************************************
+Locate the city where the players palace is located, (NULL Otherwise)
+**************************************************************************/
+struct city *find_palace(struct player *pplayer)
+{
+ city_list_iterate(pplayer->cities, pcity)
+ if (city_got_building(pcity, B_PALACE))
+ return pcity;
+ city_list_iterate_end;
+ return NULL;
+}
+
+/**************************************************************************
...
**************************************************************************/
int player_knows_improvement_tech(struct player *pplayer,
diff -u -r --exclude-from exclude freeciv-cvs/common/player.h
freeciv-mod/common/player.h
--- freeciv-cvs/common/player.h Tue Feb 16 21:50:57 1999
+++ freeciv-mod/common/player.h Sat Feb 20 14:34:28 1999
@@ -165,6 +165,8 @@
int player_knows_improvement_tech(struct player *pplayer,
enum improvement_type_id id);
+struct city *find_palace(struct player *pplayer);
+
int ai_handicap(struct player *pplayer, enum handicap_type htype);
int ai_fuzzy(struct player *pplayer, int normal_decision);
diff -u -r --exclude-from exclude freeciv-cvs/data/Freeciv
freeciv-mod/data/Freeciv
--- freeciv-cvs/data/Freeciv Fri Feb 19 22:51:49 1999
+++ freeciv-mod/data/Freeciv Sat Feb 20 14:28:00 1999
@@ -157,7 +157,10 @@
Freeciv*intelreslabel.fromVert: intelgoldlabel
Freeciv*intelreslabel.background: lightgrey
-Freeciv*inteltechlist.fromVert: intelreslabel
+Freeciv*intelcapitallabel.fromVert: intelreslabel
+Freeciv*intelcapitallabel.background: lightgrey
+
+Freeciv*inteltechlist.fromVert: intelcapitallabel
Freeciv*inteltechlist.forceColumns: true
Freeciv*inteltechlist.defaultColumns: 3
Freeciv*inteltechlist.verticalList: true
diff -u -r --exclude-from exclude freeciv-cvs/server/citytools.c
freeciv-mod/server/citytools.c
--- freeciv-cvs/server/citytools.c Thu Feb 11 18:05:47 1999
+++ freeciv-mod/server/citytools.c Sat Feb 20 14:40:04 1999
@@ -67,20 +67,6 @@
}
/**************************************************************************
-Locate the city where the players palace is located, (NULL Otherwise)
-**************************************************************************/
-
-struct city *find_palace(struct player *pplayer)
-{
- city_list_iterate(pplayer->cities, pcity)
- if (city_got_building(pcity, B_PALACE))
- return pcity;
- city_list_iterate_end;
- return NULL;
-}
-
-
-/**************************************************************************
...
**************************************************************************/
diff -u -r --exclude-from exclude freeciv-cvs/server/citytools.h
freeciv-mod/server/citytools.h
--- freeciv-cvs/server/citytools.h Sun Jan 17 20:46:16 1999
+++ freeciv-mod/server/citytools.h Sat Feb 20 14:34:20 1999
@@ -25,7 +25,6 @@
int city_got_barracks(struct city *pcity);
int can_sell_building(struct city *pcity, int id);
struct city *find_city_wonder(enum improvement_type_id id);
-struct city *find_palace(struct player *pplayer);
int city_specialists(struct city *pcity); /* elv+tax+scie */
int content_citizens(struct player *pplayer);
int get_temple_power(struct city *pcity);
- [Freeciv-Dev] capital cities in intelligence report,
David Pfitzner <=
|
|