aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp')
-rw-r--r--Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp
index d7196849..57937543 100644
--- a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp
+++ b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp
@@ -6,7 +6,6 @@
#include "..\..\ClientConnection.h"
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
-
#define CHECKBOXES_TIMER_ID 0
#define CHECKBOXES_TIMER_TIME 100
@@ -17,21 +16,21 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void
m_bShouldNavBack = false;
- InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)_initData;
+ InGamePlayerOptionsInitData *initData = static_cast<InGamePlayerOptionsInitData *>(_initData);
m_networkSmallId = initData->networkSmallId;
m_playerPrivileges = initData->playerPrivileges;
INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad );
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
- if(editingPlayer != NULL)
+ if(editingPlayer != nullptr)
{
m_labelGamertag.init(editingPlayer->GetDisplayName());
}
bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
- m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer);
+ m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer);
if( m_editingSelf || trustPlayers || editingPlayer->IsHost())
{
@@ -61,7 +60,7 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void
if(m_editingSelf)
{
-#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
+#ifndef _DEBUG // (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
removeControl( &m_checkboxes[eControl_Op], true );
#else
m_checkboxes[eControl_Op].init(L"DEBUG: Creative",eControl_Op,Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode));
@@ -241,7 +240,7 @@ void UIScene_InGamePlayerOptionsMenu::handleReload()
bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
- m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer);
+ m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer);
if( m_editingSelf || trustPlayers || editingPlayer->IsHost())
{
@@ -254,7 +253,7 @@ void UIScene_InGamePlayerOptionsMenu::handleReload()
if(m_editingSelf)
{
-#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
+#ifndef _DEBUG //(defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
removeControl( &m_checkboxes[eControl_Op], true );
#endif
@@ -348,7 +347,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
if(m_editingSelf)
{
-#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
+#ifndef _DEBUG // (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
#else
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode,m_checkboxes[eControl_Op].IsChecked());
#endif
@@ -372,7 +371,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
else
{
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
- if(!trustPlayers && (editingPlayer != NULL && !editingPlayer->IsHost() ) )
+ if(!trustPlayers && (editingPlayer != nullptr && !editingPlayer->IsHost() ) )
{
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotMine,!m_checkboxes[eControl_BuildAndMine].IsChecked());
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotBuild,!m_checkboxes[eControl_BuildAndMine].IsChecked());
@@ -405,7 +404,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
if(player->connection)
{
- player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) );
+ player->connection->send(std::make_shared<PlayerInfoPacket>(m_networkSmallId, -1, m_playerPrivileges));
}
}
navigateBack();
@@ -428,7 +427,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId)
{
- switch((int)controlId)
+ switch(static_cast<int>(controlId))
{
case eControl_Kick:
{
@@ -446,7 +445,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId)
int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- BYTE smallId = *(BYTE *)pParam;
+ BYTE smallId = *static_cast<BYTE *>(pParam);
delete pParam;
if(result==C4JStorage::EMessage_ResultAccept)
@@ -455,7 +454,7 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
if(localPlayer->connection)
{
- localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
+ localPlayer->connection->send(std::make_shared<KickPlayerPacket>(smallId));
}
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
@@ -470,12 +469,12 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4
void UIScene_InGamePlayerOptionsMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving)
{
app.DebugPrintf("UIScene_InGamePlayerOptionsMenu::OnPlayerChanged");
- UIScene_InGamePlayerOptionsMenu *scene = (UIScene_InGamePlayerOptionsMenu *)callbackParam;
+ UIScene_InGamePlayerOptionsMenu *scene = static_cast<UIScene_InGamePlayerOptionsMenu *>(callbackParam);
- UIScene_InGameInfoMenu *infoScene = (UIScene_InGameInfoMenu *)scene->getBackScene();
- if(infoScene != NULL) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving);
+ UIScene_InGameInfoMenu *infoScene = static_cast<UIScene_InGameInfoMenu *>(scene->getBackScene());
+ if(infoScene != nullptr) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving);
- if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId)
+ if(leaving && pPlayer != nullptr && pPlayer->GetSmallId() == scene->m_networkSmallId)
{
scene->m_bShouldNavBack = true;
}
@@ -497,7 +496,7 @@ void UIScene_InGamePlayerOptionsMenu::resetCheatCheckboxes()
void UIScene_InGamePlayerOptionsMenu::handleCheckboxToggled(F64 controlId, bool selected)
{
- switch((int)controlId)
+ switch(static_cast<int>(controlId))
{
case eControl_Op:
// flag that the moderator state has changed