1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Modding-related bugfixes:

- hero classes will be loaded correctly
- objects without index will have correctly assigned ID's
This commit is contained in:
Ivan Savenko 2014-06-30 17:11:25 +03:00
parent 50dfe05cd1
commit db221829aa
3 changed files with 6 additions and 4 deletions

View File

@ -199,7 +199,7 @@ void CHeroClassHandler::loadObject(std::string scope, std::string name, const Js
VLC->modh->identifiers.requestIdentifier(scope, "object", "hero", [=](si32 index)
{
JsonNode classConf;
JsonNode classConf = data["mapObject"];
classConf["heroClass"].String() = name;
classConf.setMeta(scope);
VLC->objtypeh->loadSubObject(name, classConf, index, object->id);

View File

@ -310,6 +310,7 @@ bool CContentHandler::ContentTypeHandler::preloadModData(std::string modName, st
if (remoteName == modName)
logGlobal->warnStream() << "Redundant namespace definition for " << objectName;
logGlobal->traceStream() << "Patching object " << objectName << " (" << remoteName << ") from " << modName;
JsonNode & remoteConf = modData[remoteName].patches[objectName];
JsonUtils::merge(remoteConf, entry.second);

View File

@ -140,7 +140,7 @@ si32 selectNextID(const JsonNode & fixedID, const Map & map, si32 defaultID)
if (map.empty())
return defaultID; // no objects loaded, keep gap for H3M objects
if (map.rbegin()->first > defaultID)
if (map.rbegin()->first >= defaultID)
return map.rbegin()->first + 1; // some modded objects loaded, return next available
return defaultID; // some H3M objects loaded, first modded found
@ -173,8 +173,9 @@ void CObjectClassesHandler::loadObjectEntry(const JsonNode & entry, ObjectContai
legacyTemplates.erase(range.first, range.second);
}
obj->objects[id] = handler;
logGlobal->debugStream() << "Loaded object " << obj->id << ":" << id;
assert(!obj->objects.count(id)); // DO NOT override
obj->objects[id] = handler;
}
CObjectClassesHandler::ObjectContainter * CObjectClassesHandler::loadFromJson(const JsonNode & json)