Complete.Org: Mailing Lists: Archives: freeciv-dev: November 1998:
[Freeciv-Dev] ZOC issues again
Home

[Freeciv-Dev] ZOC issues again

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxxx
Subject: [Freeciv-Dev] ZOC issues again
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sun, 1 Nov 1998 21:54:10 +1100

I was considering writing some help text on ZOC (zone of control), 
and on looking at the actual ZOC code, came across some minor 
strangeness.  (And was also reminded of old ZOC issues (at end).)

In server/unittools.c we have the following function is_my_zoc, 
where here "is_my_zoc" means essentially a square which is not 
adjacent to an enemy unit (or an enemy city, if cities have zoc).

(is_my_zoc is called as the last step in zoc_ok_move, which says:
  You CAN move if:
  1. You have units there already
  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
).

> /**************************************************************************
>   is this square controlled by the units owner
> **************************************************************************/
> int is_my_zoc(struct unit *myunit, int x0, int y0)
> {
>   int x,y;
>   int ax,ay;
>   int owner=myunit->owner;
> 
>   for (x=x0-1;x<x0+2;x++) for (y=y0-1;y<y0+2;y++) {
>     ax=map_adjust_x(x); ay=map_adjust_y(y);

>     if (is_enemy_city_tile(ax,ay,owner))
>       return 0;

This clause should go if empty cities do not impose ZOC.

>     if (is_enemy_unit_tile(ax,ay,owner))

>       if((is_sailing_unit(myunit) && (map_get_terrain(ax,ay)==T_OCEAN)) ||
>        (!is_sailing_unit(myunit) && (map_get_terrain(ax,ay)!=T_OCEAN)) )
>         return 0;

This clause is strange; firstly I'm pretty sure is_my_zoc() is only
ever called for ground units (certainly when called from zoc_ok_move();
is_my_zoc() is also called directly from gotohand and ai routines, 
but I _think_ even there only for ground units).
So the test for is_sailing_unit() may be obsolete code...
For non-sailing units, enemy units which are adjacent but on 
ocean square don't impose zoc.  This is fine for sea units,
and sea passengers, but I was wondering about air units?
An air unit over land imposes zoc on all adjacent land squares,
but this clause means air units over ocean next to land don't
impose zoc on the adjacent land squares, which seems a bit odd...?
(Though that would be more complicated to implement: you would have 
to go through the tile unit list to see if any were air units.  And
should air units on Carriers/Subs count?)

>   }
>   return 1;
> }

So... (what was my point again?) 

- Maybe I'll try a check in is_my_zoc to see if it is ever called
  with non-ground units; otherwise that bit of code can be simplified.

- Should air units over ocean impose zoc on adjacent land squares?

- Does anyone still think empty cities should impose zoc?
  I've checked Civ1, where in the game they do not.  (Though the Civ1 
  manual says essentially "enemy cities impose zoc", and does not qualify 
  that by whether they are empty or not.)  
  Aliaga <aliaga@xxxxxxxxxxxx> said that in Civ2 they do not.

- Another issue was whether zoc should apply when unloading land units
  off boats.  In Civ1 and (reportedly) Civ2, zoc does not apply in
  this case.

-- David





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] ZOC issues again, David Pfitzner <=