mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
Corrected treasure value rounding.
This commit is contained in:
@ -673,8 +673,9 @@ bool CRmgTemplateZone::createTreasurePile (CMapGenerator* gen, int3 &pos)
|
|||||||
}
|
}
|
||||||
ui32 desiredValue = gen->rand.nextInt(minValue, maxValue);
|
ui32 desiredValue = gen->rand.nextInt(minValue, maxValue);
|
||||||
//quantize value to let objects with value equal to max spawn too
|
//quantize value to let objects with value equal to max spawn too
|
||||||
float quant = (maxValue - minValue)/4.f;
|
ui32 diff = maxValue - minValue;
|
||||||
desiredValue = (boost::math::round(desiredValue / quant)) * quant;
|
float quant = (float)diff / 4.f;
|
||||||
|
desiredValue = (boost::math::round((float)(desiredValue - minValue) / quant)) * quant + minValue;
|
||||||
|
|
||||||
int currentValue = 0;
|
int currentValue = 0;
|
||||||
CGObjectInstance * object = nullptr;
|
CGObjectInstance * object = nullptr;
|
||||||
|
Reference in New Issue
Block a user