[Freeciv-Dev] (PR#11400) specialists in the server
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11400 >
This patch removes two specific references to specific specialist types
in the server.
- In the endgame report, don't show types of individual specialists.
Just show the number of total specialists.
- When shrinking a city we look first to remove specialists from it
(ideally this should be done via a CM call - cm_remove_one). Currently
this looks at each specialist in turn by name, but it's just as easy to
do it without naming the specialists.
jason
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.281
diff -u -r1.281 cityturn.c
--- server/cityturn.c 8 Dec 2004 04:18:09 -0000 1.281
+++ server/cityturn.c 8 Dec 2004 05:23:22 -0000
@@ -403,16 +403,17 @@
/* First try to kill off the specialists */
while (pop_loss > 0 && city_specialists(pcity) > 0) {
- if (pcity->specialists[SP_TAXMAN] > 0) {
- pcity->specialists[SP_TAXMAN]--;
- } else if (pcity->specialists[SP_SCIENTIST] > 0) {
- pcity->specialists[SP_SCIENTIST]--;
- } else {
- assert(pcity->specialists[SP_ELVIS] > 0);
- pcity->specialists[SP_ELVIS]--;
+ Specialist_type_id sp;
+
+ for (sp = SP_COUNT - 1; sp >= 0; sp--) {
+ if (pcity->specialists[sp] > 0) {
+ pcity->specialists[sp]--;
+ pop_loss--;
+ break;
+ }
}
- pop_loss--;
}
+ assert(pop_loss == 0 || city_specialists(pcity) == 0);
/* we consumed all the pop_loss in specialists */
if (pop_loss == 0) {
Index: server/report.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/report.c,v
retrieving revision 1.56
diff -u -r1.56 report.c
--- server/report.c 30 Nov 2004 02:08:22 -0000 1.56
+++ server/report.c 8 Dec 2004 05:23:22 -0000
@@ -492,19 +492,15 @@
return pplayer->score.unhappy;
}
-static int get_taxmen(struct player *pplayer)
+static int get_specialists(struct player *pplayer)
{
- return pplayer->score.specialists[SP_TAXMAN];
-}
+ int count = 0;
-static int get_scientists(struct player *pplayer)
-{
- return pplayer->score.specialists[SP_SCIENTIST];
-}
+ specialist_type_iterate(sp) {
+ count += pplayer->score.specialists[sp];
+ } specialist_type_iterate_end;
-static int get_elvis(struct player *pplayer)
-{
- return pplayer->score.specialists[SP_ELVIS];
+ return count;
}
static int get_gov(struct player *pplayer)
@@ -901,9 +897,7 @@
{"happypop", get_happypop},
{"contentpop", get_contentpop},
{"unhappypop", get_unhappypop},
- {"taxmen", get_taxmen},
- {"scientists", get_scientists},
- {"elvis", get_elvis},
+ {"specialists", get_specialists},
{"gov", get_gov},
{"corruption", get_corruption} /* new 1.11.5 tags end here */
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#11400) specialists in the server,
Jason Short <=
|
|