mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Fixes in object loading
This commit is contained in:
parent
68bb36f7c7
commit
1f81ddbac4
@ -237,13 +237,13 @@ void ObstacleSetHandler::loadObject(std::string scope, std::string name, const J
|
||||
if(os)
|
||||
{
|
||||
addObstacleSet(os);
|
||||
// TODO: Define some const array of object types ("biome" etc.)
|
||||
VLC->identifiersHandler->registerObject(scope, "biome", name, biomes.back()->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
logMod->error("Failed to load obstacle set: %s", name);
|
||||
}
|
||||
// TODO: Define some const array of object types ("biome" etc.)
|
||||
VLC->identifiersHandler->registerObject(scope, "biome", name, biomes.back()->id);
|
||||
}
|
||||
|
||||
void ObstacleSetHandler::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index)
|
||||
@ -252,17 +252,19 @@ void ObstacleSetHandler::loadObject(std::string scope, std::string name, const J
|
||||
if(os)
|
||||
{
|
||||
addObstacleSet(os);
|
||||
VLC->identifiersHandler->registerObject(scope, "biome", name, biomes.at(index)->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
logMod->error("Failed to load obstacle set: %s", name);
|
||||
}
|
||||
VLC->identifiersHandler->registerObject(scope, "biome", name, biomes.at(index)->id);
|
||||
|
||||
}
|
||||
|
||||
std::shared_ptr<ObstacleSet> ObstacleSetHandler::loadFromJson(const std::string & scope, const JsonNode & json, const std::string & name, size_t index)
|
||||
{
|
||||
auto os = std::make_shared<ObstacleSet>();
|
||||
os->id = index;
|
||||
|
||||
auto biome = json["biome"].Struct();
|
||||
os->setType(ObstacleSet::typeFromString(biome["objectType"].String()));
|
||||
@ -361,7 +363,6 @@ void ObstacleSetHandler::addTemplate(const std::string & scope, const std::strin
|
||||
|
||||
void ObstacleSetHandler::addObstacleSet(std::shared_ptr<ObstacleSet> os)
|
||||
{
|
||||
// TODO: Allow to refer to existing obstacle set by its id (name)
|
||||
obstacleSets[os->getType()].push_back(os);
|
||||
biomes.push_back(os);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user