mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
CGEvent: avoid permanent event removal after visit. Fix issue 2339
This commit is contained in:
@@ -51,7 +51,7 @@ void CGPandoraBox::onHeroVisit(const CGHeroInstance * h) const
|
||||
|
||||
void CGPandoraBox::giveContentsUpToExp(const CGHeroInstance *h) const
|
||||
{
|
||||
cb->removeAfterVisit(this);
|
||||
afterSuccessfulVisit();
|
||||
|
||||
InfoWindow iw;
|
||||
iw.player = h->getOwner();
|
||||
@@ -331,6 +331,11 @@ void CGPandoraBox::heroLevelUpDone(const CGHeroInstance *hero) const
|
||||
giveContentsAfterExp(hero);
|
||||
}
|
||||
|
||||
void CGPandoraBox::afterSuccessfulVisit() const
|
||||
{
|
||||
cb->removeAfterVisit(this);
|
||||
}
|
||||
|
||||
void CGEvent::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
if(!(availableFor & (1 << h->tempOwner.getNum())))
|
||||
@@ -362,3 +367,13 @@ void CGEvent::activated( const CGHeroInstance * h ) const
|
||||
giveContentsUpToExp(h);
|
||||
}
|
||||
}
|
||||
|
||||
void CGEvent::afterSuccessfulVisit() const
|
||||
{
|
||||
if(removeAfterVisit)
|
||||
{
|
||||
cb->removeAfterVisit(this);
|
||||
}
|
||||
else if(hasGuardians)
|
||||
hasGuardians = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user