diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-11-02 22:58:40 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-12-16 22:28:32 +0100 |
commit | 211c630cbe4185a2adf8b8cd8f52ca58f8bf17ed (patch) | |
tree | 89290b522a2852d71e9a71c43b6d581fb8d1d36d /src/order_cmd.h | |
parent | de45a8729c0f1ab965e4adf4e6ad7095a4a678c8 (diff) | |
download | openttd-211c630cbe4185a2adf8b8cd8f52ca58f8bf17ed.tar.xz |
Codechange: Un-bitstuff order commands.
Diffstat (limited to 'src/order_cmd.h')
-rw-r--r-- | src/order_cmd.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/order_cmd.h b/src/order_cmd.h index fa3424ce4..aeb42b624 100644 --- a/src/order_cmd.h +++ b/src/order_cmd.h @@ -11,14 +11,16 @@ #define ORDER_CMD_H #include "command_type.h" +#include "order_base.h" +#include "misc/endian_buffer.hpp" -CommandProc CmdModifyOrder; -CommandProc CmdSkipToOrder; -CommandProc CmdDeleteOrder; -CommandProc CmdInsertOrder; -CommandProc CmdOrderRefit; -CommandProc CmdCloneOrder; -CommandProc CmdMoveOrder; +CommandCost CmdModifyOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID sel_ord, ModifyOrderFlags mof, uint16 data); +CommandCost CmdSkipToOrder(DoCommandFlag flags, VehicleID veh_id, VehicleOrderID sel_ord); +CommandCost CmdDeleteOrder(DoCommandFlag flags, VehicleID veh_id, VehicleOrderID sel_ord); +CommandCost CmdInsertOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID sel_ord, const Order &new_order); +CommandCost CmdOrderRefit(DoCommandFlag flags, VehicleID veh, VehicleOrderID order_number, CargoID cargo); +CommandCost CmdCloneOrder(DoCommandFlag flags, CloneOptions action, VehicleID veh_dst, VehicleID veh_src); +CommandCost CmdMoveOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID moving_order, VehicleOrderID target_order); CommandCost CmdClearOrderBackup(DoCommandFlag flags, TileIndex tile, ClientID user_id); DEF_CMD_TRAIT(CMD_MODIFY_ORDER, CmdModifyOrder, 0, CMDT_ROUTE_MANAGEMENT) @@ -30,4 +32,15 @@ DEF_CMD_TRAIT(CMD_CLONE_ORDER, CmdCloneOrder, 0, CMDT_ DEF_CMD_TRAIT(CMD_MOVE_ORDER, CmdMoveOrder, 0, CMDT_ROUTE_MANAGEMENT) DEF_CMD_TRAIT(CMD_CLEAR_ORDER_BACKUP, CmdClearOrderBackup, CMD_CLIENT_ID, CMDT_SERVER_SETTING) +template <typename Tcont, typename Titer> +inline EndianBufferWriter<Tcont, Titer> &operator <<(EndianBufferWriter<Tcont, Titer> &buffer, const Order &order) +{ + return buffer << order.type << order.flags << order.dest << order.refit_cargo << order.wait_time << order.travel_time << order.max_speed; +} + +inline EndianBufferReader &operator >>(EndianBufferReader &buffer, Order &order) +{ + return buffer >> order.type >> order.flags >> order.dest >> order.refit_cargo >> order.wait_time >> order.travel_time >> order.max_speed; +} + #endif /* ORDER_CMD_H */ |