Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
This commit is contained in:
@@ -46,7 +46,7 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool enchanted = false;
|
||||
if (item != nullptr)
|
||||
if (item != NULL)
|
||||
{
|
||||
// 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 != nullptr && e->category->canEnchant(item->getItem()))
|
||||
if(e != NULL && e->category->canEnchant(item->getItem()))
|
||||
{
|
||||
int level = min(e->getMaxLevel(), m_enchantmentLevel);
|
||||
item->enchant(e, m_enchantmentLevel);
|
||||
|
||||
@@ -41,11 +41,11 @@ void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||
|
||||
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment)
|
||||
{
|
||||
rule = new AddEnchantmentRuleDefinition();
|
||||
m_enchantments.push_back(static_cast<AddEnchantmentRuleDefinition *>(rule));
|
||||
m_enchantments.push_back((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] != nullptr)
|
||||
if(Item::items[m_itemId] != NULL)
|
||||
{
|
||||
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||
shared_ptr<ItemInstance> newItem = std::make_shared<ItemInstance>(m_itemId, quantity, m_auxValue);
|
||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new 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) != nullptr)
|
||||
else if(dynamic_pointer_cast<Inventory>(container) != NULL)
|
||||
{
|
||||
added = dynamic_pointer_cast<Inventory>(container)->add(newItem);
|
||||
}
|
||||
|
||||
@@ -13,20 +13,20 @@ ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(LevelGenerationOption
|
||||
{
|
||||
m_levelGenOptions = levelGenOptions;
|
||||
m_location = Vec3::newPermanent(0,0,0);
|
||||
m_locationBox = nullptr;
|
||||
m_locationBox = NULL;
|
||||
m_totalBlocksChanged = 0;
|
||||
m_totalBlocksChangedLighting = 0;
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||
m_completed = false;
|
||||
m_dimension = 0;
|
||||
m_schematic = nullptr;
|
||||
m_schematic = NULL;
|
||||
}
|
||||
|
||||
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition()
|
||||
{
|
||||
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
|
||||
if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||
m_schematic = nullptr;
|
||||
m_schematic = NULL;
|
||||
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( static_cast<int>(abs(m_location->x))%2 != 0) m_location->x -=1;
|
||||
if( ((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( static_cast<int>(abs(m_location->y))%2 != 0) m_location->y -= 1;
|
||||
if( ((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(static_cast<int>(abs(m_location->z))%2 != 0) m_location->z -= 1;
|
||||
if(((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 = static_cast<int>(quad + 0.5f);
|
||||
degrees = (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 == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
if(m_schematic == NULL) 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 == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
if(m_locationBox == nullptr) updateLocationBox();
|
||||
if(m_locationBox == NULL) 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 = nullptr;
|
||||
//m_schematic = NULL;
|
||||
}
|
||||
}
|
||||
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 == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
if(m_locationBox == nullptr) updateLocationBox();
|
||||
if(m_locationBox == NULL) 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 = nullptr;
|
||||
//m_schematic = NULL;
|
||||
}
|
||||
}
|
||||
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 == nullptr ) updateLocationBox();
|
||||
if( m_locationBox == NULL ) updateLocationBox();
|
||||
return m_locationBox->intersects(x0,y0,z0,x1,y1,z1);
|
||||
}
|
||||
|
||||
int ApplySchematicRuleDefinition::getMinY()
|
||||
{
|
||||
if( m_locationBox == nullptr ) updateLocationBox();
|
||||
if( m_locationBox == NULL ) updateLocationBox();
|
||||
return m_locationBox->y0;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn
|
||||
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
if(item != nullptr && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
||||
if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
||||
{
|
||||
if(!getComplete(rule))
|
||||
{
|
||||
@@ -90,21 +90,13 @@ 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);
|
||||
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)
|
||||
));
|
||||
}
|
||||
}
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return statusChanged;
|
||||
@@ -114,7 +106,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 != nullptr)
|
||||
if(item != NULL)
|
||||
{
|
||||
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"\"";
|
||||
|
||||
@@ -36,7 +36,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||
progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
|
||||
}
|
||||
}
|
||||
if(rule->getConnection() != nullptr)
|
||||
if(rule->getConnection() != NULL)
|
||||
{
|
||||
PacketData data;
|
||||
data.goal = goal;
|
||||
@@ -45,20 +45,20 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||
int icon = -1;
|
||||
int auxValue = 0;
|
||||
|
||||
if(m_lastRuleStatusChanged != nullptr)
|
||||
if(m_lastRuleStatusChanged != NULL)
|
||||
{
|
||||
icon = m_lastRuleStatusChanged->getIcon();
|
||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||
m_lastRuleStatusChanged = nullptr;
|
||||
m_lastRuleStatusChanged = NULL;
|
||||
}
|
||||
rule->getConnection()->send(std::make_shared<UpdateGameRuleProgressPacket>(getActionType(), this->m_descriptionId, icon, auxValue, 0, &data, sizeof(PacketData)));
|
||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new 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 = static_cast<PacketData *>(data);
|
||||
PacketData *values = (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));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
CompoundGameRuleDefinition::CompoundGameRuleDefinition()
|
||||
{
|
||||
m_lastRuleStatusChanged = nullptr;
|
||||
m_lastRuleStatusChanged = NULL;
|
||||
}
|
||||
|
||||
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
|
||||
@@ -26,7 +26,7 @@ void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *child
|
||||
|
||||
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
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 != nullptr) m_children.push_back(rule);
|
||||
if(rule != NULL) m_children.push_back(rule);
|
||||
return rule;
|
||||
}
|
||||
|
||||
void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule)
|
||||
{
|
||||
GameRule *newRule = nullptr;
|
||||
GameRule *newRule = NULL;
|
||||
int i = 0;
|
||||
for (auto& it : m_children )
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
|
||||
{
|
||||
m_x = m_y = m_z = 0;
|
||||
boundingBox = nullptr;
|
||||
boundingBox = NULL;
|
||||
orientation = Direction::NORTH;
|
||||
m_dimension = 0;
|
||||
}
|
||||
@@ -25,26 +25,26 @@ void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *childre
|
||||
|
||||
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox)
|
||||
{
|
||||
rule = new XboxStructureActionGenerateBox();
|
||||
m_actions.push_back(static_cast<XboxStructureActionGenerateBox *>(rule));
|
||||
m_actions.push_back((XboxStructureActionGenerateBox *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceBlock)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceBlock();
|
||||
m_actions.push_back(static_cast<XboxStructureActionPlaceBlock *>(rule));
|
||||
m_actions.push_back((XboxStructureActionPlaceBlock *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceContainer)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceContainer();
|
||||
m_actions.push_back(static_cast<XboxStructureActionPlaceContainer *>(rule));
|
||||
m_actions.push_back((XboxStructureActionPlaceContainer *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceSpawner)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceSpawner();
|
||||
m_actions.push_back(static_cast<XboxStructureActionPlaceSpawner *>(rule));
|
||||
m_actions.push_back((XboxStructureActionPlaceSpawner *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -112,7 +112,7 @@ void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const
|
||||
|
||||
BoundingBox* ConsoleGenerateStructure::getBoundingBox()
|
||||
{
|
||||
if(boundingBox == nullptr)
|
||||
if(boundingBox == NULL)
|
||||
{
|
||||
// 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 = static_cast<XboxStructureActionGenerateBox *>(action);
|
||||
XboxStructureActionGenerateBox *genBox = (XboxStructureActionGenerateBox *)action;
|
||||
genBox->generateBoxInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceBlock:
|
||||
{
|
||||
XboxStructureActionPlaceBlock *pPlaceBlock = static_cast<XboxStructureActionPlaceBlock *>(action);
|
||||
XboxStructureActionPlaceBlock *pPlaceBlock = (XboxStructureActionPlaceBlock *)action;
|
||||
pPlaceBlock->placeBlockInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceContainer:
|
||||
{
|
||||
XboxStructureActionPlaceContainer *pPlaceContainer = static_cast<XboxStructureActionPlaceContainer *>(action);
|
||||
XboxStructureActionPlaceContainer *pPlaceContainer = (XboxStructureActionPlaceContainer *)action;
|
||||
pPlaceContainer->placeContainerInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceSpawner:
|
||||
{
|
||||
XboxStructureActionPlaceSpawner *pPlaceSpawner = static_cast<XboxStructureActionPlaceSpawner *>(action);
|
||||
XboxStructureActionPlaceSpawner *pPlaceSpawner = (XboxStructureActionPlaceSpawner *)action;
|
||||
pPlaceSpawner->placeSpawnerInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
virtual int getMinY();
|
||||
|
||||
EStructurePiece GetType() { return static_cast<EStructurePiece>(0); }
|
||||
EStructurePiece GetType() { return (EStructurePiece)0; }
|
||||
void addAdditonalSaveData(CompoundTag *tag) {}
|
||||
void readAdditonalSaveData(CompoundTag *tag) {}
|
||||
};
|
||||
@@ -16,18 +16,18 @@ ConsoleSchematicFile::ConsoleSchematicFile()
|
||||
{
|
||||
m_xSize = m_ySize = m_zSize = 0;
|
||||
m_refCount = 1;
|
||||
m_data.data = nullptr;
|
||||
m_data.data = NULL;
|
||||
}
|
||||
|
||||
ConsoleSchematicFile::~ConsoleSchematicFile()
|
||||
{
|
||||
app.DebugPrintf("Deleting schematic file\n");
|
||||
if(m_data.data != nullptr) delete [] m_data.data;
|
||||
if(m_data.data != NULL) delete [] m_data.data;
|
||||
}
|
||||
|
||||
void ConsoleSchematicFile::save(DataOutputStream *dos)
|
||||
{
|
||||
if(dos != nullptr)
|
||||
if(dos != NULL)
|
||||
{
|
||||
dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||
|
||||
@@ -52,7 +52,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos)
|
||||
|
||||
void ConsoleSchematicFile::load(DataInputStream *dis)
|
||||
{
|
||||
if(dis != nullptr)
|
||||
if(dis != NULL)
|
||||
{
|
||||
// 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 = static_cast<Compression::ECompressionTypes>(dis->readByte());
|
||||
compressionType = (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 != nullptr)
|
||||
if(m_data.data != NULL)
|
||||
{
|
||||
delete [] m_data.data;
|
||||
m_data.data = nullptr;
|
||||
delete [] m_data.data;
|
||||
m_data.data = NULL;
|
||||
}
|
||||
|
||||
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 != nullptr)
|
||||
if (tileEntityTags != NULL)
|
||||
{
|
||||
for (int i = 0; i < tileEntityTags->size(); i++)
|
||||
{
|
||||
CompoundTag *teTag = tileEntityTags->get(i);
|
||||
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
||||
|
||||
if(te == nullptr)
|
||||
if(te == NULL)
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
app.DebugPrintf("ConsoleSchematicFile has read a nullptr tile entity\n");
|
||||
app.DebugPrintf("ConsoleSchematicFile has read a NULL 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 != nullptr)
|
||||
if (entityTags != NULL)
|
||||
{
|
||||
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 = 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;
|
||||
}
|
||||
{
|
||||
x = ((IntTag *) eTag->get(L"TileX") )->data;
|
||||
y = ((IntTag *) eTag->get(L"TileY") )->data;
|
||||
z = ((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),static_cast<CompoundTag *>(eTag->copy())));
|
||||
m_entities.push_back( pair<Vec3 *, CompoundTag *>(Vec3::newPermanent(x,y,z),(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( static_cast<CompoundTag *>((it).second->copy()) );
|
||||
entityTags->add( (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, static_cast<double>(chunk->x)*16));
|
||||
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, static_cast<double>((xStart >> 4) << 4) + 16));
|
||||
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 yStart = destinationBox->y0;
|
||||
int yEnd = destinationBox->y1;
|
||||
if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight;
|
||||
|
||||
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));
|
||||
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));
|
||||
|
||||
#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( static_cast<int>(targetX) & 15, static_cast<int>(targetY) & 15, static_cast<int>(targetZ) & 15 );
|
||||
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
|
||||
|
||||
if ( teCopy != nullptr )
|
||||
{
|
||||
if ( teCopy != NULL )
|
||||
{
|
||||
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, nullptr);
|
||||
shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
|
||||
|
||||
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 != nullptr) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||
if(dos != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION);
|
||||
|
||||
if(dos != nullptr) dos->writeByte(compressionType);
|
||||
if(dos != NULL) dos->writeByte(compressionType);
|
||||
|
||||
//Write xSize
|
||||
if(dos != nullptr) dos->writeInt(xSize);
|
||||
if(dos != NULL) dos->writeInt(xSize);
|
||||
|
||||
//Write ySize
|
||||
if(dos != nullptr) dos->writeInt(ySize);
|
||||
if(dos != NULL) dos->writeInt(ySize);
|
||||
|
||||
//Write zSize
|
||||
if(dos != nullptr) dos->writeInt(zSize);
|
||||
if(dos != NULL) 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 != nullptr) dos->writeInt(inputSize);
|
||||
if(dos != nullptr) dos->write(buffer);
|
||||
if(dos != NULL) dos->writeInt(inputSize);
|
||||
if(dos != NULL) 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) )
|
||||
{
|
||||
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;
|
||||
{
|
||||
((IntTag *) eTag->get(L"TileX") )->data -= xStart;
|
||||
((IntTag *) eTag->get(L"TileY") )->data -= yStart;
|
||||
((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 != nullptr) NbtIo::write(&tag,dos);
|
||||
if(dos != NULL) 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)
|
||||
|
||||
@@ -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 = nullptr);
|
||||
GameRule(GameRuleDefinition *definition, Connection *connection = NULL);
|
||||
virtual ~GameRule();
|
||||
|
||||
Connection *getConnection() { return m_connection; }
|
||||
|
||||
@@ -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 nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
|
||||
@@ -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 = nullptr, int dataLength = 0);
|
||||
static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = NULL, int dataLength = 0);
|
||||
|
||||
};
|
||||
@@ -85,24 +85,24 @@ const WCHAR *GameRuleManager::wchAttrNameA[] =
|
||||
|
||||
GameRuleManager::GameRuleManager()
|
||||
{
|
||||
m_currentGameRuleDefinitions = nullptr;
|
||||
m_currentLevelGenerationOptions = nullptr;
|
||||
m_currentGameRuleDefinitions = NULL;
|
||||
m_currentLevelGenerationOptions = NULL;
|
||||
}
|
||||
|
||||
void GameRuleManager::loadGameRules(DLCPack *pack)
|
||||
{
|
||||
StringTable *strings = nullptr;
|
||||
StringTable *strings = NULL;
|
||||
|
||||
if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc"))
|
||||
{
|
||||
DLCLocalisationFile *localisationFile = static_cast<DLCLocalisationFile *>(pack->getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc"));
|
||||
DLCLocalisationFile *localisationFile = (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 = static_cast<DLCGameRulesHeader *>(pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i));
|
||||
DLCGameRulesHeader *dlcHeader = (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 = static_cast<DLCGameRulesFile *>(pack->getFile(DLCManager::e_DLCType_GameRules, i));
|
||||
DLCGameRulesFile *dlcFile = (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( static_cast<Compression::ECompressionTypes>(compression_type) );
|
||||
Compression::getCompression()->SetDecompressionType( (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 == nullptr &&
|
||||
m_currentLevelGenerationOptions == nullptr)
|
||||
if (m_currentGameRuleDefinitions == NULL &&
|
||||
m_currentLevelGenerationOptions == NULL)
|
||||
{
|
||||
app.DebugPrintf("GameRuleManager:: Nothing here to save.");
|
||||
*dOut = nullptr;
|
||||
*dOut = NULL;
|
||||
*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 == nullptr)
|
||||
if (m_currentGameRuleDefinitions == NULL)
|
||||
{
|
||||
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 == nullptr)
|
||||
if (st == NULL)
|
||||
{
|
||||
app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == nullptr!");
|
||||
app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == NULL!");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
*dSize = baos.buf.length;
|
||||
*dOut = baos.buf.data;
|
||||
|
||||
baos.buf.data = nullptr;
|
||||
baos.buf.data = NULL;
|
||||
|
||||
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 = nullptr;
|
||||
DataInputStream *contentDis = nullptr;
|
||||
ByteArrayInputStream *contentBais = NULL;
|
||||
DataInputStream *contentDis = NULL;
|
||||
|
||||
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 < static_cast<int>(ConsoleGameRules::eGameRuleType_Count); ++type)
|
||||
for(int type = (int)ConsoleGameRules::eGameRuleType_Root; type < (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, static_cast<ConsoleGameRules::EGameRuleType>(type)) );
|
||||
tagIdMap.insert( unordered_map<int, ConsoleGameRules::EGameRuleType>::value_type(i, (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 = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
|
||||
if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions)
|
||||
{
|
||||
@@ -548,14 +548,14 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
{
|
||||
// Not default
|
||||
contentDis->close();
|
||||
if(contentBais != nullptr) delete contentBais;
|
||||
if(contentBais != NULL) delete contentBais;
|
||||
delete contentDis;
|
||||
}
|
||||
|
||||
dis.close();
|
||||
bais.reset();
|
||||
|
||||
//if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; }
|
||||
//if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; }
|
||||
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 != nullptr) rule->addAttribute(tagsAndAtts->at(attID),value);
|
||||
if(rule != NULL) 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 = nullptr;
|
||||
if(rule != nullptr) childRule = rule->addChild(tagVal);
|
||||
GameRuleDefinition *childRule = NULL;
|
||||
if(rule != NULL) 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() != nullptr)
|
||||
if(getLevelGenerationOptions() != NULL)
|
||||
{
|
||||
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
|
||||
levelGenOptions->processSchematics(levelChunk);
|
||||
@@ -616,7 +616,7 @@ void GameRuleManager::processSchematics(LevelChunk *levelChunk)
|
||||
|
||||
void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk)
|
||||
{
|
||||
if(getLevelGenerationOptions() != nullptr)
|
||||
if(getLevelGenerationOptions() != NULL)
|
||||
{
|
||||
LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions();
|
||||
levelGenOptions->processSchematicsLighting(levelChunk);
|
||||
@@ -701,21 +701,21 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen
|
||||
{
|
||||
unloadCurrentGameRules();
|
||||
|
||||
m_currentGameRuleDefinitions = nullptr;
|
||||
m_currentGameRuleDefinitions = NULL;
|
||||
m_currentLevelGenerationOptions = levelGen;
|
||||
|
||||
if(m_currentLevelGenerationOptions != nullptr && m_currentLevelGenerationOptions->requiresGameRules() )
|
||||
if(m_currentLevelGenerationOptions != NULL && m_currentLevelGenerationOptions->requiresGameRules() )
|
||||
{
|
||||
m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules();
|
||||
}
|
||||
|
||||
if(m_currentLevelGenerationOptions != nullptr)
|
||||
if(m_currentLevelGenerationOptions != NULL)
|
||||
m_currentLevelGenerationOptions->reset_start();
|
||||
}
|
||||
|
||||
LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
|
||||
{
|
||||
if(m_currentGameRuleDefinitions != nullptr && !key.empty() )
|
||||
if(m_currentGameRuleDefinitions != NULL && !key.empty() )
|
||||
{
|
||||
return m_currentGameRuleDefinitions->getString(key);
|
||||
}
|
||||
@@ -739,9 +739,9 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *
|
||||
|
||||
void GameRuleManager::unloadCurrentGameRules()
|
||||
{
|
||||
if (m_currentLevelGenerationOptions != nullptr)
|
||||
if (m_currentLevelGenerationOptions != NULL)
|
||||
{
|
||||
if (m_currentGameRuleDefinitions != nullptr
|
||||
if (m_currentGameRuleDefinitions != NULL
|
||||
&& m_currentLevelGenerationOptions->isFromSave())
|
||||
m_levelRules.removeLevelRule( m_currentGameRuleDefinitions );
|
||||
|
||||
@@ -757,6 +757,6 @@ void GameRuleManager::unloadCurrentGameRules()
|
||||
}
|
||||
}
|
||||
|
||||
m_currentGameRuleDefinitions = nullptr;
|
||||
m_currentLevelGenerationOptions = nullptr;
|
||||
m_currentGameRuleDefinitions = NULL;
|
||||
m_currentLevelGenerationOptions = NULL;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ bool JustGrSource::ready() { return true; }
|
||||
|
||||
LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||
{
|
||||
m_spawnPos = nullptr;
|
||||
m_stringTable = nullptr;
|
||||
m_spawnPos = NULL;
|
||||
m_stringTable = NULL;
|
||||
|
||||
m_hasLoadedData = false;
|
||||
|
||||
@@ -56,7 +56,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||
m_minY = INT_MAX;
|
||||
m_bRequiresGameRules = false;
|
||||
|
||||
m_pbBaseSaveData = nullptr;
|
||||
m_pbBaseSaveData = NULL;
|
||||
m_dwBaseSaveSize = 0;
|
||||
|
||||
m_parentDLCPack = parentPack;
|
||||
@@ -66,7 +66,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||
LevelGenerationOptions::~LevelGenerationOptions()
|
||||
{
|
||||
clearSchematics();
|
||||
if(m_spawnPos != nullptr) delete m_spawnPos;
|
||||
if(m_spawnPos != NULL) 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 = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic)
|
||||
{
|
||||
rule = new ApplySchematicRuleDefinition(this);
|
||||
m_schematicRules.push_back(static_cast<ApplySchematicRuleDefinition *>(rule));
|
||||
m_schematicRules.push_back((ApplySchematicRuleDefinition *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_GenerateStructure)
|
||||
{
|
||||
rule = new ConsoleGenerateStructure();
|
||||
m_structureRules.push_back(static_cast<ConsoleGenerateStructure *>(rule));
|
||||
m_structureRules.push_back((ConsoleGenerateStructure *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_BiomeOverride)
|
||||
{
|
||||
rule = new BiomeOverride();
|
||||
m_biomeOverrides.push_back(static_cast<BiomeOverride *>(rule));
|
||||
m_biomeOverrides.push_back((BiomeOverride *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_StartFeature)
|
||||
{
|
||||
rule = new StartFeature();
|
||||
m_features.push_back(static_cast<StartFeature *>(rule));
|
||||
m_features.push_back((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 == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) 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 == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) 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 == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) 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, nullptr, bb);
|
||||
structureStart->postProcess(chunk->level, NULL, bb);
|
||||
delete bb;
|
||||
}
|
||||
}
|
||||
@@ -353,7 +353,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f
|
||||
return it->second;
|
||||
}
|
||||
|
||||
ConsoleSchematicFile *schematic = nullptr;
|
||||
ConsoleSchematicFile *schematic = NULL;
|
||||
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 = nullptr;
|
||||
ConsoleSchematicFile *schematic = NULL;
|
||||
// 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 == nullptr)
|
||||
if(m_stringTable == NULL)
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
@@ -456,7 +456,7 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
|
||||
void LevelGenerationOptions::loadBaseSaveData()
|
||||
{
|
||||
int mountIndex = -1;
|
||||
if(m_parentDLCPack != nullptr) mountIndex = m_parentDLCPack->GetDLCMountIndex();
|
||||
if(m_parentDLCPack != NULL) 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 = static_cast<LevelGenerationOptions *>(pParam);
|
||||
LevelGenerationOptions *lgo = (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 = static_cast<DLCGameRulesHeader *>(lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i));
|
||||
DLCGameRulesHeader *dlcFile = (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...
|
||||
nullptr, // Unused
|
||||
NULL, // 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
|
||||
nullptr // Unsupported
|
||||
NULL // 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...
|
||||
nullptr, // Unused
|
||||
NULL, // 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
|
||||
nullptr // Unsupported
|
||||
NULL // 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,nullptr);
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
|
||||
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...
|
||||
nullptr, // Unused
|
||||
NULL, // 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
|
||||
nullptr // Unsupported
|
||||
NULL // 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...
|
||||
nullptr, // Unused
|
||||
NULL, // 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
|
||||
nullptr // Unsupported
|
||||
NULL // Unsupported
|
||||
);
|
||||
#endif
|
||||
|
||||
if( fileHandle != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr);
|
||||
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL);
|
||||
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr);
|
||||
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
|
||||
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 = nullptr; }
|
||||
//if (m_stringTable) { delete m_stringTable; m_stringTable = nullptr; }
|
||||
//if (m_spawnPos) { delete m_spawnPos; m_spawnPos = NULL; }
|
||||
//if (m_stringTable) { delete m_stringTable; m_stringTable = NULL; }
|
||||
|
||||
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 != nullptr; }
|
||||
void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = nullptr; m_dwBaseSaveSize = 0; }
|
||||
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::hasLoadedData() { return m_hasLoadedData; }
|
||||
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
|
||||
|
||||
@@ -167,7 +167,7 @@ private:
|
||||
bool m_bLoadingData;
|
||||
|
||||
public:
|
||||
LevelGenerationOptions(DLCPack *parentPack = nullptr);
|
||||
LevelGenerationOptions(DLCPack *parentPack = NULL);
|
||||
~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 = nullptr);
|
||||
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = NULL);
|
||||
|
||||
void loadStringTable(StringTable *table);
|
||||
LPCWSTR getString(const wstring &key);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
LevelRuleset::LevelRuleset()
|
||||
{
|
||||
m_stringTable = nullptr;
|
||||
m_stringTable = NULL;
|
||||
}
|
||||
|
||||
LevelRuleset::~LevelRuleset()
|
||||
@@ -26,11 +26,11 @@ void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
|
||||
|
||||
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea)
|
||||
{
|
||||
rule = new NamedAreaRuleDefinition();
|
||||
m_areas.push_back(static_cast<NamedAreaRuleDefinition *>(rule));
|
||||
m_areas.push_back((NamedAreaRuleDefinition *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -46,7 +46,7 @@ void LevelRuleset::loadStringTable(StringTable *table)
|
||||
|
||||
LPCWSTR LevelRuleset::getString(const wstring &key)
|
||||
{
|
||||
if(m_stringTable == nullptr)
|
||||
if(m_stringTable == NULL)
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
|
||||
@@ -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 = static_cast<StructureFeature::EFeatureTypes>(value);
|
||||
m_feature = (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 != nullptr) *orientation = m_orientation;
|
||||
if(orientation != NULL) *orientation = m_orientation;
|
||||
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
|
||||
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
||||
m_health = 0;
|
||||
m_food = 0;
|
||||
m_spawnPos = nullptr;
|
||||
m_spawnPos = NULL;
|
||||
m_yRot = 0.0f;
|
||||
}
|
||||
|
||||
@@ -65,11 +65,11 @@ void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *child
|
||||
|
||||
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
|
||||
{
|
||||
rule = new AddItemRuleDefinition();
|
||||
m_items.push_back(static_cast<AddItemRuleDefinition *>(rule));
|
||||
m_items.push_back((AddItemRuleDefinition *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -84,21 +84,21 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons
|
||||
{
|
||||
if(attributeName.compare(L"spawnX") == 0)
|
||||
{
|
||||
if(m_spawnPos == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) 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 == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) 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 == nullptr) m_spawnPos = new Pos();
|
||||
if(m_spawnPos == NULL) 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 != nullptr)
|
||||
if(m_spawnPos != NULL)
|
||||
{
|
||||
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 != nullptr || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
||||
if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
||||
|
||||
for(auto& addItem : m_items)
|
||||
{
|
||||
|
||||
@@ -33,11 +33,11 @@ void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *>
|
||||
|
||||
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = nullptr;
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddItem)
|
||||
{
|
||||
rule = new AddItemRuleDefinition();
|
||||
m_items.push_back(static_cast<AddItemRuleDefinition *>(rule));
|
||||
m_items.push_back((AddItemRuleDefinition *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -70,7 +70,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
||||
|
||||
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
||||
{
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr )
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
|
||||
{
|
||||
// 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 != nullptr )
|
||||
if ( container != NULL )
|
||||
{
|
||||
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
|
||||
// Add items
|
||||
|
||||
@@ -46,7 +46,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
|
||||
|
||||
if ( chunkBB->isInside( worldX, worldY, worldZ ) )
|
||||
{
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr )
|
||||
if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL )
|
||||
{
|
||||
// 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 != nullptr )
|
||||
if( entity != NULL )
|
||||
{
|
||||
entity->setEntityId(m_entityId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user