|
@@ -334,75 +334,6 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
|
|
|
if(onlyTxt)
|
|
|
continue;
|
|
|
|
|
|
- // Fill in information about combined artifacts. Should perhaps be moved to a config file?
|
|
|
- switch (nart.id)
|
|
|
- {
|
|
|
- case 129: // Angelic Alliance
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 31, 32, 33, 34, 35, 36;
|
|
|
- break;
|
|
|
-
|
|
|
- case 130: // Cloak of the Undead King
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 54, 55, 56;
|
|
|
- break;
|
|
|
-
|
|
|
- case 131: // Elixir of Life
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 94, 95, 96;
|
|
|
- break;
|
|
|
-
|
|
|
- case 132: // Armor of the Damned
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 8, 14, 20, 26;
|
|
|
- break;
|
|
|
-
|
|
|
- case 133: // Statue of Legion
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 118, 119, 120, 121, 122;
|
|
|
- break;
|
|
|
-
|
|
|
- case 134: // Power of the Dragon Father
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 37, 38, 39, 40, 41, 42, 43, 44, 45;
|
|
|
- break;
|
|
|
-
|
|
|
- case 135: // Titan's Thunder
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 12, 18, 24, 30;
|
|
|
- break;
|
|
|
-
|
|
|
- case 136: // Admiral's Hat
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 71, 123;
|
|
|
- break;
|
|
|
-
|
|
|
- case 137: // Bow of the Sharpshooter
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 60, 61, 62;
|
|
|
- break;
|
|
|
-
|
|
|
- case 138: // Wizards' Well
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 73, 74, 75;
|
|
|
- break;
|
|
|
-
|
|
|
- case 139: // Ring of the Magi
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 76, 77, 78;
|
|
|
- break;
|
|
|
-
|
|
|
- case 140: // Cornucopia
|
|
|
- nart.constituents = new std::vector<ui32>();
|
|
|
- *nart.constituents += 109, 110, 111, 113;
|
|
|
- break;
|
|
|
-
|
|
|
- // TODO: WoG combinationals
|
|
|
-
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
artifacts.push_back(&nart);
|
|
|
}
|
|
|
if (VLC->modh->modules.COMMANDERS)
|
|
@@ -429,6 +360,7 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
|
|
|
addBonuses();
|
|
|
|
|
|
// Populate reverse mappings of combinational artifacts.
|
|
|
+ //TODO: do that also for new artifacts read from mods
|
|
|
BOOST_FOREACH(CArtifact *artifact, artifacts)
|
|
|
{
|
|
|
if (artifact->constituents != NULL)
|
|
@@ -553,6 +485,12 @@ CArtifact * CArtHandler::loadArtifact(const JsonNode & node)
|
|
|
return art;
|
|
|
}
|
|
|
|
|
|
+void CArtifact::addConstituent (ui32 component)
|
|
|
+{
|
|
|
+ assert (constituents);
|
|
|
+ constituents->push_back (component);
|
|
|
+}
|
|
|
+
|
|
|
int CArtHandler::convertMachineID(int id, bool creToArt )
|
|
|
{
|
|
|
int dif = 142;
|
|
@@ -764,6 +702,19 @@ void CArtHandler::addBonuses()
|
|
|
else if(artifact.second["type"].String() == "Commander")
|
|
|
makeItCommanderArt(ga->id);
|
|
|
|
|
|
+ const JsonNode *value;
|
|
|
+ value = &artifact.second["components"];
|
|
|
+ if (!value->isNull())
|
|
|
+ {
|
|
|
+ ga->constituents = new std::vector<ui32>();
|
|
|
+ BOOST_FOREACH (auto component, value->Vector())
|
|
|
+ {
|
|
|
+ VLC->modh->identifiers.requestIdentifier(std::string("artifact.") + component.String(),
|
|
|
+ boost::bind (&CArtifact::addConstituent, ga, _1)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
VLC->modh->identifiers.registerObject ("artifact." + artifact.first, ga->id);
|
|
|
}
|
|
|
}
|