1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Clear rewardable garrison after player is done picking units

This commit is contained in:
Ivan Savenko
2025-04-30 18:00:43 +03:00
parent 544adfd545
commit 7fc1990282
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "../mapObjects/CGHeroInstance.h"
#include "../networkPacks/PacksForClient.h"
#include "../networkPacks/PacksForClientBattle.h"
#include "../networkPacks/StackLocation.h"
#include "../serializer/JsonSerializeFormat.h"
#include <vstd/RNG.h>
@ -83,6 +84,14 @@ void CRewardableObject::battleFinished(const CGHeroInstance *hero, const BattleR
}
}
void CRewardableObject::garrisonDialogClosed(const CGHeroInstance *hero) const
{
// if visitor received creatures as rewards, but does not have free slots, he will leave some units
// inside rewardable object, which might get treated as guards later
while(!stacks.empty())
cb->eraseStack(StackLocation(id, stacks.begin()->first));
}
void CRewardableObject::blockingDialogAnswered(const CGHeroInstance * hero, int32_t answer) const
{
if(isGuarded())