1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

fixed random reward generation in CGVisitableOPW

This commit is contained in:
AlexVinS
2016-10-11 18:00:54 +03:00
parent 7db7ece143
commit 5c3f84138b
3 changed files with 13 additions and 4 deletions

View File

@@ -1108,25 +1108,27 @@ void CGVisitableOPW::setRandomReward(CRandomGenerator &rand)
{
case Obj::MYSTICAL_GARDEN:
info.resize(1);
info[0].limiter.numOfGrants = 1;
info[0].reward.resources.amin(0);
if (rand.nextInt(1) == 0)
{
info[0].reward.resources[Res::GEMS] = 5;
info[0].limiter.numOfGrants = 1;
}
else
{
info[0].reward.resources[Res::GOLD] = 500;
info[0].limiter.numOfGrants = 1;
}
break;
case Obj::WINDMILL:
info.resize(1);
info[0].reward.resources.amin(0);
// 3-6 of any resource but wood and gold
info[0].reward.resources[rand.nextInt(Res::MERCURY, Res::GEMS)] = rand.nextInt(3, 6);
info[0].limiter.numOfGrants = 1;
break;
case Obj::WATER_WHEEL:
info.resize(1);
info[0].reward.resources.amin(0);
info[0].reward.resources[Res::GOLD] = 500;
info[0].limiter.numOfGrants = 1;
break;