OpenTTD Source  20241120-master-g6d3adc6169
VehicleOrderSaver Class Reference

This class will save the current order of a vehicle and restore it on destruction. More...

Public Member Functions

 VehicleOrderSaver (Train *_v)
 
void Restore ()
 Restore the saved order to the vehicle.
 
 ~VehicleOrderSaver ()
 Restore the saved order to the vehicle, if Restore() has not already been called.
 
bool SwitchToNextOrder (bool skip_first)
 Set the current vehicle order to the next order in the order list. More...
 

Private Attributes

Trainv
 
Order old_order
 
TileIndex old_dest_tile
 
StationID old_last_station_visited
 
VehicleOrderID index
 
bool suppress_implicit_orders
 
bool restored
 

Detailed Description

This class will save the current order of a vehicle and restore it on destruction.

Definition at line 2599 of file train_cmd.cpp.

Member Function Documentation

◆ SwitchToNextOrder()

bool VehicleOrderSaver::SwitchToNextOrder ( bool  skip_first)
inline

Set the current vehicle order to the next order in the order list.

Parameters
skip_firstShall the first (i.e. active) order be skipped?
Returns
True if a suitable next order could be found.

Definition at line 2646 of file train_cmd.cpp.

References Vehicle::GetNumOrders(), Vehicle::GetOrder(), and Order::GetType().


The documentation for this class was generated from the following file: