OpenTTD Source: VehicleOrderSaver Class Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Private Attributes
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.

## Private Attributes
Train * | v
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.

## Constructor & Destructor Documentation

## ◆ VehicleOrderSaver()

VehicleOrderSaver::VehicleOrderSaver | ( | Train * | _v | ) |
| inline

Definition at line 2610 of file train_cmd.cpp.

## ◆ ~VehicleOrderSaver()

VehicleOrderSaver::~VehicleOrderSaver | ( |  | ) |
| inline

Restore the saved order to the vehicle, if Restore() has not already been called.

Definition at line 2636 of file train_cmd.cpp.

References Restore().

## Member Function Documentation

## ◆ Restore()

void VehicleOrderSaver::Restore | ( |  | ) |
| inline

Restore the saved order to the vehicle.

Definition at line 2624 of file train_cmd.cpp.

References AssignBit(), Vehicle::current_order, Vehicle::dest_tile, GroundVehicle< T, Type >::gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS, and Vehicle::last_station_visited.

Referenced by ~VehicleOrderSaver().

## ◆ SwitchToNextOrder()

bool VehicleOrderSaver::SwitchToNextOrder | ( | bool | skip_first | ) |
| inline

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

Parameters

  skip_first | Shall 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 BaseConsist::cur_real_order_index, Vehicle::current_order, Order::GetDepotOrderType(), Vehicle::GetNumOrders(), Vehicle::GetOrder(), Order::GetType(), INVALID_VEH_ORDER_ID, ODTFB_SERVICE, ProcessConditionalOrder(), and UpdateOrderDest().

## Field Documentation

## ◆ index

VehicleOrderID VehicleOrderSaver::index
| private

Definition at line 2605 of file train_cmd.cpp.

## ◆ old_dest_tile

TileIndex VehicleOrderSaver::old_dest_tile
| private

Definition at line 2603 of file train_cmd.cpp.

## ◆ old_last_station_visited

StationID VehicleOrderSaver::old_last_station_visited
| private

Definition at line 2604 of file train_cmd.cpp.

## ◆ old_order

Order VehicleOrderSaver::old_order
| private

Definition at line 2602 of file train_cmd.cpp.

## ◆ restored

bool VehicleOrderSaver::restored
| private

Definition at line 2607 of file train_cmd.cpp.

## ◆ suppress_implicit_orders

bool VehicleOrderSaver::suppress_implicit_orders
| private

Definition at line 2606 of file train_cmd.cpp.

## ◆ v

Train* VehicleOrderSaver::v
| private

Definition at line 2601 of file train_cmd.cpp.

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

- src/train_cmd.cpp