mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 04:23:20 +01:00
committed by
Ted John
parent
528843184c
commit
546aace3dd
@@ -472,7 +472,6 @@ void Network::UpdateClient()
|
||||
}
|
||||
Close();
|
||||
}
|
||||
ProcessGameCommandQueue();
|
||||
|
||||
// Check synchronisation
|
||||
if (!_desynchronised && !CheckSRAND(gCurrentTicks, gScenarioSrand0)) {
|
||||
@@ -484,6 +483,8 @@ void Network::UpdateClient()
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
ProcessGameCommandQueue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -562,6 +563,11 @@ bool Network::CheckSRAND(uint32 tick, uint32 srand0)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (game_commands_processed_this_tick != 0) {
|
||||
// SRAND/sprite hash is only updated once at beginning of tick so it is invalid otherwise
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tick == server_srand0_tick) {
|
||||
server_srand0_tick = 0;
|
||||
// Check that the server and client sprite hashes match
|
||||
@@ -1231,6 +1237,7 @@ void Network::ProcessGameCommandQueue()
|
||||
sint32 command = gc.esi;
|
||||
money32 cost = game_do_command_p(command, (sint32*)&gc.eax, (sint32*)&gc.ebx, (sint32*)&gc.ecx, (sint32*)&gc.edx, (sint32*)&gc.esi, (sint32*)&gc.edi, (sint32*)&gc.ebp);
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
game_commands_processed_this_tick++;
|
||||
NetworkPlayer* player = GetPlayerByID(gc.playerid);
|
||||
if (player) {
|
||||
player->LastAction = NetworkActions::FindCommand(command);
|
||||
@@ -1778,6 +1785,7 @@ void Network::Client_Handle_TICK(NetworkConnection& connection, NetworkPacket& p
|
||||
}
|
||||
}
|
||||
}
|
||||
game_commands_processed_this_tick = 0;
|
||||
}
|
||||
|
||||
void Network::Client_Handle_PLAYERLIST(NetworkConnection& connection, NetworkPacket& packet)
|
||||
|
||||
@@ -213,6 +213,7 @@ private:
|
||||
uint8 default_group = 0;
|
||||
SDL_RWops *_chatLogStream = nullptr;
|
||||
std::string _chatLogPath;
|
||||
uint32 game_commands_processed_this_tick = 0;
|
||||
|
||||
void UpdateServer();
|
||||
void UpdateClient();
|
||||
|
||||
Reference in New Issue
Block a user