Freeciv-3.1
|
#include "bitvector.h"
#include "shared.h"
#include "fc_types.h"
#include "name_translation.h"
#include "unittype.h"
#include "specenum_gen.h"
Go to the source code of this file.
Data Structures | |
struct | resource_type |
struct | terrain |
Macros | |
#define | RESOURCE_NULL_IDENTIFIER '\0' |
#define | RESOURCE_NONE_IDENTIFIER ' ' |
#define | T_NONE (NULL) /* A special flag meaning no terrain type. */ |
#define | T_UNKNOWN (NULL) /* An unknown terrain. */ |
#define | T_FIRST 0 |
#define | MAX_NUM_TERRAINS (96) |
#define | MAX_RESOURCE_TYPES (MAX_NUM_TERRAINS / 2) |
#define | SPECENUM_NAME terrain_class |
#define | SPECENUM_VALUE0 TC_LAND |
#define | SPECENUM_VALUE0NAME N_("Land") |
#define | SPECENUM_VALUE1 TC_OCEAN |
#define | SPECENUM_VALUE1NAME N_("Oceanic") |
#define | SPECENUM_COUNT TC_COUNT |
#define | SPECENUM_NAME terrain_alteration |
#define | SPECENUM_VALUE0 TA_CAN_IRRIGATE |
#define | SPECENUM_VALUE0NAME N_("CanIrrigate") |
#define | SPECENUM_VALUE1 TA_CAN_MINE |
#define | SPECENUM_VALUE1NAME N_("CanMine") |
#define | SPECENUM_VALUE2 TA_CAN_ROAD |
#define | SPECENUM_VALUE2NAME N_("CanRoad") |
#define | SPECENUM_COUNT TA_COUNT |
#define | SPECENUM_NAME terrain_flag_id |
#define | SPECENUM_VALUE0 TER_NO_BARBS |
#define | SPECENUM_VALUE0NAME N_("NoBarbs") |
#define | SPECENUM_VALUE1 TER_NO_CITIES |
#define | SPECENUM_VALUE1NAME N_("NoCities") |
#define | SPECENUM_VALUE2 TER_STARTER |
#define | SPECENUM_VALUE2NAME N_("Starter") |
#define | SPECENUM_VALUE3 TER_CAN_HAVE_RIVER |
#define | SPECENUM_VALUE3NAME N_("CanHaveRiver") |
#define | SPECENUM_VALUE4 TER_UNSAFE_COAST |
#define | SPECENUM_VALUE4NAME N_("UnsafeCoast") |
#define | SPECENUM_VALUE5 TER_FRESHWATER |
#define | SPECENUM_VALUE5NAME N_("FreshWater") |
#define | SPECENUM_VALUE6 TER_NOT_GENERATED |
#define | SPECENUM_VALUE6NAME N_("NotGenerated") |
#define | SPECENUM_VALUE7 TER_NO_ZOC |
#define | SPECENUM_VALUE7NAME N_("NoZoc") |
#define | SPECENUM_VALUE8 TER_FROZEN |
#define | SPECENUM_VALUE8NAME N_("Frozen") |
#define | SPECENUM_VALUE9 TER_USER_1 |
#define | SPECENUM_VALUE10 TER_USER_2 |
#define | SPECENUM_VALUE11 TER_USER_3 |
#define | SPECENUM_VALUE12 TER_USER_4 |
#define | SPECENUM_VALUE13 TER_USER_5 |
#define | SPECENUM_VALUE14 TER_USER_6 |
#define | SPECENUM_VALUE15 TER_USER_7 |
#define | SPECENUM_VALUE16 TER_USER_8 |
#define | SPECENUM_VALUE17 TER_USER_9 |
#define | SPECENUM_VALUE18 TER_USER_LAST |
#define | SPECENUM_NAMEOVERRIDE |
#define | SPECENUM_BITVECTOR bv_terrain_flags |
#define | MAX_NUM_USER_TER_FLAGS (TER_USER_LAST - TER_USER_1 + 1) |
#define | SPECENUM_NAME mapgen_terrain_property |
#define | SPECENUM_VALUE0 MG_MOUNTAINOUS |
#define | SPECENUM_VALUE0NAME "mountainous" |
#define | SPECENUM_VALUE1 MG_GREEN |
#define | SPECENUM_VALUE1NAME "green" |
#define | SPECENUM_VALUE2 MG_FOLIAGE |
#define | SPECENUM_VALUE2NAME "foliage" |
#define | SPECENUM_VALUE3 MG_TROPICAL |
#define | SPECENUM_VALUE3NAME "tropical" |
#define | SPECENUM_VALUE4 MG_TEMPERATE |
#define | SPECENUM_VALUE4NAME "temperate" |
#define | SPECENUM_VALUE5 MG_COLD |
#define | SPECENUM_VALUE5NAME "cold" |
#define | SPECENUM_VALUE6 MG_FROZEN |
#define | SPECENUM_VALUE6NAME "frozen" |
#define | SPECENUM_VALUE7 MG_WET |
#define | SPECENUM_VALUE7NAME "wet" |
#define | SPECENUM_VALUE8 MG_DRY |
#define | SPECENUM_VALUE8NAME "dry" |
#define | SPECENUM_VALUE9 MG_OCEAN_DEPTH |
#define | SPECENUM_VALUE9NAME "ocean_depth" |
#define | SPECENUM_COUNT MG_COUNT |
#define | TERRAIN_UNKNOWN_IDENTIFIER 'u' |
#define | TERRAIN_OCEAN_DEPTH_MINIMUM (1) |
#define | TERRAIN_OCEAN_DEPTH_MAXIMUM (100) |
#define | terrain_has_flag(terr, flag) BV_ISSET((terr)->flags, flag) |
#define | is_ocean(pterrain) |
#define | is_ocean_tile(ptile) is_ocean(tile_terrain(ptile)) |
#define | terrain_type_iterate(_p) |
#define | terrain_type_iterate_end |
#define | terrain_re_active_iterate(_p) |
#define | terrain_re_active_iterate_end |
Enumerations | |
enum | special_river_move { RMV_NORMAL = 0 , RMV_FAST_STRICT = 1 , RMV_FAST_RELAXED = 2 , RMV_FAST_ALWAYS = 3 } |
Functions | |
Terrain_type_id | terrain_count (void) |
Terrain_type_id | terrain_index (const struct terrain *pterrain) |
Terrain_type_id | terrain_number (const struct terrain *pterrain) |
struct terrain * | terrain_by_number (const Terrain_type_id type) |
struct terrain * | terrain_by_identifier (const char identifier) |
struct terrain * | terrain_by_rule_name (const char *name) |
struct terrain * | terrain_by_translated_name (const char *name) |
struct terrain * | rand_terrain_by_flag (enum terrain_flag_id flag) |
char | terrain_identifier (const struct terrain *pterrain) |
const char * | terrain_rule_name (const struct terrain *pterrain) |
const char * | terrain_name_translation (const struct terrain *pterrain) |
bool | is_terrain_flag_card_near (const struct civ_map *nmap, const struct tile *ptile, enum terrain_flag_id flag) |
bool | is_terrain_flag_near_tile (const struct civ_map *nmap, const struct tile *ptile, enum terrain_flag_id flag) |
int | count_terrain_flag_near_tile (const struct civ_map *nmap, const struct tile *ptile, bool cardinal_only, bool percentage, enum terrain_flag_id flag) |
void | user_terrain_flags_init (void) |
void | user_terrain_flags_free (void) |
void | set_user_terrain_flag_name (enum terrain_flag_id id, const char *name, const char *helptxt) |
const char * | terrain_flag_helptxt (enum terrain_flag_id id) |
bool | terrain_has_resource (const struct terrain *pterrain, const struct extra_type *presource) |
bool | is_terrain_card_near (const struct civ_map *nmap, const struct tile *ptile, const struct terrain *pterrain, bool check_self) |
bool | is_terrain_near_tile (const struct civ_map *nmap, const struct tile *ptile, const struct terrain *pterrain, bool check_self) |
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_resource_card_near (const struct civ_map *nmap, const struct tile *ptile, const struct extra_type *pres, bool check_self) |
bool | is_resource_near_tile (const struct civ_map *nmap, const struct tile *ptile, const struct extra_type *pres, bool check_self) |
struct resource_type * | resource_type_init (struct extra_type *pextra) |
void | resource_types_free (void) |
struct extra_type * | resource_extra_get (const struct resource_type *presource) |
const char * | get_infrastructure_text (bv_extras extras) |
struct extra_type * | get_preferred_pillage (bv_extras extras) |
int | terrain_extra_build_time (const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt) |
int | terrain_extra_removal_time (const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt) |
const char * | terrain_class_name_translation (enum terrain_class tclass) |
enum terrain_class | terrain_type_terrain_class (const struct terrain *pterrain) |
bool | is_terrain_class_card_near (const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass) |
bool | is_terrain_class_near_tile (const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass) |
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 | terrain_can_support_alteration (const struct terrain *pterrain, enum terrain_alteration talter) |
void | terrains_init (void) |
void | terrains_free (void) |
struct terrain * | terrain_array_first (void) |
const struct terrain * | terrain_array_last (void) |
#define is_ocean | ( | pterrain | ) |
#define is_ocean_tile | ( | ptile | ) | is_ocean(tile_terrain(ptile)) |
#define MAX_NUM_USER_TER_FLAGS (TER_USER_LAST - TER_USER_1 + 1) |
#define MAX_RESOURCE_TYPES (MAX_NUM_TERRAINS / 2) |
#define SPECENUM_NAME terrain_class |
#define SPECENUM_NAME terrain_alteration |
#define SPECENUM_NAME terrain_flag_id |
#define SPECENUM_NAME mapgen_terrain_property |
#define T_NONE (NULL) /* A special flag meaning no terrain type. */ |
#define terrain_has_flag | ( | terr, | |
flag | |||
) | BV_ISSET((terr)->flags, flag) |
#define terrain_re_active_iterate | ( | _p | ) |
#define terrain_re_active_iterate_end |
#define terrain_type_iterate | ( | _p | ) |
enum special_river_move |
int count_terrain_class_near_tile | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
bool | cardinal_only, | ||
bool | percentage, | ||
enum terrain_class | tclass | ||
) |
Return the number of adjacent tiles that have given terrain class (not including ptile itself).
Definition at line 621 of file terrain.c.
Referenced by can_channel_land(), can_reclaim_ocean(), create_tmap(), island_river_mouth_suitability(), island_river_suitability(), make_fracture_relief(), make_river(), make_rivers(), and river_test_adjacent_ocean().
int count_terrain_flag_near_tile | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
bool | cardinal_only, | ||
bool | percentage, | ||
enum terrain_flag_id | flag | ||
) |
Return the number of adjacent tiles that have terrain with the given flag (not including ptile itself).
Definition at line 466 of file terrain.c.
Referenced by can_freeze_terrain(), and can_thaw_terrain().
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 | ||
) |
Return the number of adjacent tiles that have the given terrain property.
Definition at line 357 of file terrain.c.
Referenced by make_rivers().
const char * get_infrastructure_text | ( | bv_extras | extras | ) |
Return a (static) string with extra(s) name(s): eg: "Mine" eg: "Road/Farmland" This only includes "infrastructure", i.e., man-made extras.
Definition at line 496 of file terrain.c.
Referenced by get_unit_info_label_text2(), popup_info_text(), and popup_terrain_info().
struct extra_type * get_preferred_pillage | ( | bv_extras | extras | ) |
Returns the highest-priority (best) extra to be pillaged from the terrain set. May return NULL if nothing is available.
Definition at line 538 of file terrain.c.
Referenced by is_action_possible(), popup_pillage_dialog(), request_unit_pillage(), and unit_assign_specific_activity_target().
bool is_resource_card_near | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
const struct extra_type * | pres, | ||
bool | check_self | ||
) |
bool is_resource_near_tile | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
const struct extra_type * | pres, | ||
bool | check_self | ||
) |
bool is_terrain_card_near | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
const struct terrain * | pterrain, | ||
bool | check_self | ||
) |
Returns TRUE iff any cardinally adjacent tile contains the given terrain.
Definition at line 315 of file terrain.c.
Referenced by is_terrain_req_active().
bool is_terrain_class_card_near | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
enum terrain_class | tclass | ||
) |
Is there terrain of the given class cardinally near tile? (Does not check ptile itself.)
Definition at line 579 of file terrain.c.
Referenced by fill_island(), and is_terrainclass_req_active().
bool is_terrain_class_near_tile | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
enum terrain_class | tclass | ||
) |
Is there terrain of the given class near tile? (Does not check ptile itself.)
Definition at line 600 of file terrain.c.
Referenced by building_advisor(), city_select_coastal_callback(), city_select_coastal_callback(), contemplate_new_city(), dai_effect_value(), find_best_city_placement(), find_closest_city(), find_something_to_kill(), is_terrain_ecologically_wet(), is_terrainclass_req_active(), naval_bonus(), and city_widget::select_coastal().
bool is_terrain_flag_card_near | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
enum terrain_flag_id | flag | ||
) |
Returns TRUE iff any cardinally adjacent tile contains terrain with the given flag (does not check ptile itself).
Definition at line 426 of file terrain.c.
Referenced by is_terrainflag_req_active().
bool is_terrain_flag_near_tile | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
enum terrain_flag_id | flag | ||
) |
Returns TRUE iff any adjacent tile contains terrain with the given flag (does not check ptile itself).
Definition at line 446 of file terrain.c.
Referenced by is_terrainflag_req_active().
bool is_terrain_near_tile | ( | const struct civ_map * | nmap, |
const struct tile * | ptile, | ||
const struct terrain * | pterrain, | ||
bool | check_self | ||
) |
Returns TRUE iff any adjacent tile contains the given terrain.
Definition at line 336 of file terrain.c.
Referenced by evaluate_city_name_priority(), fill_island(), and is_terrain_req_active().
struct terrain * rand_terrain_by_flag | ( | enum terrain_flag_id | flag | ) |
struct extra_type * resource_extra_get | ( | const struct resource_type * | presource | ) |
struct resource_type * resource_type_init | ( | struct extra_type * | pextra | ) |
Initialize resource_type structure.
Definition at line 260 of file terrain.c.
Referenced by handle_ruleset_resource(), and load_terrain_names().
void resource_types_free | ( | void | ) |
Free the memory associated with resource types
Definition at line 276 of file terrain.c.
Referenced by extras_free().
void set_user_terrain_flag_name | ( | enum terrain_flag_id | id, |
const char * | name, | ||
const char * | helptxt | ||
) |
Sets user defined name for terrain flag.
Definition at line 776 of file terrain.c.
Referenced by handle_ruleset_terrain_flag(), load_terrain_names(), and rscompat_names().
struct terrain * terrain_array_first | ( | void | ) |
const struct terrain * terrain_array_last | ( | void | ) |
struct terrain * terrain_by_identifier | ( | const char | identifier | ) |
struct terrain * terrain_by_number | ( | const Terrain_type_id | type | ) |
Return the terrain for the given terrain index.
Definition at line 144 of file terrain.c.
Referenced by tab_terrains::add_now(), api_find_terrain(), editor_tool_get_value_name(), get_tool_value_pixbuf(), handle_edit_tile_terrain(), handle_ruleset_terrain(), handle_tile_info(), load_ruleset_terrain(), mapimg_colortest(), help_widget::terrain_max_values(), universal_by_number(), and universal_value_initial().
struct terrain * terrain_by_rule_name | ( | const char * | name | ) |
Return the terrain type matching the name, or T_UNKNOWN if none matches.
Definition at line 174 of file terrain.c.
Referenced by api_find_terrain_by_name(), tab_terrains::initialize_new_terrain(), load_city_name_list(), lookup_terrain(), tab_terrains::select_terrain(), sg_load_savefile(), sg_load_savefile(), fc_client::slot_selection_changed(), and universal_value_from_str().
struct terrain * terrain_by_translated_name | ( | const char * | name | ) |
Return the terrain type matching the name, or T_UNKNOWN if none matches.
Definition at line 190 of file terrain.c.
Referenced by help_update_terrain(), help_dialog::make_tree(), and help_widget::set_topic_terrain().
bool terrain_can_support_alteration | ( | const struct terrain * | pterrain, |
enum terrain_alteration | alter | ||
) |
Can terrain support given infrastructure?
Definition at line 661 of file terrain.c.
Referenced by is_terrainalter_req_active(), and terrain_type_found().
const char * terrain_class_name_translation | ( | enum terrain_class | tclass | ) |
Return the (translated) name of the given terrain class. You don't have to free the return pointer.
Definition at line 649 of file terrain.c.
Referenced by req_text_insert(), and universal_name_translation().
Terrain_type_id terrain_count | ( | void | ) |
Return the number of terrains.
Definition at line 106 of file terrain.c.
Referenced by fill_tile_edit_packet(), handle_ruleset_control(), mapimg_colortest(), pick_terrain_by_flag(), print_mapgen_map(), receive_packet_ruleset_control_100(), receive_packet_ruleset_control_101(), send_ruleset_terrain(), send_tile_info(), and help_widget::terrain_max_values().
int terrain_extra_build_time | ( | const struct terrain * | pterrain, |
enum unit_activity | activity, | ||
const struct extra_type * | tgt | ||
) |
Time to complete the extra building activity on the given terrain.
Definition at line 682 of file terrain.c.
Referenced by adv_settlers_road_bonus(), check_recursive_road_connect(), helptext_extra(), helptext_extra_for_terrain_str(), manual_command(), and tile_activity_time().
int terrain_extra_removal_time | ( | const struct terrain * | pterrain, |
enum unit_activity | activity, | ||
const struct extra_type * | tgt | ||
) |
Time to complete the extra removal activity on the given terrain.
Definition at line 718 of file terrain.c.
Referenced by tile_activity_time().
const char * terrain_flag_helptxt | ( | enum terrain_flag_id | id | ) |
Return the (untranslated) helptxt of the user terrain flag.
Definition at line 817 of file terrain.c.
Referenced by helptext_terrain(), save_terrain_ruleset(), and send_ruleset_terrain().
bool terrain_has_resource | ( | const struct terrain * | pterrain, |
const struct extra_type * | presource | ||
) |
Check for resource in terrain resources list.
Definition at line 243 of file terrain.c.
Referenced by edit_tile_extra_handling(), is_native_tile_to_extra(), sg_load_map_tiles_extras(), sg_load_map_tiles_resources(), sg_load_player_vision(), tile_set_resource(), and tile_set_terrain().
char terrain_identifier | ( | const struct terrain * | pterrain | ) |
Return the terrain identifier.
Definition at line 114 of file terrain.c.
Referenced by compat_load_020600(), and sg_save_savefile().
Terrain_type_id terrain_index | ( | const struct terrain * | pterrain | ) |
Return the terrain index.
Currently same as terrain_number(), paired with terrain_count() indicates use as an array index.
Definition at line 126 of file terrain.c.
Referenced by fill_basic_terrain_layer_sprite_array(), fill_terrain_sprite_blending(), fill_terrain_sprite_layer(), load_ruleset_terrain(), load_terrain_names(), lookup_terrain(), nation_city_set_terrain_preference(), nation_city_terrain_preference(), pick_terrain_by_flag(), print_mapgen_map(), tab_terrains::refresh(), and tileset_setup_tile_type().
const char * terrain_name_translation | ( | const struct terrain * | pterrain | ) |
Return the (translated) name of the terrain. You don't have to free the return pointer.
Definition at line 226 of file terrain.c.
Referenced by api_methods_terrain_name_translation(), boot_help_texts(), do_paradrop(), editbar_reload_tileset(), editor_tool_get_value_name(), explain_why_no_action_enabled(), help_update_terrain(), helptext_extra(), illegal_action_msg(), insert_generated_text(), manual_command(), objbind_get_value_from_object(), real_menus_update(), remove_city(), req_text_insert(), help_widget::set_topic_terrain(), terrain_by_translated_name(), tile_get_info_text(), universal_name_translation(), and worklist_item_postpone_req_vec().
Terrain_type_id terrain_number | ( | const struct terrain * | pterrain | ) |
Return the terrain index.
Definition at line 135 of file terrain.c.
Referenced by editbar_reload_tileset(), editor_grab_tool(), fill_tile_edit_packet(), paste_tile(), send_ruleset_terrain(), send_tile_info(), tile_set_terrain(), and universal_number().
const char * terrain_rule_name | ( | const struct terrain * | pterrain | ) |
Return the (untranslated) rule name of the terrain. You don't have to free the return pointer.
Definition at line 235 of file terrain.c.
Referenced by api_methods_terrain_rule_name(), boot_help_texts(), compat_load_020600(), tab_terrains::delete_now(), tab_terrains::edit_effects(), edit_terrain::edit_terrain(), fill_island(), handle_ruleset_terrain(), insert_generated_text(), is_terrain_needed(), is_utype_needed(), manual_command(), tab_terrains::name_given(), print_mapgen_map(), tab_terrains::refresh(), regenerate_lakes(), sanity_check_ruleset_data(), save_nation(), save_terrain_ref(), sg_load_players(), sg_load_players(), sg_load_sanitycheck(), sg_load_sanitycheck(), sg_load_savefile(), sg_load_savefile(), sg_save_savefile(), smooth_water_depth(), terrain_by_rule_name(), tile_set_terrain(), tileset_setup_tile_type(), universal_kind_values(), universal_rule_name(), and tab_terrains::update_terrain_info().
enum terrain_class terrain_type_terrain_class | ( | const struct terrain * | pterrain | ) |
What terrain class terrain type belongs to.
Definition at line 570 of file terrain.c.
Referenced by api_methods_terrain_class_name(), assign_continent_flood(), assign_continent_numbers(), count_terrain_class_near_tile(), fill_road_sprite_array(), fill_sprite_array(), helptext_terrain(), is_terrain_class_card_near(), is_terrain_class_near_tile(), is_terrainclass_req_active(), most_adjacent_ocean_type(), pick_ocean(), real_distance_to_land(), recalculate_lake_surrounders(), regenerate_lakes(), smooth_water_depth(), and terrain_type_found().
void terrains_free | ( | void | ) |
Free memory which is associated with terrain types.
Definition at line 59 of file terrain.c.
Referenced by game_ruleset_free().
void terrains_init | ( | void | ) |
Initialize terrain and resource structures.
Definition at line 42 of file terrain.c.
Referenced by game_ruleset_init().
void user_terrain_flags_free | ( | void | ) |
Frees the memory associated with all user terrain flags
Definition at line 764 of file terrain.c.
Referenced by game_ruleset_free().
void user_terrain_flags_init | ( | void | ) |
Initialize user terrain type flags.
Definition at line 752 of file terrain.c.
Referenced by game_ruleset_init().