1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Implement CArtHandler::isBigArtifact and CArtifact::isTradable

This commit is contained in:
ArseniyShestakov 2014-12-24 20:43:35 +03:00
parent 937ef0227b
commit de6752c048
2 changed files with 15 additions and 0 deletions

View File

@ -64,6 +64,11 @@ bool CArtifact::isBig () const
return VLC->arth->isBigArtifact(id); return VLC->arth->isBigArtifact(id);
} }
bool CArtifact::isTradable () const
{
return VLC->arth->isTradableArtifact(id);
}
CArtifact::CArtifact() CArtifact::CArtifact()
{ {
setNodeType(ARTIFACT); setNodeType(ARTIFACT);
@ -578,6 +583,14 @@ bool CArtHandler::legalArtifact(ArtifactID id)
!(art->constituents); //no combo artifacts spawning !(art->constituents); //no combo artifacts spawning
} }
bool CArtHandler::isTradableArtifact(ArtifactID id) const
{
if (id < 7 && id != ArtifactID::SPELL_SCROLL)
return false;
return true;
}
void CArtHandler::initAllowedArtifactsList(const std::vector<bool> &allowed) void CArtHandler::initAllowedArtifactsList(const std::vector<bool> &allowed)
{ {
allowedArtifacts.clear(); allowedArtifacts.clear();

View File

@ -59,6 +59,7 @@ public:
const std::string &EventText() const; const std::string &EventText() const;
bool isBig () const; bool isBig () const;
bool isTradable () const;
int getArtClassSerial() const; //0 - treasure, 1 - minor, 2 - major, 3 - relic, 4 - spell scroll, 5 - other int getArtClassSerial() const; //0 - treasure, 1 - minor, 2 - major, 3 - relic, 4 - spell scroll, 5 - other
std::string nodeName() const override; std::string nodeName() const override;
@ -215,6 +216,7 @@ public:
//void getAllowedArts(std::vector<ConstTransitivePtr<CArtifact> > &out, std::vector<CArtifact*> *arts, int flag); //void getAllowedArts(std::vector<ConstTransitivePtr<CArtifact> > &out, std::vector<CArtifact*> *arts, int flag);
//void getAllowed(std::vector<ConstTransitivePtr<CArtifact> > &out, int flags); //void getAllowed(std::vector<ConstTransitivePtr<CArtifact> > &out, int flags);
bool isBigArtifact (ArtifactID artID) const {return bigArtifacts.find(artID) != bigArtifacts.end();} bool isBigArtifact (ArtifactID artID) const {return bigArtifacts.find(artID) != bigArtifacts.end();}
bool isTradableArtifact (ArtifactID id) const;
void initAllowedArtifactsList(const std::vector<bool> &allowed); //allowed[art_id] -> 0 if not allowed, 1 if allowed void initAllowedArtifactsList(const std::vector<bool> &allowed); //allowed[art_id] -> 0 if not allowed, 1 if allowed
static ArtifactID creatureToMachineID(CreatureID id); static ArtifactID creatureToMachineID(CreatureID id);
static CreatureID machineIDToCreature(ArtifactID id); static CreatureID machineIDToCreature(ArtifactID id);