Merge branch 'master' into jgrpp
# Conflicts: # Makefile.src.in # findversion.sh # projects/determineversion.vbs # src/aircraft_cmd.cpp # src/lang/dutch.txt # src/linkgraph/linkgraph_gui.cpp # src/linkgraph/linkgraph_gui.h # src/order_cmd.cpp # src/settings_gui.cpp # src/smallmap_gui.cpp # src/town_cmd.cpp # src/viewport.cpp # src/water_map.h
This commit is contained in:
@@ -257,15 +257,18 @@ CommandCost CmdClearOrderBackup(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
* Removes an order from all vehicles. Triggers when, say, a station is removed.
|
||||
* @param type The type of the order (OT_GOTO_[STATION|DEPOT|WAYPOINT]).
|
||||
* @param destination The destination. Can be a StationID, DepotID or WaypointID.
|
||||
* @param hangar Only used for airports in the destination.
|
||||
* When false, remove airport and hangar orders.
|
||||
* When true, remove either airport or hangar order.
|
||||
*/
|
||||
/* static */ void OrderBackup::RemoveOrder(OrderType type, DestinationID destination)
|
||||
/* static */ void OrderBackup::RemoveOrder(OrderType type, DestinationID destination, bool hangar)
|
||||
{
|
||||
OrderBackup *ob;
|
||||
FOR_ALL_ORDER_BACKUPS(ob) {
|
||||
for (Order *order = ob->orders; order != NULL; order = order->next) {
|
||||
OrderType ot = order->GetType();
|
||||
if (ot == OT_GOTO_DEPOT && (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) continue;
|
||||
if (ot == OT_IMPLICIT || (IsHangarTile(ob->tile) && ot == OT_GOTO_DEPOT)) ot = OT_GOTO_STATION;
|
||||
if (ot == OT_IMPLICIT || (IsHangarTile(ob->tile) && ot == OT_GOTO_DEPOT && !hangar)) ot = OT_GOTO_STATION;
|
||||
if (ot == type && order->GetDestination() == destination) {
|
||||
/* Remove the order backup! If a station/depot gets removed, we can't/shouldn't restore those broken orders. */
|
||||
delete ob;
|
||||
|
Reference in New Issue
Block a user