Rework several libraries to use new StringViewDictionary
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing

This commit is contained in:
2022-05-16 17:21:39 +02:00
parent dcf6b20e65
commit e6f38cfb26
11 changed files with 67 additions and 79 deletions

View File

@@ -12,8 +12,7 @@ using namespace CreatureLib::Battling;
TEST_CASE("Turn ordering: Attack before pass") {
auto lib = TestLibrary::Get();
auto learnedAttack =
LearnedAttack(lib->GetAttackLibrary()->Get("standard"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto learnedAttack = LearnedAttack(lib->GetAttackLibrary()->Get("standard"_cnc), AttackLearnMethod::Unknown);
auto creature = CreateCreature(lib, "testSpecies1"_cnc, 1).Create();
auto choice1 = std::make_shared<PassTurnChoice>(creature);
@@ -32,8 +31,8 @@ TEST_CASE("Turn ordering: Attack before pass") {
TEST_CASE("Turn ordering: High priority goes before no priority") {
auto lib = TestLibrary::Get();
const auto& l = lib->GetAttackLibrary();
auto a1 = new LearnedAttack(l->Get("standard"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->Get("highPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a1 = new LearnedAttack(l->GetByHash("standard"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->GetByHash("highPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto creature = CreateCreature(lib, "testSpecies1"_cnc, 1).Create();
auto choice1 = std::make_shared<AttackTurnChoice>(creature, a1, CreatureIndex(0, 0));
@@ -55,8 +54,8 @@ TEST_CASE("Turn ordering: High priority goes before no priority") {
TEST_CASE("Turn ordering: Higher priority goes before high priority") {
auto lib = TestLibrary::Get();
const auto& l = lib->GetAttackLibrary();
auto a1 = new LearnedAttack(l->Get("highPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->Get("higherPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a1 = new LearnedAttack(l->GetByHash("highPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->GetByHash("higherPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto creature = CreateCreature(lib, "testSpecies1"_cnc, 1).Create();
auto choice1 = std::make_shared<AttackTurnChoice>(creature, a1, CreatureIndex(0, 0));
auto choice2 = std::make_shared<AttackTurnChoice>(creature, a2, CreatureIndex(0, 0));
@@ -76,8 +75,8 @@ TEST_CASE("Turn ordering: Higher priority goes before high priority") {
TEST_CASE("Turn ordering: High priority goes before low priority") {
auto lib = TestLibrary::Get();
const auto& l = lib->GetAttackLibrary();
auto a1 = new LearnedAttack(l->Get("lowPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->Get("higherPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a1 = new LearnedAttack(l->GetByHash("lowPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->GetByHash("higherPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto creature = CreateCreature(lib, "testSpecies1"_cnc, 1).Create();
auto choice1 = std::make_shared<AttackTurnChoice>(creature, a1, CreatureIndex(0, 0));
@@ -99,8 +98,8 @@ TEST_CASE("Turn ordering: High priority goes before low priority") {
TEST_CASE("Turn ordering: No priority goes before low priority") {
auto lib = TestLibrary::Get();
const auto& l = lib->GetAttackLibrary();
auto a1 = new LearnedAttack(l->Get("lowPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->Get("standard"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a1 = new LearnedAttack(l->GetByHash("lowPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->GetByHash("standard"_cnc.GetHash()), AttackLearnMethod::Unknown);
auto creature = CreateCreature(lib, "testSpecies1"_cnc, 1).Create();
auto choice1 = std::make_shared<AttackTurnChoice>(creature, a1, CreatureIndex(0, 0));
auto choice2 = std::make_shared<AttackTurnChoice>(creature, a2, CreatureIndex(0, 0));