From 900190a955e9e229a9f8b30ef675a5b398f8fc83 Mon Sep 17 00:00:00 2001
From: JT Traub
Date: Fri, 3 May 2024 02:34:25 -0700
Subject: [PATCH] Update rules and fix a backwards comparison in the snapshot
diffs
---
genrules.cpp | 45 ++++++++----------
snapshot-tests/rules/fracas.html | 69 +++++++++++-----------------
snapshot-tests/rules/neworigins.html | 69 +++++++++++-----------------
snapshot-tests/run-rules-snapshot.sh | 2 +-
4 files changed, 75 insertions(+), 110 deletions(-)
diff --git a/genrules.cpp b/genrules.cpp
index e6c287f8..f5911380 100644
--- a/genrules.cpp
+++ b/genrules.cpp
@@ -2711,7 +2711,7 @@ int Game::GenRules(const AString &rules, const AString &css, const AString &intr
<< "A Quartermaster unit may accept " << url("#transport", "TRANSPORT") << "ed items from "
<< "any unit within " << Globals->LOCAL_TRANSPORT << ' ' << plural(Globals->LOCAL_TRANSPORT, "hex", "hexes")
<< " distance from the hex containing the quartermaster. Quartermasters may also "
- << url("#distribute", "DISTRIBUTE") << " items to any unit within " << Globals->LOCAL_TRANSPORT
+ << url("#transport", "TRANSPORT") << " items to any unit within " << Globals->LOCAL_TRANSPORT
<< ' ' << plural(Globals->LOCAL_TRANSPORT, "hex", "hexes") << " distance from the hex containing the "
<< "quartermaster and may " << url("#transport", "TRANSPORT") << " items to another quartermaster up to "
<< Globals->NONLOCAL_TRANSPORT << ' ' << plural(Globals->NONLOCAL_TRANSPORT, "hex", "hexes") << " distant.";
@@ -2754,13 +2754,13 @@ int Game::GenRules(const AString &rules, const AString &css, const AString &intr
<< (Globals->FACTION_LIMIT_TYPE == GameDefs::FACLIM_FACTION_TYPES
? ", and a faction is limited in the number of quartermasters it may have at any one time"
: "")
- << ". Both the " << url("#transport", "TRANSPORT") << " and " << url("#distribute", "DISTRIBUTE")
- << " orders count as trade activity in the hex of the unit issuing the order. The target unit must be at "
- << "least FRIENDLY to the unit which issues the order.\n"
+ << ". The " << url("#transport", "TRANSPORT") << " order counts as trade activity in "
+ << "the hex of the unit issuing the order. The target unit must be at least FRIENDLY "
+ << "to the unit which issues the order.\n"
<< enclose("p", false);
f << enclose("p", true) << "Not all type of items can be " << url("#transport", "TRANSPORT") << "ed to "
- << "or " << url("#distribute", "DISTRIBUTE") << "d by a quartermaster. Men (including Leaders), "
+ << "or " << url("#transport", "TRANSPORT") << "ed by a quartermaster. Men (including Leaders), "
<< "summoned creatures (including illusionary ones), ships, mounts, war machines, and items created "
<< "using artifact lore need to be carried/sailed from one location to another by a unit.\n"
<< enclose("p", false);
@@ -3893,23 +3893,6 @@ int Game::GenRules(const AString &rules, const AString &css, const AString &intr
<< "DESTROY\n"
<< example_end();
- if (qm_exist) {
- f << enclose(class_tag("div", "rule"), true) << '\n' << enclose("div", false);
- f << anchor("distribute") << '\n';
- f << enclose("h4", true) << "DISTRIBUTE [unit] [num] [item]\n" << enclose("h4", false);
- f << enclose("h4", true) << "DISTRIBUTE [unit] ALL [item]\n" << enclose("h4", false);
- f << enclose("h4", true) << "DISTRIBUTE [unit] ALL [item] EXCEPT [amount]\n" << enclose("h4", false);
- f << enclose("p", true) << "Distribute the specified items to the given friendly unit. In the second form, "
- << "all of that item are distributed. In the last form, all of that item except for the specified amount "
- << "are distributed. The unit issuing the distribute order must have the quartermaster skill, and be the "
- << "owner of a transport structure. Use of this order counts as trade activity in the hex.\n"
- << enclose("p", false);
- f << enclose("p", true) << "Examples:\n" << enclose("p", false);
- f << example_start("Distribute 10 STON to unit 1234")
- << "DISTRIBUTE 1234 10 STON\n"
- << example_end();
- }
-
f << enclose(class_tag("div", "rule"), true) << '\n' << enclose("div", false);
f << anchor("enter") << '\n';
f << enclose("h4", true) << "ENTER [object]\n" << enclose("h4", false);
@@ -4761,6 +4744,9 @@ int Game::GenRules(const AString &rules, const AString &css, const AString &intr
<< "unit must also be a quartermaster and be the owner of a transport structure. Use of this order "
<< "counts as trade activity in the hex.\n"
<< enclose("p", false);
+ f << enclose("p", true) << "For historical reasons, the order DISTRIBUTE can be "
+ << "used in place of TRANSPORT and has the same meaning and syntax.\n"
+ << enclose("p", false);
f << enclose("p", true) << "Examples:\n" << enclose("p", false);
f << example_start("Transport 10 STON to unit 1234")
<< "TRANSPORT 1234 10 STON\n"
@@ -4988,9 +4974,18 @@ int Game::GenRules(const AString &rules, const AString &css, const AString &intr
f << enclose("li", true) << "Teleportation spells are " << url("#cast", "CAST") << ".\n" << enclose("li", false);
if (qm_exist) {
- f << enclose("li", true) << url("#transport", "TRANSPORT") << " and " << url("#distribute", "DISTRIBUTE")
- << " orders are processed.\n"
- << enclose("li", false);
+ f << enclose("li", true) << url("#transport", "TRANSPORT") << " orders are processed "
+ << "in multiple phases. In each phase all units in all hexes are processed before "
+ << "starting the next phase. Items may move in each of the phases but only once in each phase.\n";
+ f << enclose("ol", true);
+ f << enclose("li", true) << "Items are sent from non-quartermaster units to "
+ << "quartermaster units.\n" << enclose("li", false);
+ f << enclose("li", true) << "Items are sent from one quartermaster unit to "
+ << "another quartermaster units.\n" << enclose("li", false);
+ f << enclose("li", true) << "Items are sent a quartermaster unit to "
+ << "non-quartermaster units.\n" << enclose("li", false);
+ f << enclose("ol", false);
+ f << enclose("li", false);
}
f << enclose("li", true) << "Maintenance costs are assessed.\n" << enclose("li", false);
f << enclose("OL", false);
diff --git a/snapshot-tests/rules/fracas.html b/snapshot-tests/rules/fracas.html
index 72f1e487..fa6dcbea 100644
--- a/snapshot-tests/rules/fracas.html
+++ b/snapshot-tests/rules/fracas.html
@@ -3364,7 +3364,7 @@
Trade factions may train Quartermaster units. A Quartermaster unit may
accept TRANSPORTed items from any unit within 2
hexes distance from the hex containing the quartermaster. Quartermasters
- may also DISTRIBUTE items to any unit within 2
+ may also TRANSPORT items to any unit within 2
hexes distance from the hex containing the quartermaster and may TRANSPORT items to another quartermaster up to 6
hexes distant. The distance a quartermaster can
Quartermasters must be single man units, and a faction is limited in the
- number of quartermasters it may have at any one time. Both the TRANSPORT and DISTRIBUTE
- orders count as trade activity in the hex of the unit issuing the order.
- The target unit must be at least FRIENDLY to the unit which issues the
- order.
+ number of quartermasters it may have at any one time. The TRANSPORT order counts as trade activity in the
+ hex of the unit issuing the order. The target unit must be at least
+ FRIENDLY to the unit which issues the order.
Not all type of items can be TRANSPORTed to or
- DISTRIBUTEd by a quartermaster. Men (including
+ TRANSPORTed by a quartermaster. Men (including
Leaders), summoned creatures (including illusionary ones), ships,
mounts, war machines, and items created using artifact lore need to be
carried/sailed from one location to another by a unit.
@@ -5379,39 +5378,6 @@
-
-
-
- DISTRIBUTE [unit] [num] [item]
-
-
- DISTRIBUTE [unit] ALL [item]
-
-
- DISTRIBUTE [unit] ALL [item] EXCEPT [amount]
-
-
- Distribute the specified items to the given friendly unit. In the second
- form, all of that item are distributed. In the last form, all of that
- item except for the specified amount are distributed. The unit issuing
- the distribute order must have the quartermaster skill, and be the owner
- of a transport structure. Use of this order counts as trade activity in
- the hex.
-
-
- Examples:
-
-
- Distribute 10 STON to unit 1234
-
-
-
-
-
-DISTRIBUTE 1234 10 STON
-
-
-
@@ -6889,6 +6855,10 @@
transport structure. Use of this order counts as trade activity in the
hex.
+
+ For historical reasons, the order DISTRIBUTE can be used in place of
+ TRANSPORT and has the same meaning and syntax.
+
Examples:
@@ -7274,8 +7244,23 @@
Teleportation spells are CAST.
- TRANSPORT and DISTRIBUTE orders are processed.
+ TRANSPORT orders are processed in multiple
+ phases. In each phase all units in all hexes are processed before
+ starting the next phase. Items may move in each of the phases but
+ only once in each phase.
+
+ -
+ Items are sent from non-quartermaster units to quartermaster
+ units.
+
+ -
+ Items are sent from one quartermaster unit to another
+ quartermaster units.
+
+ -
+ Items are sent a quartermaster unit to non-quartermaster units.
+
+
Maintenance costs are assessed.
diff --git a/snapshot-tests/rules/neworigins.html b/snapshot-tests/rules/neworigins.html
index 704f010c..51a0ae5b 100644
--- a/snapshot-tests/rules/neworigins.html
+++ b/snapshot-tests/rules/neworigins.html
@@ -3755,7 +3755,7 @@
+ For historical reasons, the order DISTRIBUTE can be used in place of
+ TRANSPORT and has the same meaning and syntax.
+
Examples:
@@ -7715,8 +7685,23 @@
Teleportation spells are CAST.
- TRANSPORT and DISTRIBUTE orders are processed.
+ TRANSPORT orders are processed in multiple
+ phases. In each phase all units in all hexes are processed before
+ starting the next phase. Items may move in each of the phases but
+ only once in each phase.
+
+ -
+ Items are sent from non-quartermaster units to quartermaster
+ units.
+
+ -
+ Items are sent from one quartermaster unit to another
+ quartermaster units.
+
+ -
+ Items are sent a quartermaster unit to non-quartermaster units.
+
+
Maintenance costs are assessed.
diff --git a/snapshot-tests/run-rules-snapshot.sh b/snapshot-tests/run-rules-snapshot.sh
index b72649e8..aaa6a2c5 100755
--- a/snapshot-tests/run-rules-snapshot.sh
+++ b/snapshot-tests/run-rules-snapshot.sh
@@ -35,7 +35,7 @@ rm -f ./engine-output.txt
# Clean up the Last Change: timestamp line so that comparisons can work
sed -e 's/Last Change:.*$/Last Change: __STRIPPED_FOR_COMPARISON__/' ${game}.html > ${game}.html.strip
-diff -ur ${game}.html.strip rules/${game}.html &> rules-difference.txt
+diff -ur rules/${game}.html ${game}.html.strip &> rules-difference.txt
if [[ $? != 0 ]]; then
echo "output differed. -- Test failed."
cat rules-difference.txt