mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
Large changeset, first part of editing H3 objects via mods feature. Changes:
- loading of all objects (including H3 objects) will be directed by mod handlers - common base for all handlers accessible from mod system (IHanderBase) - json format changes: use struct with string ID's instead of vector - fixed some gcc/clang errors and warnings - fixed several cases of memory leaks and invalid memory access (mostly related to usage of bonus system and/or identifiers resolution) Note that right now loading is much slower than before due to excessive json validation (or not fast enough validator)
This commit is contained in:
@ -1125,8 +1125,8 @@ bool JsonValidator::validate(const JsonNode &root, std::string schemaName, std::
|
||||
|
||||
if (!errors.empty())
|
||||
{
|
||||
logGlobal->warnStream() << "Data in " << name << " is invalid!";
|
||||
logGlobal->warnStream() << errors;
|
||||
logGlobal->warnStream() << "Data in " << name << " is invalid!";
|
||||
logGlobal->warnStream() << errors;
|
||||
}
|
||||
|
||||
return errors.empty();
|
||||
@ -1162,7 +1162,7 @@ Bonus * JsonUtils::parseBonus (const JsonVector &ability_vec) //TODO: merge with
|
||||
template <typename T>
|
||||
const T & parseByMap(const std::map<std::string, T> & map, const JsonNode * val, std::string err)
|
||||
{
|
||||
static T defaultValue;
|
||||
static T defaultValue = T();
|
||||
if (!val->isNull())
|
||||
{
|
||||
std::string type = val->String();
|
||||
@ -1179,7 +1179,7 @@ const T & parseByMap(const std::map<std::string, T> & map, const JsonNode * val,
|
||||
}
|
||||
else
|
||||
return defaultValue;
|
||||
};
|
||||
}
|
||||
|
||||
void JsonUtils::resolveIdentifier (si32 &var, const JsonNode &node, std::string name)
|
||||
{
|
||||
|
Reference in New Issue
Block a user