| 
					
				 | 
			
			
				@@ -38,6 +38,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "../networkPacks/PacksForClientBattle.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "../constants/StringConstants.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #include "../battle/Unit.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "CConfigHandler.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 VCMI_LIB_NAMESPACE_BEGIN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1509,8 +1510,29 @@ std::string CGHeroInstance::getHeroTypeName() const 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void CGHeroInstance::afterAddToMap(CMap * map) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	auto existingHero = std::find_if(map->objects.begin(), map->objects.end(), [&](const CGObjectInstance * o) ->bool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return (o->ID == Obj::HERO || o->ID == Obj::PRISON) && o->subID == subID && o != this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if(existingHero != map->objects.end()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(settings["session"]["editor"].Bool()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			logGlobal->warn("Hero is already on the map at %s", (*existingHero)->visitablePos().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			logGlobal->error("Hero is already on the map at %s", (*existingHero)->visitablePos().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw std::runtime_error("Hero is already on the map"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if(ID == Obj::HERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		map->heroesOnMap.emplace_back(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void CGHeroInstance::afterRemoveFromMap(CMap* map) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 |