[Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Attached is the final (hopefully) version of the pop cost patch. After this,
perhaps I'll take a try at factoring server/cityturn.c:city_build_stuff which
must be one of the ugliest function in Freeciv!
Arien
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/ Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.178
diff -u -r1.178 packhand.c
--- client/packhand.c 2001/08/26 10:29:22 1.178
+++ client/packhand.c 2001/08/27 18:52:33
@@ -1579,6 +1579,7 @@
sz_strlcpy(u->graphic_alt, p->graphic_alt);
u->move_type = p->move_type;
u->build_cost = p->build_cost;
+ u->pop_cost = p->pop_cost;
u->attack_strength = p->attack_strength;
u->defense_strength = p->defense_strength;
u->move_rate = p->move_rate;
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.80
diff -u -r1.80 capstr.c
--- common/capstr.c 2001/06/29 19:39:04 1.80
+++ common/capstr.c 2001/08/27 18:52:34
@@ -70,12 +70,16 @@
* are not directly related to the capability strings discussed here.)
*/
-#define CAPABILITY "+1.11.6 conn_info"
+#define CAPABILITY "+1.11.6 conn_info pop_cost"
/* "+1.11.6" is protocol for 1.11.6 beta release.
"conn_info" is sending the conn_id field. To preserve compatability
with old clients trying to connect this should persist across releases.
+
+ "pop_cost" is the capability of rulesets to specify how many units
+ of population are consumed on unit creation and/or can be added to
+ cities.
*/
void init_our_capability(void)
Index: common/packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.153
diff -u -r1.153 packets.c
--- common/packets.c 2001/08/25 10:25:35 1.153
+++ common/packets.c 2001/08/27 18:52:35
@@ -2792,6 +2792,9 @@
cptr=put_uint8(cptr, packet->paratroopers_mr_req);
cptr=put_uint8(cptr, packet->paratroopers_mr_sub);
}
+ if (has_capability("pop_cost", pc->capability)) {
+ cptr=put_uint8(cptr, packet->pop_cost);
+ }
/* This must be last, so client can determine length: */
if(packet->helptext) {
@@ -2847,6 +2850,11 @@
packet->paratroopers_mr_req=0;
packet->paratroopers_mr_sub=0;
}
+ if (has_capability("pop_cost", pc->capability)) {
+ iget_uint8(&iter, &packet->pop_cost);
+ } else {
+ packet->pop_cost=(packet->flags & (1L<<F_CITIES)) ? 1 : 0;
+ }
len = pack_iter_remaining(&iter);
if (len) {
Index: common/packets.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.h,v
retrieving revision 1.89
diff -u -r1.89 packets.h
--- common/packets.h 2001/06/29 19:39:05 1.89
+++ common/packets.h 2001/08/27 18:52:36
@@ -574,6 +574,7 @@
char graphic_alt[MAX_LEN_NAME];
int move_type;
int build_cost;
+ int pop_cost;
int attack_strength;
int defense_strength;
int move_rate;
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.131
diff -u -r1.131 unit.c
--- common/unit.c 2001/08/26 21:45:23 1.131
+++ common/unit.c 2001/08/27 18:52:37
@@ -422,38 +422,56 @@
enum add_build_city_result test_unit_add_or_build_city(struct unit *punit)
{
struct city *pcity;
+ int new_pop;
+ int is_build = unit_flag(punit->type, F_CITIES);
+ int is_add = unit_flag(punit->type, F_ADD_TO_CITY);
+
pcity = map_get_city(punit->x, punit->y);
- if (!unit_flag(punit->type, F_CITIES))
- return AB_NOT_ADDABLE_UNIT;
+ /* Bail out quickly if unit is not relevant to further
+ calculations. Note that we repeat the tests later on in the right
+ context
+ */
+
+ if (!is_build && !is_add)
+ return (!pcity) ? AB_NOT_BUILD_UNIT : AB_NOT_ADDABLE_UNIT;
+
if (!punit->moves_left) {
if (!pcity)
return AB_NO_MOVES_BUILD;
else
return AB_NO_MOVES_ADD;
}
- if (!pcity) {
- if (city_can_be_built_here(punit->x, punit->y))
- return AB_BUILD_OK;
- else
+
+ if (!pcity) { /* See if we can build */
+ if (!is_build)
+ return AB_NOT_BUILD_UNIT;
+ else if (!city_can_be_built_here(punit->x, punit->y))
return AB_NOT_BUILD_LOC;
+ else
+ return AB_BUILD_OK;
}
- if (pcity->size >= game.add_to_size_limit)
+
+ /* See if we can add */
+
+ new_pop = pcity->size + unit_pop_value(punit->type);
+
+ if (!is_add)
+ return AB_NOT_ADDABLE_UNIT;
+ else if (new_pop > game.add_to_size_limit)
return AB_TOO_BIG;
- if (pcity->owner != punit->owner)
+ else if (pcity->owner != punit->owner)
return AB_NOT_OWNER;
-
- if (improvement_exists(B_AQUEDUCT)
- && !city_got_building(pcity, B_AQUEDUCT)
- && pcity->size >= game.aqueduct_size)
+ else if (improvement_exists(B_AQUEDUCT)
+ && !city_got_building(pcity, B_AQUEDUCT)
+ && new_pop > game.aqueduct_size)
return AB_NO_AQUEDUCT;
-
- if (improvement_exists(B_SEWER)
- && !city_got_building(pcity, B_SEWER)
- && pcity->size >= game.sewer_size)
+ else if (improvement_exists(B_SEWER)
+ && !city_got_building(pcity, B_SEWER)
+ && new_pop > game.sewer_size)
return AB_NO_SEWER;
-
- return AB_ADD_OK;
+ else
+ return AB_ADD_OK;
}
/**************************************************************************
Index: common/unit.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.h,v
retrieving revision 1.76
diff -u -r1.76 unit.h
--- common/unit.h 2001/08/26 21:45:23 1.76
+++ common/unit.h 2001/08/27 18:52:37
@@ -77,6 +77,8 @@
this location */
AB_NOT_ADDABLE_UNIT, /* Unit is not one that can be added
to cities */
+ AB_NOT_BUILD_UNIT, /* Unit is not one that can build
+ cities */
AB_NO_MOVES_BUILD, /* Unit does not have moves left to
build a city */
AB_NO_MOVES_ADD, /* Unit does not have moves left to
Index: common/unittype.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.c,v
retrieving revision 1.3
diff -u -r1.3 unittype.c
--- common/unittype.c 2000/09/11 06:40:38 1.3
+++ common/unittype.c 2001/08/27 18:52:37
@@ -43,7 +43,8 @@
"OneAttack", "Pikemen", "Horse", "IgWall", "FieldUnit", "AEGIS",
"Fighter", "Marines", "Partial_Invis", "Settlers", "Diplomat",
"Trireme", "Nuclear", "Spy", "Transform", "Paratroopers",
- "Airbase", "Cities", "IgTired", "Missile_Carrier", "No_Land_Attack"
+ "Airbase", "Cities", "IgTired", "Missile_Carrier", "No_Land_Attack",
+ "AddToCity"
};
static const char *role_names[] = {
"FirstBuild", "Explorer", "Hut", "HutTech", "Partisan",
@@ -177,6 +178,15 @@
/**************************************************************************
...
**************************************************************************/
+int unit_pop_value(Unit_Type_id id)
+{
+ return (unit_types[id].pop_cost);
+}
+
+/**************************************************************************
+...
+**************************************************************************/
+
char *unit_name(Unit_Type_id id)
{
return (unit_types[id].name);
Index: common/unittype.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.h,v
retrieving revision 1.3
diff -u -r1.3 unittype.h
--- common/unittype.h 2000/09/11 06:40:38 1.3
+++ common/unittype.h 2001/08/27 18:52:37
@@ -103,6 +103,7 @@
F_IGTIRED, /* Ignore tired negative bonus when attacking */
F_MISSILE_CARRIER, /* Like F_CARRIER, but missiles only (Submarine) */
F_NO_LAND_ATTACK, /* Cannot attack vs land squares (Submarine) */
+ F_ADD_TO_CITY, /* unit can add to city population */
F_LAST
};
@@ -147,6 +148,7 @@
struct Sprite *sprite;
enum unit_move_type move_type;
int build_cost;
+ int pop_cost; /* number of workers the unit contains (e.g., settlers,
engineers)*/
int attack_strength;
int defense_strength;
int move_rate;
@@ -188,6 +190,7 @@
int is_ground_unittype(Unit_Type_id id);
int unit_value(Unit_Type_id id);
+int unit_pop_value(Unit_Type_id id);
char *unit_name(Unit_Type_id id);
const char *unit_class_name(Unit_Class_id id);
@@ -221,3 +224,4 @@
Unit_Type_id best_role_unit(struct city *pcity, int role);
#endif /* FC__UNITTYPE_H */
+
Index: data/civ1/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/units.ruleset,v
retrieving revision 1.20
diff -u -r1.20 units.ruleset
--- data/civ1/units.ruleset 2001/07/15 11:11:54 1.20
+++ data/civ1/units.ruleset 2001/08/27 18:52:38
@@ -77,6 +77,7 @@
graphic = "u.settlers"
graphic_alt = "-"
build_cost = 40
+pop_cost = 1
attack = 0
defense = 1
hitpoints = 20
@@ -89,7 +90,7 @@
uk_shield = 1
uk_food = 1
uk_gold = 0
-flags = "Settlers", "NonMil", "Cities"
+flags = "Settlers", "NonMil", "AddToCity", "Cities"
roles = ""
helptext = _("\
Settlers are one of the key units in the game. They can be used to\
@@ -116,6 +117,7 @@
graphic = "u.engineers"
graphic_alt = "-"
build_cost = 40
+pop_cost = 1
attack = 0
defense = 2
hitpoints = 20
@@ -128,7 +130,7 @@
uk_shield = 1
uk_food = 1
uk_gold = 0
-flags = "Settlers", "NonMil", "Cities"
+flags = "Settlers", "NonMil", "AddToCity", "Cities"
roles = ""
[unit_militia]
@@ -139,6 +141,7 @@
graphic = "u.warriors"
graphic_alt = "-"
build_cost = 10
+pop_cost = 0
attack = 1
defense = 1
hitpoints = 10
@@ -166,6 +169,7 @@
graphic = "u.phalanx"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 1
defense = 2
hitpoints = 10
@@ -189,6 +193,7 @@
graphic = "u.archers"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 3
defense = 2
hitpoints = 10
@@ -212,6 +217,7 @@
graphic = "u.legion"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 3
defense = 1
hitpoints = 10
@@ -235,6 +241,7 @@
graphic = "u.pikemen"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 1
defense = 2
hitpoints = 10
@@ -258,6 +265,7 @@
graphic = "u.musketeers"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 2
defense = 3
hitpoints = 20
@@ -282,6 +290,7 @@
graphic = "u.fanatics"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 20
@@ -305,6 +314,7 @@
graphic = "u.partisan"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 20
@@ -328,6 +338,7 @@
graphic = "u.alpine_troops"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 5
defense = 5
hitpoints = 20
@@ -351,6 +362,7 @@
graphic = "u.riflemen"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 3
defense = 5
hitpoints = 20
@@ -374,6 +386,7 @@
graphic = "u.marines"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 8
defense = 5
hitpoints = 20
@@ -397,6 +410,7 @@
graphic = "u.paratroopers"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 6
defense = 4
hitpoints = 20
@@ -420,6 +434,7 @@
graphic = "u.mech_inf"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 6
defense = 6
hitpoints = 30
@@ -448,6 +463,7 @@
graphic = "u.horsemen"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 2
defense = 1
hitpoints = 10
@@ -471,6 +487,7 @@
graphic = "u.chariot"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 1
hitpoints = 10
@@ -494,6 +511,7 @@
graphic = "u.elephants"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 1
hitpoints = 10
@@ -517,6 +535,7 @@
graphic = "u.crusaders"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 5
defense = 1
hitpoints = 10
@@ -540,6 +559,7 @@
graphic = "u.knights"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 2
hitpoints = 10
@@ -564,6 +584,7 @@
graphic = "u.dragoons"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 5
defense = 2
hitpoints = 20
@@ -587,6 +608,7 @@
graphic = "u.cavalry"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 8
defense = 3
hitpoints = 20
@@ -610,6 +632,7 @@
graphic = "u.armor"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 10
defense = 5
hitpoints = 30
@@ -633,6 +656,7 @@
graphic = "u.catapult"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 6
defense = 1
hitpoints = 10
@@ -656,6 +680,7 @@
graphic = "u.cannon"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 8
defense = 1
hitpoints = 20
@@ -679,6 +704,7 @@
graphic = "u.artillery"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 10
defense = 1
hitpoints = 20
@@ -702,6 +728,7 @@
graphic = "u.howitzer"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 12
defense = 2
hitpoints = 30
@@ -725,6 +752,7 @@
graphic = "u.fighter"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 2
hitpoints = 20
@@ -748,6 +776,7 @@
graphic = "u.bomber"
graphic_alt = "-"
build_cost = 120
+pop_cost = 0
attack = 12
defense = 1
hitpoints = 20
@@ -771,6 +800,7 @@
graphic = "u.helicopter"
graphic_alt = "-"
build_cost = 100
+pop_cost = 0
attack = 10
defense = 3
hitpoints = 20
@@ -794,6 +824,7 @@
graphic = "u.stealth_fighter"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 8
defense = 4
hitpoints = 20
@@ -817,6 +848,7 @@
graphic = "u.stealth_bomber"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 14
defense = 5
hitpoints = 20
@@ -840,6 +872,7 @@
graphic = "u.trireme"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 1
defense = 0
hitpoints = 10
@@ -863,6 +896,7 @@
graphic = "u.caravel"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 1
defense = 1
hitpoints = 10
@@ -886,6 +920,7 @@
graphic = "u.galleon"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 0
defense = 2
hitpoints = 20
@@ -909,6 +944,7 @@
graphic = "u.frigate"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 2
defense = 2
hitpoints = 20
@@ -932,6 +968,7 @@
graphic = "u.ironclad"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 30
@@ -955,6 +992,7 @@
graphic = "u.destroyer"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 30
@@ -978,6 +1016,7 @@
graphic = "u.cruiser"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 6
defense = 6
hitpoints = 30
@@ -1001,6 +1040,7 @@
graphic = "u.aegis_cruiser"
graphic_alt = "-"
build_cost = 100
+pop_cost = 0
attack = 8
defense = 8
hitpoints = 30
@@ -1024,6 +1064,7 @@
graphic = "u.battleship"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 18
defense = 12
hitpoints = 40
@@ -1047,6 +1088,7 @@
graphic = "u.submarine"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 8
defense = 2
hitpoints = 30
@@ -1074,6 +1116,7 @@
graphic = "u.carrier"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 1
defense = 12
hitpoints = 40
@@ -1102,6 +1145,7 @@
graphic = "u.transport"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 3
hitpoints = 30
@@ -1125,6 +1169,7 @@
graphic = "u.cruise_missile"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 18
defense = 0
hitpoints = 10
@@ -1148,6 +1193,7 @@
graphic = "u.nuclear"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 99
defense = 0
hitpoints = 10
@@ -1190,6 +1236,7 @@
graphic = "u.diplomat"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
@@ -1231,6 +1278,7 @@
graphic = "u.spy"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
@@ -1254,6 +1302,7 @@
graphic = "u.caravan"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1285,6 +1334,7 @@
graphic = "u.freight"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1308,6 +1358,7 @@
graphic = "u.explorer"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1331,6 +1382,7 @@
graphic = "u.barbarian_leader"
graphic_alt = "u.diplomat"
build_cost = 40
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
Index: data/civ2/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/units.ruleset,v
retrieving revision 1.24
diff -u -r1.24 units.ruleset
--- data/civ2/units.ruleset 2001/07/15 11:11:56 1.24
+++ data/civ2/units.ruleset 2001/08/27 18:52:38
@@ -68,6 +68,7 @@
graphic = "u.settlers"
graphic_alt = "-"
build_cost = 40
+pop_cost = 1
attack = 0
defense = 1
hitpoints = 20
@@ -80,7 +81,7 @@
uk_shield = 1
uk_food = 1
uk_gold = 0
-flags = "Settlers", "NonMil", "Airbase", "Cities"
+flags = "Settlers", "NonMil", "Airbase", "AddToCity", "Cities"
roles = ""
helptext = _("\
Settlers are one of the key units in the game. They can be used to\
@@ -107,6 +108,7 @@
graphic = "u.engineers"
graphic_alt = "-"
build_cost = 40
+pop_cost = 1
attack = 0
defense = 2
hitpoints = 20
@@ -119,7 +121,7 @@
uk_shield = 1
uk_food = 1
uk_gold = 0
-flags = "Settlers", "NonMil", "Transform", "Airbase", "Cities"
+flags = "Settlers", "NonMil", "Transform", "Airbase", "AddToCity",
"Cities"
roles = ""
helptext = _("\
Engineers are similar to Settlers, but they work twice as fast and\
@@ -143,6 +145,7 @@
graphic = "u.warriors"
graphic_alt = "-"
build_cost = 10
+pop_cost = 0
attack = 1
defense = 1
hitpoints = 10
@@ -170,6 +173,7 @@
graphic = "u.phalanx"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 1
defense = 2
hitpoints = 10
@@ -193,6 +197,7 @@
graphic = "u.archers"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 3
defense = 2
hitpoints = 10
@@ -216,6 +221,7 @@
graphic = "u.legion"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 2
hitpoints = 10
@@ -239,6 +245,7 @@
graphic = "u.pikemen"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 1
defense = 2
hitpoints = 10
@@ -262,6 +269,7 @@
graphic = "u.musketeers"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 3
defense = 3
hitpoints = 20
@@ -286,6 +294,7 @@
graphic = "u.fanatics"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 20
@@ -309,6 +318,7 @@
graphic = "u.partisan"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 20
@@ -344,6 +354,7 @@
graphic = "u.alpine_troops"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 5
defense = 5
hitpoints = 20
@@ -367,6 +378,7 @@
graphic = "u.riflemen"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 5
defense = 4
hitpoints = 20
@@ -390,6 +402,7 @@
graphic = "u.marines"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 8
defense = 5
hitpoints = 20
@@ -413,6 +426,7 @@
graphic = "u.paratroopers"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 6
defense = 4
hitpoints = 20
@@ -440,6 +454,7 @@
graphic = "u.mech_inf"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 6
defense = 6
hitpoints = 30
@@ -468,6 +483,7 @@
graphic = "u.horsemen"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 2
defense = 1
hitpoints = 10
@@ -491,6 +507,7 @@
graphic = "u.chariot"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 3
defense = 1
hitpoints = 10
@@ -514,6 +531,7 @@
graphic = "u.elephants"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 1
hitpoints = 10
@@ -537,6 +555,7 @@
graphic = "u.crusaders"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 5
defense = 1
hitpoints = 10
@@ -560,6 +579,7 @@
graphic = "u.knights"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 2
hitpoints = 10
@@ -584,6 +604,7 @@
graphic = "u.dragoons"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 5
defense = 2
hitpoints = 20
@@ -607,6 +628,7 @@
graphic = "u.cavalry"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 8
defense = 3
hitpoints = 20
@@ -630,6 +652,7 @@
graphic = "u.armor"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 10
defense = 5
hitpoints = 30
@@ -653,6 +676,7 @@
graphic = "u.catapult"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 6
defense = 1
hitpoints = 10
@@ -676,6 +700,7 @@
graphic = "u.cannon"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 8
defense = 1
hitpoints = 20
@@ -699,6 +724,7 @@
graphic = "u.artillery"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 10
defense = 1
hitpoints = 20
@@ -722,6 +748,7 @@
graphic = "u.howitzer"
graphic_alt = "-"
build_cost = 70
+pop_cost = 0
attack = 12
defense = 2
hitpoints = 30
@@ -745,6 +772,7 @@
graphic = "u.fighter"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 3
hitpoints = 20
@@ -768,6 +796,7 @@
graphic = "u.bomber"
graphic_alt = "-"
build_cost = 120
+pop_cost = 0
attack = 12
defense = 1
hitpoints = 20
@@ -791,6 +820,7 @@
graphic = "u.helicopter"
graphic_alt = "-"
build_cost = 100
+pop_cost = 0
attack = 10
defense = 3
hitpoints = 20
@@ -820,6 +850,7 @@
graphic = "u.stealth_fighter"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 8
defense = 4
hitpoints = 20
@@ -847,6 +878,7 @@
graphic = "u.stealth_bomber"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 14
defense = 5
hitpoints = 20
@@ -874,6 +906,7 @@
graphic = "u.trireme"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 1
defense = 1
hitpoints = 10
@@ -897,6 +930,7 @@
graphic = "u.caravel"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 2
defense = 1
hitpoints = 10
@@ -920,6 +954,7 @@
graphic = "u.galleon"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 0
defense = 2
hitpoints = 20
@@ -943,6 +978,7 @@
graphic = "u.frigate"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 4
defense = 2
hitpoints = 20
@@ -966,6 +1002,7 @@
graphic = "u.ironclad"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 30
@@ -989,6 +1026,7 @@
graphic = "u.destroyer"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 30
@@ -1016,6 +1054,7 @@
graphic = "u.cruiser"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 6
defense = 6
hitpoints = 30
@@ -1039,6 +1078,7 @@
graphic = "u.aegis_cruiser"
graphic_alt = "-"
build_cost = 100
+pop_cost = 0
attack = 8
defense = 8
hitpoints = 30
@@ -1062,6 +1102,7 @@
graphic = "u.battleship"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 12
defense = 12
hitpoints = 40
@@ -1085,6 +1126,7 @@
graphic = "u.submarine"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 10
defense = 2
hitpoints = 30
@@ -1113,6 +1155,7 @@
graphic = "u.carrier"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 1
defense = 9
hitpoints = 40
@@ -1141,6 +1184,7 @@
graphic = "u.transport"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 3
hitpoints = 30
@@ -1164,6 +1208,7 @@
graphic = "u.cruise_missile"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 18
defense = 0
hitpoints = 10
@@ -1191,6 +1236,7 @@
graphic = "u.nuclear"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 99
defense = 0
hitpoints = 10
@@ -1233,6 +1279,7 @@
graphic = "u.diplomat"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
@@ -1274,6 +1321,7 @@
graphic = "u.spy"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
@@ -1316,6 +1364,7 @@
graphic = "u.caravan"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1347,6 +1396,7 @@
graphic = "u.freight"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1373,6 +1423,7 @@
graphic = "u.explorer"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1399,6 +1450,7 @@
graphic = "u.barbarian_leader"
graphic_alt = "u.diplomat"
build_cost = 40
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
Index: data/default/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/units.ruleset,v
retrieving revision 1.26
diff -u -r1.26 units.ruleset
--- data/default/units.ruleset 2001/07/15 11:11:56 1.26
+++ data/default/units.ruleset 2001/08/27 18:52:39
@@ -68,6 +68,7 @@
graphic = "u.settlers"
graphic_alt = "-"
build_cost = 40
+pop_cost = 2
attack = 0
defense = 1
hitpoints = 20
@@ -80,7 +81,7 @@
uk_shield = 1
uk_food = 1
uk_gold = 0
-flags = "Settlers", "NonMil", "Airbase", "Cities"
+flags = "Settlers", "NonMil", "Airbase", "AddToCity", "Cities"
roles = ""
helptext = _("\
Settlers are one of the key units in the game. They can be used to\
@@ -107,6 +108,7 @@
graphic = "u.engineers"
graphic_alt = "-"
build_cost = 40
+pop_cost = 1
attack = 0
defense = 2
hitpoints = 20
@@ -119,7 +121,7 @@
uk_shield = 1
uk_food = 1
uk_gold = 0
-flags = "Settlers", "NonMil", "Transform", "Airbase", "Cities"
+flags = "Settlers", "NonMil", "Transform", "Airbase", "AddToCity",
"Cities"
roles = ""
helptext = _("\
Engineers are similar to Settlers, but they work twice as fast and\
@@ -143,6 +145,7 @@
graphic = "u.warriors"
graphic_alt = "-"
build_cost = 10
+pop_cost = 0
attack = 1
defense = 1
hitpoints = 10
@@ -170,6 +173,7 @@
graphic = "u.phalanx"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 1
defense = 2
hitpoints = 10
@@ -193,6 +197,7 @@
graphic = "u.archers"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 3
defense = 2
hitpoints = 10
@@ -216,6 +221,7 @@
graphic = "u.legion"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 2
hitpoints = 10
@@ -239,6 +245,7 @@
graphic = "u.pikemen"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 1
defense = 2
hitpoints = 10
@@ -262,6 +269,7 @@
graphic = "u.musketeers"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 3
defense = 3
hitpoints = 20
@@ -286,6 +294,7 @@
graphic = "u.fanatics"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 20
@@ -309,6 +318,7 @@
graphic = "u.partisan"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 20
@@ -344,6 +354,7 @@
graphic = "u.alpine_troops"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 5
defense = 5
hitpoints = 20
@@ -367,6 +378,7 @@
graphic = "u.riflemen"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 5
defense = 4
hitpoints = 20
@@ -390,6 +402,7 @@
graphic = "u.marines"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 8
defense = 5
hitpoints = 20
@@ -413,6 +426,7 @@
graphic = "u.paratroopers"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 6
defense = 4
hitpoints = 20
@@ -440,6 +454,7 @@
graphic = "u.mech_inf"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 6
defense = 6
hitpoints = 30
@@ -468,6 +483,7 @@
graphic = "u.horsemen"
graphic_alt = "-"
build_cost = 20
+pop_cost = 0
attack = 2
defense = 1
hitpoints = 10
@@ -491,6 +507,7 @@
graphic = "u.chariot"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 3
defense = 1
hitpoints = 10
@@ -514,6 +531,7 @@
graphic = "u.elephants"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 1
hitpoints = 10
@@ -537,6 +555,7 @@
graphic = "u.crusaders"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 5
defense = 1
hitpoints = 10
@@ -560,6 +579,7 @@
graphic = "u.knights"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 4
defense = 2
hitpoints = 10
@@ -584,6 +604,7 @@
graphic = "u.dragoons"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 5
defense = 2
hitpoints = 20
@@ -607,6 +628,7 @@
graphic = "u.cavalry"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 8
defense = 3
hitpoints = 20
@@ -630,6 +652,7 @@
graphic = "u.armor"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 10
defense = 5
hitpoints = 30
@@ -653,6 +676,7 @@
graphic = "u.catapult"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 6
defense = 1
hitpoints = 10
@@ -676,6 +700,7 @@
graphic = "u.cannon"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 8
defense = 1
hitpoints = 20
@@ -699,6 +724,7 @@
graphic = "u.artillery"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 10
defense = 1
hitpoints = 20
@@ -722,6 +748,7 @@
graphic = "u.howitzer"
graphic_alt = "-"
build_cost = 70
+pop_cost = 0
attack = 12
defense = 2
hitpoints = 30
@@ -745,6 +772,7 @@
graphic = "u.fighter"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 3
hitpoints = 20
@@ -768,6 +796,7 @@
graphic = "u.bomber"
graphic_alt = "-"
build_cost = 120
+pop_cost = 0
attack = 12
defense = 1
hitpoints = 20
@@ -791,6 +820,7 @@
graphic = "u.helicopter"
graphic_alt = "-"
build_cost = 100
+pop_cost = 0
attack = 10
defense = 3
hitpoints = 20
@@ -820,6 +850,7 @@
graphic = "u.stealth_fighter"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 8
defense = 4
hitpoints = 20
@@ -847,6 +878,7 @@
graphic = "u.stealth_bomber"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 14
defense = 5
hitpoints = 20
@@ -874,6 +906,7 @@
graphic = "u.trireme"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 1
defense = 1
hitpoints = 10
@@ -897,6 +930,7 @@
graphic = "u.caravel"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 2
defense = 1
hitpoints = 10
@@ -920,6 +954,7 @@
graphic = "u.galleon"
graphic_alt = "-"
build_cost = 40
+pop_cost = 0
attack = 0
defense = 2
hitpoints = 20
@@ -943,6 +978,7 @@
graphic = "u.frigate"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 4
defense = 2
hitpoints = 20
@@ -966,6 +1002,7 @@
graphic = "u.ironclad"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 30
@@ -989,6 +1026,7 @@
graphic = "u.destroyer"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 4
defense = 4
hitpoints = 30
@@ -1016,6 +1054,7 @@
graphic = "u.cruiser"
graphic_alt = "-"
build_cost = 80
+pop_cost = 0
attack = 6
defense = 6
hitpoints = 30
@@ -1039,6 +1078,7 @@
graphic = "u.aegis_cruiser"
graphic_alt = "-"
build_cost = 100
+pop_cost = 0
attack = 8
defense = 8
hitpoints = 30
@@ -1062,6 +1102,7 @@
graphic = "u.battleship"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 12
defense = 12
hitpoints = 40
@@ -1085,6 +1126,7 @@
graphic = "u.submarine"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 10
defense = 2
hitpoints = 30
@@ -1113,6 +1155,7 @@
graphic = "u.carrier"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 1
defense = 9
hitpoints = 40
@@ -1141,6 +1184,7 @@
graphic = "u.transport"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 3
hitpoints = 30
@@ -1164,6 +1208,7 @@
graphic = "u.cruise_missile"
graphic_alt = "-"
build_cost = 60
+pop_cost = 0
attack = 18
defense = 0
hitpoints = 10
@@ -1191,6 +1236,7 @@
graphic = "u.nuclear"
graphic_alt = "-"
build_cost = 160
+pop_cost = 0
attack = 99
defense = 0
hitpoints = 10
@@ -1233,6 +1279,7 @@
graphic = "u.diplomat"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
@@ -1274,6 +1321,7 @@
graphic = "u.spy"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
@@ -1316,6 +1364,7 @@
graphic = "u.caravan"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1347,6 +1396,7 @@
graphic = "u.freight"
graphic_alt = "-"
build_cost = 50
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1373,6 +1423,7 @@
graphic = "u.explorer"
graphic_alt = "-"
build_cost = 30
+pop_cost = 0
attack = 0
defense = 1
hitpoints = 10
@@ -1399,6 +1450,7 @@
graphic = "u.barbarian_leader"
graphic_alt = "u.diplomat"
build_cost = 40
+pop_cost = 0
attack = 0
defense = 0
hitpoints = 10
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.132
diff -u -r1.132 citytools.c
--- server/citytools.c 2001/08/26 06:52:20 1.132
+++ server/citytools.c 2001/08/27 18:52:40
@@ -1077,8 +1077,7 @@
do_civil_war = 1;
}
- pcity->size--;
- if (pcity->size<1) {
+ if (pcity->size<=1) {
notify_player_ex(pplayer, pcity->x, pcity->y, E_NOEVENT,
_("Game: You destroy %s completely."), pcity->name);
notify_player_ex(cplayer, pcity->x, pcity->y, E_CITY_LOST,
@@ -1094,7 +1093,7 @@
return;
}
- city_auto_remove_worker(pcity);
+ city_reduce_size(pcity, 1);
coins=cplayer->economic.gold;
coins=myrand((coins/20)+1)+(coins*(pcity->size))/200;
pplayer->economic.gold+=coins;
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.158
diff -u -r1.158 cityturn.c
--- server/cityturn.c 2001/08/26 13:10:12 1.158
+++ server/cityturn.c 2001/08/27 18:52:41
@@ -50,7 +50,6 @@
static void check_pollution(struct city *pcity);
static void city_populate(struct city *pcity);
static void city_increase_size(struct city *pcity);
-static void city_reduce_size(struct city *pcity);
static int worklist_change_build_target(struct player *pplayer,
struct city *pcity);
@@ -416,17 +415,19 @@
*/
}
+
/**************************************************************************
...
**************************************************************************/
-void city_auto_remove_worker(struct city *pcity)
+void city_reduce_size(struct city *pcity, int pop_loss)
{
- if(pcity->size<1) {
+ if(pcity->size<= pop_loss) {
remove_city_from_minimap(pcity->x, pcity->y);
remove_city(pcity);
return;
}
- if(city_specialists(pcity)) {
+ pcity->size -= pop_loss;
+ while (pop_loss > 0 && city_specialists(pcity)) {
if(pcity->ppl_taxman) {
pcity->ppl_taxman--;
} else if(pcity->ppl_scientist) {
@@ -435,12 +436,17 @@
assert(pcity->ppl_elvis);
pcity->ppl_elvis--;
}
+ pop_loss--;
+ }
+ if (pop_loss == 0) { /* we consumed all the pop_loss in specialists */
city_refresh(pcity);
send_city_info(city_owner(pcity), pcity);
return;
- }
- auto_arrange_workers(pcity);
- sync_cities();
+ }
+ else {
+ auto_arrange_workers(pcity);
+ sync_cities();
+ }
}
/**************************************************************************
@@ -540,22 +546,6 @@
}
/**************************************************************************
-...
-**************************************************************************/
-static void city_reduce_size(struct city *pcity)
-{
- notify_player_ex(city_owner(pcity), pcity->x, pcity->y, E_CITY_FAMINE,
- _("Game: Famine causes population loss in %s."),
pcity->name);
- if (city_got_effect(pcity, B_GRANARY))
- pcity->food_stock=city_granary_size(pcity->size-1)/2;
- else
- pcity->food_stock=0;
- pcity->size--;
-
- city_auto_remove_worker(pcity);
-}
-
-/**************************************************************************
Check whether the population can be increased or
if the city is unable to support a 'settler'...
**************************************************************************/
@@ -592,7 +582,13 @@
}
}
unit_list_iterate_end;
- city_reduce_size(pcity);
+ notify_player_ex(city_owner(pcity), pcity->x, pcity->y, E_CITY_FAMINE,
+ _("Game: Famine causes population loss in %s."),
pcity->name);
+ if (city_got_effect(pcity, B_GRANARY))
+ pcity->food_stock=city_granary_size(pcity->size-1)/2;
+ else
+ pcity->food_stock=0;
+ city_reduce_size(pcity, 1);
}
}
@@ -982,24 +978,20 @@
} else { /* is_building_unit */
upgrade_unit_prod(pcity);
- /* FIXME: F_CITIES should be changed to any unit
- * that 'contains' 1 (or more) pop -- sjolie
- */
if (pcity->shield_stock>=unit_value(pcity->currently_building)) {
- if (unit_flag(pcity->currently_building, F_CITIES)) {
- if (pcity->size==1) {
+ if (unit_pop_value (pcity->currently_building)) {
- /* Should we disband the city? -- Massimo */
- if (pcity->city_options & ((1<<CITYO_DISBAND))) {
+ /* Should we disband the city? -- Massimo */
+ if (pcity->size==unit_pop_value (pcity->currently_building) &&
+ (pcity->city_options & ((1<<CITYO_DISBAND)))) {
return !disband_city(pcity);
- } else {
- notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
- _("Game: %s can't build %s yet."),
- pcity->name, unit_name(pcity->currently_building));
- return 1;
- }
-
+ } else if (pcity->size <= unit_pop_value(pcity->currently_building)) {
+ notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_CANTBUILD,
+ _("Game: %s can't build %s yet."),
+ pcity->name, unit_name(pcity->currently_building));
+ return 1;
}
+
}
pcity->turn_last_built = game.year;
@@ -1010,9 +1002,8 @@
pcity->id, -1);
/* After we created the unit, so that removing the worker will take
into account the extra resources (food) needed. */
- if (unit_flag(pcity->currently_building, F_CITIES)) {
- pcity->size--;
- city_auto_remove_worker(pcity);
+ if (unit_pop_value(pcity->currently_building)) {
+ city_reduce_size(pcity, unit_pop_value(pcity->currently_building));
}
/* to eliminate micromanagement, we only subtract the unit's cost */
@@ -1278,7 +1269,8 @@
}
/**************************************************************************
- disband a city into a settler, supported by the closest city -- Massimo
+ disband a city into the built unit, supported by the closest city
+ -- Massimo, mki
**************************************************************************/
static int disband_city(struct city *pcity)
{
@@ -1302,7 +1294,7 @@
do_make_unit_veteran(pcity, pcity->currently_building),
pcity->id, -1);
- /* shift all the units supported by pcity (including the new settler) to
rcity.
+ /* shift all the units supported by pcity (including the new unit) to rcity.
transfer_city_units does not make sure no units are left floating without
a
transport, but since all units are transfered this is not a problem. */
transfer_city_units(pplayer, pplayer, &pcity->units_supported, rcity, pcity,
-1, 1);
Index: server/cityturn.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.h,v
retrieving revision 1.20
diff -u -r1.20 cityturn.h
--- server/cityturn.h 2001/08/24 06:10:11 1.20
+++ server/cityturn.h 2001/08/27 18:52:41
@@ -25,7 +25,7 @@
void auto_arrange_workers(struct city *pcity); /* will arrange the workers */
int add_adjust_workers(struct city *pcity); /* will add workers */
-void city_auto_remove_worker(struct city *pcity);
+void city_reduce_size(struct city *pcity, int num_workers);
void send_global_city_turn_notifications(struct conn_list *dest);
void send_city_turn_notifications(struct conn_list *dest, struct city *pcity);
void begin_cities_turn(struct player *pplayer);
Index: server/diplomats.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplomats.c,v
retrieving revision 1.11
diff -u -r1.11 diplomats.c
--- server/diplomats.c 2001/08/24 08:22:09 1.11
+++ server/diplomats.c 2001/08/27 18:52:42
@@ -95,8 +95,7 @@
freelog (LOG_DEBUG, "poison: succeeded");
/* Poison people! */
- (pcity->size)--;
- city_auto_remove_worker (pcity);
+ city_reduce_size(pcity, 1);
/* Notify everybody involved. */
notify_player_ex (pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT,
@@ -785,8 +784,7 @@
/* City loses some population. */
if (pcity->size > 1) {
- (pcity->size)--;
- city_auto_remove_worker (pcity);
+ city_reduce_size(pcity, 1);
}
/* This costs! */
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.76
diff -u -r1.76 ruleset.c
--- server/ruleset.c 2001/08/14 14:31:20 1.76
+++ server/ruleset.c 2001/08/27 18:52:43
@@ -647,6 +647,8 @@
u->build_cost =
secfile_lookup_int(file,"%s.build_cost", sec[i]);
+ u->pop_cost =
+ secfile_lookup_int(file,"%s.pop_cost", sec[i]);
u->attack_strength =
secfile_lookup_int(file,"%s.attack", sec[i]);
u->defense_strength =
@@ -2194,6 +2196,7 @@
sz_strlcpy(packet.graphic_alt, u->graphic_alt);
packet.move_type = u->move_type;
packet.build_cost = u->build_cost;
+ packet.pop_cost = u->pop_cost;
packet.attack_strength = u->attack_strength;
packet.defense_strength = u->defense_strength;
packet.move_rate = u->move_rate;
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.198
diff -u -r1.198 unithand.c
--- server/unithand.c 2001/08/26 21:45:24 1.198
+++ server/unithand.c 2001/08/27 18:52:44
@@ -428,17 +428,31 @@
notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
_("Game: Can't place city here."));
break;
+ case AB_NOT_BUILD_UNIT:
+ {
+ char *us = get_units_with_flag_string(F_CITIES);
+ if (us) {
+ notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ _("Game: Only %s can build a city."),
+ us);
+ free(us);
+ } else {
+ notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+ _("Game: Can't build a city."));
+ }
+ }
+ break;
case AB_NOT_ADDABLE_UNIT:
{
char *us = get_units_with_flag_string(F_CITIES);
if (us) {
notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
- _("Game: Only %s can build or add to a city."),
+ _("Game: Only %s can add to a city."),
us);
free(us);
} else {
notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
- _("Game: Can't build or add to a city."));
+ _("Game: Can't add to a city."));
}
}
break;
@@ -683,8 +697,7 @@
pcity->size>1 &&
!city_got_citywalls(pcity) &&
kills_citizen_after_attack(punit)) {
- pcity->size--;
- city_auto_remove_worker(pcity);
+ city_reduce_size(pcity,1);
city_refresh(pcity);
send_city_info(0, pcity);
}
- [Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897), (continued)
- [Freeciv-Dev] identifier length (was: Pop cost patch (resending via bug system) (PR#897)), Reinier Post, 2001/08/23
- [Freeciv-Dev] Re: identifier length (was: Pop cost patch (resending via bug system) (PR#897)), Vasco Alexandre Da Silva Costa, 2001/08/23
- [Freeciv-Dev] Re: identifier length (was: Pop cost patch (resendingvia bug system) (PR#897)), Jason Dorje Short, 2001/08/23
- [Freeciv-Dev] Re: identifier length (was: Pop cost patch (resending via bug system) (PR#897)), Raimar Falke, 2001/08/24
- [Freeciv-Dev] Re: identifier length, Christian Knoke, 2001/08/24
- [Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897), Arien Malec, 2001/08/27
- [Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897), Raimar Falke, 2001/08/27
- [Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897),
Arien Malec <=
- [Freeciv-Dev] Re: Pop cost patch (resending via bug system) (PR#897), Raimar Falke, 2001/08/29
|
|