1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-21 11:22:45 +01:00

Codechange: Check command callbacks registration even in single player

This commit is contained in:
glx22
2025-12-21 15:39:29 +01:00
committed by Loïc Guilloux
parent 0a88c084ad
commit 95b913bbb7
2 changed files with 12 additions and 0 deletions

View File

@@ -28,6 +28,7 @@
static const CommandCost CMD_ERROR = CommandCost(INVALID_STRING_ID);
void NetworkSendCommand(Commands cmd, StringID err_message, CommandCallback *callback, CompanyID company, const CommandDataBuffer &cmd_data);
bool IsNetworkRegisteredCallback(CommandCallback *callback);
bool IsValidCommand(Commands cmd);
CommandFlags GetCommandFlags(Commands cmd);
@@ -196,6 +197,7 @@ public:
template <typename Tcallback>
static bool Post(StringID err_message, Tcallback *callback, Targs... args)
{
assert(::IsNetworkRegisteredCallback(reinterpret_cast<CommandCallback *>(reinterpret_cast<void(*)()>(callback))));
return InternalPost(err_message, callback, true, false, std::forward_as_tuple(args...));
}