mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Do not use CCreature in CSimpleArmy
This commit is contained in:
		
				
					committed by
					
						 ArseniyShestakov
						ArseniyShestakov
					
				
			
			
				
	
			
			
			
						parent
						
							03cfd2cb78
						
					
				
				
					commit
					e666b2740c
				
			| @@ -126,12 +126,6 @@ bool CCallback::dismissHero(const CGHeroInstance *hero) | ||||
| 	return true; | ||||
| } | ||||
|  | ||||
| // int CCallback::getMySerial() const | ||||
| // { | ||||
| // 	boost::shared_lock<boost::shared_mutex> lock(*gs->mx); | ||||
| // 	return gs->players[player].serial; | ||||
| // } | ||||
|  | ||||
| bool CCallback::swapArtifacts(const ArtifactLocation &l1, const ArtifactLocation &l2) | ||||
| { | ||||
| 	ExchangeArtifacts ea; | ||||
|   | ||||
| @@ -126,10 +126,7 @@ public: | ||||
| 	int mergeStacks(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2) override; //first goes to the second | ||||
| 	int splitStack(const CArmedInstance *s1, const CArmedInstance *s2, SlotID p1, SlotID p2, int val) override; | ||||
| 	bool dismissHero(const CGHeroInstance * hero) override; | ||||
| 	//bool swapArtifacts(const CGHeroInstance * hero1, ui16 pos1, const CGHeroInstance * hero2, ui16 pos2); | ||||
| 	bool swapArtifacts(const ArtifactLocation &l1, const ArtifactLocation &l2) override; | ||||
| 	//bool moveArtifact(const CGHeroInstance * hero, ui16 src, const CStackInstance * stack, ui16 dest); // TODO: unify classes | ||||
| 	//bool moveArtifact(const CStackInstance * stack, ui16 src , const CGHeroInstance * hero, ui16 dest); // TODO: unify classes | ||||
| 	bool assembleArtifacts(const CGHeroInstance * hero, ArtifactPosition artifactSlot, bool assemble, ArtifactID assembleTo) override; | ||||
| 	bool buildBuilding(const CGTownInstance *town, BuildingID buildingID) override; | ||||
| 	void recruitCreatures(const CGDwelling * obj, const CArmedInstance * dst, CreatureID ID, ui32 amount, si32 level=-1) override; | ||||
|   | ||||
| @@ -399,10 +399,7 @@ void CCreatureSet::setToArmy(CSimpleArmy &src) | ||||
| 	{ | ||||
| 		auto i = src.army.begin(); | ||||
|  | ||||
| 		assert(i->second.type); | ||||
| 		assert(i->second.count); | ||||
|  | ||||
| 		putStack(i->first, new CStackInstance(i->second.type, i->second.count)); | ||||
| 		putStack(i->first, new CStackInstance(i->second.first, i->second.second)); | ||||
| 		src.army.erase(i); | ||||
| 	} | ||||
| } | ||||
| @@ -919,6 +916,6 @@ CSimpleArmy::operator bool() const | ||||
| bool CSimpleArmy::setCreature(SlotID slot, CreatureID cre, TQuantity count) | ||||
| { | ||||
| 	assert(!vstd::contains(army, slot)); | ||||
| 	army[slot] = CStackBasicDescriptor(cre, count); | ||||
| 	army[slot] = std::make_pair(cre, count); | ||||
| 	return true; | ||||
| } | ||||
|   | ||||
| @@ -135,7 +135,7 @@ public: | ||||
| }; | ||||
|  | ||||
| typedef std::map<SlotID, CStackInstance*> TSlots; | ||||
| typedef std::map<SlotID, CStackBasicDescriptor> TSimpleSlots; | ||||
| typedef std::map<SlotID, std::pair<CreatureID, TQuantity>> TSimpleSlots; | ||||
|  | ||||
| class IArmyDescriptor | ||||
| { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user