summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-01-15 17:32:42 +0000
committerbjarni <bjarni@openttd.org>2007-01-15 17:32:42 +0000
commit0026ea84d15994ea4e31bd9ea2f556ba30ddf66d (patch)
treefd6bb646b1e356f59161ab5c558887bdf3372f7c /src
parent0fbdae2828f74774ed80d72fd191c318179c33ce (diff)
downloadopenttd-0026ea84d15994ea4e31bd9ea2f556ba30ddf66d.tar.xz
(svn r8147) -Fix: [autoreplace] v->leave_depot_instantly was not always reset correctly
While it's not certain if this would have any serious sideeffects (or any at all), it's reset when intended now
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 69fabc10f..d2a44652d 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2138,7 +2138,7 @@ static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
const Player *p = GetPlayer(v->owner);
byte flags = 0;
int32 cost, temp_cost = 0;
- bool stopped = false;
+ bool stopped;
/* Remember the length in case we need to trim train later on
* If it's not a train, the value is unused
@@ -2156,11 +2156,11 @@ static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
assert(v->vehstatus & VS_STOPPED); // the vehicle should have been stopped in VehicleEnteredDepotThisTick() if needed
- if (v->leave_depot_instantly) {
- // we stopped the vehicle to do this, so we have to remember to start it again when we are done
- // we need to store this info as the engine might be replaced and lose this info
- stopped = true;
- }
+ /* Remember the flag v->leave_depot_instantly because if we replace the vehicle, the vehicle holding this flag will be sold
+ * If it is set, then we only stopped the vehicle to replace it (if needed) and we will need to start it again.
+ * We also need to reset the flag since it should remain false except from when the vehicle enters a depot until autoreplace is handled in the same tick */
+ stopped = v->leave_depot_instantly;
+ v->leave_depot_instantly = false;
for (;;) {
cost = 0;