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

More style tweaks

This commit is contained in:
Tomasz Zieliński 2022-09-28 11:38:08 +02:00
parent d38b6297f8
commit 475f835769
4 changed files with 11 additions and 12 deletions

View File

@ -172,7 +172,6 @@ void CMapHandler::initTerrainGraphics()
}
};
//TODO: use id as a key
std::map<std::string, std::string> terrainFiles;
std::map<std::string, std::string> riverFiles;
std::map<std::string, std::string> roadFiles;

View File

@ -346,9 +346,9 @@ CHeroHandler::~CHeroHandler() = default;
CHeroHandler::CHeroHandler()
{
loadTerrains();
for(int i = 0; i < VLC->terrainTypeHandler->terrains().size(); ++i)
for(const auto & terrain : VLC->terrainTypeHandler->terrains())
{
VLC->modh->identifiers.registerObject("core", "terrain", VLC->terrainTypeHandler->terrains()[i].name, i);
VLC->modh->identifiers.registerObject("core", "terrain", terrain.name, terrain.id);
}
loadBallistics();
loadExperience();

View File

@ -486,15 +486,15 @@ void AObjectTypeHandler::init(const JsonNode & input, boost::optional<std::strin
for (auto entry : input["templates"].Struct())
{
entry.second.setType(JsonNode::JsonType::DATA_STRUCT);
JsonUtils::inherit(entry.second, base);
auto tmpl = new ObjectTemplate;
tmpl->id = Obj(type);
tmpl->subid = subtype;
tmpl->stringID = entry.first; // FIXME: create "fullID" - type.object.template?
try
{
entry.second.setType(JsonNode::JsonType::DATA_STRUCT);
JsonUtils::inherit(entry.second, base);
auto tmpl = new ObjectTemplate;
tmpl->id = Obj(type);
tmpl->subid = subtype;
tmpl->stringID = entry.first; // FIXME: create "fullID" - type.object.template?
tmpl->readJson(entry.second);
templates.push_back(std::shared_ptr<const ObjectTemplate>(tmpl));
}

View File

@ -128,9 +128,9 @@ CCastleEvent::CCastleEvent() : town(nullptr)
TerrainTile::TerrainTile():
terType(nullptr),
terView(0),
riverType(const_cast<RiverType*>(&VLC->terrainTypeHandler->rivers()[0])),
riverType(const_cast<RiverType*>(&VLC->terrainTypeHandler->rivers()[River::NO_RIVER])),
riverDir(0),
roadType(const_cast<RoadType*>(&VLC->terrainTypeHandler->roads()[0])),
roadType(const_cast<RoadType*>(&VLC->terrainTypeHandler->roads()[Road::NO_ROAD])),
roadDir(0),
extTileFlags(0),
visitable(false),