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

Fix initialization of gold pile from random resource with fixed amount

This commit is contained in:
Ivan Savenko
2024-06-17 20:08:07 +00:00
parent f2d870e651
commit c68f2da977
3 changed files with 8 additions and 4 deletions

View File

@@ -263,6 +263,9 @@ void CGResource::pickRandomObject(CRandomGenerator & rand)
ID = Obj::RESOURCE;
subID = rand.nextInt(EGameResID::WOOD, EGameResID::GOLD);
setType(ID, subID);
if (subID == EGameResID::GOLD && amount != CGResource::RANDOM_AMOUNT)
amount *= CGResource::GOLD_AMOUNT_MULTIPLIER;
}
}
@@ -275,7 +278,7 @@ void CGResource::initObj(CRandomGenerator & rand)
switch(resourceID().toEnum())
{
case EGameResID::GOLD:
amount = rand.nextInt(5, 10) * 100;
amount = rand.nextInt(5, 10) * CGResource::GOLD_AMOUNT_MULTIPLIER;
break;
case EGameResID::WOOD: case EGameResID::ORE:
amount = rand.nextInt(6, 10);