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

Added string identifiers to artifacts.

Some of them have lost some abilities, needs more work.
This commit is contained in:
DjWarmonger
2012-12-25 17:23:26 +00:00
parent 96cc88ba91
commit 743a0fc3f4
3 changed files with 175 additions and 11 deletions

View File

@@ -749,20 +749,22 @@ void CArtHandler::makeItCommanderArt( TArtifactInstanceID aid, bool onlyCommande
void CArtHandler::addBonuses()
{
const JsonNode config(ResourceID("config/artifacts.json"));
BOOST_FOREACH(const JsonNode &artifact, config["artifacts"].Vector())
BOOST_FOREACH (auto & artifact, config["artifacts"].Struct()) //pair <string, JsonNode> (id, properties)
{
auto ga = artifacts[artifact["id"].Float()].get();
auto ga = artifacts[artifact.second["id"].Float()].get();
BOOST_FOREACH (auto b, artifact["bonuses"].Vector())
BOOST_FOREACH (auto b, artifact.second["bonuses"].Vector())
{
auto bonus = JsonUtils::parseBonus (b);
bonus->sid = ga->id;
ga->addNewBonus (bonus);
}
if(artifact["type"].String() == "Creature")
if(artifact.second["type"].String() == "Creature")
makeItCreatureArt(ga->id);
else if(artifact["type"].String() == "Commander")
else if(artifact.second["type"].String() == "Commander")
makeItCommanderArt(ga->id);
VLC->modh->identifiers.registerObject ("artifact." + artifact.first, ga->id);
}
}