DjWarmonger 16 ani în urmă
părinte
comite
76dab23dda
2 a modificat fișierele cu 11 adăugiri și 18 ștergeri
  1. 10 17
      hch/CObjectHandler.cpp
  2. 1 1
      hch/CObjectHandler.h

+ 10 - 17
hch/CObjectHandler.cpp

@@ -1666,7 +1666,7 @@ void CGTownInstance::onHeroVisit(const CGHeroInstance * h) const
 		else
 		{
 			cb->setOwner(id, h->tempOwner);
-			removeCapitols (h->getOwner(), true);
+			removeCapitols (h->getOwner());
 			cb->heroVisitCastle(id, h->id);
 		}
 	}
@@ -1706,8 +1706,6 @@ void CGTownInstance::initObj()
 			bonusingBuildings.push_back (new CTownBonus(17, this));
 			break;
 	}
-	if (getOwner() != 255)
-		removeCapitols (getOwner(), false); // destroy other capitols
 }
 
 void CGTownInstance::newTurn() const
@@ -1752,31 +1750,26 @@ void CGTownInstance::fightOver( const CGHeroInstance *h, BattleResult *result )
 {
 	if(result->winner == 0)
 	{
-		removeCapitols (h->getOwner(), true);
+		removeCapitols (h->getOwner());
 		cb->setOwner (id, h->tempOwner); //give control after checkout is done
 	}
 }
 
-void CGTownInstance::removeCapitols (ui8 owner, bool me) const
+void CGTownInstance::removeCapitols (ui8 owner) const
 { 
-	if (hasCapitol()) // search for older capitol
+	if (hasCapitol()) // search if there's an older capitol
 	{ 
 		PlayerState* state = cb->gameState()->getPlayer (owner); //get all towns owned by player
 		for (std::vector<CGTownInstance*>::const_iterator i = state->towns.begin(); i < state->towns.end(); ++i) 
 		{ 
 			if (*i != this && (*i)->hasCapitol()) 
 			{ 
-				if (me) 
-				{ 
-					RazeStructures rs; 
-					rs.tid = id; 
-					rs.bid.insert(13); 
-					rs.destroyed = destroyed;  
-					cb->sendAndApply(&rs); 
-					return; 
-				} 
-				else 
-					(*i)->builtBuildings.erase(13); //destroy all other capitols at the beginning of game 
+				RazeStructures rs; 
+				rs.tid = id; 
+				rs.bid.insert(13); 
+				rs.destroyed = destroyed;  
+				cb->sendAndApply(&rs); 
+				return; 
 			} 
 		} 
 	} 

+ 1 - 1
hch/CObjectHandler.h

@@ -492,7 +492,7 @@ public:
 	bool hasCapitol() const;
 	int dailyIncome() const; //calculates daily income of this town
 	int spellsAtLevel(int level, bool checkGuild) const; //levels are counted from 1 (1 - 5)
-	void removeCapitols (ui8 owner, bool me) const;
+	void removeCapitols (ui8 owner) const;
 	int defenceBonus(int type) const;//primary skills bonuses for defending hero
 
 	CGTownInstance();