66 enum mapgen_terrain_property
avoid;
75#define SPECLIST_TAG terrain_select
78#define terrain_select_list_iterate(tersel_list, ptersel) \
79 TYPED_LIST_ITERATE(struct terrain_select, tersel_list, ptersel)
80#define terrain_select_list_iterate_end \
84 enum mapgen_terrain_property
target,
85 enum mapgen_terrain_property
prefer,
86 enum mapgen_terrain_property
avoid,
97 struct terrain_select_list *
swamp;
103static void fill_island(
int coast,
long int *bucket,
104 const struct terrain_select_list *tersel_list,
108 int min_specific_island_size);
110#define RIVERS_MAXTRIES 32767
155#define HAS_POLES (wld.map.server.temperature < 70 && !wld.map.server.alltemperate)
172#define map_pos_is_dry(ptile) \
173 (map_colatitude((ptile)) <= DRY_MAX_LEVEL \
174 && map_colatitude((ptile)) > DRY_MIN_LEVEL \
175 && count_terrain_class_near_tile(&(wld.map), (ptile), \
176 FALSE, TRUE, TC_OCEAN) <= 35)
183#define ini_hmap_low_level() \
185hmap_low_level = (4 * swamp_pct * \
186 (hmap_max_level - hmap_shore_level)) / 100 + hmap_shore_level; \
189#define map_pos_is_low(ptile) ((hmap((ptile)) < hmap_low_level))
227 log_error(
"Invalid miscellaneous_c %d", c);
279 int thill,
int my_height)
395 struct terrain *pterrain,
int *to_be_placed,
400 if (*to_be_placed <= 0) {
420 to_be_placed, wc, tc, mc);
465#define PLACE_ONE_TYPE(count, alternate, ter, wc, tc, mc, weight) \
467 struct tile *ptile; \
469 if ((ptile = rand_map_pos_characteristic((wc), (tc), (mc)))) { \
470 place_terrain(ptile, (weight), (ter), &(count), (wc),(tc), (mc)); \
474 (alternate) += (count); \
489 int forests_count = 0;
490 int jungles_count = 0;
491 int deserts_count = 0;
492 int alt_deserts_count = 0;
493 int plains_count = 0;
494 int swamps_count = 0;
509 plains_count = total - forests_count - deserts_count
510 - swamps_count - jungles_count;
532 if (plains_count > 0) {
544 }
while (forests_count > 0 || jungles_count > 0
545 || deserts_count > 0 || alt_deserts_count > 0
546 || plains_count > 0 || swamps_count > 0 );
684#define NUM_TEST_FUNCTIONS 9
794 int rd_comparison_val[8];
796 bool rd_direction_is_valid[8];
797 int num_valid_directions, func_num, direction;
802 log_debug(
"The tile at (%d, %d) has been marked as river in river_map.",
818 log_debug(
"The river did not end at (%d, %d). Evaluating directions...",
822 memset(rd_direction_is_valid, 0,
sizeof(rd_direction_is_valid));
824 rd_direction_is_valid[dir] =
TRUE;
833 if (rd_direction_is_valid[dir]) {
837 if (best_val == -1) {
838 best_val = rd_comparison_val[dir];
840 best_val =
MIN(rd_comparison_val[dir], best_val);
853 if (rd_direction_is_valid[dir]) {
854 if (rd_comparison_val[dir] != best_val) {
855 rd_direction_is_valid[dir] =
FALSE;
863 num_valid_directions = 0;
865 if (rd_direction_is_valid[dir]) {
866 num_valid_directions++;
870 if (num_valid_directions == 0) {
875 log_debug(
"mapgen.c: Had to let the random number"
876 " generator select a direction for a river.");
877 direction =
fc_rand(num_valid_directions);
878 log_debug(
"mapgen.c: direction: %d", direction);
882 if (rd_direction_is_valid[dir]) {
910 int desirable_riverlength =
922 int current_riverlength = 0;
927 int iteration_counter = 0;
941 while (current_riverlength < desirable_riverlength
974 && (pterrain->
property[MG_MOUNTAINOUS] == 0
979 && (pterrain->
property[MG_FROZEN] == 0
994 if (oriver != road_river) {
1003 log_debug(
"Found a suitable starting tile for a river at (%d, %d)."
1004 " Starting to make it.",
TILE_XY(ptile));
1007 if (
make_river(&rivermap, ptile, road_river)) {
1015 if (river_terrain != NULL) {
1021 current_riverlength++;
1027 log_debug(
"mapgen.c: A river failed. It might have gotten stuck "
1031 iteration_counter++;
1032 log_debug(
"current_riverlength: %d; desirable_riverlength: %d; "
1033 "iteration_counter: %d",
1034 current_riverlength, desirable_riverlength, iteration_counter);
1050 struct terrain *land_fill = NULL;
1061 land_fill = pterrain;
1067 "No land terrain type could be found for the purpose "
1068 "of temporarily filling in land tiles during map "
1069 "generation. This could be an error in Freeciv, or a "
1070 "mistake in the terrain.ruleset file. Please make sure "
1071 "there is at least one land terrain type in the "
1072 "ruleset, or use a different map generator. If this "
1073 "error persists, please report it at: %s", BUG_URL);
1094 depth += 30 * (ocean - land) /
MAX(1, (ocean + land));
1110 if (frozen && !pterrain) {
1204 int total = 0, ocean = 0;
1230 log_verbose(
" %-20s : %6d %5.1f%% (ocean: %5.1f%%)",
1238 log_verbose(
" %-20s : %6d %5.1f%% (land: %5.1f%%)",
1276#ifdef FREECIV_TESTMATIC
1406 "Fair island generator failed to allocated "
1407 "start positions!");
1426 log_verbose(
"Map generator chose startpos=SINGLE");
1466 log_error(
_(
"The server couldn't allocate starting positions."));
1488 float mount_factor = (100.0 - polar - 30 * 0.8) / 10000;
1582 for (r = pterrain->
resources; *r; r++) {
1587 if ((*r)->generated) {
1612 xrnd = pstate->
w +
fc_rand(pstate->
e - pstate->
w);
1613 yrnd = pstate->
n +
fc_rand(pstate->
s - pstate->
n);
1622 enum mapgen_terrain_property
target,
1623 enum mapgen_terrain_property
prefer,
1624 enum mapgen_terrain_property
avoid,
1645 if (ptersel != NULL) {
1654 const struct terrain_select_list *tersel_list,
1657 int i, k, capac, total_weight = 0;
1658 int ntersel = terrain_select_list_size(tersel_list);
1661 if (*bucket <= 0 ) {
1669 i = *bucket / capac;
1671 *bucket -= i * capac;
1674 failsafe = i * (pstate->
s - pstate->
n) * (pstate->
e - pstate->
w);
1676 failsafe = -failsafe;
1680 total_weight += ptersel->weight;
1683 if (total_weight <= 0) {
1687 while (i > 0 && (failsafe--) > 0) {
1695 = terrain_select_list_get(tersel_list,
fc_rand(ntersel));
1719 log_debug(
"[fill_island] placed terrain '%s' at (%2d,%2d)",
1735 int num_card_ocean, pct_adj_ocean, num_adj_river;
1745 return (num_card_ocean == 1 && pct_adj_ocean <= 35
1746 && num_adj_river == 0);
1756 int pct_adj_ocean, num_card_ocean, pct_adj_river, num_card_river;
1767 return (num_card_river == 1 && num_card_ocean == 0
1768 && pct_adj_ocean < 20 && pct_adj_river < 35
1771 && (pct_adj_river + pct_adj_ocean * 2) <
fc_rand(25) + 25);
1780 long int failsafe, capac, i, k;
1791 i = *bucket / capac;
1793 *bucket -= i * capac;
1796 i = (i * 175) / 100;
1799 failsafe = i * (pstate->
s - pstate->
n) * (pstate->
e - pstate->
w) * 5;
1801 failsafe = -failsafe;
1804 while (i > 0 && failsafe-- > 0) {
1821 && (
fc_rand(100) < coast || i == k))
1859 for (ycur = pstate->
n, xcur = pstate->
w;
1860 ycur < pstate->
s && xcur < pstate->
e;
1864 xcur +
nat_x - pstate->
w,
1865 ycur +
nat_y - pstate->
n);
1867 if (!tile0 || !tile1) {
1875 for (ycur = pstate->
n; ycur < pstate->
s; ycur++) {
1876 for (xcur = pstate->
w; xcur < pstate->
e; xcur++) {
1879 xcur +
nat_x - pstate->
w,
1880 ycur +
nat_y - pstate->
n);
1882 if (!tile0 || !tile1) {
1891 for (ycur = pstate->
n; ycur < pstate->
s; ycur++) {
1892 for (xcur = pstate->
w; xcur < pstate->
e; xcur++) {
1895 xcur +
nat_x - pstate->
w,
1896 ycur +
nat_y - pstate->
n);
1900 log_error(
"mapgen.c: mass doesn't sum up.");
1913 pstate->
s +=
nat_y - pstate->
n;
1914 pstate->
e +=
nat_x - pstate->
w;
1929 if (
hmap(tile1) != 0) {
1943 long int tries = islemass*(2+islemass/20)+99;
1958 while (i > 0 && tries-->0) {
1972 if (nat_y <= pstate->
n && pstate->
n > 2) {
1975 if (nat_x <= pstate->w && pstate->
w > 2) {
1979 if (i < islemass / 10) {
1982 for (ycur = pstate->
n; ycur < pstate->
s; ycur++) {
1983 for (xcur = pstate->
w; xcur < pstate->
e; xcur++) {
1985 if (
hmap(ptile) == 0 && i > 0
1995 log_error(
"create_island ended early with %d/%d.", islemass-i, islemass);
2016 ptersel =
tersel_new(1, MG_FOLIAGE, MG_TROPICAL, MG_DRY,
2022 ptersel =
tersel_new(1, MG_FOLIAGE, MG_WET, MG_FROZEN,
2031 ptersel =
tersel_new(3, MG_DRY, MG_TROPICAL, MG_GREEN,
2034 ptersel =
tersel_new(2, MG_DRY, MG_TEMPERATE, MG_GREEN,
2037 ptersel =
tersel_new(1, MG_COLD, MG_DRY, MG_TROPICAL,
2055 ptersel =
tersel_new(1, MG_WET, MG_TROPICAL, MG_FOLIAGE,
2058 ptersel =
tersel_new(2, MG_WET, MG_TEMPERATE, MG_FOLIAGE,
2061 ptersel =
tersel_new(1, MG_WET, MG_COLD, MG_FOLIAGE,
2093 int min_specific_island_size)
2096 static long int tilefactor, balance, lastplaced;
2097 static long int riverbuck, mountbuck, desertbuck, forestbuck, swampbuck;
2104 if (islemass == 0) {
2115 log_normal(
_(
"High landmass - this may take a few seconds."));
2119 i = (i <= 90) ? 100 : i * 11 / 10;
2130 islemass = islemass - balance;
2132 if (islemass > lastplaced + 1 + lastplaced / 50) {
2134 islemass = lastplaced + 1 + lastplaced / 50;
2157 if (i < islemass * min_specific_island_size / 100) {
2164 if (i * 10 > islemass) {
2165 balance = i - islemass;
2219 ptile->extras_owner = NULL;
2243 long int totalweight;
2254 int bigfrac = 70, midfrac = 20, smallfrac = 10;
2257 log_verbose(
"ISLAND generator: falling back to RANDOM generator");
2269 while (!done && bigfrac > midfrac) {
2290 log_verbose(
"Island too small, trying again with all smaller "
2292 midfrac += bigfrac * 0.01;
2293 smallfrac += bigfrac * 0.04;
2301 if (bigfrac <= midfrac) {
2303 log_verbose(
"ISLAND generator: falling back to RANDOM generator");
2341 long int maxmassdiv6 = 20;
2347 log_verbose(
"ISLAND generator: falling back to FRACTAL generator due "
2348 "to landpercent > 80.");
2354 log_verbose(
"ISLAND generator: falling back to FRACTAL generator due "
2355 "to unsupported map size.");
2372 islandmass = (
landmass)/(3 * bigislands);
2373 if (islandmass < 4 * maxmassdiv6) {
2374 islandmass = (
landmass)/(2 * bigislands);
2377 islandmass= (
landmass)/(bigislands);
2380 if (islandmass < 2) {
2383 if (islandmass > maxmassdiv6 * 6) {
2384 islandmass = maxmassdiv6 * 6;
2395 log_normal(
_(
"Generator 3 didn't place all big islands."));
2398 islandmass = (islandmass * 11) / 8;
2400 if (islandmass < 2) {
2404 while (
checkmass > islandmass && ++j < 1500) {
2406 size =
fc_rand((islandmass + 1) / 2 + 1) + islandmass / 2;
2438 long int totalweight;
2446 log_verbose(
"ISLAND generator: falling back to startpos=SINGLE");
2507 && priver->generated) {
2562 struct fair_tile *ptile,
int *x,
int *y)
2601 enum direction8 dir)
2623 && (nat_x < dist || nat_x >=
wld.
map.
xsize - dist)) {
2632 && (nat_y < dist || nat_y >=
wld.
map.
ysize - dist)) {
2644 const struct iter_index *index1 = a, *index2 = b;
2646 return index1->
dist - index2->dist;
2654 const struct iter_index *index1 = a, *index2 = b;
2657 ? abs(index1->
dx + index1->
dy) - abs(index2->dx + index2->dy)
2658 : abs(index1->
dy) - abs(index2->dy));
2660 return (diff != 0 ? diff : index1->
dist - index2->dist);
2668 const struct iter_index *index1 = a, *index2 = b;
2671 ? abs(index1->
dx - index1->
dy) - abs(index2->dx - index2->dy)
2672 : abs(index1->
dx) - abs(index2->dx));
2674 return (diff != 0 ? diff : index1->
dist - index2->dist);
2718#define fair_do_iso_hex_symmetry2 fair_do_rotation
2793 for (steps =
fc_rand(99) % 3; steps > 0; steps--) {
2806 for (steps =
fc_rand(99) % 3; steps > 0; steps--) {
2823 int startpos_team_id)
2831 for (pstile = psource; pstile < smax_tile; pstile++) {
2844 if (pttile == NULL) {
2867 for (pstile = psource; pstile < smax_tile; pstile++) {
2907 for (i = 0; i < 10; i++) {
2936 int startpos_team_id)
2947 x = tx + outwards_indices[i].
dx;
2948 y = ty + outwards_indices[i].
dy;
2951 startpos_team_id)) {
2978 bool land_around =
FALSE;
3006 if (pftile2 != NULL) {
3035 if (pftile -
pmap == k) {
3084 enum mapgen_terrain_property target;
3085 enum mapgen_terrain_property prefer;
3086 enum mapgen_terrain_property avoid;
3088 { 0, MG_TEMPERATE, MG_GREEN, MG_MOUNTAINOUS },
3089 { 0, MG_FOLIAGE, MG_TEMPERATE,
MG_UNUSED },
3090 { 0, MG_DRY, MG_TEMPERATE, MG_GREEN },
3091 { 0, MG_MOUNTAINOUS, MG_GREEN,
MG_UNUSED },
3092 { 0, MG_MOUNTAINOUS,
MG_UNUSED, MG_GREEN },
3093 { 0, MG_WET, MG_TEMPERATE, MG_FOLIAGE },
3098 struct fair_tile *pftile, *pftile2, *pftile3;
3100 const int sea_around_island = (startpos_num > 0
3102 const int sea_around_island_sq = (startpos_num > 0
3107 fantasy = (
size * 2) / 5;
3112 land_tiles[0] = pftile;
3115 log_debug(
"Generating an island with %d land tiles [fantasy=%d].",
3119 while (i < fantasy) {
3120 pftile = land_tiles[
fc_rand(i)];
3131 land_tiles[i++] = pftile2;
3139 pftile = land_tiles[i -
fc_rand(fantasy) - 1];
3149 land_tiles[i++] = pftile2;
3155 for (i = 0; i < startpos_num;) {
3165 terrain[FT_GRASSLAND].count =
size - startpos_num;
3173 for (i = 0; i <
size; i++) {
3174 pftile = land_tiles[i];
3182 }
while (
terrain[j].count == 0);
3191 for (i = 0; i <
size; i++) {
3194 sea_around_island_sq, ptile) {
3203 if (startpos_num > 0) {
3216 int length_max = 3, length, l;
3217 enum direction8 dir;
3221 bool connectable_river_around, ocean_around;
3225 for (i = 0; i <
n; i++) {
3239 connectable_river_around =
FALSE;
3240 ocean_around =
FALSE;
3243 if (pftile2 == NULL) {
3248 ocean_around =
TRUE;
3253 connectable_river_around =
TRUE;
3259 || (river_around == 1 && !connectable_river_around)) {
3263 if (connectable_river_around) {
3274 dir = direction8_invalid();
3283 for (l = 2; l < length_max; l++) {
3291 connectable_river_around =
FALSE;
3292 ocean_around =
FALSE;
3300 if (pftile3 == NULL) {
3306 ocean_around =
TRUE;
3311 connectable_river_around =
TRUE;
3315 if (river_around > 1 && !connectable_river_around) {
3317 }
else if (ocean_around || connectable_river_around) {
3322 if (finished &&
fc_rand(++dirs_num) == 0) {
3332 log_debug(
"Make river from (%d, %d) to (%d, %d) [dir=%s, length=%d]",
3337 direction8_name(dir),
3342 if (pftile == pend) {
3352 if (startpos_num > 0) {
3369 pftile = pisland + i;
3387 int playermass, islandmass1 , islandmass2, islandmass3;
3389 int players_per_island = 1;
3390 int teams_num = 0, team_players_num = 0, single_players_num = 0;
3398 single_players_num++;
3401 team_players_num += i;
3433 players_per_island = 3;
3434 }
else if (maybe2) {
3435 players_per_island = 2;
3444 if (players_per_island == 1) {
3445 players_per_island = i;
3446 }
else if (i != players_per_island) {
3449 players_per_island = 1;
3462 if (players_per_island == 1) {
3471 ptile->extras_owner = NULL;
3491 islandmass1 = (players_per_island * playermass * 7) / 10;
3492 if (islandmass1 < min_island_size) {
3493 islandmass1 = min_island_size;
3495 islandmass2 = (playermass * 2) / 10;
3496 if (islandmass2 < min_island_size) {
3497 islandmass2 = min_island_size;
3499 islandmass3 = playermass / 10;
3500 if (islandmass3 < min_island_size) {
3501 islandmass3 = min_island_size;
3504 log_verbose(
"Creating a map with fair island generator");
3506 log_debug(
"players_per_island=%d", players_per_island);
3509 log_debug(
"teams_num=%d, team_players_num=%d, single_players_num=%d",
3510 teams_num, team_players_num, single_players_num);
3511 log_debug(
"playermass=%d, islandmass1=%d, islandmass2=%d, islandmass3=%d",
3512 playermass, islandmass1, islandmass2, islandmass3);
3516 while (--iter >= 0) {
3542 log_debug(
"Place main islands on the map.");
3546 && team_players_num > 0) {
3548 struct iter_index outwards_indices[
wld.map.num_iterate_outwards_indices];
3549 int start_x[teams_num], start_y[teams_num];
3555 sizeof(outwards_indices));
3557 case TEAM_PLACEMENT_DISABLED:
3560 case TEAM_PLACEMENT_CLOSEST:
3561 case TEAM_PLACEMENT_CONTINENT:
3564 outwards_indices[j].
dist =
3566 outwards_indices[j].
dy);
3571 case TEAM_PLACEMENT_HORIZONTAL:
3575 case TEAM_PLACEMENT_VERTICAL:
3588 for (j = 0; j < teams_num; j++) {
3589 start_x[j] = (
wld.
map.
xsize * (2 * j + 1)) / (2 * teams_num) +
dx;
3590 start_y[j] = (
wld.
map.
ysize * (2 * j + 1)) / (2 * teams_num) +
dy;
3604 int members_count = player_list_size(
team_members(pteam));
3608 if (members_count <= 1) {
3614 log_verbose(
"Team %d (%s) will start on (%d, %d)",
3617 for (k = 0; k < members_count; k += players_per_island) {
3619 outwards_indices, team_id)) {
3620 log_verbose(
"Failed to place island number %d for team %d (%s).",
3633 fc_assert(!done || i == team_players_num);
3640 log_verbose(
"Failed to place island number %d.", i);
3650 log_debug(
"Create and place small islands on the map.");
3654 log_verbose(
"Failed to place small island2 number %d.", i);
3666 log_verbose(
"Failed to place small island3 number %d.", i);
3683 islandmass1 = (islandmass1 * 99) / 100;
3684 if (islandmass1 < min_island_size) {
3685 islandmass1 = min_island_size;
3687 islandmass2 = (islandmass2 * 99) / 100;
3688 if (islandmass2 < min_island_size) {
3689 islandmass2 = min_island_size;
3691 islandmass3 = (islandmass3 * 99) / 100;
3692 if (islandmass3 < min_island_size) {
3693 islandmass3 = min_island_size;
3698 log_verbose(
"Failed to create map after %d iterations.", iter);
3722 ptile->extras = pftile->
extras;
3743 log_verbose(
"Fair island map created with success!");
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)
void dbv_clr_all(struct dbv *pdbv)
#define BV_ISSET(bv, bit)
#define CITY_MAP_DEFAULT_RADIUS
#define CITY_MAP_DEFAULT_RADIUS_SQ
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction bool fatal
void make_fracture_map(void)
void make_fracture_relief(void)
static map_landmass * landmass
void renormalize_hmap_poles(void)
void normalize_hmap_poles(void)
bool area_is_too_flat(struct tile *ptile, int thill, int my_height)
void make_pseudofractal1_hmap(int extra_div)
void make_random_hmap(int smooth)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define fc_assert_exit_msg(condition, message,...)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_error(message,...)
#define log_testmatic(message,...)
struct startpos * map_startpos_new(struct tile *ptile)
bool startpos_allows_all(const struct startpos *psp)
struct tile * rand_map_pos(const struct civ_map *nmap)
void main_map_allocate(void)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
int map_vector_to_sq_distance(int dx, int dy)
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)
bool is_cardinal_dir(enum direction8 dir)
struct tile * native_pos_to_tile(const struct civ_map *nmap, int nat_x, int nat_y)
bool startpos_allow(struct startpos *psp, struct nation_type *pnation)
bool normalize_map_pos(const struct civ_map *nmap, int *x, int *y)
#define current_topo_has_flag(flag)
#define native_pos_to_index(nat_x, nat_y)
static int index_to_map_pos_y(int mindex)
static const bool C_PERCENT
static const bool C_NUMBER
#define square_iterate(nmap, center_tile, radius, tile_itr)
#define cardinal_adjc_iterate_end
#define adjc_iterate(nmap, center_tile, itr_tile)
#define MAP_TO_NATIVE_POS(pnat_x, pnat_y, map_x, map_y)
static const bool C_ADJACENT
#define NATIVE_TO_MAP_POS(pmap_x, pmap_y, nat_x, nat_y)
#define cardinal_adjc_dir_iterate_end
#define square_iterate_end
#define cardinal_adjc_iterate(nmap, center_tile, itr_tile)
#define circle_iterate(nmap, center_tile, sq_radius, tile_itr)
static int index_to_map_pos_x(int mindex)
#define whole_map_iterate(_map, _tile)
static const bool C_CARDINAL
#define cardinal_adjc_dir_base_iterate_end
#define cardinal_adjc_dir_base_iterate(nmap, center_tile, dir_itr)
#define index_to_native_pos(pnat_x, pnat_y, mindex)
#define cardinal_adjc_dir_iterate(nmap, center_tile, itr_tile, dir_itr)
#define whole_map_iterate_end
#define index_to_map_pos(pmap_x, pmap_y, mindex)
#define circle_iterate_end
#define DIRSTEP(dest_x, dest_y, dir)
static void make_plains(void)
static int fair_team_placement_vertical(const void *a, const void *b)
static void make_terrains(void)
static int hmap_low_level
static void make_rivers(void)
static void mapgenerator2(void)
#define terrain_select_list_iterate_end
#define NUM_TEST_FUNCTIONS
static void fair_do_hex_symmetry1(int *x, int *y)
#define fair_do_iso_hex_symmetry2
static void fair_map_make_resources(struct fair_tile *pmap)
static bool make_island(int islemass, int starters, struct gen234_state *pstate, int min_specific_island_size)
static int river_test_adjacent_swamp(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
static struct fair_tile * fair_map_new(void)
static int river_test_height_map(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
struct terrain_select_list * mountain
static void fair_geometry_rand(struct fair_geometry_data *data)
#define map_pos_is_dry(ptile)
void(* fair_geometry_func)(int *x, int *y)
static void fair_do_iso_hex_symmetry1(int *x, int *y)
static void fair_do_geometry(const struct fair_geometry_data *data, int *x, int *y)
static void make_land(void)
static void initworld(struct gen234_state *pstate)
static struct fair_tile * fair_map_island_new(int size, int startpos_num)
static void fair_map_destroy(struct fair_tile *pmap)
static bool fair_map_tile_border(struct fair_tile *pmap, struct fair_tile *ptile, int dist)
static void mapgenerator4(void)
static void make_polar_land(void)
static void fair_do_hex_symmetry2(int *x, int *y)
static void fill_island(int coast, long int *bucket, const struct terrain_select_list *tersel_list, const struct gen234_state *const pstate)
#define map_pos_is_low(ptile)
static struct tile * rand_map_pos_characteristic(wetness_c wc, temperature_type tc, miscellaneous_c mc)
#define ini_hmap_low_level()
static void fair_map_tile_pos(struct fair_tile *pmap, struct fair_tile *ptile, int *x, int *y)
static void adjust_terrain_param(void)
static struct terrain_select * tersel_new(int weight, enum mapgen_terrain_property target, enum mapgen_terrain_property prefer, enum mapgen_terrain_property avoid, int temp_condition, int wet_condition)
#define terrain_select_list_iterate(tersel_list, ptersel)
static bool test_miscellaneous(const struct tile *ptile, miscellaneous_c c)
static int river_test_adjacent_ocean(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
static void print_mapgen_map(void)
struct terrain_select_list * forest
static bool place_island(struct gen234_state *pstate)
static void river_blockmark(struct river_map *privermap, struct tile *ptile)
static void make_huts(int number)
static bool test_wetness(const struct tile *ptile, wetness_c c)
static void island_terrain_free(void)
static bool is_tiny_island(struct tile *ptile)
struct terrain_select_list * swamp
static struct extra_type * river_types[MAX_EXTRA_TYPES]
static int river_type_count
#define PLACE_ONE_TYPE(count, alternate, ter, wc, tc, mc, weight)
static int river_test_adjacent_highlands(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
static void river_types_init(void)
static bool near_safe_tiles(struct tile *ptile)
static bool ok_for_separate_poles(struct tile *ptile)
static void fair_do_symmetry1(int *x, int *y)
static bool is_near_land(struct tile *ptile)
static int fair_team_placement_horizontal(const void *a, const void *b)
static bool condition_filter(const struct tile *ptile, const void *data)
static struct tile * get_random_map_position_from_state(const struct gen234_state *const pstate)
static bool is_resource_close(const struct tile *ptile)
static void add_resources(int prob)
static void mapgenerator3(void)
static void fair_do_rotation(int *x, int *y)
static bool fair_map_place_island_rand(struct fair_tile *ptarget, struct fair_tile *psource)
static int river_test_highlands(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
static void fill_island_rivers(int coast, long int *bucket, const struct gen234_state *const pstate)
static void fair_map_make_huts(struct fair_tile *pmap)
static int fair_team_placement_closest(const void *a, const void *b)
static bool make_river(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
static void island_terrain_init(void)
static bool island_river_mouth_suitability(const struct tile *ptile, const struct extra_type *priver)
static int river_test_rivergrid(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
static bool map_generate_fair_islands(void)
static void fair_do_iso_hex_rotation(int *x, int *y)
static void make_polar(void)
static bool create_island(int islemass, struct gen234_state *pstate)
static void make_plain(struct tile *ptile, int *to_be_placed)
static bool island_river_suitability(const struct tile *ptile, const struct extra_type *priver)
static bool fair_map_place_island_team(struct fair_tile *ptarget, int tx, int ty, struct fair_tile *psource, const struct iter_index *outwards_indices, int startpos_team_id)
static struct test_func test_funcs[NUM_TEST_FUNCTIONS]
static bool fair_map_copy(struct fair_tile *ptarget, int tx, int ty, struct fair_tile *psource, const struct fair_geometry_data *data, int startpos_team_id)
struct terrain_select_list * desert
static void make_relief(void)
static int river_test_adjacent_river(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
static void fair_do_hex_rotation(int *x, int *y)
static void remove_tiny_islands(void)
static int river_test_swamp(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
static int count_card_adjc_elevated_tiles(struct tile *ptile)
static void place_terrain(struct tile *ptile, int diff, struct terrain *pterrain, int *to_be_placed, wetness_c wc, temperature_type tc, miscellaneous_c mc)
static bool terrain_is_too_high(struct tile *ptile, int thill, int my_height)
bool map_fractal_generate(bool autosize, struct unit_type *initial_unit)
static void fair_do_symmetry2(int *x, int *y)
static struct @97 island_terrain
static struct fair_tile * fair_map_pos_tile(struct fair_tile *pmap, int x, int y)
static void tersel_free(struct terrain_select *ptersel)
static long int checkmass
static struct fair_tile * fair_map_tile_step(struct fair_tile *pmap, struct fair_tile *ptile, enum direction8 dir)
static int river_test_blocked(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
void generator_init_topology(bool autosize)
int map_colatitude(const struct tile *ptile)
bool near_singularity(const struct tile *ptile)
void set_all_ocean_tiles_placed(void)
void create_placed_map(void)
void map_set_placed(struct tile *ptile)
void destroy_placed_map(void)
bool not_placed(const struct tile *ptile)
struct terrain * pick_terrain_by_flag(enum terrain_flag_id flag)
void assign_continent_numbers(void)
void regenerate_lakes(void)
void set_placed_near_pos(struct tile *ptile, int dist)
void smooth_water_depth(void)
bool placed_map_is_initialized(void)
struct terrain * pick_terrain(enum mapgen_terrain_property target, enum mapgen_terrain_property prefer, enum mapgen_terrain_property avoid)
struct terrain * most_shallow_ocean(bool frozen)
struct terrain * pick_ocean(int depth, bool frozen)
void map_unset_placed(struct tile *ptile)
#define fc_calloc(n, esz)
struct nation_type * nation_of_player(const struct player *pplayer)
#define player_list_iterate(playerlist, pplayer)
#define player_list_iterate_end
RANDOM_STATE fc_rand_state(void)
void fc_srand(RANDOM_TYPE seed)
void fc_rand_set_state(RANDOM_STATE state)
bool road_has_flag(const struct road_type *proad, enum road_flag_id flag)
bool is_cardinal_only_road(const struct extra_type *pextra)
int count_river_type_tile_card(struct civ_map *nmap, const struct tile *ptile, const struct extra_type *priver, bool percentage)
int count_river_type_near_tile(struct civ_map *nmap, const struct tile *ptile, const struct extra_type *priver, bool percentage)
int count_river_near_tile(struct civ_map *nmap, const struct tile *ptile, const struct extra_type *priver)
void array_shuffle(int *array, int n)
#define CLIP(lower, current, upper)
#define FC_WRAP(value, range)
bool create_start_positions(enum map_startpos mode, struct unit_type *initial_unit)
enum direction8 valid_dirs[8]
int num_iterate_outwards_indices
enum mapsize_type mapsize
enum map_startpos startpos
struct iter_index * iterate_outwards_indices
struct civ_map::@41::@43 server
enum team_placement team_placement
enum direction8 cardinal_dirs[8]
enum map_generator generator
fair_geometry_func transform[4]
struct terrain * pterrain
enum fair_tile_flag flags
struct extra_type * presource
enum mapgen_terrain_property avoid
enum mapgen_terrain_property target
enum mapgen_terrain_property prefer
struct extra_type ** resources
int(* func)(struct river_map *privermap, struct tile *ptile, struct extra_type *priver)
struct team * team_by_number(const int team_id)
const char * team_rule_name(const struct team *pteam)
int team_number(const struct team *pteam)
const struct player_list * team_members(const struct team *pteam)
#define teams_iterate_end
#define teams_iterate(_pteam)
bool temperature_is_initialized(void)
bool tmap_is(const struct tile *ptile, temperature_type tt)
bool is_temperature_type_near(const struct tile *ptile, temperature_type tt)
void create_tmap(bool real)
Terrain_type_id terrain_count(void)
int count_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, bool cardinal_only, bool percentage, enum terrain_class tclass)
bool is_terrain_class_card_near(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
Terrain_type_id terrain_index(const struct terrain *pterrain)
const char * terrain_rule_name(const struct terrain *pterrain)
int count_terrain_property_near_tile(const struct civ_map *nmap, const struct tile *ptile, bool cardinal_only, bool percentage, enum mapgen_terrain_property prop)
bool is_terrain_near_tile(const struct civ_map *nmap, const struct tile *ptile, const struct terrain *pterrain, bool check_self)
#define terrain_type_iterate(_p)
#define is_ocean(pterrain)
#define is_ocean_tile(ptile)
#define TERRAIN_OCEAN_DEPTH_MINIMUM
#define terrain_type_iterate_end
#define TERRAIN_OCEAN_DEPTH_MAXIMUM
#define terrain_has_flag(terr, flag)
void tile_add_extra(struct tile *ptile, const struct extra_type *pextra)
void tile_set_terrain(struct tile *ptile, struct terrain *pterrain)
void tile_virtual_destroy(struct tile *vtile)
bool tile_has_river(const struct tile *ptile)
void tile_set_owner(struct tile *ptile, struct player *pplayer, struct tile *claimer)
struct tile * tile_virtual_new(const struct tile *ptile)
bool tile_extra_rm_apply(struct tile *ptile, struct extra_type *tgt)
void tile_set_resource(struct tile *ptile, struct extra_type *presource)
void tile_set_continent(struct tile *ptile, Continent_id val)
#define tile_resource(_tile)
#define tile_terrain(_tile)
static const bv_extras * tile_extras(const struct tile *ptile)
#define tile_continent(_tile)
#define tile_has_extra(ptile, pextra)