mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Implement CArtHandler::isBigArtifact and CArtifact::isTradable
This commit is contained in:
		| @@ -64,6 +64,11 @@ bool CArtifact::isBig () const | ||||
| 	return VLC->arth->isBigArtifact(id); | ||||
| } | ||||
|  | ||||
| bool CArtifact::isTradable () const | ||||
| { | ||||
| 	return VLC->arth->isTradableArtifact(id); | ||||
| } | ||||
|  | ||||
| CArtifact::CArtifact() | ||||
| { | ||||
| 	setNodeType(ARTIFACT); | ||||
| @@ -578,6 +583,14 @@ bool CArtHandler::legalArtifact(ArtifactID id) | ||||
| 			!(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) | ||||
| { | ||||
| 	allowedArtifacts.clear(); | ||||
|   | ||||
| @@ -59,6 +59,7 @@ public: | ||||
| 	const std::string &EventText() const; | ||||
|  | ||||
| 	bool isBig () const; | ||||
| 	bool isTradable () const; | ||||
|  | ||||
| 	int getArtClassSerial() const; //0 - treasure, 1 - minor, 2 - major, 3 - relic, 4 - spell scroll, 5 - other | ||||
| 	std::string nodeName() const override; | ||||
| @@ -215,6 +216,7 @@ public: | ||||
| 	//void getAllowedArts(std::vector<ConstTransitivePtr<CArtifact> > &out, std::vector<CArtifact*> *arts, int flag); | ||||
| 	//void getAllowed(std::vector<ConstTransitivePtr<CArtifact> > &out, int flags); | ||||
| 	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 | ||||
| 	static ArtifactID creatureToMachineID(CreatureID id); | ||||
| 	static CreatureID machineIDToCreature(ArtifactID id); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user