Fix #11: Queue outgoing commands and don't send more than 2 per frame

This commit is contained in:
dP
2021-10-29 02:54:25 +03:00
parent 4df77324fc
commit 3bef49da29
9 changed files with 161 additions and 41 deletions

View File

@@ -34,8 +34,9 @@
#include "../town.h"
#include "network_func.h"
#include "../citymania/cm_newgrf_revisions.hpp"
#include "../citymania/cm_client_list_gui.hpp"
#include "../citymania/cm_commands.hpp"
#include "../citymania/cm_newgrf_revisions.hpp"
#include "../safeguards.h"
@@ -276,6 +277,8 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
extern void StateGameLoop();
StateGameLoop();
citymania::HandleNextClientFrame();
/* Check if we are in sync! */
if (_sync_frame != 0) {
if (_sync_frame == _frame_counter) {
@@ -776,6 +779,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(Packe
this->savegame = new PacketReader();
_frame_counter = _frame_counter_server = _frame_counter_max = p->Recv_uint32();
citymania::InitCommandQueue();
_network_join_bytes = 0;
_network_join_bytes_total = 0;