diff options
author | frosch <frosch@openttd.org> | 2012-07-07 15:35:28 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-07-07 15:35:28 +0000 |
commit | 22632d5e9ae1851e4e59788b6d70640b0d7de7ea (patch) | |
tree | f8f3df540c7d3efbf3ae8592a19fe7b9d5730a76 | |
parent | e0cf1e3e946e4fe84eae582c388b64f1d247d008 (diff) | |
download | openttd-22632d5e9ae1851e4e59788b6d70640b0d7de7ea.tar.xz |
(svn r24382) -Fix: Call Vehicle::IsStoppedInDepot only for the first vehicle in a chain (i.e. primary vehicle or free wagon).
-rw-r--r-- | src/autoreplace_cmd.cpp | 2 | ||||
-rw-r--r-- | src/roadveh_cmd.cpp | 2 | ||||
-rw-r--r-- | src/train_cmd.cpp | 2 | ||||
-rw-r--r-- | src/vehicle_cmd.cpp | 1 |
4 files changed, 6 insertions, 1 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index 5ef230e64..95669a244 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -702,7 +702,7 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1 if (!was_stopped) cost.AddCost(CmdStartStopVehicle(v, true)); if (cost.Failed()) return cost; - assert(v->IsStoppedInDepot()); + assert(free_wagon || v->IsStoppedInDepot()); /* We have to construct the new vehicle chain to test whether it is valid. * Vehicle construction needs random bits, so we have to save the random seeds diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index f29efb60a..1798e75a3 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -356,6 +356,8 @@ CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 RoadVehicle *v = RoadVehicle::GetIfValid(p1); if (v == NULL) return CMD_ERROR; + if (!v->IsPrimaryVehicle()) return CMD_ERROR; + CommandCost ret = CheckOwnership(v->owner); if (ret.Failed()) return ret; diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 2a639666d..c78300f19 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1934,6 +1934,8 @@ CommandCost CmdForceTrainProceed(TileIndex tile, DoCommandFlag flags, uint32 p1, Train *t = Train::GetIfValid(p1); if (t == NULL) return CMD_ERROR; + if (!t->IsPrimaryVehicle()) return CMD_ERROR; + CommandCost ret = CheckOwnership(t->owner); if (ret.Failed()) return ret; diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 8899b5f32..cf225a210 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -991,6 +991,7 @@ CommandCost CmdSendVehicleToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1 Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20)); if (v == NULL) return CMD_ERROR; + if (!v->IsPrimaryVehicle()) return CMD_ERROR; return v->SendToDepot(flags, (DepotCommand)(p1 & DEPOT_COMMAND_MASK)); } |