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:
@ -21,6 +21,7 @@
|
|||||||
#include "../mapObjects/CGHeroInstance.h"
|
#include "../mapObjects/CGHeroInstance.h"
|
||||||
#include "../networkPacks/PacksForClient.h"
|
#include "../networkPacks/PacksForClient.h"
|
||||||
#include "../networkPacks/PacksForClientBattle.h"
|
#include "../networkPacks/PacksForClientBattle.h"
|
||||||
|
#include "../networkPacks/StackLocation.h"
|
||||||
#include "../serializer/JsonSerializeFormat.h"
|
#include "../serializer/JsonSerializeFormat.h"
|
||||||
|
|
||||||
#include <vstd/RNG.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
|
void CRewardableObject::blockingDialogAnswered(const CGHeroInstance * hero, int32_t answer) const
|
||||||
{
|
{
|
||||||
if(isGuarded())
|
if(isGuarded())
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
void onHeroVisit(const CGHeroInstance *h) const override;
|
void onHeroVisit(const CGHeroInstance *h) const override;
|
||||||
|
|
||||||
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
||||||
|
void garrisonDialogClosed(const CGHeroInstance *hero) const override;
|
||||||
|
|
||||||
///possibly resets object state
|
///possibly resets object state
|
||||||
void newTurn(vstd::RNG & rand) const override;
|
void newTurn(vstd::RNG & rand) const override;
|
||||||
|
Reference in New Issue
Block a user