aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Minecraft.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/Minecraft.cpp')
-rw-r--r--Minecraft.Client/Minecraft.cpp516
1 files changed, 259 insertions, 257 deletions
diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp
index 46e8497a..4b9fd74c 100644
--- a/Minecraft.Client/Minecraft.cpp
+++ b/Minecraft.Client/Minecraft.cpp
@@ -84,13 +84,15 @@
// from the main thread, and have longer to run, since it's called at 20Hz instead of 60
#define DISABLE_LEVELTICK_THREAD
-Minecraft *Minecraft::m_instance = NULL;
+Minecraft *Minecraft::m_instance = nullptr;
int64_t Minecraft::frameTimes[512];
int64_t Minecraft::tickTimes[512];
int Minecraft::frameTimePos = 0;
int64_t Minecraft::warezTime = 0;
File Minecraft::workDir = File(L"");
+extern ConsoleUIController ui;
+
#ifdef __PSVITA__
TOUCHSCREENRECT QuickSelectRect[3]=
@@ -119,33 +121,33 @@ ResourceLocation Minecraft::ALT_FONT_LOCATION = ResourceLocation(TN_ALT_FONT);
Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet *minecraftApplet, int width, int height, bool fullscreen)
{
// 4J - added this block of initialisers
- gameMode = NULL;
+ gameMode = nullptr;
hasCrashed = false;
timer = new Timer(SharedConstants::TICKS_PER_SECOND);
- oldLevel = NULL; //4J Stu added
- level = NULL;
+ oldLevel = nullptr; //4J Stu added
+ level = nullptr;
levels = MultiPlayerLevelArray(3); // 4J Added
- levelRenderer = NULL;
+ levelRenderer = nullptr;
player = nullptr;
cameraTargetPlayer = nullptr;
- particleEngine = NULL;
- user = NULL;
- parent = NULL;
+ particleEngine = nullptr;
+ user = nullptr;
+ parent = nullptr;
pause = false;
- textures = NULL;
- font = NULL;
- screen = NULL;
+ textures = nullptr;
+ font = nullptr;
+ screen = nullptr;
localPlayerIdx = 0;
rightClickDelay = 0;
// 4J Stu Added
InitializeCriticalSection( &ProgressRenderer::s_progress );
InitializeCriticalSection(&m_setLevelCS);
- //m_hPlayerRespawned = CreateEvent(NULL, FALSE, FALSE, NULL);
+ //m_hPlayerRespawned = CreateEvent(nullptr, FALSE, FALSE, nullptr);
- progressRenderer = NULL;
- gameRenderer = NULL;
- bgLoader = NULL;
+ progressRenderer = nullptr;
+ gameRenderer = nullptr;
+ bgLoader = nullptr;
ticks = 0;
// 4J-PB - moved into the local player
@@ -156,20 +158,20 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
orgWidth = orgHeight = 0;
achievementPopup = new AchievementPopup(this);
- gui = NULL;
+ gui = nullptr;
noRender = false;
humanoidModel = new HumanoidModel(0);
- hitResult = 0;
- options = NULL;
+ hitResult = nullptr;
+ options = nullptr;
soundEngine = new SoundEngine();
- mouseHandler = NULL;
- skins = NULL;
+ mouseHandler = nullptr;
+ skins = nullptr;
workingDirectory = File(L"");
- levelSource = NULL;
- stats[0] = NULL;
- stats[1] = NULL;
- stats[2] = NULL;
- stats[3] = NULL;
+ levelSource = nullptr;
+ stats[0] = nullptr;
+ stats[1] = nullptr;
+ stats[2] = nullptr;
+ stats[3] = nullptr;
connectToPort = 0;
workDir = File(L"");
// 4J removed
@@ -186,7 +188,7 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
orgHeight = height;
this->fullscreen = fullscreen;
- this->minecraftApplet = NULL;
+ this->minecraftApplet = nullptr;
this->parent = parent;
// 4J - Our actual physical frame buffer is always 1280x720 ie in a 16:9 ratio. If we want to do a 4:3 mode, we are telling the original minecraft code
@@ -213,12 +215,12 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
for(int i=0;i<XUSER_MAX_COUNT;i++)
{
- m_pendingLocalConnections[i] = NULL;
+ m_pendingLocalConnections[i] = nullptr;
m_connectionFailed[i] = false;
- localgameModes[i]=NULL;
+ localgameModes[i]=nullptr;
}
- animateTickLevel = NULL; // 4J added
+ animateTickLevel = nullptr; // 4J added
m_inFullTutorialBits = 0; // 4J Added
reloadTextures = false;
@@ -227,7 +229,7 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet
// 4J-PB - Removed it from here on Orbis due to it causing a crash with the network init.
// We should work out why...
#ifndef __ORBIS__
- this->soundEngine->init(NULL);
+ this->soundEngine->init(nullptr);
#endif
#ifndef DISABLE_LEVELTICK_THREAD
@@ -353,7 +355,7 @@ void Minecraft::init()
stats[i] = new StatsCounter();
/* 4J - TODO, 4J-JEV: Unnecessary.
- Achievements::openInventory->setDescFormatter(NULL);
+ Achievements::openInventory->setDescFormatter(nullptr);
Achievements.openInventory.setDescFormatter(new DescFormatter(){
public String format(String i18nValue) {
return String.format(i18nValue, Keyboard.getKeyName(options.keyBuild.key));
@@ -414,7 +416,7 @@ void Minecraft::init()
MemSect(0);
gui = new Gui(this);
- if (connectToIp != L"") // 4J - was NULL comparison
+ if (connectToIp != L"") // 4J - was nullptr comparison
{
// setScreen(new ConnectScreen(this, connectToIp, connectToPort)); // 4J TODO - put back in
}
@@ -484,10 +486,10 @@ void Minecraft::blit(int x, int y, int sx, int sy, int w, int h)
float vs = 1 / 256.0f;
Tesselator *t = Tesselator::getInstance();
t->begin();
- t->vertexUV((float)(x + 0), (float)( y + h), (float)( 0), (float)( (sx + 0) * us), (float)( (sy + h) * vs));
- t->vertexUV((float)(x + w), (float)( y + h), (float)( 0), (float)( (sx + w) * us), (float)( (sy + h) * vs));
- t->vertexUV((float)(x + w), (float)( y + 0), (float)( 0), (float)( (sx + w) * us), (float)( (sy + 0) * vs));
- t->vertexUV((float)(x + 0), (float)( y + 0), (float)( 0), (float)( (sx + 0) * us), (float)( (sy + 0) * vs));
+ t->vertexUV(static_cast<float>(x + 0), static_cast<float>(y + h), static_cast<float>(0), (float)( (sx + 0) * us), (float)( (sy + h) * vs));
+ t->vertexUV(static_cast<float>(x + w), static_cast<float>(y + h), static_cast<float>(0), (float)( (sx + w) * us), (float)( (sy + h) * vs));
+ t->vertexUV(static_cast<float>(x + w), static_cast<float>(y + 0), static_cast<float>(0), (float)( (sx + w) * us), (float)( (sy + 0) * vs));
+ t->vertexUV(static_cast<float>(x + 0), static_cast<float>(y + 0), static_cast<float>(0), (float)( (sx + 0) * us), (float)( (sy + 0) * vs));
t->end();
}
@@ -498,30 +500,30 @@ LevelStorageSource *Minecraft::getLevelSource()
void Minecraft::setScreen(Screen *screen)
{
- if (this->screen != NULL)
+ if (this->screen != nullptr)
{
this->screen->removed();
}
#ifdef _WINDOWS64
- if (screen != NULL && g_KBMInput.IsMouseGrabbed())
+ if (screen != nullptr && g_KBMInput.IsMouseGrabbed())
{
g_KBMInput.SetMouseGrabbed(false);
}
#endif
//4J Gordon: Do not force a stats save here
- /*if (dynamic_cast<TitleScreen *>(screen)!=NULL)
+ /*if (dynamic_cast<TitleScreen *>(screen)!=nullptr)
{
stats->forceSend();
}
stats->forceSave();*/
- if (screen == NULL && level == NULL)
+ if (screen == nullptr && level == nullptr)
{
screen = new TitleScreen();
}
- else if (player != NULL && !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0)
+ else if (player != nullptr && !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0)
{
//screen = new DeathScreen();
@@ -534,18 +536,18 @@ void Minecraft::setScreen(Screen *screen)
}
else
{
- ui.NavigateToScene(player->GetXboxPad(),eUIScene_DeathMenu,NULL);
+ ui.NavigateToScene(player->GetXboxPad(),eUIScene_DeathMenu,nullptr);
}
}
- if (dynamic_cast<TitleScreen *>(screen)!=NULL)
+ if (dynamic_cast<TitleScreen *>(screen)!=nullptr)
{
options->renderDebug = false;
gui->clearMessages();
}
this->screen = screen;
- if (screen != NULL)
+ if (screen != nullptr)
{
// releaseMouse(); // 4J - removed
ScreenSizeCalculator ssc(options, width, height);
@@ -561,7 +563,7 @@ void Minecraft::setScreen(Screen *screen)
// 4J-PB - if a screen has been set, go into menu mode
// it's possible that player doesn't exist here yet
- /*if(screen!=NULL)
+ /*if(screen!=nullptr)
{
if(player && player->GetXboxPad()!=-1)
{
@@ -598,7 +600,7 @@ void Minecraft::destroy()
stats->forceSave();*/
// try {
- setLevel(NULL);
+ setLevel(nullptr);
// } catch (Throwable e) {
// }
@@ -645,11 +647,11 @@ void Minecraft::run()
AABB::resetPool();
Vec3::resetPool();
- // if (parent == NULL && Display.isCloseRequested()) { // 4J - removed
+ // if (parent == nullptr && Display.isCloseRequested()) { // 4J - removed
// stop();
// }
- if (pause && level != NULL)
+ if (pause && level != nullptr)
{
float lastA = timer->a;
timer->advanceTime();
@@ -682,14 +684,14 @@ void Minecraft::run()
soundEngine->update(player, timer->a);
glEnable(GL_TEXTURE_2D);
- if (level != NULL) level->updateLights();
+ if (level != nullptr) level->updateLights();
// if (!Keyboard::isKeyDown(Keyboard.KEY_F7)) Display.update(); // 4J - removed
- if (player != NULL && player->isInWall()) options->thirdPersonView = false;
+ if (player != nullptr && player->isInWall()) options->thirdPersonView = false;
if (!noRender)
{
- if (gameMode != NULL) gameMode->render(timer->a);
+ if (gameMode != nullptr) gameMode->render(timer->a);
gameRenderer->render(timer->a);
}
@@ -723,7 +725,7 @@ void Minecraft::run()
// checkScreenshot(); // 4J - removed
/* 4J - removed
- if (parent != NULL && !fullscreen)
+ if (parent != nullptr && !fullscreen)
{
if (parent.getWidth() != width || parent.getHeight() != height)
{
@@ -738,7 +740,7 @@ void Minecraft::run()
*/
checkGlError(L"Post render");
frames++;
- pause = !isClientSide() && screen != NULL && screen->isPauseScreen();
+ pause = !isClientSide() && screen != nullptr && screen->isPauseScreen();
while (System::currentTimeMillis() >= lastTime + 1000)
{
@@ -792,7 +794,7 @@ bool Minecraft::setLocalPlayerIdx(int idx)
localPlayerIdx = idx;
// If the player is not null, but the game mode is then this is just a temp player
// whose only real purpose is to hold the viewport position
- if( localplayers[idx] == NULL || localgameModes[idx] == NULL ) return false;
+ if( localplayers[idx] == nullptr || localgameModes[idx] == nullptr ) return false;
gameMode = localgameModes[idx];
player = localplayers[idx];
@@ -816,7 +818,7 @@ void Minecraft::updatePlayerViewportAssignments()
int viewportsRequired = 0;
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
- if( localplayers[i] != NULL ) viewportsRequired++;
+ if( localplayers[i] != nullptr ) viewportsRequired++;
}
if( viewportsRequired == 3 ) viewportsRequired = 4;
@@ -826,7 +828,7 @@ void Minecraft::updatePlayerViewportAssignments()
// Single viewport
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
- if( localplayers[i] != NULL ) localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN;
+ if( localplayers[i] != nullptr ) localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN;
}
}
else if( viewportsRequired == 2 )
@@ -835,7 +837,7 @@ void Minecraft::updatePlayerViewportAssignments()
int found = 0;
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
- if( localplayers[i] != NULL )
+ if( localplayers[i] != nullptr )
{
// Primary player settings decide what the mode is
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_SplitScreenVertical))
@@ -858,7 +860,7 @@ void Minecraft::updatePlayerViewportAssignments()
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
- if( localplayers[i] != NULL )
+ if( localplayers[i] != nullptr )
{
// 4J Stu - If the game hasn't started, ignore current allocations (as the players won't have seen them)
@@ -882,7 +884,7 @@ void Minecraft::updatePlayerViewportAssignments()
// Found which quadrants are currently in use, now allocate out any spares that are required
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
- if( localplayers[i] != NULL )
+ if( localplayers[i] != nullptr )
{
if( ( localplayers[i]->m_iScreenSection < C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT ) ||
( localplayers[i]->m_iScreenSection > C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT ) )
@@ -918,22 +920,22 @@ void Minecraft::updatePlayerViewportAssignments()
bool Minecraft::addLocalPlayer(int idx)
{
//int iLocalPlayerC=app.GetLocalPlayerCount();
- if( m_pendingLocalConnections[idx] != NULL )
+ if( m_pendingLocalConnections[idx] != nullptr )
{
// 4J Stu - Should we ever be in a state where this happens?
assert(false);
m_pendingLocalConnections[idx]->close();
}
m_connectionFailed[idx] = false;
- m_pendingLocalConnections[idx] = NULL;
+ m_pendingLocalConnections[idx] = nullptr;
bool success=g_NetworkManager.AddLocalPlayerByUserIndex(idx);
if(success)
{
app.DebugPrintf("Adding temp local player on pad %d\n", idx);
- localplayers[idx] = shared_ptr<MultiplayerLocalPlayer>( new MultiplayerLocalPlayer(this, level, user, NULL ) );
- localgameModes[idx] = NULL;
+ localplayers[idx] = shared_ptr<MultiplayerLocalPlayer>(new MultiplayerLocalPlayer(this, level, user, nullptr));
+ localgameModes[idx] = nullptr;
updatePlayerViewportAssignments();
@@ -946,7 +948,7 @@ bool Minecraft::addLocalPlayer(int idx)
// send the message
for(int i=0;i<XUSER_MAX_COUNT;i++)
{
- //if((i!=idx) && (localplayers[i]!=NULL))
+ //if((i!=idx) && (localplayers[i]!=nullptr))
{
XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(i), &xuiMsg );
}
@@ -980,14 +982,14 @@ void Minecraft::addPendingLocalConnection(int idx, ClientConnection *connection)
m_pendingLocalConnections[idx] = connection;
}
-shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin)
+shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= nullptr*/,MultiPlayerLevel *levelpassedin)
{
- if( clientConnection == NULL) return nullptr;
+ if( clientConnection == nullptr) return nullptr;
if( clientConnection == m_pendingLocalConnections[idx] )
{
int tempScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN;
- if( localplayers[idx] != NULL && localgameModes[idx] == NULL )
+ if( localplayers[idx] != nullptr && localgameModes[idx] == nullptr )
{
// A temp player displaying a connecting screen
tempScreenSection = localplayers[idx]->m_iScreenSection;
@@ -996,7 +998,7 @@ shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(int idx, co
user->name = name;
// Don't need this any more
- m_pendingLocalConnections[idx] = NULL;
+ m_pendingLocalConnections[idx] = nullptr;
// Add the connection to the level which will now take responsibility for ticking it
// 4J-PB - can't use the dimension from localplayers[idx], since there may be no localplayers at this point
@@ -1043,7 +1045,7 @@ shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(int idx, co
// Compatibility rule for Win64 id migration
// host keeps legacy host XUID, non-host uses persistent uid.dat XUID.
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx);
- if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
+ if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost())
{
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
}
@@ -1060,11 +1062,11 @@ shared_ptr<MultiplayerLocalPlayer> Minecraft::createExtraLocalPlayer(int idx, co
localplayers[idx]->m_iScreenSection = tempScreenSection;
- if( levelpassedin == NULL) level->addEntity(localplayers[idx]); // Don't add if we're passing the level in, we only do this from the client connection & we'll be handling adding it ourselves
+ if( levelpassedin == nullptr) level->addEntity(localplayers[idx]); // Don't add if we're passing the level in, we only do this from the client connection & we'll be handling adding it ourselves
localplayers[idx]->SetXboxPad(iPad);
- if( localplayers[idx]->input != NULL ) delete localplayers[idx]->input;
+ if( localplayers[idx]->input != nullptr ) delete localplayers[idx]->input;
localplayers[idx]->input = new Input();
localplayers[idx]->resetPos();
@@ -1093,7 +1095,7 @@ void Minecraft::storeExtraLocalPlayer(int idx)
{
localplayers[idx] = player;
- if( localplayers[idx]->input != NULL ) delete localplayers[idx]->input;
+ if( localplayers[idx]->input != nullptr ) delete localplayers[idx]->input;
localplayers[idx]->input = new Input();
if(ProfileManager.IsSignedIn(idx))
@@ -1105,14 +1107,14 @@ void Minecraft::storeExtraLocalPlayer(int idx)
void Minecraft::removeLocalPlayerIdx(int idx)
{
bool updateXui = true;
- if(localgameModes[idx] != NULL)
+ if(localgameModes[idx] != nullptr)
{
if( getLevel( localplayers[idx]->dimension )->isClientSide )
{
shared_ptr<MultiplayerLocalPlayer> mplp = localplayers[idx];
( (MultiPlayerLevel *)getLevel( localplayers[idx]->dimension ) )->removeClientConnection(mplp->connection, true);
delete mplp->connection;
- mplp->connection = NULL;
+ mplp->connection = nullptr;
g_NetworkManager.RemoveLocalPlayerByUserIndex(idx);
}
getLevel( localplayers[idx]->dimension )->removeEntity(localplayers[idx]);
@@ -1127,13 +1129,13 @@ void Minecraft::removeLocalPlayerIdx(int idx)
playerLeftTutorial( idx );
delete localgameModes[idx];
- localgameModes[idx] = NULL;
+ localgameModes[idx] = nullptr;
}
- else if( m_pendingLocalConnections[idx] != NULL )
+ else if( m_pendingLocalConnections[idx] != nullptr )
{
- m_pendingLocalConnections[idx]->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );;
+ m_pendingLocalConnections[idx]->sendAndDisconnect(std::make_shared<DisconnectPacket>(DisconnectPacket::eDisconnect_Quitting));;
delete m_pendingLocalConnections[idx];
- m_pendingLocalConnections[idx] = NULL;
+ m_pendingLocalConnections[idx] = nullptr;
g_NetworkManager.RemoveLocalPlayerByUserIndex(idx);
}
else
@@ -1158,18 +1160,18 @@ void Minecraft::removeLocalPlayerIdx(int idx)
/*
// If we are removing the primary player then there can't be a valid gamemode left anymore, this
// pointer will be referring to the one we've just deleted
- gameMode = NULL;
+ gameMode = nullptr;
// Remove references to player
- player = NULL;
- cameraTargetPlayer = NULL;
- EntityRenderDispatcher::instance->cameraEntity = NULL;
- TileEntityRenderDispatcher::instance->cameraEntity = NULL;
+ player = nullptr;
+ cameraTargetPlayer = nullptr;
+ EntityRenderDispatcher::instance->cameraEntity = nullptr;
+ TileEntityRenderDispatcher::instance->cameraEntity = nullptr;
*/
}
else if( updateXui )
{
gameRenderer->DisableUpdateThread();
- levelRenderer->setLevel(idx, NULL);
+ levelRenderer->setLevel(idx, nullptr);
gameRenderer->EnableUpdateThread();
ui.CloseUIScenes(idx,true);
updatePlayerViewportAssignments();
@@ -1197,22 +1199,22 @@ void Minecraft::applyFrameMouseLook()
// Per-frame mouse look: consume mouse deltas every frame instead of waiting
// for the 20Hz game tick. Apply the same delta to both xRot/yRot AND xRotO/yRotO
// so the render interpolation instantly reflects the change without waiting for a tick.
- if (level == NULL) return;
+ if (level == nullptr) return;
for (int i = 0; i < XUSER_MAX_COUNT; i++)
{
- if (localplayers[i] == NULL) continue;
+ if (localplayers[i] == nullptr) continue;
int iPad = localplayers[i]->GetXboxPad();
if (iPad != 0) continue; // Mouse only applies to pad 0
if (!g_KBMInput.IsMouseGrabbed()) continue;
- if (localgameModes[iPad] == NULL) continue;
+ if (localgameModes[iPad] == nullptr) continue;
float rawDx, rawDy;
g_KBMInput.ConsumeMouseDelta(rawDx, rawDy);
if (rawDx == 0.0f && rawDy == 0.0f) continue;
- float mouseSensitivity = ((float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f;
+ float mouseSensitivity = static_cast<float>(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f;
float mdx = rawDx * mouseSensitivity;
float mdy = -rawDy * mouseSensitivity;
if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook))
@@ -1265,12 +1267,12 @@ void Minecraft::run_middle()
AABB::resetPool();
Vec3::resetPool();
- // if (parent == NULL && Display.isCloseRequested()) { // 4J - removed
+ // if (parent == nullptr && Display.isCloseRequested()) { // 4J - removed
// stop();
// }
// 4J-PB - AUTOSAVE TIMER - only in the full game and if the player is the host
- if(level!=NULL && ProfileManager.IsFullVersion() && g_NetworkManager.IsHost())
+ if(level!=nullptr && ProfileManager.IsFullVersion() && g_NetworkManager.IsHost())
{
/*if(!bAutosaveTimerSet)
{
@@ -1293,7 +1295,7 @@ void Minecraft::run_middle()
if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin())
{
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tPack);
DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();
@@ -1390,7 +1392,7 @@ void Minecraft::run_middle()
}
// When we go into the first loaded level, check if the console has active joypads that are not in the game, and bring up the quadrant display to remind them to press start (if the session has space)
- if(level!=NULL && bFirstTimeIntoGame && g_NetworkManager.SessionHasSpace())
+ if(level!=nullptr && bFirstTimeIntoGame && g_NetworkManager.SessionHasSpace())
{
// have a short delay before the display
if(iFirstTimeCountdown==0)
@@ -1401,7 +1403,7 @@ void Minecraft::run_middle()
{
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
- if((localplayers[i] == NULL) && InputManager.IsPadConnected(i))
+ if((localplayers[i] == nullptr) && InputManager.IsPadConnected(i))
{
if(!ui.PressStartPlaying(i))
{
@@ -1418,10 +1420,10 @@ void Minecraft::run_middle()
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
#ifdef __ORBIS__
- if ( m_pPsPlusUpsell != NULL && m_pPsPlusUpsell->hasResponse() && m_pPsPlusUpsell->m_userIndex == i )
+ if ( m_pPsPlusUpsell != nullptr && m_pPsPlusUpsell->hasResponse() && m_pPsPlusUpsell->m_userIndex == i )
{
delete m_pPsPlusUpsell;
- m_pPsPlusUpsell = NULL;
+ m_pPsPlusUpsell = nullptr;
if ( ProfileManager.HasPlayStationPlus(i) )
{
@@ -1622,7 +1624,7 @@ void Minecraft::run_middle()
// 4J Stu - Check that content restriction information has been received
if( !g_NetworkManager.IsLocalGame() )
{
- tryJoin = tryJoin && ProfileManager.GetChatAndContentRestrictions(i,true,NULL,NULL,NULL);
+ tryJoin = tryJoin && ProfileManager.GetChatAndContentRestrictions(i,true,nullptr,nullptr,nullptr);
}
#endif
if(tryJoin)
@@ -1662,7 +1664,7 @@ void Minecraft::run_middle()
{
#ifdef __ORBIS__
bool contentRestricted = false;
- ProfileManager.GetChatAndContentRestrictions(i,false,NULL,&contentRestricted,NULL); // TODO!
+ ProfileManager.GetChatAndContentRestrictions(i,false,nullptr,&contentRestricted,nullptr); // TODO!
if (!g_NetworkManager.IsLocalGame() && contentRestricted)
{
@@ -1690,7 +1692,7 @@ void Minecraft::run_middle()
if(g_NetworkManager.IsLocalGame() == false)
{
bool chatRestricted = false;
- ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,NULL,NULL);
+ ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,nullptr,nullptr);
if(chatRestricted)
{
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, i );
@@ -1703,7 +1705,7 @@ void Minecraft::run_middle()
{
// create the localplayer
shared_ptr<Player> player = localplayers[i];
- if( player == NULL)
+ if( player == nullptr)
{
player = createExtraLocalPlayer(i, (convStringToWstring( ProfileManager.GetGamertag(i) )).c_str(), i, level->dimension->id);
}
@@ -1777,7 +1779,7 @@ void Minecraft::run_middle()
int firstEmptyUser = 0;
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
{
- if(localplayers[i] == NULL)
+ if(localplayers[i] == nullptr)
{
firstEmptyUser = i;
break;
@@ -1811,7 +1813,7 @@ void Minecraft::run_middle()
}
#endif
- if (pause && level != NULL)
+ if (pause && level != nullptr)
{
float lastA = timer->a;
timer->advanceTime();
@@ -1840,13 +1842,13 @@ void Minecraft::run_middle()
{
// 4J - If we are waiting for this connection to do something, then tick it here.
// This replaces many of the original Java scenes which would tick the connection while showing that scene
- if( m_pendingLocalConnections[idx] != NULL )
+ if( m_pendingLocalConnections[idx] != nullptr )
{
m_pendingLocalConnections[idx]->tick();
}
// reset the player inactive tick
- if(localplayers[idx]!=NULL)
+ if(localplayers[idx]!=nullptr)
{
// any input received?
if((localplayers[idx]->ullButtonsPressed!=0) || InputManager.GetJoypadStick_LX(idx,false)!=0.0f ||
@@ -1930,8 +1932,8 @@ void Minecraft::run_middle()
// if (!Keyboard::isKeyDown(Keyboard.KEY_F7)) Display.update(); // 4J - removed
// 4J-PB - changing this to be per player
- //if (player != NULL && player->isInWall()) options->thirdPersonView = false;
- if (player != NULL && player->isInWall()) player->SetThirdPersonView(0);
+ //if (player != nullptr && player->isInWall()) options->thirdPersonView = false;
+ if (player != nullptr && player->isInWall()) player->SetThirdPersonView(0);
if (!noRender)
{
@@ -1942,7 +1944,7 @@ void Minecraft::run_middle()
if( setLocalPlayerIdx(i) )
{
PIXBeginNamedEvent(0,"Game render player idx %d",i);
- RenderManager.StateSetViewport((C4JRender::eViewportType)player->m_iScreenSection);
+ RenderManager.StateSetViewport(static_cast<C4JRender::eViewportType>(player->m_iScreenSection));
gameRenderer->render(timer->a, bFirst);
bFirst = false;
PIXEndNamedEvent();
@@ -1970,7 +1972,7 @@ void Minecraft::run_middle()
if( unoccupiedQuadrant > -1 )
{
// render a logo
- RenderManager.StateSetViewport((C4JRender::eViewportType)(C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + unoccupiedQuadrant));
+ RenderManager.StateSetViewport(static_cast<C4JRender::eViewportType>(C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT + unoccupiedQuadrant));
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -2041,7 +2043,7 @@ void Minecraft::run_middle()
// checkScreenshot(); // 4J - removed
/* 4J - removed
- if (parent != NULL && !fullscreen)
+ if (parent != nullptr && !fullscreen)
{
if (parent.getWidth() != width || parent.getHeight() != height)
{
@@ -2058,7 +2060,7 @@ void Minecraft::run_middle()
checkGlError(L"Post render");
MemSect(0);
frames++;
- //pause = !isClientSide() && screen != NULL && screen->isPauseScreen();
+ //pause = !isClientSide() && screen != nullptr && screen->isPauseScreen();
//pause = g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 && app.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad());
pause = app.IsAppPaused();
@@ -2110,7 +2112,7 @@ void Minecraft::emergencySave()
levelRenderer->clear();
AABB::clearPool();
Vec3::clearPool();
- setLevel(NULL);
+ setLevel(nullptr);
}
void Minecraft::renderFpsMeter(int64_t tickTime)
@@ -2129,7 +2131,7 @@ void Minecraft::renderFpsMeter(int64_t tickTime)
glMatrixMode(GL_PROJECTION);
glEnable(GL_COLOR_MATERIAL);
glLoadIdentity();
- glOrtho(0, (float)width, (float)height, 0, 1000, 3000);
+ glOrtho(0, static_cast<float>(width), static_cast<float>(height), 0, 1000, 3000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -2000);
@@ -2140,16 +2142,16 @@ void Minecraft::renderFpsMeter(int64_t tickTime)
t->begin(GL_QUADS);
int hh1 = (int) (nsPer60Fps / 200000);
t->color(0x20000000);
- t->vertex((float)(0), (float)( height - hh1), (float)( 0));
- t->vertex((float)(0), (float)( height), (float)( 0));
- t->vertex((float)(Minecraft::frameTimes_length), (float)( height), (float)( 0));
- t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1), (float)( 0));
+ t->vertex(static_cast<float>(0), static_cast<float>(height - hh1), static_cast<float>(0));
+ t->vertex(static_cast<float>(0), static_cast<float>(height), static_cast<float>(0));
+ t->vertex(static_cast<float>(Minecraft::frameTimes_length), static_cast<float>(height), static_cast<float>(0));
+ t->vertex(static_cast<float>(Minecraft::frameTimes_length), static_cast<float>(height - hh1), static_cast<float>(0));
t->color(0x20200000);
- t->vertex((float)(0), (float)( height - hh1 * 2), (float)( 0));
- t->vertex((float)(0), (float)( height - hh1), (float)( 0));
- t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1), (float)( 0));
- t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh1 * 2), (float)( 0));
+ t->vertex(static_cast<float>(0), static_cast<float>(height - hh1 * 2), static_cast<float>(0));
+ t->vertex(static_cast<float>(0), static_cast<float>(height - hh1), static_cast<float>(0));
+ t->vertex(static_cast<float>(Minecraft::frameTimes_length), static_cast<float>(height - hh1), static_cast<float>(0));
+ t->vertex(static_cast<float>(Minecraft::frameTimes_length), static_cast<float>(height - hh1 * 2), static_cast<float>(0));
t->end();
int64_t totalTime = 0;
@@ -2157,13 +2159,13 @@ void Minecraft::renderFpsMeter(int64_t tickTime)
{
totalTime += Minecraft::frameTimes[i];
}
- int hh = (int) (totalTime / 200000 / Minecraft::frameTimes_length);
+ int hh = static_cast<int>(totalTime / 200000 / Minecraft::frameTimes_length);
t->begin(GL_QUADS);
t->color(0x20400000);
- t->vertex((float)(0), (float)( height - hh), (float)( 0));
- t->vertex((float)(0), (float)( height), (float)( 0));
- t->vertex((float)(Minecraft::frameTimes_length), (float)( height), (float)( 0));
- t->vertex((float)(Minecraft::frameTimes_length), (float)( height - hh), (float)( 0));
+ t->vertex(static_cast<float>(0), static_cast<float>(height - hh), static_cast<float>(0));
+ t->vertex(static_cast<float>(0), static_cast<float>(height), static_cast<float>(0));
+ t->vertex(static_cast<float>(Minecraft::frameTimes_length), static_cast<float>(height), static_cast<float>(0));
+ t->vertex(static_cast<float>(Minecraft::frameTimes_length), static_cast<float>(height - hh), static_cast<float>(0));
t->end();
t->begin(GL_LINES);
for (int i = 0; i < Minecraft::frameTimes_length; i++)
@@ -2185,16 +2187,16 @@ void Minecraft::renderFpsMeter(int64_t tickTime)
int64_t time = Minecraft::frameTimes[i] / 200000;
int64_t time2 = Minecraft::tickTimes[i] / 200000;
- t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), (float)( 0));
- t->vertex((float)(i + 0.5f), (float)( height + 0.5f), (float)( 0));
+ t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), static_cast<float>(0));
+ t->vertex((float)(i + 0.5f), (float)( height + 0.5f), static_cast<float>(0));
// if (Minecraft.frameTimes[i]>nsPer60Fps) {
t->color(0xff000000 + cc * 65536 + cc * 256 + cc * 1);
// } else {
// t.color(0xff808080 + cc/2 * 256);
// }
- t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), (float)( 0));
- t->vertex((float)(i + 0.5f), (float)( height - (time - time2) + 0.5f), (float)( 0));
+ t->vertex((float)(i + 0.5f), (float)( height - time + 0.5f), static_cast<float>(0));
+ t->vertex((float)(i + 0.5f), (float)( height - (time - time2) + 0.5f), static_cast<float>(0));
}
t->end();
@@ -2209,7 +2211,7 @@ void Minecraft::stop()
void Minecraft::pauseGame()
{
- if (screen != NULL) return;
+ if (screen != nullptr) return;
// setScreen(new PauseScreen()); // 4J - TODO put back in
}
@@ -2221,7 +2223,7 @@ void Minecraft::resize(int width, int height)
this->width = width;
this->height = height;
- if (screen != NULL)
+ if (screen != nullptr)
{
ScreenSizeCalculator ssc(options, width, height);
int screenWidth = ssc.getWidth();
@@ -2255,7 +2257,7 @@ void Minecraft::verify()
void Minecraft::levelTickUpdateFunc(void* pParam)
{
- Level* pLevel = (Level*)pParam;
+ Level* pLevel = static_cast<Level *>(pParam);
pLevel->tick();
}
@@ -2288,10 +2290,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
gameRenderer->pick(1);
#if 0
// 4J - removed - we don't use ChunkCache anymore
- if (player != NULL)
+ if (player != nullptr)
{
ChunkSource *cs = level->getChunkSource();
- if (dynamic_cast<ChunkCache *>(cs) != NULL)
+ if (dynamic_cast<ChunkCache *>(cs) != nullptr)
{
ChunkCache *spcc = (ChunkCache *)cs;
@@ -2305,7 +2307,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// soundEngine.playMusicTick();
- if (!pause && level != NULL) gameMode->tick();
+ if (!pause && level != nullptr) gameMode->tick();
MemSect(31);
glBindTexture(GL_TEXTURE_2D, textures->loadTexture(TN_TERRAIN)); //L"/terrain.png"));
MemSect(0);
@@ -2323,33 +2325,33 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
* progressRenderer.progressStagePercentage(0); } else {
* serverConnection.tick(); serverConnection.sendPosition(player); } }
*/
- if (screen == NULL && player != NULL )
+ if (screen == nullptr && player != nullptr )
{
if (player->getHealth() <= 0 && !ui.GetMenuDisplayed(iPad) )
{
- setScreen(NULL);
+ setScreen(nullptr);
}
- else if (player->isSleeping() && level != NULL && level->isClientSide)
+ else if (player->isSleeping() && level != nullptr && level->isClientSide)
{
// setScreen(new InBedChatScreen()); // 4J - TODO put back in
}
}
- else if (screen != NULL && (dynamic_cast<InBedChatScreen *>(screen)!=NULL) && !player->isSleeping())
+ else if (screen != nullptr && (dynamic_cast<InBedChatScreen *>(screen)!=nullptr) && !player->isSleeping())
{
- setScreen(NULL);
+ setScreen(nullptr);
}
- if (screen != NULL)
+ if (screen != nullptr)
{
player->missTime = 10000;
player->lastClickTick[0] = ticks + 10000;
player->lastClickTick[1] = ticks + 10000;
}
- if (screen != NULL)
+ if (screen != nullptr)
{
screen->updateEvents();
- if (screen != NULL)
+ if (screen != nullptr)
{
screen->particles->tick();
screen->tick();
@@ -2357,13 +2359,13 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
#ifdef _WINDOWS64
- if ((screen != NULL || ui.GetMenuDisplayed(iPad)) && g_KBMInput.IsMouseGrabbed())
+ if ((screen != nullptr || ui.GetMenuDisplayed(iPad)) && g_KBMInput.IsMouseGrabbed())
{
g_KBMInput.SetMouseGrabbed(false);
}
#endif
- if (screen == NULL && !ui.GetMenuDisplayed(iPad) )
+ if (screen == nullptr && !ui.GetMenuDisplayed(iPad) )
{
#ifdef _WINDOWS64
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsWindowFocused())
@@ -2475,7 +2477,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
*piAlt=-1;
// 4J-PB another special case for when the player is sleeping in a bed
- if (player->isSleeping() && (level != NULL) && level->isClientSide)
+ if (player->isSleeping() && (level != nullptr) && level->isClientSide)
{
*piUse=IDS_TOOLTIPS_WAKEUP;
}
@@ -2531,8 +2533,8 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
case Item::spiderEye_Id:
// Check that we are actually hungry so will eat this item
{
- FoodItem *food = (FoodItem *)itemInstance->getItem();
- if (food != NULL && food->canEat(player))
+ FoodItem *food = static_cast<FoodItem *>(itemInstance->getItem());
+ if (food != nullptr && food->canEat(player))
{
*piUse=IDS_TOOLTIPS_EAT;
}
@@ -2610,7 +2612,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
}
- if (hitResult!=NULL)
+ if (hitResult!=nullptr)
{
switch(hitResult->type)
{
@@ -2625,7 +2627,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
int iTileID=level->getTile(x,y ,z );
int iData = level->getData(x, y, z);
- if( gameMode != NULL && gameMode->getTutorial() != NULL )
+ if( gameMode != nullptr && gameMode->getTutorial() != nullptr )
{
// 4J Stu - For the tutorial we want to be able to record what items we look at so that we can give hints
gameMode->getTutorial()->onLookAt(iTileID,iData);
@@ -2639,7 +2641,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
* for noteblocks, enderportals and flowerpots in case of non-standard items.
* (ie. ignite behaviour)
*/
- if (bUseItemOn && itemInstance!=NULL)
+ if (bUseItemOn && itemInstance!=nullptr)
{
switch (itemInstance->getItem()->id)
{
@@ -2734,7 +2736,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
case Tile::chest_Id:
*piAction = IDS_TOOLTIPS_MINE;
- *piUse = (Tile::chest->getContainer(level,x,y,z) != NULL) ? IDS_TOOLTIPS_OPEN : -1;
+ *piUse = (Tile::chest->getContainer(level,x,y,z) != nullptr) ? IDS_TOOLTIPS_OPEN : -1;
break;
case Tile::enderChest_Id:
@@ -2803,7 +2805,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
break;
case Tile::jukebox_Id:
- if (!bUseItemOn && itemInstance!=NULL)
+ if (!bUseItemOn && itemInstance!=nullptr)
{
int iID=itemInstance->getItem()->id;
if ( (iID>=Item::record_01_Id) && (iID<=Item::record_12_Id) )
@@ -2823,7 +2825,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
break;
case Tile::flowerPot_Id:
- if ( !bUseItemOn && (itemInstance != NULL) && (iData == 0) )
+ if ( !bUseItemOn && (itemInstance != nullptr) && (iData == 0) )
{
int iID = itemInstance->getItem()->id;
if (iID<256) // is it a tile?
@@ -2884,7 +2886,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
case HitResult::ENTITY:
eINSTANCEOF entityType = hitResult->entity->GetType();
- if ( (gameMode != NULL) && (gameMode->getTutorial() != NULL) )
+ if ( (gameMode != nullptr) && (gameMode->getTutorial() != nullptr) )
{
// 4J Stu - For the tutorial we want to be able to record what items we look at so that we can give hints
gameMode->getTutorial()->onLookAtEntity(hitResult->entity);
@@ -2895,7 +2897,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
{
heldItem = player->inventory->getSelected();
}
- int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1;
+ int heldItemId = heldItem != nullptr ? heldItem->getItem()->id : -1;
switch(entityType)
{
@@ -3330,7 +3332,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
shared_ptr<ItemFrame> itemFrame = dynamic_pointer_cast<ItemFrame>(hitResult->entity);
// is the frame occupied?
- if(itemFrame->getItem()!=NULL)
+ if(itemFrame->getItem()!=nullptr)
{
// rotate the item
*piUse=IDS_TOOLTIPS_ROTATE;
@@ -3361,7 +3363,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
case eTYPE_ZOMBIE:
{
shared_ptr<Zombie> zomb = dynamic_pointer_cast<Zombie>(hitResult->entity);
- static GoldenAppleItem *goldapple = (GoldenAppleItem *) Item::apple_gold;
+ static GoldenAppleItem *goldapple = static_cast<GoldenAppleItem *>(Item::apple_gold);
//zomb->hasEffect(MobEffect::weakness) - not present on client.
if ( zomb->isVillager() && zomb->isWeakened() && (heldItemId == Item::apple_gold_Id) && !goldapple->isFoil(heldItem) )
@@ -3533,7 +3535,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
{
player->inventory->swapPaint(wheel);
- if( gameMode != NULL && gameMode->getTutorial() != NULL )
+ if( gameMode != nullptr && gameMode->getTutorial() != nullptr )
{
// 4J Stu - For the tutorial we want to be able to record what items we are using so that we can give hints
gameMode->getTutorial()->onSelectedItemChanged(player->inventory->getSelected());
@@ -3683,7 +3685,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
app.EnableDebugOverlay(options->renderDebug,iPad);
#else
// 4J Stu - The xbox uses a completely different way of navigating to this scene
- ui.NavigateToScene(0, eUIScene_DebugOverlay, NULL, eUILayer_Debug);
+ ui.NavigateToScene(0, eUIScene_DebugOverlay, nullptr, eUILayer_Debug);
#endif
#endif
}
@@ -3747,7 +3749,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
app.LoadCreativeMenu(iPad,player);
}
// 4J-PB - Microsoft request that we use the 3x3 crafting if someone presses X while at the workbench
- else if ((hitResult!=NULL) && (hitResult->type == HitResult::TILE) && (level->getTile(hitResult->x, hitResult->y, hitResult->z) == Tile::workBench_Id))
+ else if ((hitResult!=nullptr) && (hitResult->type == HitResult::TILE) && (level->getTile(hitResult->x, hitResult->y, hitResult->z) == Tile::workBench_Id))
{
//ui.PlayUISFX(eSFX_Press);
//app.LoadXuiCrafting3x3Menu(iPad,player,hitResult->x, hitResult->y, hitResult->z);
@@ -3769,7 +3771,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
{
app.DebugPrintf("PAUSE PRESS PROCESSING - ipad = %d, NavigateToScene\n",player->GetXboxPad());
ui.PlayUISFX(eSFX_Press);
- ui.NavigateToScene(iPad, eUIScene_PauseMenu, NULL, eUILayer_Scene);
+ ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, eUILayer_Scene);
}
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) && gameMode->isInputAllowed(MINECRAFT_ACTION_DROP))
@@ -3804,12 +3806,12 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item
int iCount=0;
- if(selectedItem != NULL) iCount=selectedItem->GetCount();
- if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) && selectedItem->GetCount() == 1))
+ if(selectedItem != nullptr) iCount=selectedItem->GetCount();
+ if(selectedItem != nullptr && !( (player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) && selectedItem->GetCount() == 1))
{
itemName = selectedItem->getHoverName();
}
- if( !(player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) || (selectedItem != NULL && selectedItem->GetCount() <= 1) ) ui.SetSelectedItem( iPad, itemName );
+ if( !(player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) || (selectedItem != nullptr && selectedItem->GetCount() <= 1) ) ui.SetSelectedItem( iPad, itemName );
}
}
else
@@ -3817,7 +3819,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// 4J-PB
if (InputManager.GetValue(iPad, ACTION_MENU_CANCEL) > 0 && gameMode->isInputAllowed(ACTION_MENU_CANCEL))
{
- setScreen(NULL);
+ setScreen(nullptr);
}
}
@@ -3841,7 +3843,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
#if 0
// 4J - TODO - some replacement for input handling...
- if (screen == NULL || screen.passEvents)
+ if (screen == nullptr || screen.passEvents)
{
while (Mouse.next())
{
@@ -3984,9 +3986,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
#endif
- if (level != NULL)
+ if (level != nullptr)
{
- if (player != NULL)
+ if (player != nullptr)
{
recheckPlayerIn++;
if (recheckPlayerIn == 30)
@@ -4032,7 +4034,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// 4J - this doesn't fully tick the animateTick here, but does register this player's position. The actual
// work is now done in Level::animateTickDoWork() so we can take into account multiple players in the one level.
- if (!pause && levels[i] != NULL) levels[i]->animateTick(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
+ if (!pause && levels[i] != nullptr) levels[i]->animateTick(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
if( levelsTickedFlags & ( 1 << i ) ) continue; // Don't tick further if we've already ticked this level this frame
levelsTickedFlags |= (1 << i);
@@ -4045,7 +4047,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// level.addEntity(player);
// }
// }
- if( levels[i] != NULL )
+ if( levels[i] != nullptr )
{
if (!pause)
{
@@ -4061,7 +4063,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
int currPlayerIdx = getLocalPlayerIdx();
for( int idx = 0; idx < XUSER_MAX_COUNT; idx++ )
{
- if(localplayers[idx]!=NULL)
+ if(localplayers[idx]!=nullptr)
{
if( localplayers[idx]->level == levels[i] )
{
@@ -4139,7 +4141,7 @@ void Minecraft::reloadSound()
bool Minecraft::isClientSide()
{
- return level != NULL && level->isClientSide;
+ return level != nullptr && level->isClientSide;
}
void Minecraft::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, const wstring& levelName, LevelSettings *levelSettings)
@@ -4158,8 +4160,8 @@ bool Minecraft::loadSlot(const wstring& userName, int slot)
void Minecraft::releaseLevel(int message)
{
- //this->level = NULL;
- setLevel(NULL, message);
+ //this->level = nullptr;
+ setLevel(nullptr, message);
}
// 4J Stu - This code was within setLevel, but I moved it out so that I can call it at a better
@@ -4190,14 +4192,14 @@ MultiPlayerLevel *Minecraft::getLevel(int dimension)
// 4J Stu - Removed as redundant with default values in params.
//void Minecraft::setLevel(Level *level, bool doForceStatsSave /*= true*/)
//{
-// setLevel(level, -1, NULL, doForceStatsSave);
+// setLevel(level, -1, nullptr, doForceStatsSave);
//}
// Also causing ambiguous call for some reason
// as it is matching shared_ptr<Player> from the func below with bool from this one
//void Minecraft::setLevel(Level *level, const wstring& message, bool doForceStatsSave /*= true*/)
//{
-// setLevel(level, message, NULL, doForceStatsSave);
+// setLevel(level, message, nullptr, doForceStatsSave);
//}
void Minecraft::forceaddLevel(MultiPlayerLevel *level)
@@ -4208,13 +4210,13 @@ void Minecraft::forceaddLevel(MultiPlayerLevel *level)
else levels[0] = level;
}
-void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_ptr<Player> forceInsertPlayer /*=NULL*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/)
+void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_ptr<Player> forceInsertPlayer /*=nullptr*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/)
{
EnterCriticalSection(&m_setLevelCS);
bool playerAdded = false;
this->cameraTargetPlayer = nullptr;
- if(progressRenderer != NULL)
+ if(progressRenderer != nullptr)
{
this->progressRenderer->progressStart(message);
this->progressRenderer->progressStage(-1);
@@ -4223,80 +4225,80 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
// 4J-PB - since we now play music in the menu, just let it keep playing
//soundEngine->playStreaming(L"", 0, 0, 0, 0, 0);
- // 4J - stop update thread from processing this level, which blocks until it is safe to move on - will be re-enabled if we set the level to be non-NULL
+ // 4J - stop update thread from processing this level, which blocks until it is safe to move on - will be re-enabled if we set the level to be non-nullptr
gameRenderer->DisableUpdateThread();
for(unsigned int i = 0; i < levels.length; ++i)
{
- // 4J We only need to save out in multiplayer is we are setting the level to NULL
+ // 4J We only need to save out in multiplayer is we are setting the level to nullptr
// If we ever go back to making single player only then this will not work properly!
- if (levels[i] != NULL && level == NULL)
+ if (levels[i] != nullptr && level == nullptr)
{
// 4J Stu - This is really only relevant for single player (ie not what we do at the moment)
- if((doForceStatsSave==true) && player!=NULL)
+ if((doForceStatsSave==true) && player!=nullptr)
forceStatsSave(player->GetXboxPad() );
- // 4J Stu - Added these for the case when we exit a level so we are setting the level to NULL
- // The level renderer needs to have it's stored level set to NULL so that it doesn't break next time we set one
- if (levelRenderer != NULL)
+ // 4J Stu - Added these for the case when we exit a level so we are setting the level to nullptr
+ // The level renderer needs to have it's stored level set to nullptr so that it doesn't break next time we set one
+ if (levelRenderer != nullptr)
{
for(DWORD p = 0; p < XUSER_MAX_COUNT; ++p)
{
- levelRenderer->setLevel(p, NULL);
+ levelRenderer->setLevel(p, nullptr);
}
}
- if (particleEngine != NULL) particleEngine->setLevel(NULL);
+ if (particleEngine != nullptr) particleEngine->setLevel(nullptr);
}
}
- // 4J If we are setting the level to NULL then we are exiting, so delete the levels
- if( level == NULL )
+ // 4J If we are setting the level to nullptr then we are exiting, so delete the levels
+ if( level == nullptr )
{
- if(levels[0]!=NULL)
+ if(levels[0]!=nullptr)
{
delete levels[0];
- levels[0] = NULL;
+ levels[0] = nullptr;
// Both level share the same savedDataStorage
- if(levels[1]!=NULL) levels[1]->savedDataStorage = NULL;
+ if(levels[1]!=nullptr) levels[1]->savedDataStorage = nullptr;
}
- if(levels[1]!=NULL)
+ if(levels[1]!=nullptr)
{
delete levels[1];
- levels[1] = NULL;
+ levels[1] = nullptr;
}
- if(levels[2]!=NULL)
+ if(levels[2]!=nullptr)
{
delete levels[2];
- levels[2] = NULL;
+ levels[2] = nullptr;
}
// Delete all the player objects
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
shared_ptr<MultiplayerLocalPlayer> mplp = localplayers[idx];
- if(mplp != NULL && mplp->connection != NULL )
+ if(mplp != nullptr && mplp->connection != nullptr )
{
delete mplp->connection;
- mplp->connection = NULL;
+ mplp->connection = nullptr;
}
- if( localgameModes[idx] != NULL )
+ if( localgameModes[idx] != nullptr )
{
delete localgameModes[idx];
- localgameModes[idx] = NULL;
+ localgameModes[idx] = nullptr;
}
- if( m_pendingLocalConnections[idx] != NULL )
+ if( m_pendingLocalConnections[idx] != nullptr )
{
delete m_pendingLocalConnections[idx];
- m_pendingLocalConnections[idx] = NULL;
+ m_pendingLocalConnections[idx] = nullptr;
}
localplayers[idx] = nullptr;
}
// If we are removing the primary player then there can't be a valid gamemode left anymore, this
// pointer will be referring to the one we've just deleted
- gameMode = NULL;
+ gameMode = nullptr;
// Remove references to player
player = nullptr;
cameraTargetPlayer = nullptr;
@@ -4305,7 +4307,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
}
this->level = level;
- if (level != NULL)
+ if (level != nullptr)
{
int dimId = level->dimension->id;
if (dimId == -1) levels[1] = level;
@@ -4314,7 +4316,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
// If no player has been set, then this is the first level to be set this game, so set up
// a primary player & initialise some other things
- if (player == NULL)
+ if (player == nullptr)
{
int iPrimaryPlayer = ProfileManager.GetPrimaryPad();
@@ -4335,7 +4337,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
// On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`.
// To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID.
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPrimaryPlayer);
- if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
+ if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost())
{
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
}
@@ -4358,32 +4360,32 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
for(int i=0;i<XUSER_MAX_COUNT;i++)
{
- m_pendingLocalConnections[i] = NULL;
- if( i != iPrimaryPlayer ) localgameModes[i] = NULL;
+ m_pendingLocalConnections[i] = nullptr;
+ if( i != iPrimaryPlayer ) localgameModes[i] = nullptr;
}
}
- if (player != NULL)
+ if (player != nullptr)
{
player->resetPos();
// gameMode.initPlayer(player);
- if (level != NULL)
+ if (level != nullptr)
{
level->addEntity(player);
playerAdded = true;
}
}
- if(player->input != NULL) delete player->input;
+ if(player->input != nullptr) delete player->input;
player->input = new Input();
- if (levelRenderer != NULL) levelRenderer->setLevel(player->GetXboxPad(), level);
- if (particleEngine != NULL) particleEngine->setLevel(level);
+ if (levelRenderer != nullptr) levelRenderer->setLevel(player->GetXboxPad(), level);
+ if (particleEngine != nullptr) particleEngine->setLevel(level);
#if 0
// 4J - removed - we don't use ChunkCache anymore
ChunkSource *cs = level->getChunkSource();
- if (dynamic_cast<ChunkCache *>(cs) != NULL)
+ if (dynamic_cast<ChunkCache *>(cs) != nullptr)
{
ChunkCache *spcc = (ChunkCache *)cs;
@@ -4398,7 +4400,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
for(int i=0;i<XUSER_MAX_COUNT;i++)
{
- m_pendingLocalConnections[i] = NULL;
+ m_pendingLocalConnections[i] = nullptr;
}
updatePlayerViewportAssignments();
@@ -4412,13 +4414,13 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
levelSource->clearAll();
player = nullptr;
- // Clear all players if the new level is NULL
+ // Clear all players if the new level is nullptr
for(int i=0;i<XUSER_MAX_COUNT;i++)
{
- if( m_pendingLocalConnections[i] != NULL ) m_pendingLocalConnections[i]->close();
- m_pendingLocalConnections[i] = NULL;
+ if( m_pendingLocalConnections[i] != nullptr ) m_pendingLocalConnections[i]->close();
+ m_pendingLocalConnections[i] = nullptr;
localplayers[i] = nullptr;
- localgameModes[i] = NULL;
+ localgameModes[i] = nullptr;
}
}
@@ -4430,7 +4432,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
void Minecraft::prepareLevel(int title)
{
- if(progressRenderer != NULL)
+ if(progressRenderer != nullptr)
{
this->progressRenderer->progressStart(title);
this->progressRenderer->progressStage(IDS_PROGRESS_BUILDING_TERRAIN);
@@ -4443,15 +4445,15 @@ void Minecraft::prepareLevel(int title)
ChunkSource *cs = level->getChunkSource();
Pos *spawnPos = level->getSharedSpawnPos();
- if (player != NULL)
+ if (player != nullptr)
{
- spawnPos->x = (int) player->x;
- spawnPos->z = (int) player->z;
+ spawnPos->x = static_cast<int>(player->x);
+ spawnPos->z = static_cast<int>(player->z);
}
#if 0
// 4J - removed - we don't use ChunkCache anymore
- if (dynamic_cast<ChunkCache *>(cs)!=NULL)
+ if (dynamic_cast<ChunkCache *>(cs)!=nullptr)
{
ChunkCache *spcc = (ChunkCache *) cs;
@@ -4463,7 +4465,7 @@ void Minecraft::prepareLevel(int title)
{
for (int z = -r; z <= r; z += 16)
{
- if(progressRenderer != NULL) this->progressRenderer->progressStagePercentage((pp++) * 100 / max);
+ if(progressRenderer != nullptr) this->progressRenderer->progressStagePercentage((pp++) * 100 / max);
level->getTile(spawnPos->x + x, 64, spawnPos->z + z);
if (!gameMode->isCutScene()) {
}
@@ -4472,7 +4474,7 @@ void Minecraft::prepareLevel(int title)
delete spawnPos;
if (!gameMode->isCutScene())
{
- if(progressRenderer != NULL) this->progressRenderer->progressStage(IDS_PROGRESS_SIMULATING_WORLD);
+ if(progressRenderer != nullptr) this->progressRenderer->progressStage(IDS_PROGRESS_SIMULATING_WORLD);
max = 2000;
}
}
@@ -4508,7 +4510,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId)
level->validateSpawn();
level->removeAllPendingEntityRemovals();
- if (localPlayer != NULL)
+ if (localPlayer != nullptr)
{
level->removeEntity(localPlayer);
}
@@ -4529,7 +4531,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId)
#ifdef _WINDOWS64
// Same compatibility rule as create/init paths.
INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iTempPad);
- if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost())
+ if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost())
{
playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid();
}
@@ -4593,7 +4595,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId)
level->addEntity(player);
gameMode->initPlayer(player);
- if(player->input != NULL) delete player->input;
+ if(player->input != nullptr) delete player->input;
player->input = new Input();
player->entityId = newEntityId;
player->animateRespawn();
@@ -4609,7 +4611,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId)
//SetEvent(m_hPlayerRespawned);
player->SetPlayerRespawned(true);
- if (dynamic_cast<DeathScreen *>(screen) != NULL) setScreen(NULL);
+ if (dynamic_cast<DeathScreen *>(screen) != nullptr) setScreen(nullptr);
gameRenderer->EnableUpdateThread();
}
@@ -4641,9 +4643,9 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const
*/
Minecraft *minecraft;
- // 4J - was new Minecraft(frame, canvas, NULL, 854, 480, fullScreen);
+ // 4J - was new Minecraft(frame, canvas, nullptr, 854, 480, fullScreen);
- minecraft = new Minecraft(NULL, NULL, NULL, 1280, 720, fullScreen);
+ minecraft = new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen);
/* - 4J - removed
{
@@ -4664,7 +4666,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const
// 4J Stu - We never want the player to be DemoUser, we always want them to have their gamertag displayed
//if (ProfileManager.IsFullVersion())
{
- if (userName != L"" && sid != L"") // 4J - username & side were compared with NULL rather than empty strings
+ if (userName != L"" && sid != L"") // 4J - username & side were compared with nullptr rather than empty strings
{
minecraft->user = new User(userName, sid);
}
@@ -4679,7 +4681,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const
//}
/* 4J - TODO
- if (url != NULL)
+ if (url != nullptr)
{
String[] tokens = url.split(":");
minecraft.connectTo(tokens[0], Integer.parseInt(tokens[1]));
@@ -4744,7 +4746,7 @@ void Minecraft::main()
#if 0
for(unsigned int i = 0; i < Item::items.length; ++i)
{
- if(Item::items[i] != NULL)
+ if(Item::items[i] != nullptr)
{
app.DebugPrintf("<xs:enumeration value=\"%d\"><xs:annotation><xs:documentation>%ls</xs:documentation></xs:annotation></xs:enumeration>\n", i, app.GetString( Item::items[i]->getDescriptionId() ));
}
@@ -4754,7 +4756,7 @@ void Minecraft::main()
for(unsigned int i = 0; i < 256; ++i)
{
- if(Tile::tiles[i] != NULL)
+ if(Tile::tiles[i] != nullptr)
{
app.DebugPrintf("<xs:enumeration value=\"%d\"><xs:annotation><xs:documentation>%ls</xs:documentation></xs:annotation></xs:enumeration>\n", i, app.GetString( Tile::tiles[i]->getDescriptionId() ));
}
@@ -4786,7 +4788,7 @@ void Minecraft::main()
bool Minecraft::renderNames()
{
- if (m_instance == NULL || !m_instance->options->hideGui)
+ if (m_instance == nullptr || !m_instance->options->hideGui)
{
return true;
}
@@ -4795,17 +4797,17 @@ bool Minecraft::renderNames()
bool Minecraft::useFancyGraphics()
{
- return (m_instance != NULL && m_instance->options->fancyGraphics);
+ return (m_instance != nullptr && m_instance->options->fancyGraphics);
}
bool Minecraft::useAmbientOcclusion()
{
- return (m_instance != NULL && m_instance->options->ambientOcclusion != Options::AO_OFF);
+ return (m_instance != nullptr && m_instance->options->ambientOcclusion != Options::AO_OFF);
}
bool Minecraft::renderDebug()
{
- return (m_instance != NULL && m_instance->options->renderDebug);
+ return (m_instance != nullptr && m_instance->options->renderDebug);
}
bool Minecraft::handleClientSideCommand(const wstring& chatMessage)
@@ -4844,7 +4846,7 @@ if (gameMode->instaBuild) return;
if (!down) missTime = 0;
if (button == 0 && missTime > 0) return;
-if (down && hitResult != NULL && hitResult->type == HitResult::TILE && button == 0)
+if (down && hitResult != nullptr && hitResult->type == HitResult::TILE && button == 0)
{
int x = hitResult->x;
int y = hitResult->y;
@@ -4876,7 +4878,7 @@ bool mayUse = true;
// 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer game - we need to wake up, and we don't have the inbedchatscreen with a button
-if(button==1 && (player->isSleeping() && level != NULL && level->isClientSide))
+if(button==1 && (player->isSleeping() && level != nullptr && level->isClientSide))
{
shared_ptr<MultiplayerLocalPlayer> mplp = dynamic_pointer_cast<MultiplayerLocalPlayer>( player );
@@ -4890,9 +4892,9 @@ if(mplp) mplp->StopSleeping();
//}
}
-if (hitResult == NULL)
+if (hitResult == nullptr)
{
-if (button == 0 && !(dynamic_cast<CreativeMode *>(gameMode) != NULL)) missTime = 10;
+if (button == 0 && !(dynamic_cast<CreativeMode *>(gameMode) != nullptr)) missTime = 10;
}
else if (hitResult->type == HitResult::ENTITY)
{
@@ -4928,21 +4930,21 @@ gameMode->startDestroyBlock(x, y, z, hitResult->f);
else
{
shared_ptr<ItemInstance> item = player->inventory->getSelected();
-int oldCount = item != NULL ? item->count : 0;
+int oldCount = item != nullptr ? item->count : 0;
if (gameMode->useItemOn(player, level, item, x, y, z, face))
{
mayUse = false;
app.DebugPrintf("Player %d is swinging\n",player->GetXboxPad());
player->swing();
}
-if (item == NULL)
+if (item == nullptr)
{
return;
}
if (item->count == 0)
{
-player->inventory->items[player->inventory->selected] = NULL;
+player->inventory->items[player->inventory->selected] = nullptr;
}
else if (item->count != oldCount)
{
@@ -4954,7 +4956,7 @@ gameRenderer->itemInHandRenderer->itemPlaced();
if (mayUse && button == 1)
{
shared_ptr<ItemInstance> item = player->inventory->getSelected();
-if (item != NULL)
+if (item != nullptr)
{
if (gameMode->useItem(player, level, item))
{
@@ -4975,7 +4977,7 @@ bool Minecraft::isTutorial()
{
return m_inFullTutorialBits > 0;
- /*if( gameMode != NULL && gameMode->isTutorial() )
+ /*if( gameMode != nullptr && gameMode->isTutorial() )
{
return true;
}
@@ -5010,7 +5012,7 @@ void Minecraft::playerLeftTutorial(int iPad)
#ifndef _XBOX_ONE
for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
- if(localplayers[idx] != NULL)
+ if(localplayers[idx] != nullptr)
{
TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount());
}
@@ -5041,7 +5043,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP
{
// create the local player for the iPad
shared_ptr<Player> player = pClass->localplayers[iPad];
- if( player == NULL)
+ if( player == nullptr)
{
if( pClass->level->isClientSide )
{
@@ -5051,7 +5053,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP
{
// create the local player for the iPad
shared_ptr<Player> player = pClass->localplayers[iPad];
- if( player == NULL)
+ if( player == nullptr)
{
player = pClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pClass->level->dimension->id);
}
@@ -5068,7 +5070,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad, int
int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad)
#endif
{
- Minecraft* pMinecraftClass = (Minecraft*)pParam;
+ Minecraft* pMinecraftClass = static_cast<Minecraft *>(pParam);
if(g_NetworkManager.IsInSession())
{
@@ -5079,7 +5081,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad)
}
// If sign in succeded, we're in game and this player isn't already playing, continue
- if(bContinue==true && g_NetworkManager.IsInSession() && pMinecraftClass->localplayers[iPad] == NULL)
+ if(bContinue==true && g_NetworkManager.IsInSession() && pMinecraftClass->localplayers[iPad] == nullptr)
{
// It's possible that the player has not signed in - they can back out or choose no for the converttoguest
if(ProfileManager.IsSignedIn(iPad))
@@ -5105,7 +5107,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad)
{
#ifdef __ORBIS__
bool contentRestricted = false;
- ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&contentRestricted,NULL); // TODO!
+ ProfileManager.GetChatAndContentRestrictions(iPad,false,nullptr,&contentRestricted,nullptr); // TODO!
if (!g_NetworkManager.IsLocalGame() && contentRestricted)
{
@@ -5126,7 +5128,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad)
{
// create the local player for the iPad
shared_ptr<Player> player = pMinecraftClass->localplayers[iPad];
- if( player == NULL)
+ if( player == nullptr)
{
player = pMinecraftClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pMinecraftClass->level->dimension->id);
}
@@ -5195,7 +5197,7 @@ ColourTable *Minecraft::getColourTable()
ColourTable *colours = selected->getColourTable();
- if(colours == NULL)
+ if(colours == nullptr)
{
colours = skins->getDefault()->getColourTable();
}