Integrate a new resource manager which should have better performance

This commit is contained in:
2020-01-26 11:53:19 -05:00
parent 29ef8b9c1e
commit 542c037342
47 changed files with 753 additions and 644 deletions

View File

@@ -384,7 +384,7 @@ TEST_CASE("Loading a new-format scenario record") {
SECTION("With a shop") {
// Loading shops requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
SECTION("Valid shop") {
fin.open("files/scenario/shop.xml");
doc = xmlDocFromStream(fin, "shop.xml");
@@ -472,7 +472,7 @@ TEST_CASE("Loading a new-format scenario record") {
doc = xmlDocFromStream(fin, "shop-missing_node.xml");
REQUIRE_THROWS_AS(readScenarioFromXml(move(doc), scen), xMissingElem);
}
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
SECTION("With item storage shortcuts") {
SECTION("Valid") {

View File

@@ -168,7 +168,7 @@ TEST_CASE("Saving a scenario record") {
SECTION("With a shop") {
// Loading/building shops requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
cItem dummy_item('alch');
scen.shops.resize(3);
scen.shops[0] = cShop('junk');
@@ -248,7 +248,7 @@ TEST_CASE("Saving a scenario record") {
CHECK(scen.shops[2].getItem(11).item.graphic_num == 24);
CHECK(scen.shops[2].getItem(11).item.full_name == "Magic!");
CHECK(scen.shops[2].getItem(11).item.desc == "This is magic!");
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
SECTION("With some empty strings, none are stripped") {
scen.spec_strs.resize(12);

View File

@@ -30,7 +30,7 @@ TEST_CASE("When converting legacy special nodes (general)") {
legacy::special_node_type oldSpec = {0,-1,-1,0,-1,-1,-1,-1,-1,-1,-1};
// Fetching opcodes requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
oldSpec.jumpto = 12;
SECTION("Null Special") {
@@ -295,7 +295,7 @@ TEST_CASE("When converting legacy special nodes (general)") {
CHECK(newSpec.jumpto == 12);
}
// Clean up after ourselves
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
TEST_CASE("When converting legacy special nodes (one-shot)") {
@@ -303,7 +303,7 @@ TEST_CASE("When converting legacy special nodes (one-shot)") {
legacy::special_node_type oldSpec = {0,-1,-1,0,-1,-1,-1,-1,-1,-1,-1};
// Fetching opcodes requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
oldSpec.sd1 = 8; oldSpec.sd2 = 7;
oldSpec.m1 = 4; oldSpec.m2 = 5;
@@ -481,7 +481,7 @@ TEST_CASE("When converting legacy special nodes (one-shot)") {
CHECK(newSpec.jumpto == 12);
}
// Clean up after ourselves
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
TEST_CASE("When converting legacy special nodes (affect)") {
@@ -489,7 +489,7 @@ TEST_CASE("When converting legacy special nodes (affect)") {
legacy::special_node_type oldSpec = {0,-1,-1,0,-1,-1,-1,-1,-1,-1,-1};
// Fetching opcodes requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
oldSpec.m1 = 4; oldSpec.m2 = 5;
oldSpec.jumpto = 12;
@@ -761,7 +761,7 @@ TEST_CASE("When converting legacy special nodes (affect)") {
CHECK(newSpec.jumpto == 12);
}
// Clean up after ourselves
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
TEST_CASE("When converting legacy special nodes (if-then)") {
@@ -769,7 +769,7 @@ TEST_CASE("When converting legacy special nodes (if-then)") {
legacy::special_node_type oldSpec = {0,-1,-1,0,-1,-1,-1,-1,-1,-1,-1};
// Fetching opcodes requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
oldSpec.jumpto = 12;
SECTION("Stuff Done Flag?") {
@@ -1035,7 +1035,7 @@ TEST_CASE("When converting legacy special nodes (if-then)") {
CHECK(newSpec.jumpto == 12);
}
// Clean up after ourselves
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
TEST_CASE("When converting legacy special nodes (town)") {
@@ -1043,7 +1043,7 @@ TEST_CASE("When converting legacy special nodes (town)") {
legacy::special_node_type oldSpec = {0,-1,-1,0,-1,-1,-1,-1,-1,-1,-1};
// Fetching opcodes requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
oldSpec.m1 = 4; oldSpec.m2 = 5;
oldSpec.jumpto = 12;
@@ -1312,7 +1312,7 @@ TEST_CASE("When converting legacy special nodes (town)") {
CHECK(newSpec.jumpto == 12);
}
// Clean up after ourselves
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
TEST_CASE("When converting legacy special nodes (rect)") {
@@ -1320,7 +1320,7 @@ TEST_CASE("When converting legacy special nodes (rect)") {
legacy::special_node_type oldSpec = {0,-1,-1,0,-1,-1,-1,-1,-1,-1,-1};
// Fetching opcodes requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
oldSpec.m1 = 4; oldSpec.m2 = 5;
oldSpec.pic = 1;
@@ -1608,7 +1608,7 @@ TEST_CASE("When converting legacy special nodes (rect)") {
CHECK(newSpec.jumpto == 12);
}
// Clean up after ourselves
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
TEST_CASE("When converting legacy special nodes (outdoors)") {
@@ -1616,7 +1616,7 @@ TEST_CASE("When converting legacy special nodes (outdoors)") {
legacy::special_node_type oldSpec = {0,-1,-1,0,-1,-1,-1,-1,-1,-1,-1};
// Fetching opcodes requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
oldSpec.jumpto = 12;
SECTION("Make Outdoor Wandering") {
@@ -1671,7 +1671,7 @@ TEST_CASE("When converting legacy special nodes (outdoors)") {
CHECK(newSpec.ex2b == 4);
}
// Clean up after ourselves
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
TEST_CASE("When converting classic special nodes") {
@@ -1679,7 +1679,7 @@ TEST_CASE("When converting classic special nodes") {
legacy::special_node_type oldSpec = {0,-1,-1,0,-1,-1,-1,-1,-1,-1,-1};
// Fetching opcodes requires strings to be available
// Here we fetch them from the rsrc dir, rather than the data dir
ResMgr::pushPath<StringRsrc>("../rsrc/strings");
ResMgr::strings.pushPath("../rsrc/strings");
oldSpec.jumpto = 12;
SECTION("If Statistic") {
@@ -1744,7 +1744,7 @@ TEST_CASE("When converting classic special nodes") {
CHECK(newSpec.jumpto == 12);
}
// Clean up after ourselves
ResMgr::popPath<StringRsrc>();
ResMgr::strings.popPath();
}
ostream& operator<< (ostream& out, eSpecType spec) {