mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-24 03:56:43 +00:00
(svn r23795) [1.1] -Backport from trunk:
- Fix: Make default timeouts for certain network states lower and configurable [FS#4955] (r23764) - Fix: Check whether a water tile is really empty when overbuilding it with an object [FS#4956] (r23763) - Fix: Missing locking causing crash in extreme case when being in the MP lobby [FS#4938] (r23752) - Fix: Clear the backed up orders of a removed station as well, otherwise one could create orders to a station that was never in the original backupped orders. For example a road vehicle trying to go to a buoy [FS#4876] (r23464) - Fix: Do not assume all industries that cut trees have tile (0,0) and wait until all tiles of an industry are completed before starting to cut trees (r23458)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "order_backup.h"
|
||||
#include "vehicle_base.h"
|
||||
#include "window_func.h"
|
||||
#include "station_map.h"
|
||||
|
||||
OrderBackupPool _order_backup_pool("BackupOrder");
|
||||
INSTANTIATE_POOL_METHODS(OrderBackup)
|
||||
@@ -262,3 +263,25 @@ void InitializeOrderBackups()
|
||||
{
|
||||
_order_backup_pool.CleanPool();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* static */ void OrderBackup::RemoveOrder(OrderType type, DestinationID destination)
|
||||
{
|
||||
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 == 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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user