DELTA 30792 1690 93
SVN  Œ …g ¬ „…y€f {Š/* common */
#include "unit.h"

/* server */bool unit_build_city(struct player *pplayer, struct unit *punit,
                     const char *nameENDREP
DELTA 31958 546 793
SVN  †  †    †   †  ƒ˜Cƒ˜I1 ‚©B ± îV‚©munit_build_city(pplayer, punit,
                 ENDREP
DELTA 7965 74 9474
SVN  ¦‚é(ƒ:‚™6 …G €†P †ZŠ!€‚ †9‘!€žk MÈŸ HÊ €…2 PÈ| HÊ €P RÈ} ‚B™€™/ n±Z€ƒ x³j€\ 1µT€m ·N€& ¹‰ pº€Q F»€ƒ} #ÀH€‚h 6Å9€a PÈ|Ÿ HÊ €q PÈ|£ HÊ €ƒ PÈ|³ HÊ €l OÈ}¦ HÊ €†; OÈ}¥ HÊ €ƒ` kÈ{€ƒr {È{Ž HÊ € ‚)Ï-€I TÑ|€…~ TÈ{• HÊ € ‚m×;€“O qêg€1 HÊ €X ‚cü€i "ÿ9€…4 )†^€„B ‚ŠG€„$ 5Ž„ L€‚9 9‘N³ n“0€ HÊ €„^ o˜z€M ~š^€‚5 [j€‡J ‚;¢€ˆ& RÈ}ž HÊ €‚| RÈ}© HÊ €©Y RÈ}¢ HÊ €‚ RÈ}™ HÊ €…8 TÈ{  HÊ €x SÈ|µ HÊ € SÈ|€ HÊ €Œxfc_config.h>
#endif

#include <stdio.h>
#include <string.h>

/* utility */
#include "mem.h"
#include "log.h"
#include "support.h" 
#include "timing.h"

/* common */
#include "city.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "movement.h"
#include "packets.h"
#include "player.h"

/* common/aicore */
#include "pf_tools.h"

/* server */
#include "citytools.h"
#include "maphand.h"
#include "srv_log.h"
#include "unithand.h"
#include "unittools.h"

/* server/advisors */
#include "advdata.h"
#include "advgoto.h"
#include "advtools.h"
#include "autosettlers.h"
#include "infracache.h"

/* ai */
#include "handicaps.h"

/* ai/default */
#include "aidata.h"
#include "aicity.h"
#include "aiferry.h"
#include "ailog.h"
#include "aiplayer.h"
#include "aitools.h"
#include "aiunit.h"
#include "citymap.h"

#include "aisettler.h"
Stop looking too hard for better tiles to found a new city at when
 * settler finds location with at least RESULT_IS_ENOUGH want
 * points. See city_desirability() for how base want is computed
 * before amortizing it.
 *
 * This is a big WAG to save a big amount of CPU.ruct tile_data_cache {
  char food;    /* food output of the tile */
  char trade;   /* trade output of the tile */
  char shield;  /* shield output of the tile */

  int sum;      /* weighted sum of the tile output (used by AI) */

  int reserved; /* reservation for this tile; used by print_citymap() */

  int turn;     /* the turn the values were calculated */
};


struct tile_data_cache *tile_data_cache_new(void);
struct tile_data_cache *
  tile_data_cache_copy(const struct tile_data_cache *ptdc);
static void tile_data_cache_destroy(struct tile_data_cache *ptdc);

/* struct tdcache_hash. */
#define SPECHASH_TAG tile_data_cache
#define SPECHASH_INT_KEY_TYPE
#define SPECHASH_IDATA_TYPE struct tile_data_cache *
#define SPECHASH_IDATA_FREE tile_data_cache_destroy
#include "spechash.h"

struct ai_settler {
  struct tile_data_cache_hash *tdc_hash;

#ifdef DEBUG
  struct {
    int hit;
    int old;
    int miss;
    int save;
  } cache;
#endif /* DEBUG */
};

struct cityresult {
  struct tile *tile;
  int total;              /* total value of position */
  int result;             /* amortized and adjusted total value */
  int corruption, waste;
  bool overseas;          /* have to use boat to get there */
  bool virt_boat;         /* virtual boat was used in search, 
                           * so need to build one */

  struct {
    struct tile_data_cache *tdc;  /* values of city center; link to the data
                                   * in tdc_hash. */
  } city_center;

  struct {
    struct tile *tile;            /* best other tile */
    int cindex;                   /* city-relative index for other tile */
    struct tile_data_cache *tdc;  /* value of best other tile; link to the
                                   * data in tdc_hash. */
  } best_other;

  int remaining;          /* value of all other tiles */

  /* Save the result for print_citymap(). */
  struct tile_data_cache_hash *tdc_hash;

  int city_radius_sq;     /* current squared radius of the city */
};

static const struct tile_data_cache *tdc_plr_get(struct ai_type *ait,
                                                 struct player *plr,
                                                 int tindex);
static void tdc_plr_set(struct ai_type *ait, struct player *plr, int tindex,
                        const struct tile_data_cache *tdcache);

static struct cityresult *cityresult_new(struct tile *ptile);
static void cityresult_destroy(struct cityresult *result);

static struct cityresult *cityresult_fill(struct ai_type *ait,
                                          struct player *pplayer,
                                          struct tile *center);
static bool food_starvation(const struct cityresult *result);
static bool shield_starvation(const struct cityresult *result);
static int defense_bonus(struct player *pplayer,
                         const struct cityresult *result);
static int naval_bonus(const struct cityresult *result);
static void print_cityresult(struct player *pplayer,
                             const struct cityresult *cr);
struct cityresult *city_desirability(struct ai_type *ait,
                                     struct player *pplayer,
                                     struct unit *punit, struct tile *ptile);
static struct cityresult *settler_map_iterate(struct ai_type *ait,
                                              struct pf_parameter *parameter,
                                              struct unit *punit,
                                              int boat_cost);
static struct cityresult *find_best_city_placement(struct ai_type *ait,
                                                   struct unit *punit,
                                                   bool look_for_boat,
                                                   bool use_virt_boat);
static bool dai_do_build_city(struct ai_type *ait, struct player *pplayer,
                              struct unit *punit);***
  Allocated a city result.
*****/
static struct cityresult *cityresult_new(struct tile *ptile)
{
  struct cityresult *result;

  fc_assert_ret_val(ptile != NULL, NULL);

  result = fc_calloc(1, sizeof(*result));
  result->tile = ptile;
  result->total = 0;
  result->result = -666;
  result->corruption = 0;
  result->waste = 0;
  result->overseas = FALSE;
  result->virt_boat = FALSE;

  /* city centre */
  result->city_center.tdc = NULL;

  /* first worked tile */
  result->best_other.tile = NULL;
  result->best_other.tdc = NULL;
  result->best_other.cindex = 0;

  result->remaining = 0;
  result->tdc_hash = tile_data_cache_hash_new();
  result->city_radius_sq = game.info.init_city_radius_sq;

  return result***
  Destroy a city result.
*****/
static void cityresult_destroy(struct cityresult *result)
{
  if (result != NULL) {
    if (result->tdc_hash != NULL) {
      tile_data_cache_hash_destroy(result->tdc_hash);
    }
    free(result);
  }static struct cityresult *cityresult_fill(struct ai_type *ait,
                                          struct player *pplayer,
                                          struct tile *center)
{
  struct city *pcity = tile_city(center);
  struct government *curr_govt = government_of_player(pplayer);
  struct player *saved_owner = NULL;
  struct tile *saved_claimer = NULL;
  bool virtual_city = FALSE;
  bool handicap = has_handicap(pplayer, H_MAP);
  struct adv_data *adv = adv_data_get(pplayer, NULL);
  struct ai_plr *ai = dai_plr_data_get(ait, pplayer, NULL);
  struct cityresult *result;

  fc_assert_ret_val(ai != NULL, NULL);
  fc_assert_ret_val(center != NULL, NULL);

  pplayer->government = adv->goal.govt.gov;

  /* Create a city result and set default values. */
  result = cityresult_new(center);

  if (!pcity) {
    pcity = create_city_virtual(pplayer, result->tile, "Virtuaville");
    saved_owner = tile_owner(result->tile);
    saved_claimer = tile_claimer(result->tile);
    tile_set_owner(result->tile, pplayer, result->tile); /* temporarily */
    city_choose_build_default(pcity);  /* ?? */
    virtual_city = TRUE;
  }

  result->city_radius_sq = city_map_radius_sq_get(pcity);

  city_tile_iterate_index(result->city_radius_sq, result->tile, ptile,
                          cindex) {
    int tindex = tile_index(ptile);
    int reserved = citymap_read(ptile);
    bool city_center = (result->tile == ptile); /*is_city_center()*/
    struct tile_data_cache *ptdc;

    if (reserved < 0
        || (handicap && !map_is_known(ptile, pplayer))
        || NULL != tile_worked(ptile)) {
      /* Tile is reserved or we can't see it */
      ptdc = tile_data_cache_new();
      ptdc->shield = 0;
      ptdc->trade = 0;
      ptdc->food = 0;
      ptdc->sum = -1;
      ptdc->reserved = reserved;
      /* ptdc->turn was set by tile_data_cache_new(). */
    } else {
      const struct tile_data_cache *ptdc_hit = tdc_plr_get(ait, pplayer, tindex);
      if (!ptdc_hit || city_center) {
        /* We cannot read city center from cache */
        ptdc = tile_data_cache_new();

        /* Food */
        ptdc->food = city_tile_output(pcity, ptile, FALSE, O_FOOD);
        /* Shields */
        ptdc->shield = city_tile_output(pcity, ptile, FALSE, O_SHIELD);
        /* Trade */
        ptdc->trade = city_tile_output(pcity, ptile, FALSE, O_TRADE);
        /* Weighted sum */
        ptdc->sum = ptdc->food * adv->food_priority
                    + ptdc->trade * adv->science_priority
                    + ptdc->shield * adv->shield_priority;
        /* Balance perfection */
        ptdc->sum *= PERFECTION / 2;
        if (ptdc->food >= 2) {
          ptdc->sum *= 2; /* we need this to grow */
        }

        if (!city_center && virtual_city) {
          /* real cities and any city center will give us spossibly
           * skewed results */
          tdc_plr_set(ait, pplayer, tindex, tile_data_cache_copy(ptdc));
        }
      } else {
        ptdc = tile_data_cache_copy(ptdc_hit);
      }
    }

    /* Save reservation status for debugging. */
    ptdc->reserved = reserved;

    /* Avoid crowdedness, except for city center. */
    if (ptdc->sum > 0) {
      ptdc->sum -= MIN(reserved * GROWTH_PRIORITY, ptdc->/* Set city center. */
      result->city_center.tdc = ptdc;
    } else if (!result->best_other.tdc) {
      /* Set best other tile. */
      result->best_other.tdc = ptdc;
      result->best_other.tile = ptile;
      result->best_other.cindex = cindex;
    } else if (ptdc->sum > result->best_other.tdc->sum) {
      /* First add other other to remaining */
      result->remaining += result->best_other.tdc->sum.tdc = ptdc;
      result->best_other.tile = ptile;
      result->best_other.cindex = cindexptdc->sum / GROWTH_POTENTIAL_DEEMPHASIS;
    }

    tile_data_cache_hash_replace(result->tdc_hash, cindex, ptdc);
  } city_tile_iterate_index_end;

  /* We need a city center. */
  fc_assert_ret_val(result->city_center.tdc != NULL, NULL).tdc->sum
                    + (result->best_other.tdc != NULL
                       ? result->best_other.tdc->sum : 0);
  } else if (result->best_other.tdc != NULL.tdc->sum result;
  }

  /* Now we have a valid city center as well as best other tile. */nt shield = result->city_center.tdc->shield
                 + result->best_other.tdc->shield;
    result->waste = adv->shield_priority
                    * city_waste(pcity, O_SHIELD, shield, NULL);

    if (game.info.fulltradesize == 1) {
      int trade = result->city_center.tdc->trade
                  + result->best_other.tdc->trade;
      result->corruption = adv->science_priority
                           * city_waste(pcity, O_TRADE, trade, NULL);
    } else {
      result->corruption = 0;
    }city_size_add(pcity, 1);
    result->corruption = adv->science_priority
      * (city_waste(pcity, O_TRADE, result->best_other.tdc->trade, NULL)
         - pcity->waste[O_TRADE]);
    result->waste = adv->shield_priority
      * (city_waste(pcity, O_SHIELD, result->best_other.tdc->shield, NULL)
         - pcity->waste[O_SHIELD]);
    city_size_add(pcity, -1)destroy_city_virtual(pcity);
    tile_set_owner(result->tile, saved_owner, saved_claimer);
  }

  fc_assert_ret_val(result->city_center.tdc->sum >= 0, NULL);
  fc_assert_ret_val(result->remaining >= 0, NULL);

  return result***
  Allocate tile data cache
*****/
struct tile_data_cache *tile_data_cache_new(void)
{
  struct tile_data_cache *ptdc_copy = fc_calloc(1, sizeof(*ptdc_copy));

  /* Set the turn the tile data cache was created. */
  ptdc_copy->turn = game.info.turn;

  return ptdc_copy***
  Make copy of tile data cache
*****/
struct tile_data_cache *
  tile_data_cache_copy(const struct tile_data_cache *ptdc)
{
  struct tile_data_cache *ptdc_copy = tile_data_cache_new();

  fc_assert_ret_val(ptdc, NULL);

  ptdc_copy->shield = ptdc->shield;
  ptdc_copy->trade = ptdc->trade;
  ptdc_copy->food = ptdc->food;

  ptdc_copy->sum = ptdc->sum;
  ptdc_copy->reserved = ptdc->reserved;
  ptdc_copy->turn = ptdc->turn;

  return ptdc_copy***
  Free resources allocated for tile data cache
*****/
static void tile_data_cache_destroy(struct tile_data_cache *ptdc)
{
  if (ptdc) {
    free(ptdc);
  }***
  Return player's tile data cache
*****/
static const struct tile_data_cache *tdc_plr_get(struct ai_type *ait,
                                                 struct player *plr,
                                                 int tindex)
{
  struct ai_plr *ai = dai_plr_data_get(ait, plr, NULL);

  fc_assert_ret_val(ai != NULL, NULL);
  fc_assert_ret_val(ai->settler != NULL, NULL);
  fc_assert_ret_val(ai->settler->tdc_hash != NULL, NULL);

  struct tile_data_cache *ptdc;

  tile_data_cache_hash_lookup(ai->settler->tdc_hash, tindex, &ptdc);

  if (!ptdc) {
#ifdef DEBUG
    ai->settler->cache.miss++;
#endif /* DEBUG */
    return NULL;
  } else if (ptdc->turn != game.info.turn) {
#ifdef DEBUG
    ai->settler->cache.old++;
#endif /* DEBUG */
    return NULL;
  } else {
#ifdef DEBUG
    ai->settler->cache.hit++;
#endif /* DEBUG */
    return ptdc;
  }***
  Store player's tile data cache
*****/
static void tdc_plr_set(struct ai_type *ait, struct player *plr, int tindex,
                        const struct tile_data_cache *ptdc)
{
  struct ai_plr *ai = dai_plr_data_get(ait, plr, NULL);

  fc_assert_ret(ai != NULL);
  fc_assert_ret(ai->settler != NULL);
  fc_assert_ret(ai->settler->tdc_hash != NULL);
  fc_assert_ret(ptdc != NULL);

#ifdef DEBUG
    ai->settler->cache.save++;
#endif /* DEBUG */

  tile_data_cache_hash_replace(ai->settler->tdc_hash, tindex, ptdcconst struct cityresult *result)
{
  /* Avoid starvation: We must have enough food to grow.
   *   Note: this does not handle the case of a newly founded city breaking
   * even but being immediately able to build an improvement increasing its
   * yield (such as supermarkets and harbours in the classic ruleset).
   * /MSS */
  return (result->city_center.tdc->food
          + (result->best_other.tdc ? result->best_other.tdc->food
                                    : 0) <= game.info.food_costlack shields.
**/
static bool shield_starvation(const struct cityresult *result)
{
  /* Avoid resource starvation. */
  return (result->city_center.tdc->shield
          + (result->best_other.tdc ? result->best_other.tdc->shield
                                    : 0)player *pplayer,
                         const struct cityresult *result10 + tile_terrain(result->tile)->defense_bonus / 10;
  int extra_bonus = 0;
  struct tile *vtile = tile_virtual_new(result->tile);
  struct city *vcity = create_city_virtual(pplayer, vtile, "");

  tile_set_worked(vtile, vcity); /* Link tile_city(vtile) to vcity. */
  upgrade_city_extras(vcity, NULL); /* Give city free extras. */
  extra_type_iterate(pextra) {
    if (tile_has_extra(vtile, pextra)) {
      /* TODO: Do not use full bonus of those road types
       *       that are not native to all important units. */
      extra_bonus += pextra->defense_bonus;
    }
  } extra_type_iterate_end;
  tile_virtual_destroy(vtile);

  defense_bonus += (defense_bonus * extra_bonus) / 100;

  return 100 / (result->total + 1) * (100 / defense_bonus * DEFENSE_EMPHASISAdd bonus for coast.
**/
static int naval_bonus(const struct cityresult *result)
{
  bool ocean_adjacent = is_terrain_class_near_tile(result->tile, TCstatic void print_cityresult(struct player *pplayer,
                             const struct cityresult *cr)
{
  int *city_map_reserved, *city_map_food, *city_map_shield, *city_map_trade;
  int tiles = city_map_tiles(cr->city_radius_sq);
  struct tile_data_cache *ptdc;

  fc_assert_ret(cr->tdc_hash != NULL);
  fc_assert_ret(tiles > 0);

  city_map_reserved = fc_calloc(tiles, sizeof(*city_map_reserved));
  city_map_food = fc_calloc(tiles, sizeof(*city_map_food));
  city_map_shield = fc_calloc(tiles, sizeof(*city_map_shield));
  city_map_trade = fc_calloc(tiles, sizeof(*city_map_trade));

  city_map_iterate(cr->city_radius_sq, cindex, x, y) {
    tile_data_cache_hash_lookup(cr->tdc_hash, cindex, &ptdc);
    fc_assert_ret(ptdc);
    city_map_reserved[cindex] = ptdc->reserved;
    city_map_food[cindex] = ptdc->reserved;
    city_map_shield[cindex] = ptdc->reserved;
    city_map_trade[cindex] = ptdc->reserved;
  } city_map_iterate_end;

  /* print reservations */
  log_test("cityresult for (x,y,radius_sq) = (%d, %d, %d) - Reservations:",
           TILE_XY(cr->tile), cr->city_radius_sq);
  citylog_map_data(LOG_TEST, cr->city_radius_sq, city_map_reserved);

  /*  print food */
  log_test("cityresult for (x,y,radius_sq) = (%d, %d, %d) - Food:",
           TILE_XY(cr->tile), cr->city_radius_sq);
  citylog_map_data(LOG_TEST, cr->city_radius_sq, city_map_food);

  /* print shield */
  log_test("cityresult for (x,y,radius_sq) = (%d, %d, %d) - Shield:",
           TILE_XY(cr->tile), cr->city_radius_sq);
  citylog_map_data(LOG_TEST, cr->city_radius_sq, city_map_shield);

  /* print trade */
  log_test("cityresult for (x,y,radius_sq) = (%d, %d, %d) - Trade:",
           TILE_XY(cr->tile), cr->city_radius_sq);
  citylog_map_data(LOG_TEST, cr->city_radius_sq, city_map_trade);

  free(city_map_reserved);
  free(city_map_food);
  free(city_map_shield);
  free(city_map_trade);

  log_test("city center (%d, %d) %d + best other (abs: %d, %d)"
           " (cindex: %d) %d", TILE_XY(cr->tile),
           cr->city_center.tdc->sum, TILE_XY(cr->best_other.tile),
           cr->best_other.cindex, cr->best_other.tdc->sum);
  log_test("- corr %d - waste %d + remaining %d"
           " + defense bonus %d + naval bonus %d", cr->corruption,
           cr->waste, cr->remaining, defense_bonus(pplayer, cr),
           naval_bonus(cr));
  log_test("= %d (%d)", cr->total, cr->result);

  if (food_starvation(cr)) {
    log_test(" ** FOOD STARVATION **");
  }
  if (shield_starvation(cr)) {
    log_test(***
  Calculates the desire for founding a new city at 'ptile'. The citymap
  ensures that we do not build cities too close to each other. Returns NULL
  if no place was found.
*****/
struct cityresult *city_desirability(struct ai_type *ait, struct player *pplayer,
                                     struct unit *punit, struct tile *ptile)
{
  struct city *pcity = tile_city(ptile);
  struct adv_data *ai = adv_data_get(pplayer, NULL);
  struct cityresult *cr = NULL;

  fc_assert_ret_val(punit, NULL);
  fc_assert_ret_val(pplayer, NULL);
  fc_assert_ret_val(ai, NULL);

  if (!city_can_be_built_here(ptile, punit)
      || (has_handicap(pplayer, H_MAP)
          && !map_is_known(ptile, pplayer))) {
    return NULL;
  }

  /* Check if another settler has taken a spot within mindist */
  square_iterate(ptile, game.info.citymindist-1, tile1) {
    if (citymap_is_reserved(tile1)) {
      return NULL;
    }
  } square_iterate_end;

  if (adv_danger_at(punit, ptile)) {
    return NULL;
  }

  if (pcity && (city_size_get(pcity) + unit_pop_value(punit)
                > game.info.add_to_size_limit)) {
    /* Can't exceed population limit. */
    return NULL;
  }

  if (!pcity && citymap_is_reserved(ptile)) {
    return NULL; /* reserved, go away */
  }

  /* If (x, y) is an existing city, consider immigration */
  if (pcity && city_owner(pcity) == pplayer) {
    return NULL;
  }

  cr = cityresult_fill(ait, pplayer, ptile); /* Burn CPU, burn! */
  if (!cr) {
    /* Failed to find a good spot */
    return NULL;
  }

  /*** Alright: Now consider building a new city ***/

  if (food_starvation(cr) || shield_starvation(cr)) {
    cityresult_destroy(cr);
    return NULL;
  }

  cr->total += defense_bonus(pplayer, cr);
  cr->total += naval_bonus(cr);

  /* Add remaining points, which is our potential */
  cr->total += cr->remaining;

  fc_assert_ret_val(cr->total >= 0, NULL); /* Does not frees cr! */

  return cra 'struct cityresult' if found something better than what
  was originally in "best" was found; else NULLstruct cityresult *settler_map_iterate(struct ai_type *ait,
                                              struct pf_parameter *parameter,
                                              struct unit *punit,
                                              int boat_cost)
{
  struct cityresult *cr = NULL, *best = NULL;
  int best_turn = 0; /* Which turn we found the best fit */
  struct player *pplayer = unit_owner(punit);
  struct pf_map *pfm;

  pfm = pf_map_new(parameter);
  pf_map_move_costs_iterate(pfm, ptile, move_cost, FALSE) {
    int turns;

    if (boat_cost == 0 && unit_class_get(punit)->adv.sea_move == MOVE_NONE
        && tile_continent(ptile) != tile_continent(unit_tile(punit))    if (BORDERS_DISABLED != game.info.borders) {
      struct player *powner = tile_owner(ptile);
      if (NULL != powner
       && powner != pplayer
       && pplayers_in_peace(powner, pplayer)) {
        /* Land theft does not make for good neighbours. */
        continue;
      }
    }

    /* Calculate worth */
    cr = city_desirability(ait, pplayer, punit, ptile);

    /* Check if actually found something */
    if (!cr) {
      continue;
    }

    /* This algorithm punishes long treks */
    turns = move_cost / parameter->move_rate;
    cr->result = amortize(cr->cr->result -= unit_build_shield_cost(punit) + boat_cost;

    /* Find best spot */
    if ((!best && cr->result > 0)
        || (best && cr->result > best->result)) {
      /* Destroy the old 'best' value. */
      cityresult_destroy(best);
      /* save the new 'best' value. */
      best = cr;
      cr = NULL;
      best_turn = turns;

      log_debug("settler map search (search): (%d,%d) %d",
                TILE_XY(best->tile), best->result);
    } else {
      /* Destroy the unused result. */
      cityresult_destroy(cr);
      cr = NULL && info.min_dist_bw_cities*/) {
      break;
    }
  } pf_map_move_costs_iterate_end;

  pf_map_destroy(pfm);

  if (best) {
    log_debug("settler map search (final): (%d,%d) %d", TILE_XY(best->tile),
              best->result);
  } else {
    log_debug("settler map search (final): no result");
  }

  return bestus to find a (real) boat before considering
  going  If (!look_for_boat && !use_virt_boat), will not consider placements
  overseas.

  Returns the better cityresult or NULL if no result was found.
**/
static struct cityresult *find_best_city_placement(struct ai_type *ait,
                                                   struct unit *punit,
                                                   bool look_for_boat,
                                                   bool use_virt_boat)
{
  struct pf_parameter parameter;
  struct player *pplayer = unit_owner(punit);
  struct unit *ferry = NULL;
  struct cityresult *cr1 = NULL, *cr2 = NULL;

  fc_assert_ret_val(pplayer->ai_controlled, NULL);
  /* Only virtual units may use virtual boats: */
  fc_assert_ret_val(0 == punit->id || !use_virt_boat, NULL)parameter.omniscience = !has_handicap(pplayer, H_MAP);
  cr1 = settler_map_iterate(ait, &parameter, punit, 0);

  if (cr1 && cr1->result > RESULT_IS_ENOUGH) {
    /* skip further searches */
    return cr1ait, punit, 1, NULL);

    ferry = game_unit_by_number(ferry_id);
  }

  if (ferry || (use_virt_boat
                && is_terrain_class_near_tile(unit_tile(punit), TC_OCEAN)
                && tile_city(unit_tile(punit)))) {
    if (!ferry) {
      /* No boat?  Get a virtual one! */
      struct unit_type *NULL) {
        /* Sea travel not possible yet. Bump tech want for ferries. */
        boattype = get_role_unit(L_FERRYBOAT, 0);

        if (NULL != boattype
            && A_NEVER != boattype->require_advance) {
          struct ai_plr *plr_data = def_ai_player_data(pplayer, ait);

          plr_data->tech_want[advance_index(boattype->require_advance)]
            += FERRY_TECH_WANT;
          TECH_LOG(ait, LOG_DEBUG, pplayer, boattype->require_advance,
                   "+ %d for %s to ferry settler",
                   FERRY_TECH_WANT,
                   utype_rule_name(boattype));
        }
        /* return the result from the search on our current continent */
        return cr1;
      }
      ferry = unit_virtual_create(pplayer, NULL, boattype, 0);
      unit_tile_set(ferry, unit_tile(punit));
    }

    fc_assert(dai_is_ferry(ferry, ait));
    pft_fill_unit_overlap_param(&parameter, ferry);
    parameter.omniscience = !has_handicap(pplayer, H_MAPcr2 = settler_map_iterate(ait, &parameter, punit,
                              unit_build_shield_cost(ferry));
    if (cr2) {
      cr2->overseas = TRUE;
      cr2->virt_boat = (ferry->id == 0);
    }

    if (ferry->id == 0) {
      unit_virtual_destroy(ferry);
    }

    /* If we use a virtual boat, we must have permission and be emigrating: */
    /* FIXME: These assert do not frees cr2! */
    fc_assert_ret_val(!cr2 || (!cr2->virt_boat || use_virt_boat), NULL);
    fc_assert_ret_val(!cr2 || (!cr2->virt_boat || cr2->overseas), NULL);
  }

  if (!cr1) {
    /* No want for a new city on our current continent; return the result for
     * traveling by boat. */
    return cr2;
  } else if (!cr2) {
    /* No want for an overseas city; return the result for a city on our
     * current continent. */
    return cr1;
  }

  /* We want an overseas city and a city on the current continent - select the
   * best! */
  if (cr1->result > cr2->result) {
    cityresult_destroy(cr2);
    return cr1;
  } else {
    cityresult_destroy(cr1);
    return cr2;
  }Initialize ai settler engine.
**/
void dai_auto_settler_init(struct ai_plr *ai)
{
  fc_assert_ret(ai != NULL);
  fc_assert_ret(ai->settler == NULL);

  ai->settler = fc_calloc(1, sizeof(*ai->settler));
  ai->settler->tdc_hash = tile_data_cache_hash_new();

#ifdef DEBUG
  ai->settler->cache.hit = 0;
  ai->settler->cache.old = 0;
  ai->settler->cache.miss = 0;
  ai->settler->cache.save = 0;
#endif /* DEBUG */Auto settler that can also build cities.
**/
void dai_auto_settler_run(struct ai_type *ait, struct player *pplayer,
                          struct unit *punit, struct settlermap *state)
{
  int best_impr = 0;            /* best terrain improvement we can do */
  enum unit_activity best_act;
  struct extra_type *best_target;
  struct tile *best_tile = NULL;
  struct pf_path *path = NULL;
  struct city *pcity = NULL;

  /* time it will take worker to complete its given task */
  int completion_time = 0;

  CHECK_UNIT(punit);

  /*** If we are on a city mission: Go where we should ***/

BUILD_CITY:

  if (def_ai_unit_data(punit, ait)->task == AIUNIT_BUILD_CITY) {
    struct tile *ptile = punit->goto_tile;
    int sanity = punit->id;

    /* Check that the mission is still possible.  If the tile has become
     * unavailable, call it off. */
    if (!city_can_be_built_here(ptile, punit)) {
      dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);
      set_unit_activity(punit, ACTIVITY_IDLE);
      send_unit_info(NULL, punit);
      return; /* avoid recursion at all cost */
    } else {
     /* Go there */
      if ((!dai_gothere(ait, pplayer, punit, ptile)
           && NULL == game_unit_by_number(sanity))
          || punit->moves_left <= 0) {
        return;
      }
      if (same_pos(unit_tile(punit), ptile)) {
        if (!dai_do_build_city(ait, pplayer, punit)) {
          UNIT_LOG(LOG_DEBUG, punit, "could not make city on %s",
                   tile_get_info_text(unit_tile(punit), TRUE, 0));
          dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);
          /* Only known way to end in here is that hut turned in to a city
           * when settler entered tile. So this is not going to lead in any
           * serious recursion. */
          dai_auto_settler_run(ait, pplayer, punit, state);

          return;
       } else {
          return; /* We came, we saw, we built... */
        }
      } else {
        UNIT_LOG(LOG_DEBUG, punit, "could not go to target");
        /* ai_unit_new_role(punit, AIUNIT_NONE, NULL); */
        return;
      }
    }
  }

  /*** Try find some work ***/

  if (unit_has_type_flag(punit, UTYF_SETTLERS)) {
    struct worker_task *best_task;

    TIMING_LOG(AIT_WORKERS, TIMER_START);

    /* Have nearby cities requests? */
    pcity = settler_evaluate_city_requests(punit, &best_task, &path, state);

    if (pcity != NULL) {
      if (path != NULL) {
        completion_time = pf_path_last_position(path)->turn;
        best_impr = 1;
        best_act = best_task->act;
        best_target = best_task->tgt;
        best_tile = best_task->ptile;
      } else {
        pcity = NULL;
      }
    }

    if (pcity == NULL) {
      best_impr = settler_evaluate_improvements(punit, &best_act, &best_target,
                                                &best_tile, &path, state);
      if (path) {
        completion_time = pf_path_last_position(path)->turn;
      }
    }
    UNIT_LOG(LOG_DEBUG, punit, "impr want %d", best_impr);
    TIMING_LOG(AIT_WORKERS, TIMER_STOP);
  }

  if (unit_is_cityfounder(punit)) {
    struct cityresult *result;

    /* may use a boat: */
    TIMING_LOG(AIT_SETTLERS, TIMER_START);
    result = find_best_city_placement(ait, punit, TRUE, FALSE);
    TIMING_LOG(AIT_SETTLERS, TIMER_STOP);
    if (result && result->result > best_impr) {
      UNIT_LOG(LOG_DEBUG, punit, "city want %d", result->result);
      if (tile_city(result->tile)) {
        UNIT_LOG(LOG_DEBUG, punit, "immigrates to %s (%d, %d)", 
                 city_name(tile_city(result->tile)),
                 TILE_XY(result->tile));
      } else {
        UNIT_LOG(LOG_DEBUG, punit, "makes city at (%d, %d)", 
                 TILE_XY(result->tile));
        if (punit->server.debug) {
          print_cityresult(pplayer, result);
        }
      }
      /* Go make a city! */
      adv_unit_new_task(punit, AUT_BUILD_CITY, result->tile);
      if (result->best_other.tile && result->best_other.tdc->sum >= 0) {
        /* Reserve best other tile (if there is one). It is the tile where the
         * first citizen of the city is working. */
        citymap_reserve_tile(result->best_other.tile, punit->id);
      }
      punit->goto_tile = result->tile; /* TMP */

      cityresult_destroy(result);

      /*** Go back to and found a city ***/
      pf_path_destroy(path);
      path = NULL;
      goto BUILD_CITY;
    } else if (best_impr > 0) {
      UNIT_LOG(LOG_DEBUG, punit, "improves terrain instead of founding");
      /* Terrain improvements follows the old model, and is recalculated
       * each turn. */
      if (result) {
        /* We had a city result, just worse than best impr */
        cityresult_destroy(result);
      }
      adv_unit_new_task(punit, AUT_AUTO_SETTLER, best_tile);
    } else {
      UNIT_LOG(LOG_DEBUG, punit, "cannot find work");
      fc_assert(result == NULL);
      dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);
      goto CLEANUP;
    }
  } else {
    /* We are a worker or engineer */
    adv_unit_new_task(punit, AUT_AUTO_SETTLER, best_tile);
  }

  if (auto_settler_setup_work(pplayer, punit, state, 0, path,
                              best_tile, best_act, &best_target,
                              completion_time)) {
    if (pcity != NULL) {
      clear_worker_tasks(pcity);
    }
  }

CLEANUP:

  if (NULL != path) {
    pf_path_destroy(path);
  }Auto settler continuing its work.
**/
void dai_auto_settler_cont(struct ai_type *ait, struct player *pplayer,
                           struct unit *punit, struct settlermap *state)
{
  if (!adv_settler_safe_tile(pplayer, punit, unit_tile(punit))) {
    unit_activity_handling(punit, ACTIVITY_IDLE);
  }Reset ai settler engine.
**/
void dai_auto_settler_reset(struct ai_type *ait, struct player *pplayer)
{
  struct ai_plr *ai = dai_plr_data_get(ait, pplayer, NULL);

  fc_assert_ret(ai != NULL);
  fc_assert_ret(ai->settler != NULL);
  fc_assert_ret(ai->settler->tdc_hash != NULL);

#ifdef DEBUG
  log_debug("[aisettler cache for %s] save: %d, miss: %d, old: %d, hit: %d",
            player_name(pplayer), ai->settler->cache.save,
            ai->settler->cache.miss, ai->settler->cache.old,
            ai->settler->cache.hit);

  ai->settler->cache.hit = 0;
  ai->settler->cache.old = 0;
  ai->settler->cache.miss = 0;
  ai->settler->cache.save = 0;
#endif /* DEBUG */

  tile_data_cache_hash_clear(ai->settler->tdc_hashDeinitialize ai settler engine.
**/
void dai_auto_settler_free(struct ai_plr *ai)
{
  fc_assert_ret(ai != NULL);

  if (ai->settler) {
    if (ai->settler->tdc_hash) {
      tile_data_cache_hash_destroy(ai->settler->tdc_hash);
    }
    free(ai->settler);
  }
  ai->settler = NULLBuild a city and initialize AI infrastructure cache.
**/
static bool dai_do_build_city(struct ai_type *ait, struct player *pplayer,
                              struct unit *punit)
{
  struct tile *ptile = unit_tile(punit);
  struct city *pcity;

  fc_assert_ret_val(pplayer == unit_owner(punit), FALSE);
  unit_activity_handling(punit, ACTIVITY_IDLE);

  /* Free city reservations */
  dai_unit_new_task(ait, punit, AIUNIT_NONE, NULL);

  pcity = tile_city(ptile);
  if (pcity) {
    /* This can happen for instance when there was hut at this tile
     * and it turned in to a city when settler entered tile. */
    log_debug("%s: There is already a city at (%d, %d)!",
              player_name(pplayer), TILE_XY(ptile));
    return FALSE;
  }
  if (!unit_build_city(pplayer, punit, city_name_suggestion(pplayer, ptile))) {
    /* It's an error when unit_build_city() says that request was illegal to begin with. */
    log_error("%s: Failed to build city at (%d, %d)",
              player_name(pplayer), TILE_XY(ptile));
    return FALSE;
  }

  pcity = tile_city(ptile);
  if (!pcity) {
    /* Write just debug log when city building didn't success for acceptable reason. */
    log_debug("%s: Failed to build city at (%d, %d)",
              player_name(pplayer), TILE_XY(ptile));
    return FALSE;
  }

  /* We have to rebuild at least the cache for this city.  This event is
   * rare enough we might as well build the whole thing.  Who knows what
   * else might be cached in the future? */
  fc_assert_ret_val(pplayer == city_owner(pcity), FALSE);
  initialize_infrastructure_cache(pplayer);

  /* Init ai.choice. Handling ferryboats might use it. */
  adv_init_choice(&def_ai_city_data(pcity, ait)->choice);

  return TRUEReturn want for city settler. Note that we rely here on the fact that
  ai_settler_init() has been run while doing autosettlers.
**/
void contemplate_new_city(struct ai_type *ait, struct city *pcity)
{
  struct unit *virtualunit;
  struct tile *pcenter = city_tile(pcity);
  struct player *pplayer = city_owner(pcity);
  struct unit_type *unit_type;

  if (game.scenario.prevent_new_cities) {
    return;
  }

  unit_type = best_role_unit(pcity, UTYF_CITIES); 

  if (unit_type == NULL) {
    log_debug("No UTYF_CITIES role unit available");
    return;
  }

  /* Create a localized "virtual" unit to do operations with. */
  virtualunit = unit_virtual_create(pplayer, pcity, unit_type, 0);
  unit_tile_set(virtualunit, pcenter);

  fc_assert_ret(pplayer->ai_controlled);

  if (pplayer->ai_controlled) {
    struct cityresult *result;
    bool is_coastal = is_terrain_class_near_tile(pcenter, TC_OCEAN);
    struct ai_city *city_data = def_ai_city_data(pcity, ait);

    result = find_best_city_placement(ait, virtualunit, is_coastal, is_coastal);

    if (result) {
      fc_assert_ret(0 <= result->result); /* 'result' is not freed! */

      CITY_LOG(LOG_DEBUG, pcity, "want(%d) to establish city at"
               " (%d, %d) and will %s to get there", result->result, 
               TILE_XY(result->tile), 
               (result->virt_boat ? "build a boat" : 
                (result->overseas ? "use a boat" : "walk")));

      city_data->founder_want = (result->virt_boat ? 
                                 -result->result : result->result);
      city_data->founder_boat = result->overseas;

      cityresult_destroy(result);
    } else {
      CITY_LOG(LOG_DEBUG, pcity, "want no city");
      city_data->founder_want = 0;
    }
  }
  unit_virtual_destroy(virtualunit);
}
ENDREP
DELTA 32221 0 5423
SVN  †  †  7ƒe ƒôW € V6€A Pƒö7€ }ƒøR† {ƒùO€L ‚^ƒô€F T‚Ÿ@ ‚ŸtƒüTry to build city.
  Return value tells if request was sane. It can be TRUE even if city
  building failed, as long as the reason was not badbool unit_build_city(struct player *pplayer, struct unit *punit,

  if (NULL == punit) {
    /* Probably died or bribed. */
    log_verbose("unit_build_city() invalid unit.");
    return FALSE FALSE  if (res != UAB_NO_MIN_DIST) {
      return FALSE;
    }
  }

  return TRUEunit_build_city(pplayer, player_unit_by_number(pplayer, unit_id), name†  ·#»ƒ<€ƒ< *„: ¶,we = trade_route_settings_by_type(cities_trade_route_type(pcity_homecity, pcity_dest))->bonus_type;
  bonus_str = NULL;

  switch (bonus_type) {
  case TBONUS_NONE:
    break;
  case TBONUS_GOLD:
    bonus_str = _("gold");
    break;
  case TBONUS_SCIENCE:
    bonus_str = _("research");
    break;
  case TBONUS_BOTH:
    bonus_str = _("gold and research");
    break;
  }

  conn_list_do_buffer(pplayer->connections);

  if (bonus_str != NULL)ENDREP
id: 2lh.5r9.r32325/37874
type: file
pred: 2lh.5r9.r31825/53
count: 128
text: 32325 319 36480 46248 1f8f071ab230f93c43e2155a9789fa21
props: 10865 31505 111 0 23629f8214b2309975780a037517e920
cpath: /branches/S2_6/ai/default/aisettler.c
copyroot: 19757 /trunk/ai/default/aisettler.c

PLAIN
K 11
Makefile.am
V 24
file 6k4.5ck.r26385/1025
K 14
advdiplomacy.c
V 24
file 2ek.5qt.r32298/1358
K 14
advdiplomacy.h
V 25
file 2el.5ga.r21819/30478
K 13
advdomestic.c
V 23
file 1m.5qz.r30779/6015
K 13
advdomestic.h
V 24
file 1n.5gc.r21819/29385
K 13
advmilitary.c
V 23
file 1u.5so.r31581/1548
K 13
advmilitary.h
V 23
file 1v.5tt.r30779/6580
K 7
aiair.c
V 24
file 15y.5t6.r30105/1910
K 7
aiair.h
V 25
file 15z.5gi.r21819/33076
K 8
aicity.c
V 22
file 20.5r8.r31942/649
K 8
aicity.h
V 23
file 21.5sp.r30779/7136
K 8
aidata.c
V 25
file 6mb.5sk.r30222/62271
K 8
aidata.h
V 24
file 6mc.5re.r29401/4263
K 12
aidiplomat.c
V 26
file 16r.5rl.r30061/177315
K 12
aidiplomat.h
V 25
file 16s.5go.r21819/32802
K 9
aiferry.c
V 24
file 2iw.5ra.r31024/1876
K 9
aiferry.h
V 24
file 2ix.5gq.r25299/3783
K 9
aiguard.c
V 25
file 335.5gr.r21830/20422
K 9
aiguard.h
V 25
file 336.5rp.r28076/25981
K 8
aihand.c
V 24
file 22.5gt.r26403/72867
K 8
aihand.h
V 24
file 23.5gu.r21810/35768
K 8
aihunt.c
V 24
file 2gc.5t8.r30105/2462
K 8
aihunt.h
V 25
file 2gd.5gw.r21819/35411
K 7
ailog.c
V 25
file 6p8.5s8.r28854/25132
K 7
ailog.h
V 26
file 6p9.5gy.r26905/232907
K 15
aiparatrooper.c
V 26
file 36o.5t9.r30061/178161
K 15
aiparatrooper.h
V 25
file 36p.5h0.r25366/42160
K 10
aiplayer.c
V 24
file 6i3.5sh.r30143/6033
K 10
aiplayer.h
V 24
file 6i4.5td.r30143/6310
K 11
aisettler.c
V 25
file 2lh.5r9.r32325/37874
K 11
aisettler.h
V 25
file 2li.5h4.r22374/17958
K 8
aitech.c
V 23
file 24.5sn.r30779/7687
K 8
aitech.h
V 23
file 25.5h6.r25452/2151
K 9
aitools.c
V 22
file 9.5rb.r30779/7958
K 9
aitools.h
V 22
file a.5ts.r30779/8229
K 8
aiunit.c
V 22
file b.5r7.r31581/2101
K 8
aiunit.h
V 22
file c.5t7.r30311/2998
K 12
daieffects.c
V 26
file 156e.5qi.r32091/16992
K 12
daieffects.h
V 25
file 156g.5qi.r29401/5074
END
ENDREP
id: 6k3.5qi.r32325/39948
type: dir
pred: 6k3.5qi.r32298/3432
count: 415
text: 32325 38156 1779 0 148b518c915b984b3e8173da8602c389
props: 19010 5510 53 0 1aad128f6d028f535e9ce7233326568e
cpath: /branches/S2_6/ai/default
copyroot: 27474 /branches/S2_6

PLAIN
K 11
Makefile.am
V 24
file 5d.5ck.r26100/14492
K 10
aitraits.c
V 24
file 7k0.5qi.r30331/6378
K 10
aitraits.h
V 26
file 7k2.5ck.r26905/225228
K 7
classic
V 22
dir l53.5qi.r31174/603
K 7
default
V 24
dir 6k3.5qi.r32325/39948
K 12
difficulty.c
V 25
file 1b4x.5qi.r31581/4413
K 12
difficulty.h
V 25
file 1b4z.5qi.r31581/4669
K 11
handicaps.c
V 26
file syo.5ck.r26905/225805
K 11
handicaps.h
V 24
file syq.5qi.r29443/3517
K 4
stub
V 25
dir 6k5.5ck.r26905/226459
K 8
threaded
V 22
dir 6pi.5qi.r30972/700
END
ENDREP
id: 8.5qi.r32325/40714
type: dir
pred: 8.5qi.r32298/4196
count: 1866
text: 32325 40199 502 0 3729f450145114acf2ef05e1f6391a07
props: 11108 11315 64 0 abac628483ea4fdfa3bea3a3a56e0532
cpath: /branches/S2_6/ai
copyroot: 27474 /branches/S2_6

id: 18.5qi.r32325/40954
type: file
pred: 18.5qi.r32221/5448
count: 664
text: 32325 36825 1023 126354 dd67bfee06500c5244f2c98a8a4dc95f
props: 11060 7742 112 0 090627d3849ce880ce4f29c1c260669f
cpath: /branches/S2_6/server/unithand.c
copyroot: 27474 /branches/S2_6

id: 19.5qi.r32325/41217
type: file
pred: 19.5qi.r30792/9489
count: 45
text: 32325 0 175 1683 6e735c4f65fee69cd5ac7fc981e5cb1d
props: 10368 4059 111 0 8e8cf76c72bb494e2405ceda1aa1a218
cpath: /branches/S2_6/server/unithand.h
copyroot: 27474 /branches/S2_6

id: 1a.5qi.r32325/41472
type: file
pred: 1a.5qi.r31958/1625
count: 782
text: 32325 202 90 154697 673f37e27e55177927647fae7b4facc2
props: 11095 1637 112 0 c5bfe3670c093a84ebf28b66298044e4
cpath: /branches/S2_6/server/unittools.c
copyroot: 27474 /branches/S2_6

PLAIN
K 11
Makefile.am
V 23
file 5q.5qi.r31934/8804
K 13
actiontools.c
V 27
file 1p8q.5qi.r31154/115051
K 13
actiontools.h
V 26
file 1p8t.5qi.r28430/14182
K 8
advisors
V 24
dir 4n2.5qi.r32037/34413
K 9
aiiface.c
V 25
file 4gm.5ck.r26905/55786
K 9
aiiface.h
V 25
file 4gn.5ck.r26905/56374
K 9
animals.c
V 24
file vnk.5qi.r31066/7733
K 9
animals.h
V 25
file vnm.5ck.r26905/63257
K 6
auth.c
V 23
file 39c.5qi.r31945/210
K 6
auth.h
V 25
file 39d.5ck.r18977/19170
K 11
barbarian.c
V 24
file lw.5qi.r30875/23564
K 11
barbarian.h
V 22
file lx.5qi.r28606/673
K 14
citizenshand.c
V 25
file 6mz.5qi.r29646/26851
K 14
citizenshand.h
V 25
file 6n0.5ck.r26905/56662
K 10
cityhand.c
V 22
file 10.5qi.r31108/127
K 10
cityhand.h
V 23
file 4f.0.r13297/423686
K 11
citytools.c
V 23
file 4g.5qi.r32279/5158
K 11
citytools.h
V 23
file 4h.5qi.r29015/8710
K 10
cityturn.c
V 23
file 4i.5qi.r32238/6785
K 10
cityturn.h
V 24
file 4j.5qi.r31248/20765
K 11
civserver.c
V 23
file 4k.5qi.r31884/4813
K 10
commands.c
V 25
file 2ly.5qi.r30817/40910
K 10
commands.h
V 25
file 2lz.5qi.r28013/36715
K 13
connecthand.c
V 25
file 2dw.5qi.r32147/25989
K 13
connecthand.h
V 24
file 2dx.5ck.r23606/2057
K 9
console.c
V 23
file dd.5qi.r32113/7031
K 9
console.h
V 23
file de.5qi.r31515/8464
K 10
diplhand.c
V 24
file 4m.5qi.r31333/19083
K 10
diplhand.h
V 23
file 4n.5qi.r27518/5128
K 11
diplomats.c
V 23
file vz.5qi.r31253/5048
K 11
diplomats.h
V 23
file w0.5ck.r27461/1674
K 10
edithand.c
V 25
file 3bk.5qi.r32147/26253
K 10
edithand.h
V 25
file 4ez.5ck.r26905/64705
K 6
fcdb.c
V 23
file 6l3.5qi.r30953/119
K 6
fcdb.h
V 25
file 6l4.5ck.r26905/57239
K 10
gamehand.c
V 24
file 4o.5qi.r32147/26516
K 10
gamehand.h
V 24
file 4p.5qi.r32147/26776
K 9
generator
V 24
dir 2me.5qi.r32142/11176
K 10
handchat.c
V 23
file 4q.5ck.r25915/6654
K 10
handchat.h
V 24
file dj.5ck.r18270/28229
K 9
maphand.c
V 24
file 13.5qi.r32078/67323
K 9
maphand.h
V 24
file 14.5qi.r31936/31725
K 6
meta.c
V 24
file 4s.5qi.r31660/12600
K 6
meta.h
V 23
file 4t.5ck.r27204/3095
K 6
mood.c
V 26
file 112c.5ck.r26905/63547
K 6
mood.h
V 26
file 112e.5ck.r26905/64129
K 8
notify.c
V 23
file 4i2.5qi.r31786/855
K 8
notify.h
V 25
file 4i3.5qi.r31371/15986
K 9
plrhand.c
V 24
file 4u.5qi.r31936/31983
K 9
plrhand.h
V 24
file 4v.5qi.r31793/46952
K 8
report.c
V 23
file vi.5qi.r29900/1902
K 8
report.h
V 23
file vj.5qi.r29900/2158
K 10
rssanity.c
V 22
file hew.5qi.r32208/48
K 10
rssanity.h
V 25
file hey.5ck.r26905/55500
K 9
ruleset.c
V 24
file 8w.5qi.r32292/11084
K 9
ruleset.h
V 25
file 8x.5qi.r32231/107042
K 13
sanitycheck.c
V 23
file wi.5qi.r30958/3358
K 13
sanitycheck.h
V 24
file wj.5qi.r28076/13693
K 12
savecompat.c
V 23
file qva.5qi.r32018/924
K 12
savecompat.h
V 24
file qvc.5qi.r30204/4618
K 10
savegame.c
V 22
file vl.5qi.r32309/228
K 10
savegame.h
V 24
file vm.5ck.r20758/19233
K 11
savegame2.c
V 25
file 4m0.5qi.r32295/13133
K 11
savegame2.h
V 25
file 4m1.5ck.r26905/58971
K 7
score.c
V 25
file 2eg.5qi.r29646/30135
K 7
score.h
V 24
file 2eh.5ck.r21929/6179
K 9
scripting
V 23
dir 31x.5qi.r32144/6170
K 8
sernet.c
V 23
file 15.5qi.r32162/2254
K 8
sernet.h
V 24
file 4y.5qi.r31872/13733
K 10
settings.c
V 25
file 2m0.5qi.r32035/11663
K 10
settings.h
V 23
file 2m1.5qi.r29780/954
K 11
spacerace.c
V 23
file 9a.5qi.r31487/5759
K 11
spacerace.h
V 23
file 9b.5qi.r31487/6019
K 9
srv_log.c
V 24
file 15t.5rh.r28854/9971
K 9
srv_log.h
V 25
file 15u.5ri.r28013/36974
K 10
srv_main.c
V 23
file vg.5qi.r32171/1636
K 10
srv_main.h
V 23
file vh.5qi.r31621/2340
K 11
stdinhand.c
V 23
file 4z.5qi.r32171/1898
K 11
stdinhand.h
V 23
file 50.5qi.r32171/2160
K 11
techtools.c
V 22
file 33n.5qi.r31624/97
K 11
techtools.h
V 23
file 33o.5qi.r31624/354
K 10
unithand.c
V 24
file 18.5qi.r32325/40954
K 10
unithand.h
V 24
file 19.5qi.r32325/41217
K 11
unittools.c
V 24
file 1a.5qi.r32325/41472
K 11
unittools.h
V 23
file 1b.5qi.r31031/2636
K 8
voting.c
V 25
file 4ex.5ck.r26905/57525
K 8
voting.h
V 25
file 4ey.5ck.r26905/58399
END
ENDREP
id: z.5qi.r32325/45682
type: dir
pred: z.5qi.r32309/4430
count: 6231
text: 32325 41732 3937 0 2c315f7811e1d2dc5a665e77fa5696e1
props: 23990 448 166 0 e5026e1cb18fe57b41417951bfac7b19
cpath: /branches/S2_6/server
copyroot: 27474 /branches/S2_6

PLAIN
K 9
ABOUT-NLS
V 24
file fu.5ck.r27270/69307
K 7
AUTHORS
V 24
file 5u.5ck.r22143/14016
K 7
COPYING
V 22
file 1h.5qi.r29455/952
K 9
ChangeLog
V 26
file 6l.5qi.r31298/7507168
K 7
INSTALL
V 22
file 6.5qi.r31740/1317
K 11
Makefile.am
V 22
file 59.5qi.r31920/516
K 4
NEWS
V 24
file 6m.5ck.r25634/30702
K 6
README
V 20
file 7.0.r4421/96382
K 2
ai
V 22
dir 8.5qi.r32325/40714
K 10
autogen.sh
V 22
file 12o.5qi.r32157/51
K 9
bootstrap
V 23
dir 2p5.5qi.r32074/2154
K 6
client
V 22
dir d.5qi.r32316/18688
K 6
common
V 21
dir p.5qi.r32306/5604
K 12
configure.ac
V 23
file 149.5qi.r32276/381
K 4
data
V 21
dir w.5qi.r32313/7256
K 12
dependencies
V 23
dir 2yu.5qi.r31823/9339
K 3
doc
V 22
dir k7.5qi.r32175/4141
K 10
fc_version
V 26
file 2lo.5qj.r32231/106784
K 11
gen_headers
V 23
dir 1hsw.5qi.r32276/968
K 3
lua
V 24
dir 2c5p.5qi.r31920/4972
K 2
m4
V 23
dir 12p.5qi.r32311/3593
K 7
scripts
V 23
dir 2yo.5qi.r31853/1104
K 6
server
V 22
dir z.5qi.r32325/45682
K 5
tests
V 22
dir 2g9.5qi.r31521/645
K 5
tools
V 23
dir 4pj.5qp.r32251/4332
K 12
translations
V 25
dir t0a.5qi.r32320/106070
K 7
utility
V 22
dir 1c.5qi.r32323/3330
K 3
vms
V 25
dir u9.5ck.r21528/1396085
K 5
win32
V 24
dir 2eu.5qi.r32098/13458
END
ENDREP
id: 3.5qi.r32325/47134
type: dir
pred: 3.5qi.r32323/4778
count: 20562
text: 32325 45926 1195 0 eef7b7a468b1eaf5e18bd34059173edd
props: 28037 14463 292 0 9e1d5de0253c723466868990c52c129f
cpath: /branches/S2_6
copyroot: 27474 /branches/S2_6

PLAIN
K 5
S1_14
V 21
dir 3.21.r18109/18803
K 4
S2_0
V 21
dir 3.10x.r21862/4178
K 4
S2_1
V 22
dir 3.59e.r20026/11014
K 4
S2_2
V 21
dir 3.5cy.r21861/5036
K 4
S2_3
V 21
dir 3.5f2.r29458/5135
K 4
S2_4
V 22
dir 3.5ii.r30401/87429
K 4
S2_5
V 22
dir 3.5kv.r32319/22991
K 6
S2_5_3
V 23
dir 3.5ut.r31805/553797
K 4
S2_6
V 22
dir 3.5qi.r32325/47134
K 11
freeciv-web
V 22
dir 3.5bl.r13594/14918
END
ENDREP
id: 1.0.r32325/47769
type: dir
pred: 1.0.r32323/5412
count: 11028
text: 32325 47374 382 0 d29872de25e027106af1385ee000ab8b
cpath: /branches
copyroot: 0 /

PLAIN
K 8
branches
V 20
dir 1.0.r32325/47769
K 4
tags
V 19
dir 2.0.r31807/7857
K 5
trunk
V 21
dir 3.5ck.r32324/6245
K 7
website
V 20
dir 3ge.0.r31885/802
END
ENDREP
id: 0.0.r32325/48089
type: dir
pred: 0.0.r32324/6631
count: 32325
text: 32325 47924 152 0 cd220ddfa9e322ee541236565fdf1b49
cpath: /
copyroot: 0 /

2lh.5r9.t32324-1 modify true false /branches/S2_6/ai/default/aisettler.c

18.5qi.t32324-1 modify true false /branches/S2_6/server/unithand.c

19.5qi.t32324-1 modify true false /branches/S2_6/server/unithand.h

1a.5qi.t32324-1 modify true false /branches/S2_6/server/unittools.c


48089 48236
