Remove AUTO_VAR macro and _toString function (#592)
This commit is contained in:
@@ -14,10 +14,10 @@ void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId);
|
||||
dos->writeUTF( _toString( m_enchantmentId ) );
|
||||
dos->writeUTF( std::to_wstring( m_enchantmentId ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentLevel);
|
||||
dos->writeUTF( _toString( m_enchantmentLevel ) );
|
||||
dos->writeUTF( std::to_wstring( m_enchantmentLevel ) );
|
||||
}
|
||||
|
||||
void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
@@ -50,7 +50,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
// 4J-JEV: Ripped code from enchantmenthelpers
|
||||
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
|
||||
if (item->id == Item::enchantedBook_Id)
|
||||
if (item->id == Item::enchantedBook_Id)
|
||||
{
|
||||
Item::enchantedBook->addEnchantment( item, new EnchantmentInstance(m_enchantmentId, m_enchantmentLevel) );
|
||||
}
|
||||
|
||||
@@ -17,26 +17,26 @@ void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
||||
dos->writeUTF( _toString( m_itemId ) );
|
||||
dos->writeUTF( std::to_wstring( m_itemId ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
||||
dos->writeUTF( _toString( m_quantity ) );
|
||||
dos->writeUTF( std::to_wstring( m_quantity ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
||||
dos->writeUTF( _toString( m_auxValue ) );
|
||||
dos->writeUTF( std::to_wstring( m_auxValue ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
||||
dos->writeUTF( _toString( m_dataTag ) );
|
||||
dos->writeUTF( std::to_wstring( m_dataTag ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot);
|
||||
dos->writeUTF( _toString( m_slot ) );
|
||||
dos->writeUTF( std::to_wstring( m_slot ) );
|
||||
}
|
||||
|
||||
void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren( children );
|
||||
for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++)
|
||||
children->push_back( *it );
|
||||
for ( const auto& it : m_enchantments )
|
||||
children->push_back( it );
|
||||
}
|
||||
|
||||
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
@@ -99,13 +99,13 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
|
||||
bool added = false;
|
||||
if(Item::items[m_itemId] != NULL)
|
||||
{
|
||||
int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||
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) );
|
||||
newItem->set4JData(m_dataTag);
|
||||
|
||||
for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)
|
||||
for( auto& it : m_enchantments )
|
||||
{
|
||||
(*it)->enchantItem(newItem);
|
||||
it->enchantItem(newItem);
|
||||
}
|
||||
|
||||
if(m_slot >= 0 && m_slot < container->getContainerSize() )
|
||||
|
||||
@@ -37,19 +37,19 @@ void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename);
|
||||
dos->writeUTF(m_schematicName);
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_location->x));
|
||||
dos->writeUTF(std::to_wstring(m_location->x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_location->y));
|
||||
dos->writeUTF(std::to_wstring(m_location->y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_location->z));
|
||||
dos->writeUTF(std::to_wstring(m_location->z));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot);
|
||||
|
||||
switch (m_rotation)
|
||||
{
|
||||
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(_toString( 0 )); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(_toString( 90 )); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(_toString( 180 )); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(_toString( 270 )); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(L"0"); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(L"90"); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(L"180"); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(L"270"); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter rot=%d\n",m_rotation);
|
||||
}
|
||||
else if(attributeName.compare(L"dim") == 0)
|
||||
@@ -160,7 +160,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *
|
||||
{
|
||||
if( m_completed ) return;
|
||||
if(chunk->level->dimension->id != m_dimension) return;
|
||||
|
||||
|
||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
@@ -199,7 +199,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve
|
||||
{
|
||||
if( m_completed ) return;
|
||||
if(chunk->level->dimension->id != m_dimension) return;
|
||||
|
||||
|
||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
|
||||
dos->writeUTF(_toString(m_biomeId));
|
||||
dos->writeUTF(std::to_wstring(m_biomeId));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
||||
dos->writeUTF(_toString(m_tile));
|
||||
dos->writeUTF(std::to_wstring(m_tile));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId);
|
||||
dos->writeUTF(_toString(m_topTile));
|
||||
dos->writeUTF(std::to_wstring(m_topTile));
|
||||
}
|
||||
|
||||
void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
|
||||
@@ -22,13 +22,13 @@ void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numA
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
||||
dos->writeUTF( _toString( m_itemId ) );
|
||||
dos->writeUTF( std::to_wstring( m_itemId ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
||||
dos->writeUTF( _toString( m_auxValue ) );
|
||||
dos->writeUTF( std::to_wstring( m_auxValue ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
||||
dos->writeUTF( _toString( m_quantity ) );
|
||||
dos->writeUTF( std::to_wstring( m_quantity ) );
|
||||
}
|
||||
|
||||
void CollectItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
@@ -108,9 +108,9 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
|
||||
wstring xml = L"";
|
||||
if(item != NULL)
|
||||
{
|
||||
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
|
||||
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + _toString<int>(item->getAuxValue()) + L"\"";
|
||||
if(item->get4JData() != 0) xml += L" dataTag=\"" + _toString<int>(item->get4JData()) + L"\"";
|
||||
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"\"";
|
||||
if(item->get4JData() != 0) xml += L" dataTag=\"" + std::to_wstring(item->get4JData()) + L"\"";
|
||||
xml += L"/>\n";
|
||||
}
|
||||
return xml;
|
||||
|
||||
@@ -28,12 +28,12 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||
{
|
||||
int goal = 0;
|
||||
int progress = 0;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
for (auto& it : rule->m_parameters )
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
if(it.second.isPointer)
|
||||
{
|
||||
goal += it->second.gr->getGameRuleDefinition()->getGoal();
|
||||
progress += it->second.gr->getGameRuleDefinition()->getProgress(it->second.gr);
|
||||
goal += it.second.gr->getGameRuleDefinition()->getGoal();
|
||||
progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
|
||||
}
|
||||
}
|
||||
if(rule->getConnection() != NULL)
|
||||
@@ -44,9 +44,9 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||
|
||||
int icon = -1;
|
||||
int auxValue = 0;
|
||||
|
||||
|
||||
if(m_lastRuleStatusChanged != NULL)
|
||||
{
|
||||
{
|
||||
icon = m_lastRuleStatusChanged->getIcon();
|
||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||
m_lastRuleStatusChanged = NULL;
|
||||
@@ -60,7 +60,7 @@ wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &desc
|
||||
{
|
||||
PacketData *values = (PacketData *)data;
|
||||
wstring newDesc = description;
|
||||
newDesc = replaceAll(newDesc,L"{*progress*}",_toString<int>(values->progress));
|
||||
newDesc = replaceAll(newDesc,L"{*goal*}",_toString<int>(values->goal));
|
||||
newDesc = replaceAll(newDesc,L"{*progress*}",std::to_wstring(values->progress));
|
||||
newDesc = replaceAll(newDesc,L"{*goal*}",std::to_wstring(values->goal));
|
||||
return newDesc;
|
||||
}
|
||||
@@ -11,17 +11,17 @@ CompoundGameRuleDefinition::CompoundGameRuleDefinition()
|
||||
|
||||
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
|
||||
{
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
for (auto it : m_children )
|
||||
{
|
||||
delete (*it);
|
||||
delete it;
|
||||
}
|
||||
}
|
||||
|
||||
void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren(children);
|
||||
for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++)
|
||||
children->push_back(*it);
|
||||
for (auto& it : m_children )
|
||||
children->push_back(it);
|
||||
}
|
||||
|
||||
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
@@ -40,7 +40,7 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame
|
||||
rule = new UseTileRuleDefinition();
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule)
|
||||
{
|
||||
{
|
||||
rule = new UpdatePlayerRuleDefinition();
|
||||
}
|
||||
else
|
||||
@@ -57,17 +57,17 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
|
||||
{
|
||||
GameRule *newRule = NULL;
|
||||
int i = 0;
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
for (auto& it : m_children )
|
||||
{
|
||||
newRule = new GameRule(*it, rule->getConnection() );
|
||||
(*it)->populateGameRule(type,newRule);
|
||||
newRule = new GameRule(it, rule->getConnection() );
|
||||
it->populateGameRule(type,newRule);
|
||||
|
||||
GameRule::ValueType value;
|
||||
value.gr = newRule;
|
||||
value.isPointer = true;
|
||||
|
||||
// Somehow add the newRule to the current rule
|
||||
rule->setParameter(L"rule" + _toString<int>(i),value);
|
||||
rule->setParameter(L"rule" + std::to_wstring(i),value);
|
||||
++i;
|
||||
}
|
||||
GameRuleDefinition::populateGameRule(type, rule);
|
||||
@@ -76,14 +76,14 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
|
||||
bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
for (auto& it : rule->m_parameters )
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
if(it.second.isPointer)
|
||||
{
|
||||
bool changed = it->second.gr->getGameRuleDefinition()->onUseTile(it->second.gr,tileId,x,y,z);
|
||||
bool changed = it.second.gr->getGameRuleDefinition()->onUseTile(it.second.gr,tileId,x,y,z);
|
||||
if(!statusChanged && changed)
|
||||
{
|
||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
||||
m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
|
||||
statusChanged = true;
|
||||
}
|
||||
}
|
||||
@@ -94,14 +94,14 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in
|
||||
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
for (auto& it : rule->m_parameters )
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
if(it.second.isPointer)
|
||||
{
|
||||
bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem(it->second.gr,item);
|
||||
bool changed = it.second.gr->getGameRuleDefinition()->onCollectItem(it.second.gr,item);
|
||||
if(!statusChanged && changed)
|
||||
{
|
||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
||||
{
|
||||
m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
|
||||
statusChanged = true;
|
||||
}
|
||||
}
|
||||
@@ -111,8 +111,8 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
|
||||
|
||||
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||
{
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
for (auto it : m_children )
|
||||
{
|
||||
(*it)->postProcessPlayer(player);
|
||||
it->postProcessPlayer(player);
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,10 @@ ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
|
||||
|
||||
void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren(children);
|
||||
|
||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++)
|
||||
children->push_back( *it );
|
||||
GameRuleDefinition::getChildren(children);
|
||||
|
||||
for ( auto& action : m_actions )
|
||||
children->push_back( action );
|
||||
}
|
||||
|
||||
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
@@ -60,16 +60,16 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAt
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_x));
|
||||
dos->writeUTF(std::to_wstring(m_x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_y));
|
||||
dos->writeUTF(std::to_wstring(m_y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_z));
|
||||
dos->writeUTF(std::to_wstring(m_z));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
||||
dos->writeUTF(_toString(orientation));
|
||||
dos->writeUTF(std::to_wstring(orientation));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension);
|
||||
dos->writeUTF(_toString(m_dimension));
|
||||
dos->writeUTF(std::to_wstring(m_dimension));
|
||||
}
|
||||
|
||||
void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
@@ -117,27 +117,24 @@ BoundingBox* ConsoleGenerateStructure::getBoundingBox()
|
||||
// Find the max bounds
|
||||
int maxX, maxY, maxZ;
|
||||
maxX = maxY = maxZ = 1;
|
||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
|
||||
for( ConsoleGenerateStructureAction *action : m_actions )
|
||||
{
|
||||
ConsoleGenerateStructureAction *action = *it;
|
||||
maxX = max(maxX,action->getEndX());
|
||||
maxY = max(maxY,action->getEndY());
|
||||
maxZ = max(maxZ,action->getEndZ());
|
||||
maxX = std::max<int>(maxX,action->getEndX());
|
||||
maxY = std::max<int>(maxY,action->getEndY());
|
||||
maxZ = std::max<int>(maxZ,action->getEndZ());
|
||||
}
|
||||
|
||||
|
||||
boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ);
|
||||
}
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
|
||||
{
|
||||
{
|
||||
if(level->dimension->id != m_dimension) return false;
|
||||
|
||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
|
||||
for( ConsoleGenerateStructureAction *action : m_actions )
|
||||
{
|
||||
ConsoleGenerateStructureAction *action = *it;
|
||||
|
||||
switch(action->getActionType())
|
||||
{
|
||||
case ConsoleGameRules::eGameRuleType_GenerateBox:
|
||||
|
||||
@@ -167,18 +167,18 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
|
||||
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
|
||||
tag->put(L"TileEntities", tileEntityTags);
|
||||
|
||||
for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); it++)
|
||||
for ( auto& it : m_tileEntities )
|
||||
{
|
||||
CompoundTag *cTag = new CompoundTag();
|
||||
(*it)->save(cTag);
|
||||
it->save(cTag);
|
||||
tileEntityTags->add(cTag);
|
||||
}
|
||||
|
||||
ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>();
|
||||
tag->put(L"Entities", entityTags);
|
||||
|
||||
for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end(); it++)
|
||||
entityTags->add( (CompoundTag *)(*it).second->copy() );
|
||||
for (auto& it : m_entities )
|
||||
entityTags->add( (CompoundTag *)(it).second->copy() );
|
||||
|
||||
NbtIo::write(tag,dos);
|
||||
delete tag;
|
||||
@@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
|
||||
|
||||
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
{
|
||||
int xStart = max(destinationBox->x0, (double)chunk->x*16);
|
||||
int xEnd = min(destinationBox->x1, (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 = max(destinationBox->z0, (double)chunk->z*16);
|
||||
int zEnd = min(destinationBox->z1, (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);
|
||||
@@ -431,10 +431,8 @@ void ConsoleSchematicFile::schematicCoordToChunkCoord(AABB *destinationBox, doub
|
||||
|
||||
void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
|
||||
{
|
||||
for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it)
|
||||
for (auto& te : m_tileEntities )
|
||||
{
|
||||
shared_ptr<TileEntity> te = *it;
|
||||
|
||||
double targetX = te->x;
|
||||
double targetY = te->y + destinationBox->y0;
|
||||
double targetZ = te->z;
|
||||
@@ -477,7 +475,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
||||
teCopy->setChanged();
|
||||
}
|
||||
}
|
||||
for(AUTO_VAR(it, m_entities.begin()); it != m_entities.end();)
|
||||
for (auto it = m_entities.begin(); it != m_entities.end();)
|
||||
{
|
||||
Vec3 *source = it->first;
|
||||
|
||||
@@ -679,9 +677,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||
for (int zc = zc0; zc <= zc1; zc++)
|
||||
{
|
||||
vector<shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
|
||||
for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it)
|
||||
for( auto& te : *tileEntities )
|
||||
{
|
||||
shared_ptr<TileEntity> te = *it;
|
||||
CompoundTag *teTag = new CompoundTag();
|
||||
shared_ptr<TileEntity> teCopy = te->clone();
|
||||
|
||||
@@ -701,10 +698,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
||||
vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
|
||||
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities");
|
||||
|
||||
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
|
||||
for (auto& e : *entities )
|
||||
{
|
||||
shared_ptr<Entity> e = *it;
|
||||
|
||||
bool mobCanBeSaved = false;
|
||||
if (bSaveMobs)
|
||||
{
|
||||
@@ -1012,12 +1007,15 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa
|
||||
vector<shared_ptr<TileEntity> > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1)
|
||||
{
|
||||
vector<shared_ptr<TileEntity> > *result = new vector<shared_ptr<TileEntity> >;
|
||||
for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it)
|
||||
if ( result )
|
||||
{
|
||||
shared_ptr<TileEntity> te = it->second;
|
||||
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
|
||||
for ( auto& it : chunk->tileEntities )
|
||||
{
|
||||
result->push_back(te);
|
||||
shared_ptr<TileEntity> te = it.second;
|
||||
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
|
||||
{
|
||||
result->push_back(te);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -9,11 +9,11 @@ GameRule::GameRule(GameRuleDefinition *definition, Connection *connection)
|
||||
|
||||
GameRule::~GameRule()
|
||||
{
|
||||
for(AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); ++it)
|
||||
for(auto& it : m_parameters )
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
if(it.second.isPointer)
|
||||
{
|
||||
delete it->second.gr;
|
||||
delete it.second.gr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,12 +59,12 @@ void GameRule::write(DataOutputStream *dos)
|
||||
{
|
||||
// Find required parameters.
|
||||
dos->writeInt(m_parameters.size());
|
||||
for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); it++)
|
||||
for ( const auto& parameter : m_parameters )
|
||||
{
|
||||
wstring pName = (*it).first;
|
||||
ValueType vType = (*it).second;
|
||||
|
||||
dos->writeUTF( (*it).first );
|
||||
wstring pName = parameter.first;
|
||||
ValueType vType = parameter.second;
|
||||
|
||||
dos->writeUTF( parameter.first );
|
||||
dos->writeBoolean( vType.isPointer );
|
||||
|
||||
if (vType.isPointer)
|
||||
@@ -80,7 +80,7 @@ void GameRule::read(DataInputStream *dis)
|
||||
for (int i = 0; i < savedParams; i++)
|
||||
{
|
||||
wstring pNames = dis->readUTF();
|
||||
|
||||
|
||||
ValueType vType = getParameter(pNames);
|
||||
|
||||
if (dis->readBoolean())
|
||||
|
||||
@@ -18,15 +18,15 @@ void GameRuleDefinition::write(DataOutputStream *dos)
|
||||
ConsoleGameRules::write(dos, eType); // stringID
|
||||
|
||||
writeAttributes(dos, 0);
|
||||
|
||||
|
||||
// 4J-JEV: Get children.
|
||||
vector<GameRuleDefinition *> *children = new vector<GameRuleDefinition *>();
|
||||
getChildren( children );
|
||||
|
||||
// Write children.
|
||||
dos->writeInt( children->size() );
|
||||
for (AUTO_VAR(it, children->begin()); it != children->end(); it++)
|
||||
(*it)->write(dos);
|
||||
for ( auto& it : *children )
|
||||
it->write(dos);
|
||||
}
|
||||
|
||||
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
@@ -40,7 +40,7 @@ void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttribut
|
||||
dos->writeUTF(m_promptId);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
||||
dos->writeUTF(_toString(m_4JDataValue));
|
||||
dos->writeUTF(std::to_wstring(m_4JDataValue));
|
||||
}
|
||||
|
||||
void GameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) {}
|
||||
@@ -116,13 +116,13 @@ vector<GameRuleDefinition *> *GameRuleDefinition::enumerate()
|
||||
|
||||
unordered_map<GameRuleDefinition *, int> *GameRuleDefinition::enumerateMap()
|
||||
{
|
||||
unordered_map<GameRuleDefinition *, int> *out
|
||||
unordered_map<GameRuleDefinition *, int> *out
|
||||
= new unordered_map<GameRuleDefinition *, int>();
|
||||
|
||||
int i = 0;
|
||||
vector<GameRuleDefinition *> *gRules = enumerate();
|
||||
for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++)
|
||||
out->insert( pair<GameRuleDefinition *, int>( *it, i++ ) );
|
||||
for ( auto& it : *gRules )
|
||||
out->emplace(it, i++);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ WCHAR *GameRuleManager::wchAttrNameA[] =
|
||||
L"spawnY", // eGameRuleAttr_spawnY
|
||||
L"spawnZ", // eGameRuleAttr_spawnZ
|
||||
L"orientation",
|
||||
L"dimension",
|
||||
L"dimension",
|
||||
L"topTileId", // eGameRuleAttr_topTileId
|
||||
L"biomeId", // eGameRuleAttr_biomeId
|
||||
L"feature", // eGameRuleAttr_feature
|
||||
@@ -127,7 +127,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
|
||||
|
||||
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack);
|
||||
// = loadGameRules(dData, dSize); //, strings);
|
||||
|
||||
|
||||
createdLevelGenerationOptions->setGrSource( new JustGrSource() );
|
||||
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial );
|
||||
|
||||
@@ -164,7 +164,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
app.DebugPrintf("\tversion=%d.\n", version);
|
||||
|
||||
for (int i = 0; i < 8; i++) dis.readByte();
|
||||
|
||||
|
||||
BYTE compression_type = dis.readByte();
|
||||
|
||||
app.DebugPrintf("\tcompressionType=%d.\n", compression_type);
|
||||
@@ -174,11 +174,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
decomp_len = dis.readInt();
|
||||
|
||||
app.DebugPrintf("\tcompr_len=%d.\n\tdecomp_len=%d.\n", compr_len, decomp_len);
|
||||
|
||||
|
||||
|
||||
// Decompress File Body
|
||||
|
||||
byteArray content(new BYTE[decomp_len], decomp_len),
|
||||
byteArray content(new BYTE[decomp_len], decomp_len),
|
||||
compr_content(new BYTE[compr_len], compr_len);
|
||||
dis.read(compr_content);
|
||||
|
||||
@@ -251,7 +251,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
// Initialise output stream.
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
|
||||
|
||||
// Write header.
|
||||
|
||||
// VERSION NUMBER
|
||||
@@ -279,7 +279,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
compr_dos.writeInt( 0 ); // XmlObjects.length
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
StringTable *st = m_currentGameRuleDefinitions->getStringTable();
|
||||
|
||||
if (st == NULL)
|
||||
@@ -311,9 +311,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
dos.writeInt( compr_ba.length ); // Write length
|
||||
dos.writeInt( compr_baos.buf.length );
|
||||
dos.write(compr_ba);
|
||||
|
||||
|
||||
delete [] compr_ba.data;
|
||||
|
||||
|
||||
compr_dos.close();
|
||||
compr_baos.close();
|
||||
// -- END COMPRESSED -- //
|
||||
@@ -323,7 +323,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize)
|
||||
*dOut = baos.buf.data;
|
||||
|
||||
baos.buf.data = NULL;
|
||||
|
||||
|
||||
dos.close(); baos.close();
|
||||
}
|
||||
|
||||
@@ -344,11 +344,10 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
|
||||
// Write schematic files.
|
||||
unordered_map<wstring, ConsoleSchematicFile *> *files;
|
||||
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
|
||||
dos->writeInt( files->size() );
|
||||
for (AUTO_VAR(it, files->begin()); it != files->end(); it++)
|
||||
for ( auto& it : *files )
|
||||
{
|
||||
wstring filename = it->first;
|
||||
ConsoleSchematicFile *file = it->second;
|
||||
const wstring& filename = it.first;
|
||||
ConsoleSchematicFile *file = it.second;
|
||||
|
||||
ByteArrayOutputStream fileBaos;
|
||||
DataOutputStream fileDos(&fileBaos);
|
||||
@@ -378,7 +377,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
//DWORD dwLen = 0;
|
||||
//PBYTE pbData = dlcFile->getData(dwLen);
|
||||
//byteArray data(pbData,dwLen);
|
||||
|
||||
|
||||
byteArray data(dIn, dSize);
|
||||
ByteArrayInputStream bais(data);
|
||||
DataInputStream dis(&bais);
|
||||
@@ -497,7 +496,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
}
|
||||
}*/
|
||||
|
||||
// subfile
|
||||
// subfile
|
||||
UINT numFiles = contentDis->readInt();
|
||||
for (UINT i = 0; i < numFiles; i++)
|
||||
{
|
||||
@@ -519,7 +518,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
{
|
||||
int tagId = contentDis->readInt();
|
||||
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
||||
AUTO_VAR(it,tagIdMap.find(tagId));
|
||||
auto it = tagIdMap.find(tagId);
|
||||
if(it != tagIdMap.end()) tagVal = it->second;
|
||||
|
||||
GameRuleDefinition *rule = NULL;
|
||||
@@ -565,10 +564,10 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
|
||||
|
||||
LevelGenerationOptions *GameRuleManager::readHeader(DLCGameRulesHeader *grh)
|
||||
{
|
||||
LevelGenerationOptions *out =
|
||||
LevelGenerationOptions *out =
|
||||
new LevelGenerationOptions();
|
||||
|
||||
|
||||
|
||||
out->setSrc(LevelGenerationOptions::eSrc_fromDLC);
|
||||
out->setGrSource(grh);
|
||||
addLevelGenerationOptions(out);
|
||||
@@ -595,7 +594,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
|
||||
{
|
||||
int tagId = dis->readInt();
|
||||
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
|
||||
AUTO_VAR(it,tagIdMap->find(tagId));
|
||||
auto it = tagIdMap->find(tagId);
|
||||
if(it != tagIdMap->end()) tagVal = it->second;
|
||||
|
||||
GameRuleDefinition *childRule = NULL;
|
||||
@@ -640,18 +639,6 @@ void GameRuleManager::loadDefaultGameRules()
|
||||
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
// 4J Stu - Remove these just now
|
||||
//File testRulesPath(L"GAME:\\GameRules");
|
||||
//vector<File *> *packFiles = testRulesPath.listFiles();
|
||||
|
||||
//for(AUTO_VAR(it,packFiles->begin()); it != packFiles->end(); ++it)
|
||||
//{
|
||||
// loadGameRulesPack(*it);
|
||||
//}
|
||||
//delete packFiles;
|
||||
#endif
|
||||
|
||||
#else // _XBOX
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
@@ -741,7 +728,7 @@ LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key)
|
||||
LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions *lgo)
|
||||
{
|
||||
vector<LevelGenerationOptions *> *lgs = m_levelGenerators.getLevelGenerators();
|
||||
|
||||
|
||||
for (int i = 0; i<lgs->size(); i++)
|
||||
if (lgs->at(i) == lgo)
|
||||
return i;
|
||||
@@ -761,7 +748,7 @@ void GameRuleManager::unloadCurrentGameRules()
|
||||
if (m_currentLevelGenerationOptions->isFromSave())
|
||||
{
|
||||
m_levelGenerators.removeLevelGenerator( m_currentLevelGenerationOptions );
|
||||
|
||||
|
||||
delete m_currentLevelGenerationOptions;
|
||||
}
|
||||
else if (m_currentLevelGenerationOptions->isFromDLC())
|
||||
|
||||
@@ -59,7 +59,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
|
||||
m_pbBaseSaveData = NULL;
|
||||
m_dwBaseSaveSize = 0;
|
||||
|
||||
m_parentDLCPack = parentPack;
|
||||
m_parentDLCPack = parentPack;
|
||||
m_bLoadingData = false;
|
||||
}
|
||||
|
||||
@@ -67,23 +67,24 @@ LevelGenerationOptions::~LevelGenerationOptions()
|
||||
{
|
||||
clearSchematics();
|
||||
if(m_spawnPos != NULL) delete m_spawnPos;
|
||||
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); ++it)
|
||||
for (auto& it : m_schematicRules )
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
for(AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
delete it;
|
||||
}
|
||||
|
||||
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
|
||||
for (auto& it : m_structureRules )
|
||||
{
|
||||
delete *it;
|
||||
delete it;
|
||||
}
|
||||
|
||||
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
|
||||
for (auto& it : m_biomeOverrides )
|
||||
{
|
||||
delete *it;
|
||||
delete it;
|
||||
}
|
||||
|
||||
for (auto& it : m_features )
|
||||
{
|
||||
delete it;
|
||||
}
|
||||
|
||||
if (m_stringTable)
|
||||
@@ -100,16 +101,16 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttr
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
||||
dos->writeUTF(_toString(m_spawnPos->x));
|
||||
dos->writeUTF(std::to_wstring(m_spawnPos->x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
||||
dos->writeUTF(_toString(m_spawnPos->y));
|
||||
dos->writeUTF(std::to_wstring(m_spawnPos->y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
|
||||
dos->writeUTF(_toString(m_spawnPos->z));
|
||||
dos->writeUTF(std::to_wstring(m_spawnPos->z));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed);
|
||||
dos->writeUTF(_toString(m_seed));
|
||||
dos->writeUTF(std::to_wstring(m_seed));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld);
|
||||
dos->writeUTF(_toString(m_useFlatWorld));
|
||||
dos->writeUTF(std::to_wstring(m_useFlatWorld));
|
||||
}
|
||||
|
||||
void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
|
||||
@@ -117,18 +118,25 @@ void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
|
||||
GameRuleDefinition::getChildren(children);
|
||||
|
||||
vector<ApplySchematicRuleDefinition *> used_schematics;
|
||||
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++)
|
||||
if ( !(*it)->isComplete() )
|
||||
used_schematics.push_back( *it );
|
||||
for (auto& it : m_schematicRules )
|
||||
if ( it && !it->isComplete() )
|
||||
used_schematics.push_back( it );
|
||||
|
||||
for(AUTO_VAR(it, m_structureRules.begin()); it!=m_structureRules.end(); it++)
|
||||
children->push_back( *it );
|
||||
for(AUTO_VAR(it, used_schematics.begin()); it!=used_schematics.end(); it++)
|
||||
children->push_back( *it );
|
||||
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
|
||||
children->push_back( *it );
|
||||
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
|
||||
children->push_back( *it );
|
||||
for (auto& it : m_structureRules)
|
||||
if ( it )
|
||||
children->push_back( it );
|
||||
|
||||
for (auto& it : used_schematics)
|
||||
if ( it )
|
||||
children->push_back( it );
|
||||
|
||||
for (auto& it : m_biomeOverrides)
|
||||
if ( it )
|
||||
children->push_back( it );
|
||||
|
||||
for (auto& it : m_features)
|
||||
if ( it )
|
||||
children->push_back( it );
|
||||
}
|
||||
|
||||
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
@@ -195,7 +203,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
||||
{
|
||||
if(attributeValue.compare(L"true") == 0) m_useFlatWorld = true;
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter flatworld=%s\n",m_useFlatWorld?"TRUE":"FALSE");
|
||||
}
|
||||
}
|
||||
else if(attributeName.compare(L"saveName") == 0)
|
||||
{
|
||||
wstring string(attributeValue);
|
||||
@@ -218,7 +226,7 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName());
|
||||
}
|
||||
else if(attributeName.compare(L"texturePackId") == 0)
|
||||
{
|
||||
{
|
||||
setRequiredTexturePackId( _fromString<unsigned int>(attributeValue) );
|
||||
setRequiresTexturePack( true );
|
||||
app.DebugPrintf("LevelGenerationOptions: Adding parameter texturePackId=%0x\n", getRequiredTexturePackId());
|
||||
@@ -249,19 +257,14 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk)
|
||||
{
|
||||
PIXBeginNamedEvent(0,"Processing schematics for chunk (%d,%d)", chunk->x, chunk->z);
|
||||
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
|
||||
for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
|
||||
{
|
||||
ApplySchematicRuleDefinition *rule = *it;
|
||||
for( ApplySchematicRuleDefinition *rule : m_schematicRules )
|
||||
rule->processSchematic(chunkBox, chunk);
|
||||
}
|
||||
|
||||
int cx = (chunk->x << 4);
|
||||
int cz = (chunk->z << 4);
|
||||
|
||||
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
|
||||
for ( ConsoleGenerateStructure *structureStart : m_structureRules )
|
||||
{
|
||||
ConsoleGenerateStructure *structureStart = *it;
|
||||
|
||||
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
|
||||
{
|
||||
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
|
||||
@@ -276,9 +279,8 @@ void LevelGenerationOptions::processSchematicsLighting(LevelChunk *chunk)
|
||||
{
|
||||
PIXBeginNamedEvent(0,"Processing schematics (lighting) for chunk (%d,%d)", chunk->x, chunk->z);
|
||||
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
|
||||
for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
|
||||
for ( ApplySchematicRuleDefinition *rule : m_schematicRules )
|
||||
{
|
||||
ApplySchematicRuleDefinition *rule = *it;
|
||||
rule->processSchematicLighting(chunkBox, chunk);
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
@@ -292,16 +294,14 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
|
||||
// a) ores generally being below ground/sea level and b) tutorial world additions generally being above ground/sea level
|
||||
if(!m_bHaveMinY)
|
||||
{
|
||||
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
|
||||
for ( ApplySchematicRuleDefinition *rule : m_schematicRules )
|
||||
{
|
||||
ApplySchematicRuleDefinition *rule = *it;
|
||||
int minY = rule->getMinY();
|
||||
if(minY < m_minY) m_minY = minY;
|
||||
}
|
||||
|
||||
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
|
||||
for ( ConsoleGenerateStructure *structureStart : m_structureRules )
|
||||
{
|
||||
ConsoleGenerateStructure *structureStart = *it;
|
||||
int minY = structureStart->getMinY();
|
||||
if(minY < m_minY) m_minY = minY;
|
||||
}
|
||||
@@ -313,18 +313,16 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
|
||||
if( y1 < m_minY ) return false;
|
||||
|
||||
bool intersects = false;
|
||||
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
|
||||
for( ApplySchematicRuleDefinition *rule : m_schematicRules )
|
||||
{
|
||||
ApplySchematicRuleDefinition *rule = *it;
|
||||
intersects = rule->checkIntersects(x0,y0,z0,x1,y1,z1);
|
||||
if(intersects) break;
|
||||
}
|
||||
|
||||
if(!intersects)
|
||||
{
|
||||
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
|
||||
for( ConsoleGenerateStructure *structureStart : m_structureRules )
|
||||
{
|
||||
ConsoleGenerateStructure *structureStart = *it;
|
||||
intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1);
|
||||
if(intersects) break;
|
||||
}
|
||||
@@ -335,9 +333,9 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
|
||||
|
||||
void LevelGenerationOptions::clearSchematics()
|
||||
{
|
||||
for(AUTO_VAR(it, m_schematics.begin()); it != m_schematics.end(); ++it)
|
||||
for ( auto& it : m_schematics )
|
||||
{
|
||||
delete it->second;
|
||||
delete it.second;
|
||||
}
|
||||
m_schematics.clear();
|
||||
}
|
||||
@@ -345,7 +343,7 @@ void LevelGenerationOptions::clearSchematics()
|
||||
ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen)
|
||||
{
|
||||
// If we have already loaded this, just return
|
||||
AUTO_VAR(it, m_schematics.find(filename));
|
||||
auto it = m_schematics.find(filename);
|
||||
if(it != m_schematics.end())
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
@@ -370,7 +368,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
|
||||
{
|
||||
ConsoleSchematicFile *schematic = NULL;
|
||||
// If we have already loaded this, just return
|
||||
AUTO_VAR(it, m_schematics.find(filename));
|
||||
auto it = m_schematics.find(filename);
|
||||
if(it != m_schematics.end())
|
||||
{
|
||||
schematic = it->second;
|
||||
@@ -381,7 +379,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
|
||||
void LevelGenerationOptions::releaseSchematicFile(const wstring &filename)
|
||||
{
|
||||
// 4J Stu - We don't want to delete them when done, but probably want to keep a set of active schematics for the current world
|
||||
//AUTO_VAR(it, m_schematics.find(filename));
|
||||
// auto it = m_schematics.find(filename);
|
||||
//if(it != m_schematics.end())
|
||||
//{
|
||||
// ConsoleSchematicFile *schematic = it->second;
|
||||
@@ -413,10 +411,9 @@ LPCWSTR LevelGenerationOptions::getString(const wstring &key)
|
||||
|
||||
void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile)
|
||||
{
|
||||
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
|
||||
for ( BiomeOverride *bo : m_biomeOverrides )
|
||||
{
|
||||
BiomeOverride *bo = *it;
|
||||
if(bo->isBiome(biomeId))
|
||||
if ( bo && bo->isBiome(biomeId) )
|
||||
{
|
||||
bo->getTileValues(tile,topTile);
|
||||
break;
|
||||
@@ -428,9 +425,8 @@ bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFea
|
||||
{
|
||||
bool isFeature = false;
|
||||
|
||||
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
|
||||
for( StartFeature *sf : m_features )
|
||||
{
|
||||
StartFeature *sf = *it;
|
||||
if(sf->isFeatureChunk(chunkX, chunkZ, feature, orientation))
|
||||
{
|
||||
isFeature = true;
|
||||
@@ -444,17 +440,17 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
|
||||
{
|
||||
// Clean schematic rules.
|
||||
unordered_set<wstring> usedFiles = unordered_set<wstring>();
|
||||
for (AUTO_VAR(it, m_schematicRules.begin()); it!=m_schematicRules.end(); it++)
|
||||
if ( !(*it)->isComplete() )
|
||||
usedFiles.insert( (*it)->getSchematicName() );
|
||||
for ( auto& it : m_schematicRules )
|
||||
if ( !it->isComplete() )
|
||||
usedFiles.insert( it->getSchematicName() );
|
||||
|
||||
// Clean schematic files.
|
||||
unordered_map<wstring, ConsoleSchematicFile *> *out
|
||||
unordered_map<wstring, ConsoleSchematicFile *> *out
|
||||
= new unordered_map<wstring, ConsoleSchematicFile *>();
|
||||
for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++)
|
||||
out->insert( pair<wstring, ConsoleSchematicFile *>(*it, getSchematicFile(*it)) );
|
||||
for ( auto& it : usedFiles )
|
||||
out->insert( pair<wstring, ConsoleSchematicFile *>(it, getSchematicFile(it)) );
|
||||
|
||||
return out;
|
||||
return out;
|
||||
}
|
||||
|
||||
void LevelGenerationOptions::loadBaseSaveData()
|
||||
@@ -472,7 +468,7 @@ void LevelGenerationOptions::loadBaseSaveData()
|
||||
{
|
||||
// corrupt DLC
|
||||
setLoadedData();
|
||||
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",mountIndex,ProfileManager.GetPrimaryPad());
|
||||
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",mountIndex,ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -604,7 +600,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef _DURANGO
|
||||
#ifdef _DURANGO
|
||||
DWORD result = StorageManager.UnmountInstalledDLC(L"WPACK");
|
||||
#else
|
||||
DWORD result = StorageManager.UnmountInstalledDLC("WPACK");
|
||||
@@ -619,11 +615,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
|
||||
|
||||
void LevelGenerationOptions::reset_start()
|
||||
{
|
||||
for ( AUTO_VAR( it, m_schematicRules.begin());
|
||||
it != m_schematicRules.end();
|
||||
it++ )
|
||||
for ( auto& it : m_schematicRules )
|
||||
{
|
||||
(*it)->reset();
|
||||
if ( it )
|
||||
it->reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +646,7 @@ bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresText
|
||||
UINT LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); }
|
||||
|
||||
wstring LevelGenerationOptions::getDefaultSaveName()
|
||||
{
|
||||
{
|
||||
switch (getSrc())
|
||||
{
|
||||
case eSrc_fromSave: return getString( info()->getDefaultSaveName() );
|
||||
@@ -661,7 +656,7 @@ wstring LevelGenerationOptions::getDefaultSaveName()
|
||||
return L"";
|
||||
}
|
||||
LPCWSTR LevelGenerationOptions::getWorldName()
|
||||
{
|
||||
{
|
||||
switch (getSrc())
|
||||
{
|
||||
case eSrc_fromSave: return getString( info()->getWorldName() );
|
||||
|
||||
@@ -11,7 +11,7 @@ LevelRuleset::LevelRuleset()
|
||||
|
||||
LevelRuleset::~LevelRuleset()
|
||||
{
|
||||
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it)
|
||||
for (auto it = m_areas.begin(); it != m_areas.end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
@@ -20,8 +20,8 @@ LevelRuleset::~LevelRuleset()
|
||||
void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
CompoundGameRuleDefinition::getChildren(children);
|
||||
for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++)
|
||||
children->push_back(*it);
|
||||
for (const auto& area : m_areas)
|
||||
children->push_back(area);
|
||||
}
|
||||
|
||||
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
@@ -58,12 +58,12 @@ LPCWSTR LevelRuleset::getString(const wstring &key)
|
||||
|
||||
AABB *LevelRuleset::getNamedArea(const wstring &areaName)
|
||||
{
|
||||
AABB *area = NULL;
|
||||
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it)
|
||||
AABB *area = nullptr;
|
||||
for(auto& it : m_areas)
|
||||
{
|
||||
if( (*it)->getName().compare(areaName) == 0 )
|
||||
if( it->getName().compare(areaName) == 0 )
|
||||
{
|
||||
area = (*it)->getArea();
|
||||
area = it->getArea();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,18 +22,18 @@ void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAtt
|
||||
dos->writeUTF(m_name);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
||||
dos->writeUTF(_toString(m_area->x0));
|
||||
dos->writeUTF(std::to_wstring(m_area->x0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
||||
dos->writeUTF(_toString(m_area->y0));
|
||||
dos->writeUTF(std::to_wstring(m_area->y0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
||||
dos->writeUTF(_toString(m_area->z0));
|
||||
dos->writeUTF(std::to_wstring(m_area->z0));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
||||
dos->writeUTF(_toString(m_area->x1));
|
||||
dos->writeUTF(std::to_wstring(m_area->x1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
||||
dos->writeUTF(_toString(m_area->y1));
|
||||
dos->writeUTF(std::to_wstring(m_area->y1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
||||
dos->writeUTF(_toString(m_area->z1));
|
||||
dos->writeUTF(std::to_wstring(m_area->z1));
|
||||
}
|
||||
|
||||
void NamedAreaRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
|
||||
@@ -15,13 +15,13 @@ void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 4);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX);
|
||||
dos->writeUTF(_toString(m_chunkX));
|
||||
dos->writeUTF(std::to_wstring(m_chunkX));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ);
|
||||
dos->writeUTF(_toString(m_chunkZ));
|
||||
dos->writeUTF(std::to_wstring(m_chunkZ));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature);
|
||||
dos->writeUTF(_toString((int)m_feature));
|
||||
dos->writeUTF(std::to_wstring((int)m_feature));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
||||
dos->writeUTF(_toString(m_orientation));
|
||||
dos->writeUTF(std::to_wstring(m_orientation));
|
||||
}
|
||||
|
||||
void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
|
||||
@@ -11,16 +11,16 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
|
||||
{
|
||||
m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;;
|
||||
m_health = 0;
|
||||
m_food = 0;
|
||||
m_food = 0;
|
||||
m_spawnPos = NULL;
|
||||
m_yRot = 0.0f;
|
||||
}
|
||||
|
||||
UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition()
|
||||
{
|
||||
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
|
||||
for(auto& item : m_items)
|
||||
{
|
||||
delete *it;
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,34 +33,34 @@ void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream *dos, UINT num
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + attrCount );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
|
||||
dos->writeUTF(_toString(m_spawnPos->x));
|
||||
dos->writeUTF(std::to_wstring(m_spawnPos->x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
|
||||
dos->writeUTF(_toString(m_spawnPos->y));
|
||||
dos->writeUTF(std::to_wstring(m_spawnPos->y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
|
||||
dos->writeUTF(_toString(m_spawnPos->z));
|
||||
dos->writeUTF(std::to_wstring(m_spawnPos->z));
|
||||
|
||||
if(m_bUpdateYRot)
|
||||
{
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot);
|
||||
dos->writeUTF(_toString(m_yRot));
|
||||
dos->writeUTF(std::to_wstring(m_yRot));
|
||||
}
|
||||
if(m_bUpdateHealth)
|
||||
{
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food);
|
||||
dos->writeUTF(_toString(m_health));
|
||||
dos->writeUTF(std::to_wstring(m_health));
|
||||
}
|
||||
if(m_bUpdateFood)
|
||||
{
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health);
|
||||
dos->writeUTF(_toString(m_food));
|
||||
dos->writeUTF(std::to_wstring(m_food));
|
||||
}
|
||||
}
|
||||
|
||||
void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren(children);
|
||||
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++)
|
||||
children->push_back(*it);
|
||||
for(auto& item : m_items)
|
||||
children->push_back(item);
|
||||
}
|
||||
|
||||
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
@@ -162,10 +162,8 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||
|
||||
if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
|
||||
|
||||
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
|
||||
for(auto& addItem : m_items)
|
||||
{
|
||||
AddItemRuleDefinition *addItem = *it;
|
||||
|
||||
addItem->addItemToContainer(player->inventory, -1);
|
||||
}
|
||||
}
|
||||
@@ -13,19 +13,19 @@ void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttri
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
||||
dos->writeUTF(_toString(m_tileId));
|
||||
dos->writeUTF(std::to_wstring(m_tileId));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords);
|
||||
dos->writeUTF(_toString(m_useCoords));
|
||||
dos->writeUTF(std::to_wstring(m_useCoords));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_coordinates.x));
|
||||
dos->writeUTF(std::to_wstring(m_coordinates.x));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_coordinates.y));
|
||||
dos->writeUTF(std::to_wstring(m_coordinates.y));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_coordinates.z));
|
||||
dos->writeUTF(std::to_wstring(m_coordinates.z));
|
||||
}
|
||||
|
||||
void UseTileRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
|
||||
@@ -14,25 +14,25 @@ void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT
|
||||
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
|
||||
dos->writeUTF(_toString(m_x0));
|
||||
dos->writeUTF(std::to_wstring(m_x0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
|
||||
dos->writeUTF(_toString(m_y0));
|
||||
dos->writeUTF(std::to_wstring(m_y0));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
|
||||
dos->writeUTF(_toString(m_z0));
|
||||
dos->writeUTF(std::to_wstring(m_z0));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
|
||||
dos->writeUTF(_toString(m_x1));
|
||||
dos->writeUTF(std::to_wstring(m_x1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
|
||||
dos->writeUTF(_toString(m_y1));
|
||||
dos->writeUTF(std::to_wstring(m_y1));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
|
||||
dos->writeUTF(_toString(m_z1));
|
||||
dos->writeUTF(std::to_wstring(m_z1));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile);
|
||||
dos->writeUTF(_toString(m_edgeTile));
|
||||
dos->writeUTF(std::to_wstring(m_edgeTile));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile);
|
||||
dos->writeUTF(_toString(m_fillTile));
|
||||
dos->writeUTF(std::to_wstring(m_fillTile));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir);
|
||||
dos->writeUTF(_toString(m_skipAir));
|
||||
dos->writeUTF(std::to_wstring(m_skipAir));
|
||||
}
|
||||
|
||||
void XboxStructureActionGenerateBox::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
|
||||
@@ -13,16 +13,16 @@ void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, UINT
|
||||
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_x));
|
||||
dos->writeUTF(std::to_wstring(m_x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_y));
|
||||
dos->writeUTF(std::to_wstring(m_y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_z));
|
||||
dos->writeUTF(std::to_wstring(m_z));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data);
|
||||
dos->writeUTF(_toString(m_data));
|
||||
dos->writeUTF(std::to_wstring(m_data));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block);
|
||||
dos->writeUTF(_toString(m_tile));
|
||||
dos->writeUTF(std::to_wstring(m_tile));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,21 +14,21 @@ XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer()
|
||||
|
||||
XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
|
||||
{
|
||||
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
|
||||
for(auto& item : m_items)
|
||||
{
|
||||
delete *it;
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
// 4J-JEV: Super class handles attr-facing fine.
|
||||
//void XboxStructureActionPlaceContainer::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
|
||||
|
||||
|
||||
void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
XboxStructureActionPlaceBlock::getChildren(children);
|
||||
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++)
|
||||
children->push_back( *it );
|
||||
for(auto & item : m_items)
|
||||
children->push_back( item );
|
||||
}
|
||||
|
||||
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
@@ -79,15 +79,15 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
||||
|
||||
level->setTileAndData( worldX, worldY, worldZ, m_tile, 0, Tile::UPDATE_ALL );
|
||||
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 )
|
||||
{
|
||||
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
|
||||
// Add items
|
||||
int slotId = 0;
|
||||
for(AUTO_VAR(it, m_items.begin()); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId )
|
||||
{
|
||||
for (auto it = m_items.begin(); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId)
|
||||
{
|
||||
AddItemRuleDefinition *addItem = *it;
|
||||
|
||||
addItem->addItemToContainer(container,slotId);
|
||||
|
||||
Reference in New Issue
Block a user