Project

General

Profile

Feature #1186 ยป 0045-Unhardcode-Shield2Gold-unit-type-flag.patch

Marko Lindqvist, 12/12/2024 06:08 AM

View differences:

common/unittype.c
/* Switch shield upkeep to gold upkeep if
- the effect 'EFT_SHIELD2GOLD_FACTOR' is non-zero (it gives the
conversion factor in percent) and
- the unit has the corresponding flag set (UTYF_SHIELD2GOLD)
FIXME: Should the ai know about this? */
if (utype_has_flag(ut, UTYF_SHIELD2GOLD)
&& (otype == O_GOLD || otype == O_SHIELD)) {
if (otype == O_GOLD || otype == O_SHIELD) {
gold_upkeep_factor = get_target_bonus_effects(NULL,
&(const struct req_context) {
.player = pplayer,
data/goldkeep/effects.ruleset
type = "Shield2Gold_Factor"
value = 100
reqs =
{ "type", "name", "range"
"Tech", "The Corporation", "Player"
{ "type", "name", "range"
"Tech", "The Corporation", "Player"
"UnitTypeFlag", "Shield2Gold", "Local"
}
[effect_calendar_base]
doc/README.effects
Factor in percent for the conversion of unit shield upkeep to gold upkeep.
A value of 200 would transfer 1 shield upkeep to 2 gold upkeep.
This works on unit type granularity, properties of individual units
do not count. Note that only units with the "Shield2Gold" flag will
be affected by this.
do not count.
Shrink_Food
Food left after cities shrink is amount percent of the capacity of
server/ruleset/rscompat.c
**************************************************************************/
static bool effect_list_compat_cb(struct effect *peffect, void *data)
{
struct rscompat_info *info = (struct rscompat_info *)data;
if (info->version < RSFORMAT_3_3) {
if (peffect->type == EFT_SHIELD2GOLD_FACTOR) {
requirement_vector_append(&(peffect->reqs),
req_from_str("UnitTypeFlag", "Local",
FALSE, FALSE, FALSE,
"Shield2Gold"));
}
}
/* Go to the next effect. */
return TRUE;
}
    (1-1/1)