159 case VUT_IMPROVEMENT:
190 requirement_vector_init(&peffect->
reqs);
233 requirement_vector_append(&peffect->
reqs, req);
236 effect_list_append(eff_list, peffect);
278 requirement_vector_free(&peffect->reqs);
281 effect_list_destroy(tracker_list);
289 effect_list_destroy(plist);
298 effect_list_destroy(plist);
307 effect_list_destroy(plist);
316 effect_list_destroy(plist);
338 || (unis != NULL && n_unis > 0)),
343 if (peffect->type ==
type) {
344 if (peffect->value > 0) {
347 value += peffect->value;
349 }
else if (requirement_vector_size(&peffect->reqs) == 0) {
351 value += peffect->value;
374 if (peffect->type ==
type) {
375 if (peffect->value < 0) {
379 value += peffect->value;
381 }
else if (requirement_vector_size(&peffect->reqs) == 0) {
383 value += peffect->value;
409 bool effect_applies =
TRUE;
410 bool first_source_mentioned =
FALSE;
412 if (peffect->multiplier) {
420 bool req_mentioned_a_source =
FALSE;
422 for (i = 0; effect_applies && i < n_unis; i++) {
429 req_mentioned_a_source =
TRUE;
432 effect_applies =
FALSE;
436 req_mentioned_a_source =
TRUE;
439 first_source_mentioned =
TRUE;
444 effect_applies =
FALSE;
449 if (!req_mentioned_a_source) {
452 effect_applies =
FALSE;
454 if (!effect_applies) {
460 if (!first_source_mentioned) {
465 if (effect_applies) {
466 value += peffect->value;
493 int guaranteed_min_effect_value = 0;
501 if (peffect->multiplier) {
509 guaranteed_min_effect_value += peffect->value;
510 }
else if (peffect->value < 0) {
512 guaranteed_min_effect_value += peffect->value;
518 return guaranteed_min_effect_value >= min_value;
561 if (peffect->multiplier) {
571 effect_packet.
reqs[counter++] = *req;
591 .
kind = VUT_IMPROVEMENT,
602 if (peffect->type == effect_type) {
619 const struct player *other_player,
620 const struct effect *peffect,
645 struct effect_list *plist;
647 .
kind = VUT_IMPROVEMENT,
648 .value = {.building = pimprove}
667 .building = pimprove,
670 peffect, prob_type)) {
693 const struct player *other_player,
694 enum effect_type effect_type)
698 if (context == NULL) {
710 if (peffect->multiplier) {
712 bonus += (peffect->value
714 peffect->multiplier)) / 100;
717 bonus += peffect->value;
721 effect_list_append(plist, peffect);
737 const struct player *other_player,
738 enum effect_type effect_type,
740 void *data,
int n_data)
744 if (context == NULL) {
750 sum += weighter(peffect, context, other_player, data, n_data);
772 enum effect_type effect_type)
810 enum effect_type effect_type)
820 .specialist = pspecialist,
839 const struct tile *ptile,
841 enum effect_type effect_type)
863 const struct tile *ptile,
865 enum effect_type effect_type)
885 enum effect_type effect_type)
908 enum effect_type effect_type)
932 enum effect_type effect_type)
943 .building = building,
958 const struct tile *ptile,
960 const struct action *paction,
961 enum effect_type effect_type)
982 .unittype = punittype,
1018 enum effect_type etype)
1020 struct player *pplayer = NULL;
1029 if (
punit != NULL) {
1053 const struct player *pplayer,
1054 enum effect_type effect_type)
1076 const struct city *pcity,
1078 enum effect_type effect_type)
1105 enum effect_type effect_type,
1114 pcity, effect_type, prob_type,
TRUE);
1127 const struct city *pcity,
1128 enum effect_type effect_type,
1130 bool consider_multipliers)
1133 .value = {.building = pimprove}};
1137 if (pcity != NULL) {
1146 .building = pimprove,
1150 bool present =
TRUE;
1153 if (peffect->type != effect_type) {
1158 if (VUT_IMPROVEMENT == preq->source.kind
1159 && preq->source.value.building == pimprove) {
1160 present = preq->present;
1174 val = peffect->value;
1176 val = -peffect->value;
1179 if (consider_multipliers && peffect->multiplier) {
1198 char *buf,
size_t buf_len)
1209 if (!preq->present) {
1212 if (buf[0] !=
'\0') {
1217 buf + strlen(buf), buf_len - strlen(buf));
1250 if (!cb(peffect, data)) {
#define city_tile(_pcity_)
#define city_owner(_pcity_)
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 * punit
void effect_remove(struct effect *peffect)
void recv_ruleset_effect(const struct packet_ruleset_effect *packet)
struct effect_list * effects[EFT_COUNT]
struct effect_list * govs[G_LAST]
struct effect_list * tracker
bool effect_universals_value_never_below(enum effect_type type, struct universal *unis, size_t n_unis, int min_value)
struct effect_list * get_req_source_effects(struct universal *psource)
int get_tile_output_bonus(const struct city *pcity, const struct tile *ptile, const struct output_type *poutput, enum effect_type effect_type)
int get_player_output_bonus(const struct player *pplayer, const struct output_type *poutput, enum effect_type effect_type)
int get_city_specialist_output_bonus(const struct city *pcity, const struct specialist *pspecialist, const struct output_type *poutput, enum effect_type effect_type)
bool is_building_replaced(const struct city *pcity, const struct impr_type *pimprove, const enum req_problem_type prob_type)
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct player *other_player, enum effect_type effect_type)
int get_player_bonus_effects(struct effect_list *plist, const struct player *pplayer, enum effect_type effect_type)
bool iterate_effect_cache(iec_cb cb, void *data)
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
int get_current_construction_bonus(const struct city *pcity, enum effect_type effect_type, const enum req_problem_type prob_type)
int get_city_bonus_effects(struct effect_list *plist, const struct city *pcity, const struct output_type *poutput, enum effect_type effect_type)
struct effect * effect_copy(struct effect *old)
static bool is_effect_prevented(const struct req_context *context, const struct player *other_player, const struct effect *peffect, const enum req_problem_type prob_type)
int get_unit_vs_tile_bonus(const struct tile *ptile, const struct unit *punit, enum effect_type etype)
int get_unit_bonus(const struct unit *punit, enum effect_type effect_type)
int get_city_output_bonus(const struct city *pcity, const struct output_type *poutput, enum effect_type effect_type)
int get_potential_improvement_bonus(const struct impr_type *pimprove, const struct city *pcity, enum effect_type effect_type, const enum req_problem_type prob_type, bool consider_multipliers)
void send_ruleset_cache(struct conn_list *dest)
void get_effect_req_text(const struct effect *peffect, char *buf, size_t buf_len)
static struct @21 ruleset_cache
struct effect_list * buildings[B_LAST]
void ruleset_cache_free(void)
struct effect * effect_new(enum effect_type type, int value, struct multiplier *pmul)
int get_building_bonus(const struct city *pcity, const struct impr_type *building, enum effect_type effect_type)
int effect_value_from_universals(enum effect_type type, struct universal *unis, size_t n_unis)
int get_city_tile_output_bonus(const struct city *pcity, const struct tile *ptile, const struct output_type *poutput, enum effect_type effect_type)
int effect_cumulative_max(enum effect_type type, struct universal *unis, size_t n_unis)
void ruleset_cache_init(void)
struct effect_list * advances[A_LAST]
int get_world_bonus(enum effect_type effect_type)
int effect_cumulative_min(enum effect_type type, struct universal *for_uni)
struct effect_list * get_effects(enum effect_type effect_type)
bool building_has_effect(const struct impr_type *pimprove, enum effect_type effect_type)
double get_effect_expected_value(const struct req_context *context, const struct player *other_player, enum effect_type effect_type, eft_value_filter_cb weighter, void *data, int n_data)
void effect_req_append(struct effect *peffect, struct requirement req)
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)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
void get_effect_list_req_text(const struct effect_list *plist, struct astring *astr)
int effect_value_will_make_positive(enum effect_type type)
#define effect_list_iterate_end
double(* eft_value_filter_cb)(const struct effect *eft, const struct req_context *context, const struct player *other_player, void *data, int n_data)
bool(* iec_cb)(struct effect *, void *data)
#define effect_list_iterate(effect_list, peffect)
Government_type_id government_count(void)
static GtkWidget * source
struct impr_type * improvement_by_number(const Impr_type_id id)
Impr_type_id improvement_number(const struct impr_type *pimprove)
Impr_type_id improvement_count(void)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
const char * multiplier_name_translation(const struct multiplier *pmul)
Multiplier_type_id multiplier_number(const struct multiplier *pmul)
struct multiplier * multiplier_by_number(Multiplier_type_id id)
void lsend_packet_ruleset_effect(struct conn_list *dest, const struct packet_ruleset_effect *packet)
int player_multiplier_effect_value(const struct player *pplayer, const struct multiplier *pmul)
const struct req_context * req_context_empty(void)
void universal_extraction(const struct universal *source, int *kind, int *value)
bool universal_fulfills_requirements(bool check_necessary, const struct requirement_vector *reqs, const struct universal *source)
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)
bool are_reqs_active(const struct req_context *context, const struct player *other_player, const struct requirement_vector *reqs, const enum req_problem_type prob_type)
enum req_item_found universal_fulfills_requirement(const struct requirement *preq, const struct universal *source)
bool universals_say_everything(struct requirement_vector *reqs, struct universal *unis, size_t n_unis)
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
bool universals_mean_unfulfilled(struct requirement_vector *reqs, struct universal *unis, size_t n_unis)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
void strvec_destroy(struct strvec *psv)
void strvec_append(struct strvec *psv, const char *string)
struct strvec * strvec_new(void)
const char * strvec_to_and_list(const struct strvec *psv, struct astring *astr)
struct universal production
struct multiplier * multiplier
struct requirement_vector reqs
struct requirement reqs[MAX_NUM_REQS]
Multiplier_type_id multiplier
enum effect_type effect_type
const struct player * player
size_t fc_strlcat(char *dest, const char *src, size_t n)
static Tech_type_id advance_count(void)
struct city * tile_city(const struct tile *ptile)
#define tile_owner(_tile)
const struct impr_type * building
const struct unit_type * unit_type_get(const struct unit *punit)