Bunch of fixes for Windows.

This commit is contained in:
Deukhoofd 2021-08-29 12:14:27 +02:00
parent 4e11fdddb3
commit 85b80f4be7
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 10 additions and 10 deletions

View File

@ -54,10 +54,10 @@ PkmnLib::Library::ItemLibrary* BuildItems::Build(const std::string& path) {
GET(val, flingPower, i); GET(val, flingPower, i);
auto itemTypeStr = _itemType.get<std::string>(); auto itemTypeStr = _itemType.get<std::string>();
CreatureLib::Library::ItemCategory itemType = ParseItemCategory(itemTypeStr); CreatureLib::Library::ItemCategory itemType = ParseItemCategory(itemTypeStr);
if (static_cast<int>(itemType) == 255) if (static_cast<i32>(itemType) == 255)
return nullptr; return nullptr;
auto flags = std::unordered_set<uint>(); auto flags = std::unordered_set<u32>();
for (auto& flagIndex : _flags.items()) { for (auto& flagIndex : _flags.items()) {
flags.insert(ArbUt::StringView(flagIndex.value().get<std::string>().c_str())); flags.insert(ArbUt::StringView(flagIndex.value().get<std::string>().c_str()));
} }

View File

@ -21,38 +21,38 @@ void BuildLibrary::LogBuildTimes() {
std::cout << "\tScripts Time: " << ScriptsTimeMs << "ms" << std::endl; std::cout << "\tScripts Time: " << ScriptsTimeMs << "ms" << std::endl;
} }
BattleLibrary* BuildLibrary::Build(const std::string& pathString, BattleLibrary* BuildLibrary::Build(const std::string& pathString,
std::function<void(ScriptResolver*)> onScriptInitialize) { std::function<void(ScriptResolver*)> onScriptInitialize) {
auto path = std::filesystem::path(pathString); auto path = std::filesystem::path(pathString);
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
auto* typesLibrary = BuildTypes::Build(path / "Types.csv"); auto* typesLibrary = BuildTypes::Build((path / "Types.csv").generic_string());
TypeTimeMs = TypeTimeMs =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count(); std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count();
begin = std::chrono::steady_clock::now(); begin = std::chrono::steady_clock::now();
auto* natureLibrary = BuildNatures::Build(path / "Natures.csv"); auto* natureLibrary = BuildNatures::Build((path / "Natures.csv").generic_string());
NaturesTimeMs = NaturesTimeMs =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count(); std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count();
begin = std::chrono::steady_clock::now(); begin = std::chrono::steady_clock::now();
auto* movesLibrary = BuildMoves::Build(path / "Moves.json", typesLibrary); auto* movesLibrary = BuildMoves::Build((path / "Moves.json").generic_string(), typesLibrary);
MovesTimeMs = MovesTimeMs =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count(); std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count();
begin = std::chrono::steady_clock::now(); begin = std::chrono::steady_clock::now();
auto* speciesLibrary = BuildSpecies::BuildLibrary(path / "Pokemon.json", typesLibrary, movesLibrary); auto* speciesLibrary =
BuildSpecies::BuildLibrary((path / "Pokemon.json").generic_string(), typesLibrary, movesLibrary);
SpeciesTimeMs = SpeciesTimeMs =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count(); std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count();
begin = std::chrono::steady_clock::now(); begin = std::chrono::steady_clock::now();
auto* itemsLibrary = BuildItems::Build(path / "Items.json"); auto* itemsLibrary = BuildItems::Build((path / "Items.json").generic_string());
ItemsTimeMs = ItemsTimeMs =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count(); std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count();
begin = std::chrono::steady_clock::now(); begin = std::chrono::steady_clock::now();
auto* growthRates = GrowthRatesBuilder::Build(path / "GrowthRates.json"); auto* growthRates = GrowthRatesBuilder::Build((path / "GrowthRates.json").generic_string());
GrowthRateTimeMs = GrowthRateTimeMs =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count(); std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - begin).count();
@ -89,7 +89,7 @@ BattleLibrary* BuildLibrary::Build(const std::string& pathString,
continue; continue;
std::ifstream in(dirEntry.path()); std::ifstream in(dirEntry.path());
std::string contents((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>()); std::string contents((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
asScriptResolver->CreateScript(dirEntry.path().c_str(), contents.c_str()); asScriptResolver->CreateScript((const char*)dirEntry.path().c_str(), contents.c_str());
} }
asScriptResolver->FinalizeModule(); asScriptResolver->FinalizeModule();
ScriptsTimeMs = ScriptsTimeMs =