fixed potential integer overflow

This commit is contained in:
SpaceToad 2014-09-14 17:30:45 +02:00
parent 3d3085dd06
commit 2c5c282f2f

View file

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