Merge branch 'master' into jgrpp-beta

# Conflicts:
#	src/command.cpp
#	src/console_cmds.cpp
#	src/group_gui.cpp
#	src/lang/catalan.txt
#	src/lang/czech.txt
#	src/lang/danish.txt
#	src/lang/greek.txt
#	src/lang/hungarian.txt
#	src/lang/irish.txt
#	src/lang/japanese.txt
#	src/lang/luxembourgish.txt
#	src/lang/norwegian_bokmal.txt
#	src/lang/romanian.txt
#	src/lang/russian.txt
#	src/lang/serbian.txt
#	src/lang/simplified_chinese.txt
#	src/lang/slovak.txt
#	src/lang/spanish_MX.txt
#	src/lang/swedish.txt
#	src/lang/tamil.txt
#	src/lang/traditional_chinese.txt
#	src/lang/turkish.txt
#	src/lang/ukrainian.txt
#	src/lang/vietnamese.txt
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_func.h
#	src/network/network_internal.h
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/saveload/afterload.cpp
#	src/saveload/newgrf_sl.cpp
#	src/saveload/saveload.h
#	src/script/script_instance.cpp
#	src/toolbar_gui.cpp
#	src/toolbar_gui.h
#	src/vehicle_gui.cpp
#	src/widgets/rail_widget.h
#	src/widgets/vehicle_widget.h
#	src/window.cpp
This commit is contained in:
Jonathan G Rennison
2021-11-03 00:45:12 +00:00
143 changed files with 3271 additions and 755 deletions

View File

@@ -3016,19 +3016,24 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
ClearDockingTilesCheckingNeighbours(tile1);
ClearDockingTilesCheckingNeighbours(tile2);
/* All ships that were going to our station, can't go to it anymore.
* Just clear the order, then automatically the next appropriate order
* will be selected and in case of no appropriate order it will just
* wander around the world. */
if (!(st->facilities & FACIL_DOCK)) {
for (Ship *s : Ship::Iterate()) {
if (s->current_order.IsType(OT_LOADING) && s->current_order.GetDestination() == st->index) {
s->LeaveStation();
}
for (Ship *s : Ship::Iterate()) {
/* Find all ships going to our dock. */
if (s->current_order.GetDestination() != st->index) {
continue;
}
if (s->current_order.IsType(OT_GOTO_STATION) && s->current_order.GetDestination() == st->index) {
s->SetDestTile(s->GetOrderStationLocation(st->index));
}
/* Find ships that are marked as "loading" but are no longer on a
* docking tile. Force them to leave the station (as they were loading
* on the removed dock). */
if (s->current_order.IsType(OT_LOADING) && !(IsDockingTile(s->tile) && IsShipDestinationTile(s->tile, st->index))) {
s->LeaveStation();
}
/* If we no longer have a dock, mark the order as invalid and send
* the ship to the next order (or, if there is none, make it
* wander the world). */
if (s->current_order.IsType(OT_GOTO_STATION) && !(st->facilities & FACIL_DOCK)) {
s->SetDestTile(s->GetOrderStationLocation(st->index));
}
}
}