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 #877498 ยป 0020-Move-NoFortify-to-the-ruleset.patch

Sveinung Kvilhaugsvik, 2020-06-12 04:55 PM

View differences:

client/helpdata.c
_("* Units on this terrain may impose a zone of control, or "
"be restricted by one.\n"));
}
if (terrain_has_flag(pterrain, TER_NO_FORTIFY)) {
CATLSTR(buf, bufsz,
_("* No units can fortify on this terrain.\n"));
} else {
CATLSTR(buf, bufsz,
_("* Units able to fortify may do so on this terrain.\n"));
}
for (flagid = TER_USER_1 ; flagid <= TER_USER_LAST; flagid++) {
if (terrain_has_flag(pterrain, flagid)) {
const char *helptxt = terrain_flag_helptxt(flagid);
common/actions.c
if (actor_unit->activity == ACTIVITY_FORTIFIED) {
return TRI_NO;
}
pterrain = tile_terrain(actor_tile);
if (terrain_has_flag(pterrain, TER_NO_FORTIFY)
&& !tile_city(actor_tile)) {
return TRI_NO;
}
break;
case ACTRES_TRANSPORT_ALIGHT:
common/terrain.h
/* Units on this terrain are not generating or subject to zoc */
#define SPECENUM_VALUE7 TER_NO_ZOC
#define SPECENUM_VALUE7NAME N_("NoZoc")
/* No unit can fortify on this terrain */
#define SPECENUM_VALUE8 TER_NO_FORTIFY
#define SPECENUM_VALUE8NAME N_("NoFortify")
/* Ice-covered terrain (affects minimap) */
#define SPECENUM_VALUE9 TER_FROZEN
#define SPECENUM_VALUE9NAME N_("Frozen")
#define SPECENUM_VALUE10 TER_USER_1
#define SPECENUM_VALUE11 TER_USER_2
#define SPECENUM_VALUE12 TER_USER_3
#define SPECENUM_VALUE13 TER_USER_4
#define SPECENUM_VALUE14 TER_USER_5
#define SPECENUM_VALUE15 TER_USER_6
#define SPECENUM_VALUE16 TER_USER_7
#define SPECENUM_VALUE17 TER_USER_8
#define SPECENUM_VALUE18 TER_USER_9
#define SPECENUM_VALUE19 TER_USER_LAST
#define SPECENUM_VALUE8 TER_FROZEN
#define SPECENUM_VALUE8NAME N_("Frozen")
#define SPECENUM_VALUE9 TER_USER_1
#define SPECENUM_VALUE10 TER_USER_2
#define SPECENUM_VALUE11 TER_USER_3
#define SPECENUM_VALUE12 TER_USER_4
#define SPECENUM_VALUE13 TER_USER_5
#define SPECENUM_VALUE14 TER_USER_6
#define SPECENUM_VALUE15 TER_USER_7
#define SPECENUM_VALUE16 TER_USER_8
#define SPECENUM_VALUE17 TER_USER_9
#define SPECENUM_VALUE18 TER_USER_LAST
#define SPECENUM_NAMEOVERRIDE
#define SPECENUM_BITVECTOR bv_terrain_flags
#include "specenum_gen.h"
data/alien/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/alien/terrain.ruleset
{ "name", "helptxt"
_("Radiating"), _("Terrain has alien radiation.")
_("NoPollution"), _("No Pollution nor Fallout appear here.")
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/civ1/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/civ1/terrain.ruleset
; as part of some sentences, so try to make it descriptive
; and sensible.
; helptxt = displayed in the help for terrains with this flag (optional)
;flags =
; { "name", "helptxt"
; }
flags =
{ "name", "helptxt"
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
; name = rule name; In some circumstances user may see this
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/civ2/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/civ2/terrain.ruleset
; as part of some sentences, so try to make it descriptive
; and sensible.
; helptxt = displayed in the help for terrains with this flag (optional)
;flags =
; { "name", "helptxt"
; }
flags =
{ "name", "helptxt"
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
; name = rule name; In some circumstances user may see this
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/civ2civ3/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/civ2civ3/terrain.ruleset
_("Oil"), _("Mine can be upgraded to Oil Well.")
_("Sea"), _("Allows cities to build Harbors and coastal wonders.")
_("NoPollution"), _("No Pollution nor Fallout appear here.")
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/classic/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/classic/terrain.ruleset
{ "name", "helptxt"
_("Oil"), _("Has Oil Well instead of Mine.")
_("NoPollution"), _("No Pollution nor Fallout appear here.")
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/experimental/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/experimental/terrain.ruleset
{ "name", "helptxt"
_("Oil"), _("Has Oil Well instead of Mine.")
_("NoPollution"), _("No Pollution nor Fallout appear here.")
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/granularity/terrain.ruleset
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/multiplayer/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/multiplayer/terrain.ruleset
{ "name", "helptxt"
_("Oil"), _("Has Oil Well instead of Mine.")
_("NoPollution"), _("No Pollution nor Fallout appear here.")
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/sandbox/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/sandbox/terrain.ruleset
_("Sea"), _("Allows cities to build Harbors and coastal wonders.")
_("NoPollution"), _("No Pollution nor Fallout appear here.")
_("DifficultLanding"), _("Only veterans can paradrop here.")
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/stub/terrain.ruleset
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
data/webperimental/game.ruleset
"UnitFlag", "Settlers", "Local", TRUE
}
[actionenabler_fortify]
[actionenabler_fortify_terrain]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"TerrainFlag", "NoFortify", "Local", FALSE
}
[actionenabler_fortify_city]
action = "Fortify"
actor_reqs =
{ "type", "name", "range", "present"
"UnitClassFlag", "CanFortify", "Local", TRUE
"UnitFlag", "Cant_Fortify", "Local", FALSE
"CityTile", "Center", "Local", TRUE
}
[actionenabler_road]
data/webperimental/terrain.ruleset
{ "name", "helptxt"
_("Oil"), _("Has Oil Well instead of Mine.")
_("NoPollution"), _("No Pollution nor Fallout appear here.")
_("NoFortify"), _("No units can fortify on this terrain.")
}
; Names for custom extra flags. There can be up to 8 of these.
......
; (lua scripting)
; - NoZoc = Units on this terrain are not generating or subject
; to zoc
; - NoFortify = Units cannot fortify on this terrain
; - Frozen = Frozen/polar terrain. For water tiles, Frozen terrain
; is generated near poles. Conversion between frozen
; and unfrozen terrain can be controlled with
doc/README.actions
* UI name can be set using ui_name_fortify
* 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
"Convert Unit" - Convert the unit to another unit type.
* UI name can be set using ui_name_convert_unit
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.Jun.14"
NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2020.Jun.14b"
FREECIV_DISTRIBUTOR=""
server/rscompat.c
return MAX_NUM_USER_UCLASS_FLAGS;
}
/**********************************************************************//**
Find and return the first unused terrain user flag. If all terrain
user flags are taken MAX_NUM_USER_TER_FLAGS is returned.
**************************************************************************/
static int first_free_terrain_user_flag(void)
{
int flag;
/* Find the first unused user defined terrain flag. */
for (flag = 0; flag < MAX_NUM_USER_TER_FLAGS; flag++) {
if (terrain_flag_id_name_cb(flag + TER_USER_1) == NULL) {
return flag;
}
}
/* All terrain user flags are taken. */
return MAX_NUM_USER_TER_FLAGS;
}
/**********************************************************************//**
Do compatibility things with names before they are referred to. Runs
after names are loaded from the ruleset but before the ruleset objects
......
}
}
if (info->ver_terrain < 20) {
/* Some terrain flags moved to the ruleset between 3.0 and 3.1.
* Add them back as user flags.
* XXX: ruleset might not need all of these, and may have enough
* flags of its own that these additional ones prevent conversion. */
const struct {
const char *name;
const char *helptxt;
} new_flags_31[] = {
{ N_("NoFortify"), N_("No units can fortify on this terrain.") },
};
int first_free;
int i;
/* Terrain flags. */
first_free = first_free_terrain_user_flag() + TER_USER_1;
for (i = 0; i < ARRAY_SIZE(new_flags_31); i++) {
if (TER_USER_1 + MAX_NUM_USER_TER_FLAGS <= first_free + i) {
/* Can't add the user terrain flags. */
ruleset_error(LOG_ERROR,
"Can't upgrade the ruleset. Not enough free terrain "
"user flags to add user flags for the terrain flags "
"that used to be hardcoded.");
return FALSE;
}
/* Shouldn't be possible for valid old ruleset to have flag names that
* clash with these ones */
if (terrain_flag_id_by_name(new_flags_31[i].name, fc_strcasecmp)
!= terrain_flag_id_invalid()) {
ruleset_error(LOG_ERROR,
"Ruleset had illegal user terrain flag '%s'",
new_flags_31[i].name);
return FALSE;
}
set_user_terrain_flag_name(first_free + i,
new_flags_31[i].name,
new_flags_31[i].helptxt);
}
}
/* No errors encountered. */
return TRUE;
}
......
e_req = req_from_values(VUT_UCFLAG, REQ_RANGE_LOCAL, FALSE, TRUE, FALSE,
UCF_CAN_FORTIFY);
requirement_vector_append(&enabler->actor_reqs, e_req);
e_req = req_from_str("TerrainFlag", "Local", FALSE, FALSE, TRUE,
"NoFortify");
requirement_vector_append(&enabler->actor_reqs, e_req);
action_enabler_add(enabler);
enabler = action_enabler_new();
enabler->action = ACTION_FORTIFY;
e_req = req_from_values(VUT_UCFLAG, REQ_RANGE_LOCAL, FALSE, TRUE, FALSE,
UCF_CAN_FORTIFY);
requirement_vector_append(&enabler->actor_reqs, e_req);
e_req = req_from_str("CityTile", "Local", FALSE, TRUE, TRUE,
"Center");
requirement_vector_append(&enabler->actor_reqs, e_req);
action_enabler_add(enabler);
enabler = action_enabler_new();
    (1-1/1)