mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r11317) -Fix [FS#1355]: don't read a variable of a destroyed vehicle as the value will be reset to 0.
This commit is contained in:
parent
5718567d1e
commit
28bcf5bb46
|
@ -367,6 +367,8 @@ CommandCost CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
|
return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandCost ret(-v->value);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
// Invalidate depot
|
// Invalidate depot
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
||||||
|
@ -377,7 +379,7 @@ CommandCost CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
delete v;
|
delete v;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandCost(-v->value);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RoadFindDepotData {
|
struct RoadFindDepotData {
|
||||||
|
|
Loading…
Reference in New Issue