Support cond order to continue loading at station without moving for ships
This commit is contained in:
@@ -870,7 +870,7 @@ static void ShipController(Ship *v)
|
|||||||
|
|
||||||
if (ShipMoveUpDownOnLock(v)) return;
|
if (ShipMoveUpDownOnLock(v)) return;
|
||||||
|
|
||||||
if (!ShipAccelerate(v)) return;
|
if (!ShipAccelerate(v) && !v->current_order.IsType(OT_LEAVESTATION)) return;
|
||||||
|
|
||||||
gp = GetNewVehiclePos(v);
|
gp = GetNewVehiclePos(v);
|
||||||
if (v->state != TRACK_BIT_WORMHOLE) {
|
if (v->state != TRACK_BIT_WORMHOLE) {
|
||||||
@@ -888,8 +888,25 @@ static void ShipController(Ship *v)
|
|||||||
/* A leave station order only needs one tick to get processed, so we can
|
/* A leave station order only needs one tick to get processed, so we can
|
||||||
* always skip ahead. */
|
* always skip ahead. */
|
||||||
if (v->current_order.IsType(OT_LEAVESTATION)) {
|
if (v->current_order.IsType(OT_LEAVESTATION)) {
|
||||||
|
StationID station_id = v->current_order.GetDestination();
|
||||||
v->current_order.Free();
|
v->current_order.Free();
|
||||||
|
|
||||||
|
bool may_reverse = ProcessOrders(v);
|
||||||
|
|
||||||
|
if (v->current_order.IsType(OT_GOTO_STATION) && v->current_order.GetDestination() == station_id && IsDockingTile(gp.new_tile)) {
|
||||||
|
Station *st = Station::Get(station_id);
|
||||||
|
if (st->facilities & FACIL_DOCK && st->docking_station.Contains(gp.new_tile) && IsShipDestinationTile(gp.new_tile, station_id)) {
|
||||||
|
v->last_station_visited = station_id;
|
||||||
|
ShipArrivesAt(v, st);
|
||||||
|
v->BeginLoading();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
v->PlayLeaveStationSound();
|
||||||
|
|
||||||
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
|
||||||
|
if (may_reverse && CheckReverseShip(v)) goto reverse_direction;
|
||||||
/* Test if continuing forward would lead to a dead-end, moving into the dock. */
|
/* Test if continuing forward would lead to a dead-end, moving into the dock. */
|
||||||
DiagDirection exitdir = VehicleExitDir(v->direction, v->state);
|
DiagDirection exitdir = VehicleExitDir(v->direction, v->state);
|
||||||
TileIndex tile = TileAddByDiagDir(v->tile, exitdir);
|
TileIndex tile = TileAddByDiagDir(v->tile, exitdir);
|
||||||
|
@@ -3522,7 +3522,7 @@ void Vehicle::HandleLoading(bool mode)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->type != VEH_TRAIN) this->PlayLeaveStationSound();
|
if (this->type != VEH_TRAIN && this->type != VEH_SHIP) this->PlayLeaveStationSound();
|
||||||
|
|
||||||
this->LeaveStation();
|
this->LeaveStation();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user