33 #define B_LAST MAX_NUM_BUILDINGS
35 #define B_NEVER (nullptr)
38 #define SPECENUM_NAME impr_flag_id
40 #define SPECENUM_VALUE0 IF_VISIBLE_BY_OTHERS
41 #define SPECENUM_VALUE0NAME "VisibleByOthers"
43 #define SPECENUM_VALUE1 IF_SAVE_SMALL_WONDER
44 #define SPECENUM_VALUE1NAME "SaveSmallWonder"
46 #define SPECENUM_VALUE2 IF_GOLD
47 #define SPECENUM_VALUE2NAME "Gold"
49 #define SPECENUM_VALUE3 IF_DISASTER_PROOF
50 #define SPECENUM_VALUE3NAME "DisasterProof"
51 #define SPECENUM_COUNT IF_COUNT
52 #define SPECENUM_BITVECTOR bv_impr_flags
53 #include "specenum_gen.h"
66 struct requirement_vector
reqs;
71 enum impr_genus_id
genus;
101 enum impr_flag_id flag);
108 const struct tile *ptile,
112 int shields_in_stock);
136 #define WONDER_DESTROYED \
137 (MAX_NUM_PLAYER_SLOTS + 1)
139 #define WONDER_NOT_OWNED \
140 (MAX_NUM_PLAYER_SLOTS + 2)
142 #define WONDER_OWNED(player_id) ((player_id) < MAX_NUM_PLAYER_SLOTS)
145 #define WONDER_LOST (-1)
146 #define WONDER_NOT_BUILT 0
147 #define WONDER_BUILT(city_id) ((city_id) > 0)
173 const struct city *pcity);
195 #define improvement_iterate(_p) \
197 struct impr_type *_p = improvement_array_first(); \
198 if (nullptr != _p) { \
199 for (; _p <= improvement_array_last(); _p++) {
201 #define improvement_iterate_end \
206 #define improvement_re_active_iterate(_p) \
207 improvement_iterate(_p) \
209 if (!_p->ruledit_disabled) {
211 #define improvement_re_active_iterate_end \
214 improvement_iterate_end;
void improvements_free()
Frees the memory associated with all improvements.
bool can_sell_building(const struct impr_type *pimprove)
Return TRUE iff the improvement can be sold.
int impr_sell_gold(const struct impr_type *pimprove)
Returns the amount of gold received when this improvement is sold.
Impr_type_id improvement_count()
Return the number of improvements.
struct city * city_from_great_wonder(const struct impr_type *pimprove)
Get the world city with this great wonder.
bool can_city_sell_building(const struct city *pcity, const struct impr_type *pimprove)
Return TRUE iff the city can sell the given improvement.
bool can_player_build_improvement_direct(const struct player *p, const struct impr_type *pimprove)
Whether player can build given building somewhere, ignoring whether it is obsolete.
bool great_wonder_is_built(const struct impr_type *pimprove)
Returns whether this wonder is currently built.
const char * improvement_rule_name(const struct impr_type *pimprove)
Return the (untranslated) rule name of the improvement.
struct impr_type * improvement_array_first()
Return the first item of improvements.
bool is_special_improvement(const struct impr_type *pimprove)
Returns TRUE if this is a "special" improvement.
struct impr_type * improvement_by_rule_name(const char *name)
Does a linear search of improvement_types[].name.vernacular Returns nullptr when none match.
bool is_improvement_redundant(const struct city *pcity, const struct impr_type *pimprove)
Returns TRUE if an improvement in a city is redundant, that is, the city wouldn't lose anything by lo...
bool can_player_build_improvement_later(const struct player *p, const struct impr_type *pimprove)
Whether player can eventually build given building somewhere – i.e., returns TRUE if building is avai...
void wonder_built(const struct city *pcity, const struct impr_type *pimprove)
Build a wonder in the city.
struct city * city_from_small_wonder(const struct player *pplayer, const struct impr_type *pimprove)
Get the player city with this small wonder.
void improvements_init()
Initialize building structures.
void improvement_feature_cache_init()
Cache features of the improvement.
bool great_wonder_is_destroyed(const struct impr_type *pimprove)
Returns whether this wonder has been destroyed.
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
Returns pointer when the improvement_type "exists" in this game, returns nullptr otherwise.
bool wonder_is_lost(const struct player *pplayer, const struct impr_type *pimprove)
Returns whether the player has lost this wonder after having owned it (small or great).
bool can_player_build_improvement_now(const struct player *p, struct impr_type *pimprove)
Whether player can build given building somewhere immediately.
bool is_improvement(const struct impr_type *pimprove)
Is this building a regular improvement?
struct impr_type * improvement_by_number(const Impr_type_id id)
Returns the improvement type for the given index/ID.
bool wonder_is_built(const struct player *pplayer, const struct impr_type *pimprove)
Returns whether the player is currently in possession of this wonder (small or great) and it hasn't b...
int impr_base_build_shield_cost(const struct impr_type *pimprove)
Returns the base number of shields it takes to build this improvement.
Impr_type_id improvement_number(const struct impr_type *pimprove)
Return the improvement index.
const struct impr_type * improvement_array_last()
Return the last item of improvements.
bool can_improvement_go_obsolete(const struct impr_type *pimprove)
Return TRUE if the improvement can ever go obsolete.
bool is_improvement_visible(const struct impr_type *pimprove)
Return TRUE if the improvement should be visible to others without spying.
Impr_type_id improvement_index(const struct impr_type *pimprove)
Return the improvement index.
int impr_buy_gold_cost(const struct city *pcity, const struct impr_type *pimprove, int shields_in_stock)
Returns the amount of gold it takes to rush this improvement.
int impr_build_shield_cost(const struct city *pcity, const struct impr_type *pimprove)
Returns the number of shields it takes to build this improvement.
struct impr_type * improvement_by_translated_name(const char *name)
Does a linear search of improvement_types[].name.translated Returns nullptr when none match.
bool is_wonder(const struct impr_type *pimprove)
Returns whether improvement is some kind of wonder.
bool is_great_wonder(const struct impr_type *pimprove)
Is this building a great wonder?
bool improvement_obsolete(const struct player *pplayer, const struct impr_type *pimprove, const struct city *pcity)
Returns TRUE if the improvement or wonder is obsolete.
struct player * great_wonder_owner(const struct impr_type *pimprove)
Get the player owning this small wonder.
bool improvement_has_flag(const struct impr_type *pimprove, enum impr_flag_id flag)
Return TRUE if the impr has this flag otherwise FALSE.
void wonder_destroyed(const struct city *pcity, const struct impr_type *pimprove)
Remove a wonder from a city and destroy it if it's a great wonder.
const struct impr_type * improvement_replacement(const struct impr_type *pimprove)
Try to find a sensible replacement building, based on other buildings that may have caused this one t...
struct city * city_from_wonder(const struct player *pplayer, const struct impr_type *pimprove)
Get the world city with this wonder (small or great).
const char * improvement_name_translation(const struct impr_type *pimprove)
Return the (translated) name of the given improvement.
bool is_small_wonder(const struct impr_type *pimprove)
Is this building a small wonder?
enum test_result test_player_sell_building_now(struct player *pplayer, const city *pcity, const struct impr_type *pimprove)
Return TRUE iff the player can sell the given improvement from city.
BV_DEFINE(bv_imprs, B_LAST)
int impr_estimate_build_shield_cost(const struct player *pplayer, const struct tile *ptile, const struct impr_type *pimprove)
Returns estimate of the number of shields it takes to build this improvement.
bool great_wonder_is_available(const struct impr_type *pimprove)
Returns whether this wonder can be currently built.
bool is_improvement_productive(const struct city *pcity, const struct impr_type *pimprove)
Returns TRUE if an improvement in a city is productive, in some way.
char graphic_str[MAX_LEN_NAME]
char graphic_alt[MAX_LEN_NAME]
struct requirement_vector obsolete_by
char soundtag_alt[MAX_LEN_NAME]
struct requirement_vector reqs
struct name_translation name
QVector< QString > * helptext
char soundtag[MAX_LEN_NAME]