Freeciv-3.2
|
#include <math.h>
#include "bitvector.h"
#include "iterator.h"
#include "log.h"
#include "fc_types.h"
#include "game.h"
#include "map_types.h"
#include "packets.h"
#include "world_object.h"
Go to the source code of this file.
Variables | |
static const bool | C_ADJACENT = FALSE |
static const bool | C_CARDINAL = TRUE |
static const bool | C_NUMBER = FALSE |
static const bool | C_PERCENT = TRUE |
struct terrain_misc | terrain_control |
const int | DIR_DX [8] |
const int | DIR_DY [8] |
#define adjc_dir_base_iterate | ( | nmap, | |
center_tile, | |||
dir_itr | |||
) |
#define adjc_dir_base_iterate_end adjc_dirlist_base_iterate_end |
#define adjc_dir_iterate | ( | nmap, | |
center_tile, | |||
itr_tile, | |||
dir_itr | |||
) |
#define adjc_dir_iterate_end adjc_dirlist_iterate_end |
#define adjc_iterate | ( | nmap, | |
center_tile, | |||
itr_tile | |||
) |
#define adjc_iterate_end |
#define ALL_DIRECTIONS_CARDINAL | ( | ) | topo_has_flag((CURRENT_TOPOLOGY), TF_HEX) |
#define cardinal_adjc_dir_base_iterate | ( | nmap, | |
center_tile, | |||
dir_itr | |||
) |
#define cardinal_adjc_dir_base_iterate_end adjc_dirlist_base_iterate_end |
#define cardinal_adjc_dir_iterate | ( | nmap, | |
center_tile, | |||
itr_tile, | |||
dir_itr | |||
) |
#define cardinal_adjc_dir_iterate_end adjc_dirlist_iterate_end |
#define cardinal_adjc_iterate | ( | nmap, | |
center_tile, | |||
itr_tile | |||
) |
#define cardinal_adjc_iterate_end adjc_dirlist_iterate_end |
#define cardinal_between_iterate_end |
#define circle_dxyr_iterate_end |
#define circle_iterate | ( | nmap, | |
center_tile, | |||
sq_radius, | |||
tile_itr | |||
) | circle_dxyr_iterate(nmap, center_tile, sq_radius, tile_itr, _dx, _dy, _dr) |
#define circle_iterate_end circle_dxyr_iterate_end |
#define current_topo_has_flag | ( | flag | ) | topo_has_flag((CURRENT_TOPOLOGY), (flag)) |
#define current_wrap_has_flag | ( | flag | ) | wrap_has_flag((CURRENT_WRAP), (flag)) |
#define iterate_outward_end iterate_outward_dxy_end |
#define MAP_DEFAULT_GENERATOR MAPGEN_RANDOM |
#define MAP_DEFAULT_MAPSIZE MAPSIZE_FULLSIZE |
#define MAP_DEFAULT_NORTH_LATITUDE MAP_MAX_LATITUDE_BOUND |
#define MAP_DEFAULT_SOUTH_LATITUDE MAP_MIN_LATITUDE_BOUND |
#define MAP_DEFAULT_STARTPOS MAPSTARTPOS_DEFAULT |
#define MAP_DEFAULT_TEAM_PLACEMENT TEAM_PLACEMENT_CLOSEST |
#define MAP_DISTANCE_MAX (MAP_MAX_LINEAR_SIZE + MAP_MIN_LINEAR_SIZE) |
#define MAP_IS_ISOMETRIC (CURRENT_TOPOLOGY & (TF_ISO + TF_HEX)) |
#define MAP_MAX_ABS_LATITUDE | ( | _nmap | ) | MAX(MAP_MAX_REAL_LATITUDE(_nmap), -MAP_MIN_REAL_LATITUDE(_nmap)) |
#define MAP_MAX_LATITUDE_BOUND (MAP_MAX_LATITUDE) |
#define MAP_MAX_LINEAR_SIZE (MAP_MAX_SIZE * 1000 / MAP_MIN_LINEAR_SIZE) |
#define MAP_MAX_REAL_LATITUDE | ( | _nmap | ) | MAX(MAP_NORTH_LATITUDE(_nmap), MAP_SOUTH_LATITUDE(_nmap)) |
#define MAP_MAX_SEED (MAX_UINT32 >> 1) |
#define MAP_MIN_ABS_LATITUDE | ( | _nmap | ) | MAX(0, MAX(MAP_MIN_REAL_LATITUDE(_nmap), -MAP_MAX_REAL_LATITUDE(_nmap))) |
#define MAP_MIN_LATITUDE_BOUND (-MAP_MAX_LATITUDE) |
#define MAP_MIN_REAL_LATITUDE | ( | _nmap | ) | MIN(MAP_NORTH_LATITUDE(_nmap), MAP_SOUTH_LATITUDE(_nmap)) |
#define MAP_REAL_LATITUDE_RANGE | ( | _nmap | ) | (MAP_MAX_REAL_LATITUDE(_nmap) - MAP_MIN_REAL_LATITUDE(_nmap)) |
#define map_size_checked | ( | ) | MAX(map_num_tiles() / 1000, 1) |
#define map_startpos_iterate_end generic_iterate_end |
#define NATURAL_WIDTH (MAP_IS_ISOMETRIC ? 2 * wld.map.xsize : wld.map.xsize) |
#define square_dxy_iterate | ( | nmap, | |
center_tile, | |||
radius, | |||
tile_itr, | |||
dx_itr, | |||
dy_itr | |||
) | iterate_outward_dxy(nmap, center_tile, radius, tile_itr, dx_itr, dy_itr) |
#define square_dxy_iterate_end iterate_outward_dxy_end |
#define square_iterate | ( | nmap, | |
center_tile, | |||
radius, | |||
tile_itr | |||
) | square_dxy_iterate(nmap, center_tile, radius, tile_itr, _dummy_x, dummy_y) |
#define square_iterate_end square_dxy_iterate_end |
#define startpos_nations_iterate | ( | ARG_psp, | |
NAME_pnation | |||
) |
#define startpos_nations_iterate_end generic_iterate_end |
bool base_get_direction_for_step | ( | const struct civ_map * | nmap, |
const struct tile * | start_tile, | ||
const struct tile * | end_tile, | ||
enum direction8 * | dir | ||
) |
Return TRUE and sets dir to the direction of the step if (end_x, end_y) can be reached from (start_x, start_y) in one step. Return FALSE otherwise (value of dir is unchanged in this case).
Definition at line 1328 of file map.c.
Referenced by do_attack(), get_direction_for_step(), unit_bombard(), and unit_move().
Finds the difference between the two (unnormalized) positions, in cartesian (map) coordinates. Most callers should use map_distance_vector instead.
Definition at line 1024 of file map.c.
Referenced by client_city_tile(), draw_calculated_trade_routes(), gui_distance_vector(), map_distance_vector(), tile_to_canvas_pos(), and trade_route_to_canvas_lines().
BV_DEFINE | ( | dir_vector | , |
8 | |||
) |
This function returns true if the tile at the given location can be "channeled" from land into ocean. This is the case only when there are a sufficient number of adjacent tiles that are ocean.
Definition at line 699 of file map.c.
Referenced by terrain_surroundings_allow_change().
Returns true if the tile at the given location can be turned from terrain without a 'Frozen' flag to terrain with. This requires a sufficient number of adjacent frozen tiles.
Definition at line 728 of file map.c.
Referenced by terrain_surroundings_allow_change().
This function returns true if the tile at the given location can be "reclaimed" from ocean into land. This is the case only when there are a sufficient number of adjacent tiles that are not ocean.
Definition at line 684 of file map.c.
Referenced by terrain_surroundings_allow_change().
Returns true if the tile at the given location can be thawed from terrain with a 'Frozen' flag to terrain without. This requires a sufficient number of adjacent unfrozen tiles.
Definition at line 713 of file map.c.
Referenced by terrain_surroundings_allow_change().
enum direction8 dir_ccw | ( | enum direction8 | dir | ) |
Returns the next direction counter-clock-wise.
Definition at line 1203 of file map.c.
Referenced by api_utilities_dir_ccw(), fill_terrain_sprite_array(), and gui_to_map_dir().
enum direction8 dir_cw | ( | enum direction8 | dir | ) |
Returns the next direction clock-wise.
Definition at line 1174 of file map.c.
Referenced by api_utilities_dir_cw(), fill_terrain_sprite_array(), map_to_gui_dir(), tileset_read_toplevel(), and tileset_setup_unit_direction().
const char * dir_get_name | ( | enum direction8 | dir | ) |
Return the debugging name of the direction.
Definition at line 1146 of file map.c.
Referenced by handle_unit_orders(), make_path_orders(), and pf_path_print_real().
FC_STATIC_ASSERT | ( | ) |
FC_STATIC_ASSERT | ( | MAP_MAX_SIZE *1000<= | MAX_DBV_LENGTH, |
map_too_big_for_bitvector | |||
) |
int get_direction_for_step | ( | const struct civ_map * | nmap, |
const struct tile * | start_tile, | ||
const struct tile * | end_tile | ||
) |
Return the direction which is needed for a step on the map from (start_x, start_y) to (end_x, end_y).
Definition at line 1347 of file map.c.
Referenced by make_path_orders(), request_unit_non_action_move(), send_connect_route(), send_goto_route(), and mr_menu::slot_execute_orders().
Return a bitfield of the extras on the tile that are infrastructure.
Definition at line 101 of file map.c.
Referenced by actres_possible().
Definition at line 715 of file map.h.
Referenced by api_methods_tile_map_x(), dai_hunter_manage(), fair_map_island_new(), look_for_charge(), popup_advanced_terrain_dialog(), and popup_find_dialog().
Definition at line 724 of file map.h.
Referenced by api_methods_tile_map_y(), dai_hunter_manage(), fair_map_island_new(), look_for_charge(), popup_advanced_terrain_dialog(), and popup_find_dialog().
Return the tile for the given index position.
Definition at line 456 of file map.c.
Referenced by act_sel_new_extra_tgt_callback(), act_sel_new_unit_tgt_callback(), chatwdg::anchor_clicked(), api_find_tile_by_index(), attack(), base(), clean(), cultivate(), disembark1(), disembark2(), enter_hut(), enter_hut2(), event_after(), event_after(), event_cache_save(), execute_call(), execute_orders(), fair_map_island_new(), fair_map_make_huts(), frighten_hut(), frighten_hut2(), handle_chat_msg(), handle_city_info(), handle_city_make_specialist(), handle_city_make_worker(), handle_city_short_info(), handle_early_chat_msg(), handle_edit_city_create(), handle_edit_player_vision(), handle_edit_startpos(), handle_edit_startpos(), handle_edit_startpos_full(), handle_edit_startpos_full(), handle_edit_tile(), handle_edit_tile_extra(), handle_edit_tile_terrain(), handle_edit_unit_create(), handle_edit_unit_remove(), handle_nuke_tile_info(), handle_player_diplstate(), handle_player_place_infra(), handle_tile_info(), handle_unit_actions(), handle_unit_get_actions(), handle_unit_orders(), handle_unit_sscs_set(), handle_worker_task(), handle_worker_task(), irrigate(), link_mark_tile(), map_startpos_by_number(), mine(), name_new_city_popup_callback(), notify_conn_packet(), nuke(), objtype_get_object_from_id(), paradrop(), paradrop_conquer(), paradrop_enter(), paradrop_enter_conquer(), paradrop_frighten(), paradrop_frighten_conquer(), pf_danger_map_iterate(), pf_fuel_map_iterate(), pf_jumbo_map_iterate(), pf_normal_map_iterate(), pillage(), plant(), popup_newcity_dialog(), regular_move(), request_action_details_callback(), road(), sg_load_map_owner(), sg_load_map_owner(), simple_action_callback(), simple_action_callback(), suicide_attack(), texai_city_info_recv(), texai_tile_info_recv(), texai_unit_info_recv(), texai_unit_moved_recv(), text_tag_start_sequence(), transform_terrain(), unit_order_list_is_sane(), unit_perform_action(), unpackage_short_unit(), unpackage_unit(), and upgrade_unit_order_targets().
bool is_cardinal_dir | ( | enum direction8 | dir | ) |
Returns TRUE iff the given direction is a cardinal one.
Cardinal directions are those in which adjacent tiles share an edge not just a vertex.
Definition at line 1316 of file map.c.
Referenced by api_utilities_direction_is_cardinal(), fair_map_island_new(), and get_connect_irrig().
bool is_move_cardinal | ( | const struct civ_map * | nmap, |
const struct tile * | start_tile, | ||
const struct tile * | end_tile | ||
) |
Returns TRUE iff the move from the position (start_x,start_y) to (end_x,end_y) is a cardinal one.
Definition at line 1365 of file map.c.
Referenced by is_native_move(), and tile_move_cost_ptrs().
Returns TRUE iff the map position is normal. "Normal" here means that it is both a real/valid coordinate set and that the coordinates are in their canonical/proper form. In plain English: the coordinates must be on the map.
Definition at line 963 of file map.c.
Referenced by event_cache_load(), and is_normal_nat_pos().
Return TRUE if this ocean terrain is adjacent to a safe coastline.
Definition at line 667 of file map.c.
Referenced by can_exist_at_tile(), can_unit_survive_at_tile(), is_possible_base_fuel(), is_refuel_tile(), pf_get_move_scope(), remove_city(), try_summon_barbarians(), unit_move_to_tile_test(), and unit_teleport_to_tile_test().
A "SINGULAR" position is any map position that has an abnormal number of tiles in the radius of dist.
(map_x, map_y) must be normalized.
dist is the "real" map distance.
Definition at line 1581 of file map.c.
Referenced by near_singularity().
Are two tiles adjacent to each other.
Definition at line 931 of file map.c.
Referenced by adv_could_be_my_zoc(), are_tiles_in_range(), dai_gothere(), dai_hunter_try_launch(), dai_military_attack(), dai_unit_attack(), dai_unit_bodyguard_move(), dai_unit_move(), do_move_unit(), explorer_desirable(), find_rampage_target(), mr_menu::slot_execute_orders(), uclass_need_trans_between(), and unit_move_to_tile_test().
bool is_valid_dir | ( | enum direction8 | dir | ) |
Returns TRUE iff the given direction is a valid one.
If the direction could be out of range you should use map_untrusted_dir_is_valid() instead.
Definition at line 1260 of file map.c.
Referenced by api_utilities_dir2str(), api_utilities_dir_ccw(), api_utilities_dir_cw(), get_unittype_sprite(), goto_path_redraw(), goto_path_undraw(), luascript_dir(), map_untrusted_dir_is_valid(), and mapstep().
Allocate main map and related global structures.
Definition at line 519 of file map.c.
Referenced by handle_map_info(), map_fractal_generate(), sg_load_map_tiles(), sg_load_map_tiles(), and srv_ready().
Free main map and related global structures.
Definition at line 554 of file map.c.
Referenced by game_free(), game_reset(), and srv_ready().
Allocate space for map, and initialise the tiles. Uses current map.xsize and map.ysize.
Definition at line 493 of file map.c.
Referenced by main_map_allocate(), and texai_map_init().
Return Manhattan distance between two tiles.
Definition at line 654 of file map.c.
Referenced by are_tiles_in_range(), area_is_too_flat(), can_cities_trade(), city_incite_cost(), dai_fill_unit_param(), get_caravan_enter_city_trade_bonus(), search_homecity_for_caravan(), and unit_bribe_cost().
void map_distance_vector | ( | int * | dx, |
int * | dy, | ||
const struct tile * | tile0, | ||
const struct tile * | tile1 | ||
) |
Topology function to find the vector which has the minimum "real" distance between the map positions (x0, y0) and (x1, y1). If there is more than one vector with equal distance, no guarantee is made about which is found.
Real distance is defined as the larger of the distances in the x and y direction; since units can travel diagonally this is the "real" distance a unit has to travel to get from point to point.
(See also: real_map_distance, map_distance, and sq_map_distance.)
With the standard topology the ranges of the return value are: -map.xsize / 2 <= dx <= map.xsize / 2 -map.ysize < dy < map.ysize
Definition at line 1073 of file map.c.
Referenced by city_tile_to_city_map(), do_move_unit(), edit_buffer_paste(), editor_get_selection_center(), map_claim_border(), map_distance(), real_map_distance(), sq_map_distance(), team_placement_horizontal(), team_placement_vertical(), and update_selection_rectangle().
Frees the allocated memory of the map.
Definition at line 530 of file map.c.
Referenced by handle_map_info(), main_map_free(), and texai_map_close().
Put some sensible values into the map structure
Definition at line 157 of file map.c.
Referenced by game_init(), game_reset(), and texai_map_init().
map_init_topology needs to be called after map.topology_id is changed.
map.xsize and map.ysize must be set before calling map_init_topology(). This is done by the map generator code (server), when loading a savegame or a scenario with map (server), and packhand code (client).
Definition at line 303 of file map.c.
Referenced by generator_init_topology(), handle_map_info(), sg_load_map_tiles(), sg_load_map_tiles(), and texai_map_init().
Returns TRUE if we are at a stage of the game where the map has not yet been generated/loaded. (To be precise, returns TRUE if map_allocate() has not yet been called.)
Definition at line 149 of file map.c.
Referenced by generator_validate(), handle_map_info(), leave_mapcanvas(), map_canvas_draw(), map_canvas_draw(), map_canvas_resized(), map_fractal_generate(), mapimg_create(), server_remove_player(), set_rulesetdir(), setting_is_free_to_change(), sg_save_map(), srv_ready(), texai_thread_start(), tile_map_check(), and unqueue_mapview_updates().
|
inlinestatic |
Definition at line 305 of file map.h.
Referenced by normal_move(), overlap_move(), and utype_pays_mp_for_action_estimate().
|
inlinestatic |
Definition at line 293 of file map.h.
Referenced by adv_unit_move(), dai_action_value_unit_vs_city(), dai_unit_move(), diplomat_charge_movement(), do_conquer_extras(), do_disembark(), do_unit_conquer_city(), do_unit_embark(), do_unit_hut(), kill_unit(), unit_do_regular_move(), and unit_move_pay().
Returns the total number of (real) positions (or tiles) on the map.
Definition at line 1014 of file map.c.
Referenced by achievement_check(), catastrophe_scaled(), city_name_suggestion(), climate_change(), create_island(), fair_map_make_huts(), game_map_init(), generator_init_topology(), is_city_channel_tile(), make_huts(), make_rivers(), map_fractal_generate(), map_generate_fair_islands(), map_init_topology(), remove_city(), summon_barbarians(), tile_map_check(), and update_environmental_upset().
Definition at line 705 of file map.h.
Referenced by event_cache_load().
Return the tile for the given cartesian (map) position.
Definition at line 419 of file map.c.
Referenced by adv_settlers_road_bonus(), api_methods_private_tile_for_outward_index(), butt_down_overviewcanvas(), canvas_pos_to_tile(), city_map_to_tile(), client_city_tile(), debug_command(), edit_buffer_paste(), editor_get_selection_center(), exit_find_city_dlg_callback(), find_dispersed_position(), goto_here_callback(), left_butt_down_overviewcanvas(), mapstep(), minimap_window_callback(), minimap_view::mousePressEvent(), move_unit_map_canvas(), nearest_real_tile(), normalize_map_pos(), overview_update_line(), paradrop_here_callback(), patrol_here_callback(), right_butt_down_overviewcanvas(), terrain_info_callback(), and text_tag_init_from_sequence().
Returns the latitude of this map position. This is a value in the range of -MAP_MAX_LATITUDE to MAP_MAX_LATITUDE (inclusive).
latitude reaches MAP_MAX_LATITUDE in the northern polar region, reaches -MAP_MAX_LATITUDE in the southern polar region, and is around 0 in the tropics.
Definition at line 1550 of file map.c.
Referenced by is_latitude_req_active(), map_colatitude(), and popup_info_text().
Returns the start position associated to the given ID.
Definition at line 1624 of file map.c.
Referenced by objtype_get_object_from_id().
Is there start positions set for map
Definition at line 1853 of file map.c.
Referenced by create_start_positions(), generate_players(), init_new_game(), map_fractal_generate(), maxplayers_callback(), sg_load_map_startpos(), sg_load_map_startpos(), sg_save_map_startpos(), start_command(), and update_nations_with_startpos().
Returns the start position at the given tile, or NULL if none exists there.
Definition at line 1883 of file map.c.
Referenced by fill_sprite_array(), handle_edit_startpos(), handle_edit_startpos(), handle_edit_startpos_full(), handle_edit_startpos_full(), map_startpos_by_number(), property_page_add_objbinds_from_tile(), and property_page_create_objects().
struct iterator * map_startpos_iter_init | ( | struct map_startpos_iter * | iter | ) |
Create a new start position at the given tile and return it. If a start position already exists there, it is first removed.
Definition at line 1866 of file map.c.
Referenced by create_start_positions(), handle_edit_startpos(), handle_edit_startpos(), map_generate_fair_islands(), sg_load_map_startpos(), and sg_load_map_startpos().
Remove the start position at the given tile. Returns TRUE if the start position was removed.
Definition at line 1899 of file map.c.
Referenced by handle_edit_startpos(), and handle_edit_startpos().
bool map_untrusted_dir_is_valid | ( | enum direction8 | dir | ) |
Returns TRUE iff the given direction is a valid one.
Doesn't trust the input. Can be used to validate a direction from an untrusted source.
Definition at line 1273 of file map.c.
Referenced by unit_order_list_is_sane().
Return the "real" distance for a given vector.
Definition at line 578 of file map.c.
Referenced by generate_map_indices(), get_closest_safe_tile_distance(), map_vector_to_distance(), map_vector_to_sq_distance(), real_distance_to_land(), and real_map_distance().
Return the sq_distance for a given vector.
Definition at line 614 of file map.c.
Referenced by generate_city_map_indices(), is_valid_city_coords(), map_claim_border(), map_generate_fair_islands(), and sq_map_distance().
struct tile * mapstep | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
enum direction8 | dir | ||
) |
Step from the given tile in the given direction. The new tile is returned, or NULL if the direction is invalid or leads off the map.
Definition at line 371 of file map.c.
Referenced by build_tile_data(), dai_diplomat_bribe_nearby(), execute_orders(), fill_terrain_sprite_blending(), mapdeco_add_gotoline(), mapdeco_remove_gotoline(), mapdeco_set_gotoroute(), pf_danger_map_construct_path(), pf_danger_map_create_segment(), pf_fuel_map_construct_path(), pf_fuel_map_create_segment(), pf_normal_map_construct_path(), pixel_border_hexa(), pixel_border_isohexa(), pixel_border_rect(), random_movements(), request_move_unit_direction(), show_unit_orders(), unleash_barbarians(), and upgrade_unit_order_targets().
Return the tile for the given native position.
Definition at line 443 of file map.c.
Referenced by api_find_tile(), center_on_something(), create_island(), fmfill(), gen5rec(), get_random_map_position_from_state(), make_fracture_map(), place_island(), rand_map_pos(), sg_load_map_owner(), sg_load_map_owner(), sg_load_map_startpos(), sg_load_map_startpos(), sg_load_map_worked(), sg_load_map_worked(), sg_load_player_cities(), sg_load_player_cities(), sg_load_player_city(), sg_load_player_city(), sg_load_player_unit(), sg_load_player_unit(), sg_load_player_vision(), sg_load_player_vision(), sg_load_player_vision_city(), sg_load_player_vision_city(), sg_save_map_owner(), sg_save_map_worked(), and sg_save_player_vision().
Twiddle *x and *y to point to the nearest real tile, and ensure that the position is normalized.
Definition at line 995 of file map.c.
Referenced by canvas_pos_to_nearest_tile().
If the position is real, it will be normalized and TRUE will be returned. If the position is unreal, it will be left unchanged and FALSE will be returned.
Note, we need to leave x and y with sane values even in the unreal case. Some callers may for instance call nearest_real_tile() on these values.
Definition at line 979 of file map.c.
Referenced by api_methods_private_tile_for_outward_index(), api_methods_private_tile_next_outward_index(), canvas_pos_to_tile(), fair_map_place_island_team(), is_real_map_pos(), and overview_to_map_pos().
enum direction8 opposite_direction | ( | enum direction8 | dir | ) |
Return direction that is opposite to given one.
Definition at line 1937 of file map.c.
Referenced by api_utilities_opposite_dir(), and do_attack().
enum direction8 rand_direction | ( | void | ) |
Return random direction that is valid in current map.
Definition at line 1929 of file map.c.
Referenced by unit_virtual_create().
Random square anywhere on the map. Only normal positions (for which is_normal_map_pos returns true) will be found.
Definition at line 1088 of file map.c.
Referenced by climate_change(), place_animal(), place_island(), and try_summon_barbarians().
struct tile * rand_map_pos_filtered | ( | const struct civ_map * | nmap, |
void * | data, | ||
bool(*)(const struct tile *ptile, const void *data) | filter | ||
) |
Give a random tile anywhere on the map for which the 'filter' function returns TRUE. Return FALSE if none can be found. The filter may be NULL if any position is okay; if non-NULL it shouldn't have any side effects.
Definition at line 1101 of file map.c.
Referenced by create_start_positions(), and rand_map_pos_characteristic().
Return real distance between two tiles.
Definition at line 630 of file map.c.
Referenced by action_prob_vs_city_full(), action_prob_vs_extras_full(), action_prob_vs_stack_full(), action_prob_vs_tile_full(), action_prob_vs_unit_full(), actres_possible(), assess_danger(), assess_danger_unit(), auto_settler_setup_work(), calculate_want_for_paratrooper(), check_city_migrations_player(), dai_caravan_goto(), dai_hunter_manage(), dai_manage_caravan(), dai_manage_diplomat(), dai_military_bodyguard(), expl_act_not_enabl(), find_closest_city(), find_dispersed_position(), get_caravan_enter_city_trade_bonus(), handle_unit_get_actions(), is_action_possible(), is_tiles_adjacent(), is_valid_start_pos(), nearest_gov_center(), player_distance_to_player(), popup_advanced_terrain_dialog(), settler_evaluate_city_requests(), settler_evaluate_improvements(), trade_base_between_cities(), transfer_city_units(), and try_summon_barbarians().
Are (x1,y1) and (x2,y2) really the same when adjusted? This function might be necessary ALOT of places...
Definition at line 940 of file map.c.
Referenced by adv_could_be_my_zoc(), adv_unit_execute_path(), api_edit_create_unit_full(), are_tiles_in_range(), auto_settler_setup_work(), base_get_direction_for_step(), can_unit_load(), city_exists_within_max_city_map(), city_gold_worth(), dai_auto_settler_run(), dai_caravan_goto(), dai_diplomat_defend(), dai_gothere(), dai_manage_airunit(), dai_manage_barbarian_leader(), dai_manage_diplomat(), dai_military_attack(), dai_military_bodyguard(), dai_military_defend(), dai_unit_attack(), dai_unit_goto_constrained(), dai_unit_move(), execute_orders(), find_something_to_kill(), find_visible_unit(), goto_is_sane(), handle_unit_packet_common(), immediate_destination(), is_move_cardinal(), make_path_orders(), manage_auto_explorer(), maybe_activate_keyboardless_goto(), player_restore_units(), request_unit_load(), search_homecity_for_caravan(), send_connect_route(), send_goto_route(), and unit_transport_unload().
Return squared distance between two tiles.
Definition at line 641 of file map.c.
Referenced by api_methods_tile_sq_distance(), goto_dialog::fill_tab(), find_nearest_unit(), get_nearest_city(), handle_city_short_info(), handle_tile_info(), player_in_city_map(), sg_load_player_city(), sg_load_player_city(), team_placement_continent(), tile_border_strength(), and wakeup_neighbor_sentries().
bool startpos_allow | ( | struct startpos * | psp, |
struct nation_type * | pnation | ||
) |
Allow the nation to start at the start position. NB: in "excluding" mode, this remove the nation from the excluded list.
Definition at line 1643 of file map.c.
Referenced by map_generate_fair_islands(), sg_load_map_startpos(), and sg_load_map_startpos().
Returns TRUE if any nation can start here.
Definition at line 1696 of file map.c.
Referenced by generate_players(), init_new_game(), map_generate_fair_islands(), sg_save_map_startpos(), and startpos_iter_init().
bool startpos_disallow | ( | struct startpos * | psp, |
struct nation_type * | pnation | ||
) |
Disallow the nation to start at the start position. NB: in "excluding" mode, this add the nation to the excluded list.
Definition at line 1660 of file map.c.
Referenced by sg_load_map_startpos(), and sg_load_map_startpos().
Returns TRUE if the nations returned by startpos_raw_nations() are actually excluded from the nations allowed to start at this position.
FIXME: This function exposes the internal implementation and should be removed when no longer needed by the property editor system.
Definition at line 1753 of file map.c.
Referenced by objbind_get_value_from_object(), and sg_save_map_startpos().
Implementation of iterator 'sizeof' function.
struct startpos_iter can be either a 'struct nation_hash_iter', a 'struct nation_iter' or 'struct startpos_iter'.
Returns TRUE if the given nation can start here.
Definition at line 1685 of file map.c.
Referenced by generate_players(), init_new_game(), and update_nations_with_startpos().
Returns the unique ID number for this start position. This is just the tile index of the tile where this start position is located.
Definition at line 1633 of file map.c.
Referenced by handle_edit_startpos_full(), objtype_get_id_from_object(), and startpos_pack().
Fills the packet with all of the information at this start position. Returns TRUE if the packet can be sent.
Definition at line 1706 of file map.c.
Referenced by edithand_send_initial_packets(), and objbind_pack_current_values().
Return a the nations hash, used for the property editor.
FIXME: This function exposes the internal implementation and should be removed when no longer needed by the property editor system.
Definition at line 1765 of file map.c.
Referenced by objbind_get_value_from_object(), and sg_save_map_startpos().
Returns the tile where this start position is located.
Definition at line 1676 of file map.c.
Referenced by edithand_send_initial_packets(), init_new_game(), is_valid_start_pos(), objbind_get_value_from_object(), and sg_save_map_startpos().
Fills the start position with the nation information in the packet. Returns TRUE if the start position was changed.
Definition at line 1726 of file map.c.
Referenced by handle_edit_startpos_full(), and handle_edit_startpos_full().
bool terrain_surroundings_allow_change | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
const struct terrain * | pterrain | ||
) |
Returns FALSE if a terrain change to 'pterrain' would be prevented by not having enough similar terrain surrounding ptile.
Definition at line 742 of file map.c.
Referenced by actres_possible(), adv_calc_transform(), and climate_change().
int tile_move_cost_ptrs | ( | const struct civ_map * | nmap, |
const struct unit * | punit, | ||
const struct unit_type * | punittype, | ||
const struct player * | pplayer, | ||
const struct tile * | t1, | ||
const struct tile * | t2 | ||
) |
The basic cost to move punit from tile t1 to tile t2. That is, tile_move_cost(), with pre-calculated tile pointers; the tiles are assumed to be adjacent, and the (x,y) values are used only to get the river bonus correct.
May also be used with punit == NULL, in which case punit tests are not done (for unit-independent results).
Definition at line 780 of file map.c.
Referenced by map_move_cost(), and map_move_cost_unit().
Definition at line 37 of file map.h.
Referenced by island_river_mouth_suitability(), and island_river_suitability().
Definition at line 38 of file map.h.
Referenced by island_river_mouth_suitability(), and island_river_suitability().
Definition at line 39 of file map.h.
Referenced by island_river_mouth_suitability(), and island_river_suitability().
Definition at line 40 of file map.h.
Referenced by island_river_mouth_suitability(), and island_river_suitability().
Definition at line 86 of file map.c.
Referenced by draw_segment(), and scroll_mapview().
Definition at line 87 of file map.c.
Referenced by draw_segment(), and scroll_mapview().
|
extern |
Definition at line 69 of file map.c.
Referenced by can_channel_land(), can_freeze_terrain(), can_reclaim_ocean(), can_thaw_terrain(), handle_player_place_infra(), handle_ruleset_terrain_control(), helptext_extra(), helptext_unit(), is_valid_start_pos(), load_ruleset_terrain(), real_menus_init(), real_menus_update(), regenerate_lakes(), save_terrain_ruleset(), send_ruleset_terrain(), settler_evaluate_improvements(), mr_menu::setup_menus(), texai_tile_worker_task_select(), and tile_move_cost_ptrs().