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

use ArtifactID

This commit is contained in:
SoundSSGood
2022-11-29 00:11:46 +02:00
parent 3b072b80d5
commit 909dcb82fa
12 changed files with 57 additions and 47 deletions

View File

@@ -19,9 +19,18 @@ VCMI_LIB_NAMESPACE_BEGIN
class CGCreature;
// Used in std::unordered_map
template<> struct std::hash<ArtifactID>
{
std::size_t operator()(const ArtifactID & aid) const
{
return std::hash<int>{}(aid.num);
}
};
class DLL_LINKAGE CQuest final
{
mutable std::unordered_map<ui16, unsigned> artifactsRequirements; // artifact ID -> required count
mutable std::unordered_map<ArtifactID, unsigned> artifactsRequirements; // artifact ID -> required count
public:
enum Emission {MISSION_NONE = 0, MISSION_LEVEL = 1, MISSION_PRIMARY_STAT = 2, MISSION_KILL_HERO = 3, MISSION_KILL_CREATURE = 4,
@@ -36,7 +45,7 @@ public:
ui32 m13489val;
std::vector<ui32> m2stats;
std::vector<ui16> m5arts; // artifact IDs. Add IDs through addArtifactID(), not directly to the field.
std::vector<ArtifactID> m5arts; // artifact IDs. Add IDs through addArtifactID(), not directly to the field.
std::vector<CStackBasicDescriptor> m6creatures; //pair[cre id, cre count], CreatureSet info irrelevant
std::vector<ui32> m7resources; //TODO: use resourceset?
@@ -62,7 +71,7 @@ public:
virtual void getRolloverText (MetaString &text, bool onHover) const; //hover or quest log entry
virtual void completeQuest (const CGHeroInstance * h) const {};
virtual void addReplacements(MetaString &out, const std::string &base) const;
void addArtifactID(ui16 id);
void addArtifactID(ArtifactID id);
bool operator== (const CQuest & quest) const
{