Gather all enchantment info into a single place

This also resolves several TODO notes about duplicate code and makes cPresetItem::ability an eEnchant
This commit is contained in:
2024-08-28 23:41:36 -04:00
committed by Celtic Minstrel
parent 71a9d11cd0
commit 6965b822dc
22 changed files with 216 additions and 83 deletions

View File

@@ -86,7 +86,7 @@ TEST_CASE("Converting legacy town data") {
CHECK(town.preset_items[0].loc == loc(7,8));
CHECK(town.preset_items[0].code == 3);
CHECK(town.preset_items[0].charges == 9);
CHECK(town.preset_items[0].ability == -1);
CHECK(town.preset_items[0].ability == eEnchant::NONE);
CHECK(town.preset_items[0].always_there);
CHECK(town.preset_items[0].property);
CHECK(town.preset_items[0].contained);

View File

@@ -169,7 +169,7 @@ TEST_CASE("Loading a town definition") {
CHECK(town->spec_strs[7] == "Here is a town string.");
REQUIRE(town->preset_items.size() >= 3);
CHECK(town->preset_items[2].code == 120);
CHECK(town->preset_items[2].ability == 2);
CHECK(town->preset_items[2].ability == eEnchant::PLUS_THREE);
CHECK(town->preset_items[2].charges == 17);
CHECK(town->preset_items[2].always_there);
CHECK(town->preset_items[2].property);

View File

@@ -108,7 +108,7 @@ TEST_CASE("Saving a town") {
SECTION("With a preset item") {
town->preset_items.emplace_back();
town->preset_items.back().code = 52;
town->preset_items.back().ability = 9;
town->preset_items.back().ability = eEnchant::BLESSED;
town->preset_items.back().charges = 102;
town->preset_items.back().always_there = true;
town->preset_items.back().property = true;
@@ -116,7 +116,7 @@ TEST_CASE("Saving a town") {
in_and_out("item", town, scen);
REQUIRE(town->preset_items.size() >= 1);
CHECK(town->preset_items[0].code == 52);
CHECK(town->preset_items[0].ability == 9);
CHECK(town->preset_items[0].ability == eEnchant::BLESSED);
CHECK(town->preset_items[0].charges == 102);
CHECK(town->preset_items[0].always_there);
CHECK(town->preset_items[0].property);