mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r24382) -Fix: Call Vehicle::IsStoppedInDepot only for the first vehicle in a chain (i.e. primary vehicle or free wagon).
This commit is contained in:
parent
e0cf1e3e94
commit
22632d5e9a
|
@ -702,7 +702,7 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
if (!was_stopped) cost.AddCost(CmdStartStopVehicle(v, true));
|
if (!was_stopped) cost.AddCost(CmdStartStopVehicle(v, true));
|
||||||
if (cost.Failed()) return cost;
|
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.
|
/* 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
|
* Vehicle construction needs random bits, so we have to save the random seeds
|
||||||
|
|
|
@ -356,6 +356,8 @@ CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
RoadVehicle *v = RoadVehicle::GetIfValid(p1);
|
RoadVehicle *v = RoadVehicle::GetIfValid(p1);
|
||||||
if (v == NULL) return CMD_ERROR;
|
if (v == NULL) return CMD_ERROR;
|
||||||
|
|
||||||
|
if (!v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(v->owner);
|
CommandCost ret = CheckOwnership(v->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
|
|
|
@ -1934,6 +1934,8 @@ CommandCost CmdForceTrainProceed(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
Train *t = Train::GetIfValid(p1);
|
Train *t = Train::GetIfValid(p1);
|
||||||
if (t == NULL) return CMD_ERROR;
|
if (t == NULL) return CMD_ERROR;
|
||||||
|
|
||||||
|
if (!t->IsPrimaryVehicle()) return CMD_ERROR;
|
||||||
|
|
||||||
CommandCost ret = CheckOwnership(t->owner);
|
CommandCost ret = CheckOwnership(t->owner);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
|
|
|
@ -991,6 +991,7 @@ CommandCost CmdSendVehicleToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1
|
||||||
|
|
||||||
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 20));
|
||||||
if (v == NULL) return CMD_ERROR;
|
if (v == NULL) return CMD_ERROR;
|
||||||
|
if (!v->IsPrimaryVehicle()) return CMD_ERROR;
|
||||||
|
|
||||||
return v->SendToDepot(flags, (DepotCommand)(p1 & DEPOT_COMMAND_MASK));
|
return v->SendToDepot(flags, (DepotCommand)(p1 & DEPOT_COMMAND_MASK));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue