From 715f8c0218b10700a9d41c2ad54c8b0f1776e4f3 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 18 Apr 2024 18:41:36 +0200 Subject: [PATCH] Codefix: cast to "CommandCallback *" in a way cast-function-type-mismatch doesn't mind (#12529) --- src/command_func.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command_func.h b/src/command_func.h index ddf68aaf11..69cb9ebcac 100644 --- a/src/command_func.h +++ b/src/command_func.h @@ -250,7 +250,7 @@ public: template static Tret Unsafe(StringID err_message, Tcallback *callback, bool my_cmd, bool estimate_only, TileIndex location, std::tuple args) { - return Execute(err_message, reinterpret_cast(callback), my_cmd, estimate_only, false, location, std::move(args)); + return Execute(err_message, reinterpret_cast(reinterpret_cast(callback)), my_cmd, estimate_only, false, location, std::move(args)); } protected: @@ -301,7 +301,7 @@ protected: /* Only set client IDs when the command does not come from the network. */ if (!network_command && GetCommandFlags() & CMD_CLIENT_ID) SetClientIds(args, std::index_sequence_for{}); - Tret res = Execute(err_message, reinterpret_cast(callback), my_cmd, estimate_only, network_command, tile, args); + Tret res = Execute(err_message, reinterpret_cast(reinterpret_cast(callback)), my_cmd, estimate_only, network_command, tile, args); InternalPostResult(ExtractCommandCost(res), tile, estimate_only, only_sending, err_message, my_cmd); if (!estimate_only && !only_sending && callback != nullptr) {