fixed precision loss in average computation, close #2016

This commit is contained in:
SpaceToad 2014-09-14 17:28:14 +02:00
parent 69ff44dc9f
commit 3d3085dd06

View file

@ -247,7 +247,7 @@ public class PipeTransportPower extends PipeTransport {
if (totalPowerConsumed > 0) {
for (int in = 0; in < 6; ++in) {
int powerConsumed = (int) Math.floor(internalPower[in] / totalPowerContained * totalPowerConsumed);
int powerConsumed = internalPower[in] * totalPowerConsumed / totalPowerContained;
displayPower[in] += powerConsumed;
}
}