34 #define ADVANCE_REQ_ITER(it) ((struct advance_req_iter *) it)
42 #define ADVANCE_ROOT_REQ_ITER(it) ((struct advance_root_req_iter *) it)
97 && (atype < 0 || atype >=
game.
control.num_tech_types)) {
210 "Invalid tech_cost_style %d",
game.
info.tech_cost_style);
225 switch (
game.
info.tech_cost_style) {
226 case TECH_COST_CIV1CIV2:
227 case TECH_COST_LINEAR:
230 case TECH_COST_CLASSIC_PRESET:
231 if (-1 != padvance->cost) {
236 case TECH_COST_CLASSIC:
240 case TECH_COST_EXPERIMENTAL_PRESET:
241 if (-1 != padvance->cost) {
246 case TECH_COST_EXPERIMENTAL:
253 if (min_req && padvance->cost <
game.
info.base_tech_cost) {
254 padvance->cost =
game.
info.base_tech_cost;
258 if (padvance->tclass !=
nullptr) {
259 padvance->cost = padvance->cost * padvance->tclass->cost_pct / 100;
306 if (idx < 0 || idx >=
game.
control.num_tech_classes) {
340 for (i = 0; i <
game.
control.num_tech_classes; i++) {
381 int tfid =
id - TECH_USER_1;
393 if (helptxt && helptxt[0] !=
'\0') {
403 if (flag < TECH_USER_1 || flag > TECH_USER_LAST) {
415 fc_assert(
id >= TECH_USER_1 &&
id <= TECH_USER_LAST);
430 return (
game.
info.tech_leakage == TECH_LEAKAGE_NONE
431 &&
game.
info.tech_cost_style != TECH_COST_CIV1CIV2);
bool BV_ISSET(const BV &bv, int bit)
static void base(QVariant data1, QVariant data2)
Action "Build Base" for choice dialog.
#define MAX_NUM_TECH_CLASSES
void user_flag_init(struct user_flag *flag)
Initialize user flag.
void user_flag_free(struct user_flag *flag)
Free user flag.
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
static void name_set(struct name_translation *ptrans, const char *domain, const char *vernacular_name)
static const char * rule_name_get(const struct name_translation *ptrans)
static const char * name_translation_get(const struct name_translation *ptrans)
const struct advance ** end
const struct advance ** current
const struct advance * array[A_LAST]
const struct advance * array[A_LAST]
const struct advance ** current
const struct advance ** end
struct requirement_vector research_reqs
struct tech_class * tclass
struct advance * require[AR_SIZE]
struct name_translation name
QVector< QString > * helptext
struct packet_ruleset_control control
struct packet_game_info info
struct name_translation name
int fc_strcasecmp(const char *str0, const char *str1)
Compare strings like strcmp(), but ignoring case.
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.
static void advance_req_iter_next(struct iterator *it)
Jump to next advance requirement.
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.
#define ADVANCE_ROOT_REQ_ITER(it)
static struct user_flag user_tech_flags[MAX_NUM_USER_TECH_FLAGS]
struct advance advances[A_ARRAY_SIZE]
struct advance * advance_requires(const struct advance *padvance, enum tech_req require)
Accessor for requirements.
static void tech_free(Tech_type_id tech)
De-allocate resources associated with the given tech.
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.
static bool advance_root_req_iter_valid(const struct iterator *it)
Return whether we finished to iterate or not.
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.
struct tech_class tech_classes[MAX_NUM_TECH_CLASSES]
static void * advance_req_iter_get(const struct iterator *it)
Return the current advance.
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.
struct advance * valid_advance_by_number(const Tech_type_id id)
Returns pointer when the advance "exists" in this game, returns nullptr otherwise.
Tech_type_id advance_index(const struct advance *padvance)
Return the advance index.
static void * advance_root_req_iter_get(const struct iterator *it)
Return the current root_req.
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.
static bool advance_req_iter_valid(const struct iterator *it)
Return whether we finished to iterate or not.
const char * tech_flag_id_name_cb(enum tech_flag_id flag)
Tech flag name callback, called from specenum code.
static void advance_root_req_iter_next(struct iterator *it)
Jump to next advance which has a previously unseen root_req.
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.
#define ADVANCE_REQ_ITER(it)
void techs_init()
Initialize tech structures.
Tech_type_id advance_number(const struct advance *padvance)
Return the advance index.
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.
#define advance_index_iterate_end
#define advance_req_iterate(_goal, _padvance)
#define MAX_NUM_USER_TECH_FLAGS
#define advance_iterate(_start, _p)
#define advance_req_iterate_end
#define advance_iterate_end
#define advance_index_iterate(_start, _index)