mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Try to simplify / cleanup code to localize crash
This commit is contained in:
@@ -1074,14 +1074,14 @@ void CMapLoaderJson::MapObjectLoader::construct()
|
||||
|
||||
auto handler = VLC->objtypeh->getHandlerFor( ModScope::scopeMap(), typeName, subtypeName);
|
||||
|
||||
auto * appearance = new ObjectTemplate;
|
||||
auto appearance = std::make_shared<ObjectTemplate>();
|
||||
|
||||
appearance->id = Obj(handler->getIndex());
|
||||
appearance->subid = handler->getSubIndex();
|
||||
appearance->readJson(configuration["template"], false);
|
||||
|
||||
// Will be destroyed soon and replaced with shared template
|
||||
instance = handler->create(std::shared_ptr<const ObjectTemplate>(appearance));
|
||||
instance = handler->create(appearance);
|
||||
|
||||
instance->id = ObjectInstanceID(static_cast<si32>(owner->map->objects.size()));
|
||||
instance->instanceName = jsonKey;
|
||||
|
||||
Reference in New Issue
Block a user