mirror of https://github.com/OpenTTD/OpenTTD
Fix #11862: Ships leaving docks could be momentarily lost
When a ship is departing from a dock, and wants to go back to it again, the destination tile is set as the origin, making the ship have a OT_LEAVESTATION OrderType. With this order type, the docking tiles aren't added as origins even though the tile is still that of a dock. OT_LEAVESTATION OrderType still has the same destination as that of OT_GOTO_STATION, so assume they still belong to the same dock.pull/12156/head
parent
39784240e9
commit
10606d32aa
|
@ -44,8 +44,9 @@ protected:
|
|||
public:
|
||||
void SetDestination(const Ship *v)
|
||||
{
|
||||
if (v->current_order.IsType(OT_GOTO_STATION)) {
|
||||
if (v->current_order.IsType(OT_GOTO_STATION) || v->current_order.IsType(OT_LEAVESTATION)) {
|
||||
this->dest_station = v->current_order.GetDestination();
|
||||
assert(Station::IsValidID(this->dest_station));
|
||||
this->dest_tile = CalcClosestStationTile(this->dest_station, v->tile, StationType::Dock);
|
||||
this->dest_trackdirs = INVALID_TRACKDIR_BIT;
|
||||
} else {
|
||||
|
|
|
@ -184,8 +184,9 @@ public:
|
|||
Tpf pf(std::min(static_cast<int>(Map::Size() * NODES_PER_REGION) / WATER_REGION_NUMBER_OF_TILES, MAX_NUMBER_OF_NODES));
|
||||
pf.SetDestination(start_water_region_patch);
|
||||
|
||||
if (v->current_order.IsType(OT_GOTO_STATION)) {
|
||||
if (v->current_order.IsType(OT_GOTO_STATION) || v->current_order.IsType(OT_LEAVESTATION)) {
|
||||
DestinationID station_id = v->current_order.GetDestination();
|
||||
assert(Station::IsValidID(station_id));
|
||||
const BaseStation *station = BaseStation::Get(station_id);
|
||||
TileArea tile_area;
|
||||
station->GetTileArea(&tile_area, StationType::Dock);
|
||||
|
|
Loading…
Reference in New Issue