mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-14 02:33:51 +02:00
Firts working version that launches original maps
This commit is contained in:
parent
11e1bb44a2
commit
c9c4603f75
@ -74,10 +74,10 @@ TerrainTypeHandler::TerrainTypeHandler()
|
||||
}
|
||||
else
|
||||
{
|
||||
auto rockTerrainType = terr.second["rockTerrain"].String();
|
||||
resolveLater.push_back([this, rockTerrainType, info]()
|
||||
auto rockTerrainName = terr.second["rockTerrain"].String();
|
||||
resolveLater.push_back([this, rockTerrainName, info]()
|
||||
{
|
||||
info->rockTerrain = getInfoByName(rockTerrainType)->id;
|
||||
info->rockTerrain = getInfoByName(rockTerrainName)->id;
|
||||
});
|
||||
}
|
||||
|
||||
@ -159,6 +159,7 @@ TerrainTypeHandler::TerrainTypeHandler()
|
||||
id = objects.size();
|
||||
objects.push_back(info);
|
||||
}
|
||||
info->id = id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +169,8 @@ TerrainTypeHandler::TerrainTypeHandler()
|
||||
assert(objects(i));
|
||||
}
|
||||
|
||||
//TODO: add ids to resolve
|
||||
recreateTerrainMaps();
|
||||
|
||||
for (auto& functor : resolveLater)
|
||||
{
|
||||
functor();
|
||||
@ -216,7 +218,7 @@ TerrainType::operator std::string() const
|
||||
}
|
||||
|
||||
TerrainType::TerrainType(const std::string& _name):
|
||||
name(name),
|
||||
name(_name),
|
||||
id(Terrain::WRONG),
|
||||
rockTerrain(Terrain::ROCK),
|
||||
moveCost(100),
|
||||
|
@ -193,10 +193,10 @@ void LibClasses::init(bool onlyEssential)
|
||||
|
||||
createHandler(bth, "Bonus type", pomtime);
|
||||
|
||||
createHandler(generaltexth, "General text", pomtime);
|
||||
|
||||
createHandler(terrainTypeHandler, "Terrain", pomtime);
|
||||
|
||||
createHandler(generaltexth, "General text", pomtime);
|
||||
|
||||
createHandler(heroh, "Hero", pomtime);
|
||||
|
||||
createHandler(arth, "Artifact", pomtime);
|
||||
|
@ -483,6 +483,8 @@ void AObjectTypeHandler::init(const JsonNode & input, boost::optional<std::strin
|
||||
} // else block is not needed - set in constructor
|
||||
|
||||
for (auto entry : input["templates"].Struct())
|
||||
{
|
||||
try
|
||||
{
|
||||
entry.second.setType(JsonNode::JsonType::DATA_STRUCT);
|
||||
JsonUtils::inherit(entry.second, base);
|
||||
@ -494,6 +496,11 @@ void AObjectTypeHandler::init(const JsonNode & input, boost::optional<std::strin
|
||||
tmpl->readJson(entry.second);
|
||||
templates.push_back(std::shared_ptr<const ObjectTemplate>(tmpl));
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
logGlobal->warn("Failed to load terrains for object %s: %s", entry.first, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if (input["name"].isNull())
|
||||
objectName = name;
|
||||
|
@ -300,7 +300,6 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain)
|
||||
if (withTerrain && allowedTerrains.empty())
|
||||
logGlobal->warn("Loaded template without allowed terrains!");
|
||||
|
||||
|
||||
auto charToTile = [&](const char & ch) -> ui8
|
||||
{
|
||||
switch (ch)
|
||||
|
Loading…
Reference in New Issue
Block a user