aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/GameRules
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/Common/GameRules
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/Common/GameRules')
-rw-r--r--Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp4
-rw-r--r--Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp10
-rw-r--r--Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp32
-rw-r--r--Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp26
-rw-r--r--Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp10
-rw-r--r--Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp8
-rw-r--r--Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp22
-rw-r--r--Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h2
-rw-r--r--Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp78
-rw-r--r--Minecraft.Client/Common/GameRules/GameRule.h2
-rw-r--r--Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp2
-rw-r--r--Minecraft.Client/Common/GameRules/GameRuleDefinition.h2
-rw-r--r--Minecraft.Client/Common/GameRules/GameRuleManager.cpp68
-rw-r--r--Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp68
-rw-r--r--Minecraft.Client/Common/GameRules/LevelGenerationOptions.h4
-rw-r--r--Minecraft.Client/Common/GameRules/LevelRuleset.cpp8
-rw-r--r--Minecraft.Client/Common/GameRules/StartFeature.cpp4
-rw-r--r--Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp16
-rw-r--r--Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp8
-rw-r--r--Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp4
20 files changed, 193 insertions, 185 deletions
diff --git a/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp
index 555ed8b4..f97bfdd1 100644
--- a/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp
@@ -46,7 +46,7 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
{
bool enchanted = false;
- if (item != NULL)
+ if (item != nullptr)
{
// 4J-JEV: Ripped code from enchantmenthelpers
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
@@ -58,7 +58,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
{
Enchantment *e = Enchantment::enchantments[m_enchantmentId];
- if(e != NULL && e->category->canEnchant(item->getItem()))
+ if(e != nullptr && e->category->canEnchant(item->getItem()))
{
int level = min(e->getMaxLevel(), m_enchantmentLevel);
item->enchant(e, m_enchantmentLevel);
diff --git a/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp
index 801a2937..49809d0c 100644
--- a/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp
@@ -41,11 +41,11 @@ void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
{
- GameRuleDefinition *rule = NULL;
+ GameRuleDefinition *rule = nullptr;
if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment)
{
rule = new AddEnchantmentRuleDefinition();
- m_enchantments.push_back((AddEnchantmentRuleDefinition *)rule);
+ m_enchantments.push_back(static_cast<AddEnchantmentRuleDefinition *>(rule));
}
else
{
@@ -97,10 +97,10 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst
bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container, int slotId)
{
bool added = false;
- if(Item::items[m_itemId] != NULL)
+ if(Item::items[m_itemId] != nullptr)
{
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
- shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
+ shared_ptr<ItemInstance> newItem = std::make_shared<ItemInstance>(m_itemId, quantity, m_auxValue);
newItem->set4JData(m_dataTag);
for( auto& it : m_enchantments )
@@ -118,7 +118,7 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
container->setItem( slotId, newItem );
added = true;
}
- else if(dynamic_pointer_cast<Inventory>(container) != NULL)
+ else if(dynamic_pointer_cast<Inventory>(container) != nullptr)
{
added = dynamic_pointer_cast<Inventory>(container)->add(newItem);
}
diff --git a/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp
index a740a2be..3c7e02a3 100644
--- a/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp
@@ -13,20 +13,20 @@ ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(LevelGenerationOption
{
m_levelGenOptions = levelGenOptions;
m_location = Vec3::newPermanent(0,0,0);
- m_locationBox = NULL;
+ m_locationBox = nullptr;
m_totalBlocksChanged = 0;
m_totalBlocksChangedLighting = 0;
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
m_completed = false;
m_dimension = 0;
- m_schematic = NULL;
+ m_schematic = nullptr;
}
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition()
{
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
- m_schematic = NULL;
+ m_schematic = nullptr;
delete m_location;
}
@@ -72,20 +72,20 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
else if(attributeName.compare(L"x") == 0)
{
m_location->x = _fromString<int>(attributeValue);
- if( ((int)abs(m_location->x))%2 != 0) m_location->x -=1;
+ if( static_cast<int>(abs(m_location->x))%2 != 0) m_location->x -=1;
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter x=%f\n",m_location->x);
}
else if(attributeName.compare(L"y") == 0)
{
m_location->y = _fromString<int>(attributeValue);
- if( ((int)abs(m_location->y))%2 != 0) m_location->y -= 1;
+ if( static_cast<int>(abs(m_location->y))%2 != 0) m_location->y -= 1;
if(m_location->y < 0) m_location->y = 0;
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter y=%f\n",m_location->y);
}
else if(attributeName.compare(L"z") == 0)
{
m_location->z = _fromString<int>(attributeValue);
- if(((int)abs(m_location->z))%2 != 0) m_location->z -= 1;
+ if(static_cast<int>(abs(m_location->z))%2 != 0) m_location->z -= 1;
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter z=%f\n",m_location->z);
}
else if(attributeName.compare(L"rot") == 0)
@@ -95,7 +95,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
while(degrees < 0) degrees += 360;
while(degrees >= 360) degrees -= 360;
float quad = degrees/90;
- degrees = (int)(quad + 0.5f);
+ degrees = static_cast<int>(quad + 0.5f);
switch(degrees)
{
case 1:
@@ -130,7 +130,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
void ApplySchematicRuleDefinition::updateLocationBox()
{
- if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
+ if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
m_locationBox = AABB::newPermanent(0,0,0,0,0,0);
@@ -162,9 +162,9 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *
if(chunk->level->dimension->id != m_dimension) return;
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
- if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
+ if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
- if(m_locationBox == NULL) updateLocationBox();
+ if(m_locationBox == nullptr) updateLocationBox();
if(chunkBox->intersects( m_locationBox ))
{
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
@@ -189,7 +189,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *
{
m_completed = true;
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
- //m_schematic = NULL;
+ //m_schematic = nullptr;
}
}
PIXEndNamedEvent();
@@ -201,9 +201,9 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
if(chunk->level->dimension->id != m_dimension) return;
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
- if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
+ if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
- if(m_locationBox == NULL) updateLocationBox();
+ if(m_locationBox == nullptr) updateLocationBox();
if(chunkBox->intersects( m_locationBox ))
{
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
@@ -223,7 +223,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
{
m_completed = true;
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
- //m_schematic = NULL;
+ //m_schematic = nullptr;
}
}
PIXEndNamedEvent();
@@ -231,13 +231,13 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1)
{
- if( m_locationBox == NULL ) updateLocationBox();
+ if( m_locationBox == nullptr ) updateLocationBox();
return m_locationBox->intersects(x0,y0,z0,x1,y1,z1);
}
int ApplySchematicRuleDefinition::getMinY()
{
- if( m_locationBox == NULL ) updateLocationBox();
+ if( m_locationBox == nullptr ) updateLocationBox();
return m_locationBox->y0;
}
diff --git a/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp
index f3b48445..7f03a0fe 100644
--- a/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp
@@ -77,7 +77,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
{
bool statusChanged = false;
- if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
+ if(item != nullptr && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
{
if(!getComplete(rule))
{
@@ -90,13 +90,21 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIns
if(quantityCollected >= m_quantity)
{
setComplete(rule, true);
- app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId,m_auxValue,m_quantity,m_4JDataValue);
-
- if(rule->getConnection() != NULL)
- {
- rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0)));
- }
- }
+ app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId, m_auxValue, m_quantity, m_4JDataValue);
+
+ if (rule->getConnection() != nullptr)
+ {
+ rule->getConnection()->send(std::make_shared<UpdateGameRuleProgressPacket>(
+ getActionType(),
+ this->m_descriptionId,
+ m_itemId,
+ m_auxValue,
+ this->m_4JDataValue,
+ nullptr,
+ static_cast<DWORD>(0)
+ ));
+ }
+ }
}
}
return statusChanged;
@@ -106,7 +114,7 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
{
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
wstring xml = L"";
- if(item != NULL)
+ if(item != nullptr)
{
xml = L"<CollectItemRule itemId=\"" + std::to_wstring(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + std::to_wstring(item->getAuxValue()) + L"\"";
diff --git a/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp
index b928b26c..cd23cd50 100644
--- a/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp
@@ -36,7 +36,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
}
}
- if(rule->getConnection() != NULL)
+ if(rule->getConnection() != nullptr)
{
PacketData data;
data.goal = goal;
@@ -45,20 +45,20 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
int icon = -1;
int auxValue = 0;
- if(m_lastRuleStatusChanged != NULL)
+ if(m_lastRuleStatusChanged != nullptr)
{
icon = m_lastRuleStatusChanged->getIcon();
auxValue = m_lastRuleStatusChanged->getAuxValue();
- m_lastRuleStatusChanged = NULL;
+ m_lastRuleStatusChanged = nullptr;
}
- rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData))));
+ rule->getConnection()->send(std::make_shared<UpdateGameRuleProgressPacket>(getActionType(), this->m_descriptionId, icon, auxValue, 0, &data, sizeof(PacketData)));
}
app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal);
}
wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &description, void *data, int dataLength)
{
- PacketData *values = (PacketData *)data;
+ PacketData *values = static_cast<PacketData *>(data);
wstring newDesc = description;
newDesc = replaceAll(newDesc,L"{*progress*}",std::to_wstring(values->progress));
newDesc = replaceAll(newDesc,L"{*goal*}",std::to_wstring(values->goal));
diff --git a/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
index 395b4eeb..f75eddd4 100644
--- a/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
@@ -6,7 +6,7 @@
CompoundGameRuleDefinition::CompoundGameRuleDefinition()
{
- m_lastRuleStatusChanged = NULL;
+ m_lastRuleStatusChanged = nullptr;
}
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
@@ -26,7 +26,7 @@ void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *child
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
{
- GameRuleDefinition *rule = NULL;
+ GameRuleDefinition *rule = nullptr;
if(ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule)
{
rule = new CompleteAllRuleDefinition();
@@ -49,13 +49,13 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame
wprintf(L"CompoundGameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
#endif
}
- if(rule != NULL) m_children.push_back(rule);
+ if(rule != nullptr) m_children.push_back(rule);
return rule;
}
void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule)
{
- GameRule *newRule = NULL;
+ GameRule *newRule = nullptr;
int i = 0;
for (auto& it : m_children )
{
diff --git a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp
index f505ce7a..dd777682 100644
--- a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp
+++ b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp
@@ -10,7 +10,7 @@
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
{
m_x = m_y = m_z = 0;
- boundingBox = NULL;
+ boundingBox = nullptr;
orientation = Direction::NORTH;
m_dimension = 0;
}
@@ -25,26 +25,26 @@ void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *childre
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
{
- GameRuleDefinition *rule = NULL;
+ GameRuleDefinition *rule = nullptr;
if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox)
{
rule = new XboxStructureActionGenerateBox();
- m_actions.push_back((XboxStructureActionGenerateBox *)rule);
+ m_actions.push_back(static_cast<XboxStructureActionGenerateBox *>(rule));
}
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceBlock)
{
rule = new XboxStructureActionPlaceBlock();
- m_actions.push_back((XboxStructureActionPlaceBlock *)rule);
+ m_actions.push_back(static_cast<XboxStructureActionPlaceBlock *>(rule));
}
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceContainer)
{
rule = new XboxStructureActionPlaceContainer();
- m_actions.push_back((XboxStructureActionPlaceContainer *)rule);
+ m_actions.push_back(static_cast<XboxStructureActionPlaceContainer *>(rule));
}
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceSpawner)
{
rule = new XboxStructureActionPlaceSpawner();
- m_actions.push_back((XboxStructureActionPlaceSpawner *)rule);
+ m_actions.push_back(static_cast<XboxStructureActionPlaceSpawner *>(rule));
}
else
{
@@ -112,7 +112,7 @@ void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const
BoundingBox* ConsoleGenerateStructure::getBoundingBox()
{
- if(boundingBox == NULL)
+ if(boundingBox == nullptr)
{
// Find the max bounds
int maxX, maxY, maxZ;
@@ -139,25 +139,25 @@ bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, Boundin
{
case ConsoleGameRules::eGameRuleType_GenerateBox:
{
- XboxStructureActionGenerateBox *genBox = (XboxStructureActionGenerateBox *)action;
+ XboxStructureActionGenerateBox *genBox = static_cast<XboxStructureActionGenerateBox *>(action);
genBox->generateBoxInLevel(this,level,chunkBB);
}
break;
case ConsoleGameRules::eGameRuleType_PlaceBlock:
{
- XboxStructureActionPlaceBlock *pPlaceBlock = (XboxStructureActionPlaceBlock *)action;
+ XboxStructureActionPlaceBlock *pPlaceBlock = static_cast<XboxStructureActionPlaceBlock *>(action);
pPlaceBlock->placeBlockInLevel(this,level,chunkBB);
}
break;
case ConsoleGameRules::eGameRuleType_PlaceContainer:
{
- XboxStructureActionPlaceContainer *pPlaceContainer = (XboxStructureActionPlaceContainer *)action;
+ XboxStructureActionPlaceContainer *pPlaceContainer = static_cast<XboxStructureActionPlaceContainer *>(action);
pPlaceContainer->placeContainerInLevel(this,level,chunkBB);
}
break;
case ConsoleGameRules::eGameRuleType_PlaceSpawner:
{
- XboxStructureActionPlaceSpawner *pPlaceSpawner = (XboxStructureActionPlaceSpawner *)action;
+ XboxStructureActionPlaceSpawner *pPlaceSpawner = static_cast<XboxStructureActionPlaceSpawner *>(action);
pPlaceSpawner->placeSpawnerInLevel(this,level,chunkBB);
}
break;
diff --git a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h
index 91c4ef35..712a29ab 100644
--- a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h
+++ b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h
@@ -36,7 +36,7 @@ public:
virtual int getMinY();
- EStructurePiece GetType() { return (EStructurePiece)0; }
+ EStructurePiece GetType() { return static_cast<EStructurePiece>(0); }
void addAdditonalSaveData(CompoundTag *tag) {}
void readAdditonalSaveData(CompoundTag *tag) {}
}; \ No newline at end of file
diff --git a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp
index 7b69c4b4..c261e0cd 100644
--- a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp
+++ b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp
@@ -16,18 +16,18 @@ ConsoleSchematicFile::ConsoleSchematicFile()
{
m_xSize = m_ySize = m_zSize = 0;
m_refCount = 1;
- m_data.data = NULL;
+ m_data.data = nullptr;
}
ConsoleSchematicFile::~ConsoleSchematicFile()
{
app.DebugPrintf("Deleting schematic file\n");
- if(m_data.data != NULL) delete [] m_data.data;
+ if(m_data.data != nullptr) delete [] m_data.data;
}
void ConsoleSchematicFile::save(DataOutputStream *dos)
{
- if(dos != NULL)
+ if(dos != nullptr)
{
dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
@@ -52,7 +52,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
void ConsoleSchematicFile::load(DataInputStream *dis)
{
- if(dis != NULL)
+ if(dis != nullptr)
{
// VERSION CHECK //
int version = dis->readInt();
@@ -61,7 +61,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
if (version > XBOX_SCHEMATIC_ORIGINAL_VERSION) // Or later versions
{
- compressionType = (Compression::ECompressionTypes)dis->readByte();
+ compressionType = static_cast<Compression::ECompressionTypes>(dis->readByte());
}
if (version > XBOX_SCHEMATIC_CURRENT_VERSION)
@@ -75,10 +75,10 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
byteArray compressedBuffer(compressedSize);
dis->readFully(compressedBuffer);
- if(m_data.data != NULL)
+ if(m_data.data != nullptr)
{
- delete [] m_data.data;
- m_data.data = NULL;
+ delete [] m_data.data;
+ m_data.data = nullptr;
}
if(compressionType == Compression::eCompressionType_None)
@@ -111,17 +111,17 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
// READ TAGS //
CompoundTag *tag = NbtIo::read(dis);
ListTag<CompoundTag> *tileEntityTags = (ListTag<CompoundTag> *) tag->getList(L"TileEntities");
- if (tileEntityTags != NULL)
+ if (tileEntityTags != nullptr)
{
for (int i = 0; i < tileEntityTags->size(); i++)
{
CompoundTag *teTag = tileEntityTags->get(i);
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
- if(te == NULL)
+ if(te == nullptr)
{
#ifndef _CONTENT_PACKAGE
- app.DebugPrintf("ConsoleSchematicFile has read a NULL tile entity\n");
+ app.DebugPrintf("ConsoleSchematicFile has read a nullptr tile entity\n");
__debugbreak();
#endif
}
@@ -132,7 +132,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
}
}
ListTag<CompoundTag> *entityTags = (ListTag<CompoundTag> *) tag->getList(L"Entities");
- if (entityTags != NULL)
+ if (entityTags != nullptr)
{
for (int i = 0; i < entityTags->size(); i++)
{
@@ -145,15 +145,15 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
double z = pos->get(2)->data;
if( type == eTYPE_PAINTING || type == eTYPE_ITEM_FRAME )
- {
- x = ((IntTag *) eTag->get(L"TileX") )->data;
- y = ((IntTag *) eTag->get(L"TileY") )->data;
- z = ((IntTag *) eTag->get(L"TileZ") )->data;
- }
+ {
+ x = static_cast<IntTag *>(eTag->get(L"TileX"))->data;
+ y = static_cast<IntTag *>(eTag->get(L"TileY"))->data;
+ z = static_cast<IntTag *>(eTag->get(L"TileZ"))->data;
+ }
#ifdef _DEBUG
//app.DebugPrintf(1,"Loaded entity type %d at (%f,%f,%f)\n",(int)type,x,y,z);
#endif
- m_entities.push_back( pair<Vec3 *, CompoundTag *>(Vec3::newPermanent(x,y,z),(CompoundTag *)eTag->copy()));
+ m_entities.push_back( pair<Vec3 *, CompoundTag *>(Vec3::newPermanent(x,y,z),static_cast<CompoundTag *>(eTag->copy())));
}
}
delete tag;
@@ -178,7 +178,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
tag->put(L"Entities", entityTags);
for (auto& it : m_entities )
- entityTags->add( (CompoundTag *)(it).second->copy() );
+ entityTags->add( static_cast<CompoundTag *>((it).second->copy()) );
NbtIo::write(tag,dos);
delete tag;
@@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
int64_t ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
- int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
- int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
+ int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, static_cast<double>(chunk->x)*16));
+ int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, static_cast<double>((xStart >> 4) << 4) + 16));
int yStart = destinationBox->y0;
int yEnd = destinationBox->y1;
if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight;
- int zStart = static_cast<int>(std::fmax<double>(destinationBox->z0, (double)chunk->z * 16));
- int zEnd = static_cast<int>(std::fmin<double>(destinationBox->z1, (double)((zStart >> 4) << 4) + 16));
+ int zStart = static_cast<int>(std::fmax<double>(destinationBox->z0, static_cast<double>(chunk->z) * 16));
+ int zEnd = static_cast<int>(std::fmin<double>(destinationBox->z1, static_cast<double>((zStart >> 4) << 4) + 16));
#ifdef _DEBUG
app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1);
@@ -442,10 +442,10 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ);
if( chunkBox->containsIncludingLowerBound(pos) )
{
- shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
+ shared_ptr<TileEntity> teCopy = chunk->getTileEntity( static_cast<int>(targetX) & 15, static_cast<int>(targetY) & 15, static_cast<int>(targetZ) & 15 );
- if ( teCopy != NULL )
- {
+ if ( teCopy != nullptr )
+ {
CompoundTag *teData = new CompoundTag();
te->save(teData);
@@ -493,7 +493,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
}
CompoundTag *eTag = it->second;
- shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
+ shared_ptr<Entity> e = EntityIO::loadStatic(eTag, nullptr);
if( e->GetType() == eTYPE_PAINTING )
{
@@ -582,18 +582,18 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
app.DebugPrintf("Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), %dx%dx%d\n",xStart,yStart,zStart,xEnd,yEnd,zEnd,xSize,ySize,zSize);
- if(dos != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
+ if(dos != nullptr) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
- if(dos != NULL) dos->writeByte(compressionType);
+ if(dos != nullptr) dos->writeByte(compressionType);
//Write xSize
- if(dos != NULL) dos->writeInt(xSize);
+ if(dos != nullptr) dos->writeInt(xSize);
//Write ySize
- if(dos != NULL) dos->writeInt(ySize);
+ if(dos != nullptr) dos->writeInt(ySize);
//Write zSize
- if(dos != NULL) dos->writeInt(zSize);
+ if(dos != nullptr) dos->writeInt(zSize);
//byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart, xSize, ySize, zSize, false);
int xRowSize = ySize * zSize;
@@ -660,8 +660,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
delete [] result.data;
byteArray buffer = byteArray(ucTemp,inputSize);
- if(dos != NULL) dos->writeInt(inputSize);
- if(dos != NULL) dos->write(buffer);
+ if(dos != nullptr) dos->writeInt(inputSize);
+ if(dos != nullptr) dos->write(buffer);
delete [] buffer.data;
CompoundTag tag;
@@ -725,10 +725,10 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
pos->get(2)->data -= zStart;
if( e->instanceof(eTYPE_HANGING_ENTITY) )
- {
- ((IntTag *) eTag->get(L"TileX") )->data -= xStart;
- ((IntTag *) eTag->get(L"TileY") )->data -= yStart;
- ((IntTag *) eTag->get(L"TileZ") )->data -= zStart;
+ {
+ static_cast<IntTag *>(eTag->get(L"TileX"))->data -= xStart;
+ static_cast<IntTag *>(eTag->get(L"TileY"))->data -= yStart;
+ static_cast<IntTag *>(eTag->get(L"TileZ"))->data -= zStart;
}
entitiesTag->add(eTag);
@@ -738,7 +738,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
tag.put(L"Entities", entitiesTag);
- if(dos != NULL) NbtIo::write(&tag,dos);
+ if(dos != nullptr) NbtIo::write(&tag,dos);
}
void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP)
diff --git a/Minecraft.Client/Common/GameRules/GameRule.h b/Minecraft.Client/Common/GameRules/GameRule.h
index 3b9dba7e..e35f1375 100644
--- a/Minecraft.Client/Common/GameRules/GameRule.h
+++ b/Minecraft.Client/Common/GameRules/GameRule.h
@@ -40,7 +40,7 @@ public:
stringValueMapType m_parameters; // These are the members of this rule that maintain it's state
public:
- GameRule(GameRuleDefinition *definition, Connection *connection = NULL);
+ GameRule(GameRuleDefinition *definition, Connection *connection = nullptr);
virtual ~GameRule();
Connection *getConnection() { return m_connection; }
diff --git a/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp
index 80d02956..770b56d5 100644
--- a/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp
@@ -50,7 +50,7 @@ GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType
#ifndef _CONTENT_PACKAGE
wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
#endif
- return NULL;
+ return nullptr;
}
void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
diff --git a/Minecraft.Client/Common/GameRules/GameRuleDefinition.h b/Minecraft.Client/Common/GameRules/GameRuleDefinition.h
index afec8fbc..4a2c43a1 100644
--- a/Minecraft.Client/Common/GameRules/GameRuleDefinition.h
+++ b/Minecraft.Client/Common/GameRules/GameRuleDefinition.h
@@ -61,6 +61,6 @@ public:
// Static functions
static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection);
- static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = NULL, int dataLength = 0);
+ static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = nullptr, int dataLength = 0);
}; \ No newline at end of file
diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp
index 0606808c..ff294a65 100644
--- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp
+++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp
@@ -85,24 +85,24 @@ const WCHAR *GameRuleManager::wchAttrNameA[] =
GameRuleManager::GameRuleManager()
{
- m_currentGameRuleDefinitions = NULL;
- m_currentLevelGenerationOptions = NULL;
+ m_currentGameRuleDefinitions = nullptr;
+ m_currentLevelGenerationOptions = nullptr;
}
void GameRuleManager::loadGameRules(DLCPack *pack)
{
- StringTable *strings = NULL;
+ StringTable *strings = nullptr;
if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc"))
{
- DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc");
+ DLCLocalisationFile *localisationFile = static_cast<DLCLocalisationFile *>(pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"));
strings = localisationFile->getStringTable();
}
int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader);
for(int i = 0; i < gameRulesCount; ++i)
{
- DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
+ DLCGameRulesHeader *dlcHeader = static_cast<DLCGameRulesHeader *>(pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i));
DWORD dSize;
byte *dData = dlcHeader->getData(dSize);
@@ -120,7 +120,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRules);
for (int i = 0; i < gameRulesCount; ++i)
{
- DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i);
+ DLCGameRulesFile *dlcFile = static_cast<DLCGameRulesFile *>(pack->getFile(DLCManager::e_DLCType_GameRules, i));
DWORD dSize;
byte *dData = dlcFile->getData(dSize);
@@ -182,7 +182,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
compr_content(new BYTE[compr_len], compr_len);
dis.read(compr_content);
- Compression::getCompression()->SetDecompressionType( (Compression::ECompressionTypes)compression_type );
+ Compression::getCompression()->SetDecompressionType( static_cast<Compression::ECompressionTypes>(compression_type) );
Compression::getCompression()->DecompressLZXRLE( content.data, &content.length,
compr_content.data, compr_content.length);
Compression::getCompression()->SetDecompressionType( SAVE_FILE_PLATFORM_LOCAL );
@@ -237,11 +237,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
// 4J-JEV: Reverse of loadGameRules.
void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
{
- if (m_currentGameRuleDefinitions == NULL &&
- m_currentLevelGenerationOptions == NULL)
+ if (m_currentGameRuleDefinitions == nullptr &&
+ m_currentLevelGenerationOptions == nullptr)
{
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
- *dOut = NULL;
+ *dOut = nullptr;
*dSize = 0;
return;
}
@@ -268,7 +268,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
ByteArrayOutputStream compr_baos;
DataOutputStream compr_dos(&compr_baos);
- if (m_currentGameRuleDefinitions == NULL)
+ if (m_currentGameRuleDefinitions == nullptr)
{
compr_dos.writeInt( 0 ); // numStrings for StringTable
compr_dos.writeInt( version_number );
@@ -282,9 +282,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
{
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
- if (st == NULL)
+ if (st == nullptr)
{
- app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == NULL!");
+ app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == nullptr!");
}
else
{
@@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
*dSize = baos.buf.length;
*dOut = baos.buf.data;
- baos.buf.data = NULL;
+ baos.buf.data = nullptr;
dos.close(); baos.close();
}
@@ -399,8 +399,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
for(int i = 0; i < 8; ++i) dis.readBoolean();
}
- ByteArrayInputStream *contentBais = NULL;
- DataInputStream *contentDis = NULL;
+ ByteArrayInputStream *contentBais = nullptr;
+ DataInputStream *contentDis = nullptr;
if(compressionType == Compression::eCompressionType_None)
{
@@ -469,13 +469,13 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
tagsAndAtts.push_back( contentDis->readUTF() );
unordered_map<int, ConsoleGameRules::EGameRuleType> tagIdMap;
- for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (int)ConsoleGameRules::eGameRuleType_Count; ++type)
+ for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < static_cast<int>(ConsoleGameRules::eGameRuleType_Count); ++type)
{
for(UINT i = 0; i < numStrings; ++i)
{
if(tagsAndAtts[i].compare(wchTagNameA[type]) == 0)
{
- tagIdMap.insert( unordered_map<int, ConsoleGameRules::EGameRuleType>::value_type(i, (ConsoleGameRules::EGameRuleType)type) );
+ tagIdMap.insert( unordered_map<int, ConsoleGameRules::EGameRuleType>::value_type(i, static_cast<ConsoleGameRules::EGameRuleType>(type)) );
break;
}
}
@@ -521,7 +521,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
auto it = tagIdMap.find(tagId);
if(it != tagIdMap.end()) tagVal = it->second;
- GameRuleDefinition *rule = NULL;
+ GameRuleDefinition *rule = nullptr;
if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions)
{
@@ -548,14 +548,14 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
{
// Not default
contentDis->close();
- if(contentBais != NULL) delete contentBais;
+ if(contentBais != nullptr) delete contentBais;
delete contentDis;
}
dis.close();
bais.reset();
- //if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; }
+ //if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; }
if(!gameRulesAdded) delete gameRules;
return true;
@@ -583,7 +583,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, vector<wstring> *tags
int attID = dis->readInt();
wstring value = dis->readUTF();
- if(rule != NULL) rule->addAttribute(tagsAndAtts->at(attID),value);
+ if(rule != nullptr) rule->addAttribute(tagsAndAtts->at(attID),value);
}
}
@@ -597,8 +597,8 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
auto it = tagIdMap->find(tagId);
if(it != tagIdMap->end()) tagVal = it->second;
- GameRuleDefinition *childRule = NULL;
- if(rule != NULL) childRule = rule->addChild(tagVal);
+ GameRuleDefinition *childRule = nullptr;
+ if(rule != nullptr) childRule = rule->addChild(tagVal);
readAttributes(dis,tagsAndAtts,childRule);
readChildren(dis,tagsAndAtts,tagIdMap,childRule);
@@ -607,7 +607,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
void GameRuleManager::processSchematics(LevelChunk *levelChunk)
{
- if(getLevelGenerationOptions() != NULL)
+ if(getLevelGenerationOptions() != nullptr)
{
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
levelGenOptions->processSchematics(levelChunk);
@@ -616,7 +616,7 @@ void GameRuleManager::processSchematics(LevelChunk *levelChunk)
void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk)
{
- if(getLevelGenerationOptions() != NULL)
+ if(getLevelGenerationOptions() != nullptr)
{
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
levelGenOptions->processSchematicsLighting(levelChunk);
@@ -701,21 +701,21 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen
{
unloadCurrentGameRules();
- m_currentGameRuleDefinitions = NULL;
+ m_currentGameRuleDefinitions = nullptr;
m_currentLevelGenerationOptions = levelGen;
- if(m_currentLevelGenerationOptions != NULL && m_currentLevelGenerationOptions->requiresGameRules() )
+ if(m_currentLevelGenerationOptions != nullptr && m_currentLevelGenerationOptions->requiresGameRules() )
{
m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules();
}
- if(m_currentLevelGenerationOptions != NULL)
+ if(m_currentLevelGenerationOptions != nullptr)
m_currentLevelGenerationOptions->reset_start();
}
LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
{
- if(m_currentGameRuleDefinitions != NULL && !key.empty() )
+ if(m_currentGameRuleDefinitions != nullptr && !key.empty() )
{
return m_currentGameRuleDefinitions->getString(key);
}
@@ -739,9 +739,9 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *
void GameRuleManager::unloadCurrentGameRules()
{
- if (m_currentLevelGenerationOptions != NULL)
+ if (m_currentLevelGenerationOptions != nullptr)
{
- if (m_currentGameRuleDefinitions != NULL
+ if (m_currentGameRuleDefinitions != nullptr
&& m_currentLevelGenerationOptions->isFromSave())
m_levelRules.removeLevelRule( m_currentGameRuleDefinitions );
@@ -757,6 +757,6 @@ void GameRuleManager::unloadCurrentGameRules()
}
}
- m_currentGameRuleDefinitions = NULL;
- m_currentLevelGenerationOptions = NULL;
+ m_currentGameRuleDefinitions = nullptr;
+ m_currentLevelGenerationOptions = nullptr;
}
diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp
index 59fde56e..2f121f4f 100644
--- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp
+++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp
@@ -44,8 +44,8 @@ bool JustGrSource::ready() { return true; }
LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
{
- m_spawnPos = NULL;
- m_stringTable = NULL;
+ m_spawnPos = nullptr;
+ m_stringTable = nullptr;
m_hasLoadedData = false;
@@ -56,7 +56,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
m_minY = INT_MAX;
m_bRequiresGameRules = false;
- m_pbBaseSaveData = NULL;
+ m_pbBaseSaveData = nullptr;
m_dwBaseSaveSize = 0;
m_parentDLCPack = parentPack;
@@ -66,7 +66,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
LevelGenerationOptions::~LevelGenerationOptions()
{
clearSchematics();
- if(m_spawnPos != NULL) delete m_spawnPos;
+ if(m_spawnPos != nullptr) delete m_spawnPos;
for (auto& it : m_schematicRules )
{
delete it;
@@ -141,26 +141,26 @@ void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
{
- GameRuleDefinition *rule = NULL;
+ GameRuleDefinition *rule = nullptr;
if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic)
{
rule = new ApplySchematicRuleDefinition(this);
- m_schematicRules.push_back((ApplySchematicRuleDefinition *)rule);
+ m_schematicRules.push_back(static_cast<ApplySchematicRuleDefinition *>(rule));
}
else if(ruleType == ConsoleGameRules::eGameRuleType_GenerateStructure)
{
rule = new ConsoleGenerateStructure();
- m_structureRules.push_back((ConsoleGenerateStructure *)rule);
+ m_structureRules.push_back(static_cast<ConsoleGenerateStructure *>(rule));
}
else if(ruleType == ConsoleGameRules::eGameRuleType_BiomeOverride)
{
rule = new BiomeOverride();
- m_biomeOverrides.push_back((BiomeOverride *)rule);
+ m_biomeOverrides.push_back(static_cast<BiomeOverride *>(rule));
}
else if(ruleType == ConsoleGameRules::eGameRuleType_StartFeature)
{
rule = new StartFeature();
- m_features.push_back((StartFeature *)rule);
+ m_features.push_back(static_cast<StartFeature *>(rule));
}
else
{
@@ -180,21 +180,21 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
}
else if(attributeName.compare(L"spawnX") == 0)
{
- if(m_spawnPos == NULL) m_spawnPos = new Pos();
+ if(m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->x = value;
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",value);
}
else if(attributeName.compare(L"spawnY") == 0)
{
- if(m_spawnPos == NULL) m_spawnPos = new Pos();
+ if(m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->y = value;
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",value);
}
else if(attributeName.compare(L"spawnZ") == 0)
{
- if(m_spawnPos == NULL) m_spawnPos = new Pos();
+ if(m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->z = value;
app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",value);
@@ -268,7 +268,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk)
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
{
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
- structureStart->postProcess(chunk->level, NULL, bb);
+ structureStart->postProcess(chunk->level, nullptr, bb);
delete bb;
}
}
@@ -353,7 +353,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f
return it->second;
}
- ConsoleSchematicFile *schematic = NULL;
+ ConsoleSchematicFile *schematic = nullptr;
byteArray data(pbData,dwLen);
ByteArrayInputStream bais(data);
DataInputStream dis(&bais);
@@ -366,7 +366,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f
ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &filename)
{
- ConsoleSchematicFile *schematic = NULL;
+ ConsoleSchematicFile *schematic = nullptr;
// If we have already loaded this, just return
auto it = m_schematics.find(filename);
if(it != m_schematics.end())
@@ -399,7 +399,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table)
LPCWSTR LevelGenerationOptions::getString(const wstring &key)
{
- if(m_stringTable == NULL)
+ if(m_stringTable == nullptr)
{
return L"";
}
@@ -456,7 +456,7 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
void LevelGenerationOptions::loadBaseSaveData()
{
int mountIndex = -1;
- if(m_parentDLCPack != NULL) mountIndex = m_parentDLCPack->GetDLCMountIndex();
+ if(m_parentDLCPack != nullptr) mountIndex = m_parentDLCPack->GetDLCMountIndex();
if(mountIndex > -1)
{
@@ -485,7 +485,7 @@ void LevelGenerationOptions::loadBaseSaveData()
int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask)
{
- LevelGenerationOptions *lgo = (LevelGenerationOptions *)pParam;
+ LevelGenerationOptions *lgo = static_cast<LevelGenerationOptions *>(pParam);
lgo->m_bLoadingData = false;
if(dwErr!=ERROR_SUCCESS)
{
@@ -499,7 +499,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
int gameRulesCount = lgo->m_parentDLCPack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader);
for(int i = 0; i < gameRulesCount; ++i)
{
- DLCGameRulesHeader *dlcFile = (DLCGameRulesHeader *) lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
+ DLCGameRulesHeader *dlcFile = static_cast<DLCGameRulesHeader *>(lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i));
if (!dlcFile->getGrfPath().empty())
{
@@ -513,10 +513,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
- NULL, // Unused
+ nullptr, // Unused
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
- NULL // Unsupported
+ nullptr // Unsupported
);
#else
const char *pchFilename=wstringtofilename(grf.getPath());
@@ -524,10 +524,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
- NULL, // Unused
+ nullptr, // Unused
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
- NULL // Unsupported
+ nullptr // Unsupported
);
#endif
@@ -536,7 +536,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
DWORD dwFileSize = grf.length();
DWORD bytesRead;
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
- BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
+ BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
if(bSuccess==FALSE)
{
app.FatalLoadError();
@@ -565,10 +565,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
- NULL, // Unused
+ nullptr, // Unused
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
- NULL // Unsupported
+ nullptr // Unsupported
);
#else
const char *pchFilename=wstringtofilename(save.getPath());
@@ -576,18 +576,18 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
- NULL, // Unused
+ nullptr, // Unused
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
- NULL // Unsupported
+ nullptr // Unsupported
);
#endif
if( fileHandle != INVALID_HANDLE_VALUE )
{
- DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL);
+ DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr);
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
- BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
+ BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
if(bSuccess==FALSE)
{
app.FatalLoadError();
@@ -624,8 +624,8 @@ void LevelGenerationOptions::reset_start()
void LevelGenerationOptions::reset_finish()
{
- //if (m_spawnPos) { delete m_spawnPos; m_spawnPos = NULL; }
- //if (m_stringTable) { delete m_stringTable; m_stringTable = NULL; }
+ //if (m_spawnPos) { delete m_spawnPos; m_spawnPos = nullptr; }
+ //if (m_stringTable) { delete m_stringTable; m_stringTable = nullptr; }
if (isFromDLC())
{
@@ -694,8 +694,8 @@ bool LevelGenerationOptions::ready() { return info()->ready(); }
void LevelGenerationOptions::setBaseSaveData(PBYTE pbData, DWORD dwSize) { m_pbBaseSaveData = pbData; m_dwBaseSaveSize = dwSize; }
PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; }
-bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != NULL; }
-void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; }
+bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != nullptr; }
+void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = nullptr; m_dwBaseSaveSize = 0; }
bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h
index cf669019..378ac6c5 100644
--- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h
+++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h
@@ -167,7 +167,7 @@ private:
bool m_bLoadingData;
public:
- LevelGenerationOptions(DLCPack *parentPack = NULL);
+ LevelGenerationOptions(DLCPack *parentPack = nullptr);
~LevelGenerationOptions();
virtual ConsoleGameRules::EGameRuleType getActionType();
@@ -202,7 +202,7 @@ public:
LevelRuleset *getRequiredGameRules();
void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile);
- bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = NULL);
+ bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = nullptr);
void loadStringTable(StringTable *table);
LPCWSTR getString(const wstring &key);
diff --git a/Minecraft.Client/Common/GameRules/LevelRuleset.cpp b/Minecraft.Client/Common/GameRules/LevelRuleset.cpp
index 658abe91..de17bacc 100644
--- a/Minecraft.Client/Common/GameRules/LevelRuleset.cpp
+++ b/Minecraft.Client/Common/GameRules/LevelRuleset.cpp
@@ -6,7 +6,7 @@
LevelRuleset::LevelRuleset()
{
- m_stringTable = NULL;
+ m_stringTable = nullptr;
}
LevelRuleset::~LevelRuleset()
@@ -26,11 +26,11 @@ void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
{
- GameRuleDefinition *rule = NULL;
+ GameRuleDefinition *rule = nullptr;
if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea)
{
rule = new NamedAreaRuleDefinition();
- m_areas.push_back((NamedAreaRuleDefinition *)rule);
+ m_areas.push_back(static_cast<NamedAreaRuleDefinition *>(rule));
}
else
{
@@ -46,7 +46,7 @@ void LevelRuleset::loadStringTable(StringTable *table)
LPCWSTR LevelRuleset::getString(const wstring &key)
{
- if(m_stringTable == NULL)
+ if(m_stringTable == nullptr)
{
return L"";
}
diff --git a/Minecraft.Client/Common/GameRules/StartFeature.cpp b/Minecraft.Client/Common/GameRules/StartFeature.cpp
index 904bce73..14b6d9c9 100644
--- a/Minecraft.Client/Common/GameRules/StartFeature.cpp
+++ b/Minecraft.Client/Common/GameRules/StartFeature.cpp
@@ -47,7 +47,7 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att
else if(attributeName.compare(L"feature") == 0)
{
int value = _fromString<int>(attributeValue);
- m_feature = (StructureFeature::EFeatureTypes)value;
+ m_feature = static_cast<StructureFeature::EFeatureTypes>(value);
app.DebugPrintf("StartFeature: Adding parameter feature=%d\n",m_feature);
}
else
@@ -58,6 +58,6 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att
bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation)
{
- if(orientation != NULL) *orientation = m_orientation;
+ if(orientation != nullptr) *orientation = m_orientation;
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
} \ No newline at end of file
diff --git a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp
index ec218c7a..99aee99b 100644
--- a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp
+++ b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp
@@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
m_health = 0;
m_food = 0;
- m_spawnPos = NULL;
+ m_spawnPos = nullptr;
m_yRot = 0.0f;
}
@@ -65,11 +65,11 @@ void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *child
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
{
- GameRuleDefinition *rule = NULL;
+ GameRuleDefinition *rule = nullptr;
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
{
rule = new AddItemRuleDefinition();
- m_items.push_back((AddItemRuleDefinition *)rule);
+ m_items.push_back(static_cast<AddItemRuleDefinition *>(rule));
}
else
{
@@ -84,21 +84,21 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons
{
if(attributeName.compare(L"spawnX") == 0)
{
- if(m_spawnPos == NULL) m_spawnPos = new Pos();
+ if(m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->x = value;
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n",value);
}
else if(attributeName.compare(L"spawnY") == 0)
{
- if(m_spawnPos == NULL) m_spawnPos = new Pos();
+ if(m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->y = value;
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n",value);
}
else if(attributeName.compare(L"spawnZ") == 0)
{
- if(m_spawnPos == NULL) m_spawnPos = new Pos();
+ if(m_spawnPos == nullptr) m_spawnPos = new Pos();
int value = _fromString<int>(attributeValue);
m_spawnPos->z = value;
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n",value);
@@ -148,7 +148,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
double z = player->z;
float yRot = player->yRot;
float xRot = player->xRot;
- if(m_spawnPos != NULL)
+ if(m_spawnPos != nullptr)
{
x = m_spawnPos->x;
y = m_spawnPos->y;
@@ -160,7 +160,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
yRot = m_yRot;
}
- if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
+ if(m_spawnPos != nullptr || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
for(auto& addItem : m_items)
{
diff --git a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp
index fa68ef6a..1f494691 100644
--- a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp
+++ b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp
@@ -33,11 +33,11 @@ void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *>
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
{
- GameRuleDefinition *rule = NULL;
+ GameRuleDefinition *rule = nullptr;
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
{
rule = new AddItemRuleDefinition();
- m_items.push_back((AddItemRuleDefinition *)rule);
+ m_items.push_back(static_cast<AddItemRuleDefinition *>(rule));
}
else
{
@@ -70,7 +70,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
{
- if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
+ if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr )
{
// Remove the current tile entity
level->removeTileEntity( worldX, worldY, worldZ );
@@ -81,7 +81,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
- if ( container != NULL )
+ if ( container != nullptr )
{
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
// Add items
diff --git a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp
index 3f6204af..3e61154f 100644
--- a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp
+++ b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp
@@ -46,7 +46,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
{
- if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
+ if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr )
{
// Remove the current tile entity
level->removeTileEntity( worldX, worldY, worldZ );
@@ -59,7 +59,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
#ifndef _CONTENT_PACKAGE
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);
#endif
- if( entity != NULL )
+ if( entity != nullptr )
{
entity->setEntityId(m_entityId);
}