1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 19:54:06 +01:00

Fix 3effb89: [Script] Don't set CommandCallback for asynchronous commands (#13501)

This commit is contained in:
Loïc Guilloux
2025-02-08 23:14:37 +01:00
committed by GitHub
parent edf90f5e4b
commit 8ab3e9f0a3

View File

@@ -401,7 +401,7 @@ bool ScriptObject::ScriptDoCommandHelper<Tcmd, Tret(*)(DoCommandFlag, Targs...)>
if (!estimate_only && networking) ScriptObject::SetLastCommand(EndianBufferWriter<CommandDataBuffer>::FromValue(args), Tcmd);
/* Try to perform the command. */
Tret res = ::Command<Tcmd>::Unsafe((StringID)0, networking ? ScriptObject::GetDoCommandCallback() : nullptr, false, estimate_only, tile, args);
Tret res = ::Command<Tcmd>::Unsafe((StringID)0, (!asynchronous && networking) ? ScriptObject::GetDoCommandCallback() : nullptr, false, estimate_only, tile, args);
if constexpr (std::is_same_v<Tret, CommandCost>) {
return ScriptObject::DoCommandProcessResult(res, callback, estimate_only, asynchronous);