Remove the Edit Saved Item Rectangles menu item in favour of a toolbar button.

The limit of 3 saved item rectangles has been removed - you can now add as many as you want.
However, the 1 per town limit is now strictly enforced.

The saved item rectangle is now shown with a cyan border when editing town.
This commit is contained in:
2025-03-02 15:19:56 -05:00
committed by Celtic Minstrel
parent c60d151ed3
commit a1bc923de8
30 changed files with 103 additions and 205 deletions

View File

@@ -100,14 +100,9 @@ TEST_CASE("Converting legacy scenario data") {
CHECK(scen.special_items[1].special == -1);
}
SECTION("With item storage rects") {
REQUIRE(scen.store_item_rects.size() >= 3);
REQUIRE(scen.store_item_towns.size() >= 3);
CHECK(scen.store_item_rects[0] == rect(1,2,3,4));
CHECK(scen.store_item_towns[0] == 0);
CHECK(scen.store_item_rects[1] == rect(2,4,6,8));
CHECK(scen.store_item_towns[1] == 1);
CHECK(scen.store_item_rects[2] == rect(1,8,2,9));
CHECK(scen.store_item_towns[2] == 2);
}
SECTION("With item storage shortcuts") {
REQUIRE(scen.storage_shortcuts.size() >= 1);

View File

@@ -203,7 +203,6 @@ TEST_CASE("Loading a new-format scenario record") {
REQUIRE(scen.store_item_rects.size() >= 1);
REQUIRE(scen.store_item_rects.size() >= 1);
CHECK(scen.store_item_rects[0] == rectangle(12,13,20,36));
CHECK(scen.store_item_towns[0] == 0);
REQUIRE(scen.town_mods.size() >= 1);
CHECK(scen.town_mods[0] == loc(16,21));
CHECK(scen.town_mods[0].spec == 1);
@@ -275,7 +274,7 @@ TEST_CASE("Loading a new-format scenario record") {
SECTION("Too many") {
fin.open("files/scenario/too_many_rects.xml");
doc = xmlDocFromStream(fin, "too_many_rects.xml");
REQUIRE_THROWS_AS(readScenarioFromXml(move(doc), scen), xBadNode);
REQUIRE_THROWS_AS(readScenarioFromXml(move(doc), scen), xBadVal);
}
}
SECTION("With an invalid timer") {

View File

@@ -94,10 +94,7 @@ TEST_CASE("Saving a scenario record") {
REQUIRE(scen.town_mods.size() >= 1); // A safety valve for if I ever make this array dynamic
scen.town_mods[0] = loc(12,9);
scen.town_mods[0].spec = 4;
REQUIRE(scen.store_item_towns.size() >= 1); // A safety valve for if I ever make this array dynamic
REQUIRE(scen.store_item_rects.size() >= 1); // A safety valve for if I ever make this array dynamic
scen.store_item_rects[0] = rect(1,2,3,4);
scen.store_item_towns[0] = 5;
scen.store_item_rects[5] = rect(1,2,3,4);
REQUIRE(scen.scenario_timers.size() >= 1); // A safety valve for if I ever make this array dynamic
scen.scenario_timers[0].node = 3;
scen.scenario_timers[0].node_type = eSpecCtxType::OUTDOOR;
@@ -107,8 +104,7 @@ TEST_CASE("Saving a scenario record") {
in_and_out("optional", scen);
CHECK(scen.town_mods[0] == loc(12,9));
CHECK(scen.town_mods[0].spec == 4);
CHECK(scen.store_item_rects[0] == rect(1,2,3,4));
CHECK(scen.store_item_towns[0] == 5);
CHECK(scen.store_item_rects[5] == rect(1,2,3,4));
CHECK(scen.scenario_timers[0].node == 3);
CHECK(scen.scenario_timers[0].node_type == eSpecCtxType::SCEN); // This is inferred by the fact that it's in the scenario file
CHECK(scen.scenario_timers[0].time == 30000);