mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-04 23:17:41 +02:00
Fix loading of vcmi json maps
This commit is contained in:
parent
8b2d336562
commit
e87adf334d
@ -161,7 +161,7 @@ void CObjectClassesHandler::loadSubObject(const std::string & scope, const std::
|
|||||||
assert(object);
|
assert(object);
|
||||||
obj->objects.push_back(object);
|
obj->objects.push_back(object);
|
||||||
|
|
||||||
registerObject(scope, "mapObject", obj->getJsonKey() + "." + object->getSubTypeName(), object->subtype);
|
registerObject(scope, obj->getJsonKey(), object->getSubTypeName(), object->subtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CObjectClassesHandler::loadSubObject(const std::string & scope, const std::string & identifier, const JsonNode & entry, ObjectClass * obj, size_t index)
|
void CObjectClassesHandler::loadSubObject(const std::string & scope, const std::string & identifier, const JsonNode & entry, ObjectClass * obj, size_t index)
|
||||||
@ -172,7 +172,7 @@ void CObjectClassesHandler::loadSubObject(const std::string & scope, const std::
|
|||||||
assert(obj->objects[index] == nullptr); // ensure that this id was not loaded before
|
assert(obj->objects[index] == nullptr); // ensure that this id was not loaded before
|
||||||
obj->objects[index] = object;
|
obj->objects[index] = object;
|
||||||
|
|
||||||
registerObject(scope, "mapObject", obj->getJsonKey() + "." + object->getSubTypeName(), object->subtype);
|
registerObject(scope, obj->getJsonKey(), object->getSubTypeName(), object->subtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
TObjectTypeHandler CObjectClassesHandler::loadSubObjectFromJson(const std::string & scope, const std::string & identifier, const JsonNode & entry, ObjectClass * obj, size_t index)
|
TObjectTypeHandler CObjectClassesHandler::loadSubObjectFromJson(const std::string & scope, const std::string & identifier, const JsonNode & entry, ObjectClass * obj, size_t index)
|
||||||
@ -306,11 +306,11 @@ TObjectTypeHandler CObjectClassesHandler::getHandlerFor(si32 type, si32 subtype)
|
|||||||
|
|
||||||
TObjectTypeHandler CObjectClassesHandler::getHandlerFor(std::string scope, std::string type, std::string subtype) const
|
TObjectTypeHandler CObjectClassesHandler::getHandlerFor(std::string scope, std::string type, std::string subtype) const
|
||||||
{
|
{
|
||||||
boost::optional<si32> id = VLC->modh->identifiers.getIdentifier(scope, "object", type, false);
|
boost::optional<si32> id = VLC->modh->identifiers.getIdentifier(scope, "object", type);
|
||||||
if(id)
|
if(id)
|
||||||
{
|
{
|
||||||
auto object = objects[id.get()];
|
auto object = objects[id.get()];
|
||||||
boost::optional<si32> subID = VLC->modh->identifiers.getIdentifier(scope, object->getJsonKey(), subtype, false);
|
boost::optional<si32> subID = VLC->modh->identifiers.getIdentifier(scope, object->getJsonKey(), subtype);
|
||||||
|
|
||||||
if (subID)
|
if (subID)
|
||||||
return object->objects[subID.get()];
|
return object->objects[subID.get()];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user