|
@@ -1889,25 +1889,25 @@ CommandCost CmdBuildBuoy(TileIndex tile,
|
|
|
* Tests whether the player's vehicles have this station in orders
|
|
|
* When player == INVALID_PLAYER, then check all vehicles
|
|
|
* @param station station ID
|
|
|
* @param player player ID, INVALID_PLAYER to disable the check
|
|
|
*/
|
|
|
bool HasStationInUse(StationID station, PlayerID player)
|
|
|
{
|
|
|
const Vehicle *v;
|
|
|
FOR_ALL_VEHICLES(v) {
|
|
|
if (player == INVALID_PLAYER || v->owner == player) {
|
|
|
const Order *order;
|
|
|
FOR_VEHICLE_ORDERS(v, order) {
|
|
|
if (order->IsType(OT_GOTO_STATION) && order->dest == station) {
|
|
|
if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == station) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
static CommandCost RemoveBuoy(Station *st, uint32 flags)
|
|
|
{
|
|
|
/* XXX: strange stuff */
|
|
|
if (!IsValidPlayer(_current_player)) return_cmd_error(INVALID_STRING_ID);
|
|
@@ -2428,25 +2428,25 @@ static VehicleEnterTileStatus VehicleEnt
|
|
|
if (IsRoadStop(tile) && IsRoadVehFront(v)) {
|
|
|
/* Attempt to allocate a parking bay in a road stop */
|
|
|
RoadStop *rs = GetRoadStopByTile(tile, GetRoadStopType(tile));
|
|
|
|
|
|
if (IsDriveThroughStopTile(tile)) {
|
|
|
/* Vehicles entering a drive-through stop from the 'normal' side use first bay (bay 0). */
|
|
|
byte side = ((DirToDiagDir(v->direction) == ReverseDiagDir(GetRoadStopDir(tile))) == (v->u.road.overtaking == 0)) ? 0 : 1;
|
|
|
|
|
|
if (!rs->IsFreeBay(side)) return VETSB_CANNOT_ENTER;
|
|
|
|
|
|
/* Check if the vehicle is stopping at this road stop */
|
|
|
if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
|
|
|
v->current_order.dest == GetStationIndex(tile)) {
|
|
|
v->current_order.GetDestination() == GetStationIndex(tile)) {
|
|
|
SetBit(v->u.road.state, RVS_IS_STOPPING);
|
|
|
rs->AllocateDriveThroughBay(side);
|
|
|
}
|
|
|
|
|
|
/* Indicate if vehicle is using second bay. */
|
|
|
if (side == 1) SetBit(v->u.road.state, RVS_USING_SECOND_BAY);
|
|
|
/* Indicate a drive-through stop */
|
|
|
SetBit(v->u.road.state, RVS_IN_DT_ROAD_STOP);
|
|
|
return VETSB_CONTINUE;
|
|
|
}
|
|
|
|
|
|
/* For normal (non drive-through) road stops */
|