AlexVinS 8 years ago
parent
commit
9718ef1543
2 changed files with 4 additions and 2 deletions
  1. 2 1
      lib/mapObjects/CGHeroInstance.cpp
  2. 2 1
      lib/mapObjects/CGTownInstance.cpp

+ 2 - 1
lib/mapObjects/CGHeroInstance.cpp

@@ -1561,7 +1561,8 @@ std::string CGHeroInstance::getHeroTypeName() const
 
 
 void CGHeroInstance::afterAddToMap(CMap * map)
 void CGHeroInstance::afterAddToMap(CMap * map)
 {
 {
-	map->heroesOnMap.push_back(this);
+	if(ID = Obj::HERO)
+		map->heroesOnMap.push_back(this);
 }
 }
 
 
 void CGHeroInstance::setHeroTypeName(const std::string & identifier)
 void CGHeroInstance::setHeroTypeName(const std::string & identifier)

+ 2 - 1
lib/mapObjects/CGTownInstance.cpp

@@ -1337,7 +1337,8 @@ void CGTownInstance::battleFinished(const CGHeroInstance *hero, const BattleResu
 
 
 void CGTownInstance::afterAddToMap(CMap * map)
 void CGTownInstance::afterAddToMap(CMap * map)
 {
 {
-	map->towns.push_back(this);
+	if(ID = Obj::TOWN)
+		map->towns.push_back(this);
 }
 }
 
 
 void CGTownInstance::serializeJsonOptions(JsonSerializeFormat & handler)
 void CGTownInstance::serializeJsonOptions(JsonSerializeFormat & handler)