Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9747) Remove terrain references in maphand.c
Home

[Freeciv-Dev] (PR#9747) Remove terrain references in maphand.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9747) Remove terrain references in maphand.c
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 20 Aug 2004 10:34:04 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9747 >

This patch removes the terrain references in global_warming() and 
nuclear_winter() in maphand.c.

Four new values are added to the ruleset for each terrain: 
warmer_wetter_result, warmer_drier_result, cooler_wetter_result, and 
cooler_drier_result.  Warming and winter make the terrain warmer or 
cooler as well as making wet terrain wetter while dry terrain becomes 
drier (thanks to Ross for pointing this out).

Note these values, along with most other terrain type values, are not 
sent to the client.  This should be changed eventually.

Behavior should be unchanged by this patch.  However this is hard to 
test, and I did not do so.

One behavior change is that if a terrain name does not match (in 
lookup_terrain, when loading the ruleset) rather than returning 
T_UNKNOWN (which usually leads to a server crash later) we print an 
error message and return T_LAST.

About the internals: if the result is "no" then this terrain is not 
eligible for this behavior.  In this case it doesn't count toward the 
warming/cooling effect (the effect specifies an exact number of tiles to 
be changed).  If the result is a specific terrain then the terrain is 
changed, and it counts toward the effect.  But if the result is "yes" 
(which is allowed by lookup_terrain although it doesn't correspond to 
any current behavior) then I had this not change the terrain type, but 
it _does_ count toward the effect.  I'm not sure if this would be useful 
to any rulesets but it seemed easier than disallowing or ignoring a 
"yes" result.

See also PR#7584.

jason

? freeciv-1.14.99-devel.tar.gz
? server/civmanual.c
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.204
diff -u -r1.204 map.h
--- common/map.h        13 Aug 2004 15:59:12 -0000      1.204
+++ common/map.h        20 Aug 2004 17:29:12 -0000
@@ -117,6 +117,9 @@
   int clean_pollution_time;
   int clean_fallout_time;
 
+  enum tile_terrain_type warmer_wetter_result, warmer_drier_result;
+  enum tile_terrain_type cooler_wetter_result, cooler_drier_result;
+
   bv_terrain_flags flags;
 
   char *helptext;
Index: data/civ1/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/terrain.ruleset,v
retrieving revision 1.25
diff -u -r1.25 terrain.ruleset
--- data/civ1/terrain.ruleset   9 Jul 2004 17:33:55 -0000       1.25
+++ data/civ1/terrain.ruleset   20 Aug 2004 17:29:12 -0000
@@ -136,6 +136,16 @@
 ;                        "no"  -- cannot transform
 ;                        terrain name -- transformation changes to that terrain
 ; transform_time       = time to transform; if 0, cannot transform
+; warmer_wetter_result = result of global warming for wet terrains; one of:
+;                        "no"  -- no change; doesn't count for warming
+;                        "yes" -- no change; counts for warming
+;                        terrain name -- warming changes to that terrain
+; warmer_drier_result  = result of global warming for dry terrains;
+;                        see warmer_wetter_result
+; cooler_wetter_result = result of nuclear winter for wet terrains;
+;                        see warmer_wetter_result
+; cooler_drier_result  = result of nuclear winter for dry terrains;
+;                        see warmer_wetter_result
 ; flags                = General flags for this terrain:
 ;   - NoBarbs          = Barbarians will not be spawned here.
 ;   - NoPollution      = Pollution will not be put on this terrain type.
@@ -185,6 +195,10 @@
 mining_time          = 0
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "NoBarbs"
 helptext            = _("\
 Arctic squares are found only in the most northerly or southerly\
@@ -223,6 +237,10 @@
 mining_time          = 5
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 helptext            = _("\
 Deserts are regions of extreme dryness, making agriculture and\
  trade very difficult.\
@@ -259,6 +277,10 @@
 mining_time          = 0
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "Jungle"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 helptext            = _("\
 Forests are densely wooded, making agriculture somewhat\
  problematic.\
@@ -295,6 +317,10 @@
 mining_time          = 10
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Grasslands afford exceptional agricultural opportunities.\
@@ -331,6 +357,10 @@
 mining_time          = 10
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 helptext            = _("\
 In addition to being amenable to agriculture, Hills are frequently\
  rich in resources.\
@@ -367,6 +397,10 @@
 mining_time          = 15
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 helptext            = _("\
 Jungles are densely overgrown, making agriculture somewhat\
  problematic.\
@@ -403,6 +437,10 @@
 mining_time          = 10
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 helptext            = _("\
 Mountains are regions of extreme altitude, making agriculture and\
  trade very difficult.\
@@ -439,6 +477,10 @@
 mining_time          = 0
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "Oceanic", "NoPollution", "UnsafeCoast", "NoCities"
 helptext            = _("\
 Oceans cover much of the world, and only sea units (Triremes and\
@@ -478,6 +520,10 @@
 mining_time          = 15
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "Starter"
 helptext            = _("\
 Plains are very broad, sparse regions, which makes trade slightly\
@@ -515,6 +561,10 @@
 mining_time          = 0
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 helptext            = ""
 
 [terrain_swamp]
@@ -548,6 +598,10 @@
 mining_time          = 15
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 helptext            = _("\
 Swamps suffer from an over-abundance of water, making agriculture\
  somewhat problematic.\
@@ -584,6 +638,10 @@
 mining_time          = 0
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Arctic"
+cooler_drier_result  = "Arctic"
 flags                = "NoBarbs"
 helptext            = _("\
 Tundra are broad, cold regions, fit for some agriculture and little\
Index: data/civ2/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/terrain.ruleset,v
retrieving revision 1.27
diff -u -r1.27 terrain.ruleset
--- data/civ2/terrain.ruleset   9 Jul 2004 17:33:55 -0000       1.27
+++ data/civ2/terrain.ruleset   20 Aug 2004 17:29:12 -0000
@@ -144,6 +144,16 @@
 ;                        "no"  -- cannot transform
 ;                        terrain name -- transformation changes to that terrain
 ; transform_time       = time to transform; if 0, cannot transform
+; warmer_wetter_result = result of global warming for wet terrains; one of:
+;                        "no"  -- no change; doesn't count for warming
+;                        "yes" -- no change; counts for warming
+;                        terrain name -- warming changes to that terrain
+; warmer_drier_result  = result of global warming for dry terrains;
+;                        see warmer_wetter_result
+; cooler_wetter_result = result of nuclear winter for wet terrains;
+;                        see warmer_wetter_result
+; cooler_drier_result  = result of nuclear winter for dry terrains;
+;                        see warmer_wetter_result
 ; flags                = General flags for this terrain:
 ;   - NoBarbs          = Barbarians will not be spawned here.
 ;   - NoPollution      = Pollution will not be put on this terrain type.
@@ -193,6 +203,10 @@
 mining_time          = 10
 transform_result     = "Tundra"
 transform_time       = 24
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "NoBarbs", "CanHaveRiver"
 helptext            = _("\
 Glaciers are found only in the most northerly or southerly\
@@ -231,6 +245,10 @@
 mining_time          = 5
 transform_result     = "Plains"
 transform_time       = 24
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Deserts are regions of extreme dryness, making agriculture and\
@@ -268,6 +286,10 @@
 mining_time          = 0
 transform_result     = "Grassland"
 transform_time       = 24
+warmer_wetter_result = "Jungle"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Forests are densely wooded, making agriculture somewhat\
@@ -305,6 +327,10 @@
 mining_time          = 10
 transform_result     = "Hills"
 transform_time       = 24
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Grasslands afford exceptional agricultural opportunities.\
@@ -341,6 +367,10 @@
 mining_time          = 10
 transform_result     = "Plains"
 transform_time       = 24
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 In addition to being amenable to agriculture, Hills are frequently\
@@ -378,6 +408,11 @@
 mining_time          = 15
 transform_result     = "Plains"
 transform_time       = 24
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
+flags                = "CanHaveRiver"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Jungles are densely overgrown, making agriculture somewhat\
@@ -415,6 +450,10 @@
 mining_time          = 10
 transform_result     = "Hills"
 transform_time       = 24
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Mountains are regions of extreme altitude, making agriculture and\
@@ -452,6 +491,10 @@
 mining_time          = 0
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "Oceanic", "NoPollution", "UnsafeCoast", "NoCities"
 helptext            = _("\
 Oceans cover much of the world, and only sea units (Triremes and\
@@ -491,6 +534,10 @@
 mining_time          = 15
 transform_result     = "Grassland"
 transform_time       = 24
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Plains are very broad, sparse regions, which makes trade slightly\
@@ -528,6 +575,10 @@
 mining_time          = 0
 transform_result     = "no"
 transform_time       = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
@@ -560,6 +611,10 @@
 mining_time          = 15
 transform_result     = "Plains"
 transform_time       = 24
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Swamps suffer from an over-abundance of water, making agriculture\
@@ -597,6 +652,10 @@
 mining_time          = 0
 transform_result     = "Desert"
 transform_time       = 24
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Glacier"
+cooler_drier_result  = "Glacier"
 flags                = "NoBarbs", "CanHaveRiver"
 helptext            = _("\
 Tundra are broad, cold regions, fit for some agriculture and little\
Index: data/default/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/terrain.ruleset,v
retrieving revision 1.28
diff -u -r1.28 terrain.ruleset
--- data/default/terrain.ruleset        9 Jul 2004 17:33:55 -0000       1.28
+++ data/default/terrain.ruleset        20 Aug 2004 17:29:12 -0000
@@ -144,6 +144,16 @@
 ;                        "no"  -- cannot transform
 ;                        terrain name -- transformation changes to that terrain
 ; transform_time       = time to transform; if 0, cannot transform
+; warmer_wetter_result = result of global warming for wet terrains; one of:
+;                        "no"  -- no change; doesn't count for warming
+;                        "yes" -- no change; counts for warming
+;                        terrain name -- warming changes to that terrain
+; warmer_drier_result  = result of global warming for dry terrains;
+;                        see warmer_wetter_result
+; cooler_wetter_result = result of nuclear winter for wet terrains;
+;                        see warmer_wetter_result
+; cooler_drier_result  = result of nuclear winter for dry terrains;
+;                        see warmer_wetter_result
 ; flags                = General flags for this terrain:
 ;   - NoBarbs          = Barbarians will not be spawned here.
 ;   - NoPollution      = Pollution will not be put on this terrain type.
@@ -198,6 +208,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "NoBarbs", "CanHaveRiver", "UnsafeCoast", "Unsafe"
 helptext            = _("\
 Glaciers are found only in the most northerly or southerly\
@@ -241,6 +255,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Deserts are regions of extreme dryness, making agriculture and\
@@ -283,6 +301,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "Jungle"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Forests are densely wooded, making agriculture somewhat\
@@ -325,6 +347,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Grasslands afford exceptional agricultural opportunities.\
@@ -366,6 +392,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 In addition to being amenable to agriculture, Hills are frequently\
@@ -408,6 +438,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Jungles are densely overgrown, making agriculture somewhat\
@@ -450,6 +484,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Mountains are regions of extreme altitude, making agriculture and\
@@ -492,6 +530,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "Oceanic", "NoPollution", "UnsafeCoast", "NoCities"
 helptext            = _("\
 Oceans cover much of the world, and only sea units (Triremes and\
@@ -536,6 +578,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Plains are very broad, sparse regions, which makes trade slightly\
@@ -578,6 +624,10 @@
 fortress_time        = 0
 clean_pollution_time = 0
 clean_fallout_time   = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
@@ -615,6 +665,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Swamps suffer from an over-abundance of water, making agriculture\
@@ -657,6 +711,10 @@
 fortress_time        = 3
 clean_pollution_time = 3
 clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Glacier"
+cooler_drier_result  = "Glacier"
 flags                = "NoBarbs", "CanHaveRiver"
 helptext            = _("\
 Tundra are broad, cold regions, fit for some agriculture and little\
Index: data/history/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/terrain.ruleset,v
retrieving revision 1.10
diff -u -r1.10 terrain.ruleset
--- data/history/terrain.ruleset        9 Jul 2004 17:33:55 -0000       1.10
+++ data/history/terrain.ruleset        20 Aug 2004 17:29:13 -0000
@@ -144,6 +144,16 @@
 ;                        "no"  -- cannot transform
 ;                        terrain name -- transformation changes to that terrain
 ; transform_time       = time to transform; if 0, cannot transform
+; warmer_wetter_result = result of global warming for wet terrains; one of:
+;                        "no"  -- no change; doesn't count for warming
+;                        "yes" -- no change; counts for warming
+;                        terrain name -- warming changes to that terrain
+; warmer_drier_result  = result of global warming for dry terrains;
+;                        see warmer_wetter_result
+; cooler_wetter_result = result of nuclear winter for wet terrains;
+;                        see warmer_wetter_result
+; cooler_drier_result  = result of nuclear winter for dry terrains;
+;                        see warmer_wetter_result
 ; flags                = General flags for this terrain:
 ;   - NoBarbs          = Barbarians will not be spawned here.
 ;   - NoPollution      = Pollution will not be put on this terrain type.
@@ -193,6 +203,15 @@
 mining_time          = 10
 transform_result     = "Tundra"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "NoBarbs", "CanHaveRiver", "UnsafeCoast", "Unsafe"
 helptext            = _("\
 Glaciers are found only in the most northerly or southerly\
@@ -231,6 +250,15 @@
 mining_time          = 5
 transform_result     = "Plains"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Deserts are regions of extreme dryness, making agriculture and\
@@ -268,6 +296,15 @@
 mining_time          = 15
 transform_result     = "Grassland"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "Jungle"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Forests are densely wooded, making agriculture somewhat\
@@ -305,6 +342,15 @@
 mining_time          = 10
 transform_result     = "Hills"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Grasslands afford exceptional agricultural opportunities.\
@@ -341,6 +387,15 @@
 mining_time          = 10
 transform_result     = "Plains"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 In addition to being amenable to agriculture, Hills are frequently\
@@ -378,6 +433,15 @@
 mining_time          = 15
 transform_result     = "Plains"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Jungles are densely overgrown, making agriculture somewhat\
@@ -415,6 +479,15 @@
 mining_time          = 10
 transform_result     = "Hills"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "CanHaveRiver"
 helptext            = _("\
 Mountains are regions of extreme altitude, making agriculture and\
@@ -452,6 +525,15 @@
 mining_time          = 0
 transform_result     = "Swamp"
 transform_time       = 36
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 flags                = "Oceanic", "NoPollution", "UnsafeCoast", "NoCities"
 helptext            = _("\
 Oceans cover much of the world, and only sea units (Triremes and\
@@ -491,6 +573,15 @@
 mining_time          = 15
 transform_result     = "Grassland"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "Swamp"
+warmer_drier_result  = "Desert"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Plains are very broad, sparse regions, which makes trade slightly\
@@ -528,6 +619,15 @@
 mining_time          = 0
 transform_result     = "no"
 transform_time       = 0
+rail_time            = 0
+airbase_time         = 0
+fortress_time        = 0
+clean_pollution_time = 0
+clean_fallout_time   = 0
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
@@ -558,8 +658,18 @@
 mining_result        = "Forest"
 mining_shield_incr   = 0
 mining_time          = 15
-transform_result     = "Ocean", "CanHaveRiver"
+transform_result     = "Ocean"
 transform_time       = 36
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Desert"
+cooler_drier_result  = "Tundra"
+flags                = "CanHaveRiver"
 helptext            = _("\
 Swamps suffer from an over-abundance of water, making agriculture\
  somewhat problematic.\
@@ -596,6 +706,15 @@
 mining_time          = 0
 transform_result     = "Desert"
 transform_time       = 24
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "Glacier"
+cooler_drier_result  = "Glacier"
 flags                = "NoBarbs", "CanHaveRiver"
 helptext            = _("\
 Tundra are broad, cold regions, fit for some agriculture and little\
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.139
diff -u -r1.139 maphand.c
--- server/maphand.c    20 Aug 2004 10:14:28 -0000      1.139
+++ server/maphand.c    20 Aug 2004 17:29:14 -0000
@@ -73,42 +73,27 @@
 
   k = map_num_tiles();
   while(effect > 0 && (k--) > 0) {
+    enum tile_terrain_type old, new;
+
     rand_map_pos(&x, &y);
-    if (!is_ocean(map_get_terrain(x, y))) {
-      if (is_terrain_ecologically_wet(x, y)) {
-       switch (map_get_terrain(x, y)) {
-       case T_FOREST:
-         effect--;
-         change_terrain(x, y, T_JUNGLE);
-         send_tile_info(NULL, x, y);
-         break;
-       case T_DESERT:
-       case T_PLAINS:
-       case T_GRASSLAND:
-         effect--;
-         change_terrain(x, y, T_SWAMP);
-         send_tile_info(NULL, x, y);
-         break;
-       default:
-         break;
-       }
-      } else {
-       switch (map_get_terrain(x, y)) {
-       case T_PLAINS:
-       case T_GRASSLAND:
-       case T_FOREST:
-         effect--;
-         change_terrain(x, y, T_DESERT);
-         send_tile_info(NULL, x, y);
-         break;
-       default:
-         break;
-       }
-      }
+    old = map_get_terrain(x, y);
+    if (is_terrain_ecologically_wet(x, y)) {
+      new = get_tile_type(old)->warmer_wetter_result;
+    } else {
+      new = get_tile_type(old)->warmer_drier_result;
+    }
+    if (new != T_LAST && old != new) {
+      effect--;
+      change_terrain(x, y, new);
+      send_tile_info(NULL, x, y);
       unit_list_iterate(map_get_tile(x, y)->units, punit) {
-       if (!can_unit_continue_current_activity(punit))
+       if (!can_unit_continue_current_activity(punit)) {
          handle_unit_activity_request(punit, ACTIVITY_IDLE);
+       }
       } unit_list_iterate_end;
+    } else if (old == new) {
+      /* This counts toward warming although nothing is changed. */
+      effect--;
     }
   }
 
@@ -125,34 +110,31 @@
 {
   int x, y, k;
 
-  freelog(LOG_NORMAL, "Nuclear winter: %d", game.cooling);
+  freelog(LOG_NORMAL, "Nuclear winter: %d (%d)", game.cooling, effect);
 
   k = map_num_tiles();
   while(effect > 0 && (k--) > 0) {
+    enum tile_terrain_type old, new;
+
     rand_map_pos(&x, &y);
-    if (!is_ocean(map_get_terrain(x, y))) {
-      switch (map_get_terrain(x, y)) {
-      case T_JUNGLE:
-      case T_SWAMP:
-      case T_PLAINS:
-      case T_GRASSLAND:
-       effect--;
-       change_terrain(x, y,
-                      is_terrain_ecologically_wet(x, y) ? T_DESERT : T_TUNDRA);
-       send_tile_info(NULL, x, y);
-       break;
-      case T_TUNDRA:
-       effect--;
-       change_terrain(x, y, T_ARCTIC);
-       send_tile_info(NULL, x, y);
-       break;
-      default:
-       break;
-      }
+    old = map_get_terrain(x, y);
+    if (is_terrain_ecologically_wet(x, y)) {
+      new = get_tile_type(old)->cooler_wetter_result;
+    } else {
+      new = get_tile_type(old)->cooler_drier_result;
+    }
+    if (new != T_LAST && old != new) {
+      effect--;
+      change_terrain(x, y, new);
+      send_tile_info(NULL, x, y);
       unit_list_iterate(map_get_tile(x, y)->units, punit) {
-       if (!can_unit_continue_current_activity(punit))
+       if (!can_unit_continue_current_activity(punit)) {
          handle_unit_activity_request(punit, ACTIVITY_IDLE);
+       }
       } unit_list_iterate_end;
+    } else if (old == new) {
+      /* This counts toward winter although nothing is changed. */
+      effect--;
     }
   }
 
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.185
diff -u -r1.185 ruleset.c
--- server/ruleset.c    14 Aug 2004 22:40:17 -0000      1.185
+++ server/ruleset.c    20 Aug 2004 17:29:15 -0000
@@ -492,7 +492,9 @@
     }
   }
 
-  return T_UNKNOWN;
+  freelog(LOG_ERROR, _("Unknown terrain %s in entry %s."),
+         name, tile_types[tthis].terrain_name);
+  return T_LAST;
 }
 
 /**************************************************************************
@@ -1657,6 +1659,19 @@
       t->clean_fallout_time = 
           secfile_lookup_int_default(file, 3, "%s.clean_fallout_time", sec[i]);
 
+      t->warmer_wetter_result
+       = lookup_terrain(secfile_lookup_str(file, "%s.warmer_wetter_result",
+                                           sec[i]), i);
+      t->warmer_drier_result
+       = lookup_terrain(secfile_lookup_str(file, "%s.warmer_drier_result",
+                                           sec[i]), i);
+      t->cooler_wetter_result
+       = lookup_terrain(secfile_lookup_str(file, "%s.cooler_wetter_result",
+                                           sec[i]), i);
+      t->cooler_drier_result
+       = lookup_terrain(secfile_lookup_str(file, "%s.cooler_drier_result",
+                                           sec[i]), i);
+
       slist = secfile_lookup_str_vec(file, &nval, "%s.flags", sec[i]);
       BV_CLR_ALL(t->flags);
       for (j = 0; j < nval; j++) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9747) Remove terrain references in maphand.c, Jason Short <=