101 if (nextra != NULL) {
115 value +=
MAX(0,
MAX(mine_bonus, irrig_bonus)) / 2;
131 const struct tile *ptile,
135 struct tile_list *tlist = tile_list_new();
141 tile_list_append(tlist, central);
143 while (tile_list_size(tlist) > 0 && tiles < min_area) {
150 tile_list_append(tlist, ptile3);
152 if (tiles >= min_area) {
159 tile_list_remove(tlist, ptile2);
161 if (tiles >= min_area) {
168 tile_list_destroy(tlist);
174 return tiles >= min_area;
240 <= (sqrt(cont_size / island->
total))))
305 int *tile_value_aux = NULL;
306 int *tile_value = NULL;
307 int min_goodies_per_player = 1500;
308 int total_goodies = 0;
311 bool failure =
FALSE;
318 log_verbose(
"Map has no land, so cannot assign start positions!");
347 int this_tile_value = tile_value_aux[
tile_index(value_tile)];
348 int lcount = 0, bcount = 0;
352 if (this_tile_value > tile_value_aux[
tile_index(ptile1)]) {
354 }
else if (this_tile_value < tile_value_aux[
tile_index(ptile1)]) {
359 if (lcount <= bcount) {
362 tile_value[
tile_index(value_tile)] = 100 * this_tile_value;
377 total_goodies += tile_value[
tile_index(starter_tile)];
393 log_verbose(
"Not enough continents; falling back to startpos=2or3");
399 log_verbose(
"Not enough continents; falling back to startpos=VARIABLE");
405 ||
islands[1].goodies < total_goodies * (0.5 + 0.8 * efactor)
407 log_verbose(
"No good enough island; falling back to startpos=VARIABLE");
413 min_goodies_per_player = total_goodies * (0.65 + 0.8 * efactor)
430 float var_goodies, best = HUGE_VAL;
435 if (
islands[nr + num_islands - 1].goodies < min_goodies_per_player) {
440 / (
islands[nr + num_islands - 1].goodies);
442 if (var_goodies < best * 0.9) {
468 /
MAX(1, min_goodies_per_player));
474 data.
value = tile_value;
491 log_debug(
"Adding (%d, %d) as starting position %d, %d goodies on "
498 log_normal(
_(
"The server appears to have gotten into an infinite "
499 "loop in the allocation of starting positions.\nMaybe "
500 "the number of players is too high for this map."));
void dbv_init(struct dbv *pdbv, int bits)
void dbv_set(struct dbv *pdbv, int bit)
bool dbv_isset(const struct dbv *pdbv, int bit)
void dbv_free(struct dbv *pdbv)
int city_tile_output(const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
#define output_type_iterate(output)
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
#define CITY_MAP_DEFAULT_RADIUS_SQ
#define city_tile_iterate_end
#define output_type_iterate_end
signed short Continent_id
#define log_verbose(message,...)
#define fc_assert_ret_val(condition, val)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
struct startpos * map_startpos_new(struct tile *ptile)
struct tile * startpos_tile(const struct startpos *psp)
struct tile * rand_map_pos_filtered(const struct civ_map *nmap, void *data, bool(*filter)(const struct tile *ptile, const void *data))
int map_startpos_count(void)
int real_map_distance(const struct tile *tile0, const struct tile *tile1)
struct terrain_misc terrain_control
#define map_startpos_iterate(NAME_psp)
#define adjc_iterate(nmap, center_tile, itr_tile)
#define map_startpos_iterate_end
#define whole_map_iterate(_map, _tile)
#define map_size_checked()
#define whole_map_iterate_end
int get_continent_size(Continent_id id)
void smooth_int_map(int *int_map, bool zeroes_at_edges)
void adjust_int_map_filtered(int *int_map, int int_map_max, void *data, bool(*filter)(const struct tile *ptile, const void *data))
#define fc_calloc(n, esz)
bool is_native_tile(const struct unit_type *punittype, const struct tile *ptile)
bool are_reqs_active(const struct req_context *context, const struct player *other_player, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
bool road_can_be_built(const struct road_type *proad, const struct tile *ptile)
static int compare_islands(const void *A_, const void *B_)
bool create_start_positions(enum map_startpos mode, struct unit_type *initial_unit)
static bool filter_starters(const struct tile *ptile, const void *data)
static void initialize_isle_data(void)
static int * islands_index
static struct islands_data_type * islands
static int get_tile_value(struct tile *ptile)
static bool check_native_area(const struct unit_type *utype, const struct tile *ptile, int min_area)
static bool is_valid_start_pos(const struct tile *ptile, const void *dataptr)
struct civ_game::@30::@34 server
struct unit_type * initial_unit
bool temperature_is_initialized(void)
bool tmap_is(const struct tile *ptile, temperature_type tt)
void create_tmap(bool real)
#define terrain_has_flag(terr, flag)
void tile_add_extra(struct tile *ptile, const struct extra_type *pextra)
void tile_virtual_destroy(struct tile *vtile)
bool tile_apply_activity(struct tile *ptile, Activity_type_id act, struct extra_type *tgt)
struct tile * tile_virtual_new(const struct tile *ptile)
#define tile_list_iterate(tile_list, ptile)
#define tile_terrain(_tile)
#define tile_list_iterate_end
#define tile_continent(_tile)
struct unit_type * get_role_unit(int role, int role_index)
int num_role_units(int role)