summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/World.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 1df4c9167..9b7d54670 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -258,10 +258,10 @@ cWorld::cWorld(const AString & a_WorldName, eDimension a_Dimension, const AStrin
m_VillagersShouldHarvestCrops(true),
m_SimulatorManager(),
m_SandSimulator(),
- m_WaterSimulator(NULL),
+ m_WaterSimulator(nullptr),
m_LavaSimulator(nullptr),
m_FireSimulator(),
- m_RedstoneSimulator(NULL),
+ m_RedstoneSimulator(nullptr),
m_MaxPlayers(10),
m_ChunkMap(),
m_bAnimals(true),
@@ -303,9 +303,9 @@ cWorld::cWorld(const AString & a_WorldName, eDimension a_Dimension, const AStrin
cWorld::~cWorld()
{
- delete m_WaterSimulator; m_WaterSimulator = NULL;
- delete m_LavaSimulator; m_LavaSimulator = NULL;
- delete m_RedstoneSimulator; m_RedstoneSimulator = NULL;
+ delete m_WaterSimulator; m_WaterSimulator = nullptr;
+ delete m_LavaSimulator; m_LavaSimulator = nullptr;
+ delete m_RedstoneSimulator; m_RedstoneSimulator = nullptr;
UnloadUnusedChunks();
@@ -1261,7 +1261,7 @@ void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_Blo
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if (ch == NULL)
+ if (ch == nullptr)
{
continue;
}
@@ -2016,7 +2016,7 @@ void cWorld::BroadcastChat(const AString & a_Message, const cClientHandle * a_Ex
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2034,7 +2034,7 @@ void cWorld::BroadcastChat(const cCompositeChat & a_Message, const cClientHandle
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2177,7 +2177,7 @@ void cWorld::BroadcastPlayerListAddPlayer(const cPlayer & a_Player, const cClien
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2195,7 +2195,7 @@ void cWorld::BroadcastPlayerListRemovePlayer(const cPlayer & a_Player, const cCl
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2213,7 +2213,7 @@ void cWorld::BroadcastPlayerListUpdateGameMode(const cPlayer & a_Player, const c
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2231,7 +2231,7 @@ void cWorld::BroadcastPlayerListUpdatePing(const cPlayer & a_Player, const cClie
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2249,7 +2249,7 @@ void cWorld::BroadcastPlayerListUpdateDisplayName(const cPlayer & a_Player, cons
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2276,7 +2276,7 @@ void cWorld::BroadcastScoreboardObjective(const AString & a_Name, const AString
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2294,7 +2294,7 @@ void cWorld::BroadcastScoreUpdate(const AString & a_Objective, const AString & a
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2312,7 +2312,7 @@ void cWorld::BroadcastDisplayObjective(const AString & a_Objective, cScoreboard:
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2357,7 +2357,7 @@ void cWorld::BroadcastTeleportEntity(const cEntity & a_Entity, const cClientHand
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2384,7 +2384,7 @@ void cWorld::BroadcastTimeUpdate(const cClientHandle * a_Exclude)
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2411,7 +2411,7 @@ void cWorld::BroadcastWeather(eWeather a_Weather, const cClientHandle * a_Exclud
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed())
+ if ((ch == a_Exclude) || (ch == nullptr) || !ch->IsLoggedIn() || ch->IsDestroyed())
{
continue;
}
@@ -2646,7 +2646,7 @@ void cWorld::RemovePlayer(cPlayer * a_Player, bool a_RemoveFromChunk)
// Remove the player's client from the list of clients to be ticked:
cClientHandle * Client = a_Player->GetClientHandle();
- if (Client != NULL)
+ if (Client != nullptr)
{
Client->RemoveFromWorld();
m_ChunkMap->RemoveClientFromChunks(Client);
@@ -2699,7 +2699,7 @@ bool cWorld::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_
bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback)
{
- cPlayer * BestMatch = NULL;
+ cPlayer * BestMatch = nullptr;
size_t BestRating = 0;
size_t NameLength = a_PlayerNameHint.length();
@@ -2718,7 +2718,7 @@ bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCa
}
} // for itr - m_Players[]
- if (BestMatch != NULL)
+ if (BestMatch != nullptr)
{
return a_Callback.Item (BestMatch);
}
@@ -2735,7 +2735,7 @@ cPlayer * cWorld::FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit,
cTracer LineOfSight(this);
double ClosestDistance = a_SightLimit;
- cPlayer * ClosestPlayer = NULL;
+ cPlayer * ClosestPlayer = nullptr;
cCSLock Lock(m_CSPlayers);
for (cPlayerList::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
@@ -2774,7 +2774,7 @@ void cWorld::SendPlayerList(cPlayer * a_DestPlayer)
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
cClientHandle * ch = (*itr)->GetClientHandle();
- if ((ch != NULL) && !ch->IsDestroyed())
+ if ((ch != nullptr) && !ch->IsDestroyed())
{
a_DestPlayer->GetClientHandle()->SendPlayerListAddPlayer(*(*itr));
}
@@ -3218,10 +3218,10 @@ bool cWorld::IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ)
int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType)
{
- cMonster * Monster = NULL;
+ cMonster * Monster = nullptr;
Monster = cMonster::NewMonsterFromType(a_MonsterType);
- if (Monster != NULL)
+ if (Monster != nullptr)
{
Monster->SetPosition(a_PosX, a_PosY, a_PosZ);
}
@@ -3247,7 +3247,7 @@ int cWorld::SpawnMobFinalize(cMonster * a_Monster)
if (cPluginManager::Get()->CallHookSpawningMonster(*this, *a_Monster))
{
delete a_Monster;
- a_Monster = NULL;
+ a_Monster = nullptr;
return -1;
}
@@ -3255,7 +3255,7 @@ int cWorld::SpawnMobFinalize(cMonster * a_Monster)
if (!a_Monster->Initialize(*this))
{
delete a_Monster;
- a_Monster = NULL;
+ a_Monster = nullptr;
return -1;
}
@@ -3272,14 +3272,14 @@ int cWorld::SpawnMobFinalize(cMonster * a_Monster)
int cWorld::CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem * a_Item, const Vector3d * a_Speed)
{
cProjectileEntity * Projectile = cProjectileEntity::Create(a_Kind, a_Creator, a_PosX, a_PosY, a_PosZ, a_Item, a_Speed);
- if (Projectile == NULL)
+ if (Projectile == nullptr)
{
return -1;
}
if (!Projectile->Initialize(*this))
{
delete Projectile;
- Projectile = NULL;
+ Projectile = nullptr;
return -1;
}
return Projectile->GetUniqueID();
@@ -3362,7 +3362,7 @@ cRedstoneSimulator<cChunk, cWorld> * cWorld::InitializeRedstoneSimulator(cIniFil
SimulatorName = "Incremental";
}
- cRedstoneSimulator<cChunk, cWorld> * res = NULL;
+ cRedstoneSimulator<cChunk, cWorld> * res = nullptr;
if (NoCaseCompare(SimulatorName, "Incremental") == 0)
{
@@ -3395,7 +3395,7 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c
SimulatorName = "Vanilla";
}
- cFluidSimulator * res = NULL;
+ cFluidSimulator * res = nullptr;
bool IsWater = (strcmp(a_FluidName, "Water") == 0); // Used for defaults
int Rate = 1;
if (
@@ -3485,7 +3485,7 @@ void cWorld::AddQueuedPlayers(void)
for (cPlayerList::iterator itr = PlayersToAdd.begin(), end = PlayersToAdd.end(); itr != end; ++itr)
{
cClientHandle * Client = (*itr)->GetClientHandle();
- if (Client != NULL)
+ if (Client != nullptr)
{
m_Clients.push_back(Client);
}
@@ -3496,7 +3496,7 @@ void cWorld::AddQueuedPlayers(void)
for (cPlayerList::iterator itr = PlayersToAdd.begin(), end = PlayersToAdd.end(); itr != end; ++itr)
{
cClientHandle * Client = (*itr)->GetClientHandle();
- if (Client != NULL)
+ if (Client != nullptr)
{
Client->SendPlayerMoveLook();
Client->SendHealth();
@@ -3596,7 +3596,7 @@ void cWorld::cChunkGeneratorCallbacks::OnChunkGenerated(cChunkDesc & a_ChunkDesc
cSetChunkDataPtr SetChunkData(new cSetChunkData(
a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ(),
a_ChunkDesc.GetBlockTypes(), BlockMetas,
- NULL, NULL, // We don't have lighting, chunk will be lighted when needed
+ nullptr, nullptr, // We don't have lighting, chunk will be lighted when needed
&a_ChunkDesc.GetHeightMap(), &a_ChunkDesc.GetBiomeMap(),
a_ChunkDesc.GetEntities(), a_ChunkDesc.GetBlockEntities(),
true