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 #750025 ยป 0001-Fortify-action-be-consistent-WRT-flags.patch

Sveinung Kvilhaugsvik, 2018-04-26 12:46 PM

View differences:

common/actions.c
"domestic target.",
ACTION_UPGRADE_UNIT, ACTION_NONE);
/* Why this is a hard requirement:
* - Preserve semantics of CanFortify unit class flag and the Cant_Fortify
* unit type flag.
* - Corner case that should be worked out: The point of ACTION_FORTIFY
* is to get into the state ACTIVITY_FORTIFIED. ACTIVITY_FORTIFIED has
* two consequences:
* 1) Slightly higher hitpoint regeneration. See hp_gain_coord()
* 2) Increased defensive power when attacked. But being in a city has
* the same effect. UCF_CAN_FORTIFY and UTYF_CANT_FORTIFY currently
* control if a unit in a city/in the ACTIVITY_FORTIFIED state gets
* the bonus. See defense_multiplication()
* - A few other uses should be replaced before these can be demoted to
* ruleset defined flags.
*/
oblig_hard_req_register(req_from_values(VUT_UCFLAG, REQ_RANGE_LOCAL,
FALSE, FALSE, TRUE,
UCF_CAN_FORTIFY),
FALSE,
"All action enablers for %s must require that "
"the actor has the CanFortify uclass flag.",
ACTION_FORTIFY, ACTION_NONE);
oblig_hard_req_register(req_from_values(VUT_UTFLAG, REQ_RANGE_LOCAL,
FALSE, TRUE, TRUE,
UTYF_CANT_FORTIFY),
FALSE,
"All action enablers for %s must require that "
"the actor doesn't have the Cant_Fortify utype "
"flag.",
ACTION_FORTIFY, ACTION_NONE);
/* Why this is a hard requirement: Preserve semantics of NoHome
* flag. Need to replace other uses in game engine before this can
* be demoted to a regular unit flag. */
......
}
break;
case ACTION_FORTIFY:
if (utype_has_flag(actor_unittype, UTYF_CANT_FORTIFY)) {
/* Reason: Shouldn't have "Can't fortify" flag. */
return FALSE;
}
break;
case ACTION_CONVERT:
if (!actor_unittype->converted_to) {
/* Reason: must be able to convert to something. */
......
case ACTION_CONQUER_CITY:
case ACTION_HEAL_UNIT:
case ACTION_PILLAGE:
case ACTION_FORTIFY:
/* No hard unit type requirements. */
break;
data/alien/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
data/civ1/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
data/civ2/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
data/civ2civ3/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
data/classic/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
data/experimental/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
data/multiplayer/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
data/sandbox/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
data/webperimental/game.ruleset
[actionenabler_fortify]
action = "Fortify"
actor_reqs =
{ "type", "name", "range"
"UnitClassFlag", "CanFortify", "Local"
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
}
[actionenabler_road]
doc/README.actions
"Fortify" - Fortify at tile
* UI name can be set using ui_name_fortify
* the actor unit has "CanFortify" unit class flag
* the actor unit has "CanFortify" unit class flag (!)
* the actor unit can't have the "Cant_Fortify" unit type flag (!)
* terrain type must be one where fortifying is possible
Actions done by a unit to it self
server/rscompat.c
enabler = action_enabler_new();
enabler->action = ACTION_CONVERT;
action_enabler_add(enabler);
/* Update action enablers. */
action_enablers_iterate(ae) {
if (action_enabler_obligatory_reqs_missing(ae)) {
/* Add previously implicit obligatory hard requirement(s). */
action_enabler_obligatory_reqs_add(ae);
}
} action_enablers_iterate_end;
}
/* The ruleset may need adjustments it didn't need before compatibility
    (1-1/1)