mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Parsing for CREATURE_TYPE_LIMITER
This commit is contained in:
		| @@ -1369,6 +1369,11 @@ CCreatureTypeLimiter::CCreatureTypeLimiter() | ||||
| 	includeUpgrades = false; | ||||
| } | ||||
|  | ||||
| void CCreatureTypeLimiter::setCreature (TCreature id) | ||||
| { | ||||
| 	creature = VLC->creh->creatures[id]; | ||||
| } | ||||
|  | ||||
| HasAnotherBonusLimiter::HasAnotherBonusLimiter( TBonusType bonus ) | ||||
| 	: type(bonus), subtype(0), isSubtypeRelevant(false) | ||||
| { | ||||
|   | ||||
| @@ -785,6 +785,7 @@ public: | ||||
|  | ||||
| 	CCreatureTypeLimiter(); | ||||
| 	CCreatureTypeLimiter(const CCreature &Creature, ui8 IncludeUpgrades = true); | ||||
| 	void setCreature (TCreature id); | ||||
|  | ||||
| 	int limit(const BonusLimitationContext &context) const OVERRIDE; | ||||
|  | ||||
|   | ||||
| @@ -1053,8 +1053,18 @@ Bonus * JsonUtils::parseBonus (const JsonNode &ability) | ||||
| 						shared_ptr<ILimiter> l; | ||||
| 						if (limiter["type"].String() == "CREATURE_TYPE_LIMITER") | ||||
| 						{ | ||||
| 							//continue; | ||||
| 							//l = make_shared<CCreatureTypeLimiter>(); //TODO: How the hell resolve pointer to creature? | ||||
| 							shared_ptr<CCreatureTypeLimiter> l2 = make_shared<CCreatureTypeLimiter>(); //TODO: How the hell resolve pointer to creature? | ||||
| 							const JsonVector vec = limiter["parameters"].Vector(); | ||||
| 							VLC->modh->identifiers.requestIdentifier(std::string("creature.") + vec[0].String(), [=](si32 creature) | ||||
| 							{ | ||||
| 								l2->setCreature (creature); | ||||
| 							}); | ||||
| 							if (vec.size() > 1) | ||||
| 							{ | ||||
| 								l2->includeUpgrades = vec[1].Bool(); | ||||
| 							} | ||||
| 							else | ||||
| 								l2->includeUpgrades = false; | ||||
| 						} | ||||
| 						if (limiter["type"].String() == "HAS_ANOTHER_BONUS_LIMITER") | ||||
| 						{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user