Try to fix cmclient command callbacks

This commit is contained in:
Pavel Stupnikov
2023-01-03 15:35:06 +04:00
parent 6bc46c2119
commit cb888544ce
15 changed files with 1040 additions and 894 deletions
+5 -2
View File
@@ -286,14 +286,15 @@ void NetworkSendCommand(Commands cmd, StringID err_message, CommandCallback *cal
c.my_cmd = true;
_local_wait_queue.Append(&c);
citymania::AddCommandCallback(&c);
return;
}
c.frame = 0; // The client can't tell which frame, so just make it 0
/* Clients send their command to the server and forget all about the packet */
MyClient::SendCommand(&c);
// FIXME citymania::SendClientCommand(&c);
// MyClient::SendCommand(&c);
citymania::SendClientCommand(&c);
}
/**
@@ -542,6 +543,8 @@ CommandDataBuffer SanitizeCmdStrings(const CommandDataBuffer &data)
template <Commands Tcmd, size_t Tcb>
void UnpackNetworkCommand(const CommandPacket* cp)
{
citymania::BeforeNetworkCommandExecution(cp);
auto args = EndianBufferReader::ToValue<typename CommandTraits<Tcmd>::Args>(cp->data);
Command<Tcmd>::PostFromNet(cp->err_msg, std::get<Tcb>(_callback_tuple), cp->my_cmd, cp->tile, args);
citymania::AfterNetworkCommandExecution(cp);
}