Freeciv-3.2
|
#include "bitvector.h"
#include "log.h"
#include "support.h"
#include "fc_interface.h"
#include "game.h"
#include "map.h"
#include "movement.h"
#include "road.h"
#include "unit.h"
#include "unitlist.h"
#include "tile.h"
Go to the source code of this file.
Variables | |
static bv_extras | empty_extras |
|
static |
Recursively add all extra dependencies to add given extra.
Definition at line 513 of file tile.c.
Referenced by add_recursive_extras(), and tile_extra_apply().
Recursively remove all extras depending on given extra.
Definition at line 541 of file tile.c.
Referenced by rm_recursive_extras(), and tile_extra_rm_apply().
int tile_activity_time | ( | enum unit_activity | activity, |
const struct tile * | ptile, | ||
const struct extra_type * | tgt | ||
) |
Time to complete the given activity on the given tile.
See also action_get_act_time()
Definition at line 418 of file tile.c.
Referenced by actres_get_act_time(), calc_activity(), get_turns_for_activity_at(), total_activity_done(), and update_unit_activity().
Adds extra to tile
Definition at line 955 of file tile.c.
Referenced by adv_calc_extra(), check_recursive_road_connect(), create_extra(), do_nuke_tile(), edit_buffer_copy(), fair_map_make_huts(), fill_island_rivers(), get_tile_value(), make_huts(), make_rivers(), ocean_to_land_fix_rivers(), place_pollution(), tile_create_extra(), tile_set_resource(), and upgrade_city_extras().
bool tile_apply_activity | ( | struct tile * | ptile, |
Activity_type_id | act, | ||
struct extra_type * | tgt | ||
) |
Apply an activity (Activity_type_id, e.g., ACTIVITY_TRANSFORM) to a tile. Return false if there was a error or if the activity is not implemented by this function.
Definition at line 681 of file tile.c.
Referenced by get_tile_change_menu_text(), get_tile_change_menu_text(), get_tile_value(), and update_unit_activity().
Change the terrain to the given type. This does secondary tile updates to the tile (as will happen when mining/irrigation/transforming changes the tile's terrain).
Definition at line 496 of file tile.c.
Referenced by adv_calc_cultivate(), adv_calc_plant(), adv_calc_transform(), api_edit_change_terrain(), check_terrain_change(), climate_change(), edit_tile_terrain_handling(), regenerate_lakes(), tile_cultivate(), tile_plant(), and tile_transform().
Return the city on this tile (or NULL), checking for city center.
Definition at line 83 of file tile.c.
Referenced by action_maybe_possible_actor_unit(), action_prob_self_full(), 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(), action_success_target_pay_mp(), action_tgt_city(), actres_possible(), trade_generator::add_tile(), adv_calc_cultivate(), adv_calc_plant(), adv_calc_transform(), adv_danger_at(), ap_dipl_battle_win(), api_edit_change_terrain(), api_edit_create_unit_full(), api_edit_tile_hide(), api_edit_unit_teleport(), api_effects_unit_bonus(), api_methods_enemy_tile(), api_methods_tile_city(), auto_settlers_speculate_can_act_at(), blocked_find_target_city(), build_landarea_map(), butt_down_mapcanvas(), button_up_on_map(), calculate_city_clusters(), calculate_want_for_paratrooper(), can_build_extra_base(), can_create_unit_at_tile(), can_exist_at_tile(), can_extra_be_removed(), can_player_attack_tile(), can_player_see_hypotetic_units_at(), can_player_see_unit_at(), can_step_taken_wrt_to_zoc(), can_unit_change_homecity(), can_unit_survive_at_tile(), can_unit_unload(), caravan_search_from(), casus_belli_range_for(), check_city_migrations_player(), city_build(), city_desirability(), city_dialog_redraw_map(), city_exists_within_max_city_map(), city_landlocked_sell_coastal_improvements(), citymindist_prevents_city_on_tile(), cityresult_fill(), client_plr_tile_city_id_get(), client_remove_unit(), climate_change(), clipboard_copy_production(), control_mouse_cursor(), could_unit_load(), dai_airlift(), dai_auto_settler_run(), dai_consider_tile_dangerous(), dai_data_phase_begin(), dai_diplomat_bribe_nearby(), dai_diplomat_defend(), dai_do_build_city(), dai_effect_value(), dai_find_boat_for_unit(), dai_find_strategic_airbase(), dai_gothere_bodyguard(), dai_hunter_manage(), dai_hunter_try_launch(), dai_manage_airunit(), dai_manage_caravan(), dai_manage_diplomat(), dai_manage_hitpoint_recovery(), dai_manage_military(), dai_manage_paratrooper(), dai_military_defend(), dai_rampage_want(), dai_should_we_air_attack_tile(), dai_unit_attack(), dai_unit_new_task(), dai_wonder_city_distance(), debug_command(), defense_multiplication(), define_tiles_within_rectangle(), diplomat_bribe(), diplomat_infiltrate_tile(), diplomat_success_vs_defender(), disband_all_units(), do_airline(), do_attack(), do_capture_units(), do_disband_alternative(), do_heal_unit(), do_map_click(), do_move_unit(), do_nuke_tile(), do_paradrop(), do_unit_paradrop_to(), do_unit_teleport_to(), draw_calculated_trade_routes(), edit_buffer_copy(), edit_tile_terrain_handling(), editor_apply_tool(), editor_grab_applied_player(), editor_grab_tool(), execute_orders(), expl_act_not_enabl(), find_a_good_partisan_spot(), find_beachhead(), find_best_city_placement(), find_best_tile_to_paradrop_to(), find_city_or_settler_near_tile(), find_city_to_diplomat(), find_nearest_safe_city(), find_something_to_kill(), find_visible_unit(), get_airlift_text(), get_modified_firepower(), get_nearest_city(), get_tile_bonus(), get_total_attack_power(), get_unit_bonus(), get_unit_vs_tile_bonus(), get_unittype_bonus(), give_distorted_map(), gui_refresh_unit_city_dialogs(), handle_edit_city_create(), handle_edit_player_vision(), handle_edit_unit_create(), handle_unit_packet_common(), handle_unit_type_upgrade(), inputline_make_chat_link(), notify_goto::inspect_city(), invasion_funct(), is_action_enabled_unit_on_city_full(), is_action_enabled_unit_on_extras_full(), is_action_enabled_unit_on_self_full(), is_action_enabled_unit_on_stack_full(), is_action_enabled_unit_on_tile_full(), is_action_enabled_unit_on_unit_full(), is_border_source(), is_building_req_active(), is_buildingflag_req_active(), is_city_channel_tile(), is_city_in_tile(), is_friendly_city_near(), is_native_tile_to_extra(), is_req_knowable(), is_stack_vulnerable(), is_unit_reachable_at(), kill_something_with(), kill_unit(), look_for_charge(), main_key_down_handler(), main_key_down_handler(), chatwdg::make_link(), map_change_seen(), map_claim_border(), map_show_tile(), mapimg_client_tile_city(), mapimg_server_tile_city(), maybe_make_contact(), mr_menu::menus_sensitive(), meswin_add(), meswin_popup_city(), middle_present_unit_release(), need_war_player_hlp(), notify_goto::notify_goto(), notify_goto_dialog_goto_callback(), notify_goto_response(), occupy_move(), overview_tile_color(), paste_tile(), pf_danger_map_iterate(), pf_danger_node_init(), pf_fuel_map_iterate(), pf_fuel_node_init(), pf_get_move_scope(), pf_normal_map_new(), pf_normal_node_init(), place_animal(), player_in_city_map(), player_may_explore(), popup_advanced_terrain_dialog(), popup_info_text(), popup_notify_goto_dialog(), present_unit_activate_close_callback(), present_unit_activate_close_callback(), present_unit_callback(), present_unit_callback(), present_unit_middle_callback(), process_attacker_want(), property_page_add_objbinds_from_tile(), put_one_tile(), qtg_refresh_unit_city_dialogs(), rally_set_tile(), real_menus_update(), reality_check_city(), redraw_unit_info_label(), refresh_unit_city_dialogs(), remove_city(), request_unit_build_city(), request_unit_caravan_action(), request_unit_change_homecity(), request_unit_upgrade(), right_butt_down_mapcanvas(), sdi_try_defend(), send_city_info_at_tile(), server_remove_unit_full(), sg_load_player_city(), sg_load_player_city(), sg_load_player_vision(), sg_load_player_vision(), sg_order_to_action(), sg_special_set_bv(), sg_special_set_dbv(), map_view::shortcut_pressed(), show_city_descriptions(), terrain_changed(), test_unit_can_airlift_to(), throw_units_from_illegal_cities(), tile_allied_city(), tile_border_source_radius_sq(), tile_border_source_strength(), tile_enemy_city(), tile_move_cost_ptrs(), tile_non_allied_city(), tile_non_attack_city(), tile_set_owner(), tile_set_terrain(), tile_virtual_destroy(), toggle_tile_hilite(), transfer_city_units(), transfer_unit(), unit_being_aggressive(), unit_bombard(), unit_can_add_or_build_city(), unit_can_est_trade_route_here(), unit_can_help_build_wonder_here(), unit_change_homecity_handling(), unit_do_disband_trad(), unit_foodbox_cost(), unit_gain_hitpoints(), unit_move(), unit_move_consequences(), unit_move_to_tile_test(), unit_pays_mp_for_action(), unit_perform_action(), unit_select_dialog_popup(), unit_survive_autoattack(), unit_teleport_to_tile_test(), unit_upgrade_test(), unit_actions::update_actions(), update_source_label(), usdlg_check_unit_location(), utype_pays_mp_for_action_estimate(), and wakeup_neighbor_sentries().
Cultivate (ACTIVITY_CULTIVATE) the tile. This usually changes the tile's terrain type.
Definition at line 667 of file tile.c.
Referenced by tile_apply_activity().
Destroy extra from tile.
Definition at line 481 of file tile.c.
Referenced by rm_recursive_extras(), tile_change_terrain(), and tile_extra_apply().
bool tile_extra_apply | ( | struct tile * | ptile, |
struct extra_type * | tgt | ||
) |
Add extra and adjust other extras accordingly.
If not all necessary adjustments can be done, returns FALSE. When problem occurs, changes to tile extras are not reverted. Pass virtual tile to the function if you are not sure it will success and don't want extras adjusted at all in case of failure.
Definition at line 575 of file tile.c.
Referenced by edit_tile_extra_handling(), end_turn(), tile_irrigate(), and tile_mine().
bool tile_extra_rm_apply | ( | struct tile * | ptile, |
struct extra_type * | tgt | ||
) |
Remove extra and adjust other extras accordingly.
If not all necessary adjustments can be done, returns FALSE. When problem occurs, changes to tile extras are not reverted. Pass virtual tile to the function if you are not sure it will success and don't want extras adjusted at all in case of failure.
Definition at line 601 of file tile.c.
Referenced by api_edit_remove_extra(), edit_tile_extra_handling(), end_turn(), place_starting_unit(), remove_city(), remove_tiny_islands(), and try_summon_barbarians().
Calculate defense bonus given for unit class by extras.
Definition at line 242 of file tile.c.
Referenced by chance_killed_at(), and tile_extras_defense_bonus().
Calculate defense bonus given for unit type by bases and roads
Definition at line 233 of file tile.c.
Referenced by adv_danger_at(), dai_consider_tile_dangerous(), defense_multiplication(), and kill_unit().
Returns a bit vector of the extras present at NULL tile.
Definition at line 166 of file tile.c.
Referenced by tile_extras_safe().
const char * tile_get_info_text | ( | const struct tile * | ptile, |
bool | include_nuisances, | ||
int | linebreaks | ||
) |
Return a (static) string with tile name describing terrain and extras of some categories. If include_nuisances is set, pollution and nuclear fallout will be ignored.
Examples: "Hills" "Hills (Coals)" "Hills (Coals) [Pollution]"
Definition at line 771 of file tile.c.
Referenced by dai_auto_settler_run(), get_tile_change_menu_text(), get_tile_change_menu_text(), get_unit_info_label_text2(), popup_info_text(), and popup_terrain_info().
Return a known_type enumeration value for the tile.
Note that the client only has known data about its own player.
Definition at line 392 of file tile.c.
Referenced by api_methods_tile_known(), api_methods_tile_seen(), base_city_can_work_tile(), can_player_see_tile(), can_player_see_unit_at(), client_tile_get_known(), editor_apply_tool(), editor_grab_applied_player(), editor_grab_tool(), get_closest_safe_tile_distance(), get_connect_irrig(), get_connect_road(), goto_tile_state(), is_plr_zoc_client(), is_possible_base_fuel(), mapimg_client_tile_known(), mapimg_server_tile_known(), mapimg_server_tile_owner(), mapimg_server_tile_unit(), pf_danger_node_init(), pf_fuel_node_init(), pf_normal_node_init(), plr_knows_tile(), test_unit_can_airlift_to(), and tile_is_seen().
Check if tile contains base providing effect for unit.
Definition at line 215 of file tile.c.
Referenced by actres_possible(), dai_unit_attack(), maybe_claim_base(), sg_load_player_units(), and unit_move().
Returns TRUE if the given tile has a extra conflicting with the given one.
Definition at line 901 of file tile.c.
Referenced by upgrade_city_extras().
Check if tile contains extra providing effect
Definition at line 886 of file tile.c.
Referenced by is_extraflag_req_active(), and is_stack_vulnerable().
Check if tile contains base native for unit.
Definition at line 324 of file tile.c.
Referenced by amphibious_move_scope(), can_unit_unload(), could_unit_load(), is_possible_base_fuel(), is_unit_reachable_at(), is_unitstate_req_active(), pf_attack_possible(), pf_danger_map_iterate(), pf_fuel_map_iterate(), pf_get_move_scope(), pf_normal_map_new(), and unit_gain_hitpoints().
int tile_has_not_aggressive_extra_for_unit | ( | const struct tile * | ptile, |
const struct unit_type * | punittype | ||
) |
Check if tile contains extra making unit not aggressive.
Maximum distance to nearest friendly city to make extra effective returned. Negative distance means that there's no such extra.
Definition at line 196 of file tile.c.
Referenced by unit_being_aggressive(), and unit_move_consequences().
Check if tile contains refuel extra native for unit class
Definition at line 309 of file tile.c.
Referenced by can_unit_survive_at_tile().
Tile has any river type
Definition at line 852 of file tile.c.
Referenced by count_river_near_tile(), fill_island_rivers(), is_terrain_ecologically_wet(), and make_rivers().
Returns TRUE if the given tile has a road of given type on it.
Definition at line 844 of file tile.c.
Referenced by adv_settlers_road_bonus(), can_unit_do_connect(), count_road_near_tile(), get_connect_road(), popup_terrain_info(), and road_can_be_built().
Check if tile contains road providing effect
Definition at line 868 of file tile.c.
Referenced by is_roadflag_req_active().
Returns TRUE if the given tile has an extra of the given type on it.
Definition at line 917 of file tile.c.
Referenced by popup_info_text(), tile_get_info_text(), and tile_info_pollution().
Returns key that should be used when storing tile to hash or when retrieving it from there.
Definition at line 1083 of file tile.c.
Referenced by map_startpos_get(), map_startpos_new(), and map_startpos_remove().
|
static |
Add one entry about pollution situation to buffer. Return if there has been any pollution (even prior calling this)
Definition at line 736 of file tile.c.
Referenced by tile_get_info_text().
Build irrigation on the tile. This may change the extras of the tile or change the terrain type itself.
Definition at line 615 of file tile.c.
Referenced by tile_apply_activity().
Is there a placing ongoing?
Definition at line 1129 of file tile.c.
Referenced by can_unit_do_activity_targeted_at().
Returns TRUE iff the target_tile is seen by pow_player.
Definition at line 407 of file tile.c.
Referenced by action_prob_vs_stack_full(), handle_unit_get_actions(), is_req_knowable(), is_tile_seen_adj(), is_tile_seen_cadj(), is_tile_seen_city(), and player_can_see_city_externals().
Check if the given tile is on a map.
Definition at line 1065 of file tile.c.
Referenced by destroy_extra(), and tile_set_terrain().
Build a mine on the tile. This may change the extras of the tile or change the terrain type itself.
Definition at line 628 of file tile.c.
Referenced by tile_apply_activity().
Plant (ACTIVITY_PLANT) the tile. This usually changes the tile's terrain type.
Definition at line 654 of file tile.c.
Referenced by tile_apply_activity().
Removes extra from tile if such exist
Definition at line 965 of file tile.c.
Referenced by adv_calc_extra(), adv_calc_rmextra(), can_extra_be_removed(), destroy_extra(), get_tile_infrastructure_set(), tile_destroy_extra(), and tile_set_resource().
Calculate output bonus given by roads
Definition at line 291 of file tile.c.
Referenced by city_tile_output().
Calculate output increment given by roads
Definition at line 271 of file tile.c.
Referenced by city_tile_output().
void tile_set_continent | ( | struct tile * | ptile, |
Continent_id | val | ||
) |
Set the continent ID of the tile. See tile_continent.
Definition at line 382 of file tile.c.
Referenced by assign_continent_flood(), assign_continent_numbers(), initworld(), make_polar_land(), map_generate_fair_islands(), place_island(), and remove_tiny_islands().
Sets label for tile. Returns whether label changed.
Definition at line 1095 of file tile.c.
Referenced by api_edit_tile_set_label(), handle_edit_tile(), handle_tile_info(), sg_load_map_tiles(), and sg_load_map_tiles().
Set the owner of a tile (may be NULL).
Definition at line 69 of file tile.c.
Referenced by cityresult_fill(), create_city(), handle_tile_info(), initworld(), map_claim_border_ownership(), map_generate_fair_islands(), and remove_player_from_maps().
void tile_set_resource | ( | struct tile * | ptile, |
struct extra_type * | presource | ||
) |
Set the given resource at the specified tile.
Definition at line 349 of file tile.c.
Referenced by add_resources(), edit_buffer_copy(), edit_tile_extra_handling(), fair_map_make_huts(), handle_tile_info(), map_generate_fair_islands(), sg_load_map_tiles_extras(), and sg_load_map_tiles_resources().
Set the given terrain at the specified tile.
Definition at line 124 of file tile.c.
Referenced by edit_buffer_copy(), fair_map_make_huts(), fill_island(), handle_tile_info(), initworld(), make_fracture_relief(), make_land(), make_plain(), make_polar(), make_polar_land(), make_relief(), make_rivers(), map_generate_fair_islands(), place_island(), place_terrain(), remove_tiny_islands(), smooth_water_depth(), and tile_change_terrain().
Set the city/worker on the tile (may be NULL).
Definition at line 106 of file tile.c.
Referenced by city_map_update_empty(), city_map_update_tile_direct(), city_map_update_worker(), city_packet_common(), create_city(), edit_buffer_copy(), game_remove_city(), handle_tile_info(), remove_city(), result_defense_bonus(), sg_load_player_city(), sg_load_player_city(), texai_city_destruction_recv(), texai_city_info_recv(), and tile_virtual_destroy().
Transform (ACTIVITY_TRANSFORM) the tile. This usually changes the tile's terrain type.
Definition at line 641 of file tile.c.
Referenced by tile_apply_activity().
Frees all memory used by the virtual tile, including freeing virtual units in the tile's unit list and the virtual city on this tile if one exists.
NB: Do not call this on real tiles!
Definition at line 1033 of file tile.c.
Referenced by adv_calc_cultivate(), adv_calc_extra(), adv_calc_plant(), adv_calc_rmextra(), adv_calc_transform(), can_extra_be_removed(), can_unit_do_connect(), check_native_area(), goto_dialog::close_dlg(), edit_buffer_clear(), edit_buffer_copy(), edit_buffer_free(), fair_map_make_huts(), get_activity_time(), get_tile_change_menu_text(), get_tile_change_menu_text(), get_tile_infrastructure_set(), get_tile_value(), goto_dialog::init(), result_defense_bonus(), sg_special_set_bv(), and sg_special_set_dbv().
Returns a virtual tile. If ptile is given, the properties of this tile are copied, else it is completely blank (except for the unit list vtile->units, which is created for you). Be sure to call tile_virtual_free on it when it is no longer needed.
Definition at line 981 of file tile.c.
Referenced by adv_calc_cultivate(), adv_calc_extra(), adv_calc_plant(), adv_calc_rmextra(), adv_calc_transform(), can_extra_be_removed(), can_unit_do_connect(), check_native_area(), edit_buffer_copy(), fair_map_make_huts(), get_activity_time(), get_tile_change_menu_text(), get_tile_change_menu_text(), get_tile_infrastructure_set(), get_tile_value(), goto_dialog::init(), result_defense_bonus(), sg_special_set_bv(), and sg_special_set_dbv().
|
static |
Definition at line 34 of file tile.c.
Referenced by tile_extras_null().