1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix Neutral Creatures Weekly Growth

Made it so neutral creatures could not be picked as "Flavour of the Week".
It is checking neutral creatures hometown to do so.

Fixes #3046.
This commit is contained in:
Ewilhan 2019-05-06 14:12:14 +01:00
parent b5243602ca
commit ec4797d856

View File

@ -1673,8 +1673,12 @@ void CGameHandler::newTurn()
if (monthType < 25)
{
n.specialWeek = NewTurn::BONUS_GROWTH; //+5
std::pair<int, CreatureID> newMonster(54, VLC->creh->pickRandomMonster(getRandomGenerator()));
//TODO do not pick neutrals
std::pair<int, CreatureID> newMonster(54, CreatureID());
do
{
newMonster.second = VLC->creh->pickRandomMonster(getRandomGenerator());
} while (VLC->creh->creatures[newMonster.second] &&
VLC->townh->factions[VLC->creh->creatures[newMonster.second]->faction]->town == nullptr); // find first non neutral creature
n.creatureid = newMonster.second;
}
}