mirror of https://github.com/OpenTTD/OpenTTD
Fix 3effb89: [Script] Don't set CommandCallback for asynchronous commands (#13501)
parent
edf90f5e4b
commit
8ab3e9f0a3
|
@ -401,7 +401,7 @@ bool ScriptObject::ScriptDoCommandHelper<Tcmd, Tret(*)(DoCommandFlag, Targs...)>
|
||||||
if (!estimate_only && networking) ScriptObject::SetLastCommand(EndianBufferWriter<CommandDataBuffer>::FromValue(args), Tcmd);
|
if (!estimate_only && networking) ScriptObject::SetLastCommand(EndianBufferWriter<CommandDataBuffer>::FromValue(args), Tcmd);
|
||||||
|
|
||||||
/* Try to perform the command. */
|
/* 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>) {
|
if constexpr (std::is_same_v<Tret, CommandCost>) {
|
||||||
return ScriptObject::DoCommandProcessResult(res, callback, estimate_only, asynchronous);
|
return ScriptObject::DoCommandProcessResult(res, callback, estimate_only, asynchronous);
|
||||||
|
|
Loading…
Reference in New Issue