1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

VCAI will now check whether it actually has enough gold to buy a hero

This commit is contained in:
Ivan Savenko 2024-04-06 15:43:24 +03:00
parent 907438c6f5
commit 03786fb63b

View File

@ -2031,6 +2031,9 @@ void VCAI::tryRealize(Goals::Explore & 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())
{
recruitHero(t, true);