mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-30 08:57:00 +02:00
VCAI will now check whether it actually has enough gold to buy a hero
This commit is contained in:
parent
907438c6f5
commit
03786fb63b
@ -2031,6 +2031,9 @@ void VCAI::tryRealize(Goals::Explore & g)
|
|||||||
|
|
||||||
void VCAI::tryRealize(Goals::RecruitHero & g)
|
void VCAI::tryRealize(Goals::RecruitHero & g)
|
||||||
{
|
{
|
||||||
|
if(cb->getResourceAmount(EGameResID::GOLD) < GameConstants::HERO_GOLD_COST)
|
||||||
|
throw cannotFulfillGoalException("Not enough gold to recruit hero!");
|
||||||
|
|
||||||
if(const CGTownInstance * t = findTownWithTavern())
|
if(const CGTownInstance * t = findTownWithTavern())
|
||||||
{
|
{
|
||||||
recruitHero(t, true);
|
recruitHero(t, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user