77 int num_cities_nonzero =
MAX(1, city_list_size(pplayer->
cities));
83 memset(values, 0,
sizeof(values));
92 bool real_found =
FALSE;
127 values[k] += plr_data->
tech_want[i] / steps;
145 goal_values[i] = values[i];
148 goal_values[i] += values[k];
155 goal_values[i] /= steps;
160 values[i], goal_values[i]);
171 if (values[i] > values[newtech]
175 if (goal_values[i] > goal_values[newgoal]
182#ifdef REALLY_DEBUG_THIS
187 "turn end want: %d", values[
id]);
194 choice->
want = values[newtech] / num_cities_nonzero;
196 / num_cities_nonzero);
201 goal->
want = goal_values[newgoal] / num_cities_nonzero;
203 / num_cities_nonzero);
205 "num_cities_nonzero = %d",
208 goal_values[newgoal],
245 return final_want - orig_want;
263 && aplayer->team == pplayer->
team
264 && aplayer != pplayer) {
294 if (VUT_ADVANCE == preq->source.kind
295 && preq->source.value.advance == padv) {
296 present = preq->present;
323 tech_want = v * 14 / 8;
348 if (!
is_ai(aplayer)) {
361 "new research, was %s, penalty was %d",
395 int best_avl_def = 0;
407 int mp_pct = deftype->cache.defense_mp_bonuses_pct[att_idx] + 100;
408 int scramble = deftype->cache.scramble_coeff[att_idx];
410 CBONUS_DEFENSE_DIVIDER_PCT)
412 CBONUS_DEFENSE_DIVIDER);
414 int def = deftype->defense_strength
415 * (scramble ? scramble : defbonus * mp_pct) / div_bonus_pct;
420 if (def > best_avl_def) {
428 if (def_values[
utype_index(deftype)] > best_avl_def
434 struct advance *itech = deftype->require_advance;
435 bool impossible_to_get =
FALSE;
457 if (VUT_ADVANCE == preq->source.kind && preq->present) {
466 itech = preq->source.value.advance;
472 impossible_to_get =
TRUE;
478 if (
cost < best_cost && !impossible_to_get
492 && def_values[
utype_index(best_unit)] <= 1.5 * best_avl_def) {
499 "+ %d for %s by role",
514 struct city *pcity,
int role,
int want)
525 for (i =
n - 1; i >= 0; i--) {
546 if (VUT_ADVANCE == preq->source.kind && preq->present) {
558 itech = preq->source.value.advance;
580 if (build_unit != NULL) {
586 "+ %d for %s by role",
struct adv_data * adv_data_get(struct player *pplayer, bool *caller_closes)
#define TECH_LOG(ait, loglevel, pplayer, padvance, msg,...)
static struct ai_plr * def_ai_player_data(const struct player *pplayer, struct ai_type *deftype)
static adv_want dai_tech_base_want(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct advance *padv)
struct unit_type * dai_wants_defender_against(struct ai_type *ait, const struct civ_map *nmap, struct player *pplayer, struct city *pcity, const struct unit_type *att, int want)
void dai_clear_tech_wants(struct ai_type *ait, struct player *pplayer)
void dai_manage_tech(struct ai_type *ait, struct player *pplayer)
static void dai_select_tech(struct ai_type *ait, struct player *pplayer, struct ai_tech_choice *choice, struct ai_tech_choice *goal)
static void dai_tech_effect_values(struct ai_type *ait, struct player *pplayer)
struct unit_type * dai_wants_role_unit(struct ai_type *ait, struct player *pplayer, struct city *pcity, int role, int want)
const struct impr_type * utype_needs_improvement(const struct unit_type *putype, const struct city *pcity)
bool is_capital(const struct city *pcity)
bool can_city_build_unit_now(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
bool can_city_build_unit_later(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
#define city_list_iterate_end
int combat_bonus_against(const struct combat_bonus_list *list, const struct unit_type *enemy, enum combat_bonus_type type)
adv_want dai_city_want(struct player *pplayer, struct city *acity, struct adv_data *adv, struct impr_type *pimprove)
bool dai_can_requirement_be_met_in_city(const struct requirement *preq, const struct player *pplayer, const struct city *pcity)
adv_want dai_effect_value(struct player *pplayer, const struct adv_data *adv, const struct city *pcity, const bool capital, int turns, const struct effect *peffect, const int c, const int nplayers)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int cost
struct effect_list * get_req_source_effects(struct universal *psource)
int get_unittype_bonus(const struct player *pplayer, const struct tile *ptile, const struct unit_type *punittype, const struct action *paction, enum effect_type effect_type)
#define effect_list_iterate_end
#define effect_list_iterate(effect_list, peffect)
static GtkWidget * source
bool can_player_build_improvement_direct(const struct player *p, const struct impr_type *pimprove)
#define log_debug(message,...)
const char * player_name(const struct player *pplayer)
#define players_iterate_end
#define players_iterate(_pplayer)
int normal_player_count(void)
bool is_req_active(const struct req_context *context, const struct player *other_player, const struct requirement *req, const 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)
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)
enum tech_state research_invention_set(struct research *presearch, Tech_type_id tech, enum tech_state value)
const char * research_advance_rule_name(const struct research *presearch, Tech_type_id tech)
int research_goal_bulbs_required(const struct research *presearch, Tech_type_id goal)
int research_total_bulbs_required(const struct research *presearch, Tech_type_id tech, bool loss_value)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
#define research_players_iterate(_presearch, _pplayer)
#define research_players_iterate_end
adv_want tech_want[A_LAST+1]
struct packet_game_info info
struct requirement_vector reqs
bool global_advances[A_LAST]
struct city_list * cities
const struct impr_type * building
const struct player * player
struct advance * require_advance
struct combat_bonus_list * bonuses
struct advance * advance_by_number(const Tech_type_id atype)
bool is_future_tech(Tech_type_id tech)
struct advance * valid_advance_by_number(const Tech_type_id id)
const char * advance_rule_name(const struct advance *padvance)
Tech_type_id advance_index(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_index_iterate_max_end
#define advance_iterate(_start, _p)
static Tech_type_id advance_count(void)
#define advance_iterate_end
#define advance_index_iterate(_start, _index)
struct unit_type * get_role_unit(int role, int role_index)
int num_role_units(int role)
const char * utype_rule_name(const struct unit_type *punittype)
Unit_type_id utype_index(const struct unit_type *punittype)
#define unit_type_iterate(_p)
#define unit_type_iterate_end