1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Creature set serialization

This commit is contained in:
AlexVinS
2016-01-15 20:24:17 +03:00
parent 37d0dad70a
commit a638d0cd51
8 changed files with 97 additions and 33 deletions

View File

@@ -188,6 +188,16 @@ CCreatureHandler::CCreatureHandler()
loadCommanders();
}
const CCreature * CCreatureHandler::getCreature(const std::string & scope, const std::string & identifier) const
{
boost::optional<si32> index = VLC->modh->identifiers.getIdentifier(scope, "creature", identifier);
if(!index)
throw std::runtime_error("Creature not found "+identifier);
return creatures[*index];
}
void CCreatureHandler::loadCommanders()
{
JsonNode data(ResourceID("config/commanders.json"));