62 if (NULL != pterrain->helptext) {
64 pterrain->helptext = NULL;
66 if (pterrain->resources != NULL) {
69 free(pterrain->resources);
70 pterrain->resources = NULL;
72 if (pterrain->rgb != NULL) {
249 if (*r == presource) {
264 presource =
fc_malloc(
sizeof(*presource));
268 presource->
self = pextra;
286 return presource->
self;
293#define variable_adjc_iterate(nmap, center_tile, _tile, card_only) \
295 enum direction8 *_tile##_list; \
299 _tile##_list = wld.map.cardinal_dirs; \
300 _tile##_count = wld.map.num_cardinal_dirs; \
302 _tile##_list = wld.map.valid_dirs; \
303 _tile##_count = wld.map.num_valid_dirs; \
305 adjc_dirlist_iterate(nmap, center_tile, _tile, _tile##_dir, \
306 _tile##_list, _tile##_count) {
308#define variable_adjc_iterate_end \
309 } adjc_dirlist_iterate_end; \
316 const struct tile *ptile,
317 const struct terrain *pterrain,
320 if (pterrain == NULL) {
330 return check_self && ptile->
terrain == pterrain;
337 const struct tile *ptile,
338 const struct terrain *pterrain,
341 if (pterrain == NULL) {
351 return check_self && ptile->
terrain == pterrain;
358 const struct tile *ptile,
359 bool cardinal_only,
bool percentage,
360 enum mapgen_terrain_property prop)
362 int count = 0, total = 0;
373 if (percentage && count > 0) {
374 count = count * 100 / total;
384 const struct tile *ptile,
405 const struct tile *ptile,
427 const struct tile *ptile,
428 enum terrain_flag_id flag)
447 const struct tile *ptile,
448 enum terrain_flag_id flag)
467 const struct tile *ptile,
468 bool cardinal_only,
bool percentage,
469 enum terrain_flag_id flag)
471 int count = 0, total = 0;
483 if (percentage && count > 0) {
484 count = count * 100 / total;
505 if (pextra->category == ECAT_INFRA
512 if (
BV_ISSET(pextra->hidden_by, topi)
527 if (
len > 0 && *p ==
'/') {
541 static const enum extra_cause prefs[] = {
580 const struct tile *ptile,
581 enum terrain_class tclass)
601 const struct tile *ptile,
602 enum terrain_class
tclass)
622 const struct tile *ptile,
623 bool cardinal_only,
bool percentage,
624 enum terrain_class
tclass)
626 int count = 0, total = 0;
638 if (percentage && count > 0) {
639 count = count * 100 / total;
651 if (!terrain_class_is_valid(
tclass)) {
655 return _(terrain_class_name(
tclass));
662 enum terrain_alteration alter)
665 case TA_CAN_IRRIGATE:
683 enum unit_activity activity,
703 case ACTIVITY_GEN_ROAD:
705 case ACTIVITY_IRRIGATE:
719 enum unit_activity activity,
737 case ACTIVITY_POLLUTION:
739 case ACTIVITY_FALLOUT:
741 case ACTIVITY_PILLAGE:
779 int tfid =
id - TER_USER_1;
797 if (helptxt && helptxt[0] !=
'\0') {
807 if (flag < TER_USER_1 || flag > TER_USER_LAST) {
819 fc_assert(
id >= TER_USER_1 &&
id <= TER_USER_LAST);
#define BV_ISSET(bv, bit)
void user_flag_init(struct user_flag *flag)
void user_flag_free(struct user_flag *flag)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define cardinal_adjc_iterate_end
#define adjc_iterate(nmap, center_tile, itr_tile)
#define cardinal_adjc_iterate(nmap, center_tile, itr_tile)
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
void strvec_destroy(struct strvec *psv)
struct packet_ruleset_control control
struct extra_type ** resources
struct name_translation name
const struct unit_type * animal
enum terrain_class tclass
int fc_strcasecmp(const char *str0, const char *str1)
int cat_snprintf(char *str, size_t n, const char *format,...)
int terrain_extra_removal_time(const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt)
void user_terrain_flags_init(void)
struct terrain * terrain_by_rule_name(const char *name)
bool is_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
char terrain_identifier(const struct terrain *pterrain)
Terrain_type_id terrain_count(void)
struct extra_type * resource_extra_get(const struct resource_type *presource)
int count_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, bool cardinal_only, bool percentage, enum terrain_class tclass)
bool is_terrain_class_card_near(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
struct terrain * terrain_by_translated_name(const char *name)
const char * terrain_class_name_translation(enum terrain_class tclass)
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)
const char * get_infrastructure_text(bv_extras extras)
const char * terrain_flag_id_name_cb(enum terrain_flag_id flag)
Terrain_type_id terrain_index(const struct terrain *pterrain)
bool is_resource_card_near(const struct civ_map *nmap, const struct tile *ptile, const struct extra_type *pres, bool check_self)
const char * terrain_name_translation(const struct terrain *pterrain)
#define variable_adjc_iterate(nmap, center_tile, _tile, card_only)
struct terrain * terrain_array_first(void)
struct terrain * rand_terrain_by_flag(enum terrain_flag_id flag)
struct terrain * terrain_by_number(const Terrain_type_id type)
bool terrain_can_support_alteration(const struct terrain *pterrain, enum terrain_alteration alter)
bool is_terrain_card_near(const struct civ_map *nmap, const struct tile *ptile, const struct terrain *pterrain, bool check_self)
const char * terrain_rule_name(const struct terrain *pterrain)
bool is_resource_near_tile(const struct civ_map *nmap, const struct tile *ptile, const struct extra_type *pres, bool check_self)
void resource_types_free(void)
void user_terrain_flags_free(void)
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
const char * terrain_flag_helptxt(enum terrain_flag_id id)
bool terrain_has_resource(const struct terrain *pterrain, const struct extra_type *presource)
struct resource_type * resource_type_init(struct extra_type *pextra)
bool is_terrain_flag_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_flag_id flag)
struct extra_type * get_preferred_pillage(bv_extras extras)
void set_user_terrain_flag_name(enum terrain_flag_id id, const char *name, const char *helptxt)
const struct terrain * terrain_array_last(void)
static struct terrain civ_terrains[MAX_NUM_TERRAINS]
int terrain_extra_build_time(const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt)
static struct user_flag user_terrain_flags[MAX_NUM_USER_TER_FLAGS]
Terrain_type_id terrain_number(const struct terrain *pterrain)
struct terrain * terrain_by_identifier(const char identifier)
bool is_terrain_flag_card_near(const struct civ_map *nmap, const struct tile *ptile, enum terrain_flag_id flag)
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)
#define variable_adjc_iterate_end
bool is_terrain_near_tile(const struct civ_map *nmap, const struct tile *ptile, const struct terrain *pterrain, bool check_self)
#define terrain_type_iterate(_p)
#define TERRAIN_UNKNOWN_IDENTIFIER
#define terrain_type_iterate_end
#define terrain_has_flag(terr, flag)
#define MAX_NUM_USER_TER_FLAGS
#define tile_resource(_tile)
#define tile_terrain(_tile)