#include "order_type.h"
#include "vehicle_type.h"
#include "tile_type.h"
#include "group_type.h"
#include "date_type.h"
Go to the source code of this file.
Data Structures | |
struct | BackuppedOrders |
Defines | |
#define | MIN_SERVINT_PERCENT 5 |
#define | MAX_SERVINT_PERCENT 90 |
#define | MIN_SERVINT_DAYS 30 |
#define | MAX_SERVINT_DAYS 800 |
Functions | |
void | BackupVehicleOrders (const Vehicle *v, BackuppedOrders *order=&_backup_orders_data) |
Backup a vehicle order-list, so you can replace a vehicle without losing the order-list. | |
void | RestoreVehicleOrders (const Vehicle *v, const BackuppedOrders *order=&_backup_orders_data) |
Restore vehicle orders that are backupped via BackupVehicleOrders. | |
void | RemoveOrderFromAllVehicles (OrderType type, DestinationID destination) |
Removes an order from all vehicles. | |
void | InvalidateVehicleOrder (const Vehicle *v, int data) |
Updates the widgets of a vehicle which contains the order-data. | |
bool | VehicleHasDepotOrders (const Vehicle *v) |
Checks if a vehicle has a GOTO_DEPOT in his order list. | |
void | CheckOrders (const Vehicle *) |
Check the orders of a vehicle, to see if there are invalid orders and stuff. | |
void | DeleteVehicleOrders (Vehicle *v, bool keep_orderlist=false) |
Delete all orders from a vehicle. | |
bool | ProcessOrders (Vehicle *v) |
Handle the orders of a vehicle and determine the next place to go to if needed. | |
bool | UpdateOrderDest (Vehicle *v, const Order *order, int conditional_depth=0) |
Update the vehicle's destination tile from an order. | |
VehicleOrderID | ProcessConditionalOrder (const Order *order, const Vehicle *v) |
Process a conditional order and determine the next order. | |
void | DrawOrderString (const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int width) |
Date | GetServiceIntervalClamped (uint index) |
Get the service interval domain. | |
Variables | |
TileIndex | _backup_orders_tile |
BackuppedOrders | _backup_orders_data |
Definition in file order_func.h.
void BackupVehicleOrders | ( | const Vehicle * | v, | |
BackuppedOrders * | bak | |||
) |
Backup a vehicle order-list, so you can replace a vehicle without losing the order-list.
Definition at line 1221 of file order_cmd.cpp.
void CheckOrders | ( | const Vehicle * | v | ) |
Check the orders of a vehicle, to see if there are invalid orders and stuff.
Definition at line 1378 of file order_cmd.cpp.
References _settings_client, AddNewsItem(), GetLastVehicleOrder(), ClientSettings::gui, INVALID_TILE, NS_ADVICE, and GUISettings::order_review_system.
void DeleteVehicleOrders | ( | Vehicle * | v, | |
bool | keep_orderlist | |||
) |
Delete all orders from a vehicle.
Definition at line 1521 of file order_cmd.cpp.
References DeleteOrderWarnings().
Referenced by CmdCloneOrder(), CmdMoveRailVehicle(), CmdSellRailWagon(), and DecloneOrder().
Date GetServiceIntervalClamped | ( | uint | index | ) |
Get the service interval domain.
Get the new proposed service interval for the vehicle is indeed, clamped within the given bounds.
index | proposed service interval |
Definition at line 1536 of file order_cmd.cpp.
References _settings_game, Clamp(), VehicleSettings::servint_ispercent, and GameSettings::vehicle.
Referenced by CmdChangeServiceInt(), and CmdRestoreOrderIndex().
void InvalidateVehicleOrder | ( | const Vehicle * | v, | |
int | data | |||
) |
Updates the widgets of a vehicle which contains the order-data.
Definition at line 147 of file order_cmd.cpp.
References InvalidateWindow(), and InvalidateWindowData().
Referenced by CmdCloneOrder(), CmdDeleteOrder(), CmdInsertOrder(), CmdModifyOrder(), CmdMoveOrder(), CmdOrderRefit(), CmdSkipToOrder(), DecloneOrder(), ProcessOrders(), and RemoveOrderFromAllVehicles().
VehicleOrderID ProcessConditionalOrder | ( | const Order * | order, | |
const Vehicle * | v | |||
) |
Process a conditional order and determine the next order.
order | the order the vehicle currently has | |
v | the vehicle to update |
Definition at line 1581 of file order_cmd.cpp.
References CalcPercentVehicleFilled(), DAYS_IN_LEAP_YEAR, INVALID_VEH_ORDER_ID, OCV_AGE, OCV_LOAD_PERCENTAGE, OCV_MAX_SPEED, OCV_RELIABILITY, OCV_REQUIRES_SERVICE, OCV_UNCONDITIONALLY, and OrderConditionCompare().
Referenced by VehicleOrderSaver::SwitchToNextOrder(), and UpdateOrderDest().
bool ProcessOrders | ( | Vehicle * | v | ) |
Handle the orders of a vehicle and determine the next place to go to if needed.
v | the vehicle to do this for. |
Reversing because of order change is allowed only just after leaving a station (and the difficulty setting to allowed, of course) this can be detected because only after OT_LEAVESTATION, current_order will be reset to nothing. (That also happens if no order, but in that case it won't hit the point in code where may_reverse is checked)
Definition at line 1681 of file order_cmd.cpp.
References CheckForValidOrders(), GetStationIndex(), GetWindowClassForVehicleType(), INVALID_TILE, InvalidateVehicleOrder(), InvalidateWindowClasses(), IsTileType(), MP_STATION, ODTFB_PART_OF_ORDERS, ODTFB_SERVICE, ONSF_NO_STOP_AT_DESTINATION_STATION, and UpdateOrderDest().
void RemoveOrderFromAllVehicles | ( | OrderType | type, | |
DestinationID | destination | |||
) |
Removes an order from all vehicles.
Triggers when, say, a station is removed.
type | The type of the order (OT_GOTO_[STATION|DEPOT|WAYPOINT]). | |
destination | The destination. Can be a StationID, DepotID or WaypointID. |
Definition at line 1455 of file order_cmd.cpp.
References INVALID_VEH_ORDER_ID, InvalidateVehicleOrder(), InvalidateWindow(), and ODATFB_NEAREST_DEPOT.
Referenced by Station::~Station().
void RestoreVehicleOrders | ( | const Vehicle * | v, | |
const BackuppedOrders * | bak | |||
) |
Restore vehicle orders that are backupped via BackupVehicleOrders.
Definition at line 1272 of file order_cmd.cpp.
References _settings_game, CMD_ADD_VEHICLE_GROUP, CMD_CHANGE_TIMETABLE, CMD_CLONE_ORDER, CMD_INSERT_ORDER, CMD_MODIFY_ORDER, CMD_NO_TEST_IF_IN_NETWORK, CMD_RENAME_VEHICLE, CMD_RESTORE_ORDER_INDEX, DoCommandP(), MOF_LOAD, GameSettings::order, and OrderSettings::timetabling.
Referenced by CcBuildAircraft().
bool UpdateOrderDest | ( | Vehicle * | v, | |
const Order * | order, | |||
int | conditional_depth | |||
) |
Update the vehicle's destination tile from an order.
order | the order the vehicle currently has | |
v | the vehicle to update |
Definition at line 1607 of file order_cmd.cpp.
References AircraftNextAirportPos_and_Order(), CMD_REVERSE_TRAIN_DIRECTION, DC_EXEC, DoCommand(), INVALID_VEH_ORDER_ID, ODATFB_NEAREST_DEPOT, ProcessConditionalOrder(), and UpdateOrderDest().
Referenced by ProcessOrders(), VehicleOrderSaver::SwitchToNextOrder(), and UpdateOrderDest().
bool VehicleHasDepotOrders | ( | const Vehicle * | v | ) |
Checks if a vehicle has a GOTO_DEPOT in his order list.
Definition at line 1504 of file order_cmd.cpp.
Referenced by CheckSendAircraftToHangarForReplacement().