Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Pop cost patch (resending via bug system) (PR#897)
Home

[Freeciv-Dev] Pop cost patch (resending via bug system) (PR#897)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Pop cost patch (resending via bug system) (PR#897)
From: Arien Malec <arien_malec@xxxxxxxxx>
Date: Thu, 16 Aug 2001 06:58:08 -0700 (PDT)

OK, following the recent discussion on patch handling procedures, I'm
re-resubmitting through the bug tracking system the pop cost patch that Michael
Kiermaier and I did back in March.

Patch is against CVS 1.12.1-devel, and applies cleanly as of Aug 16 2001

This patch does three things:

1) Changes city_auto_remove_workers to city_reduce_size, with an argument for #
pop to reduce, and changes callers to use the new interface

RATIONALE: Old system required a manual city->size-- to be done before the call
to city_auto_remove_workers, which breaks encapsulation & is prone to error.
Now we have one place where the full reduction gets done, and can support
reductions of more than 1 without special casing things.

TODO: I haven't changed the nuke code, but I imagine that it could benefit from
a call to the new function.

2) Adds a pop_cost variable to the units.ruleset and puts in place the
infrastructure to make use of that variable (building units, and adding to
cities)

3) Adds an AddToCities flag to separate out the F_CITIES building behavior from
the ability to add to cites.

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.174
diff -u -r1.174 packhand.c
--- client/packhand.c   2001/07/31 13:46:19     1.174
+++ client/packhand.c   2001/08/14 15:49:51
@@ -1562,6 +1562,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/packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.152
diff -u -r1.152 packets.c
--- common/packets.c    2001/06/29 19:39:04     1.152
+++ common/packets.c    2001/08/14 15:49:53
@@ -2767,6 +2767,7 @@
   cptr=put_uint8(cptr, packet->id);
   cptr=put_uint8(cptr, packet->move_type);
   cptr=put_uint16(cptr, packet->build_cost);
+  cptr=put_uint8(cptr, packet->pop_cost);
   cptr=put_uint8(cptr, packet->attack_strength);
   cptr=put_uint8(cptr, packet->defense_strength);
   cptr=put_uint8(cptr, packet->move_rate);
@@ -2817,6 +2818,7 @@
   iget_uint8(&iter, &packet->id);
   iget_uint8(&iter, &packet->move_type);
   iget_uint16(&iter, &packet->build_cost);
+  iget_uint8(&iter, &packet->pop_cost);
   iget_uint8(&iter, &packet->attack_strength);
   iget_uint8(&iter, &packet->defense_strength);
   iget_uint8(&iter, &packet->move_rate);
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/14 15:49:53
@@ -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.125
diff -u -r1.125 unit.c
--- common/unit.c       2001/08/13 12:25:26     1.125
+++ common/unit.c       2001/08/14 15:49:54
@@ -416,29 +416,31 @@
 int can_unit_add_to_city(struct unit *punit)
 {
   struct city *pcity;
+  int new_pop;
 
-  if(!unit_flag(punit->type, F_CITIES))
+  if(!unit_flag(punit->type, F_ADD_TO_CITY))
     return 0;
   if(!punit->moves_left)
     return 0;
 
   pcity = map_get_city(punit->x, punit->y);
-
+  new_pop = pcity->size + unit_pop_value(punit->type);
+  
   if(!pcity)
     return 0;
-  if(pcity->size >= game.add_to_size_limit)
+  if(new_pop >= game.add_to_size_limit)
     return 0;
   if(pcity->owner != punit->owner)
     return 0;
 
   if(improvement_exists(B_AQUEDUCT)
      && !city_got_building(pcity, B_AQUEDUCT) 
-     && pcity->size >= game.aqueduct_size)
+     && new_pop  >= game.aqueduct_size)
     return 0;
   
   if(improvement_exists(B_SEWER)
      && !city_got_building(pcity, B_SEWER)
-     && pcity->size >= game.sewer_size)
+     && new_pop >= game.sewer_size)
     return 0;
 
   return 1;
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/14 15:49:54
@@ -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);
@@ -529,4 +539,6 @@
   }
   return U_LAST;
 }
+
+
 
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/14 15:49:55
@@ -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/14 15:49:55
@@ -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/14 15:49:56
@@ -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/14 15:49:56
@@ -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.126
diff -u -r1.126 citytools.c
--- server/citytools.c  2001/07/28 16:39:13     1.126
+++ server/citytools.c  2001/08/14 15:49:58
@@ -1218,8 +1218,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, 
@@ -1237,7 +1236,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.153
diff -u -r1.153 cityturn.c
--- server/cityturn.c   2001/08/13 11:09:19     1.153
+++ server/cityturn.c   2001/08/14 15:49:59
@@ -54,7 +54,6 @@
 static void check_pollution(struct city *pcity);
 static void city_support(struct city *pcity);
 
-static void happy_copy(struct city *pcity, int i);
 static void citizen_happy_size(struct city *pcity);
 static void citizen_happy_luxury(struct city *pcity);
 static void citizen_happy_units(struct city *pcity, int unhap);
@@ -64,7 +63,6 @@
 
 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);
@@ -870,17 +868,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) {
@@ -889,12 +889,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();
+  }
 }
 
 /**************************************************************************
@@ -994,22 +999,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'...
 **************************************************************************/
@@ -1046,7 +1035,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);
   }
 }
 
@@ -1435,24 +1430,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;
@@ -1463,9 +1454,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 */
@@ -1731,7 +1721,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)
 {
@@ -1755,7 +1746,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.19
diff -u -r1.19 cityturn.h
--- server/cityturn.h   2001/04/10 12:44:02     1.19
+++ server/cityturn.h   2001/08/14 15:49:59
@@ -27,7 +27,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.8
diff -u -r1.8 diplomats.c
--- server/diplomats.c  2001/07/05 19:20:53     1.8
+++ server/diplomats.c  2001/08/14 15:50:00
@@ -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,
@@ -789,8 +788,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/14 15:50:01
@@ -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.193
diff -u -r1.193 unithand.c
--- server/unithand.c   2001/08/08 09:46:26     1.193
+++ server/unithand.c   2001/08/14 15:50:02
@@ -419,13 +419,24 @@
   unit_name = get_unit_type(punit->type)->name;
   pcity = map_get_city(punit->x, punit->y);
   
-  if (!unit_flag(punit->type, F_CITIES)) {
-    char *us = get_units_with_flag_string(F_CITIES);
-    notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
-                    _("Game: Only %s can build or add to a city."), us);
-    free(us);
-    return;
-  }  
+
+  if (pcity) {
+    if (!unit_flag(punit->type, F_ADD_TO_CITY)) {
+      char *us = get_units_with_flag_string(F_ADD_TO_CITY);
+      notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+                      _("Game: Only %s can add to a city."), us);
+      free(us);
+      return;
+    }
+  } else {
+    if (!unit_flag(punit->type, F_CITIES)) {
+      char *us = get_units_with_flag_string(F_CITIES);
+      notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT,
+                      _("Game: Only %s can build a city."), us);
+      free(us);
+      return;
+    }
+  }
 
   if(!punit->moves_left)  {
     if (pcity) {
@@ -442,7 +453,7 @@
     
   if (pcity) {
     if (can_unit_add_to_city(punit)) {
-      pcity->size++;
+      pcity->size+=unit_pop_value(punit->type);
       if (!add_adjust_workers(pcity)) {
        auto_arrange_workers(pcity);
        sync_cities();
@@ -453,14 +464,14 @@
                       _("Game: %s added to aid %s in growing."), 
                       unit_name, pcity->name);
     } else {
-      if(pcity->size >= game.add_to_size_limit) {
+      if(pcity->size+unit_pop_value(punit->type) >= game.add_to_size_limit) {
        notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT, 
                         _("Game: %s is too big to add %s."),
                         pcity->name, unit_name);
       }
       else if(improvement_exists(B_AQUEDUCT)
         && !city_got_building(pcity, B_AQUEDUCT) 
-        && pcity->size >= game.aqueduct_size) {
+        && pcity->size+unit_pop_value(punit->type) >= game.aqueduct_size) {
        notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT, 
                         _("Game: %s needs %s to grow, so you cannot add %s."),
                         pcity->name, get_improvement_name(B_AQUEDUCT),
@@ -468,7 +479,7 @@
       }
       else if(improvement_exists(B_SEWER)
              && !city_got_building(pcity, B_SEWER)
-             && pcity->size >= game.sewer_size) {
+             && pcity->size+unit_pop_value(punit->type) > game.sewer_size) {
        notify_player_ex(pplayer, punit->x, punit->y, E_NOEVENT, 
                         _("Game: %s needs %s to grow, so you cannot add %s."),
                         pcity->name, get_improvement_name(B_SEWER),
@@ -642,8 +653,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);
   }

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