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 #908582 ยป 0033-Add-minimum_turns-property-for-multipliers.patch

Marko Lindqvist, 2020-12-22 06:29 PM

View differences:

client/packhand.c
fc_assert(pinfo->multip_count == multiplier_count());
game.control.num_multipliers = pinfo->multip_count;
multipliers_iterate(pmul) {
pplayer->multipliers[multiplier_index(pmul)].value =
pinfo->multiplier[multiplier_index(pmul)];
pplayer->multipliers[multiplier_index(pmul)].target =
pinfo->multiplier_target[multiplier_index(pmul)];
int idx = multiplier_index(pmul);
pplayer->multipliers[idx].value = pinfo->multiplier[idx];
pplayer->multipliers[idx].target = pinfo->multiplier_target[idx];
pplayer->multipliers[idx].changed = pinfo->multiplier_changed[idx];
} multipliers_iterate_end;
/* if the server requests that the client reset, then information about
......
pmul->def = p->def;
pmul->offset = p->offset;
pmul->factor = p->factor;
pmul->minimum_turns = p->minimum_turns;
names_set(&pmul->name, NULL, p->name, p->rule_name);
common/multipliers.c
****************************************************************************/
bool multiplier_can_be_changed(struct multiplier *pmul, struct player *pplayer)
{
int idx = multiplier_index(pmul);
if (pplayer->multipliers[idx].changed > 0) {
/* It has been changed in the past, so require minimum_turns to have passed. */
if (game.info.turn - pplayer->multipliers[idx].changed < pmul->minimum_turns) {
return FALSE;
}
}
return are_reqs_active(pplayer, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, &pmul->reqs, RPT_CERTAIN);
}
common/multipliers.h
int def; /* default value, in display units */
int offset;
int factor;
int minimum_turns;
struct requirement_vector reqs;
struct strvec *helptext;
};
common/networking/packets.def
UINT8 multip_count;
SINT32 multiplier[MAX_NUM_MULTIPLIERS:multip_count];
SINT32 multiplier_target[MAX_NUM_MULTIPLIERS:multip_count];
TURN multiplier_changed[MAX_NUM_MULTIPLIERS:multip_count];
end
PACKET_PLAYER_PHASE_DONE = 52; cs, dsend
......
SINT32 def;
SINT32 offset;
SINT32 factor;
UINT16 minimum_turns;
STRING name[MAX_LEN_NAME];
STRING rule_name[MAX_LEN_NAME];
UINT8 reqs_count;
data/alien/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/civ1/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/civ2/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/civ2civ3/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/classic/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/experimental/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/granularity/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/multiplayer/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/ruledit/comments-3.1.txt
; effect_value = (ui_value + offset) * (factor/100)\n\
; Optional; by default offset=0, factor=100, so\n\
; that UI values are used as-is.\n\
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it\n\
; reqs = requirements for adjusting this policy (see README.effects)\n\
; helptext = optional help text string; should escape all raw\n\
; newlines so that xgettext parsing works\n\
data/sandbox/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/stub/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
data/webperimental/governments.ruleset
; effect_value = (ui_value + offset) * (factor/100)
; Optional; by default offset=0, factor=100, so
; that UI values are used as-is.
; minimum_turns = how often multiplier can be changed, or: how long one is stuck
; with the given value after changing to it
; reqs = requirements for adjusting this policy (see README.effects)
; helptext = optional help text string; should escape all raw
; newlines so that xgettext parsing works
fc_version
# - No new mandatory capabilities can be added to the release branch; doing
# so would break network capability of supposedly "compatible" releases.
#
NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2020.Dec.09"
NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2020.Dec.22"
FREECIV_DISTRIBUTOR=""
server/plrhand.c
packet->multip_count = multiplier_count();
if (info_level >= INFO_FULL) {
multipliers_iterate(pmul) {
packet->multiplier[multiplier_index(pmul)] =
plr->multipliers[multiplier_index(pmul)].value;
packet->multiplier_target[multiplier_index(pmul)] =
plr->multipliers[multiplier_index(pmul)].target;
int idx = multiplier_index(pmul);
packet->multiplier[idx] = plr->multipliers[idx].value;
packet->multiplier_target[idx] = plr->multipliers[idx].target;
packet->multiplier_changed[idx] = plr->multipliers[idx].changed;
} multipliers_iterate_end;
} else {
multipliers_iterate(pmul) {
packet->multiplier[multiplier_index(pmul)] = 0;
packet->multiplier_target[multiplier_index(pmul)] = 0;
int idx = multiplier_index(pmul);
packet->multiplier[idx] = 0;
packet->multiplier_target[idx] = 0;
packet->multiplier_changed[idx] = 0;
} multipliers_iterate_end;
}
server/ruleset.c
break;
}
pmul->minimum_turns = secfile_lookup_int_default(file, 0,
"%s.minimum_turns",
sec_name);
reqs = lookup_req_list(file, compat, sec_name, "reqs",
multiplier_rule_name(pmul));
if (reqs == NULL) {
......
packet.def = pmul->def;
packet.offset = pmul->offset;
packet.factor = pmul->factor;
packet.minimum_turns = pmul->minimum_turns;
sz_strlcpy(packet.name, untranslated_name(&pmul->name));
sz_strlcpy(packet.rule_name, rule_name_get(&pmul->name));
tools/ruleutil/rulesave.c
save_default_int(sfile, pmul->offset, 0, path, "offset");
save_default_int(sfile, pmul->factor, 100, path, "factor");
save_default_int(sfile, pmul->minimum_turns, 0, path, "minimum_turns");
save_reqs_vector(sfile, &(pmul->reqs), path, "reqs");
    (1-1/1)