Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#3006) transforming land->ocean kills off engineers
Home

[Freeciv-Dev] Re: (PR#3006) transforming land->ocean kills off engineers

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jean-Christophe Dubacq <jean-christophe.dubacq@xxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3006) transforming land->ocean kills off engineers.
From: Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Feb 2003 08:53:08 -0600

On Thu, Feb 06, 2003 at 02:59:12PM +0100, Jean-Christophe Dubacq wrote:
> Excuse my poor question, but how do you terraform ocean -> land ? I
> tried to put an engineer on a boat, and it doesn't have any transform
> option. I also saw the ocean_reclaim_requirement=3 in the ruleset but
> I can't infer how it could work...

your method is correct, but ocean_reclaim_requirement=3 means that you 
must have at least 3 land tiles adjacent to the ocean square that you're 
attempting to transform.

Here is the appropriate code:

common/unit.c:779

  case ACTIVITY_TRANSFORM:
    return (terrain_control.may_transform &&
            (type->transform_result!=T_LAST) &&
            (ptile->terrain!=type->transform_result) &&
            (!is_ocean(ptile->terrain) || is_ocean(type->transform_result) ||
             can_reclaim_ocean(punit->x, punit->y)) &&
            (is_ocean(ptile->terrain) || !is_ocean(type->transform_result) ||
             can_channel_land(punit->x, punit->y)) &&
            (!is_ocean(type->transform_result) ||
             !(map_get_city(punit->x, punit->y))) &&
            unit_flag(punit, F_TRANSFORM));

and common/map.c:

bool can_reclaim_ocean(int x, int y)
{
  int landtiles = terrain_control.ocean_reclaim_requirement;

  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;
} 

-mike


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