40#define RESEARCH_ITER(p) ((struct research_iter *) p)
49#define RESEARCH_PLAYER_ITER(p) ((struct research_player_iter *) p)
51#define RESEARCH_ARRAY_SIZE MAX(MAX_NUM_PLAYER_SLOTS, MAX_NUM_TEAM_SLOTS)
130 if (
NULL == pplayer) {
172 const struct player *pplayer;
220 const char *new_name)
285 fc_snprintf(buffer,
sizeof(buffer),
_(
"Future Tech. %d"), no + 1);
366#define research_is_allowed(presearch, tech) \
367 research_allowed(presearch, tech, are_reqs_active)
375#define research_may_become_allowed(presearch, tech) \
376 research_allowed(presearch, tech, reqs_may_activate)
416 for (req = 0; req <
AR_SIZE; req++) {
458 for (req = 0; req <
AR_SIZE; req++) {
504 int techs_researched;
509 bool root_reqs_known =
TRUE;
521 state = (root_reqs_known
541 presearch->inventions[
i].reachable = reachable;
542 presearch->inventions[
i].root_reqs_known = root_reqs_known;
546 presearch->inventions[
i].num_required_techs = 0;
553 techs_researched =
presearch->techs_researched;
562 presearch->inventions[
i].num_required_techs++;
570 presearch->techs_researched = techs_researched;
591 presearch->inventions[
i].reachable ?
"" :
" [unrechable]",
593 ?
"" :
" [root reqs aren't known]");
600 presearch->num_known_tech_with_flag[flag] = 0;
605 presearch->num_known_tech_with_flag[flag]++;
626 return presearch->inventions[tech].state;
649 presearch->inventions[tech].state = value;
674 return presearch->inventions[tech].reachable;
701 ?
presearch->inventions[tech].root_reqs_known
758 return presearch->inventions[goal].num_required_techs;
760 return pgoal->num_reqs;
780 return presearch->inventions[goal].bulbs_required;
783 * (
pgoal->num_reqs + 1) / 2;
791 int bulbs_required = 0;
794 bulbs_required +=
preq->cost;
797 return bulbs_required;
894 "Invalid tech_cost_style %d", tech_cost_style);
896 switch (tech_cost_style) {
1039 if (
is_ai(pplayer)) {
1040 fc_assert(0 < pplayer->ai_common.science_cost);
1041 total_cost +=
base_cost * pplayer->ai_common.science_cost / 100.0;
1062 double tech_upkeep = 0.0;
1107 * (
f * (2 * t +
f + 1) + 2 * t) / 2);
1132 if (0.0 > tech_upkeep) {
1138 return (
int) tech_upkeep;
1179 return (0 <=
rit->index
1205 return (0 <=
rit->index
#define BV_ISSET(bv, bit)
static void base(QVariant data1, QVariant data2)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
static void * iterator_get(const struct iterator *it)
static void iterator_next(struct iterator *it)
#define fc_assert_msg(condition, message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
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 char * nation_plural_for_player(const struct player *pplayer)
struct player * player_by_number(const int player_id)
int player_slot_count(void)
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
bool player_slots_initialised(void)
bool player_has_embassy(const struct player *pplayer, const struct player *pplayer2)
static bool is_barbarian(const struct player *pplayer)
#define players_iterate_alive_end
#define players_iterate_alive(_pplayer)
enum req_unchanging_status is_req_preventing(const struct req_context *context, const struct req_context *other_context, const struct requirement *req, enum req_problem_type prob_type)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
int research_goal_unknown_techs(const struct research *presearch, Tech_type_id goal)
static struct research research_array[RESEARCH_ARRAY_SIZE]
bool research_invention_reachable(const struct research *presearch, const Tech_type_id tech)
bool research_goal_tech_req(const struct research *presearch, Tech_type_id goal, Tech_type_id tech)
const char * research_name_translation(const struct research *presearch)
#define research_may_become_allowed(presearch, tech)
enum tech_state research_invention_set(struct research *presearch, Tech_type_id tech, enum tech_state value)
static struct name_translation advance_unknown_name
struct research * research_by_number(int number)
#define RESEARCH_ARRAY_SIZE
const char * research_advance_rule_name(const struct research *presearch, Tech_type_id tech)
int player_tech_upkeep(const struct player *pplayer)
bool research_future_next(const struct research *presearch)
static void * research_player_iter_not_pooled_get(const struct iterator *it)
static void * research_iter_get(const struct iterator *it)
static bool research_iter_player_valid(const struct iterator *it)
static void * research_player_iter_pooled_get(const struct iterator *it)
static struct name_translation advance_unset_name
static void research_player_iter_not_pooled_next(struct iterator *it)
size_t research_iter_sizeof(void)
#define research_is_allowed(presearch, tech)
void researches_init(void)
static void research_player_iter_pooled_next(struct iterator *it)
static void research_iter_player_next(struct iterator *it)
static struct name_translation advance_future_name
static bool research_get_root_reqs_known(const struct research *presearch, Tech_type_id tech)
int research_number(const struct research *presearch)
static bool research_player_iter_valid_state(struct iterator *it)
int research_goal_bulbs_required(const struct research *presearch, Tech_type_id goal)
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
int research_total_bulbs_required(const struct research *presearch, Tech_type_id tech, bool loss_value)
static const struct name_translation * research_advance_name(Tech_type_id tech)
static bool research_allowed(const struct research *presearch, Tech_type_id tech, bool(*reqs_eval)(const struct req_context *context, const struct req_context *ocontext, const struct requirement_vector *reqs, const enum req_problem_type ptype))
struct iterator * research_iter_init(struct research_iter *it)
int recalculate_techs_researched(const struct research *presearch)
const char * research_rule_name(const struct research *presearch)
static struct strvec * future_rule_name
static bool research_get_reachable_rreqs(const struct research *presearch, Tech_type_id tech)
struct research * research_get(const struct player *pplayer)
void researches_free(void)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
static bool research_get_reachable(const struct research *presearch, Tech_type_id tech)
static bool research_player_iter_not_pooled_valid(const struct iterator *it)
static bool research_iter_team_valid(const struct iterator *it)
Tech_type_id research_goal_step(const struct research *presearch, Tech_type_id goal)
static bool reqs_may_activate(const struct req_context *context, const struct req_context *other_context, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
static bool research_player_iter_pooled_valid(const struct iterator *it)
#define RESEARCH_PLAYER_ITER(p)
size_t research_player_iter_sizeof(void)
static const char * research_future_set_name(struct strvec *psv, int no, const char *new_name)
struct iterator * research_player_iter_init(struct research_player_iter *it, const struct research *presearch)
static struct strvec * future_name_translation
void research_update(struct research *presearch)
static void research_iter_team_next(struct iterator *it)
int research_pretty_name(const struct research *presearch, char *buf, size_t buf_len)
#define research_players_iterate(_presearch, _pplayer)
#define researches_iterate(_presearch)
#define research_players_iterate_end
#define researches_iterate_end
void strvec_destroy(struct strvec *psv)
bool strvec_set(struct strvec *psv, size_t svindex, const char *string)
void strvec_reserve(struct strvec *psv, size_t reserve)
const char * strvec_get(const struct strvec *psv, size_t svindex)
struct strvec * strvec_new(void)
size_t strvec_size(const struct strvec *psv)
struct requirement_vector research_reqs
struct packet_ruleset_control control
struct packet_game_info info
bool(* valid)(const struct iterator *it)
bool team_pooled_research
enum tech_upkeep_style tech_upkeep_style
bool global_advances[A_LAST]
enum tech_leakage_style tech_leakage
enum tech_cost_style tech_cost_style
struct city_list * cities
int bulbs_researched_saved
struct player_list_link * plink
struct research::research_invention inventions[A_ARRAY_SIZE]
Tech_type_id researching_saved
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
struct team * team_by_number(const int team_id)
const char * team_name_translation(const struct team *pteam)
const char * team_rule_name(const struct team *pteam)
int team_number(const struct team *pteam)
bool team_slots_initialised(void)
int team_pretty_name(const struct team *pteam, char *buf, size_t buf_len)
const struct player_list * team_members(const struct team *pteam)
int team_slot_count(void)
struct advance * advance_by_number(const Tech_type_id atype)
bool is_future_tech(Tech_type_id tech)
struct advance * valid_advance(struct advance *padvance)
bool advance_has_flag(Tech_type_id tech, enum tech_flag_id flag)
struct advance * advance_requires(const struct advance *padvance, enum tech_req require)
struct advance * valid_advance_by_number(const Tech_type_id id)
Tech_type_id advance_required(const Tech_type_id tech, enum tech_req require)
const char * advance_rule_name(const struct advance *padvance)
Tech_type_id advance_number(const struct advance *padvance)
#define advance_index_iterate_max(_start, _index, _max)
#define advance_index_iterate_end
#define advance_req_iterate(_goal, _padvance)
#define advance_index_iterate_max_end
#define advance_req_iterate_end
static Tech_type_id advance_count(void)
#define advance_root_req_iterate_end
#define advance_iterate(_p)
#define advance_iterate_end
#define advance_index_iterate(_start, _index)
#define advance_root_req_iterate(_goal, _padvance)