From ed62e92a2839b8b13543c07e82aada685aec74ad Mon Sep 17 00:00:00 2001 From: MrS-ibra Date: Wed, 24 Dec 2025 23:32:35 +0300 Subject: [PATCH 1/6] Update ConnectionManager.cpp --- Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index ae432e692bf..0e3994c1f2d 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1946,7 +1946,7 @@ void ConnectionManager::quitGame() { flushConnections(); // need to do this so our packet actually gets sent before the connections are deleted. //DEBUG_LOG(("ConnectionManager::disconnectLocalPlayer - done flushing connections")); - disconnectMsg->detach(); + // disconnectMsg->detach(); #if RTS_GENERALS // if we get here, we hit Quit on the disconnect screen. Mark everyone as having disconnected from us From 7e19a8d08bd3b29423e814db1acc9451d216106e Mon Sep 17 00:00:00 2001 From: MrS-ibra Date: Wed, 24 Dec 2025 23:59:57 +0300 Subject: [PATCH 2/6] Update ConnectionManager.cpp --- Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 0e3994c1f2d..f12fcf6f262 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -55,6 +55,8 @@ #include "../NextGenTransport.h" #include "../NetworkMesh.h" #include "../ngmp_interfaces.h" +#include +#include extern Int MIN_LOGIC_FRAMES; @@ -1675,7 +1677,7 @@ void ConnectionManager::sendLocalCommandDirect(NetCommandMsg *msg, UnsignedByte } } - msg->detach(); + // msg->detach(); } Int commandsReadyDebugSpewage = 0; @@ -1944,6 +1946,7 @@ void ConnectionManager::quitGame() { //DEBUG_LOG(("ConnectionManager::disconnectLocalPlayer - about to flush connections")); flushConnections(); // need to do this so our packet actually gets sent before the connections are deleted. + std::this_thread::sleep_for(std::chrono::milliseconds(50)); //DEBUG_LOG(("ConnectionManager::disconnectLocalPlayer - done flushing connections")); // disconnectMsg->detach(); From 69ed1e31553d2cf3ce042fc621e452d2fd8569c6 Mon Sep 17 00:00:00 2001 From: MrS-ibra Date: Thu, 25 Dec 2025 00:21:16 +0300 Subject: [PATCH 3/6] Update Connection.cpp --- Core/GameEngine/Source/GameNetwork/Connection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/GameEngine/Source/GameNetwork/Connection.cpp b/Core/GameEngine/Source/GameNetwork/Connection.cpp index 68128ff5204..a4b82600100 100644 --- a/Core/GameEngine/Source/GameNetwork/Connection.cpp +++ b/Core/GameEngine/Source/GameNetwork/Connection.cpp @@ -330,7 +330,7 @@ UnsignedInt Connection::doSend() { m_lastTimeSent = curtime; } if (packet != NULL) { - deleteInstance(packet); // delete the packet now that we're done with it. + // deleteInstance(packet); // delete the packet now that we're done with it. } } From f902a6d53aa8c266f69cbff74ebf73294e52bde2 Mon Sep 17 00:00:00 2001 From: MrS-ibra Date: Thu, 25 Dec 2025 00:48:12 +0300 Subject: [PATCH 4/6] Update NetCommandMsg.cpp --- .../Source/GameNetwork/NetCommandMsg.cpp | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp index 8c02dd99ee9..0ae2eb6df9e 100644 --- a/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp +++ b/Core/GameEngine/Source/GameNetwork/NetCommandMsg.cpp @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine +#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine #include "GameNetwork/NetCommandMsg.h" #include "Common/GameState.h" @@ -33,7 +33,7 @@ /** * Base constructor */ -NetCommandMsg::NetCommandMsg() +NetCommandMsg::NetCommandMsg() { m_executionFrame = 0; m_id = 0; @@ -123,10 +123,10 @@ NetGameCommandMsg::~NetGameCommandMsg() { /** * Add an argument to this command. */ -void NetGameCommandMsg::addArgument(const GameMessageArgumentDataType type, GameMessageArgumentType arg) +void NetGameCommandMsg::addArgument(const GameMessageArgumentDataType type, GameMessageArgumentType arg) { if (m_argTail == NULL) { - m_argList = newInstance(GameMessageArgument); + m_argList = newInstance(GameMessageArgument); m_argTail = m_argList; m_argList->m_data = arg; m_argList->m_type = type; @@ -153,7 +153,7 @@ static Int indexFromMask(UnsignedInt mask) player = ThePlayerList->getNthPlayer( i ); if( player && player->getPlayerMask() == mask ) return i; - } + } return -1; } @@ -161,7 +161,7 @@ static Int indexFromMask(UnsignedInt mask) /** * Construct a new GameMessage object from the data in this object. */ -GameMessage *NetGameCommandMsg::constructGameMessage() +GameMessage *NetGameCommandMsg::constructGameMessage() { GameMessage *retval = newInstance(GameMessage)(m_type); @@ -600,6 +600,7 @@ NetDisconnectKeepAliveCommandMsg::~NetDisconnectKeepAliveCommandMsg() { NetDisconnectPlayerCommandMsg::NetDisconnectPlayerCommandMsg() : NetCommandMsg() { m_commandType = NETCOMMANDTYPE_DISCONNECTPLAYER; m_disconnectSlot = 0; + m_disconnectFrame = 0; } /** @@ -804,7 +805,7 @@ NetProgressCommandMsg::NetProgressCommandMsg( void ) : NetCommandMsg() } NetProgressCommandMsg::~NetProgressCommandMsg( void ) {} - + UnsignedByte NetProgressCommandMsg::getPercentage() { return m_percent; @@ -830,17 +831,17 @@ NetWrapperCommandMsg::NetWrapperCommandMsg() : NetCommandMsg() { } NetWrapperCommandMsg::~NetWrapperCommandMsg() { - delete m_data; - m_data = NULL; + delete m_data; + m_data = NULL; } UnsignedByte * NetWrapperCommandMsg::getData() { return m_data; } -void NetWrapperCommandMsg::setData(UnsignedByte *data, UnsignedInt dataLength) +void NetWrapperCommandMsg::setData(UnsignedByte *data, UnsignedInt dataLength) { - delete m_data; + delete m_data; m_data = NEW UnsignedByte[dataLength]; // pool[]ify memcpy(m_data, data, dataLength); m_dataLength = dataLength; @@ -901,16 +902,16 @@ NetFileCommandMsg::NetFileCommandMsg() : NetCommandMsg() { } NetFileCommandMsg::~NetFileCommandMsg() { - delete[] m_data; - m_data = NULL; + delete[] m_data; + m_data = NULL; } -AsciiString NetFileCommandMsg::getRealFilename() +AsciiString NetFileCommandMsg::getRealFilename() { return TheGameState->portableMapPathToRealMapPath(m_portableFilename); } -void NetFileCommandMsg::setRealFilename(AsciiString filename) +void NetFileCommandMsg::setRealFilename(AsciiString filename) { m_portableFilename = TheGameState->realMapPathToPortableMapPath(filename); } @@ -923,7 +924,7 @@ UnsignedByte * NetFileCommandMsg::getFileData() { return m_data; } -void NetFileCommandMsg::setFileData(UnsignedByte *data, UnsignedInt dataLength) +void NetFileCommandMsg::setFileData(UnsignedByte *data, UnsignedInt dataLength) { m_dataLength = dataLength; m_data = NEW UnsignedByte[dataLength]; // pool[]ify @@ -943,12 +944,12 @@ NetFileAnnounceCommandMsg::NetFileAnnounceCommandMsg() : NetCommandMsg() { NetFileAnnounceCommandMsg::~NetFileAnnounceCommandMsg() { } -AsciiString NetFileAnnounceCommandMsg::getRealFilename() +AsciiString NetFileAnnounceCommandMsg::getRealFilename() { return TheGameState->portableMapPathToRealMapPath(m_portableFilename); } -void NetFileAnnounceCommandMsg::setRealFilename(AsciiString filename) +void NetFileAnnounceCommandMsg::setRealFilename(AsciiString filename) { m_portableFilename = TheGameState->realMapPathToPortableMapPath(filename); } @@ -1054,3 +1055,4 @@ UnsignedInt NetFrameResendRequestCommandMsg::getFrameToResend() { void NetFrameResendRequestCommandMsg::setFrameToResend(UnsignedInt frame) { m_frameToResend = frame; } + From 31a71584d8708f41b55b2c8c466b9fe3e9ee343f Mon Sep 17 00:00:00 2001 From: MrS-ibra Date: Thu, 25 Dec 2025 01:17:39 +0300 Subject: [PATCH 5/6] Update DisconnectManager.cpp --- Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp b/Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp index 94beda05da6..4ec5b0f2282 100644 --- a/Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp @@ -609,6 +609,7 @@ void DisconnectManager::sendDisconnectCommand(Int slot, ConnectionManager *conMg msg->setDisconnectSlot(slot); msg->setDisconnectFrame(disconnectFrame); msg->setPlayerID(conMgr->getLocalPlayerID()); + msg->attach(); if (DoesCommandRequireACommandID(msg->getNetCommandType())) { msg->setID(GenerateNextCommandID()); } From 2461c9ec77cfaa6d5f590628627e644106c7045a Mon Sep 17 00:00:00 2001 From: MrS-ibra Date: Thu, 25 Dec 2025 01:18:36 +0300 Subject: [PATCH 6/6] Update ConnectionManager.cpp --- Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp index f12fcf6f262..017bc6befd7 100644 --- a/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -1937,6 +1937,7 @@ void ConnectionManager::quitGame() { NetDisconnectPlayerCommandMsg *disconnectMsg = newInstance(NetDisconnectPlayerCommandMsg); disconnectMsg->setDisconnectSlot(m_localSlot); disconnectMsg->setDisconnectFrame(TheGameLogic->getFrame()); + disconnectMsg->attach(); disconnectMsg->setPlayerID(m_localSlot); if (DoesCommandRequireACommandID(disconnectMsg->getNetCommandType())) { disconnectMsg->setID(GenerateNextCommandID());