summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-20 20:15:34 +0000
committerrubidium <rubidium@openttd.org>2007-10-20 20:15:34 +0000
commit3fe8be47ffa73cc8309d7f8ed797008828153d3f (patch)
treea5205d5f834f04646e3524820ad9dc0cf6dea938 /src
parentfc9ebd257f4f5d033dd52f54e8560b3f03ffd34e (diff)
downloadopenttd-3fe8be47ffa73cc8309d7f8ed797008828153d3f.tar.xz
(svn r11317) -Fix [FS#1355]: don't read a variable of a destroyed vehicle as the value will be reset to 0.
Diffstat (limited to 'src')
-rw-r--r--src/roadveh_cmd.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 7f7799bfb..f24a990e6 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -367,6 +367,8 @@ CommandCost CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
}
+ CommandCost ret(-v->value);
+
if (flags & DC_EXEC) {
// Invalidate depot
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
@@ -377,7 +379,7 @@ CommandCost CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
delete v;
}
- return CommandCost(-v->value);
+ return ret;
}
struct RoadFindDepotData {