From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: 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. --- .../Durango/Network/ChatIntegrationLayer.h | 2 +- .../Durango/Network/DQRNetworkManager.cpp | 90 +++++++++++----------- .../Durango/Network/DQRNetworkManager.h | 2 +- .../Network/DQRNetworkManager_FriendSessions.cpp | 12 +-- .../Network/DQRNetworkManager_SendReceive.cpp | 16 ++-- .../Network/DQRNetworkManager_XRNSEvent.cpp | 14 ++-- .../Durango/Network/DQRNetworkPlayer.cpp | 2 +- .../Durango/Network/NetworkPlayerDurango.cpp | 6 +- .../Durango/Network/PartyController.cpp | 14 ++-- .../Network/PlatformNetworkManagerDurango.cpp | 60 +++++++-------- .../Network/PlatformNetworkManagerDurango.h | 2 +- Minecraft.Client/Durango/Network/base64.cpp | 6 +- 12 files changed, 113 insertions(+), 113 deletions(-) (limited to 'Minecraft.Client/Durango/Network') diff --git a/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h b/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h index f81a0f1f..80b4e10a 100644 --- a/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h +++ b/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h @@ -238,7 +238,7 @@ private: __in ChatPacketType chatPacketType ); Concurrency::critical_section m_chatPacketStatsLock; - int m_chatVoicePacketsStatistic[2][static_cast(Microsoft::Xbox::GameChat::ChatMessageType::InvalidMessage)+1]; + int m_chatVoicePacketsStatistic[2][(int)Microsoft::Xbox::GameChat::ChatMessageType::InvalidMessage+1]; }; std::shared_ptr GetChatIntegrationLayer(); \ No newline at end of file diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp index 9e9e78c0..39dc53a9 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp @@ -25,7 +25,7 @@ int DQRNetworkManager::m_bootUserIndex; wstring DQRNetworkManager::m_bootSessionName; wstring DQRNetworkManager::m_bootServiceConfig; wstring DQRNetworkManager::m_bootSessionTemplate; -DQRNetworkManager * DQRNetworkManager::s_pDQRManager = nullptr; +DQRNetworkManager * DQRNetworkManager::s_pDQRManager = NULL; //using namespace Windows::Xbox::Networking; @@ -87,16 +87,16 @@ DQRNetworkManager::DQRNetworkManager(IDQRNetworkManagerListener *listener) memset(&m_roomSyncData, 0, sizeof(m_roomSyncData)); memset(m_players, 0, sizeof(m_players)); - m_CreateSessionThread = nullptr; - m_GetFriendPartyThread = nullptr; - m_UpdateCustomSessionDataThread = nullptr; + m_CreateSessionThread = NULL; + m_GetFriendPartyThread = NULL; + m_UpdateCustomSessionDataThread = NULL; - m_CheckPartyInviteThread = nullptr; + m_CheckPartyInviteThread = NULL; m_notifyForFullParty = false; m_customDataDirtyUpdateTicks = 0; m_sessionResultCount = 0; - m_sessionSearchResults = nullptr; + m_sessionSearchResults = NULL; m_joinSessionUserMask = 0; m_cancelJoinFromSearchResult = false; @@ -274,7 +274,7 @@ void DQRNetworkManager::JoinSession(int playerMask) // If we found the session, then set the status of this member to be active (should be reserved). This will stop our slot timing out and us being dropped out of the session. if( session != nullptr ) { - if(!IsPlayerInSession(joiningUser->XboxUserId, session, nullptr) ) + if(!IsPlayerInSession(joiningUser->XboxUserId, session, NULL) ) { app.DebugPrintf("DNM_INT_STATE_JOINING_FAILED didn't find required player in session\n"); SetState(DNM_INT_STATE_JOINING_FAILED); @@ -515,7 +515,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex) pPlayer->SetSmallId(smallId); pPlayer->SetName(ProfileManager.GetUser(userIndex)->DisplayInfo->Gamertag->Data()); pPlayer->SetDisplayName(ProfileManager.GetDisplayName(userIndex)); - pPlayer->SetUID(static_cast(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); + pPlayer->SetUID(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); // Also add to the party so that our friends can find us. The host will get notified of this additional player in the party, but we should ignore since we're already in the session m_partyController->AddLocalUsersToParty(1 << userIndex, ProfileManager.GetUser(0)); @@ -550,7 +550,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex) pPlayer->SetSmallId(m_currentSmallId++); pPlayer->SetName(ProfileManager.GetUser(userIndex)->DisplayInfo->Gamertag->Data()); pPlayer->SetDisplayName(ProfileManager.GetDisplayName(userIndex)); - pPlayer->SetUID(static_cast(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); + pPlayer->SetUID(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data())); // TODO - could this add fail? if(AddRoomSyncPlayer( pPlayer, 0, userIndex)) @@ -600,7 +600,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex) m_joinSessionXUIDs[userIndex] = ProfileManager.GetUser(userIndex)->XboxUserId; m_partyController->AddLocalUsersToParty(1 << userIndex, ProfileManager.GetUser(0)); - m_addLocalPlayerSuccessPlayer = nullptr; + m_addLocalPlayerSuccessPlayer = NULL; m_addLocalPlayerState = DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS; } } @@ -763,7 +763,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerBySmallId(int idx) } } } - return nullptr; + return NULL; } DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid) @@ -778,7 +778,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid) } } } - return nullptr; + return NULL; } // Retrieve player display name by gamertag @@ -809,7 +809,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetLocalPlayerByUserIndex(int idx) } } } - return nullptr; + return NULL; } DQRNetworkPlayer *DQRNetworkManager::GetHostPlayer() @@ -892,7 +892,7 @@ void DQRNetworkManager::Tick_VoiceChat() #endif // If we have to inform the chat integration layer of any players that have joined, do that now EnterCriticalSection(&m_csVecChatPlayers); - for( size_t i = 0; i < m_vecChatPlayersJoined.size(); i++ ) + for( int i = 0; i < m_vecChatPlayersJoined.size(); i++ ) { int idx = m_vecChatPlayersJoined[i]; if( m_chat ) @@ -967,19 +967,19 @@ void DQRNetworkManager::Tick_Party() void DQRNetworkManager::Tick_CustomSessionData() { // If there was a thread updaing our custom session data, then clear it up if it is done - if( m_UpdateCustomSessionDataThread != nullptr ) + if( m_UpdateCustomSessionDataThread != NULL ) { if( !m_UpdateCustomSessionDataThread->isRunning() ) { delete m_UpdateCustomSessionDataThread; - m_UpdateCustomSessionDataThread = nullptr; + m_UpdateCustomSessionDataThread = NULL; } } // If our custom data is dirty, and we aren't currently updating, then kick off a thread to update it if( m_isHosting && ( !m_isOfflineGame ) ) { - if( m_UpdateCustomSessionDataThread == nullptr ) + if( m_UpdateCustomSessionDataThread == NULL ) { if( m_customDataDirtyUpdateTicks ) { @@ -1003,7 +1003,7 @@ void DQRNetworkManager::Tick_AddAndRemoveLocalPlayers() // A lot of handling adding local players is handled asynchronously. Trying to avoid having the callbacks that may result from this being called from the task threads, so handling this aspect of it here in the tick if( m_addLocalPlayerState == DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS ) { - // If we've completed, and we're the host, then we should have the new player to create stored here in m_localPlayerSuccessCreated. For clients, this will just be nullptr as the actual + // If we've completed, and we're the host, then we should have the new player to create stored here in m_localPlayerSuccessCreated. For clients, this will just be NULL as the actual // adding of the player happens as part of a longer process of the host creating us a reserved slot etc. etc. if( m_addLocalPlayerSuccessPlayer ) { @@ -1201,7 +1201,7 @@ void DQRNetworkManager::Tick_StateMachine() break; case DNM_INT_STATE_HOSTING_WAITING_TO_PLAY: delete m_CreateSessionThread; - m_CreateSessionThread = nullptr; + m_CreateSessionThread = NULL; // If the game is offline we can transition straight to playing if (m_isOfflineGame) StartGame(); break; @@ -1247,10 +1247,10 @@ void DQRNetworkManager::Tick_CheckInviteParty() if( !m_CheckPartyInviteThread->isRunning() ) { delete m_CheckPartyInviteThread; - m_CheckPartyInviteThread = nullptr; + m_CheckPartyInviteThread = NULL; } } - if( m_CheckPartyInviteThread == nullptr ) + if( m_CheckPartyInviteThread == NULL ) { m_inviteReceived = false; m_CheckPartyInviteThread = new C4JThread(&DQRNetworkManager::_CheckInviteThreadProc, this, "Check invite thread"); @@ -1326,11 +1326,11 @@ void DQRNetworkManager::HandleSessionChange(MXSM::MultiplayerSession^ multiplaye { // 4J-JEV: This id is needed to link stats together. // I thought setting the value from here would be less intrusive than adding an accessor. - static_cast(GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId); + ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId); } else { - static_cast(GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr ); + ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr ); } m_multiplayerSession = multiplayerSession; @@ -1403,7 +1403,7 @@ bool DQRNetworkManager::IsPlayerInSession( Platform::String^ xboxUserId, MXSM::M { Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson); Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId"); - *smallId = static_cast(customValue->GetNumber()) & 255; + *smallId = (int)(customValue->GetNumber()) & 255; } catch (Platform::COMException^ ex) { @@ -1449,7 +1449,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData) for( int j = 0; j < m_roomSyncData.playerCount; j++ ) { tempPlayers.push_back(m_players[j]); - m_players[j] = nullptr; + m_players[j] = NULL; } // For each new player, it's either: @@ -1509,12 +1509,12 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData) } memcpy(&m_roomSyncData, pNewSyncData, sizeof(m_roomSyncData)); - for( size_t i = 0; i < tempPlayers.size(); i++ ) + for( int i = 0; i < tempPlayers.size(); i++ ) { m_listener->HandlePlayerLeaving(tempPlayers[i]); delete tempPlayers[i]; } - for( size_t i = 0; i < newPlayers.size(); i++ ) + for( int i = 0; i < newPlayers.size(); i++ ) { m_listener->HandlePlayerJoined(newPlayers[i]); // For clients, this is where we get notified of local and remote players joining } @@ -1592,12 +1592,12 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses } m_roomSyncData.playerCount = iWriteIdx; - for( size_t i = 0; i < removedPlayers.size(); i++ ) + for( int i = 0; i < removedPlayers.size(); i++ ) { m_listener->HandlePlayerLeaving(removedPlayers[i]); delete removedPlayers[i]; memset(&m_roomSyncData.players[m_roomSyncData.playerCount + i], 0, sizeof(PlayerSyncData)); - m_players[m_roomSyncData.playerCount + i] = nullptr; + m_players[m_roomSyncData.playerCount + i] = NULL; } LeaveCriticalSection(&m_csRoomSyncData); } @@ -1623,12 +1623,12 @@ void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer) } m_roomSyncData.playerCount = iWriteIdx; - for( size_t i = 0; i < removedPlayers.size(); i++ ) + for( int i = 0; i < removedPlayers.size(); i++ ) { m_listener->HandlePlayerLeaving(removedPlayers[i]); delete removedPlayers[i]; memset(&m_roomSyncData.players[m_roomSyncData.playerCount + i], 0, sizeof(PlayerSyncData)); - m_players[m_roomSyncData.playerCount + i] = nullptr; + m_players[m_roomSyncData.playerCount + i] = NULL; } } @@ -1643,7 +1643,7 @@ void DQRNetworkManager::SendRoomSyncInfo() // (2) A single byte internal data tag // (3) An unsigned int encoding the size of the combined size of all the strings in stage (5) // (4) The RoomSyncData structure itself - // (5) A wchar nullptr terminated string for every active player to encode the XUID + // (5) A wchar NULL terminated string for every active player to encode the XUID unsigned int xuidBytes = 0; for( int i = 0 ; i < m_roomSyncData.playerCount; i++ ) { @@ -1689,7 +1689,7 @@ void DQRNetworkManager::SendAddPlayerFailed(Platform::String^ xuid) // (1) 2 byte general header // (2) A single byte internal data tag // (3) An unsigned int encoding the size size of the string - // (5) A wchar nullptr terminated string storing the xuid of the player which has failed to join + // (5) A wchar NULL terminated string storing the xuid of the player which has failed to join unsigned int xuidBytes = sizeof(wchar_t) * ( xuid->Length() + 1 ); @@ -1745,7 +1745,7 @@ void DQRNetworkManager::SendSmallId(bool reliableAndSequential, int playerMask) { Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson); Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId"); - smallId = static_cast(customValue->GetNumber()); + smallId = (BYTE)(customValue->GetNumber()); bFound = true; } catch (Platform::COMException^ ex) @@ -1797,7 +1797,7 @@ int DQRNetworkManager::GetSessionIndexForSmallId(unsigned char smallId) { Windows::Data::Json::JsonObject^ customConstant = Windows::Data::Json::JsonObject::Parse(member->MemberCustomConstantsJson); Windows::Data::Json::JsonValue^ customValue = customConstant->GetNamedValue(L"smallId"); - smallIdMember = static_cast(customValue->GetNumber()); + smallIdMember = (BYTE)(customValue->GetNumber()); } catch (Platform::COMException^ ex) { @@ -1830,7 +1830,7 @@ int DQRNetworkManager::GetSessionIndexAndSmallIdForHost(unsigned char *smallId) } if( smallIdMember > 255 ) { - *smallId = static_cast(smallIdMember); + *smallId = (BYTE)(smallIdMember); return i; } } @@ -1877,7 +1877,7 @@ Platform::String^ DQRNetworkManager::GetNextSmallIdAsJsonString() int DQRNetworkManager::_HostGameThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->HostGameThreadProc(); } @@ -2190,7 +2190,7 @@ int DQRNetworkManager::HostGameThreadProc() pPlayer->SetSmallId(smallId); pPlayer->SetName(user->DisplayInfo->Gamertag->Data()); pPlayer->SetDisplayName(displayName); - pPlayer->SetUID(static_cast(user->XboxUserId->Data())); + pPlayer->SetUID(PlayerUID(user->XboxUserId->Data())); AddRoomSyncPlayer( pPlayer, localSessionAddress, i); @@ -2208,7 +2208,7 @@ int DQRNetworkManager::HostGameThreadProc() int DQRNetworkManager::_LeaveRoomThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->LeaveRoomThreadProc(); } @@ -2311,7 +2311,7 @@ int DQRNetworkManager::LeaveRoomThreadProc() int DQRNetworkManager::_TidyUpJoinThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->TidyUpJoinThreadProc(); } @@ -2416,7 +2416,7 @@ int DQRNetworkManager::TidyUpJoinThreadProc() int DQRNetworkManager::_UpdateCustomSessionDataThreadProc( void* lpParameter ) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->UpdateCustomSessionDataThreadProc(); } @@ -2491,7 +2491,7 @@ int DQRNetworkManager::UpdateCustomSessionDataThreadProc() int DQRNetworkManager::_CheckInviteThreadProc(void* lpParameter) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->CheckInviteThreadProc(); } @@ -2614,7 +2614,7 @@ void DQRNetworkManager::LeaveRoom() for( int i = 0; i < m_roomSyncData.playerCount; i++ ) { delete m_players[i]; - m_players[i] = nullptr; + m_players[i] = NULL; } memset(&m_roomSyncData, 0, sizeof(m_roomSyncData)); m_displayNames.clear(); @@ -3026,8 +3026,8 @@ void DQRNetworkManager::RequestDisplayName(DQRNetworkPlayer *player) void DQRNetworkManager::GetProfileCallback(LPVOID pParam, Microsoft::Xbox::Services::Social::XboxUserProfile^ profile) { - DQRNetworkManager *dqnm = static_cast(pParam); - dqnm->SetDisplayName(static_cast(profile->XboxUserId->Data()), profile->GameDisplayName->Data()); + DQRNetworkManager *dqnm = (DQRNetworkManager *)pParam; + dqnm->SetDisplayName(PlayerUID(profile->XboxUserId->Data()), profile->GameDisplayName->Data()); } // Set player display name diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager.h b/Minecraft.Client/Durango/Network/DQRNetworkManager.h index b74e079c..3c4a742c 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager.h +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager.h @@ -221,7 +221,7 @@ public: class SessionSearchResult { public: - SessionSearchResult() { m_extData = nullptr; } + SessionSearchResult() { m_extData = NULL; } ~SessionSearchResult() { free(m_extData); } wstring m_partyId; wstring m_sessionName; diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp index 0822a93c..3a14a2d5 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp @@ -49,7 +49,7 @@ bool DQRNetworkManager::FriendPartyManagerSearch() m_sessionResultCount = 0; delete [] m_sessionSearchResults; - m_sessionSearchResults = nullptr; + m_sessionSearchResults = NULL; m_GetFriendPartyThread = new C4JThread(&_GetFriendsThreadProc,this,"GetFriendsThreadProc"); m_GetFriendPartyThread->Run(); @@ -61,7 +61,7 @@ bool DQRNetworkManager::FriendPartyManagerSearch() void DQRNetworkManager::FriendPartyManagerGetSessionInfo(int idx, SessionSearchResult *searchResult) { assert( idx < m_sessionResultCount ); - assert( ( m_GetFriendPartyThread == nullptr ) || ( !m_GetFriendPartyThread->isRunning()) ); + assert( ( m_GetFriendPartyThread == NULL ) || ( !m_GetFriendPartyThread->isRunning()) ); // Need to make sure that copied data has independently allocated m_extData, so both copies can be freed *searchResult = m_sessionSearchResults[idx]; @@ -71,7 +71,7 @@ void DQRNetworkManager::FriendPartyManagerGetSessionInfo(int idx, SessionSearchR int DQRNetworkManager::_GetFriendsThreadProc(void* lpParameter) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->GetFriendsThreadProc(); } @@ -410,7 +410,7 @@ int DQRNetworkManager::GetFriendsThreadProc() for( int j = 0; j < nameResolveVector[i]->Size; j++ ) { m_sessionSearchResults[i].m_playerNames[j] = nameResolveVector[i]->GetAt(j)->GameDisplayName->Data(); - m_sessionSearchResults[i].m_playerXuids[j] = static_cast(nameResolveVector[i]->GetAt(j)->XboxUserId->Data()); + m_sessionSearchResults[i].m_playerXuids[j] = PlayerUID(nameResolveVector[i]->GetAt(j)->XboxUserId->Data()); } m_sessionSearchResults[i].m_playerCount = nameResolveVector[i]->Size; m_sessionSearchResults[i].m_usedSlotCount = newSessionVector[i]->Members->Size; @@ -556,7 +556,7 @@ bool DQRNetworkManager::IsSessionFriendsOfFriends(MXSM::MultiplayerSession^ sess if (result) { - friendsOfFriends = app.GetGameHostOption(static_cast(gameSessionData)->m_uiGameHostSettings, eGameHostOption_FriendsOfFriends); + friendsOfFriends = app.GetGameHostOption(((GameSessionData *)gameSessionData)->m_uiGameHostSettings, eGameHostOption_FriendsOfFriends); } free(gameSessionData); @@ -577,7 +577,7 @@ bool DQRNetworkManager::GetGameSessionData(MXSM::MultiplayerSession^ session, vo Platform::String ^customValueString = customValue->GetString(); if( customValueString ) { - base64_decode( customValueString, static_cast(gameSessionData), sizeof(GameSessionData) ); + base64_decode( customValueString, (unsigned char *)gameSessionData, sizeof(GameSessionData) ); return true; } } diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp index eed3e851..9232d095 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp @@ -24,7 +24,7 @@ void DQRNetworkManager::BytesReceived(int smallId, BYTE *bytes, int byteCount) DQRNetworkPlayer *host = GetPlayerBySmallId(m_hostSmallId); DQRNetworkPlayer *client = GetPlayerBySmallId(smallId); - if( ( host == nullptr ) || ( client == nullptr ) ) + if( ( host == NULL ) || ( client == NULL ) ) { return; } @@ -113,7 +113,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, case DQRConnectionInfo::ConnectionState_InternalAssignSmallId2: case DQRConnectionInfo::ConnectionState_InternalAssignSmallId3: { - int channel = static_cast(connectionInfo->m_internalDataState) - DQRConnectionInfo::ConnectionState_InternalAssignSmallId0; + int channel = ((int)connectionInfo->m_internalDataState) - DQRConnectionInfo::ConnectionState_InternalAssignSmallId0; if( ( connectionInfo->m_smallIdReadMask & ( 1 << channel ) ) && ( !connectionInfo->m_channelActive[channel] ) ) { @@ -137,7 +137,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, DQRNetworkPlayer *pPlayer = new DQRNetworkPlayer(this, DQRNetworkPlayer::DNP_TYPE_REMOTE, true, 0, sessionAddress); pPlayer->SetSmallId(byte); - pPlayer->SetUID(static_cast(m_multiplayerSession->Members->GetAt(sessionIndex)->XboxUserId->Data())); + pPlayer->SetUID(PlayerUID(m_multiplayerSession->Members->GetAt(sessionIndex)->XboxUserId->Data())); HostGamertagResolveDetails *resolveDetails = new HostGamertagResolveDetails(); resolveDetails->m_pPlayer = pPlayer; @@ -238,7 +238,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, UpdateRoomSyncPlayers((RoomSyncData *)connectionInfo->m_pucRoomSyncData); delete connectionInfo->m_pucRoomSyncData; - connectionInfo->m_pucRoomSyncData = nullptr; + connectionInfo->m_pucRoomSyncData = NULL; connectionInfo->m_internalDataState = DQRConnectionInfo::ConnectionState_InternalHeaderByte; // If we haven't actually established a connection yet for this channel, then this is the point where we can consider this active @@ -267,7 +267,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, { if( m_currentUserMask & ( 1 << i ) ) { - if( GetLocalPlayerByUserIndex(i) == nullptr ) + if( GetLocalPlayerByUserIndex(i) == NULL ) { allLocalPlayersHere = false; } @@ -307,7 +307,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, // XUID fully read, can now handle what to do with it AddPlayerFailed(ref new Platform::String( (wchar_t *)connectionInfo->m_pucAddFailedPlayerData ) ); delete [] connectionInfo->m_pucAddFailedPlayerData; - connectionInfo->m_pucAddFailedPlayerData = nullptr; + connectionInfo->m_pucAddFailedPlayerData = NULL; connectionInfo->m_internalDataState = DQRConnectionInfo::ConnectionState_InternalHeaderByte; } @@ -371,7 +371,7 @@ void DQRNetworkManager::SendBytesChat(unsigned int address, BYTE *bytes, int byt void DQRNetworkManager::SendBytes(int smallId, BYTE *bytes, int byteCount) { EnterCriticalSection(&m_csSendBytes); - unsigned char *tempSendBuffer = static_cast(malloc(8191 + 2)); + unsigned char *tempSendBuffer = (unsigned char *)malloc(8191 + 2); BYTE *data = bytes; BYTE *dataEnd = bytes + byteCount; @@ -381,7 +381,7 @@ void DQRNetworkManager::SendBytes(int smallId, BYTE *bytes, int byteCount) // blocks of this size. do { - int bytesToSend = static_cast(dataEnd - data); + int bytesToSend = (int)(dataEnd - data); if( bytesToSend > 8191 ) bytesToSend = 8191; // Send header with data sending mode - see full comment in DQRNetworkManagerEventHandlers::DataReceivedHandler diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp index ae7094fb..c985a191 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp @@ -84,7 +84,7 @@ void DQRNetworkManagerEventHandlers::DataReceivedHandler(Platform::Object^ sessi } rtsMessage.m_sessionAddress = args->SessionAddress; rtsMessage.m_dataSize = args->Data->Length; - rtsMessage.m_pucData = static_cast(malloc(rtsMessage.m_dataSize)); + rtsMessage.m_pucData = (unsigned char *)malloc(rtsMessage.m_dataSize); memcpy( rtsMessage.m_pucData, args->Data->Data, rtsMessage.m_dataSize ); m_pDQRNet->m_RTSMessageQueueIncoming.push(rtsMessage); LeaveCriticalSection(&m_pDQRNet->m_csRTSMessageQueueIncoming); @@ -311,7 +311,7 @@ void DQRNetworkManager::Process_RTS_MESSAGE_DATA_RECEIVED(RTS_Message &message) break; case DQRConnectionInfo::ConnectionState_ReadBytes: // At this stage we can send up to connectionInfo->m_bytesRemaining bytes, or the number of bytes that we have remaining in the data received, whichever is lowest. - int bytesInBuffer = static_cast(pEndByte - pNextByte); + int bytesInBuffer = (int)(pEndByte - pNextByte); int bytesToReceive = ( ( connectionInfo->m_bytesRemaining < bytesInBuffer ) ? connectionInfo->m_bytesRemaining : bytesInBuffer ); if( connectionInfo->m_internalFlag ) @@ -438,7 +438,7 @@ void DQRNetworkManager::Process_RTS_MESSAGE_STATUS_TERMINATED(RTS_Message &messa int DQRNetworkManager::_RTSDoWorkThread(void* lpParameter) { - DQRNetworkManager *pDQR = static_cast(lpParameter); + DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter; return pDQR->RTSDoWorkThread(); } @@ -603,7 +603,7 @@ void DQRNetworkManager::RTS_StartCient() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_START_CLIENT; - message.m_pucData = nullptr; + message.m_pucData = NULL; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); @@ -614,7 +614,7 @@ void DQRNetworkManager::RTS_StartHost() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_START_HOST; - message.m_pucData = nullptr; + message.m_pucData = NULL; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); @@ -625,7 +625,7 @@ void DQRNetworkManager::RTS_Terminate() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_TERMINATE; - message.m_pucData = nullptr; + message.m_pucData = NULL; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); @@ -636,7 +636,7 @@ void DQRNetworkManager::RTS_SendData(unsigned char *pucData, unsigned int dataSi EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_SEND_DATA; - message.m_pucData = static_cast(malloc(dataSize)); + message.m_pucData = (unsigned char *)malloc(dataSize); memcpy(message.m_pucData, pucData, dataSize); message.m_dataSize = dataSize; message.m_sessionAddress = sessionAddress; diff --git a/Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp b/Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp index a8140764..e2d82a90 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp @@ -97,7 +97,7 @@ bool DQRNetworkPlayer::HasVoice() Microsoft::Xbox::GameChat::ChatUser^ chatUser = m_manager->m_chat->GetChatUserByXboxUserId(ref new Platform::String(m_UID.toString().c_str())); if( chatUser == nullptr ) return false; - if( static_cast(chatUser->ParticipantType) & static_cast(Windows::Xbox::Chat::ChatParticipantTypes::Talker) ) + if( ((int)chatUser->ParticipantType) & ((int)Windows::Xbox::Chat::ChatParticipantTypes::Talker) ) { return true; } diff --git a/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp b/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp index 84a34a97..fd2181df 100644 --- a/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp +++ b/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp @@ -4,7 +4,7 @@ NetworkPlayerDurango::NetworkPlayerDurango(DQRNetworkPlayer *qnetPlayer) { m_dqrPlayer = qnetPlayer; - m_pSocket = nullptr; + m_pSocket = NULL; } unsigned char NetworkPlayerDurango::GetSmallId() @@ -14,12 +14,12 @@ unsigned char NetworkPlayerDurango::GetSmallId() void NetworkPlayerDurango::SendData(INetworkPlayer *player, const void *pvData, int dataSize, bool lowPriority) { - m_dqrPlayer->SendData( static_cast(player)->m_dqrPlayer, pvData, dataSize ); + m_dqrPlayer->SendData( ((NetworkPlayerDurango *)player)->m_dqrPlayer, pvData, dataSize ); } bool NetworkPlayerDurango::IsSameSystem(INetworkPlayer *player) { - return m_dqrPlayer->IsSameSystem(static_cast(player)->m_dqrPlayer); + return m_dqrPlayer->IsSameSystem(((NetworkPlayerDurango *)player)->m_dqrPlayer); } int NetworkPlayerDurango::GetSendQueueSizeBytes( INetworkPlayer *player, bool lowPriority ) diff --git a/Minecraft.Client/Durango/Network/PartyController.cpp b/Minecraft.Client/Durango/Network/PartyController.cpp index 1dfd5eb0..753a71ac 100644 --- a/Minecraft.Client/Durango/Network/PartyController.cpp +++ b/Minecraft.Client/Durango/Network/PartyController.cpp @@ -103,7 +103,7 @@ void PartyController::RefreshPartyView() } catch ( Platform::Exception^ ex ) { - if( ex->HResult != static_cast(Windows::Xbox::Multiplayer::PartyErrorStatus::EmptyParty) ) + if( ex->HResult != (int)Windows::Xbox::Multiplayer::PartyErrorStatus::EmptyParty ) { // LogCommentWithError( L"GetPartyView failed", ex->HResult ); } @@ -181,7 +181,7 @@ bool PartyController::AddLocalUsersToParty(int userMask, Windows::Xbox::System:: bool alreadyInSession = false; if( session ) { - if( m_pDQRNet->IsPlayerInSession( ProfileManager.GetUser(i, true)->XboxUserId, session, nullptr ) ) + if( m_pDQRNet->IsPlayerInSession( ProfileManager.GetUser(i, true)->XboxUserId, session, NULL ) ) { alreadyInSession = true; } @@ -577,7 +577,7 @@ void PartyController::OnPartyRosterChanged( PartyRosterChangedEventArgs^ eventAr // Still a party, find out who left for( int i = 0; i < eventArgs->RemovedMembers->Size; i++ ) { - DQRNetworkPlayer *player = m_pDQRNet->GetPlayerByXuid(static_cast(eventArgs->RemovedMembers->GetAt(i)->Data())); + DQRNetworkPlayer *player = m_pDQRNet->GetPlayerByXuid(PlayerUID(eventArgs->RemovedMembers->GetAt(i)->Data())); if( player ) { if( player->IsLocal() ) @@ -621,7 +621,7 @@ void PartyController::AddAvailableGamePlayers(IVectorView^ availabl } #endif - if( m_pDQRNet->IsPlayerInSession(player->XboxUserId, currentSession, nullptr)) + if( m_pDQRNet->IsPlayerInSession(player->XboxUserId, currentSession, NULL)) { DQRNetworkManager::LogComment( L"Player is already in session; skipping join request: " + player->XboxUserId->ToString() ); continue; @@ -639,7 +639,7 @@ void PartyController::AddAvailableGamePlayers(IVectorView^ availabl { bFoundLocal = true; // Check that they aren't in the game already (don't see how this could be the case anyway) - if( m_pDQRNet->GetPlayerByXuid( static_cast(player->XboxUserId->Data()) ) == nullptr ) + if( m_pDQRNet->GetPlayerByXuid( PlayerUID(player->XboxUserId->Data()) ) == NULL ) { // And check whether they are signed in yet or not int userIdx = -1; @@ -838,7 +838,7 @@ void PartyController::OnGameSessionReady( GameSessionReadyEventArgs^ eventArgs ) if( !isAJoiningXuid ) // Isn't someone we are actively trying to join { if( (!bInSession) || // If not in a game session at all - ( ( m_pDQRNet->GetState() == DQRNetworkManager::DNM_INT_STATE_PLAYING ) && ( m_pDQRNet->GetPlayerByXuid( static_cast(memberXUID->Data()) ) == nullptr ) ) // Or we're fully in, and this player isn't in it + ( ( m_pDQRNet->GetState() == DQRNetworkManager::DNM_INT_STATE_PLAYING ) && ( m_pDQRNet->GetPlayerByXuid( PlayerUID(memberXUID->Data()) ) == NULL ) ) // Or we're fully in, and this player isn't in it ) { for( int j = 4; j < 12; j++ ) // Final check that we have a gamepad for this xuid so that we might possibly be able to pair someone up @@ -1201,5 +1201,5 @@ double PartyController::GetTimeBetweenInSeconds(Windows::Foundation::DateTime dt { const uint64 tickPerSecond = 10000000i64; uint64 deltaTime = dt2.UniversalTime - dt1.UniversalTime; - return static_cast(deltaTime) / static_cast(tickPerSecond); + return (double)deltaTime / (double)tickPerSecond; } \ No newline at end of file diff --git a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp index 5e3a0824..925a37a8 100644 --- a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp +++ b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp @@ -87,7 +87,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl bool createFakeSocket = false; bool localPlayer = false; - NetworkPlayerDurango *networkPlayer = static_cast(addNetworkPlayer(pDQRPlayer)); + NetworkPlayerDurango *networkPlayer = (NetworkPlayerDurango *)addNetworkPlayer(pDQRPlayer); // Request full display name for this player m_pDQRNet->RequestDisplayName(pDQRPlayer); @@ -166,7 +166,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -175,7 +175,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -198,7 +198,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP { // Get our wrapper object associated with this player. Socket *socket = networkPlayer->GetSocket(); - if( socket != nullptr ) + if( socket != NULL ) { // If we are in game then remove this player from the game as well. // We may get here either from the player requesting to exit the game, @@ -214,14 +214,14 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP // We need this as long as the game server still needs to communicate with the player //delete socket; - networkPlayer->SetSocket( nullptr ); + networkPlayer->SetSocket( NULL ); } if( m_pDQRNet->IsHost() && !m_bHostChanged ) { if( isSystemPrimaryPlayer(pDQRPlayer) ) { - DQRNetworkPlayer *pNewDQRPrimaryPlayer = nullptr; + DQRNetworkPlayer *pNewDQRPrimaryPlayer = NULL; for(unsigned int i = 0; i < m_pDQRNet->GetPlayerCount(); ++i ) { DQRNetworkPlayer *pDQRPlayer2 = m_pDQRNet->GetPlayerByIndex( i ); @@ -238,7 +238,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP m_machineDQRPrimaryPlayers.erase( it ); } - if( pNewDQRPrimaryPlayer != nullptr ) + if( pNewDQRPrimaryPlayer != NULL ) m_machineDQRPrimaryPlayers.push_back( pNewDQRPrimaryPlayer ); } @@ -251,7 +251,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != nullptr) + if(playerChangedCallback[idx] != NULL) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); } @@ -260,7 +260,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; + if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -289,7 +289,7 @@ void CPlatformNetworkManagerDurango::HandleDataReceived(DQRNetworkPlayer *player INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom); Socket *socket = pPlayerFrom->GetSocket(); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(data, dataSize, false); } else @@ -298,7 +298,7 @@ void CPlatformNetworkManagerDurango::HandleDataReceived(DQRNetworkPlayer *player INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo); Socket *socket = pPlayerTo->GetSocket(); //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != nullptr) + if(socket != NULL) socket->pushDataToQueue(data, dataSize); } } @@ -319,7 +319,7 @@ bool CPlatformNetworkManagerDurango::Initialise(CGameNetworkManager *pGameNetwor g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = nullptr; + playerChangedCallback[ i ] = NULL; } m_bLeavingGame = false; @@ -330,14 +330,14 @@ bool CPlatformNetworkManagerDurango::Initialise(CGameNetworkManager *pGameNetwor m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = nullptr; - m_SessionsUpdatedCallback = nullptr; + m_pSearchParam = NULL; + m_SessionsUpdatedCallback = NULL; m_searchResultsCount = 0; m_lastSearchStartTime = 0; // The results that will be filled in with the current search - m_pSearchResults = nullptr; + m_pSearchResults = NULL; Windows::Networking::Connectivity::NetworkInformation::NetworkStatusChanged += ref new Windows::Networking::Connectivity::NetworkStatusChangedEventHandler( []( Platform::Object^ pxObject ) { @@ -585,8 +585,8 @@ void CPlatformNetworkManagerDurango::UnRegisterPlayerChangedCallback(int iPad, v { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = nullptr; - playerChangedCallbackParam[iPad] = nullptr; + playerChangedCallback[iPad] = NULL; + playerChangedCallbackParam[iPad] = NULL; } } @@ -613,12 +613,12 @@ bool CPlatformNetworkManagerDurango::_RunNetworkGame() return true; } -void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) +void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) { if( this->m_bLeavingGame ) return; - if( GetHostPlayer() == nullptr ) + if( GetHostPlayer() == NULL ) return; m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All); @@ -628,18 +628,18 @@ void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer int CPlatformNetworkManagerDurango::RemovePlayerOnSocketClosedThreadProc( void* lpParam ) { - INetworkPlayer *pNetworkPlayer = static_cast(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; } @@ -712,7 +712,7 @@ void CPlatformNetworkManagerDurango::SystemFlagReset() void CPlatformNetworkManagerDurango::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++ ) { @@ -728,7 +728,7 @@ void CPlatformNetworkManagerDurango::SystemFlagSet(INetworkPlayer *pNetworkPlaye bool CPlatformNetworkManagerDurango::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == nullptr ) + if( pNetworkPlayer == NULL ) { return false; } @@ -769,7 +769,7 @@ void CPlatformNetworkManagerDurango::TickSearch() } m_bSearchPending = false; - if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam); + if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); } } else @@ -777,7 +777,7 @@ void CPlatformNetworkManagerDurango::TickSearch() if( !m_pDQRNet->FriendPartyManagerIsBusy() ) { // Don't start searches unless we have registered a callback - if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + MINECRAFT_DURANGO_PARTY_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) + if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + MINECRAFT_DURANGO_PARTY_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) { if( m_pDQRNet->FriendPartyManagerSearch() ); { @@ -794,13 +794,13 @@ vector *CPlatformNetworkManagerDurango::GetSessionList(int vector *filteredList = new vector(); for( int i = 0; i < m_searchResultsCount; i++ ) { - GameSessionData *gameSessionData = static_cast(m_pSearchResults[i].m_extData); + GameSessionData *gameSessionData = (GameSessionData *)m_pSearchResults[i].m_extData; if( ( gameSessionData->netVersion == MINECRAFT_NET_VERSION ) && ( gameSessionData->isReadyToJoin ) ) { FriendSessionInfo *session = new FriendSessionInfo(); session->searchResult = m_pSearchResults[i]; - session->searchResult.m_extData = nullptr; // We have another copy of the GameSessionData, so don't need to make another copy of this here + session->searchResult.m_extData = NULL; // We have another copy of the GameSessionData, so don't need to make another copy of this here session->displayLabelLength = session->searchResult.m_playerNames[0].size(); session->displayLabel = new wchar_t[ session->displayLabelLength + 1 ]; memcpy(&session->data, gameSessionData, sizeof(GameSessionData)); @@ -832,7 +832,7 @@ void CPlatformNetworkManagerDurango::ForceFriendsSessionRefresh() m_lastSearchStartTime = 0; m_searchResultsCount = 0; delete [] m_pSearchResults; - m_pSearchResults = nullptr; + m_pSearchResults = NULL; } INetworkPlayer *CPlatformNetworkManagerDurango::addNetworkPlayer(DQRNetworkPlayer *pDQRPlayer) @@ -858,7 +858,7 @@ void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRP INetworkPlayer *CPlatformNetworkManagerDurango::getNetworkPlayer(DQRNetworkPlayer *pDQRPlayer) { - return pDQRPlayer ? (INetworkPlayer *)(pDQRPlayer->GetCustomDataValue()) : nullptr; + return pDQRPlayer ? (INetworkPlayer *)(pDQRPlayer->GetCustomDataValue()) : NULL; } diff --git a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h index 5626b012..55807227 100644 --- a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h +++ b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h @@ -87,7 +87,7 @@ private: bool m_hostGameSessionIsJoinable; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Durango/Network/base64.cpp b/Minecraft.Client/Durango/Network/base64.cpp index c916725f..c5af745c 100644 --- a/Minecraft.Client/Durango/Network/base64.cpp +++ b/Minecraft.Client/Durango/Network/base64.cpp @@ -109,13 +109,13 @@ void base64_decode(Platform::String ^encoded_string, unsigned char *output, unsi while (in_len-- && ( encoded_string->Data()[in_] != L'=') && is_base64(encoded_string->Data()[in_])) { - char_array_4[i++] = static_cast(encoded_string->Data()[in_]); + char_array_4[i++] = (unsigned char)(encoded_string->Data()[in_]); in_++; if (i ==4) { for (i = 0; i <4; i++) { - char_array_4[i] = static_cast(base64_chars.find(char_array_4[i])); + char_array_4[i] = (unsigned char )base64_chars.find(char_array_4[i]); } char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); @@ -140,7 +140,7 @@ void base64_decode(Platform::String ^encoded_string, unsigned char *output, unsi for (j = 0; j <4; j++) { - char_array_4[j] = static_cast(base64_chars.find(char_array_4[j])); + char_array_4[j] = (unsigned char )base64_chars.find(char_array_4[j]); } char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); -- cgit v1.2.3