1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

First semi-working version of antilag for hero movement

This commit is contained in:
Ivan Savenko
2025-06-29 20:55:23 +03:00
parent 3ea2c8bff0
commit 241da5937d
33 changed files with 95 additions and 71 deletions

View File

@@ -617,8 +617,8 @@ void CServerHandler::startGameplay(std::shared_ptr<CGameState> gameState)
if(GAME->mainmenu())
GAME->mainmenu()->disable();
if (isGuest())
antilagServer = std::make_unique<AntilagServer>(getNetworkHandler(), gameState);
//if (isGuest())
networkLagCompensator = std::make_unique<AntilagServer>(getNetworkHandler(), gameState);
switch(si->mode)
{
@@ -944,7 +944,7 @@ void CServerHandler::visitForLobby(CPackForLobby & lobbyPack)
void CServerHandler::visitForClient(CPackForClient & clientPack)
{
if (antilagServer && antilagServer->verifyReply(clientPack))
if (networkLagCompensator && networkLagCompensator->verifyReply(clientPack))
return;
client->handlePack(clientPack);
@@ -968,8 +968,8 @@ bool CServerHandler::inGame() const
void CServerHandler::sendGamePack(const CPackForServer & pack) const
{
if (antilagServer)
antilagServer->tryPredictReply(pack);
if (networkLagCompensator)
networkLagCompensator->tryPredictReply(pack);
logicConnection->sendPack(pack);
}