Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Pop cost patch
Home

[Freeciv-Dev] Pop cost patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Pop cost patch
From: Arien Malec <arien_malec@xxxxxxxxx>
Date: Fri, 10 Aug 2001 14:40:09 -0700 (PDT)

Attached is the population cost patch that Michael Kiermaier & I did way back
in March. (It also has the separation of F_CITIES and F_ADD_TO_CITY unit flags
(so that you could build a refugee unit, etc.). It is updated for current CVS,
and I hope that it can be applied soon.

Note that I made the default settler pop cost = 2. I'd like to see the pop cost
stuff tested, and defaulting a non-classic pop cost might be a good way of
ensuring that, but might also be pushing it... Feel free to change it back.

Arien

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
diff -Nur -Xcvs/diff_ignore cvs/client/packhand.c mod/client/packhand.c
--- cvs/client/packhand.c       Tue Feb 20 13:35:27 2001
+++ mod/client/packhand.c       Thu Mar  8 18:34:09 2001
@@ -1617,6 +1617,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;
diff -Nur -Xcvs/diff_ignore cvs/common/packets.c mod/common/packets.c
--- cvs/common/packets.c        Tue Feb 20 13:35:34 2001
+++ mod/common/packets.c        Thu Mar  8 18:31:32 2001
@@ -3056,6 +3056,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);
@@ -3106,6 +3107,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);
diff -Nur -Xcvs/diff_ignore cvs/common/packets.h mod/common/packets.h
--- cvs/common/packets.h        Tue Feb 20 13:35:34 2001
+++ mod/common/packets.h        Thu Mar  8 18:30:55 2001
@@ -578,6 +578,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;
diff -Nur -Xcvs/diff_ignore cvs/common/unit.c mod/common/unit.c
--- cvs/common/unit.c   Wed Feb 21 13:37:54 2001
+++ mod/common/unit.c   Thu Mar  8 18:40:49 2001
@@ -406,7 +406,7 @@
 {
   struct city *pcity;
 
-  if(!unit_flag(punit->type, F_CITIES))
+  if(!unit_flag(punit->type, F_ADD_TO_CITY))
     return 0;
   if(!punit->moves_left)
     return 0;
@@ -415,19 +415,19 @@
 
   if(!pcity)
     return 0;
-  if(pcity->size > game.add_to_size_limit)
+  if(pcity->size+unit_pop_value(punit->type) > 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)
+     && pcity->size+unit_pop_value(punit->type) > game.aqueduct_size)
     return 0;
   
   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)
     return 0;
 
   return 1;
diff -Nur -Xcvs/diff_ignore cvs/common/unittype.c mod/common/unittype.c
--- cvs/common/unittype.c       Mon Sep 11 13:32:15 2000
+++ mod/common/unittype.c       Thu Mar  8 18:48:43 2001
@@ -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;
 }
+
+
 
diff -Nur -Xcvs/diff_ignore cvs/common/unittype.h mod/common/unittype.h
--- cvs/common/unittype.h       Mon Sep 11 13:32:16 2000
+++ mod/common/unittype.h       Thu Mar  8 18:28:54 2001
@@ -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 */
+
diff -Nur -Xcvs/diff_ignore cvs/data/civ1/units.ruleset 
mod/data/civ1/units.ruleset
--- cvs/data/civ1/units.ruleset Fri Jan 26 13:37:27 2001
+++ mod/data/civ1/units.ruleset Thu Mar  8 21:33:03 2001
@@ -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      = _("\
 Setters 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
diff -Nur -Xcvs/diff_ignore cvs/data/civ2/units.ruleset 
mod/data/civ2/units.ruleset
--- cvs/data/civ2/units.ruleset Fri Jan 26 13:37:28 2001
+++ mod/data/civ2/units.ruleset Thu Mar  8 21:38:45 2001
@@ -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      = _("\
 Setters 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
diff -Nur -Xcvs/diff_ignore cvs/data/default/units.ruleset 
mod/data/default/units.ruleset
--- cvs/data/default/units.ruleset      Fri Jan 26 13:37:29 2001
+++ mod/data/default/units.ruleset      Thu Mar  8 21:42:54 2001
@@ -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      = _("\
 Setters 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
diff -Nur -Xcvs/diff_ignore cvs/server/cityturn.c mod/server/cityturn.c
--- cvs/server/cityturn.c       Wed Feb 28 13:36:23 2001
+++ mod/server/cityturn.c       Thu Mar  8 20:46:45 2001
@@ -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);
@@ -865,28 +863,30 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void city_auto_remove_worker(struct city *pcity)
+void city_reduce_size(struct city *pcity, int num_workers)
 {
-  if(pcity->size<1) {      
+  if(pcity->size<=num_workers) {      
     remove_city_from_minimap(pcity->x, pcity->y);
     remove_city(pcity);
     return;
   }
-  if(city_specialists(pcity)) {
+  pcity->size -= num_workers;
+  while (num_workers && city_specialists(pcity)) {
     if(pcity->ppl_taxman) {
       pcity->ppl_taxman--;
-      return;
     } else if(pcity->ppl_scientist) {
       pcity->ppl_scientist--;
-      return;
     } else if(pcity->ppl_elvis) {
-      pcity->ppl_elvis--; 
-      return;
+      pcity->ppl_elvis--;
     }
-  } 
-  auto_arrange_workers(pcity);
-  city_refresh(pcity);
-  send_city_info(city_owner(pcity), pcity);
+    num_workers--;
+  }
+  /* Need to re-arrange if we've removed non-specialists */
+  if (num_workers) {
+    auto_arrange_workers(pcity);
+    city_refresh(pcity);
+    send_city_info(city_owner(pcity), pcity);
+  }
 }
 
 /**************************************************************************
@@ -984,22 +984,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'...
 **************************************************************************/
@@ -1036,7 +1020,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);
   }
 }
 
@@ -1293,7 +1283,6 @@
 {
   struct government *g = get_gov_pplayer(pplayer);
   int space_part;
-  int city_built_city_builder;
 
   while (pcity->shield_surplus<0) {
     unit_list_iterate(pcity->units_supported, punit) {
@@ -1407,34 +1396,30 @@
       }
     } 
   } else { /* is_building_unit */
-    city_built_city_builder = 0;
-
     upgrade_unit_prod(pcity);
 
     /* FIXME: F_CITIES should be changed to any unit
      * that 'contains' 1 (or more) pop -- sjolie
+     * fixed: now pop_cost is used -- mki
      */
     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))) {
-           disband_city(pcity);
-           return 0;
-         } 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));
-         }
+       /* Should we disband the city? -- Massimo */
+       if (pcity->size==unit_pop_value(pcity->currently_building) &&
+           (pcity->city_options & ((1<<CITYO_DISBAND)))) {
+         disband_city(pcity);
+         return 0;
+       } 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;
-
        }
-       city_built_city_builder = 1;
       }
       
       pcity->turn_last_built = game.year;
-      /* don't update turn_last_built if we returned above for size==1 */
+      /* don't update turn_last_built if we returned above for size too small 
*/
 
       create_unit(pplayer, pcity->x, pcity->y, pcity->currently_building,
                  do_make_unit_veteran(pcity, pcity->currently_building), 
@@ -1443,9 +1428,8 @@
       pcity->before_change_shields-=unit_value(pcity->currently_building); 
       pcity->shield_stock-=unit_value(pcity->currently_building);
 
-      if (city_built_city_builder) {
-       pcity->size--;
-       city_auto_remove_worker(pcity);
+      if (unit_pop_value(pcity->currently_building)) {
+       city_reduce_size(pcity,unit_pop_value(pcity->currently_building));
       }
 
       notify_player_ex(pplayer, pcity->x, pcity->y, E_UNIT_BUILD,
@@ -1849,7 +1833,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 void disband_city(struct city *pcity)
 {
@@ -1873,7 +1858,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);
diff -Nur -Xcvs/diff_ignore cvs/server/cityturn.h mod/server/cityturn.h
--- cvs/server/cityturn.h       Tue Feb 20 13:35:41 2001
+++ mod/server/cityturn.h       Thu Mar  8 19:37:11 2001
@@ -28,7 +28,7 @@
 int add_adjust_workers(struct city *pcity);   /* will add workers */
 int city_check_workers(struct city *pcity, int send_changed_adjacent_cities);
 
-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);
diff -Nur -Xcvs/diff_ignore cvs/server/diplomats.c mod/server/diplomats.c
--- cvs/server/diplomats.c      Tue Feb 20 13:35:41 2001
+++ mod/server/diplomats.c      Thu Mar  8 19:51:37 2001
@@ -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,
@@ -786,8 +785,7 @@
 
   /* City loses some population. */
   if (pcity->size > 1) {
-    (pcity->size)--;
-    city_auto_remove_worker (pcity);
+    city_reduce_size(pcity, 1);
   }
 
   /* This costs! */
diff -Nur -Xcvs/diff_ignore cvs/server/ruleset.c mod/server/ruleset.c
--- cvs/server/ruleset.c        Wed Feb 14 13:43:33 2001
+++ mod/server/ruleset.c        Thu Mar  8 18:50:36 2001
@@ -630,6 +630,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 =
@@ -701,12 +703,12 @@
     free(slist);
 
     /* For now, if F_CITIES flag, we require the F_SETTLERS flag. -- jjm */
-    if (unit_flag(i, F_CITIES) && !(unit_flag(i, F_SETTLERS))) {
+    /*if (unit_flag(i, F_CITIES) && !(unit_flag(i, F_SETTLERS))) {
       freelog(LOG_FATAL,
              "for unit_type \"%s\": \"Cities\" flag without \"Settlers\" flag 
(%s)",
              u->name, filename);
       exit(1);
-    }
+      }*/
   }
     
   /* roles */
@@ -2178,6 +2180,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;
diff -Nur -Xcvs/diff_ignore cvs/server/unithand.c mod/server/unithand.c
--- cvs/server/unithand.c       Tue Feb 20 13:35:42 2001
+++ mod/server/unithand.c       Thu Mar  8 19:50:10 2001
@@ -393,13 +393,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) {
@@ -416,7 +427,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);
       wipe_unit(punit);
@@ -425,14 +436,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),
@@ -440,7 +451,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),
@@ -600,8 +611,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);
   }
@@ -1278,8 +1288,8 @@
       do_civil_war = 1;
   }
   
-  pcity->size--;
-  if (pcity->size<1) {
+  /* special case if city will be destroyed*/
+  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, 
@@ -1297,7 +1307,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;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Pop cost patch, Arien Malec <=