38 #define A_LAST (MAX_NUM_ADVANCES + 1)
39 #define A_FUTURE (A_LAST + 1)
40 #define A_ARRAY_SIZE (A_FUTURE + 1)
41 #define A_UNSET (A_LAST + 2)
42 #define A_UNKNOWN (A_LAST + 3)
44 #define A_NEVER (nullptr)
69 #define SPECENUM_NAME tech_flag_id
71 #define SPECENUM_VALUE0 TF_BONUS_TECH
74 #define SPECENUM_VALUE0NAME N_("Bonus_Tech")
76 #define SPECENUM_VALUE1 TF_BRIDGE
77 #define SPECENUM_VALUE1NAME N_("Bridge")
79 #define SPECENUM_VALUE2 TF_BUILD_AIRBORNE
80 #define SPECENUM_VALUE2NAME N_("Build_Airborne")
82 #define SPECENUM_VALUE3 TF_CLAIM_OCEAN
83 #define SPECENUM_VALUE3NAME N_("Claim_Ocean")
86 #define SPECENUM_VALUE4 TF_CLAIM_OCEAN_LIMITED
87 #define SPECENUM_VALUE4NAME N_("Claim_Ocean_Limited")
88 #define SPECENUM_VALUE5 TECH_USER_1
89 #define SPECENUM_VALUE6 TECH_USER_2
90 #define SPECENUM_VALUE7 TECH_USER_3
91 #define SPECENUM_VALUE8 TECH_USER_4
92 #define SPECENUM_VALUE9 TECH_USER_5
93 #define SPECENUM_VALUE10 TECH_USER_6
94 #define SPECENUM_VALUE11 TECH_USER_7
95 #define SPECENUM_VALUE12 TECH_USER_LAST
97 #define SPECENUM_COUNT TF_COUNT
98 #define SPECENUM_BITVECTOR bv_tech_flags
99 #define SPECENUM_NAMEOVERRIDE
100 #include "specenum_gen.h"
102 #define MAX_NUM_USER_TECH_FLAGS (TECH_USER_LAST - TECH_USER_1 + 1)
167 #define tech_class_index(_ptclass_) (_ptclass_)->idx
172 #define tech_class_iterate(_p) \
175 for (_i_##_p = 0; _i_##_p < game.control.num_tech_classes; _i_##_p++) { \
176 struct tech_class *_p = tech_class_by_number(_i_##_p);
178 #define tech_class_iterate_end \
182 #define tech_class_re_active_iterate(_p) \
183 tech_class_iterate(_p) \
185 if (!_p->ruledit_disabled) {
187 #define tech_class_re_active_iterate_end \
190 tech_class_iterate_end;
195 const char *helptxt);
221 #define advance_index_iterate(_start, _index) \
223 Tech_type_id _index = (_start); \
224 for (; _index < advance_count(); _index++) {
226 #define advance_index_iterate_end \
232 #define advance_iterate(_start, _p) \
234 struct advance *_p = advance_by_number(_start); \
235 if (nullptr != _p) { \
236 for (; _p <= advance_array_last(); _p++) {
238 #define advance_iterate_end \
243 #define advance_re_active_iterate(_p) \
244 advance_iterate(A_FIRST, _p) \
246 if (_p->require[AR_ONE] != A_NEVER) {
248 #define advance_re_active_iterate_end \
262 #define advance_req_iterate(_goal, _padvance) \
263 generic_iterate(struct advance_req_iter, const struct advance *, \
264 _padvance, advance_req_iter_sizeof, \
265 advance_req_iter_init, _goal)
266 #define advance_req_iterate_end generic_iterate_end
277 #define advance_root_req_iterate(_goal, _padvance) \
278 generic_iterate(struct advance_root_req_iter, const struct advance *, \
279 _padvance, advance_root_req_iter_sizeof, \
280 advance_root_req_iter_init, _goal)
281 #define advance_root_req_iterate_end generic_iterate_end
struct requirement_vector research_reqs
struct tech_class * tclass
struct advance * require[AR_SIZE]
struct name_translation name
char graphic_str[MAX_LEN_NAME]
char graphic_alt[MAX_LEN_NAME]
QVector< QString > * helptext
struct name_translation name
struct tech_class * tech_class_by_rule_name(const char *name)
Does a linear search of tech_classes[].name.vernacular Returns nullptr when none match.
struct advance * advance_by_translated_name(const char *name)
Does a linear search of advances[].name.translated Returns nullptr when none match.
void set_user_tech_flag_name(enum tech_flag_id id, const char *name, const char *helptxt)
Sets user defined name for tech flag.
bool is_future_tech(Tech_type_id tech)
Is the given tech a future tech.
const char * tech_class_name_translation(const struct tech_class *ptclass)
Return the (translated) name of the given tech_class You must not free the return pointer.
struct tech_class * tech_class_by_number(const int idx)
Return the tech_class for the given index.
struct iterator * advance_req_iter_init(struct advance_req_iter *it, const struct advance *goal)
Initialize an advance requirements iterator.
struct iterator * advance_root_req_iter_init(struct advance_root_req_iter *it, const struct advance *goal)
Initialize a root requirements iterator.
void tech_classes_init()
Initialize tech classes.
bool advance_has_flag(Tech_type_id tech, enum tech_flag_id flag)
Return TRUE if the tech has this flag otherwise FALSE.
struct advance * valid_advance(struct advance *padvance)
Returns pointer when the advance "exists" in this game, returns nullptr otherwise.
struct advance * valid_advance_by_number(const Tech_type_id atype)
Returns pointer when the advance "exists" in this game, returns nullptr otherwise.
struct advance * advance_requires(const struct advance *padvance, enum tech_req require)
Accessor for requirements.
struct advance * advance_by_rule_name(const char *name)
Does a linear search of advances[].name.vernacular Returns nullptr when none match.
const char * advance_rule_name(const struct advance *padvance)
Return the (untranslated) rule name of the advance/technology.
struct advance * advance_by_number(const Tech_type_id atype)
Return the advance for the given advance index.
const char * tech_class_rule_name(const struct tech_class *ptclass)
Return the (untranslated) rule name of tech_class You must not free the return pointer.
void techs_precalc_data()
Function to precalculate needed data for technologies.
const char * tech_flag_helptxt(enum tech_flag_id id)
Return the (untranslated) helptxt of the user tech flag.
Tech_type_id advance_required(const Tech_type_id tech, enum tech_req require)
Accessor for requirements.
size_t advance_root_req_iter_sizeof()
Return the size of the advance root requirements iterator.
size_t advance_req_iter_sizeof()
Return the size of the advance requirements iterator.
Tech_type_id advance_index(const struct advance *padvance)
Return the advance index.
bool techs_have_fixed_costs()
Returns true if the costs for the given technology will stay constant during the game.
void user_tech_flags_init()
Initialize user tech flags.
Tech_type_id advance_count()
Return the number of advances/technologies.
const struct advance * advance_array_last()
Return the last item of advances/technologies.
void techs_free()
De-allocate resources of all techs.
void techs_init()
Initialize tech structures.
Tech_type_id advance_number(const struct advance *padvance)
Return the advance index.
BV_DEFINE(bv_techs, A_LAST)
const char * advance_name_translation(const struct advance *padvance)
Return the (translated) name of the given advance/technology.
void user_tech_flags_free()
Frees the memory associated with all user tech flags.