improve power transmission logic, add 7.0.26 changelog

This commit is contained in:
asiekierka 2015-09-28 10:59:02 +02:00
parent 0bfbffc722
commit 8882f934c8
2 changed files with 17 additions and 5 deletions

View file

@ -0,0 +1,10 @@
Improvements:
* [#3039] Slight item insertion optimization (Speiger)
* Improved power transmission logic (asie)
Bugs fixed:
* [#3041] GUI crash with Robot gate parameters (asie)
* [#3038] Server crash on corrupt BC map loading (asie)
* [#3035] Builder GUI crash (asie)

View file

@ -214,10 +214,12 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
}
if (totalPowerQuery > 0) {
int unusedPowerQuery = totalPowerQuery;
for (int j = 0; j < 6; ++j) {
if (j != i && powerQuery[j] > 0) {
Object ep = providers[j];
double watts = Math.min(internalPower[i] * powerQuery[j] / totalPowerQuery, internalPower[i]);
double watts = Math.min(internalPower[i] * powerQuery[j] / unusedPowerQuery, internalPower[i]);
unusedPowerQuery -= powerQuery[j];
if (ep instanceof IPipeTile && ((IPipeTile) ep).getPipeType() == IPipeTile.PipeType.POWER) {
Pipe<?> nearbyPipe = (Pipe<?>) ((IPipeTile) ep).getPipe();
@ -238,18 +240,17 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
iWatts = handler.receiveEnergy(ForgeDirection.VALID_DIRECTIONS[j].getOpposite(),
iWatts, false);
}
internalPower[i] -= iWatts;
dbgEnergyOutput[j] += iWatts;
} else if (ep instanceof IEnergyReceiver) {
IEnergyReceiver handler = (IEnergyReceiver) ep;
if (handler.canConnectEnergy(ForgeDirection.VALID_DIRECTIONS[j].getOpposite())) {
iWatts = handler.receiveEnergy(ForgeDirection.VALID_DIRECTIONS[j].getOpposite(),
iWatts, false);
}
internalPower[i] -= iWatts;
dbgEnergyOutput[j] += iWatts;
}
internalPower[i] -= iWatts;
dbgEnergyOutput[j] += iWatts;
powerAverage[j].push(iWatts);
powerAverage[i].push(iWatts);
}
@ -258,6 +259,7 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
}
}
}
short highestPower = 0;
for (int i = 0; i < 6; i++) {
powerAverage[i].tick();