[Freeciv-Dev] (PR#8871) put specialist configuration info into an array
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#8871) put specialist configuration info into an array |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Sat, 29 May 2004 17:18:02 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8871 >
This patch puts the specialists configuration data (min_size and bonus
info) into an array. This is done in game.h and packets.def.
Most users are just search-and-replace changed into the new interface.
A few users are simplified.
jason
? diff
? ferries
? flags
? data/flags
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.373
diff -u -r1.373 packhand.c
--- client/packhand.c 29 May 2004 20:57:16 -0000 1.373
+++ client/packhand.c 30 May 2004 00:17:14 -0000
@@ -2675,12 +2675,10 @@
{
int i;
- game.rgame.min_size_elvis = packet->min_size_elvis;
- game.rgame.min_size_taxman = packet->min_size_taxman;
- game.rgame.min_size_scientist = packet->min_size_scientist;
- game.rgame.base_elvis = packet->base_elvis;
- game.rgame.base_scientist = packet->base_scientist;
- game.rgame.base_taxman = packet->base_taxman;
+ for (i = 0; i < T_COUNT; i++) {
+ game.rgame.specialists[i].min_size = packet->specialist_min_size[i];
+ game.rgame.specialists[i].bonus = packet->specialist_bonus[i];
+ }
game.rgame.changable_tax = packet->changable_tax;
game.rgame.forced_science = packet->forced_science;
game.rgame.forced_luxury = packet->forced_luxury;
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.166
diff -u -r1.166 capstr.c
--- common/capstr.c 21 May 2004 19:03:43 -0000 1.166
+++ common/capstr.c 30 May 2004 00:17:14 -0000
@@ -77,7 +77,7 @@
#define CAPABILITY "+1.14.delta +last_turns_shield_surplus veteran +orders " \
"+starter +union +iso_maps +orders2client " \
"+change_production +tilespec1 +no_earth +trans " \
- "+want_hack invasions bombard +killstack2 spec"
+ "+want_hack invasions bombard +killstack2 spec +spec2"
/* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
*
@@ -117,6 +117,8 @@
* "bombard" means units support the bombard ability.
*
* "spec" is configurable specialists
+ *
+ * "spec2" is semi-configurable specialists in an array
*/
void init_our_capability(void)
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.213
diff -u -r1.213 city.c
--- common/city.c 29 May 2004 20:57:16 -0000 1.213
+++ common/city.c 30 May 2004 00:17:14 -0000
@@ -1821,13 +1821,13 @@
pcity->tax_total = tax;
pcity->luxury_total = lux;
- pcity->luxury_total
- += (pcity->specialists[SP_ELVIS] * game.rgame.base_elvis);
- pcity->science_total
- += (pcity->specialists[SP_SCIENTIST] * game.rgame.base_scientist);
- pcity->tax_total
- += ((pcity->specialists[SP_TAXMAN] * game.rgame.base_taxman)
- + get_city_tithes_bonus(pcity));
+ pcity->luxury_total += (pcity->specialists[SP_ELVIS]
+ * game.rgame.specialists[SP_ELVIS].bonus);
+ pcity->science_total += (pcity->specialists[SP_SCIENTIST]
+ * game.rgame.specialists[SP_SCIENTIST].bonus);
+ pcity->tax_total += ((pcity->specialists[SP_TAXMAN]
+ * game.rgame.specialists[SP_TAXMAN].bonus)
+ + get_city_tithes_bonus(pcity));
}
/**************************************************************************
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.140
diff -u -r1.140 game.h
--- common/game.h 25 May 2004 00:40:20 -0000 1.140
+++ common/game.h 30 May 2004 00:17:14 -0000
@@ -186,12 +186,9 @@
/* values from game.ruleset */
struct {
- int min_size_elvis;
- int min_size_taxman;
- int min_size_scientist;
- int base_elvis;
- int base_scientist;
- int base_taxman;
+ struct {
+ int min_size, bonus;
+ } specialists[T_COUNT];
bool changable_tax;
int forced_science; /* only relevant if !changable_tax */
int forced_luxury;
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.24
diff -u -r1.24 packets.def
--- common/packets.def 27 May 2004 22:14:18 -0000 1.24
+++ common/packets.def 30 May 2004 00:17:15 -0000
@@ -956,12 +956,8 @@
end
PACKET_RULESET_GAME=97;sc,lsend
- UINT8 min_size_elvis; add-cap(spec)
- UINT8 min_size_taxman; add-cap(spec)
- UINT8 min_size_scientist; add-cap(spec)
- UINT8 base_elvis; add-cap(spec)
- UINT8 base_scientist; add-cap(spec)
- UINT8 base_taxman; add-cap(spec)
+ UINT8 specialist_min_size[T_COUNT];
+ UINT8 specialist_bonus[T_COUNT];
BOOL changable_tax; add-cap(spec)
UINT8 forced_science; add-cap(spec)
UINT8 forced_luxury; add-cap(spec)
Index: server/cityhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v
retrieving revision 1.130
diff -u -r1.130 cityhand.c
--- server/cityhand.c 29 May 2004 20:57:16 -0000 1.130
+++ server/cityhand.c 30 May 2004 00:17:15 -0000
@@ -74,9 +74,7 @@
if (to < 0 || to >= SP_COUNT
|| from < 0 || from >= SP_COUNT
- || (to == SP_ELVIS && pcity->size < game.rgame.min_size_elvis)
- || (to == SP_TAXMAN && pcity->size < game.rgame.min_size_taxman)
- || (to == SP_SCIENTIST && pcity->size < game.rgame.min_size_scientist)
+ || pcity->size < game.rgame.specialists[to].min_size
|| pcity->specialists[from] == 0) {
freelog(LOG_ERROR, "Error in specialist change request from client.");
return;
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.173
diff -u -r1.173 ruleset.c
--- server/ruleset.c 23 May 2004 17:06:42 -0000 1.173
+++ server/ruleset.c 30 May 2004 00:17:16 -0000
@@ -2495,17 +2495,17 @@
/* Specialist options */
- game.rgame.min_size_elvis =
+ game.rgame.specialists[SP_ELVIS].min_size =
secfile_lookup_int_default(file, 0, "specialist.min_size_elvis");
- game.rgame.min_size_taxman =
- secfile_lookup_int_default(file, 5, "specialist.min_size_taxman");
- game.rgame.min_size_scientist =
+ game.rgame.specialists[SP_SCIENTIST].min_size =
secfile_lookup_int_default(file, 5, "specialist.min_size_scientist");
- game.rgame.base_elvis =
+ game.rgame.specialists[SP_TAXMAN].min_size =
+ secfile_lookup_int_default(file, 5, "specialist.min_size_taxman");
+ game.rgame.specialists[SP_ELVIS].bonus =
secfile_lookup_int_default(file, 2, "specialist.base_elvis");
- game.rgame.base_scientist =
+ game.rgame.specialists[SP_SCIENTIST].bonus =
secfile_lookup_int_default(file, 3, "specialist.base_scientist");
- game.rgame.base_taxman =
+ game.rgame.specialists[SP_TAXMAN].bonus =
secfile_lookup_int_default(file, 3, "specialist.base_taxman");
game.rgame.changable_tax =
secfile_lookup_bool_default(file, TRUE, "specialist.changable_tax");
@@ -2520,9 +2520,8 @@
freelog(LOG_FATAL, "Forced taxes do not add up in ruleset!");
exit(EXIT_FAILURE);
}
- if (game.rgame.min_size_elvis > 0 && game.rgame.min_size_taxman > 0
- && game.rgame.min_size_scientist > 0) {
- freelog(LOG_FATAL, "At least one specialist must be available without a "
+ if (game.rgame.specialists[SP_ELVIS].min_size > 0) {
+ freelog(LOG_FATAL, "Elvises must be available without a "
"city size restriction!");
exit(EXIT_FAILURE);
}
@@ -3095,12 +3094,10 @@
int i;
struct packet_ruleset_game misc_p;
- misc_p.min_size_elvis = game.rgame.min_size_elvis;
- misc_p.min_size_taxman = game.rgame.min_size_taxman;
- misc_p.min_size_scientist = game.rgame.min_size_scientist;
- misc_p.base_elvis = game.rgame.base_elvis;
- misc_p.base_scientist = game.rgame.base_scientist;
- misc_p.base_taxman = game.rgame.base_taxman;
+ for (i = 0; i < T_COUNT; i++) {
+ misc_p.specialist_min_size[i] = game.rgame.specialists[i].min_size;
+ misc_p.specialist_bonus[i] = game.rgame.specialists[i].bonus;
+ }
misc_p.changable_tax = game.rgame.changable_tax;
misc_p.forced_science = game.rgame.forced_science;
misc_p.forced_luxury = game.rgame.forced_luxury;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#8871) put specialist configuration info into an array,
Jason Short <=
|
|