DELTA 77 137776 3266
SVN  žEĄv/Y @ U A ˙ o¤Q i§~ ¨u5 w­
W G vFC__MAP_H
#define FC__MAP_H

#include <assert.h>
#include <math.h>

#include "fc_types.h"

#include "tile.h"

/*
 * The value of MOVE_COST_FOR_VALID_SEA_STEP has no particular
 * meaning. The value is only used for comparison. The value must be
 * <0.
 */
#define MOVE_COST_FOR_VALID_SEA_STEP	(-3)
#define MOVE_COST_FOR_VALID_AIR_STEP	(-3)


miscellaneous terrain information
*****************************************************************/
#define terrain_misc packet_ruleset_terrain_control

struct civ_map {
  int topology_id;
  enum direction8 valid_dirs[8], cardinal_dirs[8];
  int num_valid_dirs, num_cardinal_dirs;
  struct iter_index *iterate_outwards_indices;
  int num_iterate_outwards_indices;
  int size; /* used to calculate [xy]size */
  int xsize, ysize; /* native dimensions */
  int seed;
  int riches;
  int huts;
  int landpercent;
  int generator;
  int startpos;
  bool tinyisles;
  bool separatepoles;
  bool alltemperate;
  int temperature;
  int wetness;
  int steepness;
  int num_start_positions;
  bool have_resources;
  bool have_huts;
  bool have_rivers_overlay;	/* only applies if !have_resources */
  int num_continents;
  int num_oceans;               /* not updated at the client */
  struct tile *tiles;

  /* Only used by server. */
  struct start_position {
    struct tile *tile;
    struct nation_type *nation; /* May be NO_NATION_SELECTED. */
  } *start_positions;	/* allocated at runtime */
};

enum topo_flag {
  /* Bit-values. */
  /* Changing these values will break map_init_topology. */
  TF_WRAPX = 1,
  TF_WRAPY = 2,
  TF_ISO = 4,
  TF_HEX = 8
};

/* Parameters for terrain counting functions. */
static const bool C_ADJACENT = FALSE;
static const bool C_CARDINAL = TRUE;
static const bool C_NUMBER = FALSE;
static const bool C_PERCENT = TRUE;

#define MAP_IS_ISOMETRIC (topo_has_flag(TF_ISO) || topo_has_flag(TF_HEX))

#define CURRENT_TOPOLOGY (map.topology_id)

#define topo_has_flag(flag) ((CURRENT_TOPOLOGY & (flag)) != 0)

bool map_is_empty(void);
void map_init(void);
void map_init_topology(bool set_sizes);
void map_allocate(void);
void map_free(void);

int map_vector_to_real_distance(int dx, int dy);
int map_vector_to_sq_distance(int dx, int dy);
int map_distance(const struct tile *tile0, const struct tile *tile1);
int real_map_distance(const struct tile *tile0, const struct tile *tile1);
int sq_map_distance(const struct tile *tile0,const  struct tile *tile1);

bool same_pos(const struct tile *tile0, const struct tile *tile1);
bool base_get_direction_for_step(const struct tile *src_tile,
				 const struct tile *dst_tile,
				 enum direction8 *dir);
int get_direction_for_step(const struct tile *src_tile,
			   const struct tile *dst_tile);

/* Number of index coordinates (for sanity checks and allocations) */
#define MAP_INDEX_SIZE (map.xsize * map.ysize)

#ifdef DEBUG
#define CHECK_MAP_POS(x,y) assert(is_normal_map_pos((x),(y)))
#define CHECK_NATIVE_POS(x, y) assert((x) >= 0 && (x) < map.xsize \
				      && (y) >= 0 && (y) < map.ysize)
#define CHECK_INDEX(index) assert((index) >= 0 && (index) < MAP_INDEX_SIZE)
#else
#define CHECK_MAP_POS(x,y) ((void)0)
#define CHECK_NATIVE_POS(x, y) ((void)0)
#define CHECK_INDEX(index) ((void)0)
#endif

#define native_pos_to_index(nat_x, nat_y)                                   \
  (CHECK_NATIVE_POS((nat_x), (nat_y)),					    \
   (nat_x) + (nat_y) * map.xsize)
#define index_to_native_pos(pnat_x, pnat_y, index)                          \
  (*(pnat_x) = (index) % map.xsize,                                         \
   *(pnat_y) = (index) / map.xsize)

/* Obscure math.  See explanation in doc/HACKING. */
#define NATIVE_TO_MAP_POS(pmap_x, pmap_y, nat_x, nat_y)                     \
  (MAP_IS_ISOMETRIC							    \
   ? (*(pmap_x) = ((nat_y) + ((nat_y) & 1)) / 2 + (nat_x),                  \
      *(pmap_y) = (nat_y) - *(pmap_x) + map.xsize)                          \
   : (*(pmap_x) = (nat_x), *(pmap_y) = (nat_y)))

#define MAP_TO_NATIVE_POS(pnat_x, pnat_y, map_x, map_y)                     \
  (MAP_IS_ISOMETRIC							    \
   ? (*(pnat_y) = (map_x) + (map_y) - map.xsize,                            \
      *(pnat_x) = (2 * (map_x) - *(pnat_y) - (*(pnat_y) & 1)) / 2)          \
   : (*(pnat_x) = (map_x), *(pnat_y) = (map_y)))

#define NATURAL_TO_MAP_POS(pmap_x, pmap_y, nat_x, nat_y)                    \
  (MAP_IS_ISOMETRIC							    \
   ? (*(pmap_x) = ((nat_y) + (nat_x)) / 2,                                  \
      *(pmap_y) = (nat_y) - *(pmap_x) + map.xsize)                          \
   : (*(pmap_x) = (nat_x), *(pmap_y) = (nat_y)))

#define MAP_TO_NATURAL_POS(pnat_x, pnat_y, map_x, map_y)                    \
  (MAP_IS_ISOMETRIC							    \
   ? (*(pnat_y) = (map_x) + (map_y) - map.xsize,                            \
      *(pnat_x) = 2 * (map_x) - *(pnat_y))                                  \
   : (*(pnat_x) = (map_x), *(pnat_y) = (map_y)))


/* Provide a block to convert from map to native coordinates.  This allows
 * you to use a native version of the map position within the block.  Note
 * that the native position is declared as const and can't be changed
 * inside the block. */
#define do_in_native_pos(nat_x, nat_y, map_x, map_y)                        \
{                                                                           \
  int _nat_x, _nat_y;                                                       \
  MAP_TO_NATIVE_POS(&_nat_x, &_nat_y, map_x, map_y);			    \
  {                                                                         \
    const int nat_x = _nat_x, nat_y = _nat_y;

#define do_in_native_pos_end                                                \
  }                                                                         \
}

/* Provide a block to convert from map to natural coordinates. This allows
 * you to use a natural version of the map position within the block.  Note
 * that the natural position is declared as const and can't be changed
 * inside the block. */
#define do_in_natural_pos(ntl_x, ntl_y, map_x, map_y)                        \
{                                                                           \
  int _ntl_x, _ntl_y;                                                       \
  MAP_TO_NATURAL_POS(&_ntl_x, &_ntl_y, map_x, map_y);			    \
  {                                                                         \
    const int ntl_x = _ntl_x, ntl_y = _ntl_y;

#define do_in_natural_pos_end                                                \
  }                                                                         \
}

/* Width and height of the map, in native coordinates. */
#define NATIVE_WIDTH map.xsize
#define NATIVE_HEIGHT map.ysize

/* Width and height of the map, in natural coordinates. */
#define NATURAL_WIDTH (MAP_IS_ISOMETRIC ? 2 * map.xsize : map.xsize)
#define NATURAL_HEIGHT map.ysize

#define MAP_WIDTH  \
  (MAP_IS_ISOMETRIC ? (map.xsize + map.ysize / 2) : map.xsize)
#define MAP_HEIGHT \
  (MAP_IS_ISOMETRIC ? (map.xsize + map.ysize / 2) : map.ysize)
  
static inline int map_pos_to_index(int map_x, int map_y);

/* index_to_map_pos(int *, int *, int) inverts map_pos_to_index */
#define index_to_map_pos(pmap_x, pmap_y, index) \
  (CHECK_INDEX(index),                          \
   index_to_native_pos(pmap_x, pmap_y, index),  \
   NATIVE_TO_MAP_POS(pmap_x, pmap_y, *(pmap_x), *(pmap_y)))

#define DIRSTEP(dest_x, dest_y, dir)	\
(    (dest_x) = DIR_DX[(dir)],      	\
     (dest_y) = DIR_DY[(dir)])

/*
 * Steps from the tile in the given direction, yielding a new tile (or NULL).
 *
 * Direct calls to DIR_DXY should be avoided and DIRSTEP should be
 * used. But to allow dest and src to be the same, as in
 *    MAPSTEP(x, y, x, y, dir)
 * we bend this rule here.
 */
struct tile *mapstep(const struct tile *ptile, enum direction8 dir);

struct tile *map_pos_to_tile(int x, int y);
struct tile *native_pos_to_tile(int nat_x, int nat_y);
struct tile *index_to_tile(int index);

bool is_real_map_pos(int x, int y);
bool is_normal_map_pos(int x, int y);

bool is_singular_tile(const struct tile *ptile, int dist);
bool normalize_map_pos(int *x, int *y);
struct tile *nearest_real_tile(int x, int y);
void base_map_distance_vector(int *dx, int *dy,
			      int x0, int y0, int x1, int y1);
void map_distance_vector(int *dx, int *dy, const struct tile *ptile0,
			 const struct tile *ptile1);
int map_num_tiles(void);

struct tile *rand_neighbour(const struct tile *ptile);
struct tile *rand_map_pos(void);
struct tile *rand_map_pos_filtered(void *data,
				   bool (*filter)(const struct tile *ptile,
						  const void *data));

bool is_water_adjacent_to_tile(const struct tile *ptile);
bool is_tiles_adjacent(const struct tile *ptile0, const struct tile *ptile1);
bool is_move_cardinal(const struct tile *src_tile,
		      const struct tile *dst_tile);
int map_move_cost(struct unit *punit, const struct tile *ptile);
int map_move_cost_ai(const struct tile *tile0, const struct tile *tile1);
bool is_safe_ocean(const struct tile *ptile);
bool is_cardinally_adj_to_ocean(const struct tile *ptile);
bv_special get_tile_infrastructure_set(const struct tile *ptile,
					  int *count);

bool can_channel_land(const struct tile *ptile);
bool can_reclaim_ocean(const struct tile *ptile);

extern struct civ_map map;

extern struct terrain_misc terrain_control;

#define vision_layer_iterate(vision)					    \
  {									    \
    enum vision_layer vision;						    \
									    \
  for (vision = 0; vision < V_COUNT; vision++) {

#define vision_layer_iterate_end					    \
  }									    \
}

/* This iterates outwards from the starting point. Every tile within max_dist
 * will show up exactly once, in an outward (based on real map distance)
 * order.  The returned values are always real and are normalized.  The
 * starting position must be normal.
 *
 * See also iterate_outward() */
#define iterate_outward_dxy(start_tile, max_dist, tile_itr, dx_itr, dy_itr) \
{									    \
  const struct tile *_start_tile = (start_tile);			    \
  struct tile *tile_itr;						    \
  int _max_dist = (max_dist), _x_itr, _y_itr, dx_itr, dy_itr, _index;	    \
  bool _is_border = is_border_tile(_start_tile, _max_dist);		    \
									    \
  for (_index = 0; _index < map.num_iterate_outwards_indices; _index++) {   \
    if (map.iterate_outwards_indices[_index].dist > _max_dist) {	    \
      break;								    \
    }									    \
    dx_itr = map.iterate_outwards_indices[_index].dx;			    \
    dy_itr = map.iterate_outwards_indices[_index].dy;			    \
    _x_itr = dx_itr + _start_tile->x;					    \
    _y_itr = dy_itr + _start_tile->y;					    \
    if (_is_border && !normalize_map_pos(&_x_itr, &_y_itr)) {		    \
      continue;								    \
    }									    \
    tile_itr = map.tiles + map_pos_to_index(_x_itr, _y_itr);

#define iterate_outward_dxy_end						    \
  }                                                                         \
}

/* See iterate_outward_dxy() */
#define iterate_outward(start_tile, max_dist, itr_tile)			    \
  iterate_outward_dxy(start_tile, max_dist, itr_tile, _dx_itr, _dy_itr)

#define iterate_outward_end iterate_outward_dxy_end

/* 
 * Iterate through all tiles in a square with given center and radius.
 * The position (x_itr, y_itr) that is returned will be normalized;
 * unreal positions will be automatically discarded. (dx_itr, dy_itr)
 * is the standard distance vector between the position and the center
 * position. Note that when the square is larger than the map the
 * distance vector may not be the minimum distance vector.
 */
#define square_dxy_iterate(center_tile, radius, tile_itr, dx_itr, dy_itr)   \
  iterate_outward_dxy(center_tile, radius, tile_itr, dx_itr, dy_itr)

#define square_dxy_iterate_end iterate_outward_dxy_end

/*
 * Iterate through all tiles in a square with given center and radius.
 * Positions returned will have adjusted x, and positions with illegal
 * y will be automatically discarded.
 */
#define square_iterate(center_tile, radius, tile_itr)			    \
  square_dxy_iterate(center_tile, radius, tile_itr, _dummy_x, dummy_y)

#define square_iterate_end  square_dxy_iterate_end

/* 
 * Iterate through all tiles in a circle with given center and squared
 * radius.  Positions returned will have adjusted (x, y); unreal
 * positions will be automatically discarded. 
 */
#define circle_iterate(center_tile, sq_radius, tile_itr)		    \
  circle_dxyr_iterate(center_tile, sq_radius, tile_itr, _dx, _dy, _dr)

#define circle_iterate_end                                                  \
  circle_dxyr_iterate_end

/* dx, dy, dr are distance from center to tile in x, y and square distance;
 * do not rely on x, y distance, since they do not work for hex topologies */
#define circle_dxyr_iterate(center_tile, sq_radius,			    \
			    tile_itr, dx, dy, dr)			    \
{									    \
  const int _sq_radius = (sq_radius);					    \
  const int _cr_radius = (int)sqrt((double)MAX(_sq_radius, 0));		    \
									    \
  square_dxy_iterate(center_tile, _cr_radius, tile_itr, dx, dy) {	    \
    const int dr = map_vector_to_sq_distance(dx, dy);			    \
									    \
    if (dr <= _sq_radius) {

#define circle_dxyr_iterate_end						    \
    }									    \
  } square_dxy_iterate_end;						    \
}

/* Iterate through all map positions adjacent to the given center map
 * position, with normalization.  The order of positions is unspecified. */
#define adjc_iterate(center_tile, itr_tile)				    \
{									    \
  /* Written as a wrapper to adjc_dir_iterate since it's the cleanest and   \
   * most efficient. */							    \
  adjc_dir_iterate(center_tile, itr_tile, ADJC_ITERATE_dir_itr) {

#define adjc_iterate_end                                                    \
  } adjc_dir_iterate_end;                                                   \
}

#define adjc_dir_iterate(center_tile, itr_tile, dir_itr)		    \
  adjc_dirlist_iterate(center_tile, itr_tile, dir_itr,			    \
		       map.valid_dirs, map.num_valid_dirs)

#define adjc_dir_iterate_end adjc_dirlist_iterate_end

#define cardinal_adjc_iterate(center_tile, itr_tile)			    \
  adjc_dirlist_iterate(center_tile, itr_tile, _dir_itr,			    \
		       map.cardinal_dirs, map.num_cardinal_dirs)

#define cardinal_adjc_iterate_end adjc_dirlist_iterate_end

#define cardinal_adjc_dir_iterate(center_tile, itr_tile, dir_itr)	    \
  adjc_dirlist_iterate(center_tile, itr_tile, dir_itr,			    \
		       map.cardinal_dirs, map.num_cardinal_dirs)

#define cardinal_adjc_dir_iterate_end adjc_dirlist_iterate_end

/* Iterate through all tiles adjacent to a tile using the given list of
 * directions.  dir_itr is the directional value, (center_x, center_y) is
 * the center tile (which must be normalized), and (x_itr, y_itr) is the
 * position corresponding to dir_itr.
 *
 * This macro should not be used directly.  Instead, use adjc_dir_iterate
 * or cartesian_adjacent_iterate. */
#define adjc_dirlist_iterate(center_tile, itr_tile, dir_itr,		    \
			     dirlist, dircount)				    \
{									    \
  const struct tile *_center_tile = (center_tile);			    \
  struct tile *itr_tile;						    \
  int _dir_index, _x_itr, _y_itr;					    \
  enum direction8 dir_itr;						    \
  bool _is_border = is_border_tile(_center_tile, 1);			    \
									    \
  for (_dir_index = 0; _dir_index < (dircount); _dir_index++) {		    \
    dir_itr = dirlist[_dir_index];					    \
    DIRSTEP(_x_itr, _y_itr, dir_itr);					    \
    _x_itr += _center_tile->x;						    \
    _y_itr += _center_tile->y;						    \
    if (_is_border && !normalize_map_pos(&_x_itr, &_y_itr)) {		    \
      continue;								    \
    }									    \
    itr_tile = map.tiles + map_pos_to_index(_x_itr, _y_itr);

#define adjc_dirlist_iterate_end					    \
    }									    \
}

/* Iterate over all positions on the globe. */
#define whole_map_iterate(ptile)					    \
{                                                                           \
  int _index; /* We use index positions for cache efficiency. */	    \
  for (_index = 0; _index < MAP_INDEX_SIZE; _index++) {			    \
    struct tile *ptile = map.tiles + _index;				    \

#define whole_map_iterate_end                                               \
  }                                                                         \
}

BV_DEFINE(dir_vector, 8);

/* return the reverse of the direction */
#define DIR_REVERSE(dir) (7 - (dir))

enum direction8 dir_cw(enum direction8 dir);
enum direction8 dir_ccw(enum direction8 dir);
const char* dir_get_name(enum direction8 dir);
bool is_valid_dir(enum direction8 dir);
bool is_cardinal_dir(enum direction8 dir);

extern const int DIR_DX[8];
extern const int DIR_DY[8];

/* Used for network transmission; do not change. */
#define MAP_TILE_OWNER_NULL	 MAX_UINT8/* Size of the map in thousands of tiles */
#define MAP_DEFAULT_SIZE         4
#define MAP_MIN_SIZE             1
#define MAP_MAX_SIZE             29

/* This defines the maximum linear size in _map_ coordinates.
 * This must be smaller than 255 because of the way coordinates are sent
 * across the network. */
#define MAP_MAX_LINEAR_SIZE      254
#define MAP_MIN_LINEAR_SIZE      8
#define MAP_MAX_WIDTH            MAP_MAX_LINEAR_SIZE
#define MAP_MAX_HEIGHT           MAP_MAX_LINEAR_SIZE

#define MAP_ORIGINAL_TOPO        TF_WRAPX
#define MAP_DEFAULT_TOPO         TF_WRAPX
#define MAP_MIN_TOPO             0
#define MAP_MAX_TOPO             15(MAX_UINT32 >> 1)

#define MAP_DEFAULT_LANDMASS     30
#define MAP_MIN_LANDMASS         15
#define MAP_MAX_LANDMASS         85TEEPNESS    30
#define MAP_MIN_STEEPNESS        0
#define MAP_MAX_STEEPNESS        100

#define MAP_DEFAULT_WETNESS      50
#define MAP_MIN_WETNESS          0
#define MAP_MAX_WETNES3

#define MAP_DEFAULT_STARTPOS     0
#define MAP_MIN_STARTPOS         0
#define MAP_MAX_STARTPOS         4

#define MAP_DEFAULT_TINYISLES    FALSE
#define MAP_MIN_TINYISLES        FALSE
#define MAP_MAX_TINYISLES        TRUE

#define MAP_DEFAULT_SEPARATE_POLES   TRUE
#define MAP_MIN_SEPARATE_POLES       FALSE
#define MAP_MAX_SEPARATE_POLES       TRUE

#define MAP_DEFAULT_ALLTEMPERATE   FALSE
#define MAP_MIN_ALLTEMPERATE       FALSE
#define MAP_MAX_ALLTEMPERATE       TRUE

#define MAP_DEFAULT_TEMPERATURE   50
#define MAP_MIN_TEMPERATURE       0
#define MAP_MAX_TEMPERATURE       100

/*
 * Inline function definitions.  These are at the bottom because they may use
 * elements defined above.
 */

static inline int map_pos_to_index(int map_x, int map_y)
{
  /* Note: writing this as a macro is hard; it needs temp variables. */
  int nat_x, nat_y;

  CHECK_MAP_POS(map_x, map_y);
  MAP_TO_NATIVE_POS(&nat_x, &nat_y, map_x, map_y);
  return native_pos_to_index(nat_x, nat_y);
}

******
  A "border position" is any map position that _may have_ positions within
  real map distance dist that are non-normal.  To see its correctness,
  consider the case where dist is 1 or 0.
****************************************************************************/
static inline bool is_border_tile(const struct tile *ptile, int dist)
{
  /* HACK: An iso-map compresses the value in the X direction but not in
   * the Y direction.  Hence (x+1,y) is 1 tile away while (x,y+2) is also
   * one tile away. */
  int xdist = dist;
  int ydist = (MAP_IS_ISOMETRIC ? (2 * dist) : dist);

  return (ptile->nat_x < xdist 
	  || ptile->nat_y < ydist
	  || ptile->nat_x >= map.xsize - xdist
	  || ptile->nat_y >= map.ysize - ydist);
}

#endif  /* FC__MAP_H */
ENDREP
DELTA 11374 6417 7722
SVN  zas Í s  Î ĸpãn @^8 vQ[ 6?Ą ¸Ļ Ū ; ķaĩ D@c Sđ@t D@9 Sđ@ D@l Wí3E Núvc Vü2 P9 Q)pick_terrain_by_flag may return NULL if there is no match. */
  struct terrain *best_terrain = pick_terrain_by_flag_get_continent(tile1) >pick_terrain_by_flag may return NULL
	       * if there is no match. */
	      pterrain = pick_terrain_by_flagstruct terrain *land_fill = NULL;
  
  if (HAS_POLES) {
    normalize_hmap_poles();
  }

  /* Pick a non-ocean terrain just once and fill all land tiles with "
   * that terrain. We must set some terrain (and not T_UNKNOWN) so that "
   * continent number assignment works. */
  terrain_type_iterate(pterrain) {
    if (!is_ocean(pterrain)) {
      land_fill = pterrain;
      break;
    }
  } terrain_type_iterate_end;
  if (land_fill == NULL) {
    freelog(LOG_FATAL, "No land terrain type could be found for the "
            "purpose of temporarily filling in land tiles during map "
            "generation. This could be an error in freeciv, or a "
            "mistake in the terrain.ruleset file. Please make sure "
            "there is at least one land terrain type in the ruleset, "
            "or use a different map generator. If this error persists, "
            "please report it at: %s", BUG_URL);
    assert(land_fill != NULL);
  }
 else {
      /* See note above for 'land_fill'. */
      tile_set_terrain(ptile, land_fillterrain_rule_name(pterrain),
	   , FALSE) 
	     || is_terrain_near_tile(ptile, warm1, FALSE)
	     || myrand(100)<50 
	     || is_terrain_near_tile(ptile, cold0, FALSE)
	     || is_terrain_near_tile(ptile, cold1, FALSE)Returns TRUE if ptile is suitable for a river mouth.
******/
static bool island_river_mouth_suitability(const struct tile *ptile)
{
  int num_card_ocean, pct_adj_ocean, num_adj_river;

  num_card_ocean = count_ocean_near_tile(ptile, C_CARDINAL, C_NUMBER);
  pct_adj_ocean = count_ocean_near_tile(ptile, C_ADJACENT, C_PERCENT);
  num_adj_river = count_special_near_tile(ptile, C_ADJACENT, C_NUMBER,
                                          S_RIVER);

  return (num_card_ocean == 1 && pct_adj_ocean <= 35
          && num_adj_river == 0)Returns TRUE if there is a river in a cardinal direction near the tile
  and the tile is suitable for extending it.
******/
static bool island_river_suitability(const struct tile *ptile)
{
  int pct_adj_ocean, num_card_ocean, pct_adj_river, num_card_river;

  num_card_river = count_special_near_tile(ptile, C_CARDINAL, C_NUMBER,
                                           S_RIVER);
  num_card_ocean = count_ocean_near_tile(ptile, C_CARDINAL, C_NUMBER);
  pct_adj_ocean = count_ocean_near_tile(ptile, C_ADJACENT, C_PERCENT);
  pct_adj_river = count_special_near_tile(ptile, C_ADJACENT, C_PERCENT,
                                          S_RIVER);

  return (num_card_river == 1 && num_card_ocean == 0
          && pct_adj_ocean < 20 && pct_adj_river < 35
          /* The following expression helps with straightness,
           * ocean avoidance, and reduces forking. */
          && (pct_adj_river + pct_adj_ocean * 2) < myrand(25) + 25)Fill an island with rivers.
******/
static void fill_island_rivers(int coast, long int *bucket,
                               const struct gen234_state *const pstate)
{
  long int failsafe, capac, i, k;
  struct tile *ptile;

  if (*bucket <= 0) {
    return;
  }/* generate 75% more rivers than generator 1 */
  i = (i * 175) / 100 * 5;
  if (failsafe < 0) {
    failsafe = -failsafe;
  }

  while (i > 0 && failsafe-- > 0) {
    != pstate->isleindex
        || tile_has_special(ptile, S_RIVER)) {
      continue;
    }

    if ((island_river_mouth_suitability(ptile)
         && (myrand(100) < coast || i == k))
        || island_river_suitability(ptile)) {
      tile_set_special(ptile, S_RIVER);
      i--;ENDREP
id: 2mg.59e.r15385/23382
type: file
pred: 2mg.59e.r15367/51
count: 40
text: 15385 19506 3847 69089 5b5fa0c5fb2dd2ef45cefd3820e0693d
props: 10829 1266 111 0 18cdb9becb11c47631b7a093e907200c
cpath: /branches/S2_1/server/generator/mapgen.c
copyroot: 11448 /branches/S2_1

PLAIN
K 11
Makefile.am
V 21
file 2mf.0.r8249/8781
K 12
height_map.c
V 25
file 2mj.59e.r13482/13971
K 12
height_map.h
V 25
file 2mk.59e.r13482/14236
K 8
mapgen.c
V 25
file 2mg.59e.r15385/23382
K 8
mapgen.h
V 22
file 2mh.0.r10108/7816
K 17
mapgen_topology.c
V 25
file 2ml.59e.r13482/13702
K 17
mapgen_topology.h
V 22
file 2mm.0.r10181/3103
K 10
startpos.c
V 23
file 2mt.59e.r15199/920
K 10
startpos.h
V 22
file 2mu.0.r10829/1031
K 17
temperature_map.c
V 25
file 2mn.59e.r13482/14505
K 17
temperature_map.h
V 25
file 2mo.59e.r13482/13157
K 11
utilities.c
V 25
file 2mp.59e.r13908/14403
K 11
utilities.h
V 25
file 2mq.59e.r13908/14129
END
ENDREP
id: 2me.59e.r15385/24293
type: dir
pred: 2me.59e.r15367/952
count: 66
text: 15385 23651 629 629 367a7e24541f4eba6068dbdd66ff3d35
props: 11108 4081 68 0 445aae39c72ff2e5199436fb06040160
cpath: /branches/S2_1/server/generator
copyroot: 11448 /branches/S2_1

PLAIN
K 11
Makefile.am
V 23
file 5q.59e.r14487/5744
K 9
airgoto.c
V 23
file 160.59e.r12202/274
K 9
airgoto.h
V 23
file 161.59e.r12202/528
K 6
auth.c
V 22
file 39c.59e.r15361/58
K 6
auth.h
V 25
file 39d.59e.r13514/10767
K 11
barbarian.c
V 23
file lw.59e.r14981/2668
K 11
barbarian.h
V 21
file lx.0.r10733/9671
K 10
cityhand.c
V 24
file 10.59e.r15267/27306
K 10
cityhand.h
V 22
file 4f.0.r10360/45679
K 11
citytools.c
V 23
file 4g.59e.r14946/6172
K 11
citytools.h
V 23
file 4h.59e.r14724/7206
K 10
cityturn.c
V 23
file 4i.59e.r14990/2455
K 10
cityturn.h
V 20
file 4j.0.r8119/8321
K 11
civserver.c
V 23
file 4k.59e.r13514/9742
K 11
civserver.h
V 21
file 4l.0.r2805/33121
K 10
commands.c
V 22
file 2ly.59e.r15164/49
K 10
commands.h
V 22
file 2lz.0.r11087/2800
K 13
connecthand.c
V 23
file 2dw.59e.r15336/195
K 13
connecthand.h
V 25
file 2dx.59e.r14187/10870
K 9
console.c
V 21
file dd.0.r11144/6041
K 9
console.h
V 23
file de.59e.r11698/7135
K 10
diplhand.c
V 26
file 4m.59e.r14210/2228805
K 10
diplhand.h
V 23
file 4n.59e.r13422/2662
K 11
diplomats.c
V 26
file vz.59e.r14210/2229333
K 11
diplomats.h
V 24
file w0.59e.r13744/49823
K 10
gamehand.c
V 22
file 4o.59e.r14953/853
K 10
gamehand.h
V 23
file 4p.59e.r13723/2527
K 9
generator
V 24
dir 2me.59e.r15385/24293
K 11
ggzserver.c
V 25
file 39a.59e.r15001/33940
K 11
ggzserver.h
V 25
file 39b.59e.r15001/34202
K 10
gotohand.c
V 22
file 11.59e.r14973/467
K 10
gotohand.h
V 22
file 7r.59e.r14973/728
K 10
hand_gen.c
V 25
file 2fo.59e.r13744/48778
K 10
hand_gen.h
V 25
file 2f9.59e.r13744/49300
K 10
handchat.c
V 26
file 4q.59e.r14210/2225075
K 10
handchat.h
V 22
file dj.0.r7100/189089
K 9
maphand.c
V 23
file 13.59e.r14946/6429
K 9
maphand.h
V 25
file 14.59e.r13925/175227
K 6
meta.c
V 22
file 4s.59e.r14414/358
K 6
meta.h
V 24
file 4t.59e.r13260/30684
K 9
plrhand.c
V 23
file 4u.59e.r15258/5607
K 9
plrhand.h
V 23
file 4v.59e.r15044/4254
K 8
report.c
V 23
file vi.59e.r15274/4635
K 8
report.h
V 23
file vj.59e.r15274/4892
K 9
ruleset.c
V 23
file 8w.59e.r14978/2372
K 9
ruleset.h
V 23
file 8x.59e.r14152/9709
K 13
sanitycheck.c
V 23
file wi.59e.r14667/2232
K 13
sanitycheck.h
V 24
file wj.59e.r14267/56478
K 10
savegame.c
V 24
file vl.59e.r15267/29602
K 10
savegame.h
V 21
file vm.0.r10073/2584
K 7
score.c
V 27
file 2eg.59e.r14210/2225337
K 7
score.h
V 22
file 2eh.0.r11430/3487
K 9
scripting
V 24
dir 31x.59e.r15267/28824
K 8
sernet.c
V 22
file 15.59e.r15339/311
K 8
sernet.h
V 24
file 4y.59e.r14122/42841
K 10
settings.c
V 24
file 2m0.59e.r15274/4114
K 10
settings.h
V 24
file 2m1.59e.r15274/4375
K 10
settlers.c
V 24
file 7s.59e.r14267/55945
K 10
settlers.h
V 19
file 7t.0.r9484/937
K 11
spacerace.c
V 26
file 9a.59e.r14210/2228005
K 11
spacerace.h
V 21
file 9b.0.r11338/1129
K 10
srv_main.c
V 22
file vg.59e.r15333/906
K 10
srv_main.h
V 23
file vh.59e.r14160/6812
K 11
stdinhand.c
V 23
file 4z.59e.r15334/3982
K 11
stdinhand.h
V 24
file 50.59e.r15001/34723
K 11
techtools.c
V 24
file 33n.59e.r14981/2926
K 11
techtools.h
V 24
file 33o.59e.r14981/3190
K 10
unithand.c
V 23
file 18.59e.r14618/8357
K 10
unithand.h
V 24
file 19.59e.r14246/20716
K 11
unittools.c
V 21
file 1a.59e.r14821/71
K 11
unittools.h
V 24
file 1b.59e.r14246/20194
END
ENDREP
id: z.59e.r15385/27743
type: dir
pred: z.59e.r15367/4397
count: 3329
text: 15385 24549 3181 3181 e3953f969c6cb8fd50e5fb4fab60afd1
props: 13931 1856 101 0 347a75d6319334d09b8f5c63b7f32119
cpath: /branches/S2_1/server
copyroot: 11448 /branches/S2_1

id: 41.59e.r15385/27991
type: file
pred: 41.59e.r13901/44984
count: 256
text: 15385 0 19478 20726 ff41087d4fe91f6c5ad4d9d22ce8610b
props: 10733 16375 112 0 04d6f3553e14be31b9e437b066651140
cpath: /branches/S2_1/common/map.h
copyroot: 11448 /branches/S2_1

PLAIN
K 11
Makefile.am
V 22
file 5h.0.r11391/39828
K 6
aicore
V 23
dir 18t.59e.r14524/5982
K 8
capstr.c
V 23
file dv.59e.r12018/5512
K 8
capstr.h
V 24
file dw.59e.r14881/26467
K 6
city.c
V 21
file q.59e.r15087/178
K 6
city.h
V 23
file 3q.59e.r14990/6164
K 8
combat.c
V 26
file wp.59e.r14203/1564387
K 8
combat.h
V 22
file wq.0.r11179/22662
K 12
connection.c
V 23
file un.59e.r15339/4006
K 12
connection.h
V 22
file uo.0.r11356/16780
K 8
dataio.c
V 23
file 15r.59e.r14514/669
K 8
dataio.h
V 23
file 15s.0.r10480/10050
K 11
diptreaty.c
V 26
file 3r.59e.r14210/2244988
K 11
diptreaty.h
V 20
file 3s.0.r9582/5141
K 9
effects.c
V 25
file 2eo.59e.r13590/41672
K 9
effects.h
V 25
file 2ep.59e.r13590/41934
K 8
events.c
V 26
file 33h.59e.r14117/507151
K 8
events.h
V 24
file 3t.59e.r13524/15083
K 10
fc_types.h
V 25
file 2ll.59e.r13301/13007
K 6
game.c
V 23
file 3u.59e.r14876/1022
K 6
game.h
V 23
file 3v.59e.r14797/4194
K 19
generate_packets.py
V 25
file 2f4.59e.r14495/34877
K 12
government.c
V 24
file he.59e.r13301/13528
K 12
government.h
V 24
file hf.59e.r13044/52595
K 6
idex.c
V 26
file qo.59e.r14210/2249559
K 6
idex.h
V 21
file qp.0.r8119/15235
K 13
improvement.c
V 23
file vb.59e.r14978/6078
K 13
improvement.h
V 23
file vc.59e.r14978/6342
K 5
map.c
V 24
file r.59e.r13925/183197
K 5
map.h
V 24
file 41.59e.r15385/27991
K 10
movement.c
V 26
file 2xv.59e.r13925/182149
K 10
movement.h
V 23
file 2xw.0.r10755/47420
K 8
nation.c
V 24
file il.59e.r14267/61523
K 8
nation.h
V 26
file im.59e.r14210/2249820
K 9
packets.c
V 23
file 43.59e.r14483/1132
K 11
packets.def
V 25
file 2f5.59e.r14678/52913
K 9
packets.h
V 24
file 44.59e.r13069/18292
K 13
packets_gen.c
V 25
file 2f6.59e.r14678/53175
K 13
packets_gen.h
V 25
file 2f7.59e.r14678/53444
K 8
player.c
V 23
file 45.59e.r15044/7958
K 8
player.h
V 23
file 46.59e.r15044/8215
K 14
requirements.c
V 25
file 2wq.59e.r14946/10659
K 14
requirements.h
V 25
file 2wr.59e.r13590/42465
K 11
spaceship.c
V 20
file 98.0.r9977/2632
K 11
spaceship.h
V 20
file 99.0.r9977/2979
K 12
specialist.c
V 22
file 33f.0.r10490/6920
K 12
specialist.h
V 22
file 33g.0.r10490/7274
K 6
team.c
V 25
file 33i.59e.r14257/22796
K 6
team.h
V 23
file 33j.0.r10866/16021
K 6
tech.c
V 22
file t.59e.r14981/7150
K 6
tech.h
V 23
file u.59e.r14257/23048
K 9
terrain.c
V 25
file 2fp.59e.r14946/10141
K 9
terrain.h
V 24
file qs.59e.r14946/10402
K 6
tile.c
V 26
file 2ys.59e.r13925/182416
K 6
tile.h
V 24
file 2yt.59e.r14697/1442
K 6
unit.c
V 23
file v.59e.r14267/60750
K 6
unit.h
V 24
file 48.59e.r14246/24474
K 10
unitlist.c
V 27
file 39m.59e.r14210/2248234
K 10
unitlist.h
V 27
file 39n.59e.r14210/2248760
K 10
unittype.c
V 24
file v9.59e.r13044/49994
K 10
unittype.h
V 24
file va.59e.r13044/50511
K 9
version.c
V 19
file oe.0.r11233/55
K 9
version.h
V 23
file e7.59e.r11550/2812
K 10
worklist.c
V 25
file o8.59e.r13028/197456
K 10
worklist.h
V 22
file o9.59e.r13338/305
END
ENDREP
id: p.59e.r15385/31139
type: dir
pred: p.59e.r15339/7154
count: 2281
text: 15385 28247 2879 2879 44bab600eab76df7cebf4b9b221ea230
props: 11108 11015 68 0 29f6aad3a983ad5efd94235c6b41039e
cpath: /branches/S2_1/common
copyroot: 11448 /branches/S2_1

PLAIN
K 9
ABOUT-NLS
V 21
file fu.0.r3960/17632
K 7
AUTHORS
V 22
file 5u.59e.r13248/152
K 7
COPYING
V 19
file 1h.0.r9643/400
K 9
ChangeLog
V 24
file 6l.59e.r15344/97190
K 7
INSTALL
V 20
file 6.59e.r14673/94
K 11
Makefile.am
V 21
file 59.59e.r14919/55
K 4
NEWS
V 22
file 6m.59e.r13823/201
K 6
README
V 20
file 7.0.r4421/96382
K 2
ai
V 21
dir 8.59e.r15295/3256
K 5
amiga
V 21
dir kd.0.r11105/71924
K 10
autogen.sh
V 23
file 12o.59e.r14490/316
K 9
bootstrap
V 24
dir 2p5.59e.r14780/13984
K 6
client
V 21
dir d.59e.r15301/3914
K 6
common
V 22
dir p.59e.r15385/31139
K 12
config.mac.h
V 20
file hb.0.r6045/5982
K 12
configure.ac
V 26
file 149.59e.r15096/266366
K 4
data
V 21
dir w.59e.r15270/4636
K 6
debian
V 22
dir 5w.59e.r13442/7411
K 12
dependencies
V 21
dir 2yu.0.r11108/3256
K 11
diff_ignore
V 23
file qq.59e.r13228/2550
K 3
doc
V 22
dir k7.59e.r14600/3039
K 4
intl
V 21
dir f4.0.r11105/23499
K 2
m4
V 23
dir 12p.59e.r15311/4087
K 6
manual
V 26
dir 2m2.59e.r14210/2260417
K 2
po
V 23
dir fs.59e.r15348/80962
K 7
scripts
V 23
dir 2yo.59e.r14811/1235
K 6
server
V 22
dir z.59e.r15385/27743
K 10
stamp-h.in
V 19
file 80.0.r1125/241
K 5
tests
V 23
dir 2g9.59e.r13446/1204
K 7
utility
V 22
dir 1c.59e.r15331/2721
K 10
version.in
V 23
file 2lo.59e.r15346/193
K 3
vms
V 21
dir u9.0.r11105/70719
K 5
win32
V 24
dir 2eu.59e.r13979/10719
END
ENDREP
id: 3.59e.r15385/32726
type: dir
pred: 3.59e.r15367/5980
count: 11455
text: 15385 31387 1326 1326 a453213a4894791ee1fa6297b96eebcc
props: 11109 0 255 0 8cbc80e0da9c47b05b8ffee17ea9b0f1
cpath: /branches/S2_1
copyroot: 11448 /branches/S2_1

PLAIN
K 5
S1_14
V 20
dir 3.21.r15224/4547
K 4
S2_0
V 21
dir 3.10x.r15341/9267
K 4
S2_1
V 22
dir 3.59e.r15385/32726
K 11
freeciv-web
V 22
dir 3.5bl.r13594/14918
END
ENDREP
id: 1.0.r15385/33136
type: dir
pred: 1.0.r15367/6387
count: 3382
text: 15385 32965 158 158 53ef52720b174d153f608247348d4583
cpath: /branches
copyroot: 0 /

PLAIN
K 8
branches
V 20
dir 1.0.r15385/33136
K 4
tags
V 19
dir 2.0.r15347/4951
K 5
trunk
V 22
dir 3.5ck.r15384/15882
K 7
website
V 18
dir 3ge.0.r12388/0
END
ENDREP
id: 0.0.r15385/33456
type: dir
pred: 0.0.r15384/16269
count: 15385
text: 15385 33292 151 151 ddf819a42b7012b7d1de9e41202e3297
cpath: /
copyroot: 0 /

41.59e.t15384-1 modify true false /branches/S2_1/common/map.h

2mg.59e.t15384-1 modify true false /branches/S2_1/server/generator/mapgen.c


33456 33606
