Freeciv21
Develop your civilization from humble roots to a global empire
terrain.h File Reference
#include "bitvector.h"
#include "shared.h"
#include "fc_types.h"
#include "name_translation.h"
#include "unittype.h"
#include "specenum_gen.h"
+ Include dependency graph for terrain.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  resource_type
 
struct  terrain
 

Macros

#define RESOURCE_NULL_IDENTIFIER   '\0'
 
#define RESOURCE_NONE_IDENTIFIER   ' '
 
#define T_NONE   (nullptr)
 
#define T_UNKNOWN   (nullptr)
 
#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 ()
 Return the number of terrains. More...
 
Terrain_type_id terrain_index (const struct terrain *pterrain)
 Return the terrain index. More...
 
Terrain_type_id terrain_number (const struct terrain *pterrain)
 Return the terrain index. More...
 
struct terrainterrain_by_number (const Terrain_type_id type)
 Return the terrain for the given terrain index. More...
 
struct terrainterrain_by_rule_name (const char *name)
 Return the terrain type matching the name, or T_UNKNOWN if none matches. More...
 
struct terrainterrain_by_translated_name (const char *name)
 Return the terrain type matching the name, or T_UNKNOWN if none matches. More...
 
char terrain_identifier (const struct terrain *pterrain)
 Return the terrain identifier. More...
 
const char * terrain_rule_name (const struct terrain *pterrain)
 Return the (untranslated) rule name of the terrain. More...
 
const char * terrain_name_translation (const struct terrain *pterrain)
 Return the (translated) name of the terrain. More...
 
bool is_terrain_flag_card_near (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). More...
 
bool is_terrain_flag_near_tile (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). More...
 
int count_terrain_flag_near_tile (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). More...
 
void user_terrain_flags_init ()
 Initialize user terrain type flags. More...
 
void user_terrain_flags_free ()
 Frees the memory associated with all user terrain flags. More...
 
void set_user_terrain_flag_name (enum terrain_flag_id id, const char *name, const char *helptxt)
 Sets user defined name for terrain flag. More...
 
const char * terrain_flag_helptxt (enum terrain_flag_id id)
 Return the (untranslated) helptxt of the user terrain flag. More...
 
bool terrain_has_resource (const struct terrain *pterrain, const struct extra_type *presource)
 Check for resource in terrain resources list. More...
 
bool is_terrain_card_near (const struct tile *ptile, const struct terrain *pterrain, bool check_self)
 Returns TRUE iff any cardinally adjacent tile contains the given terrain. More...
 
bool is_terrain_near_tile (const struct tile *ptile, const struct terrain *pterrain, bool check_self)
 Returns TRUE iff any adjacent tile contains the given terrain. More...
 
int count_terrain_property_near_tile (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. More...
 
struct resource_typeresource_type_init (struct extra_type *pextra)
 Initialize resource_type structure. More...
 
void resource_types_free ()
 Free the memory associated with resource types. More...
 
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. More...
 
struct extra_typeget_preferred_pillage (bv_extras extras)
 Returns the highest-priority (best) extra to be pillaged from the terrain set. More...
 
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. More...
 
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. More...
 
const char * terrain_class_name_translation (enum terrain_class tclass)
 Return the (translated) name of the given terrain class. More...
 
enum terrain_class terrain_type_terrain_class (const struct terrain *pterrain)
 What terrain class terrain type belongs to. More...
 
bool is_terrain_class_card_near (const struct tile *ptile, enum terrain_class tclass)
 Is there terrain of the given class cardinally near tile? (Does not check ptile itself.) More...
 
bool is_terrain_class_near_tile (const struct tile *ptile, enum terrain_class tclass)
 Is there terrain of the given class near tile? (Does not check ptile itself.) More...
 
int count_terrain_class_near_tile (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). More...
 
bool terrain_can_support_alteration (const struct terrain *pterrain, enum terrain_alteration talter)
 Can terrain support given infrastructure? More...
 
void terrains_init ()
 Initialize terrain and resource structures. More...
 
void terrains_free ()
 Free memory which is associated with terrain types. More...
 
struct terrainterrain_array_first ()
 Return the first item of terrains. More...
 
const struct terrainterrain_array_last ()
 Return the last item of terrains. More...
 

Macro Definition Documentation

◆ is_ocean

#define is_ocean (   pterrain)
Value:
((pterrain) != T_UNKNOWN \
&& terrain_type_terrain_class(pterrain) == TC_OCEAN)
#define T_UNKNOWN
Definition: terrain.h:51
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
What terrain class terrain type belongs to.
Definition: terrain.cpp:464

Definition at line 276 of file terrain.h.

◆ is_ocean_tile

#define is_ocean_tile (   ptile)    is_ocean(tile_terrain(ptile))

Definition at line 279 of file terrain.h.

◆ MAX_NUM_TERRAINS

#define MAX_NUM_TERRAINS   (96)

Definition at line 58 of file terrain.h.

◆ MAX_NUM_USER_TER_FLAGS

#define MAX_NUM_USER_TER_FLAGS   (TER_USER_LAST - TER_USER_1 + 1)

Definition at line 140 of file terrain.h.

◆ MAX_RESOURCE_TYPES

#define MAX_RESOURCE_TYPES   (MAX_NUM_TERRAINS / 2)

Definition at line 61 of file terrain.h.

◆ RESOURCE_NONE_IDENTIFIER

#define RESOURCE_NONE_IDENTIFIER   ' '

Definition at line 41 of file terrain.h.

◆ RESOURCE_NULL_IDENTIFIER

#define RESOURCE_NULL_IDENTIFIER   '\0'

Definition at line 40 of file terrain.h.

◆ SPECENUM_BITVECTOR

#define SPECENUM_BITVECTOR   bv_terrain_flags

Definition at line 137 of file terrain.h.

◆ SPECENUM_COUNT [1/3]

#define SPECENUM_COUNT   TC_COUNT

Definition at line 163 of file terrain.h.

◆ SPECENUM_COUNT [2/3]

#define SPECENUM_COUNT   TA_COUNT

Definition at line 163 of file terrain.h.

◆ SPECENUM_COUNT [3/3]

#define SPECENUM_COUNT   MG_COUNT

Definition at line 163 of file terrain.h.

◆ SPECENUM_NAME [1/4]

#define SPECENUM_NAME   terrain_class

Definition at line 142 of file terrain.h.

◆ SPECENUM_NAME [2/4]

#define SPECENUM_NAME   terrain_alteration

Definition at line 142 of file terrain.h.

◆ SPECENUM_NAME [3/4]

#define SPECENUM_NAME   terrain_flag_id

Definition at line 142 of file terrain.h.

◆ SPECENUM_NAME [4/4]

#define SPECENUM_NAME   mapgen_terrain_property

Definition at line 142 of file terrain.h.

◆ SPECENUM_NAMEOVERRIDE

#define SPECENUM_NAMEOVERRIDE

Definition at line 136 of file terrain.h.

◆ SPECENUM_VALUE0 [1/4]

#define SPECENUM_VALUE0   TC_LAND

Definition at line 143 of file terrain.h.

◆ SPECENUM_VALUE0 [2/4]

#define SPECENUM_VALUE0   TA_CAN_IRRIGATE

Definition at line 143 of file terrain.h.

◆ SPECENUM_VALUE0 [3/4]

#define SPECENUM_VALUE0   TER_NO_BARBS

Definition at line 143 of file terrain.h.

◆ SPECENUM_VALUE0 [4/4]

#define SPECENUM_VALUE0   MG_MOUNTAINOUS

Definition at line 143 of file terrain.h.

◆ SPECENUM_VALUE0NAME [1/4]

#define SPECENUM_VALUE0NAME   N_("Land")

Definition at line 144 of file terrain.h.

◆ SPECENUM_VALUE0NAME [2/4]

#define SPECENUM_VALUE0NAME   N_("CanIrrigate")

Definition at line 144 of file terrain.h.

◆ SPECENUM_VALUE0NAME [3/4]

#define SPECENUM_VALUE0NAME   N_("NoBarbs")

Definition at line 144 of file terrain.h.

◆ SPECENUM_VALUE0NAME [4/4]

#define SPECENUM_VALUE0NAME   "mountainous"

Definition at line 144 of file terrain.h.

◆ SPECENUM_VALUE1 [1/4]

#define SPECENUM_VALUE1   TC_OCEAN

Definition at line 145 of file terrain.h.

◆ SPECENUM_VALUE1 [2/4]

#define SPECENUM_VALUE1   TA_CAN_MINE

Definition at line 145 of file terrain.h.

◆ SPECENUM_VALUE1 [3/4]

#define SPECENUM_VALUE1   TER_NO_CITIES

Definition at line 145 of file terrain.h.

◆ SPECENUM_VALUE1 [4/4]

#define SPECENUM_VALUE1   MG_GREEN

Definition at line 145 of file terrain.h.

◆ SPECENUM_VALUE10

#define SPECENUM_VALUE10   TER_USER_2

Definition at line 127 of file terrain.h.

◆ SPECENUM_VALUE11

#define SPECENUM_VALUE11   TER_USER_3

Definition at line 128 of file terrain.h.

◆ SPECENUM_VALUE12

#define SPECENUM_VALUE12   TER_USER_4

Definition at line 129 of file terrain.h.

◆ SPECENUM_VALUE13

#define SPECENUM_VALUE13   TER_USER_5

Definition at line 130 of file terrain.h.

◆ SPECENUM_VALUE14

#define SPECENUM_VALUE14   TER_USER_6

Definition at line 131 of file terrain.h.

◆ SPECENUM_VALUE15

#define SPECENUM_VALUE15   TER_USER_7

Definition at line 132 of file terrain.h.

◆ SPECENUM_VALUE16

#define SPECENUM_VALUE16   TER_USER_8

Definition at line 133 of file terrain.h.

◆ SPECENUM_VALUE17

#define SPECENUM_VALUE17   TER_USER_9

Definition at line 134 of file terrain.h.

◆ SPECENUM_VALUE18

#define SPECENUM_VALUE18   TER_USER_LAST

Definition at line 135 of file terrain.h.

◆ SPECENUM_VALUE1NAME [1/4]

#define SPECENUM_VALUE1NAME   N_("Oceanic")

Definition at line 146 of file terrain.h.

◆ SPECENUM_VALUE1NAME [2/4]

#define SPECENUM_VALUE1NAME   N_("CanMine")

Definition at line 146 of file terrain.h.

◆ SPECENUM_VALUE1NAME [3/4]

#define SPECENUM_VALUE1NAME   N_("NoCities")

Definition at line 146 of file terrain.h.

◆ SPECENUM_VALUE1NAME [4/4]

#define SPECENUM_VALUE1NAME   "green"

Definition at line 146 of file terrain.h.

◆ SPECENUM_VALUE2 [1/3]

#define SPECENUM_VALUE2   TA_CAN_ROAD

Definition at line 147 of file terrain.h.

◆ SPECENUM_VALUE2 [2/3]

#define SPECENUM_VALUE2   TER_STARTER

Definition at line 147 of file terrain.h.

◆ SPECENUM_VALUE2 [3/3]

#define SPECENUM_VALUE2   MG_FOLIAGE

Definition at line 147 of file terrain.h.

◆ SPECENUM_VALUE2NAME [1/3]

#define SPECENUM_VALUE2NAME   N_("CanRoad")

Definition at line 148 of file terrain.h.

◆ SPECENUM_VALUE2NAME [2/3]

#define SPECENUM_VALUE2NAME   N_("Starter")

Definition at line 148 of file terrain.h.

◆ SPECENUM_VALUE2NAME [3/3]

#define SPECENUM_VALUE2NAME   "foliage"

Definition at line 148 of file terrain.h.

◆ SPECENUM_VALUE3 [1/2]

#define SPECENUM_VALUE3   TER_CAN_HAVE_RIVER

Definition at line 149 of file terrain.h.

◆ SPECENUM_VALUE3 [2/2]

#define SPECENUM_VALUE3   MG_TROPICAL

Definition at line 149 of file terrain.h.

◆ SPECENUM_VALUE3NAME [1/2]

#define SPECENUM_VALUE3NAME   N_("CanHaveRiver")

Definition at line 150 of file terrain.h.

◆ SPECENUM_VALUE3NAME [2/2]

#define SPECENUM_VALUE3NAME   "tropical"

Definition at line 150 of file terrain.h.

◆ SPECENUM_VALUE4 [1/2]

#define SPECENUM_VALUE4   TER_UNSAFE_COAST

Definition at line 151 of file terrain.h.

◆ SPECENUM_VALUE4 [2/2]

#define SPECENUM_VALUE4   MG_TEMPERATE

Definition at line 151 of file terrain.h.

◆ SPECENUM_VALUE4NAME [1/2]

#define SPECENUM_VALUE4NAME   N_("UnsafeCoast")

Definition at line 152 of file terrain.h.

◆ SPECENUM_VALUE4NAME [2/2]

#define SPECENUM_VALUE4NAME   "temperate"

Definition at line 152 of file terrain.h.

◆ SPECENUM_VALUE5 [1/2]

#define SPECENUM_VALUE5   TER_FRESHWATER

Definition at line 153 of file terrain.h.

◆ SPECENUM_VALUE5 [2/2]

#define SPECENUM_VALUE5   MG_COLD

Definition at line 153 of file terrain.h.

◆ SPECENUM_VALUE5NAME [1/2]

#define SPECENUM_VALUE5NAME   N_("FreshWater")

Definition at line 154 of file terrain.h.

◆ SPECENUM_VALUE5NAME [2/2]

#define SPECENUM_VALUE5NAME   "cold"

Definition at line 154 of file terrain.h.

◆ SPECENUM_VALUE6 [1/2]

#define SPECENUM_VALUE6   TER_NOT_GENERATED

Definition at line 155 of file terrain.h.

◆ SPECENUM_VALUE6 [2/2]

#define SPECENUM_VALUE6   MG_FROZEN

Definition at line 155 of file terrain.h.

◆ SPECENUM_VALUE6NAME [1/2]

#define SPECENUM_VALUE6NAME   N_("NotGenerated")

Definition at line 156 of file terrain.h.

◆ SPECENUM_VALUE6NAME [2/2]

#define SPECENUM_VALUE6NAME   "frozen"

Definition at line 156 of file terrain.h.

◆ SPECENUM_VALUE7 [1/2]

#define SPECENUM_VALUE7   TER_NO_ZOC

Definition at line 157 of file terrain.h.

◆ SPECENUM_VALUE7 [2/2]

#define SPECENUM_VALUE7   MG_WET

Definition at line 157 of file terrain.h.

◆ SPECENUM_VALUE7NAME [1/2]

#define SPECENUM_VALUE7NAME   N_("NoZoc")

Definition at line 158 of file terrain.h.

◆ SPECENUM_VALUE7NAME [2/2]

#define SPECENUM_VALUE7NAME   "wet"

Definition at line 158 of file terrain.h.

◆ SPECENUM_VALUE8 [1/2]

#define SPECENUM_VALUE8   TER_FROZEN

Definition at line 159 of file terrain.h.

◆ SPECENUM_VALUE8 [2/2]

#define SPECENUM_VALUE8   MG_DRY

Definition at line 159 of file terrain.h.

◆ SPECENUM_VALUE8NAME [1/2]

#define SPECENUM_VALUE8NAME   N_("Frozen")

Definition at line 160 of file terrain.h.

◆ SPECENUM_VALUE8NAME [2/2]

#define SPECENUM_VALUE8NAME   "dry"

Definition at line 160 of file terrain.h.

◆ SPECENUM_VALUE9 [1/2]

#define SPECENUM_VALUE9   TER_USER_1

Definition at line 161 of file terrain.h.

◆ SPECENUM_VALUE9 [2/2]

#define SPECENUM_VALUE9   MG_OCEAN_DEPTH

Definition at line 161 of file terrain.h.

◆ SPECENUM_VALUE9NAME

#define SPECENUM_VALUE9NAME   "ocean_depth"

Definition at line 162 of file terrain.h.

◆ T_FIRST

#define T_FIRST   0

Definition at line 54 of file terrain.h.

◆ T_NONE

#define T_NONE   (nullptr)

Definition at line 50 of file terrain.h.

◆ T_UNKNOWN

#define T_UNKNOWN   (nullptr)

Definition at line 51 of file terrain.h.

◆ terrain_has_flag

#define terrain_has_flag (   terr,
  flag 
)    BV_ISSET((terr)->flags, flag)

Definition at line 260 of file terrain.h.

◆ TERRAIN_OCEAN_DEPTH_MAXIMUM

#define TERRAIN_OCEAN_DEPTH_MAXIMUM   (100)

Definition at line 234 of file terrain.h.

◆ TERRAIN_OCEAN_DEPTH_MINIMUM

#define TERRAIN_OCEAN_DEPTH_MINIMUM   (1)

Definition at line 233 of file terrain.h.

◆ terrain_re_active_iterate

#define terrain_re_active_iterate (   _p)
Value:
{ \
if (!_p->ruledit_disabled) {
#define terrain_type_iterate(_p)
Definition: terrain.h:331

Definition at line 342 of file terrain.h.

◆ terrain_re_active_iterate_end

#define terrain_re_active_iterate_end
Value:
} \
} \
terrain_type_iterate_end;

Definition at line 347 of file terrain.h.

◆ terrain_type_iterate

#define terrain_type_iterate (   _p)
Value:
{ \
struct terrain *_p = terrain_array_first(); \
if (nullptr != _p) { \
for (; _p <= terrain_array_last(); _p++) {
const struct terrain * terrain_array_last()
Return the last item of terrains.
Definition: terrain.cpp:82
struct terrain * terrain_array_first()
Return the first item of terrains.
Definition: terrain.cpp:71

Definition at line 331 of file terrain.h.

◆ terrain_type_iterate_end

#define terrain_type_iterate_end
Value:
} \
} \
}

Definition at line 337 of file terrain.h.

◆ TERRAIN_UNKNOWN_IDENTIFIER

#define TERRAIN_UNKNOWN_IDENTIFIER   'u'

Definition at line 181 of file terrain.h.

Enumeration Type Documentation

◆ special_river_move

Enumerator
RMV_NORMAL 
RMV_FAST_STRICT 
RMV_FAST_RELAXED 
RMV_FAST_ALWAYS 

Definition at line 28 of file terrain.h.

Function Documentation

◆ count_terrain_class_near_tile()

int count_terrain_class_near_tile ( 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 517 of file terrain.cpp.

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().

◆ count_terrain_flag_near_tile()

int count_terrain_flag_near_tile ( 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 365 of file terrain.cpp.

Referenced by can_freeze_terrain(), and can_thaw_terrain().

◆ count_terrain_property_near_tile()

int count_terrain_property_near_tile ( 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 298 of file terrain.cpp.

Referenced by make_rivers().

◆ get_infrastructure_text()

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 394 of file terrain.cpp.

Referenced by popup_info_text(), and popup_terrain_info().

◆ get_preferred_pillage()

struct extra_type* get_preferred_pillage ( bv_extras  extras)

Returns the highest-priority (best) extra to be pillaged from the terrain set.

May return nullptr if nothing is available.

Definition at line 439 of file terrain.cpp.

Referenced by popup_pillage_dialog(), request_unit_pillage(), and unit_assign_specific_activity_target().

◆ is_terrain_card_near()

bool is_terrain_card_near ( 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 256 of file terrain.cpp.

◆ is_terrain_class_card_near()

bool is_terrain_class_card_near ( 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 473 of file terrain.cpp.

Referenced by fill_island().

◆ is_terrain_class_near_tile()

bool is_terrain_class_near_tile ( const struct tile ptile,
enum terrain_class  tclass 
)

◆ is_terrain_flag_card_near()

bool is_terrain_flag_card_near ( 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 325 of file terrain.cpp.

◆ is_terrain_flag_near_tile()

bool is_terrain_flag_near_tile ( 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 345 of file terrain.cpp.

◆ is_terrain_near_tile()

bool is_terrain_near_tile ( const struct tile ptile,
const struct terrain pterrain,
bool  check_self 
)

Returns TRUE iff any adjacent tile contains the given terrain.

Definition at line 277 of file terrain.cpp.

Referenced by evaluate_city_name_priority(), and fill_island().

◆ resource_type_init()

struct resource_type* resource_type_init ( struct extra_type pextra)

Initialize resource_type structure.

Definition at line 209 of file terrain.cpp.

Referenced by handle_ruleset_resource(), and load_terrain_names().

◆ resource_types_free()

void resource_types_free ( )

Free the memory associated with resource types.

Definition at line 223 of file terrain.cpp.

Referenced by extras_free().

◆ set_user_terrain_flag_name()

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 673 of file terrain.cpp.

Referenced by handle_ruleset_terrain_flag(), load_terrain_names(), and rscompat_names().

◆ terrain_array_first()

struct terrain* terrain_array_first ( )

Return the first item of terrains.

Definition at line 71 of file terrain.cpp.

◆ terrain_array_last()

const struct terrain* terrain_array_last ( )

Return the last item of terrains.

Definition at line 82 of file terrain.cpp.

◆ terrain_by_number()

◆ terrain_by_rule_name()

struct terrain* terrain_by_rule_name ( const char *  name)

◆ terrain_by_translated_name()

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 158 of file terrain.cpp.

Referenced by help_dialog::make_tree(), and help_widget::set_topic_terrain().

◆ terrain_can_support_alteration()

bool terrain_can_support_alteration ( const struct terrain pterrain,
enum terrain_alteration  talter 
)

Can terrain support given infrastructure?

Definition at line 558 of file terrain.cpp.

◆ terrain_class_name_translation()

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 546 of file terrain.cpp.

Referenced by req_text_insert(), universal_name_translation(), and worklist_item_postpone_req_vec().

◆ terrain_count()

◆ terrain_extra_build_time()

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 579 of file terrain.cpp.

Referenced by adv_settlers_road_bonus(), check_recursive_road_connect(), helptext_extra(), helptext_extra_for_terrain_str(), manual_command(), and tile_activity_time().

◆ terrain_extra_removal_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 615 of file terrain.cpp.

Referenced by tile_activity_time().

◆ terrain_flag_helptxt()

const char* terrain_flag_helptxt ( enum terrain_flag_id  id)

Return the (untranslated) helptxt of the user terrain flag.

Definition at line 708 of file terrain.cpp.

Referenced by helptext_terrain(), save_terrain_ruleset(), and send_ruleset_terrain().

◆ terrain_has_resource()

bool terrain_has_resource ( const struct terrain pterrain,
const struct extra_type presource 
)

Check for resource in terrain resources list.

Definition at line 192 of file terrain.cpp.

Referenced by 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().

◆ terrain_identifier()

char terrain_identifier ( const struct terrain pterrain)

Return the terrain identifier.

Definition at line 98 of file terrain.cpp.

Referenced by compat_load_020600(), and sg_save_savefile().

◆ terrain_index()

◆ terrain_name_translation()

◆ terrain_number()

Terrain_type_id terrain_number ( const struct terrain pterrain)

◆ terrain_rule_name()

◆ terrain_type_terrain_class()

◆ terrains_free()

void terrains_free ( )

Free memory which is associated with terrain types.

Definition at line 50 of file terrain.cpp.

Referenced by game_ruleset_free().

◆ terrains_init()

void terrains_init ( )

Initialize terrain and resource structures.

Definition at line 34 of file terrain.cpp.

Referenced by game_ruleset_init().

◆ user_terrain_flags_free()

void user_terrain_flags_free ( )

Frees the memory associated with all user terrain flags.

Definition at line 661 of file terrain.cpp.

Referenced by game_ruleset_free().

◆ user_terrain_flags_init()

void user_terrain_flags_init ( )

Initialize user terrain type flags.

Definition at line 649 of file terrain.cpp.

Referenced by game_ruleset_init().