Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9170) rulesetify a few more terrain actions
Home

[Freeciv-Dev] (PR#9170) rulesetify a few more terrain actions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9170) rulesetify a few more terrain actions
From: "Per Inge Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 3 Jul 2004 08:50:25 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch makes the time required for building fortress, airbase, rail
and cleaning up pollution and fallout rulesetable instead of hardcoded. I
don't understand why this was not done in the first place.

  - Per

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.382
diff -u -r1.382 packhand.c
--- client/packhand.c   25 Jun 2004 23:35:55 -0000      1.382
+++ client/packhand.c   3 Jul 2004 15:36:33 -0000
@@ -2584,6 +2584,11 @@
   t->mining_time = p->mining_time;
   t->transform_result = p->transform_result;
   t->transform_time = p->transform_time;
+  t->rail_time = p->rail_time;
+  t->airbase_time = p->airbase_time;
+  t->fortress_time = p->fortress_time;
+  t->clean_pollution_time = p->clean_pollution_time;
+  t->clean_fallout_time = p->clean_fallout_time;
   
   t->flags = p->flags;
 
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.173
diff -u -r1.173 map.c
--- common/map.c        1 Jul 2004 18:15:52 -0000       1.173
+++ common/map.c        3 Jul 2004 15:36:34 -0000
@@ -747,7 +747,7 @@
 ***************************************************************/
 int map_build_rail_time(int x, int y)
 {
-  return 30;
+  return tile_types[map_get_terrain(x, y)].rail_time * 10;
 }
 
 /***************************************************************
@@ -755,7 +755,7 @@
 ***************************************************************/
 int map_build_airbase_time(int x, int y)
 {
-  return 30;
+  return tile_types[map_get_terrain(x, y)].airbase_time * 10;
 }
 
 /***************************************************************
@@ -763,7 +763,7 @@
 ***************************************************************/
 int map_build_fortress_time(int x, int y)
 {
-  return 30;
+  return tile_types[map_get_terrain(x, y)].fortress_time * 10;
 }
 
 /***************************************************************
@@ -771,7 +771,7 @@
 ***************************************************************/
 int map_clean_pollution_time(int x, int y)
 {
-  return 30;
+  return tile_types[map_get_terrain(x, y)].clean_pollution_time * 10;
 }
 
 /***************************************************************
@@ -779,7 +779,7 @@
 ***************************************************************/
 int map_clean_fallout_time(int x, int y)
 {
-  return 30;
+  return tile_types[map_get_terrain(x, y)].clean_fallout_time * 10;
 }
 
 /***************************************************************
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.189
diff -u -r1.189 map.h
--- common/map.h        1 Jul 2004 18:15:52 -0000       1.189
+++ common/map.h        3 Jul 2004 15:36:34 -0000
@@ -109,6 +109,11 @@
 
   enum tile_terrain_type transform_result;
   int transform_time;
+  int rail_time;
+  int airbase_time;
+  int fortress_time;
+  int clean_pollution_time;
+  int clean_fallout_time;
 
   bv_terrain_flags flags;
 
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.29
diff -u -r1.29 packets.def
--- common/packets.def  12 Jun 2004 17:42:27 -0000      1.29
+++ common/packets.def  3 Jul 2004 15:36:34 -0000
@@ -1200,6 +1200,11 @@
 
   TERRAIN transform_result;
   UINT8 transform_time;
+  UINT8 rail_time;
+  UINT8 airbase_time;
+  UINT8 fortress_time;
+  UINT8 clean_pollution_time;
+  UINT8 clean_fallout_time;
   
   STRING helptext[MAX_LEN_PACKET];
 end
Index: data/default/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/terrain.ruleset,v
retrieving revision 1.26
diff -u -r1.26 terrain.ruleset
--- data/default/terrain.ruleset        25 Jun 2004 23:30:00 -0000      1.26
+++ data/default/terrain.ruleset        3 Jul 2004 15:36:37 -0000
@@ -193,6 +193,11 @@
 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
 flags                = "NoBarbs", "CanHaveRiver", "UnsafeCoast", "Unsafe"
 helptext            = _("\
 Glaciers are found only in the most northerly or southerly\
@@ -231,6 +236,11 @@
 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
 flags                = "CanHaveRiver"
 helptext            = _("\
 Deserts are regions of extreme dryness, making agriculture and\
@@ -268,6 +278,11 @@
 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
 flags                = "CanHaveRiver"
 helptext            = _("\
 Forests are densely wooded, making agriculture somewhat\
@@ -305,6 +320,11 @@
 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
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Grasslands afford exceptional agricultural opportunities.\
@@ -341,6 +361,11 @@
 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
 flags                = "CanHaveRiver"
 helptext            = _("\
 In addition to being amenable to agriculture, Hills are frequently\
@@ -378,6 +403,11 @@
 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
 flags                = "CanHaveRiver"
 helptext            = _("\
 Jungles are densely overgrown, making agriculture somewhat\
@@ -415,6 +445,11 @@
 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
 flags                = "CanHaveRiver"
 helptext            = _("\
 Mountains are regions of extreme altitude, making agriculture and\
@@ -452,6 +487,11 @@
 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
 flags                = "Oceanic", "NoPollution", "UnsafeCoast", "NoCities"
 helptext            = _("\
 Oceans cover much of the world, and only sea units (Triremes and\
@@ -491,6 +531,11 @@
 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
 flags                = "Starter", "CanHaveRiver"
 helptext            = _("\
 Plains are very broad, sparse regions, which makes trade slightly\
@@ -528,6 +573,11 @@
 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
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
@@ -560,6 +610,11 @@
 mining_time          = 15
 transform_result     = "Ocean"
 transform_time       = 36
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
 flags                = "CanHaveRiver"
 helptext            = _("\
 Swamps suffer from an over-abundance of water, making agriculture\
@@ -597,6 +652,11 @@
 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
 flags                = "NoBarbs", "CanHaveRiver"
 helptext            = _("\
 Tundra are broad, cold regions, fit for some agriculture and little\
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.175
diff -u -r1.175 ruleset.c
--- server/ruleset.c    9 Jun 2004 04:39:13 -0000       1.175
+++ server/ruleset.c    3 Jul 2004 15:36:38 -0000
@@ -1610,6 +1610,16 @@
       t->transform_result =
        lookup_terrain(secfile_lookup_str(file, "%s.transform_result", sec[i]), 
i);
       t->transform_time = secfile_lookup_int(file, "%s.transform_time", 
sec[i]);
+      t->rail_time = 
+          secfile_lookup_int_default(file, 3, "%s.rail_time", sec[i]);
+      t->airbase_time = 
+          secfile_lookup_int_default(file, 3, "%s.airbase_time", sec[i]);
+      t->fortress_time = 
+          secfile_lookup_int_default(file, 3, "%s.fortress_time", sec[i]);
+      t->clean_pollution_time = 
+         secfile_lookup_int_default(file, 3, "%s.clean_pollution_time", 
sec[i]);
+      t->clean_fallout_time = 
+          secfile_lookup_int_default(file, 3, "%s.clean_fallout_time", sec[i]);
 
       slist = secfile_lookup_str_vec(file, &nval, "%s.flags", sec[i]);
       BV_CLR_ALL(t->flags);
@@ -2924,6 +2934,11 @@
 
       packet.transform_result = t->transform_result;
       packet.transform_time = t->transform_time;
+      packet.rail_time = t->rail_time;
+      packet.airbase_time = t->airbase_time;
+      packet.fortress_time = t->fortress_time;
+      packet.clean_pollution_time = t->clean_pollution_time;
+      packet.clean_fallout_time = t->clean_fallout_time;
 
       packet.flags = t->flags;
 

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