1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fixed bug 116 - constructing bonusing buildings will now affect town heroes.

This commit is contained in:
DjWarmonger 2009-10-06 06:15:56 +00:00
parent 3697b1d64e
commit 60085e2249
2 changed files with 9 additions and 5 deletions

View File

@ -1560,12 +1560,13 @@ void CGTownInstance::onHeroVisit(const CGHeroInstance * h) const
}
else
{
removeCapitols (h->getOwner(), true);
cb->setOwner(id, h->tempOwner);
removeCapitols (h->getOwner(), true);
cb->heroVisitCastle(id, h->id);
}
}
cb->heroVisitCastle(id, h->id);
else
cb->heroVisitCastle(id, h->id);
}
void CGTownInstance::onHeroLeave(const CGHeroInstance * h) const
@ -1626,7 +1627,7 @@ void CGTownInstance::removeCapitols (ui8 owner, bool me) const
{
if (hasCapitol()) // search for older capitol
{
PlayerState* state = cb->gameState()->getPlayer (owner);
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())

View File

@ -2053,7 +2053,10 @@ bool CGameHandler::buildStructure( si32 tid, si32 bid )
if(t->garrisonHero)
giveSpells(t,t->garrisonHero);
}
if(t->visitingHero)
vistiCastleObjects (t, t->visitingHero);
if(t->garrisonHero)
vistiCastleObjects (t, t->garrisonHero);
return true;
}
bool CGameHandler::razeStructure (si32 tid, si32 bid)