mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r14090) -Fix: the vehicle window of articulated road vehicles would show the clone/refit button when the vehicle was not completely stopped in the depot.
This commit is contained in:
parent
38905d596f
commit
d063758582
@ -78,6 +78,7 @@ struct RoadVehicle : public Vehicle {
|
|||||||
int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
|
int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
|
||||||
Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * GetPriceByIndex(RoadVehInfo(this->engine_type)->running_cost_class); }
|
Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * GetPriceByIndex(RoadVehInfo(this->engine_type)->running_cost_class); }
|
||||||
bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
|
bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
|
||||||
|
bool IsStoppedInDepot() const;
|
||||||
void Tick();
|
void Tick();
|
||||||
void OnNewDay();
|
void OnNewDay();
|
||||||
TileIndex GetOrderStationLocation(StationID station);
|
TileIndex GetOrderStationLocation(StationID station);
|
||||||
|
@ -305,14 +305,14 @@ void ClearSlot(Vehicle *v)
|
|||||||
DEBUG(ms, 3, "Clearing slot at 0x%X", rs->xy);
|
DEBUG(ms, 3, "Clearing slot at 0x%X", rs->xy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CheckRoadVehInDepotStopped(const Vehicle *v)
|
bool RoadVehicle::IsStoppedInDepot() const
|
||||||
{
|
{
|
||||||
TileIndex tile = v->tile;
|
TileIndex tile = this->tile;
|
||||||
|
|
||||||
if (!IsRoadDepotTile(tile)) return false;
|
if (!IsRoadDepotTile(tile)) return false;
|
||||||
if (IsRoadVehFront(v) && !(v->vehstatus & VS_STOPPED)) return false;
|
if (IsRoadVehFront(this) && !(this->vehstatus & VS_STOPPED)) return false;
|
||||||
|
|
||||||
for (; v != NULL; v = v->Next()) {
|
for (const Vehicle *v = this; v != NULL; v = v->Next()) {
|
||||||
if (v->u.road.state != RVSB_IN_DEPOT || v->tile != tile) return false;
|
if (v->u.road.state != RVSB_IN_DEPOT || v->tile != tile) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -336,7 +336,7 @@ CommandCost CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
|
|
||||||
if (HASBITS(v->vehstatus, VS_CRASHED)) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE);
|
if (HASBITS(v->vehstatus, VS_CRASHED)) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE);
|
||||||
|
|
||||||
if (!CheckRoadVehInDepotStopped(v)) {
|
if (!v->IsStoppedInDepot()) {
|
||||||
return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
|
return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2008,7 +2008,7 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
v = GetVehicle(p1);
|
v = GetVehicle(p1);
|
||||||
|
|
||||||
if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
|
if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
|
||||||
if (!CheckRoadVehInDepotStopped(v)) return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
|
if (!v->IsStoppedInDepot()) return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
|
||||||
if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_REFIT_DESTROYED_VEHICLE);
|
if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_REFIT_DESTROYED_VEHICLE);
|
||||||
|
|
||||||
if (new_cid >= NUM_CARGO) return CMD_ERROR;
|
if (new_cid >= NUM_CARGO) return CMD_ERROR;
|
||||||
|
Loading…
Reference in New Issue
Block a user