Updates to new PkmnLib, fixed same named scripts in different folders not handling both scripts.

This commit is contained in:
Deukhoofd 2020-04-19 12:38:15 +02:00
parent 292ca78b47
commit 27556e30e3
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 13 additions and 13 deletions

View File

@ -79,8 +79,9 @@ PkmnLib::Library::NatureLibrary* BuildNatures::Build(const std::string& path) {
decreasedModifier = 1.0;
std::cout << "Registered nature with name '" << natureName << "'.\n";
library->LoadNature(natureName, PkmnLib::Library::Nature(parsedIncreased, parsedDecreased, increasedModifier,
decreasedModifier));
library->LoadNature(
Arbutils::CaseInsensitiveConstString(natureName),
new PkmnLib::Library::Nature(parsedIncreased, parsedDecreased, increasedModifier, decreasedModifier));
}
return library;
}

View File

@ -1,21 +1,20 @@
#include "../../extern/catch.hpp"
#include "../Library.hpp"
#define CHECK_NATURE_NEUTRAL(name) \
#define CHECK_NATURE_NEUTRAL(name) \
{ \
auto nature = natureLib->GetNatureByName( #name ); \
CHECK(nature.GetIncreaseModifier() == Approx(1.0)); \
CHECK(nature.GetDecreaseModifier() == Approx(1.0)); \
auto nature = natureLib->GetNatureByName(Arbutils::CaseInsensitiveConstString(#name)); \
CHECK(nature->GetIncreaseModifier() == Approx(1.0)); \
CHECK(nature->GetDecreaseModifier() == Approx(1.0)); \
}
#define CHECK_NATURE(name, increasedStat, decreasedStat) \
{ \
auto nature = natureLib->GetNatureByName( #name ); \
CHECK(nature.GetIncreasedStat() == PkmnLib::Library::Statistic::increasedStat); \
CHECK(nature.GetDecreasedStat() == PkmnLib::Library::Statistic::decreasedStat); \
CHECK(nature.GetIncreaseModifier() == Approx(1.1)); \
CHECK(nature.GetDecreaseModifier() == Approx(0.9)); \
auto nature = natureLib->GetNatureByName(Arbutils::CaseInsensitiveConstString(#name)); \
CHECK(nature->GetIncreasedStat() == PkmnLib::Library::Statistic::increasedStat); \
CHECK(nature->GetDecreasedStat() == PkmnLib::Library::Statistic::decreasedStat); \
CHECK(nature->GetIncreaseModifier() == Approx(1.1)); \
CHECK(nature->GetDecreaseModifier() == Approx(0.9)); \
}
TEST_CASE("Nature Checks", "[natures]") {

View File

@ -102,7 +102,7 @@ int main(int argc, char* argv[]) {
continue;
std::ifstream in(dirEntry.path());
std::string contents((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
asScriptResolver->CreateScript(dirEntry.path().filename().c_str(), contents.c_str());
asScriptResolver->CreateScript(dirEntry.path().c_str(), contents.c_str());
}
asScriptResolver->CreateScript("TriggerEffectChance", R"(