aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Durango/Network
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/Durango/Network
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
Project modernization (#630)
* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.Client/Durango/Network')
-rw-r--r--Minecraft.Client/Durango/Network/ChatIntegrationLayer.h2
-rw-r--r--Minecraft.Client/Durango/Network/DQRNetworkManager.cpp90
-rw-r--r--Minecraft.Client/Durango/Network/DQRNetworkManager.h2
-rw-r--r--Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp12
-rw-r--r--Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp16
-rw-r--r--Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp14
-rw-r--r--Minecraft.Client/Durango/Network/DQRNetworkPlayer.cpp2
-rw-r--r--Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp6
-rw-r--r--Minecraft.Client/Durango/Network/PartyController.cpp14
-rw-r--r--Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp60
-rw-r--r--Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h2
-rw-r--r--Minecraft.Client/Durango/Network/base64.cpp6
12 files changed, 113 insertions, 113 deletions
diff --git a/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h b/Minecraft.Client/Durango/Network/ChatIntegrationLayer.h
index 80b4e10a..f81a0f1f 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][(int)Microsoft::Xbox::GameChat::ChatMessageType::InvalidMessage+1];
+ int m_chatVoicePacketsStatistic[2][static_cast<int>(Microsoft::Xbox::GameChat::ChatMessageType::InvalidMessage)+1];
};
std::shared_ptr<ChatIntegrationLayer> GetChatIntegrationLayer(); \ No newline at end of file
diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp
index 39dc53a9..9e9e78c0 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 = NULL;
+DQRNetworkManager * DQRNetworkManager::s_pDQRManager = nullptr;
//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 = NULL;
- m_GetFriendPartyThread = NULL;
- m_UpdateCustomSessionDataThread = NULL;
+ m_CreateSessionThread = nullptr;
+ m_GetFriendPartyThread = nullptr;
+ m_UpdateCustomSessionDataThread = nullptr;
- m_CheckPartyInviteThread = NULL;
+ m_CheckPartyInviteThread = nullptr;
m_notifyForFullParty = false;
m_customDataDirtyUpdateTicks = 0;
m_sessionResultCount = 0;
- m_sessionSearchResults = NULL;
+ m_sessionSearchResults = nullptr;
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, NULL) )
+ if(!IsPlayerInSession(joiningUser->XboxUserId, session, nullptr) )
{
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(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data()));
+ pPlayer->SetUID(static_cast<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(PlayerUID(ProfileManager.GetUser(userIndex)->XboxUserId->Data()));
+ pPlayer->SetUID(static_cast<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 = NULL;
+ m_addLocalPlayerSuccessPlayer = nullptr;
m_addLocalPlayerState = DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS;
}
}
@@ -763,7 +763,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerBySmallId(int idx)
}
}
}
- return NULL;
+ return nullptr;
}
DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid)
@@ -778,7 +778,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid)
}
}
}
- return NULL;
+ return nullptr;
}
// Retrieve player display name by gamertag
@@ -809,7 +809,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetLocalPlayerByUserIndex(int idx)
}
}
}
- return NULL;
+ return nullptr;
}
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( int i = 0; i < m_vecChatPlayersJoined.size(); i++ )
+ for( size_t 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 != NULL )
+ if( m_UpdateCustomSessionDataThread != nullptr )
{
if( !m_UpdateCustomSessionDataThread->isRunning() )
{
delete m_UpdateCustomSessionDataThread;
- m_UpdateCustomSessionDataThread = NULL;
+ m_UpdateCustomSessionDataThread = nullptr;
}
}
// 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 == NULL )
+ if( m_UpdateCustomSessionDataThread == nullptr )
{
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 NULL 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 nullptr 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 = NULL;
+ m_CreateSessionThread = nullptr;
// 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 = NULL;
+ m_CheckPartyInviteThread = nullptr;
}
}
- if( m_CheckPartyInviteThread == NULL )
+ if( m_CheckPartyInviteThread == nullptr )
{
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.
- ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId);
+ static_cast<DurangoStats *>(GenericStats::getInstance())->setMultiplayerCorrelationId(multiplayerSession->MultiplayerCorrelationId);
}
else
{
- ((DurangoStats*)GenericStats::getInstance())->setMultiplayerCorrelationId( nullptr );
+ static_cast<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 = (int)(customValue->GetNumber()) & 255;
+ *smallId = static_cast<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] = NULL;
+ m_players[j] = nullptr;
}
// For each new player, it's either:
@@ -1509,12 +1509,12 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
}
memcpy(&m_roomSyncData, pNewSyncData, sizeof(m_roomSyncData));
- for( int i = 0; i < tempPlayers.size(); i++ )
+ for( size_t i = 0; i < tempPlayers.size(); i++ )
{
m_listener->HandlePlayerLeaving(tempPlayers[i]);
delete tempPlayers[i];
}
- for( int i = 0; i < newPlayers.size(); i++ )
+ for( size_t 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( int i = 0; i < removedPlayers.size(); i++ )
+ for( size_t 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] = NULL;
+ m_players[m_roomSyncData.playerCount + i] = nullptr;
}
LeaveCriticalSection(&m_csRoomSyncData);
}
@@ -1623,12 +1623,12 @@ void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer)
}
m_roomSyncData.playerCount = iWriteIdx;
- for( int i = 0; i < removedPlayers.size(); i++ )
+ for( size_t 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] = NULL;
+ m_players[m_roomSyncData.playerCount + i] = nullptr;
}
}
@@ -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 NULL terminated string for every active player to encode the XUID
+ // (5) A wchar nullptr 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 NULL terminated string storing the xuid of the player which has failed to join
+ // (5) A wchar nullptr 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 = (BYTE)(customValue->GetNumber());
+ smallId = static_cast<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 = (BYTE)(customValue->GetNumber());
+ smallIdMember = static_cast<BYTE>(customValue->GetNumber());
}
catch (Platform::COMException^ ex)
{
@@ -1830,7 +1830,7 @@ int DQRNetworkManager::GetSessionIndexAndSmallIdForHost(unsigned char *smallId)
}
if( smallIdMember > 255 )
{
- *smallId = (BYTE)(smallIdMember);
+ *smallId = static_cast<BYTE>(smallIdMember);
return i;
}
}
@@ -1877,7 +1877,7 @@ Platform::String^ DQRNetworkManager::GetNextSmallIdAsJsonString()
int DQRNetworkManager::_HostGameThreadProc( void* lpParameter )
{
- DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
+ DQRNetworkManager *pDQR = static_cast<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(PlayerUID(user->XboxUserId->Data()));
+ pPlayer->SetUID(static_cast<PlayerUID>(user->XboxUserId->Data()));
AddRoomSyncPlayer( pPlayer, localSessionAddress, i);
@@ -2208,7 +2208,7 @@ int DQRNetworkManager::HostGameThreadProc()
int DQRNetworkManager::_LeaveRoomThreadProc( void* lpParameter )
{
- DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
+ DQRNetworkManager *pDQR = static_cast<DQRNetworkManager *>(lpParameter);
return pDQR->LeaveRoomThreadProc();
}
@@ -2311,7 +2311,7 @@ int DQRNetworkManager::LeaveRoomThreadProc()
int DQRNetworkManager::_TidyUpJoinThreadProc( void* lpParameter )
{
- DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
+ DQRNetworkManager *pDQR = static_cast<DQRNetworkManager *>(lpParameter);
return pDQR->TidyUpJoinThreadProc();
}
@@ -2416,7 +2416,7 @@ int DQRNetworkManager::TidyUpJoinThreadProc()
int DQRNetworkManager::_UpdateCustomSessionDataThreadProc( void* lpParameter )
{
- DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
+ DQRNetworkManager *pDQR = static_cast<DQRNetworkManager *>(lpParameter);
return pDQR->UpdateCustomSessionDataThreadProc();
}
@@ -2491,7 +2491,7 @@ int DQRNetworkManager::UpdateCustomSessionDataThreadProc()
int DQRNetworkManager::_CheckInviteThreadProc(void* lpParameter)
{
- DQRNetworkManager *pDQR = (DQRNetworkManager *)lpParameter;
+ DQRNetworkManager *pDQR = static_cast<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] = NULL;
+ m_players[i] = nullptr;
}
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 = (DQRNetworkManager *)pParam;
- dqnm->SetDisplayName(PlayerUID(profile->XboxUserId->Data()), profile->GameDisplayName->Data());
+ DQRNetworkManager *dqnm = static_cast<DQRNetworkManager *>(pParam);
+ dqnm->SetDisplayName(static_cast<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 3c4a742c..b74e079c 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 = NULL; }
+ SessionSearchResult() { m_extData = nullptr; }
~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 3a14a2d5..0822a93c 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 = NULL;
+ m_sessionSearchResults = nullptr;
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 == NULL ) || ( !m_GetFriendPartyThread->isRunning()) );
+ assert( ( m_GetFriendPartyThread == nullptr ) || ( !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 = (DQRNetworkManager *)lpParameter;
+ DQRNetworkManager *pDQR = static_cast<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] = PlayerUID(nameResolveVector[i]->GetAt(j)->XboxUserId->Data());
+ m_sessionSearchResults[i].m_playerXuids[j] = static_cast<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(((GameSessionData *)gameSessionData)->m_uiGameHostSettings, eGameHostOption_FriendsOfFriends);
+ friendsOfFriends = app.GetGameHostOption(static_cast<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, (unsigned char *)gameSessionData, sizeof(GameSessionData) );
+ base64_decode( customValueString, static_cast<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 9232d095..eed3e851 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 == NULL ) || ( client == NULL ) )
+ if( ( host == nullptr ) || ( client == nullptr ) )
{
return;
}
@@ -113,7 +113,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo,
case DQRConnectionInfo::ConnectionState_InternalAssignSmallId2:
case DQRConnectionInfo::ConnectionState_InternalAssignSmallId3:
{
- int channel = ((int)connectionInfo->m_internalDataState) - DQRConnectionInfo::ConnectionState_InternalAssignSmallId0;
+ int channel = static_cast<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(PlayerUID(m_multiplayerSession->Members->GetAt(sessionIndex)->XboxUserId->Data()));
+ pPlayer->SetUID(static_cast<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 = NULL;
+ connectionInfo->m_pucRoomSyncData = nullptr;
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) == NULL )
+ if( GetLocalPlayerByUserIndex(i) == nullptr )
{
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 = NULL;
+ connectionInfo->m_pucAddFailedPlayerData = nullptr;
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 = (unsigned char *)malloc(8191 + 2);
+ unsigned char *tempSendBuffer = static_cast<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 = (int)(dataEnd - data);
+ int bytesToSend = static_cast<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 c985a191..ae7094fb 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 = (unsigned char *)malloc(rtsMessage.m_dataSize);
+ rtsMessage.m_pucData = static_cast<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 = (int)(pEndByte - pNextByte);
+ int bytesInBuffer = static_cast<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 = (DQRNetworkManager *)lpParameter;
+ DQRNetworkManager *pDQR = static_cast<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 = NULL;
+ message.m_pucData = nullptr;
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 = NULL;
+ message.m_pucData = nullptr;
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 = NULL;
+ message.m_pucData = nullptr;
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 = (unsigned char *)malloc(dataSize);
+ message.m_pucData = static_cast<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 e2d82a90..a8140764 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( ((int)chatUser->ParticipantType) & ((int)Windows::Xbox::Chat::ChatParticipantTypes::Talker) )
+ if( static_cast<int>(chatUser->ParticipantType) & static_cast<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 fd2181df..84a34a97 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 = NULL;
+ m_pSocket = nullptr;
}
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( ((NetworkPlayerDurango *)player)->m_dqrPlayer, pvData, dataSize );
+ m_dqrPlayer->SendData( static_cast<NetworkPlayerDurango *>(player)->m_dqrPlayer, pvData, dataSize );
}
bool NetworkPlayerDurango::IsSameSystem(INetworkPlayer *player)
{
- return m_dqrPlayer->IsSameSystem(((NetworkPlayerDurango *)player)->m_dqrPlayer);
+ return m_dqrPlayer->IsSameSystem(static_cast<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 753a71ac..1dfd5eb0 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 != (int)Windows::Xbox::Multiplayer::PartyErrorStatus::EmptyParty )
+ if( ex->HResult != static_cast<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, NULL ) )
+ if( m_pDQRNet->IsPlayerInSession( ProfileManager.GetUser(i, true)->XboxUserId, session, nullptr ) )
{
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(PlayerUID(eventArgs->RemovedMembers->GetAt(i)->Data()));
+ DQRNetworkPlayer *player = m_pDQRNet->GetPlayerByXuid(static_cast<PlayerUID>(eventArgs->RemovedMembers->GetAt(i)->Data()));
if( player )
{
if( player->IsLocal() )
@@ -621,7 +621,7 @@ void PartyController::AddAvailableGamePlayers(IVectorView<GamePlayer^>^ availabl
}
#endif
- if( m_pDQRNet->IsPlayerInSession(player->XboxUserId, currentSession, NULL))
+ if( m_pDQRNet->IsPlayerInSession(player->XboxUserId, currentSession, nullptr))
{
DQRNetworkManager::LogComment( L"Player is already in session; skipping join request: " + player->XboxUserId->ToString() );
continue;
@@ -639,7 +639,7 @@ void PartyController::AddAvailableGamePlayers(IVectorView<GamePlayer^>^ 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( PlayerUID(player->XboxUserId->Data()) ) == NULL )
+ if( m_pDQRNet->GetPlayerByXuid( static_cast<PlayerUID>(player->XboxUserId->Data()) ) == nullptr )
{
// 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( PlayerUID(memberXUID->Data()) ) == NULL ) ) // Or we're fully in, and this player isn't in it
+ ( ( m_pDQRNet->GetState() == DQRNetworkManager::DNM_INT_STATE_PLAYING ) && ( m_pDQRNet->GetPlayerByXuid( static_cast<PlayerUID>(memberXUID->Data()) ) == nullptr ) ) // 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 (double)deltaTime / (double)tickPerSecond;
+ return static_cast<double>(deltaTime) / static_cast<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 925a37a8..5e3a0824 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 = (NetworkPlayerDurango *)addNetworkPlayer(pDQRPlayer);
+ NetworkPlayerDurango *networkPlayer = static_cast<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] != NULL)
+ if(playerChangedCallback[idx] != nullptr)
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) != NULL ) ++localPlayerCount;
+ if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++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 != NULL )
+ if( socket != nullptr )
{
// 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( NULL );
+ networkPlayer->SetSocket( nullptr );
}
if( m_pDQRNet->IsHost() && !m_bHostChanged )
{
if( isSystemPrimaryPlayer(pDQRPlayer) )
{
- DQRNetworkPlayer *pNewDQRPrimaryPlayer = NULL;
+ DQRNetworkPlayer *pNewDQRPrimaryPlayer = nullptr;
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 != NULL )
+ if( pNewDQRPrimaryPlayer != nullptr )
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] != NULL)
+ if(playerChangedCallback[idx] != nullptr)
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) != NULL ) ++localPlayerCount;
+ if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount;
}
float appTime = app.getAppTime();
@@ -289,7 +289,7 @@ void CPlatformNetworkManagerDurango::HandleDataReceived(DQRNetworkPlayer *player
INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom);
Socket *socket = pPlayerFrom->GetSocket();
- if(socket != NULL)
+ if(socket != nullptr)
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 != NULL)
+ if(socket != nullptr)
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 ] = NULL;
+ playerChangedCallback[ i ] = nullptr;
}
m_bLeavingGame = false;
@@ -330,14 +330,14 @@ bool CPlatformNetworkManagerDurango::Initialise(CGameNetworkManager *pGameNetwor
m_bSearchPending = false;
m_bIsOfflineGame = false;
- m_pSearchParam = NULL;
- m_SessionsUpdatedCallback = NULL;
+ m_pSearchParam = nullptr;
+ m_SessionsUpdatedCallback = nullptr;
m_searchResultsCount = 0;
m_lastSearchStartTime = 0;
// The results that will be filled in with the current search
- m_pSearchResults = NULL;
+ m_pSearchResults = nullptr;
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] = NULL;
- playerChangedCallbackParam[iPad] = NULL;
+ playerChangedCallback[iPad] = nullptr;
+ playerChangedCallbackParam[iPad] = nullptr;
}
}
@@ -613,12 +613,12 @@ bool CPlatformNetworkManagerDurango::_RunNetworkGame()
return true;
}
-void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/)
+void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/)
{
if( this->m_bLeavingGame )
return;
- if( GetHostPlayer() == NULL )
+ if( GetHostPlayer() == nullptr )
return;
m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All);
@@ -628,18 +628,18 @@ void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer
int CPlatformNetworkManagerDurango::RemovePlayerOnSocketClosedThreadProc( void* lpParam )
{
- INetworkPlayer *pNetworkPlayer = (INetworkPlayer *)lpParam;
+ INetworkPlayer *pNetworkPlayer = static_cast<INetworkPlayer *>(lpParam);
Socket *socket = pNetworkPlayer->GetSocket();
- if( socket != NULL )
+ if( socket != nullptr )
{
//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( NULL );
+ pNetworkPlayer->SetSocket( nullptr );
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 == NULL ) return;
+ if( pNetworkPlayer == nullptr ) 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 == NULL )
+ if( pNetworkPlayer == nullptr )
{
return false;
}
@@ -769,7 +769,7 @@ void CPlatformNetworkManagerDurango::TickSearch()
}
m_bSearchPending = false;
- if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam);
+ if( m_SessionsUpdatedCallback != nullptr ) 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 != NULL && (m_lastSearchStartTime + MINECRAFT_DURANGO_PARTY_SEARCH_DELAY_MILLISECONDS) < GetTickCount() )
+ if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + MINECRAFT_DURANGO_PARTY_SEARCH_DELAY_MILLISECONDS) < GetTickCount() )
{
if( m_pDQRNet->FriendPartyManagerSearch() );
{
@@ -794,13 +794,13 @@ vector<FriendSessionInfo *> *CPlatformNetworkManagerDurango::GetSessionList(int
vector<FriendSessionInfo *> *filteredList = new vector<FriendSessionInfo *>();
for( int i = 0; i < m_searchResultsCount; i++ )
{
- GameSessionData *gameSessionData = (GameSessionData *)m_pSearchResults[i].m_extData;
+ GameSessionData *gameSessionData = static_cast<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 = NULL; // We have another copy of the GameSessionData, so don't need to make another copy of this here
+ session->searchResult.m_extData = nullptr; // 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 = NULL;
+ m_pSearchResults = nullptr;
}
INetworkPlayer *CPlatformNetworkManagerDurango::addNetworkPlayer(DQRNetworkPlayer *pDQRPlayer)
@@ -858,7 +858,7 @@ void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRP
INetworkPlayer *CPlatformNetworkManagerDurango::getNetworkPlayer(DQRNetworkPlayer *pDQRPlayer)
{
- return pDQRPlayer ? (INetworkPlayer *)(pDQRPlayer->GetCustomDataValue()) : NULL;
+ return pDQRPlayer ? (INetworkPlayer *)(pDQRPlayer->GetCustomDataValue()) : nullptr;
}
diff --git a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h
index 55807227..5626b012 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 = NULL);
+ virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr);
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 c5af745c..c916725f 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++] = (unsigned char)(encoded_string->Data()[in_]);
+ char_array_4[i++] = static_cast<unsigned char>(encoded_string->Data()[in_]);
in_++;
if (i ==4)
{
for (i = 0; i <4; i++)
{
- char_array_4[i] = (unsigned char )base64_chars.find(char_array_4[i]);
+ char_array_4[i] = static_cast<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] = (unsigned char )base64_chars.find(char_array_4[j]);
+ char_array_4[j] = static_cast<unsigned char>(base64_chars.find(char_array_4[j]));
}
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);