1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-03 23:19:22 +02:00

some changes towards editing H3 objects via mods. Should be stable, report if not.

- removed duplicated json loading code in handlers
- simpler and mod-friendly handling of combined artifacts
- reorganized CCreature to avoid huge number of fields in one structure
This commit is contained in:
Ivan Savenko
2013-03-02 16:55:51 +00:00
parent cc2391d641
commit f306d7bb70
17 changed files with 565 additions and 729 deletions

View File

@@ -281,9 +281,17 @@ std::vector<std::string> CModHandler::getActiveMods()
}
template<typename Handler>
void handleData(Handler handler, const JsonNode & config)
void handleData(Handler handler, const JsonNode & sourceList)
{
handler->load(JsonUtils::assembleFromFiles(config.convertTo<std::vector<std::string> >()));
JsonNode config = JsonUtils::assembleFromFiles(sourceList.convertTo<std::vector<std::string> >());
BOOST_FOREACH(auto & entry, config.Struct())
{
if (!entry.second.isNull()) // may happens if mod removed object by setting json entry to null
{
handler->load(entry.first, entry.second);
}
}
}
void CModHandler::loadActiveMods()
@@ -346,8 +354,6 @@ void CModHandler::reload()
VLC->dobjinfo->gobjs[Obj::ARTIFACT][art->id] = info;
}
}
VLC->arth->reverseMapArtifactConstituents();
}
{