Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9999) channeling and reclaiming in hex tiles
Home

[Freeciv-Dev] (PR#9999) channeling and reclaiming in hex tiles

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9999) channeling and reclaiming in hex tiles
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 9 Sep 2004 14:43:29 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch will fix the land_channel_requirement and 
ocean_reclaim_requirement so they'll work with hex tiles.  The 
requirement is listed as a percentage.

jason

Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.184
diff -u -r1.184 capstr.c
--- common/capstr.c     6 Sep 2004 02:58:11 -0000       1.184
+++ common/capstr.c     9 Sep 2004 21:42:01 -0000
@@ -73,7 +73,7 @@
  * are not directly related to the capability strings discussed here.)
  */
 
-#define CAPABILITY "+Freeciv.Devel.2004.Sep.5"
+#define CAPABILITY "+Freeciv.Devel.2004.Sep.9"
 
 void init_our_capability(void)
 {
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.192
diff -u -r1.192 map.c
--- common/map.c        3 Sep 2004 15:12:25 -0000       1.192
+++ common/map.c        9 Sep 2004 21:42:01 -0000
@@ -990,20 +990,9 @@
 **************************************************************************/
 bool can_reclaim_ocean(int x, int y)
 {
-  int landtiles = terrain_control.ocean_reclaim_requirement;
+  int land_tiles = 100 - count_ocean_near_tile(x, y, FALSE, TRUE);
 
-  if (landtiles >= 9)
-    return FALSE;
-  if (landtiles <= 0)
-    return TRUE;
-
-  adjc_iterate(x, y, x1, y1) {
-    if (!is_ocean(map_get_tile(x1, y1)->terrain))
-      if (--landtiles == 0)
-       return TRUE;    
-  } adjc_iterate_end;
-
-  return FALSE;
+  return land_tiles >= terrain_control.ocean_reclaim_requirement_pct;
 }
 
 /**************************************************************************
@@ -1013,20 +1002,9 @@
 **************************************************************************/
 bool can_channel_land(int x, int y)
 {
-  int oceantiles = terrain_control.land_channel_requirement;
+  int ocean_tiles = count_ocean_near_tile(x, y, FALSE, TRUE);
 
-  if (oceantiles >= 9)
-    return FALSE;
-  if (oceantiles <= 0)
-    return TRUE;
-
-  adjc_iterate(x, y, x1, y1) {
-    if (is_ocean(map_get_tile(x1, y1)->terrain))
-      if (--oceantiles == 0)
-       return TRUE;
-  } adjc_iterate_end;
-
-  return FALSE;
+  return ocean_tiles >= terrain_control.land_channel_requirement_pct;
 }
 
 /***************************************************************
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.48
diff -u -r1.48 packets.def
--- common/packets.def  9 Sep 2004 21:22:34 -0000       1.48
+++ common/packets.def  9 Sep 2004 21:42:01 -0000
@@ -1083,8 +1083,8 @@
   BOOL may_transform;  /* may transform terrain */
 
   /* parameters */
-  UINT8 ocean_reclaim_requirement;     /* # adjacent land tiles for reclaim */
-  UINT8 land_channel_requirement;      /* # adjacent ocean tiles for channel */
+  UINT8 ocean_reclaim_requirement_pct; /* # adjacent land tiles for reclaim */
+  UINT8 land_channel_requirement_pct; /* # adjacent ocean tiles for channel */
   RIVER_MOVE river_move_mode;
 
   UINT16 river_defense_bonus;           /* % added to defense if Civ2 river */
Index: data/civ1/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/terrain.ruleset,v
retrieving revision 1.28
diff -u -r1.28 terrain.ruleset
--- data/civ1/terrain.ruleset   4 Sep 2004 16:53:39 -0000       1.28
+++ data/civ1/terrain.ruleset   9 Sep 2004 21:42:02 -0000
@@ -22,13 +22,13 @@
 
 [parameters]
 
-; number of "land" tiles required to be adjacent to an ocean tile before
-; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere)
-ocean_reclaim_requirement=9
-
-; number of "ocean" tiles required to be adjacent to a land tile before
-; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere)
-land_channel_requirement=9
+; Percentage of "land" tiles required to be adjacent to an ocean tile before
+; it may be "reclaimed" into a land tile (0-101; 0=anywhere, 101=nowhere)
+ocean_reclaim_requirement=101
+
+; Percentage of "ocean" tiles required to be adjacent to a land tile before
+; it may be "channeled" into an ocean tile (0-101; 0=anywhere, 101=nowhere)
+land_channel_requirement=101
 
 ; special movement costs for rivers:
 ;   0 - normal movement cost for rivers (matches Civ1)
Index: data/civ2/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/terrain.ruleset,v
retrieving revision 1.30
diff -u -r1.30 terrain.ruleset
--- data/civ2/terrain.ruleset   4 Sep 2004 16:53:39 -0000       1.30
+++ data/civ2/terrain.ruleset   9 Sep 2004 21:42:02 -0000
@@ -22,13 +22,13 @@
 
 [parameters]
 
-; number of "land" tiles required to be adjacent to an ocean tile before
-; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere)
-ocean_reclaim_requirement=9
-
-; number of "ocean" tiles required to be adjacent to a land tile before
-; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere)
-land_channel_requirement=9
+; Percentage of "land" tiles required to be adjacent to an ocean tile before
+; it may be "reclaimed" into a land tile (0-101; 0=anywhere, 101=nowhere)
+ocean_reclaim_requirement_pct=101
+
+; Percentage of "ocean" tiles required to be adjacent to a land tile before
+; it may be "channeled" into an ocean tile (0-101; 0=anywhere, 101=nowhere)
+land_channel_requirement_pct=101
 
 ; special movement costs for rivers:
 ;   0 - normal movement cost for rivers (matches Civ1)
Index: data/default/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/terrain.ruleset,v
retrieving revision 1.31
diff -u -r1.31 terrain.ruleset
--- data/default/terrain.ruleset        4 Sep 2004 16:53:39 -0000       1.31
+++ data/default/terrain.ruleset        9 Sep 2004 21:42:02 -0000
@@ -22,13 +22,13 @@
 
 [parameters]
 
-; number of "land" tiles required to be adjacent to an ocean tile before
-; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere)
-ocean_reclaim_requirement=3
-
-; number of "ocean" tiles required to be adjacent to a land tile before
-; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere)
-land_channel_requirement=1
+; Percentage of "land" tiles required to be adjacent to an ocean tile before
+; it may be "reclaimed" into a land tile (0-101; 0=anywhere, 101=nowhere)
+ocean_reclaim_requirement_pct = 30
+
+; Percentage of "ocean" tiles required to be adjacent to a land tile before
+; it may be "channeled" into an ocean tile (0-101; 0=anywhere, 101=nowhere)
+land_channel_requirement_pct = 10
 
 ; special movement costs for rivers:
 ;   0 - normal movement cost for rivers (matches Civ1)
Index: data/history/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/terrain.ruleset,v
retrieving revision 1.13
diff -u -r1.13 terrain.ruleset
--- data/history/terrain.ruleset        4 Sep 2004 16:53:39 -0000       1.13
+++ data/history/terrain.ruleset        9 Sep 2004 21:42:02 -0000
@@ -22,13 +22,13 @@
 
 [parameters]
 
-; number of "land" tiles required to be adjacent to an ocean tile before
-; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere)
-ocean_reclaim_requirement=3
-
-; number of "ocean" tiles required to be adjacent to a land tile before
-; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere)
-land_channel_requirement=1
+; Percentage of "land" tiles required to be adjacent to an ocean tile before
+; it may be "reclaimed" into a land tile (0-101; 0=anywhere, 101=nowhere)
+ocean_reclaim_requirement=30
+
+; Percentage of "ocean" tiles required to be adjacent to a land tile before
+; it may be "channeled" into an ocean tile (0-101; 0=anywhere, 101=nowhere)
+land_channel_requirement=10
 
 ; special movement costs for rivers:
 ;   0 - normal movement cost for rivers (matches Civ1)
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.193
diff -u -r1.193 ruleset.c
--- server/ruleset.c    6 Sep 2004 02:58:12 -0000       1.193
+++ server/ruleset.c    9 Sep 2004 21:42:03 -0000
@@ -1553,10 +1553,12 @@
 
   /* parameters */
 
-  terrain_control.ocean_reclaim_requirement =
-    secfile_lookup_int_default(file, 9, 
"parameters.ocean_reclaim_requirement");
-  terrain_control.land_channel_requirement =
-    secfile_lookup_int_default(file, 9, "parameters.land_channel_requirement");
+  terrain_control.ocean_reclaim_requirement_pct
+    = secfile_lookup_int_default(file, 9,
+                                "parameters.ocean_reclaim_requirement_pct");
+  terrain_control.land_channel_requirement_pct
+    = secfile_lookup_int_default(file, 9,
+                                "parameters.land_channel_requirement_pct");
   terrain_control.river_move_mode =
     secfile_lookup_int_default(file, RMV_FAST_STRICT, 
"parameters.river_move_mode");
   terrain_control.river_defense_bonus =

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9999) channeling and reclaiming in hex tiles, Jason Short <=