Complete.Org: Mailing Lists: Archives: freeciv-dev: April 1999:
[Freeciv-Dev] patch: zoc changes to match Civ2
Home

[Freeciv-Dev] patch: zoc changes to match Civ2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] patch: zoc changes to match Civ2
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sun, 25 Apr 1999 21:54:57 +1000 (EST)

This patch makes ZOC changes to bring the rules in line with Civ2.
I'm not completely sure how the AI will be affected by this, but
maybe not be as badly as I previously thought....

-- David
diff -u -r --exclude-from exclude freeciv-cvs/data/helpdata.txt 
freeciv-mod/data/helpdata.txt
--- freeciv-cvs/data/helpdata.txt       Thu Apr  8 21:46:34 1999
+++ freeciv-mod/data/helpdata.txt       Sun Apr 25 20:44:28 1999
@@ -1657,21 +1657,27 @@
 The general rule is that a land unit which is adjacent to an enemy
 occupied square cannot move directly to another square which is
 also adjacent to an enemy occupied square.  Here an enemy occupied
-square means an enemy city, or an enemy unit on a land square.
-Adjacency means any of the eight squares surrounding a unit.
+square means a land square with an enemy unit on it.  Adjacency 
+means any of the eight squares surrounding a unit.
 
 In the following special cases ZOC does not apply:
 - A unit moving directly into or out of a city.
 - A unit moving onto a square occupied by a friendly unit.
+- A unit moving from an ocean square (disembarking from a boat).
 - A unit type which explicitly ignores ZOC, eg Diplomats.
 
-Note:
+Notes:
 - Only land units are restricted by ZOC.
 - Non-land units can impose ZOC (that is, count as enemy occupied
   squares), but only if they are on a land square.  So effectively
   sea units cannot impose ZOC, and air units (including helicopters)
-  do not impose ZOC if they are over sea squares.
+  do not impose ZOC if they are over ocean squares.
 - ZOC does not restrict unit attacks, only movement.
+- An enemy city counts as an enemy occupied square if they are any 
+  units inside the city, but not if the city is empty.
+- Moving from an ocean square is a special case; moving _to_ an 
+  ocean square (moving back onto a boat) is also permitted, by the
+  special case of moving onto a friendly unit (the boat).
 
 TIP: You can infiltrate enemy zones by first moving in a Diplomat
      (or some other unit which ignores ZOC), and then moving regular
@@ -1680,10 +1686,10 @@
      behind to keep squares occupied), you can make a path through
      enemy territory.
 
-The following Freeciv ZOC effects differ from some similar games:
-- Enemy cities with no units in them impose ZOC.
-- Land units moving from boats at sea onto land are subject to ZOC.
-These cases will probably be changed in a future version of Freeciv.
+These rules differ slightly from previous versions of freeciv 
+(release 1.8.0 and before) in the following ways:
+- Enemy cities with no units in them no longer impose ZOC.
+- The special case for land units disembarking is new.
 ---
 %% It would probably be better to have some client-side code to
 %% automatically pull terrain information from the tile_types[]
diff -u -r --exclude-from exclude freeciv-cvs/server/gotohand.c 
freeciv-mod/server/gotohand.c
--- freeciv-cvs/server/gotohand.c       Sun Apr 25 12:29:20 1999
+++ freeciv-mod/server/gotohand.c       Sun Apr 25 20:47:58 1999
@@ -269,10 +269,6 @@
     ax = map_adjust_x(myunit->x + ii[k]);
     ay = map_adjust_y(myunit->y + jj[k]);
     
-    /* remove following case if/when empty cities do not impose zoc: */
-    if (is_enemy_city_tile(ax,ay,owner))
-      return 0;
-    
     if (!dir_ok(x0, y0, myunit->goto_dest_x, myunit->goto_dest_y, k))
       continue;
     /* don't care too much about ZOC of units we've already gone past -- Syela 
*/
diff -u -r --exclude-from exclude freeciv-cvs/server/unittools.c 
freeciv-mod/server/unittools.c
--- freeciv-cvs/server/unittools.c      Sun Apr 25 12:29:20 1999
+++ freeciv-mod/server/unittools.c      Sun Apr 25 20:48:33 1999
@@ -171,9 +171,6 @@
     ay=map_adjust_y(y);
     if ((map_get_terrain(ax,ay)!=T_OCEAN) && is_enemy_unit_tile(ax,ay,owner))
       return 0;
-    /* remove following case for empty cities to not impose zoc: */
-    if (is_enemy_city_tile(ax,ay,owner))
-      return 0;
   }
   return 1;
 }
@@ -186,7 +183,8 @@
   2. Your unit isn't a ground unit
   3. Your unit ignores ZOC (diplomat, freight, etc.)
   4. You're moving from or to a city
-  5. The spot you're moving from or to is in your ZOC
+  5. You're moving from an ocean square (from a boat)
+  6. The spot you're moving from or to is in your ZOC
 **************************************************************************/
 int zoc_ok_move_gen(struct unit *punit, int x1, int y1, int x2, int y2)
 {
@@ -195,6 +193,8 @@
   if (is_friendly_unit_tile(x2, y2, punit->owner))
     return 1;
   if (map_get_city(x1, y1) || map_get_city(x2, y2))
+    return 1;
+  if (map_get_terrain(x1,y1)==T_OCEAN)
     return 1;
   return (is_my_zoc(punit, x1, y1) || is_my_zoc(punit, x2, y2)); 
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] patch: zoc changes to match Civ2, David Pfitzner <=