Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
extras.h File Reference
#include "fc_types.h"
#include "unittype.h"
#include "specenum_gen.h"
#include "speclist.h"

Go to the source code of this file.

Data Structures

struct  extra_type
 

Macros

#define SPECENUM_NAME   extra_flag_id
 
#define SPECENUM_VALUE0   EF_NATIVE_TILE
 
#define SPECENUM_VALUE0NAME   N_("?extraflag:NativeTile")
 
#define SPECENUM_VALUE1   EF_REFUEL
 
#define SPECENUM_VALUE1NAME   N_("?extraflag:Refuel")
 
#define SPECENUM_VALUE2   EF_TERR_CHANGE_REMOVES
 
#define SPECENUM_VALUE2NAME   N_("?extraflag:TerrChangeRemoves")
 
#define SPECENUM_VALUE3   EF_AUTO_ON_CITY_CENTER
 
#define SPECENUM_VALUE3NAME   N_("?extraflag:AutoOnCityCenter")
 
#define SPECENUM_VALUE4   EF_ALWAYS_ON_CITY_CENTER
 
#define SPECENUM_VALUE4NAME   N_("?extraflag:AlwaysOnCityCenter")
 
#define SPECENUM_VALUE5   EF_CONNECT_LAND
 
#define SPECENUM_VALUE5NAME   N_("?extraflag:ConnectLand")
 
#define SPECENUM_VALUE6   EF_GLOBAL_WARMING
 
#define SPECENUM_VALUE6NAME   N_("?extraflag:GlobalWarming")
 
#define SPECENUM_VALUE7   EF_NUCLEAR_WINTER
 
#define SPECENUM_VALUE7NAME   N_("?extraflag:NuclearWinter")
 
#define SPECENUM_VALUE8   EF_SHOW_FLAG
 
#define SPECENUM_VALUE8NAME   N_("?extraflag:ShowFlag")
 
#define SPECENUM_VALUE9   EF_NATURAL_DEFENSE
 
#define SPECENUM_VALUE9NAME   N_("?extraflag:NaturalDefense")
 
#define SPECENUM_VALUE10   EF_NO_STACK_DEATH
 
#define SPECENUM_VALUE10NAME   N_("NoStackDeath")
 
#define SPECENUM_VALUE11   EF_CAUSE_ZOC
 
#define SPECENUM_VALUE11NAME   N_("CauseZoC")
 
#define SPECENUM_VALUE12   EF_USER_FLAG_1
 
#define SPECENUM_VALUE13   EF_USER_FLAG_2
 
#define SPECENUM_VALUE14   EF_USER_FLAG_3
 
#define SPECENUM_VALUE15   EF_USER_FLAG_4
 
#define SPECENUM_VALUE16   EF_USER_FLAG_5
 
#define SPECENUM_VALUE17   EF_USER_FLAG_6
 
#define SPECENUM_VALUE18   EF_USER_FLAG_7
 
#define SPECENUM_VALUE19   EF_USER_FLAG_8
 
#define SPECENUM_VALUE20   EF_USER_FLAG_9
 
#define SPECENUM_VALUE21   EF_USER_FLAG_10
 
#define SPECENUM_COUNT   EF_COUNT
 
#define SPECENUM_NAMEOVERRIDE
 
#define SPECENUM_BITVECTOR   bv_extra_flags
 
#define EF_LAST_USER_FLAG   EF_USER_FLAG_10
 
#define MAX_NUM_USER_EXTRA_FLAGS   (EF_LAST_USER_FLAG - EF_USER_FLAG_1 + 1)
 
#define EXTRA_NONE   (-1)
 
#define SPECLIST_TAG   extra_type
 
#define SPECLIST_TYPE   struct extra_type
 
#define extra_type_list_iterate(extralist, pextra)    TYPED_LIST_ITERATE(struct extra_type, extralist, pextra)
 
#define extra_type_list_iterate_end   LIST_ITERATE_END
 
#define extra_type_list_iterate_rev(extralist, pextra)    TYPED_LIST_ITERATE_REV(struct extra_type, extralist, pextra)
 
#define extra_type_list_iterate_rev_end   LIST_ITERATE_REV_END
 
#define extra_index(_e_)   (_e_)->id
 
#define extra_base_get(_e_)   (_e_)->data.base
 
#define extra_road_get(_e_)   (_e_)->data.road
 
#define extra_resource_get(_e_)   (_e_)->data.resource
 
#define is_extra_caused_by(e, c)   (e->causes & (1 << c))
 
#define extra_type_iterate(_p)
 
#define extra_type_iterate_end
 
#define extra_type_re_active_iterate(_p)
 
#define extra_type_re_active_iterate_end
 
#define extra_type_by_cause_iterate(_cause, _extra)
 
#define extra_type_by_cause_iterate_end
 
#define extra_type_by_cause_iterate_rev(_cause, _extra)
 
#define extra_type_by_cause_iterate_rev_end
 
#define extra_type_by_rmcause_iterate(_rmcause, _extra)
 
#define extra_type_by_rmcause_iterate_end
 
#define extra_type_cleanable_iterate(_extra)
 
#define extra_type_cleanable_iterate_end
 
#define extra_deps_iterate(_reqs, _dep)
 
#define extra_deps_iterate_end
 

Functions

void extras_init (void)
 
void extras_free (void)
 
int extra_count (void)
 
int extra_number (const struct extra_type *pextra)
 
struct extra_typeextra_by_number (int id)
 
const charextra_name_translation (const struct extra_type *pextra)
 
const charextra_rule_name (const struct extra_type *pextra)
 
struct extra_typeextra_type_by_rule_name (const char *name)
 
struct extra_typeextra_type_by_translated_name (const char *name)
 
void extra_to_caused_by_list (struct extra_type *pextra, enum extra_cause cause)
 
struct extra_type_listextra_type_list_by_cause (enum extra_cause cause)
 
struct extra_typerand_extra_for_tile (struct tile *ptile, enum extra_cause cause, bool generated)
 
struct extra_type_listextra_type_list_of_unit_hiders (void)
 
struct extra_type_listextra_type_list_of_zoccers (void)
 
struct extra_type_listextra_type_list_of_terr_claimers (void)
 
bool is_extra_caused_by_worker_action (const struct extra_type *pextra)
 
bool is_extra_caused_by_action (const struct extra_type *pextra, const struct action *paction)
 
void _extra_to_removed_by_list (struct extra_type *pextra, enum extra_rmcause rmcause)
 
static void extra_to_removed_by_list (struct extra_type *pextra, enum extra_rmcause rmcause)
 
struct extra_type_listextra_type_list_by_rmcause (enum extra_rmcause rmcause)
 
struct extra_type_listextra_type_list_cleanable (void)
 
bool is_extra_removed_by (const struct extra_type *pextra, enum extra_rmcause rmcause)
 
bool is_extra_removed_by_worker_action (const struct extra_type *pextra)
 
bool is_extra_removed_by_action (const struct extra_type *pextra, const struct action *paction)
 
bool is_extra_card_near (const struct civ_map *nmap, const struct tile *ptile, const struct extra_type *pextra)
 
bool is_extra_near_tile (const struct civ_map *nmap, const struct tile *ptile, const struct extra_type *pextra)
 
bool extra_can_be_built (const struct extra_type *pextra, const struct tile *ptile)
 
bool can_build_extra (const struct extra_type *pextra, const struct unit *punit, const struct tile *ptile)
 
bool can_build_extra_base (const struct extra_type *pextra, const struct player *pplayer, const struct tile *ptile)
 
bool player_can_build_extra (const struct extra_type *pextra, const struct player *pplayer, const struct tile *ptile)
 
bool player_can_place_extra (const struct extra_type *pextra, const struct player *pplayer, const struct tile *ptile)
 
bool can_remove_extra (const struct extra_type *pextra, const struct unit *punit, const struct tile *ptile)
 
bool player_can_remove_extra (const struct extra_type *pextra, const struct player *pplayer, const struct tile *ptile)
 
bool is_native_extra_to_uclass (const struct extra_type *pextra, const struct unit_class *pclass)
 
bool is_native_extra_to_utype (const struct extra_type *pextra, const struct unit_type *punittype)
 
bool is_native_tile_to_extra (const struct extra_type *pextra, const struct tile *ptile)
 
bool extra_conflicting_on_tile (const struct extra_type *pextra, const struct tile *ptile)
 
bool hut_on_tile (const struct tile *ptile)
 
bool unit_can_enter_hut (const struct unit *punit, const struct tile *ptile)
 
bool unit_can_displace_hut (const struct unit *punit, const struct tile *ptile)
 
bool extra_has_flag (const struct extra_type *pextra, enum extra_flag_id flag)
 
bool is_extra_flag_card_near (const struct civ_map *nmap, const struct tile *ptile, enum extra_flag_id flag)
 
bool is_extra_flag_near_tile (const struct civ_map *nmap, const struct tile *ptile, enum extra_flag_id flag)
 
void user_extra_flags_init (void)
 
void extra_flags_free (void)
 
void set_user_extra_flag_name (enum extra_flag_id id, const char *name, const char *helptxt)
 
const charextra_flag_helptxt (enum extra_flag_id id)
 
bool extra_flag_is_in_use (enum extra_flag_id id)
 
bool extra_causes_env_upset (struct extra_type *pextra, enum environment_upset_type upset)
 
bool can_extras_coexist (const struct extra_type *pextra1, const struct extra_type *pextra2)
 
bool can_extra_appear (const struct extra_type *pextra, const struct tile *ptile)
 
bool can_extra_disappear (const struct extra_type *pextra, const struct tile *ptile)
 
struct extra_typenext_extra_for_tile (const struct tile *ptile, enum extra_cause cause, const struct player *pplayer, const struct unit *punit)
 
struct extra_typeprev_extra_in_tile (const struct tile *ptile, enum extra_rmcause rmcause, const struct player *pplayer, const struct unit *punit)
 
struct extra_typeprev_cleanable_in_tile (const struct tile *ptile, const struct player *pplayer, const struct unit *punit)
 
enum extra_cause activity_to_extra_cause (enum unit_activity act)
 
enum extra_rmcause activity_to_extra_rmcause (enum unit_activity act)
 
struct playerextra_owner (const struct tile *ptile)
 
bool player_knows_extra_exist (const struct player *pplayer, const struct extra_type *pextra, const struct tile *ptile)
 

Macro Definition Documentation

◆ EF_LAST_USER_FLAG

#define EF_LAST_USER_FLAG   EF_USER_FLAG_10

Definition at line 82 of file extras.h.

◆ extra_base_get

#define extra_base_get (   _e_)    (_e_)->data.base

Definition at line 190 of file extras.h.

◆ extra_deps_iterate

#define extra_deps_iterate (   _reqs,
  _dep 
)
Value:
{ \
if (preq->source.kind == VUT_EXTRA \
&& preq->present) { \
struct extra_type *_dep; \
_dep = preq->source.value.extra;
char * incite_cost
Definition comments.c:75

Definition at line 371 of file extras.h.

◆ extra_deps_iterate_end

#define extra_deps_iterate_end
Value:
} \
}
#define requirement_vector_iterate_end

Definition at line 379 of file extras.h.

◆ extra_index

#define extra_index (   _e_)    (_e_)->id

Definition at line 183 of file extras.h.

◆ EXTRA_NONE

#define EXTRA_NONE   (-1)

Definition at line 85 of file extras.h.

◆ extra_resource_get

#define extra_resource_get (   _e_)    (_e_)->data.resource

Definition at line 192 of file extras.h.

◆ extra_road_get

#define extra_road_get (   _e_)    (_e_)->data.road

Definition at line 191 of file extras.h.

◆ extra_type_by_cause_iterate

#define extra_type_by_cause_iterate (   _cause,
  _extra 
)
Value:
{ \
struct extra_type_list * extra_type_list_by_cause(enum extra_cause cause)
Definition extras.c:249

Definition at line 333 of file extras.h.

◆ extra_type_by_cause_iterate_end

#define extra_type_by_cause_iterate_end
Value:
} \
}
#define extra_type_list_iterate_end
Definition extras.h:167

Definition at line 339 of file extras.h.

◆ extra_type_by_cause_iterate_rev

#define extra_type_by_cause_iterate_rev (   _cause,
  _extra 
)

◆ extra_type_by_cause_iterate_rev_end

#define extra_type_by_cause_iterate_rev_end
Value:
}
#define extra_type_list_iterate_rev_end
Definition extras.h:171

Definition at line 349 of file extras.h.

◆ extra_type_by_rmcause_iterate

#define extra_type_by_rmcause_iterate (   _rmcause,
  _extra 
)
Value:
{ \
struct extra_type_list * extra_type_list_by_rmcause(enum extra_rmcause rmcause)
Definition extras.c:322

Definition at line 353 of file extras.h.

◆ extra_type_by_rmcause_iterate_end

#define extra_type_by_rmcause_iterate_end
Value:

Definition at line 358 of file extras.h.

◆ extra_type_cleanable_iterate

#define extra_type_cleanable_iterate (   _extra)
Value:
{ \
struct extra_type_list * extra_type_list_cleanable(void)
Definition extras.c:332

Definition at line 362 of file extras.h.

◆ extra_type_cleanable_iterate_end

#define extra_type_cleanable_iterate_end
Value:

Definition at line 367 of file extras.h.

◆ extra_type_iterate

#define extra_type_iterate (   _p)
Value:
{ \
int _i_##_p; \
struct extra_type * extra_by_number(int id)
Definition extras.c:183
struct civ_game game
Definition game.c:62
struct packet_ruleset_control control
Definition game.h:83

Definition at line 315 of file extras.h.

◆ extra_type_iterate_end

#define extra_type_iterate_end
Value:
} \
}

Definition at line 321 of file extras.h.

◆ extra_type_list_iterate

#define extra_type_list_iterate (   extralist,
  pextra 
)     TYPED_LIST_ITERATE(struct extra_type, extralist, pextra)

Definition at line 165 of file extras.h.

◆ extra_type_list_iterate_end

#define extra_type_list_iterate_end   LIST_ITERATE_END

Definition at line 167 of file extras.h.

◆ extra_type_list_iterate_rev

#define extra_type_list_iterate_rev (   extralist,
  pextra 
)     TYPED_LIST_ITERATE_REV(struct extra_type, extralist, pextra)

Definition at line 169 of file extras.h.

◆ extra_type_list_iterate_rev_end

#define extra_type_list_iterate_rev_end   LIST_ITERATE_REV_END

Definition at line 171 of file extras.h.

◆ extra_type_re_active_iterate

#define extra_type_re_active_iterate (   _p)
Value:
if (!_p->ruledit_disabled) {
#define extra_type_iterate(_p)
Definition extras.h:315

Definition at line 325 of file extras.h.

◆ extra_type_re_active_iterate_end

#define extra_type_re_active_iterate_end
Value:
} \
#define extra_type_iterate_end
Definition extras.h:321

Definition at line 329 of file extras.h.

◆ is_extra_caused_by

#define is_extra_caused_by (   e,
 
)    (e->causes & (1 << c))

Definition at line 203 of file extras.h.

◆ MAX_NUM_USER_EXTRA_FLAGS

#define MAX_NUM_USER_EXTRA_FLAGS   (EF_LAST_USER_FLAG - EF_USER_FLAG_1 + 1)

Definition at line 83 of file extras.h.

◆ SPECENUM_BITVECTOR

#define SPECENUM_BITVECTOR   bv_extra_flags

Definition at line 79 of file extras.h.

◆ SPECENUM_COUNT

#define SPECENUM_COUNT   EF_COUNT

Definition at line 77 of file extras.h.

◆ SPECENUM_NAME

Definition at line 28 of file extras.h.

◆ SPECENUM_NAMEOVERRIDE

#define SPECENUM_NAMEOVERRIDE

Definition at line 78 of file extras.h.

◆ SPECENUM_VALUE0

#define SPECENUM_VALUE0   EF_NATIVE_TILE

Definition at line 30 of file extras.h.

◆ SPECENUM_VALUE0NAME

#define SPECENUM_VALUE0NAME   N_("?extraflag:NativeTile")

Definition at line 31 of file extras.h.

◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1   EF_REFUEL

Definition at line 33 of file extras.h.

◆ SPECENUM_VALUE10

#define SPECENUM_VALUE10   EF_NO_STACK_DEATH

Definition at line 60 of file extras.h.

◆ SPECENUM_VALUE10NAME

#define SPECENUM_VALUE10NAME   N_("NoStackDeath")

Definition at line 61 of file extras.h.

◆ SPECENUM_VALUE11

#define SPECENUM_VALUE11   EF_CAUSE_ZOC

Definition at line 63 of file extras.h.

◆ SPECENUM_VALUE11NAME

#define SPECENUM_VALUE11NAME   N_("CauseZoC")

Definition at line 64 of file extras.h.

◆ SPECENUM_VALUE12

#define SPECENUM_VALUE12   EF_USER_FLAG_1

Definition at line 66 of file extras.h.

◆ SPECENUM_VALUE13

#define SPECENUM_VALUE13   EF_USER_FLAG_2

Definition at line 67 of file extras.h.

◆ SPECENUM_VALUE14

#define SPECENUM_VALUE14   EF_USER_FLAG_3

Definition at line 68 of file extras.h.

◆ SPECENUM_VALUE15

#define SPECENUM_VALUE15   EF_USER_FLAG_4

Definition at line 69 of file extras.h.

◆ SPECENUM_VALUE16

#define SPECENUM_VALUE16   EF_USER_FLAG_5

Definition at line 70 of file extras.h.

◆ SPECENUM_VALUE17

#define SPECENUM_VALUE17   EF_USER_FLAG_6

Definition at line 71 of file extras.h.

◆ SPECENUM_VALUE18

#define SPECENUM_VALUE18   EF_USER_FLAG_7

Definition at line 72 of file extras.h.

◆ SPECENUM_VALUE19

#define SPECENUM_VALUE19   EF_USER_FLAG_8

Definition at line 73 of file extras.h.

◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME   N_("?extraflag:Refuel")

Definition at line 34 of file extras.h.

◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2   EF_TERR_CHANGE_REMOVES

Definition at line 35 of file extras.h.

◆ SPECENUM_VALUE20

#define SPECENUM_VALUE20   EF_USER_FLAG_9

Definition at line 74 of file extras.h.

◆ SPECENUM_VALUE21

#define SPECENUM_VALUE21   EF_USER_FLAG_10

Definition at line 75 of file extras.h.

◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME   N_("?extraflag:TerrChangeRemoves")

Definition at line 36 of file extras.h.

◆ SPECENUM_VALUE3

#define SPECENUM_VALUE3   EF_AUTO_ON_CITY_CENTER

Definition at line 38 of file extras.h.

◆ SPECENUM_VALUE3NAME

#define SPECENUM_VALUE3NAME   N_("?extraflag:AutoOnCityCenter")

Definition at line 39 of file extras.h.

◆ SPECENUM_VALUE4

#define SPECENUM_VALUE4   EF_ALWAYS_ON_CITY_CENTER

Definition at line 41 of file extras.h.

◆ SPECENUM_VALUE4NAME

#define SPECENUM_VALUE4NAME   N_("?extraflag:AlwaysOnCityCenter")

Definition at line 42 of file extras.h.

◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5   EF_CONNECT_LAND

Definition at line 44 of file extras.h.

◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME   N_("?extraflag:ConnectLand")

Definition at line 45 of file extras.h.

◆ SPECENUM_VALUE6

#define SPECENUM_VALUE6   EF_GLOBAL_WARMING

Definition at line 47 of file extras.h.

◆ SPECENUM_VALUE6NAME

#define SPECENUM_VALUE6NAME   N_("?extraflag:GlobalWarming")

Definition at line 48 of file extras.h.

◆ SPECENUM_VALUE7

#define SPECENUM_VALUE7   EF_NUCLEAR_WINTER

Definition at line 50 of file extras.h.

◆ SPECENUM_VALUE7NAME

#define SPECENUM_VALUE7NAME   N_("?extraflag:NuclearWinter")

Definition at line 51 of file extras.h.

◆ SPECENUM_VALUE8

#define SPECENUM_VALUE8   EF_SHOW_FLAG

Definition at line 53 of file extras.h.

◆ SPECENUM_VALUE8NAME

#define SPECENUM_VALUE8NAME   N_("?extraflag:ShowFlag")

Definition at line 54 of file extras.h.

◆ SPECENUM_VALUE9

#define SPECENUM_VALUE9   EF_NATURAL_DEFENSE

Definition at line 57 of file extras.h.

◆ SPECENUM_VALUE9NAME

#define SPECENUM_VALUE9NAME   N_("?extraflag:NaturalDefense")

Definition at line 58 of file extras.h.

◆ SPECLIST_TAG

#define SPECLIST_TAG   extra_type

Definition at line 161 of file extras.h.

◆ SPECLIST_TYPE

#define SPECLIST_TYPE   struct extra_type

Definition at line 162 of file extras.h.

Function Documentation

◆ _extra_to_removed_by_list()

void _extra_to_removed_by_list ( struct extra_type pextra,
enum extra_rmcause  rmcause 
)

Add extra type to list of extra removed by given cause.

Definition at line 340 of file extras.c.

Referenced by extra_to_removed_by_list().

◆ activity_to_extra_cause()

enum extra_cause activity_to_extra_cause ( enum unit_activity  act)

◆ activity_to_extra_rmcause()

enum extra_rmcause activity_to_extra_rmcause ( enum unit_activity  act)

◆ can_build_extra()

bool can_build_extra ( const struct extra_type pextra,
const struct unit punit,
const struct tile ptile 
)

Tells if unit can build extra on tile.

Definition at line 533 of file extras.c.

Referenced by actres_possible(), can_unit_do_connect(), and next_extra_for_tile().

◆ can_build_extra_base()

bool can_build_extra_base ( const struct extra_type pextra,
const struct player pplayer,
const struct tile ptile 
)

Tells if player can build extra to tile with suitable unit.

Definition at line 413 of file extras.c.

Referenced by can_build_base(), can_build_extra(), can_build_road(), player_can_build_base(), player_can_build_extra(), and player_can_build_road().

◆ can_extra_appear()

bool can_extra_appear ( const struct extra_type pextra,
const struct tile ptile 
)

Are all the requirements for extra to appear on tile fulfilled.

Definition at line 1122 of file extras.c.

Referenced by end_turn().

◆ can_extra_disappear()

bool can_extra_disappear ( const struct extra_type pextra,
const struct tile ptile 
)

Are all the requirements for extra to disappear from tile fulfilled.

Definition at line 1136 of file extras.c.

Referenced by end_turn().

◆ can_extras_coexist()

bool can_extras_coexist ( const struct extra_type pextra1,
const struct extra_type pextra2 
)

◆ can_remove_extra()

bool can_remove_extra ( const struct extra_type pextra,
const struct unit punit,
const struct tile ptile 
)

Tells if unit can remove extra from tile. Does not examine action requirements if an action is required for it.

Definition at line 612 of file extras.c.

Referenced by actres_possible(), prev_cleanable_in_tile(), and prev_extra_in_tile().

◆ extra_by_number()

struct extra_type * extra_by_number ( int  id)

◆ extra_can_be_built()

bool extra_can_be_built ( const struct extra_type pextra,
const struct tile ptile 
)

Tells if extra can build to tile if all other requirements are met.

Definition at line 394 of file extras.c.

Referenced by can_build_extra_base().

◆ extra_causes_env_upset()

bool extra_causes_env_upset ( struct extra_type pextra,
enum environment_upset_type  upset 
)

Does the extra count toward environment upset?

Definition at line 1016 of file extras.c.

Referenced by update_environmental_upset().

◆ extra_conflicting_on_tile()

bool extra_conflicting_on_tile ( const struct extra_type pextra,
const struct tile ptile 
)

Returns TRUE iff an extra that conflicts with pextra exists at ptile.

Definition at line 680 of file extras.c.

Referenced by can_extra_appear().

◆ extra_count()

int extra_count ( void  )

Return the number of extra_types.

Definition at line 153 of file extras.c.

Referenced by fill_tile_edit_packet(), helptext_unit(), player_tile_init(), receive_packet_ruleset_terrain_100(), and tileset_setup_base().

◆ extra_flag_helptxt()

const char * extra_flag_helptxt ( enum extra_flag_id  id)

Return the (untranslated) help text of the user extra flag.

Definition at line 974 of file extras.c.

Referenced by helptext_extra(), save_terrain_ruleset(), and send_ruleset_extras().

◆ extra_flag_is_in_use()

bool extra_flag_is_in_use ( enum extra_flag_id  id)

Returns TRUE iff the specified extra type flag is in use by any extra type.

Parameters
idthe extra type flag to check if is in use.
Returns
TRUE if the extra type flag is used in the current ruleset.

Definition at line 987 of file extras.c.

Referenced by universal_never_there().

◆ extra_flags_free()

void extra_flags_free ( void  )

Frees the memory associated with all extra flags

Definition at line 921 of file extras.c.

Referenced by game_ruleset_free().

◆ extra_has_flag()

bool extra_has_flag ( const struct extra_type pextra,
enum extra_flag_id  flag 
)

◆ extra_name_translation()

const char * extra_name_translation ( const struct extra_type pextra)

◆ extra_number()

int extra_number ( const struct extra_type pextra)

◆ extra_owner()

struct player * extra_owner ( const struct tile ptile)

◆ extra_rule_name()

const char * extra_rule_name ( const struct extra_type pextra)

◆ extra_to_caused_by_list()

void extra_to_caused_by_list ( struct extra_type pextra,
enum extra_cause  cause 
)

Add extra type to list of extra caused by given cause.

Definition at line 312 of file extras.c.

Referenced by handle_ruleset_extra(), and load_ruleset_terrain().

◆ extra_to_removed_by_list()

static void extra_to_removed_by_list ( struct extra_type pextra,
enum extra_rmcause  rmcause 
)
inlinestatic

Wrapper around real _extra_to_removed_by_list(), notifying compiler about illegal parameters.

Definition at line 214 of file extras.h.

Referenced by handle_ruleset_extra(), and load_ruleset_terrain().

◆ extra_type_by_rule_name()

struct extra_type * extra_type_by_rule_name ( const char name)

◆ extra_type_by_translated_name()

struct extra_type * extra_type_by_translated_name ( const char name)

Returns extra type matching the translated name, or NULL if there is no extra type with that name.

Definition at line 235 of file extras.c.

Referenced by help_update_extra(), help_dialog::make_tree(), and help_widget::set_topic_extra().

◆ extra_type_list_by_cause()

struct extra_type_list * extra_type_list_by_cause ( enum extra_cause  cause)

◆ extra_type_list_by_rmcause()

struct extra_type_list * extra_type_list_by_rmcause ( enum extra_rmcause  rmcause)

Returns extra type list for given rmcause.

Definition at line 322 of file extras.c.

◆ extra_type_list_cleanable()

struct extra_type_list * extra_type_list_cleanable ( void  )

Returns extra type list of cleanables

Definition at line 332 of file extras.c.

◆ extra_type_list_of_terr_claimers()

struct extra_type_list * extra_type_list_of_terr_claimers ( void  )

◆ extra_type_list_of_unit_hiders()

struct extra_type_list * extra_type_list_of_unit_hiders ( void  )

Returns extra types that hide units.

Definition at line 259 of file extras.c.

Referenced by handle_ruleset_extra(), load_ruleset_terrain(), and player_can_trust_tile_has_no_units().

◆ extra_type_list_of_zoccers()

struct extra_type_list * extra_type_list_of_zoccers ( void  )

Returns extra types that cauze ZoC by themselves.

Definition at line 267 of file extras.c.

Referenced by handle_ruleset_extra(), is_plr_zoc_client(), is_plr_zoc_srv(), and load_ruleset_terrain().

◆ extras_free()

void extras_free ( void  )

Free the memory associated with extras

Definition at line 84 of file extras.c.

Referenced by game_ruleset_free().

◆ extras_init()

void extras_init ( void  )

Initialize extras structures.

Definition at line 45 of file extras.c.

Referenced by game_ruleset_init().

◆ hut_on_tile()

bool hut_on_tile ( const struct tile ptile)

Returns TRUE iff an extra on the tile is a hut (removed by entering). The effect of entering is handled by unit_enter_hut() in unittools.c

Definition at line 697 of file extras.c.

Referenced by adv_data_phase_init(), dai_unit_move(), explorer_desirable(), and is_valid_start_pos().

◆ is_extra_card_near()

bool is_extra_card_near ( const struct civ_map nmap,
const struct tile ptile,
const struct extra_type pextra 
)

Is there extra of the given type cardinally near tile? (Does not check ptile itself.)

Definition at line 363 of file extras.c.

Referenced by is_extra_req_active().

◆ is_extra_caused_by_action()

bool is_extra_caused_by_action ( const struct extra_type pextra,
const struct action paction 
)

Is the extra caused by specific worker action?

Definition at line 1056 of file extras.c.

Referenced by settler_evaluate_improvements(), and texai_tile_worker_task_select().

◆ is_extra_caused_by_worker_action()

bool is_extra_caused_by_worker_action ( const struct extra_type pextra)

Is the extra caused by some kind of worker action?

Definition at line 1032 of file extras.c.

Referenced by helptext_extra(), initialize_infrastructure_cache(), load_ruleset_terrain(), and save_terrain_ruleset().

◆ is_extra_flag_card_near()

bool is_extra_flag_card_near ( const struct civ_map nmap,
const struct tile ptile,
enum extra_flag_id  flag 
)

Returns TRUE iff any cardinally adjacent tile contains an extra with the given flag (does not check ptile itself).

Definition at line 870 of file extras.c.

Referenced by is_extraflag_req_active().

◆ is_extra_flag_near_tile()

bool is_extra_flag_near_tile ( const struct civ_map nmap,
const struct tile ptile,
enum extra_flag_id  flag 
)

Returns TRUE iff any adjacent tile contains an extra with the given flag (does not check ptile itself).

Definition at line 890 of file extras.c.

Referenced by is_extraflag_req_active().

◆ is_extra_near_tile()

bool is_extra_near_tile ( const struct civ_map nmap,
const struct tile ptile,
const struct extra_type pextra 
)

Is there extra of the given type near tile? (Does not check ptile itself.)

Definition at line 379 of file extras.c.

Referenced by is_extra_req_active().

◆ is_extra_removed_by()

bool is_extra_removed_by ( const struct extra_type pextra,
enum extra_rmcause  rmcause 
)

◆ is_extra_removed_by_action()

bool is_extra_removed_by_action ( const struct extra_type pextra,
const struct action paction 
)

Is the extra removed by specific worker action?

Definition at line 1066 of file extras.c.

Referenced by settler_evaluate_improvements(), and texai_tile_worker_task_select().

◆ is_extra_removed_by_worker_action()

bool is_extra_removed_by_worker_action ( const struct extra_type pextra)

Is the extra removed by some kind of worker action?

Definition at line 1045 of file extras.c.

Referenced by initialize_infrastructure_cache().

◆ is_native_extra_to_uclass()

bool is_native_extra_to_uclass ( const struct extra_type pextra,
const struct unit_class pclass 
)

◆ is_native_extra_to_utype()

bool is_native_extra_to_utype ( const struct extra_type pextra,
const struct unit_type punittype 
)

Is extra native to unit type?

Definition at line 852 of file extras.c.

Referenced by create_extra(), destroy_extra(), and tile_has_not_aggressive_extra_for_unit().

◆ is_native_tile_to_extra()

bool is_native_tile_to_extra ( const struct extra_type pextra,
const struct tile ptile 
)

Is tile native to extra?

Definition at line 633 of file extras.c.

Referenced by add_recursive_extras(), can_extra_appear(), create_city(), rand_extra_for_tile(), remove_city(), and tile_change_terrain().

◆ next_extra_for_tile()

struct extra_type * next_extra_for_tile ( const struct tile ptile,
enum extra_cause  cause,
const struct player pplayer,
const struct unit punit 
)

◆ player_can_build_extra()

bool player_can_build_extra ( const struct extra_type pextra,
const struct player pplayer,
const struct tile ptile 
)

Tells if player can build extra to tile with suitable unit.

Definition at line 468 of file extras.c.

Referenced by adv_calc_extra(), can_extra_be_removed(), impr_provides_buildable_extras(), next_extra_for_tile(), player_can_place_extra(), and upgrade_city_extras().

◆ player_can_place_extra()

bool player_can_place_extra ( const struct extra_type pextra,
const struct player pplayer,
const struct tile ptile 
)

Tells if player can place extra on tile.

Definition at line 488 of file extras.c.

Referenced by handle_player_place_infra(), and infra_placement_set_tile().

◆ player_can_remove_extra()

bool player_can_remove_extra ( const struct extra_type pextra,
const struct player pplayer,
const struct tile ptile 
)

Tells if player can remove extra from tile with suitable unit. Entering or Frightening huts are not considered.

Definition at line 591 of file extras.c.

Referenced by adv_calc_rmextra(), prev_cleanable_in_tile(), and prev_extra_in_tile().

◆ player_knows_extra_exist()

bool player_knows_extra_exist ( const struct player pplayer,
const struct extra_type pextra,
const struct tile ptile 
)

Extra is not hidden from the user.

Definition at line 1149 of file extras.c.

Referenced by send_tile_info(), and update_player_tile_knowledge().

◆ prev_cleanable_in_tile()

struct extra_type * prev_cleanable_in_tile ( const struct tile ptile,
const struct player pplayer,
const struct unit punit 
)

Returns prev cleanable extra that unit or player can remove from tile.

Definition at line 817 of file extras.c.

Referenced by real_menus_update().

◆ prev_extra_in_tile()

struct extra_type * prev_extra_in_tile ( const struct tile ptile,
enum extra_rmcause  rmcause,
const struct player pplayer,
const struct unit punit 
)

◆ rand_extra_for_tile()

struct extra_type * rand_extra_for_tile ( struct tile ptile,
enum extra_cause  cause,
bool  generated 
)

Return random extra type for given cause that is native to the tile.

Definition at line 283 of file extras.c.

Referenced by do_nuke_tile(), fair_map_make_huts(), make_huts(), and place_pollution().

◆ set_user_extra_flag_name()

void set_user_extra_flag_name ( enum extra_flag_id  id,
const char name,
const char helptxt 
)

Sets user defined name for extra flag.

Definition at line 933 of file extras.c.

Referenced by add_user_extra_flags_3_2(), handle_ruleset_extra_flag(), and load_terrain_names().

◆ unit_can_displace_hut()

bool unit_can_displace_hut ( const struct unit punit,
const struct tile ptile 
)

Returns TRUE iff the unit can enter or frighten any hut on the tile. For the unit, tests only its class and its owner.

Definition at line 738 of file extras.c.

Referenced by actres_possible().

◆ unit_can_enter_hut()

bool unit_can_enter_hut ( const struct unit punit,
const struct tile ptile 
)

Returns TRUE iff the unit can enter any hut on the tile. For the unit, tests only its class and its owner.

Definition at line 712 of file extras.c.

Referenced by dai_rampage_want(), and explorer_desirable().

◆ user_extra_flags_init()

void user_extra_flags_init ( void  )

Initialize user extra flags.

Definition at line 909 of file extras.c.

Referenced by game_ruleset_init().