Compare commits
2 Commits
fe6d13eb7e
...
efca5ca06d
| Author | SHA1 | Date | |
|---|---|---|---|
|
efca5ca06d
|
|||
|
e2edf6129d
|
@@ -1,6 +1,6 @@
|
||||
#include "BuildAbilities.hpp"
|
||||
#include "json.hpp"
|
||||
#include <fstream>
|
||||
#include "json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
@@ -51,6 +51,11 @@ CreatureLib::Library::TalentLibrary* BuildAbilities::Build(const std::string& pa
|
||||
case json::value_t::number_float:
|
||||
realParameters.Append(new CreatureLib::Library::EffectParameter(p.get<float>()));
|
||||
break;
|
||||
case json::value_t ::string: {
|
||||
auto s = p.get<std::string>();
|
||||
realParameters.Append(new CreatureLib::Library::EffectParameter(ArbUt::StringView(s.c_str(), s.length())));
|
||||
break;
|
||||
}
|
||||
default: continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,11 @@ PkmnLib::Library::ItemLibrary* BuildItems::Build(const std::string& path) {
|
||||
case json::value_t::number_float:
|
||||
parameters.Append(new CreatureLib::Library::EffectParameter(p.get<float>()));
|
||||
break;
|
||||
case json::value_t ::string: {
|
||||
auto s = p.get<std::string>();
|
||||
parameters.Append(new CreatureLib::Library::EffectParameter(ArbUt::StringView(s.c_str(), s.length())));
|
||||
break;
|
||||
}
|
||||
default: continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
using json = nlohmann::json;
|
||||
|
||||
#define GET(o, objectKey, key) \
|
||||
auto& _##objectKey = o[#objectKey]; \
|
||||
auto& _##objectKey = o[#objectKey]; \
|
||||
if (_##objectKey.is_null()) { \
|
||||
auto errorKeyFunc = [=]() { return key; }; \
|
||||
std::cout << "Failed to retrieve key '" << #objectKey << "' for object with key '" << errorKeyFunc() \
|
||||
<< path << "'\n"; \
|
||||
std::cout << "Failed to retrieve key '" << #objectKey << "' for object with key '" << errorKeyFunc() << path \
|
||||
<< "'\n"; \
|
||||
return nullptr; \
|
||||
}
|
||||
|
||||
@@ -89,6 +89,12 @@ PkmnLib::Library::MoveLibrary* BuildMoves::Build(const std::string& path,
|
||||
case json::value_t::number_float:
|
||||
parameters.Append(new CreatureLib::Library::EffectParameter(p.get<float>()));
|
||||
break;
|
||||
case json::value_t ::string: {
|
||||
auto s = p.get<std::string>();
|
||||
parameters.Append(new CreatureLib::Library::EffectParameter(
|
||||
ArbUt::StringView(s.c_str(), s.length())));
|
||||
break;
|
||||
}
|
||||
default: continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ const PkmnLib::Library::PokemonForme* BuildSpecies::BuildForme(const std::string
|
||||
auto s = ab.value().get<std::string>();
|
||||
auto tryAbility = talentLibrary->TryGet(ArbUt::StringView(s.c_str(), s.length()));
|
||||
if (!tryAbility.has_value())
|
||||
THROW("Unknown ability " << s);
|
||||
THROW("Unknown ability ", s);
|
||||
abilities.Append(tryAbility.value());
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ const PkmnLib::Library::PokemonForme* BuildSpecies::BuildForme(const std::string
|
||||
auto s = ab.value().get<std::string>();
|
||||
auto tryAbility = talentLibrary->TryGet(ArbUt::StringView(s.c_str(), s.length()));
|
||||
if (!tryAbility.has_value())
|
||||
THROW("Unknown ability " << s);
|
||||
THROW("Unknown ability ", s);
|
||||
hiddenAbilities.Append(tryAbility.value());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user