More error messages for playerdatadef parsing
This commit is contained in:
parent
5c87509849
commit
b3aacf8731
@ -130,6 +130,18 @@ namespace Components
|
|||||||
std::string errors;
|
std::string errors;
|
||||||
json11::Json defData = json11::Json::parse(definition.GetBuffer(), errors);
|
json11::Json defData = json11::Json::parse(definition.GetBuffer(), errors);
|
||||||
|
|
||||||
|
if (!errors.empty())
|
||||||
|
{
|
||||||
|
Logger::Error("Parsing patch file '%s' for PlayerDataDef version %d failed: %s", definition.GetName().data(), i, errors.data());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defData.is_object())
|
||||||
|
{
|
||||||
|
Logger::Error("PlayerDataDef patch for version %d is invalid!", i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int pType = 0; pType < StructuredData::PlayerDataType::ENUM_MAX; ++pType)
|
for (unsigned int pType = 0; pType < StructuredData::PlayerDataType::ENUM_MAX; ++pType)
|
||||||
{
|
{
|
||||||
auto enumData = defData[StructuredData::EnumTranslation[pType]];
|
auto enumData = defData[StructuredData::EnumTranslation[pType]];
|
||||||
@ -187,7 +199,11 @@ namespace Components
|
|||||||
auto patchData = patchDefinitions[newData[i].version];
|
auto patchData = patchDefinitions[newData[i].version];
|
||||||
|
|
||||||
// Invalid patch data
|
// Invalid patch data
|
||||||
if (patchData.size() != StructuredData::PlayerDataType::ENUM_MAX) continue;
|
if (patchData.size() != StructuredData::PlayerDataType::ENUM_MAX)
|
||||||
|
{
|
||||||
|
Logger::Error("PlayerDataDef patch for version %d wasn't parsed correctly!", newData[i].version);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Apply the patch data
|
// Apply the patch data
|
||||||
for (unsigned int pType = 0; pType < StructuredData::PlayerDataType::ENUM_MAX; ++pType)
|
for (unsigned int pType = 0; pType < StructuredData::PlayerDataType::ENUM_MAX; ++pType)
|
||||||
|
Loading…
Reference in New Issue
Block a user