diff options
author | glx <glx@openttd.org> | 2008-03-17 22:13:00 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2008-03-17 22:13:00 +0000 |
commit | 985dbaa093a9310bf176fb82a277ca858872aa3f (patch) | |
tree | f097528055876cd245b7fbf47b8a826d96fe16dd /src | |
parent | fbf70d53ec5b1d6d8f70c41a8fbc94e6504d3b75 (diff) | |
download | openttd-985dbaa093a9310bf176fb82a277ca858872aa3f.tar.xz |
(svn r12380) -Fix: update train acceleration and max speed after setting cached value to ensure the correct max speed is used with disabled real acceleration
Diffstat (limited to 'src')
-rw-r--r-- | src/train_cmd.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 67409c5e9..763a7ed96 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -291,7 +291,10 @@ void TrainConsistChanged(Vehicle* v) /* recalculate cached weights and power too (we do this *after* the rest, so it is known which wagons are powered and need extra weight added) */ TrainCargoChanged(v); - if (IsFrontEngine(v)) InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + if (IsFrontEngine(v)) { + UpdateTrainAcceleration(v); + InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + } } enum AccelType { @@ -792,7 +795,6 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 } TrainConsistChanged(v); - UpdateTrainAcceleration(v); UpdateTrainGroupID(v); if (!HasBit(p2, 1)) { // check if the cars should be added to the new vehicle @@ -1247,7 +1249,6 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p TrainConsistChanged(src_head); UpdateTrainGroupID(src_head); if (IsFrontEngine(src_head)) { - UpdateTrainAcceleration(src_head); /* Update the refit button and window */ InvalidateWindow(WC_VEHICLE_REFIT, src_head->index); InvalidateWindowWidget(WC_VEHICLE_VIEW, src_head->index, VVW_WIDGET_REFIT_VEH); @@ -1261,7 +1262,6 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p TrainConsistChanged(dst_head); UpdateTrainGroupID(dst_head); if (IsFrontEngine(dst_head)) { - UpdateTrainAcceleration(dst_head); /* Update the refit button and window */ InvalidateWindowWidget(WC_VEHICLE_VIEW, dst_head->index, VVW_WIDGET_REFIT_VEH); InvalidateWindow(WC_VEHICLE_REFIT, dst_head->index); @@ -1434,10 +1434,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) NormaliseTrainConsist(first); TrainConsistChanged(first); UpdateTrainGroupID(first); - if (IsFrontEngine(first)) { - InvalidateWindow(WC_VEHICLE_REFIT, first->index); - UpdateTrainAcceleration(first); - } + if (IsFrontEngine(first)) InvalidateWindow(WC_VEHICLE_REFIT, first->index); } @@ -1503,7 +1500,6 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) NormaliseTrainConsist(first); TrainConsistChanged(first); UpdateTrainGroupID(first); - if (IsFrontEngine(first)) UpdateTrainAcceleration(first); InvalidateWindow(WC_VEHICLE_REFIT, first->index); } } break; |