OpenTTD Source: src/order_func.h Source File

OpenTTD Source 15.0-RC2

order_func.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef ORDER_FUNC_H
11#define ORDER_FUNC_H
12
13#include "order_type.h"
14#include "vehicle_type.h"
15#include "company_type.h"
16
17/* Functions */
18void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination, bool hangar = false);
19void InvalidateVehicleOrder(const Vehicle *v, int data);
20void CheckOrders(const Vehicle*);
21void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist = false, bool reset_order_indices = true);
22bool ProcessOrders(Vehicle *v);
23bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth = 0, bool pbs_look_ahead = false);
24 VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v);
25uint GetOrderDistance(VehicleOrderID prev, VehicleOrderID cur, const Vehicle *v, int conditional_depth = 0);
26
27void DrawOrderString(const Vehicle *v, const Order *order, VehicleOrderID order_index, int y, bool selected, bool timetable, int left, int middle, int right);
28
29static const uint DEF_SERVINT_DAYS_TRAINS = 150;
30static const uint DEF_SERVINT_DAYS_ROADVEH = 150;
31static const uint DEF_SERVINT_DAYS_AIRCRAFT = 100;
32static const uint DEF_SERVINT_DAYS_SHIPS = 360;
33static const uint MIN_SERVINT_DAYS = 30;
34static const uint MAX_SERVINT_DAYS = 800;
35
36static const uint DEF_SERVINT_MINUTES_TRAINS = 5;
37static const uint DEF_SERVINT_MINUTES_ROADVEH = 5;
38static const uint DEF_SERVINT_MINUTES_AIRCRAFT = 3;
39static const uint DEF_SERVINT_MINUTES_SHIPS = 12;
40static const uint MIN_SERVINT_MINUTES = 1;
41static const uint MAX_SERVINT_MINUTES = 30;
42
43static const uint DEF_SERVINT_PERCENT = 50;
44static const uint MIN_SERVINT_PERCENT = 5;
45static const uint MAX_SERVINT_PERCENT = 90;
46
47uint16_t GetServiceIntervalClamped(int interval, bool ispercent);
48
49#endif /* ORDER_FUNC_H */
company_type.h
Types related to companies.
GetServiceIntervalClamped
uint16_t GetServiceIntervalClamped(int interval, bool ispercent)
Clamp the service interval to the correct min/max.
Definition order_cmd.cpp:1862
ProcessOrders
bool ProcessOrders(Vehicle *v)
Handle the orders of a vehicle and determine the next place to go to if needed.
Definition order_cmd.cpp:2075
DeleteVehicleOrders
void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist=false, bool reset_order_indices=true)
Delete all orders from a vehicle.
Definition order_cmd.cpp:1830
UpdateOrderDest
bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth=0, bool pbs_look_ahead=false)
Update the vehicle's destination tile from an order.
Definition order_cmd.cpp:1946
InvalidateVehicleOrder
void InvalidateVehicleOrder(const Vehicle *v, int data)
Updates the widgets of a vehicle which contains the order-data.
Definition order_cmd.cpp:213
RemoveOrderFromAllVehicles
void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination, bool hangar=false)
Removes an order from all vehicles.
Definition order_cmd.cpp:1753
DrawOrderString
void DrawOrderString(const Vehicle *v, const Order *order, VehicleOrderID order_index, int y, bool selected, bool timetable, int left, int middle, int right)
Draws an order in order or timetable GUI.
Definition order_gui.cpp:223
ProcessConditionalOrder
VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v)
Process a conditional order and determine the next order.
Definition order_cmd.cpp:1916
GetOrderDistance
uint GetOrderDistance(VehicleOrderID prev, VehicleOrderID cur, const Vehicle *v, int conditional_depth=0)
Get the distance between two orders of a vehicle.
Definition order_cmd.cpp:589
CheckOrders
void CheckOrders(const Vehicle *)
Check the orders of a vehicle, to see if there are invalid orders and stuff.
Definition order_cmd.cpp:1678
order_type.h
Types related to orders.
VehicleOrderID
uint8_t VehicleOrderID
The index of an order within its current vehicle (not pool related)
Definition order_type.h:18
OrderType
OrderType
Order types.
Definition order_type.h:50
DestinationID
Definition order_type.h:21
Order
Definition order_base.h:33
Vehicle
Vehicle data structure.
Definition vehicle_base.h:205
vehicle_type.h
Types related to vehicles.