mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fixed visitation of configurable town buildings by newly recruited heroes
and on building construction
This commit is contained in:
parent
abdb23f78f
commit
67132b3e7f
@ -476,7 +476,7 @@ void CTownRewardableBuilding::onHeroVisit(const CGHeroInstance *h) const
|
||||
cb->showBlockingDialog(&sd);
|
||||
};
|
||||
|
||||
if(!town->hasBuilt(bID) || cb->isVisitCoveredByAnotherQuery(town, h))
|
||||
if(!town->hasBuilt(bID))
|
||||
return;
|
||||
|
||||
if(!wasVisitedBefore(h))
|
||||
|
@ -322,8 +322,9 @@ void CGTownInstance::onHeroVisit(const CGHeroInstance * h) const
|
||||
cb->heroVisitCastle(this, h);
|
||||
}
|
||||
}
|
||||
else if(h->visitablePos() == visitablePos())
|
||||
else
|
||||
{
|
||||
assert(h->visitablePos() == this->visitablePos());
|
||||
bool commander_recover = h->commander && !h->commander->alive;
|
||||
if (commander_recover) // rise commander from dead
|
||||
{
|
||||
@ -344,10 +345,6 @@ void CGTownInstance::onHeroVisit(const CGHeroInstance * h) const
|
||||
cb->showInfoDialog(&iw);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->error("%s visits allied town of %s from different pos?", h->getNameTranslated(), getNameTranslated());
|
||||
}
|
||||
}
|
||||
|
||||
void CGTownInstance::onHeroLeave(const CGHeroInstance * h) const
|
||||
|
@ -1518,11 +1518,14 @@ void CGameHandler::takeCreatures(ObjectInstanceID objid, const std::vector<CStac
|
||||
|
||||
void CGameHandler::heroVisitCastle(const CGTownInstance * obj, const CGHeroInstance * hero)
|
||||
{
|
||||
HeroVisitCastle vc;
|
||||
vc.hid = hero->id;
|
||||
vc.tid = obj->id;
|
||||
vc.flags |= 1;
|
||||
sendAndApply(&vc);
|
||||
if (obj->visitingHero != hero && obj->garrisonHero != hero)
|
||||
{
|
||||
HeroVisitCastle vc;
|
||||
vc.hid = hero->id;
|
||||
vc.tid = obj->id;
|
||||
vc.flags |= 1;
|
||||
sendAndApply(&vc);
|
||||
}
|
||||
visitCastleObjects(obj, hero);
|
||||
giveSpells (obj, hero);
|
||||
|
||||
@ -2487,9 +2490,9 @@ bool CGameHandler::buildStructure(ObjectInstanceID tid, BuildingID requestedID,
|
||||
changeFogOfWar(t->getSightCenter(), t->getSightRadius(), t->getOwner(), ETileVisibility::REVEALED);
|
||||
|
||||
if(t->garrisonHero) //garrison hero first - consistent with original H3 Mana Vortex and Battle Scholar Academy levelup windows order
|
||||
visitCastleObjects(t, t->garrisonHero);
|
||||
objectVisited(t, t->garrisonHero);
|
||||
if(t->visitingHero)
|
||||
visitCastleObjects(t, t->visitingHero);
|
||||
objectVisited(t, t->visitingHero);
|
||||
|
||||
checkVictoryLossConditionsForPlayer(t->tempOwner);
|
||||
return true;
|
||||
|
@ -242,10 +242,7 @@ bool HeroPoolProcessor::hireHero(const ObjectInstanceID & objectID, const HeroTy
|
||||
gameHandler->giveResource(player, EGameResID::GOLD, -GameConstants::HERO_GOLD_COST);
|
||||
|
||||
if(town)
|
||||
{
|
||||
gameHandler->visitCastleObjects(town, recruitedHero);
|
||||
gameHandler->giveSpells(town, recruitedHero);
|
||||
}
|
||||
gameHandler->objectVisited(town, recruitedHero);
|
||||
|
||||
// If new hero has scouting he might reveal more terrain than we saw before
|
||||
gameHandler->changeFogOfWar(recruitedHero->getSightCenter(), recruitedHero->getSightRadius(), player, ETileVisibility::REVEALED);
|
||||
|
Loading…
Reference in New Issue
Block a user