diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-10-31 22:07:22 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-12-16 22:28:32 +0100 |
commit | eab18f06a47e558fe313cb86c855e8949b01feed (patch) | |
tree | a6dd29dc2ea3eb44ea2432151fa392ccd31c7d73 /src/command_func.h | |
parent | 0f64ee5ce1548d9cda69917f27c5b1a3cb91823d (diff) | |
download | openttd-eab18f06a47e558fe313cb86c855e8949b01feed.tar.xz |
Codechange: Pass additional data as byte stream to command callbacks.
Diffstat (limited to 'src/command_func.h')
-rw-r--r-- | src/command_func.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/command_func.h b/src/command_func.h index 6a9b93ff5..9d603abcf 100644 --- a/src/command_func.h +++ b/src/command_func.h @@ -12,7 +12,7 @@ #include "command_type.h" #include "company_type.h" -#include <vector> +#include "misc/endian_buffer.hpp" #include "tile_map.h" /** @@ -34,9 +34,6 @@ static const CommandCost CMD_ERROR = CommandCost(INVALID_STRING_ID); */ #define return_cmd_error(errcode) return CommandCost(errcode); -/** Storage buffer for serialized command data. */ -typedef std::vector<byte> CommandDataBuffer; - CommandCost DoCommandPInternal(Commands cmd, StringID err_message, CommandCallback *callback, bool my_cmd, bool estimate_only, bool network_command, TileIndex tile, uint32 p1, uint32 p2, const std::string &text); void NetworkSendCommand(Commands cmd, StringID err_message, CommandCallback *callback, CompanyID company, TileIndex tile, uint32 p1, uint32 p2, const std::string &text); @@ -213,7 +210,7 @@ protected: InternalPostResult(res, tile, estimate_only, only_sending, err_message, my_cmd); if (!estimate_only && !only_sending && callback != nullptr) { - std::apply(callback, std::tuple_cat(std::tuple<const CommandCost &, Commands>{ res, Tcmd }, args)); + callback(Tcmd, res, tile, EndianBufferWriter<CommandDataBuffer>::FromValue(args)); } return res.Succeeded(); |