diff options
| author | Loki Rautio <lokirautio@gmail.com> | 2026-03-07 21:12:22 -0600 |
|---|---|---|
| committer | Loki Rautio <lokirautio@gmail.com> | 2026-03-07 21:12:22 -0600 |
| commit | 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch) | |
| tree | 69454763e73ca764af4e682d3573080b13138a0e /Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp | |
| parent | a9be52c41a02d207233199e98898fe7483d7e817 (diff) | |
Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp')
| -rw-r--r-- | Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 03be8ec9..970dfd24 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -26,7 +26,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) bool createFakeSocket = false; bool localPlayer = false; - NetworkPlayerXbox *networkPlayer = static_cast<NetworkPlayerXbox *>(addNetworkPlayer(pQNetPlayer)); + NetworkPlayerXbox *networkPlayer = (NetworkPlayerXbox *)addNetworkPlayer(pQNetPlayer); if( pQNetPlayer->IsLocal() ) { @@ -103,7 +103,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -112,7 +112,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -127,11 +127,11 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer) app.DebugPrintf("Player 0x%p \"%ls\" leaving.\n", pQNetPlayer, pQNetPlayer->GetGamertag()); INetworkPlayer* networkPlayer = getNetworkPlayer(pQNetPlayer); - if (networkPlayer == nullptr) + if (networkPlayer == NULL) return; Socket* socket = networkPlayer->GetSocket(); - if (socket != nullptr) + if (socket != NULL) { if (m_pIQNet->IsHost()) g_NetworkManager.CloseConnection(networkPlayer); @@ -146,7 +146,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer) for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (playerChangedCallback[idx] != nullptr) + if (playerChangedCallback[idx] != NULL) playerChangedCallback[idx](playerChangedCallbackParam[idx], networkPlayer, true); } @@ -162,7 +162,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = nullptr; + playerChangedCallback[ i ] = NULL; } m_bLeavingGame = false; @@ -173,8 +173,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_pSearchParam = NULL; + m_SessionsUpdatedCallback = NULL; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -182,10 +182,10 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_lastSearchStartTime[i] = 0; // The results that will be filled in with the current search - m_pSearchResults[i] = nullptr; - m_pQoSResult[i] = nullptr; - m_pCurrentSearchResults[i] = nullptr; - m_pCurrentQoSResult[i] = nullptr; + m_pSearchResults[i] = NULL; + m_pQoSResult[i] = NULL; + m_pCurrentSearchResults[i] = NULL; + m_pCurrentQoSResult[i] = NULL; m_currentSearchResultsCount[i] = 0; } @@ -231,7 +231,7 @@ void CPlatformNetworkManagerStub::DoWork() while (WinsockNetLayer::PopDisconnectedSmallId(&disconnectedSmallId)) { IQNetPlayer* qnetPlayer = m_pIQNet->GetPlayerBySmallId(disconnectedSmallId); - if (qnetPlayer != nullptr && qnetPlayer->m_smallId == disconnectedSmallId) + if (qnetPlayer != NULL && qnetPlayer->m_smallId == disconnectedSmallId) { NotifyPlayerLeaving(qnetPlayer); qnetPlayer->m_smallId = 0; @@ -386,7 +386,7 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame, #ifdef _WINDOWS64 int port = WIN64_NET_DEFAULT_PORT; - const char* bindIp = nullptr; + const char* bindIp = NULL; if (g_Win64DedicatedServer) { if (g_Win64DedicatedServerPort > 0) @@ -419,7 +419,7 @@ bool CPlatformNetworkManagerStub::_StartGame() int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int localUsersMask, int primaryUserIndex) { #ifdef _WINDOWS64 - if (searchResult == nullptr) + if (searchResult == NULL) return CGameNetworkManager::JOINGAME_FAIL_GENERAL; const char* hostIP = searchResult->data.hostIP; @@ -493,8 +493,8 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = nullptr; - playerChangedCallbackParam[iPad] = nullptr; + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; } } @@ -514,7 +514,7 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame() if (IQNet::m_player[i].m_isRemote) { INetworkPlayer* pNetworkPlayer = getNetworkPlayer(&IQNet::m_player[i]); - if (pNetworkPlayer != nullptr && pNetworkPlayer->GetSocket() != nullptr) + if (pNetworkPlayer != NULL && pNetworkPlayer->GetSocket() != NULL) { Socket::addIncomingSocket(pNetworkPlayer->GetSocket()); } @@ -524,14 +524,14 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame() return true; } -void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) +void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) { // DWORD playerCount = m_pIQNet->GetPlayerCount(); // // if( this->m_bLeavingGame ) // return; // -// if( GetHostPlayer() == nullptr ) +// if( GetHostPlayer() == NULL ) // return; // // for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) @@ -551,13 +551,13 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN // } // else // { -// m_hostGameSessionData.players[i] = nullptr; +// m_hostGameSessionData.players[i] = NULL; // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); // } // } // else // { -// m_hostGameSessionData.players[i] = nullptr; +// m_hostGameSessionData.players[i] = NULL; // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); // } // } @@ -568,18 +568,18 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = static_cast<INetworkPlayer *>(lpParam); + INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam; Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( nullptr ); + pNetworkPlayer->SetSocket( NULL ); delete socket; } @@ -669,7 +669,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset() void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == nullptr ) return; + if( pNetworkPlayer == NULL ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -685,7 +685,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) { return false; } @@ -713,7 +713,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() for(unsigned int i = 0; i < GetPlayerCount(); ++i) { - IQNetPlayer *pQNetPlayer = static_cast<NetworkPlayerXbox *>(GetPlayerByIndex(i))->GetQNetPlayer(); + IQNetPlayer *pQNetPlayer = ((NetworkPlayerXbox *)GetPlayerByIndex( i ))->GetQNetPlayer(); if(!pQNetPlayer->IsLocal()) { @@ -728,7 +728,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() void CPlatformNetworkManagerStub::TickSearch() { #ifdef _WINDOWS64 - if (m_SessionsUpdatedCallback == nullptr) + if (m_SessionsUpdatedCallback == NULL) return; static DWORD lastSearchTime = 0; @@ -757,7 +757,7 @@ void CPlatformNetworkManagerStub::SearchForGames() size_t nameLen = wcslen(lanSessions[i].hostName); info->displayLabel = new wchar_t[nameLen + 1]; wcscpy_s(info->displayLabel, nameLen + 1, lanSessions[i].hostName); - info->displayLabelLength = static_cast<unsigned char>(nameLen); + info->displayLabelLength = (unsigned char)nameLen; info->displayLabelViewableStartIndex = 0; info->data.netVersion = lanSessions[i].netVersion; @@ -772,8 +772,7 @@ void CPlatformNetworkManagerStub::SearchForGames() info->data.playerCount = lanSessions[i].playerCount; info->data.maxPlayers = lanSessions[i].maxPlayers; - info->sessionId = static_cast<uint64_t>(inet_addr(lanSessions[i].hostIP)) | - static_cast<uint64_t>(lanSessions[i].hostPort) << 32; + info->sessionId = (SessionID)((uint64_t)inet_addr(lanSessions[i].hostIP) | ((uint64_t)lanSessions[i].hostPort << 32)); friendsSessions[0].push_back(info); } @@ -813,7 +812,7 @@ void CPlatformNetworkManagerStub::SearchForGames() size_t nameLen = wcslen(label); info->displayLabel = new wchar_t[nameLen+1]; wcscpy_s(info->displayLabel, nameLen + 1, label); - info->displayLabelLength = static_cast<unsigned char>(nameLen); + info->displayLabelLength = (unsigned char)nameLen; info->displayLabelViewableStartIndex = 0; info->data.isReadyToJoin = true; info->data.isJoinable = true; @@ -827,9 +826,9 @@ void CPlatformNetworkManagerStub::SearchForGames() std::fclose(file); } - m_searchResultsCount[0] = static_cast<int>(friendsSessions[0].size()); + m_searchResultsCount[0] = (int)friendsSessions[0].size(); - if (m_SessionsUpdatedCallback != nullptr) + if (m_SessionsUpdatedCallback != NULL) m_SessionsUpdatedCallback(m_pSearchParam); #endif } @@ -877,7 +876,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() m_searchResultsCount[i] = 0; m_lastSearchStartTime[i] = 0; delete m_pSearchResults[i]; - m_pSearchResults[i] = nullptr; + m_pSearchResults[i] = NULL; } } @@ -904,7 +903,7 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer) { - return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : nullptr; + return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL; } |
