From 8e4267586a56fd2e81e122fa03b574c72a9a1388 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Fri, 11 Jun 2021 12:27:44 +0200 Subject: [PATCH 14/14] Replace OnDomesticTile with DiplRelTile. See osdn #42516 --- common/fc_types.h | 22 ++++++++++------------ common/metaknowledge.c | 1 - common/reqtext.c | 12 ------------ common/requirements.c | 11 ----------- data/sandbox/game.ruleset | 6 +++--- data/webperimental/game.ruleset | 6 +++--- doc/README.effects | 3 +-- server/ruleset.c | 9 +++++++++ 8 files changed, 26 insertions(+), 44 deletions(-) diff --git a/common/fc_types.h b/common/fc_types.h index 29e2a42e4f..5a51ffe303 100644 --- a/common/fc_types.h +++ b/common/fc_types.h @@ -528,18 +528,16 @@ typedef int Unit_Class_id; #define SPECENUM_VALUE0NAME "Transported" #define SPECENUM_VALUE1 USP_LIVABLE_TILE #define SPECENUM_VALUE1NAME "OnLivableTile" -#define SPECENUM_VALUE2 USP_DOMESTIC_TILE -#define SPECENUM_VALUE2NAME "OnDomesticTile" -#define SPECENUM_VALUE3 USP_TRANSPORTING -#define SPECENUM_VALUE3NAME "Transporting" -#define SPECENUM_VALUE4 USP_HAS_HOME_CITY -#define SPECENUM_VALUE4NAME "HasHomeCity" -#define SPECENUM_VALUE5 USP_NATIVE_TILE -#define SPECENUM_VALUE5NAME "OnNativeTile" -#define SPECENUM_VALUE6 USP_NATIVE_EXTRA -#define SPECENUM_VALUE6NAME "InNativeExtra" -#define SPECENUM_VALUE7 USP_MOVED_THIS_TURN -#define SPECENUM_VALUE7NAME "MovedThisTurn" +#define SPECENUM_VALUE2 USP_TRANSPORTING +#define SPECENUM_VALUE2NAME "Transporting" +#define SPECENUM_VALUE3 USP_HAS_HOME_CITY +#define SPECENUM_VALUE3NAME "HasHomeCity" +#define SPECENUM_VALUE4 USP_NATIVE_TILE +#define SPECENUM_VALUE4NAME "OnNativeTile" +#define SPECENUM_VALUE5 USP_NATIVE_EXTRA +#define SPECENUM_VALUE5NAME "InNativeExtra" +#define SPECENUM_VALUE6 USP_MOVED_THIS_TURN +#define SPECENUM_VALUE6NAME "MovedThisTurn" #define SPECENUM_COUNT USP_COUNT #include "specenum_gen.h" diff --git a/common/metaknowledge.c b/common/metaknowledge.c index 227ac657a6..4796452995 100644 --- a/common/metaknowledge.c +++ b/common/metaknowledge.c @@ -208,7 +208,6 @@ static bool is_req_knowable(const struct player *pow_player, switch (req->source.value.unit_state) { case USP_TRANSPORTED: case USP_LIVABLE_TILE: - case USP_DOMESTIC_TILE: case USP_TRANSPORTING: case USP_NATIVE_TILE: case USP_NATIVE_EXTRA: diff --git a/common/reqtext.c b/common/reqtext.c index ec3ed3d67d..08dda837e1 100644 --- a/common/reqtext.c +++ b/common/reqtext.c @@ -1546,18 +1546,6 @@ bool req_text_insert(char *buf, size_t bufsz, struct player *pplayer, _("Requires that the unit isn't on livable tile.")); } return TRUE; - case USP_DOMESTIC_TILE: - fc_strlcat(buf, prefix, bufsz); - if (preq->present) { - cat_snprintf(buf, bufsz, - _("Requires that the unit is on a domestic " - "tile.")); - } else { - cat_snprintf(buf, bufsz, - _("Requires that the unit isn't on a domestic " - "tile.")); - } - return TRUE; case USP_TRANSPORTING: fc_strlcat(buf, prefix, bufsz); if (preq->present) { diff --git a/common/requirements.c b/common/requirements.c index d442bf20b6..da648d2377 100644 --- a/common/requirements.c +++ b/common/requirements.c @@ -2649,10 +2649,6 @@ static enum fc_tristate is_unit_state(const struct unit *target_unit, can_unit_exist_at_tile(&(wld.map), target_unit, unit_tile(target_unit))); break; - case USP_DOMESTIC_TILE: - return BOOL_TO_TRISTATE( - tile_owner(unit_tile(target_unit)) == unit_owner(target_unit)); - break; case USP_TRANSPORTING: return BOOL_TO_TRISTATE(0 < get_transporter_occupancy(target_unit)); case USP_HAS_HOME_CITY: @@ -4394,12 +4390,6 @@ const char *universal_name_translation(const struct universal *psource, * "Missile+On livable tile") */ _("On livable tile")); break; - case USP_DOMESTIC_TILE: - cat_snprintf(buf, bufsz, - /* TRANS: unit state. (appears in strings like - * "Missile+On domestic tile") */ - _("On domestic tile")); - break; case USP_TRANSPORTING: /* TRANS: unit state. (appears in strings like "Missile+Transported") */ cat_snprintf(buf, bufsz, _("Transporting")); @@ -5100,7 +5090,6 @@ static enum req_item_found ustate_found(const struct requirement *preq, case USP_NATIVE_TILE: /* USP_NATIVE_TILE isn't a strict subset of USP_LIVABLE_TILE. See * UTYF_COAST_STRICT. */ - case USP_DOMESTIC_TILE: case USP_HAS_HOME_CITY: case USP_NATIVE_EXTRA: case USP_MOVED_THIS_TURN: diff --git a/data/sandbox/game.ruleset b/data/sandbox/game.ruleset index 6652284b10..838f974d98 100644 --- a/data/sandbox/game.ruleset +++ b/data/sandbox/game.ruleset @@ -1464,8 +1464,8 @@ action = "Expel Unit" actor_reqs = { "type", "name", "range", "present" "UnitClassFlag", "BorderPolice", "Local", TRUE - "UnitState", "OnDomesticTile", "Local", TRUE - "DiplRel", "Foreign", "Local", TRUE + "DiplRelTile", "Foreign", "Local", FALSE + "DiplRel", "Foreign", "Local", TRUE "DiplRel", "Team", "Local", FALSE "DiplRel", "Alliance", "Local", FALSE "DiplRel", "War", "Local", FALSE @@ -1474,7 +1474,7 @@ actor_reqs = target_reqs = { "type", "name", "range", "present" "UnitClassFlag", "Expellable", "Local", TRUE - "UnitState", "OnDomesticTile", "Local", FALSE + "DiplRelTile", "Foreign", "Local", TRUE } [actionenabler_nuke] diff --git a/data/webperimental/game.ruleset b/data/webperimental/game.ruleset index 3efd9021fd..651bca157b 100644 --- a/data/webperimental/game.ruleset +++ b/data/webperimental/game.ruleset @@ -1176,8 +1176,8 @@ action = "Expel Unit" actor_reqs = { "type", "name", "range", "present" "UnitFlag", "BorderPolice", "Local", TRUE - "UnitState", "OnDomesticTile", "Local", TRUE - "DiplRel", "Foreign", "Local", TRUE + "DiplRelTile", "Foreign", "Local", FALSE + "DiplRel", "Foreign", "Local", TRUE "DiplRel", "Team", "Local", FALSE "DiplRel", "Alliance", "Local", FALSE "DiplRel", "War", "Local", FALSE @@ -1186,7 +1186,7 @@ actor_reqs = target_reqs = { "type", "name", "range", "present" "UnitFlag", "Expellable", "Local", TRUE - "UnitState", "OnDomesticTile", "Local", FALSE + "DiplRelTile", "Foreign", "Local", TRUE } ; The GameLoss unit requirement makes sending units on a suicide mission to diff --git a/doc/README.effects b/doc/README.effects index a8f51f907f..6ee37a8894 100644 --- a/doc/README.effects +++ b/doc/README.effects @@ -109,7 +109,7 @@ CityStatus is "OwnedByOriginal" DiplRel is a diplomatic relationship. MaxUnitsOnTile is about the number of units present on a tile. UnitState is "Transported", "Transporting", "OnNativeTile", "OnLivableTile", -"InNativeExtra", "OnDomesticTile", "MovedThisTurn" or "HasHomeCity". +"InNativeExtra", "MovedThisTurn" or "HasHomeCity". Activity is "Idle", "Pollution", "Mine", "Irrigate", "Fortified", "Pillage", "Transform", "Fortifying", "Fallout", "Base", "Road", "Convert", "Cultivate", or "Plant". @@ -754,6 +754,5 @@ The UnitState requirement type outside of a transport. "InNativeExtra" is fulfilled if the unit is on a tile with an extra native to it. -"OnDomesticTile" is fulfilled if the unit is on a tile owned by its player. "MovedThisTurn" is fulfilled if the unit has moved this turn. "HasHomeCity" is fulfilled if the unit has a home city. diff --git a/server/ruleset.c b/server/ruleset.c index b6296febab..b866058f74 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -751,6 +751,15 @@ struct requirement_vector *lookup_req_list(struct section_file *file, name = rscompat_req_name_3_1(type, name); } + if (compat->compat_mode) { + if (!fc_strcasecmp(type, "UnitState") + && !fc_strcasecmp(name, "OnDomesticTile")) { + type = "DiplRelTile"; + name = "Foreign"; + present = !present; + } + } + req = req_from_str(type, range, survives, present, quiet, name); if (req.source.kind == universals_n_invalid()) { ruleset_error(LOG_ERROR, "\"%s\" [%s] has invalid or unknown req: " -- 2.30.2