Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #923137 ยป 0001-effect_cumulative_max-support-many-universals.patch

Sveinung Kvilhaugsvik, 2021-03-19 07:29 AM

View differences:

client/helpdata.c
|| (effect_cumulative_max(EFT_FORTIFY_DEFENSE_BONUS,
&(struct universal){
.kind = VUT_UTYPE,
.value = { .utype = utype }})
.value = { .utype = utype }},
1)
<= 0)) {
cat_snprintf(buf, bufsz,
/* TRANS: indented unit action property, preserve
common/city.c
int rs_max_city_radius_sq(void)
{
int max_rad = game.info.init_city_radius_sq
+ effect_cumulative_max(EFT_CITY_RADIUS_SQ, NULL);
+ effect_cumulative_max(EFT_CITY_RADIUS_SQ, NULL, 0);
return MIN(max_rad, CITY_MAP_MAX_RADIUS_SQ);
}
common/effects.c
mutually exclusive effects).
for_uni can be NULL to get max effect value ignoring requirements.
**************************************************************************/
int effect_cumulative_max(enum effect_type type, struct universal *for_uni)
int effect_cumulative_max(enum effect_type type, struct universal *unis,
size_t n_unis)
{
struct effect_list *plist = ruleset_cache.tracker;
int value = 0;
fc_assert_ret_val(((unis == NULL && n_unis == 0)
|| (unis != NULL && n_unis > 0)),
0);
if (plist) {
effect_list_iterate(plist, peffect) {
if (peffect->type == type && peffect->value > 0) {
if (for_uni == NULL
|| universal_fulfills_requirements(FALSE, &(peffect->reqs),
for_uni)) {
if (unis == NULL
|| !universals_mean_unfulfilled(&(peffect->reqs), unis, n_unis)) {
value += peffect->value;
}
}
common/effects.h
void recv_ruleset_effect(const struct packet_ruleset_effect *packet);
void send_ruleset_cache(struct conn_list *dest);
int effect_cumulative_max(enum effect_type type, struct universal *for_uni);
int effect_cumulative_max(enum effect_type type, struct universal *unis,
size_t n_unis);
int effect_cumulative_min(enum effect_type type, struct universal *for_uni);
int effect_value_from_universals(enum effect_type type,
server/rssanity.c
}
if (num_role_units(L_PARTISAN) == 0
&& effect_cumulative_max(EFT_INSPIRE_PARTISANS, NULL) > 0) {
&& effect_cumulative_max(EFT_INSPIRE_PARTISANS, NULL, 0) > 0) {
ruleset_error(LOG_ERROR,
"Inspire_Partisans effect present, but no units with partisan role.");
return FALSE;
......
for (i = 0; boolean_effects[i] != EFT_COUNT; i++) {
if (effect_cumulative_min(boolean_effects[i], NULL) < 0
&& effect_cumulative_max(boolean_effects[i], NULL) == 0) {
&& effect_cumulative_max(boolean_effects[i], NULL, 0) == 0) {
ruleset_error(LOG_ERROR, "Boolean effect %s can get disabled, but it can't get "
"enabled before that.", effect_type_name(boolean_effects[i]));
ret = FALSE;
    (1-1/1)