Remove AUTO_VAR macro and _toString function (#592)

This commit is contained in:
void_17 2026-03-06 02:11:18 +07:00 committed by GitHub
parent 7d6658fe5b
commit 55231bb8d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
294 changed files with 5067 additions and 5773 deletions

18
.clang-tidy Normal file
View file

@ -0,0 +1,18 @@
---
# Enable all modernize checks, but explicitly exclude trailing return types
Checks: >
-*,
modernize-*,
google-readability-casting,
cppcoreguidelines-pro-type-cstyle-cast,
-modernize-use-trailing-return-type
# Pass the C++14 flag to the internal Clang compiler
ExtraArgs: ['-std=c++14']
CheckOptions:
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-use-auto.MinTypeNameLength
value: 5
...

30
Minecraft.Client/.clangd Normal file
View file

@ -0,0 +1,30 @@
CompileFlags:
Add: [-std=c++14,
-m64,
-Wno-unused-includes
]
Remove: [-W*]
Index:
StandardLibrary: true
Diagnostics:
Suppress: unused-includes
UnusedIncludes: None
ClangTidy:
Add: [modernize-loop-convert]
Completion:
AllScopes: Yes
ArgumentLists: Delimiters
HeaderInsertion: Never
InlayHints:
BlockEnd: true
ParameterNames: false
DeducedTypes: false
Designators: false
DefaultArguments: false
Hover:
ShowAKA: true

View file

@ -53,11 +53,8 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
Slot *hoveredSlot = NULL; Slot *hoveredSlot = NULL;
AUTO_VAR(itEnd, menu->slots->end()); for ( Slot *slot : *menu->slots )
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
{ {
Slot *slot = *it; //menu->slots->at(i);
renderSlot(slot); renderSlot(slot);
if (isHovering(slot, xm, ym)) if (isHovering(slot, xm, ym))
@ -150,10 +147,8 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
Slot *AbstractContainerScreen::findSlot(int x, int y) Slot *AbstractContainerScreen::findSlot(int x, int y)
{ {
AUTO_VAR(itEnd, menu->slots->end()); for (Slot* slot : menu->slots )
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
{ {
Slot *slot = *it; //menu->slots->at(i);
if (isHovering(slot, x, y)) return slot; if (isHovering(slot, x, y)) return slot;
} }
return NULL; return NULL;

View file

@ -262,11 +262,9 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
AUTO_VAR(itEnd, Achievements::achievements->end()); for ( Achievement *ach : *Achievements::achievements )
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
{ {
Achievement *ach = *it; //Achievements::achievements->at(i); if ( ach == nullptr || ach->requires == nullptr) continue;
if (ach->requires == NULL) continue;
int x1 = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll + 11 + xBigMap; int x1 = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll + 11 + xBigMap;
int y1 = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll + 11 + yBigMap; int y1 = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll + 11 + yBigMap;
@ -299,11 +297,8 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
glEnable(GL_RESCALE_NORMAL); glEnable(GL_RESCALE_NORMAL);
glEnable(GL_COLOR_MATERIAL); glEnable(GL_COLOR_MATERIAL);
itEnd = Achievements::achievements->end(); for ( Achievement *ach : *Achievements::achievements )
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
{ {
Achievement *ach = *it; //Achievements::achievements->at(i);
int x = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll; int x = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll;
int y = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll; int y = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll;

View file

@ -78,11 +78,8 @@ vector<wstring> *ArchiveFile::getFileList()
{ {
vector<wstring> *out = new vector<wstring>(); vector<wstring> *out = new vector<wstring>();
for ( AUTO_VAR(it, m_index.begin()); for ( const auto& it : m_index )
it != m_index.end(); out->push_back( it.first );
it++ )
out->push_back( it->first );
return out; return out;
} }
@ -100,7 +97,7 @@ int ArchiveFile::getFileSize(const wstring &filename)
byteArray ArchiveFile::getFile(const wstring &filename) byteArray ArchiveFile::getFile(const wstring &filename)
{ {
byteArray out; byteArray out;
AUTO_VAR(it,m_index.find(filename)); auto it = m_index.find(filename);
if(it == m_index.end()) if(it == m_index.end())
{ {

View file

@ -149,7 +149,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
wstring mipMapPath = L""; wstring mipMapPath = L"";
if( l != 0 ) if( l != 0 )
{ {
mipMapPath = L"MipMapLevel" + _toString<int>(l+1); mipMapPath = L"MipMapLevel" + std::to_wstring(l+1);
} }
if( filenameHasExtension ) if( filenameHasExtension )
{ {
@ -207,7 +207,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
wstring mipMapPath = L""; wstring mipMapPath = L"";
if( l != 0 ) if( l != 0 )
{ {
mipMapPath = L"MipMapLevel" + _toString<int>(l+1); mipMapPath = L"MipMapLevel" + std::to_wstring(l+1);
} }
if( filenameHasExtension ) if( filenameHasExtension )
{ {

View file

@ -484,7 +484,6 @@ void Chunk::rebuild()
PIXEndNamedEvent(); PIXEndNamedEvent();
PIXBeginNamedEvent(0,"Rebuild section D"); PIXBeginNamedEvent(0,"Rebuild section D");
// 4J - have rewritten the way that tile entities are stored globally to make it work more easily with split screen. Chunks are now // 4J - have rewritten the way that tile entities are stored globally to make it work more easily with split screen. Chunks are now
// stored globally in the levelrenderer, in a hashmap with a special key made up from the dimension and chunk position (using same index // stored globally in the levelrenderer, in a hashmap with a special key made up from the dimension and chunk position (using same index
// as is used for global flags) // as is used for global flags)
@ -493,25 +492,25 @@ void Chunk::rebuild()
EnterCriticalSection(globalRenderableTileEntities_cs); EnterCriticalSection(globalRenderableTileEntities_cs);
if( renderableTileEntities.size() ) if( renderableTileEntities.size() )
{ {
AUTO_VAR(it, globalRenderableTileEntities->find(key)); auto it = globalRenderableTileEntities->find(key);
if( it != globalRenderableTileEntities->end() ) if( it != globalRenderableTileEntities->end() )
{ {
// We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be. // We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be.
// We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones // We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones
// First pass - flag everything already existing to be removed // First pass - flag everything already existing to be removed
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ ) for(auto& it2 : it->second)
{ {
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk); it2->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
} }
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add // Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
for( int i = 0; i < renderableTileEntities.size(); i++ ) for(const auto& it3 : renderableTileEntities)
{ {
AUTO_VAR(it2, find( it->second.begin(), it->second.end(), renderableTileEntities[i] )); auto it2 = find(it->second.begin(), it->second.end(), it3);
if( it2 == it->second.end() ) if( it2 == it->second.end() )
{ {
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]); (*globalRenderableTileEntities)[key].push_back(it3);
} }
else else
{ {
@ -531,12 +530,12 @@ void Chunk::rebuild()
else else
{ {
// Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed. // Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed.
AUTO_VAR(it, globalRenderableTileEntities->find(key)); auto it = globalRenderableTileEntities->find(key);
if( it != globalRenderableTileEntities->end() ) if( it != globalRenderableTileEntities->end() )
{ {
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ ) for(auto& it2 : it->second)
{ {
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk); it2->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
} }
} }
} }
@ -559,7 +558,7 @@ void Chunk::rebuild()
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
AUTO_VAR(endIt, oldTileEntities.end()); auto endIt = oldTileEntities.end();
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
{ {
newTileEntities.erase(*it); newTileEntities.erase(*it);
@ -576,7 +575,7 @@ void Chunk::rebuild()
// 4J - All these new things added to globalRenderableTileEntities // 4J - All these new things added to globalRenderableTileEntities
AUTO_VAR(endItRTE, renderableTileEntities.end()); auto endItRTE = renderableTileEntities.end();
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
{ {
oldTileEntities.erase(*it); oldTileEntities.erase(*it);
@ -814,14 +813,14 @@ void Chunk::rebuild_SPU()
EnterCriticalSection(globalRenderableTileEntities_cs); EnterCriticalSection(globalRenderableTileEntities_cs);
if( renderableTileEntities.size() ) if( renderableTileEntities.size() )
{ {
AUTO_VAR(it, globalRenderableTileEntities->find(key)); auto it = globalRenderableTileEntities->find(key);
if( it != globalRenderableTileEntities->end() ) if( it != globalRenderableTileEntities->end() )
{ {
// We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be. // We've got some renderable tile entities that we want associated with this chunk, and an existing list of things that used to be.
// We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones // We need to flag any that we don't need any more to be removed, keep those that we do, and add any new ones
// First pass - flag everything already existing to be removed // First pass - flag everything already existing to be removed
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ ) for( auto it2 = it->second.begin(); it2 != it->second.end(); it2++ )
{ {
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk); (*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
} }
@ -829,7 +828,7 @@ void Chunk::rebuild_SPU()
// Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add // Now go through the current list. If these are already in the list, then unflag the remove flag. If they aren't, then add
for( int i = 0; i < renderableTileEntities.size(); i++ ) for( int i = 0; i < renderableTileEntities.size(); i++ )
{ {
AUTO_VAR(it2, find( it->second.begin(), it->second.end(), renderableTileEntities[i] )); auto it2 = find( it->second.begin(), it->second.end(), renderableTileEntities[i] );
if( it2 == it->second.end() ) if( it2 == it->second.end() )
{ {
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]); (*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
@ -852,10 +851,10 @@ void Chunk::rebuild_SPU()
else else
{ {
// Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed. // Another easy case - we don't want any renderable tile entities associated with this chunk. Flag all to be removed.
AUTO_VAR(it, globalRenderableTileEntities->find(key)); auto it = globalRenderableTileEntities->find(key);
if( it != globalRenderableTileEntities->end() ) if( it != globalRenderableTileEntities->end() )
{ {
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++ ) for( auto it2 = it->second.begin(); it2 != it->second.end(); it2++ )
{ {
(*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk); (*it2)->setRenderRemoveStage(TileEntity::e_RenderRemoveStageFlaggedAtChunk);
} }
@ -879,7 +878,7 @@ void Chunk::rebuild_SPU()
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
AUTO_VAR(endIt, oldTileEntities.end()); auto endIt = oldTileEntities.end();
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ ) for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
{ {
newTileEntities.erase(*it); newTileEntities.erase(*it);
@ -896,7 +895,7 @@ void Chunk::rebuild_SPU()
// 4J - All these new things added to globalRenderableTileEntities // 4J - All these new things added to globalRenderableTileEntities
AUTO_VAR(endItRTE, renderableTileEntities.end()); auto endItRTE = renderableTileEntities.end();
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ ) for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
{ {
oldTileEntities.erase(*it); oldTileEntities.erase(*it);

View file

@ -627,15 +627,12 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
} }
vector<shared_ptr<Entity> > *subEntities = e->getSubEntities(); vector<shared_ptr<Entity> > *subEntities = e->getSubEntities();
if (subEntities != NULL) if (subEntities)
{ {
int offs = packet->id - e->entityId; int offs = packet->id - e->entityId;
//for (int i = 0; i < subEntities.length; i++) for ( auto it : *subEntities )
for(AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); ++it)
{ {
(*it)->entityId += offs; it->entityId += offs;
//subEntities[i].entityId += offs;
//System.out.println(subEntities[i].entityId);
} }
} }
@ -2345,14 +2342,12 @@ void ClientConnection::handleAddMob(shared_ptr<AddMobPacket> packet)
mob->xRotp = packet->xRot; mob->xRotp = packet->xRot;
vector<shared_ptr<Entity> > *subEntities = mob->getSubEntities(); vector<shared_ptr<Entity> > *subEntities = mob->getSubEntities();
if (subEntities != NULL) if (subEntities)
{ {
int offs = packet->id - mob->entityId; int offs = packet->id - mob->entityId;
//for (int i = 0; i < subEntities.length; i++) for (auto& it : *subEntities )
for(AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); ++it)
{ {
//subEntities[i].entityId += offs; it->entityId += offs;
(*it)->entityId += offs;
} }
} }
@ -3897,29 +3892,29 @@ void ClientConnection::handleUpdateAttributes(shared_ptr<UpdateAttributesPacket>
BaseAttributeMap *attributes = (dynamic_pointer_cast<LivingEntity>(entity))->getAttributes(); BaseAttributeMap *attributes = (dynamic_pointer_cast<LivingEntity>(entity))->getAttributes();
unordered_set<UpdateAttributesPacket::AttributeSnapshot *> attributeSnapshots = packet->getValues(); unordered_set<UpdateAttributesPacket::AttributeSnapshot *> attributeSnapshots = packet->getValues();
for (AUTO_VAR(it,attributeSnapshots.begin()); it != attributeSnapshots.end(); ++it) for ( UpdateAttributesPacket::AttributeSnapshot *attribute : attributeSnapshots )
{ {
UpdateAttributesPacket::AttributeSnapshot *attribute = *it;
AttributeInstance *instance = attributes->getInstance(attribute->getId()); AttributeInstance *instance = attributes->getInstance(attribute->getId());
if (instance == NULL) if (instance)
{ {
// 4J - TODO: revisit, not familiar with the attribute system, why are we passing in MIN_NORMAL (Java's smallest non-zero value conforming to IEEE Standard 754 (?)) and MAX_VALUE // 4J - TODO: revisit, not familiar with the attribute system, why are we passing in MIN_NORMAL (Java's smallest non-zero value conforming to IEEE Standard 754 (?)) and MAX_VALUE
instance = attributes->registerAttribute(new RangedAttribute(attribute->getId(), 0, Double::MIN_NORMAL, Double::MAX_VALUE)); instance = attributes->registerAttribute(new RangedAttribute(attribute->getId(), 0, Double::MIN_NORMAL, Double::MAX_VALUE));
}
instance->setBaseValue(attribute->getBase()); instance->setBaseValue(attribute->getBase());
instance->removeModifiers(); instance->removeModifiers();
unordered_set<AttributeModifier *> *modifiers = attribute->getModifiers(); unordered_set<AttributeModifier *> *modifiers = attribute->getModifiers();
for (AUTO_VAR(it2,modifiers->begin()); it2 != modifiers->end(); ++it2) if ( modifiers )
{
for ( AttributeModifier* modifier : *modifiers )
{ {
AttributeModifier* modifier = *it2;
instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation())); instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation()));
} }
} }
} }
}
}
// 4J: Check for deferred entity link packets related to this entity ID and handle them // 4J: Check for deferred entity link packets related to this entity ID and handle them
void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId) void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId)

View file

@ -42,7 +42,7 @@ void ConsoleSoundEngine::tick()
return; return;
} }
for(AUTO_VAR(it,scheduledSounds.begin()); it != scheduledSounds.end();) for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();)
{ {
SoundEngine::ScheduledSound *next = *it; SoundEngine::ScheduledSound *next = *it;
next->delay--; next->delay--;

View file

@ -355,7 +355,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
wstring colourId = dis.readUTF(); wstring colourId = dis.readUTF();
int colourValue = dis.readInt(); int colourValue = dis.readInt();
setColour(colourId, colourValue); setColour(colourId, colourValue);
AUTO_VAR(it,s_colourNamesMap.find(colourId)); auto it = s_colourNamesMap.find(colourId); // ?
} }
bais.reset(); bais.reset();
@ -363,7 +363,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
void ColourTable::setColour(const wstring &colourName, int value) void ColourTable::setColour(const wstring &colourName, int value)
{ {
AUTO_VAR(it,s_colourNamesMap.find(colourName)); auto it = s_colourNamesMap.find(colourName);
if(it != s_colourNamesMap.end()) if(it != s_colourNamesMap.end())
{ {
m_colourValues[(int)it->second] = value; m_colourValues[(int)it->second] = value;

View file

@ -1475,9 +1475,8 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_Gamertags); app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_Gamertags);
PlayerList *players = MinecraftServer::getInstance()->getPlayerList(); PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3) for( auto& decorationPlayer : players->players )
{ {
shared_ptr<ServerPlayer> decorationPlayer = *it3;
decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false); decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false);
} }
} }
@ -5641,7 +5640,7 @@ bool CMinecraftApp::isXuidNotch(PlayerUID xuid)
bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid) bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid)
{ {
AUTO_VAR(it, MojangData.find( xuid )); // 4J Stu - The .at and [] accessors insert elements if they don't exist auto it = MojangData.find(xuid); // 4J Stu - The .at and [] accessors insert elements if they don't exist
if (it != MojangData.end() ) if (it != MojangData.end() )
{ {
MOJANG_DATA *pMojangData=MojangData[xuid]; MOJANG_DATA *pMojangData=MojangData[xuid];
@ -5659,7 +5658,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD
EnterCriticalSection(&csMemFilesLock); EnterCriticalSection(&csMemFilesLock);
// check it's not already in // check it's not already in
PMEMDATA pData=NULL; PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_Files.find(wName)); auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end()) if(it != m_MEM_Files.end())
{ {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
@ -5704,7 +5703,7 @@ void CMinecraftApp::RemoveMemoryTextureFile(const wstring &wName)
{ {
EnterCriticalSection(&csMemFilesLock); EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName)); auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end()) if(it != m_MEM_Files.end())
{ {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
@ -5730,7 +5729,7 @@ bool CMinecraftApp::DefaultCapeExists()
bool val = false; bool val = false;
EnterCriticalSection(&csMemFilesLock); EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wTex)); auto it = m_MEM_Files.find(wTex);
if(it != m_MEM_Files.end()) val = true; if(it != m_MEM_Files.end()) val = true;
LeaveCriticalSection(&csMemFilesLock); LeaveCriticalSection(&csMemFilesLock);
@ -5742,7 +5741,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName)
bool val = false; bool val = false;
EnterCriticalSection(&csMemFilesLock); EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName)); auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end()) val = true; if(it != m_MEM_Files.end()) val = true;
LeaveCriticalSection(&csMemFilesLock); LeaveCriticalSection(&csMemFilesLock);
@ -5752,7 +5751,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName)
void CMinecraftApp::GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes) void CMinecraftApp::GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes)
{ {
EnterCriticalSection(&csMemFilesLock); EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName)); auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end()) if(it != m_MEM_Files.end())
{ {
PMEMDATA pData = (*it).second; PMEMDATA pData = (*it).second;
@ -5767,7 +5766,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes)
EnterCriticalSection(&csMemTPDLock); EnterCriticalSection(&csMemTPDLock);
// check it's not already in // check it's not already in
PMEMDATA pData=NULL; PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_TPD.find(iConfig)); auto it = m_MEM_TPD.find(iConfig);
if(it == m_MEM_TPD.end()) if(it == m_MEM_TPD.end())
{ {
pData = (PMEMDATA)new BYTE[sizeof(MEMDATA)]; pData = (PMEMDATA)new BYTE[sizeof(MEMDATA)];
@ -5787,7 +5786,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
EnterCriticalSection(&csMemTPDLock); EnterCriticalSection(&csMemTPDLock);
// check it's not already in // check it's not already in
PMEMDATA pData=NULL; PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_TPD.find(iConfig)); auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end()) if(it != m_MEM_TPD.end())
{ {
pData=m_MEM_TPD[iConfig]; pData=m_MEM_TPD[iConfig];
@ -5844,7 +5843,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
bool val = false; bool val = false;
EnterCriticalSection(&csMemTPDLock); EnterCriticalSection(&csMemTPDLock);
AUTO_VAR(it, m_MEM_TPD.find(iConfig)); auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end()) val = true; if(it != m_MEM_TPD.end()) val = true;
LeaveCriticalSection(&csMemTPDLock); LeaveCriticalSection(&csMemTPDLock);
@ -5854,7 +5853,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes) void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes)
{ {
EnterCriticalSection(&csMemTPDLock); EnterCriticalSection(&csMemTPDLock);
AUTO_VAR(it, m_MEM_TPD.find(iConfig)); auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end()) if(it != m_MEM_TPD.end())
{ {
PMEMDATA pData = (*it).second; PMEMDATA pData = (*it).second;
@ -6989,7 +6988,7 @@ HRESULT CMinecraftApp::RegisterDLCData(eDLCContentType eType, WCHAR *pwchBannerN
// check if we already have this info from the local DLC file // check if we already have this info from the local DLC file
wstring wsTemp=wchUppercaseProductID; wstring wsTemp=wchUppercaseProductID;
AUTO_VAR(it, DLCInfo_Full.find(wsTemp)); auto it = DLCInfo_Full.find(wsTemp);
if( it == DLCInfo_Full.end() ) if( it == DLCInfo_Full.end() )
{ {
// Not found // Not found
@ -7097,7 +7096,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__) #if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal) bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
{ {
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); auto it = DLCInfo_SkinName.find(FirstSkin);
if( it == DLCInfo_SkinName.end() ) if( it == DLCInfo_SkinName.end() )
{ {
return false; return false;
@ -7110,7 +7109,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLON
} }
bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID) bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID)
{ {
AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); auto it = DLCTextures_PackID.find(iPackID);
if( it == DLCTextures_PackID.end() ) if( it == DLCTextures_PackID.end() )
{ {
*ppchKeyID=NULL; *ppchKeyID=NULL;
@ -7128,7 +7127,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName)
if(DLCInfo.size()>0) if(DLCInfo.size()>0)
{ {
AUTO_VAR(it, DLCInfo.find(tempString)); auto it = DLCInfo.find(tempString);
if( it == DLCInfo.end() ) if( it == DLCInfo.end() )
{ {
@ -7185,7 +7184,7 @@ char *CMinecraftApp::GetDLCInfoTextures(int iIndex)
#elif defined _XBOX_ONE #elif defined _XBOX_ONE
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring &ProductId) bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring &ProductId)
{ {
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); auto it = DLCInfo_SkinName.find(FirstSkin);
if( it == DLCInfo_SkinName.end() ) if( it == DLCInfo_SkinName.end() )
{ {
return false; return false;
@ -7198,7 +7197,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring
} }
bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &ProductId) bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &ProductId)
{ {
AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); auto it = DLCTextures_PackID.find(iPackID);
if( it == DLCTextures_PackID.end() ) if( it == DLCTextures_PackID.end() )
{ {
return false; return false;
@ -7243,7 +7242,7 @@ wstring CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex)
#else #else
bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal) bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal)
{ {
AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); auto it = DLCInfo_SkinName.find(FirstSkin);
if( it == DLCInfo_SkinName.end() ) if( it == DLCInfo_SkinName.end() )
{ {
return false; return false;
@ -7256,15 +7255,15 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLON
} }
bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal) bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal)
{ {
AUTO_VAR(it, DLCTextures_PackID.find(iPackID)); auto it = DLCTextures_PackID.find(iPackID);
if( it == DLCTextures_PackID.end() ) if( it == DLCTextures_PackID.end() )
{ {
*pullVal=(ULONGLONG)0; *pullVal=0ULL;
return false; return false;
} }
else else
{ {
*pullVal=(ULONGLONG)it->second; *pullVal=it->second;
return true; return true;
} }
} }
@ -7273,7 +7272,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
//DLC_INFO *pDLCInfo=NULL; //DLC_INFO *pDLCInfo=NULL;
if(DLCInfo_Trial.size()>0) if(DLCInfo_Trial.size()>0)
{ {
AUTO_VAR(it, DLCInfo_Trial.find(ullOfferID_Trial)); auto it = DLCInfo_Trial.find(ullOfferID_Trial);
if( it == DLCInfo_Trial.end() ) if( it == DLCInfo_Trial.end() )
{ {
@ -7330,7 +7329,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID)
wstring wsTemp = pwchProductID; wstring wsTemp = pwchProductID;
if(DLCInfo_Full.size()>0) if(DLCInfo_Full.size()>0)
{ {
AUTO_VAR(it, DLCInfo_Full.find(wsTemp)); auto it = DLCInfo_Full.find(wsTemp);
if( it == DLCInfo_Full.end() ) if( it == DLCInfo_Full.end() )
{ {
@ -7370,7 +7369,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full)
if(DLCInfo_Full.size()>0) if(DLCInfo_Full.size()>0)
{ {
AUTO_VAR(it, DLCInfo_Full.find(ullOfferID_Full)); auto it = DLCInfo_Full.find(ullOfferID_Full);
if( it == DLCInfo_Full.end() ) if( it == DLCInfo_Full.end() )
{ {
@ -7570,9 +7569,8 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size());
PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]); PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]);
int iCount=0; int iCount=0;
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it) for (PBANNEDLISTDATA pData : *m_vBannedListA[iPad] )
{ {
PBANNEDLISTDATA pData=*it;
memcpy(&pBannedList[iCount++],pData,sizeof(BANNEDLISTDATA)); memcpy(&pBannedList[iCount++],pData,sizeof(BANNEDLISTDATA));
} }
@ -7590,9 +7588,8 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName) bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName)
{ {
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ++it) for( PBANNEDLISTDATA pData : *m_vBannedListA[iPad] )
{ {
PBANNEDLISTDATA pData=*it;
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
PlayerUID bannedPlayerUID = pData->wchPlayerUID; PlayerUID bannedPlayerUID = pData->wchPlayerUID;
if(IsEqualXUID (bannedPlayerUID,xuid) && (strcmp(pData->pszLevelName,pszLevelName)==0)) if(IsEqualXUID (bannedPlayerUID,xuid) && (strcmp(pData->pszLevelName,pszLevelName)==0))
@ -7613,7 +7610,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
//bool bRes; //bool bRes;
// we will have retrieved the banned level list from TMS, so remove this one from it and write it back to TMS // we will have retrieved the banned level list from TMS, so remove this one from it and write it back to TMS
for(AUTO_VAR(it, m_vBannedListA[iPad]->begin()); it != m_vBannedListA[iPad]->end(); ) for (auto it = m_vBannedListA[iPad]->begin(); it != m_vBannedListA[iPad]->end(); )
{ {
PBANNEDLISTDATA pBannedListData = *it; PBANNEDLISTDATA pBannedListData = *it;
@ -8321,10 +8318,8 @@ unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, __int64 see
void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,int x,int z) void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,int x,int z)
{ {
// check we don't already have this in // check we don't already have this in
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it) for( FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
{ {
FEATURE_DATA *pFeatureData=*it;
if((pFeatureData->eTerrainFeature==eFeatureType) &&(pFeatureData->x==x) && (pFeatureData->z==z)) return; if((pFeatureData->eTerrainFeature==eFeatureType) &&(pFeatureData->x==x) && (pFeatureData->z==z)) return;
} }
@ -8338,10 +8333,8 @@ void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,
_eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z) _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z)
{ {
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it) for(FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
{ {
FEATURE_DATA *pFeatureData=*it;
if((pFeatureData->x==x) && (pFeatureData->z==z)) return pFeatureData->eTerrainFeature; if((pFeatureData->x==x) && (pFeatureData->z==z)) return pFeatureData->eTerrainFeature;
} }
@ -8350,10 +8343,8 @@ _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z)
bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType,int *pX, int *pZ) bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType,int *pX, int *pZ)
{ {
for(AUTO_VAR(it, m_vTerrainFeatures.begin()); it < m_vTerrainFeatures.end(); ++it) for ( const FEATURE_DATA *pFeatureData : m_vTerrainFeatures )
{ {
FEATURE_DATA *pFeatureData=*it;
if(pFeatureData->eTerrainFeature==eType) if(pFeatureData->eTerrainFeature==eType)
{ {
*pX=pFeatureData->x; *pX=pFeatureData->x;
@ -8489,10 +8480,8 @@ unsigned int CMinecraftApp::AddDLCRequest(eDLCMarketplaceType eType, bool bPromo
// If it's already in there, promote it to the top of the list // If it's already in there, promote it to the top of the list
int iPosition=0; int iPosition=0;
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{ {
DLCRequest *pCurrent = *it;
if(pCurrent->dwType==m_dwContentTypeA[eType]) if(pCurrent->dwType==m_dwContentTypeA[eType])
{ {
// already got this in the list // already got this in the list
@ -8543,7 +8532,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
bool bPromoted=false; bool bPromoted=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) for ( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{ {
TMSPPRequest *pCurrent = *it; TMSPPRequest *pCurrent = *it;
@ -8601,10 +8590,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
// this may already be present in the vector because of a previous trial/full offer // this may already be present in the vector because of a previous trial/full offer
bool bAlreadyInQueue=false; bool bAlreadyInQueue=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{ {
TMSPPRequest *pCurrent = *it;
if(wcscmp(pDLC->wchDataFile,pCurrent->wchFilename)==0) if(wcscmp(pDLC->wchDataFile,pCurrent->wchFilename)==0)
{ {
bAlreadyInQueue=true; bAlreadyInQueue=true;
@ -8664,10 +8651,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
if(!bPresent) // retrieve it from TMSPP if(!bPresent) // retrieve it from TMSPP
{ {
bool bAlreadyInQueue=false; bool bAlreadyInQueue=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{ {
TMSPPRequest *pCurrent = *it;
if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0) if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0)
{ {
bAlreadyInQueue=true; bAlreadyInQueue=true;
@ -8721,10 +8706,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
// this may already be present in the vector because of a previous trial/full offer // this may already be present in the vector because of a previous trial/full offer
bool bAlreadyInQueue=false; bool bAlreadyInQueue=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{ {
TMSPPRequest *pCurrent = *it;
if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0) if(wcscmp(pDLC->wchBanner,pCurrent->wchFilename)==0)
{ {
bAlreadyInQueue=true; bAlreadyInQueue=true;
@ -8767,10 +8750,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
bool CMinecraftApp::CheckTMSDLCCanStop() bool CMinecraftApp::CheckTMSDLCCanStop()
{ {
EnterCriticalSection(&csTMSPPDownloadQueue); EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{ {
TMSPPRequest *pCurrent = *it;
if(pCurrent->eState==e_TMS_ContentState_Retrieving) if(pCurrent->eState==e_TMS_ContentState_Retrieving)
{ {
LeaveCriticalSection(&csTMSPPDownloadQueue); LeaveCriticalSection(&csTMSPPDownloadQueue);
@ -8796,10 +8777,8 @@ bool CMinecraftApp::RetrieveNextDLCContent()
} }
EnterCriticalSection(&csDLCDownloadQueue); EnterCriticalSection(&csDLCDownloadQueue);
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) for( const DLCRequest* pCurrent : m_DLCDownloadQueue )
{ {
DLCRequest *pCurrent = *it;
if(pCurrent->eState==e_DLC_ContentState_Retrieving) if(pCurrent->eState==e_DLC_ContentState_Retrieving)
{ {
LeaveCriticalSection(&csDLCDownloadQueue); LeaveCriticalSection(&csDLCDownloadQueue);
@ -8808,10 +8787,8 @@ bool CMinecraftApp::RetrieveNextDLCContent()
} }
// Now look for the next retrieval // Now look for the next retrieval
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{ {
DLCRequest *pCurrent = *it;
if(pCurrent->eState==e_DLC_ContentState_Idle) if(pCurrent->eState==e_DLC_ContentState_Idle)
{ {
#ifdef _DEBUG #ifdef _DEBUG
@ -8853,9 +8830,8 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto
// find the right one in the vector // find the right one in the vector
EnterCriticalSection(&pClass->csTMSPPDownloadQueue); EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
for(AUTO_VAR(it, pClass->m_TMSPPDownloadQueue.begin()); it != pClass->m_TMSPPDownloadQueue.end(); ++it) for( TMSPPRequest *pCurrent : pClass->m_TMSPPDownloadQueue )
{ {
TMSPPRequest *pCurrent = *it;
#if defined(_XBOX) || defined(_WINDOWS64) #if defined(_XBOX) || defined(_WINDOWS64)
char szFile[MAX_TMSFILENAME_SIZE]; char szFile[MAX_TMSFILENAME_SIZE];
wcstombs(szFile,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE); wcstombs(szFile,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE);
@ -8956,8 +8932,7 @@ bool CMinecraftApp::RetrieveNextTMSPPContent()
if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) return false; if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) return false;
EnterCriticalSection(&csTMSPPDownloadQueue); for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
{ {
TMSPPRequest *pCurrent = *it; TMSPPRequest *pCurrent = *it;
@ -8970,7 +8945,7 @@ bool CMinecraftApp::RetrieveNextTMSPPContent()
} }
// Now look for the next retrieval // Now look for the next retrieval
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{ {
TMSPPRequest *pCurrent = *it; TMSPPRequest *pCurrent = *it;
@ -9074,10 +9049,9 @@ void CMinecraftApp::ClearAndResetDLCDownloadQueue()
int iPosition=0; int iPosition=0;
EnterCriticalSection(&csTMSPPDownloadQueue); EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{ {
DLCRequest *pCurrent = *it; if ( pCurrent )
delete pCurrent; delete pCurrent;
iPosition++; iPosition++;
} }
@ -9100,10 +9074,9 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved()
{ {
int iPosition=0; int iPosition=0;
EnterCriticalSection(&csTMSPPDownloadQueue); EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it) for ( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{ {
TMSPPRequest *pCurrent = *it; if ( pCurrent )
delete pCurrent; delete pCurrent;
iPosition++; iPosition++;
} }
@ -9118,10 +9091,8 @@ int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, in
// find the right one in the vector // find the right one in the vector
EnterCriticalSection(&pClass->csTMSPPDownloadQueue); EnterCriticalSection(&pClass->csTMSPPDownloadQueue);
for(AUTO_VAR(it, pClass->m_DLCDownloadQueue.begin()); it != pClass->m_DLCDownloadQueue.end(); ++it) for( DLCRequest *pCurrent : pClass->m_DLCDownloadQueue )
{ {
DLCRequest *pCurrent = *it;
// avatar items are coming back as type Content, so we can't trust the type setting // avatar items are coming back as type Content, so we can't trust the type setting
if(pCurrent->dwType==dwType) if(pCurrent->dwType==dwType)
{ {
@ -9151,10 +9122,8 @@ bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType)
// If there's already a retrieve in progress, quit // If there's already a retrieve in progress, quit
// we may have re-ordered the list, so need to check every item // we may have re-ordered the list, so need to check every item
EnterCriticalSection(&csDLCDownloadQueue); EnterCriticalSection(&csDLCDownloadQueue);
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it) for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{ {
DLCRequest *pCurrent = *it;
if((pCurrent->dwType==m_dwContentTypeA[eType]) && (pCurrent->eState==e_DLC_ContentState_Retrieved)) if((pCurrent->dwType==m_dwContentTypeA[eType]) && (pCurrent->eState==e_DLC_ContentState_Retrieved))
{ {
LeaveCriticalSection(&csDLCDownloadQueue); LeaveCriticalSection(&csDLCDownloadQueue);
@ -9208,17 +9177,17 @@ vector<ModelPart *> * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect
app.DebugPrintf("*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from array of Skin Boxes\n",dwSkinID&0x0FFFFFFF); app.DebugPrintf("*** SetAdditionalSkinBoxes - Inserting model parts for skin %d from array of Skin Boxes\n",dwSkinID&0x0FFFFFFF);
// convert the skin boxes into model parts, and add to the humanoid model // convert the skin boxes into model parts, and add to the humanoid model
for(AUTO_VAR(it, pvSkinBoxA->begin());it != pvSkinBoxA->end(); ++it) for( auto& it : *pvSkinBoxA )
{ {
if(pModel) if(pModel)
{ {
ModelPart *pModelPart=pModel->AddOrRetrievePart(*it); ModelPart *pModelPart=pModel->AddOrRetrievePart(it);
pvModelPart->push_back(pModelPart); pvModelPart->push_back(pModelPart);
} }
} }
m_AdditionalModelParts.insert( std::pair<DWORD, vector<ModelPart *> *>(dwSkinID, pvModelPart) ); m_AdditionalModelParts.emplace(dwSkinID, pvModelPart);
m_AdditionalSkinBoxes.insert( std::pair<DWORD, vector<SKIN_BOX *> *>(dwSkinID, pvSkinBoxA) ); m_AdditionalSkinBoxes.emplace(dwSkinID, pvSkinBoxA);
LeaveCriticalSection( &csAdditionalSkinBoxes ); LeaveCriticalSection( &csAdditionalSkinBoxes );
LeaveCriticalSection( &csAdditionalModelParts ); LeaveCriticalSection( &csAdditionalModelParts );
@ -9232,7 +9201,7 @@ vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
vector<ModelPart *> *pvModelParts=NULL; vector<ModelPart *> *pvModelParts=NULL;
if(m_AdditionalModelParts.size()>0) if(m_AdditionalModelParts.size()>0)
{ {
AUTO_VAR(it, m_AdditionalModelParts.find(dwSkinID)); auto it = m_AdditionalModelParts.find(dwSkinID);
if(it!=m_AdditionalModelParts.end()) if(it!=m_AdditionalModelParts.end())
{ {
pvModelParts = (*it).second; pvModelParts = (*it).second;
@ -9249,7 +9218,7 @@ vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID)
vector<SKIN_BOX *> *pvSkinBoxes=NULL; vector<SKIN_BOX *> *pvSkinBoxes=NULL;
if(m_AdditionalSkinBoxes.size()>0) if(m_AdditionalSkinBoxes.size()>0)
{ {
AUTO_VAR(it,m_AdditionalSkinBoxes.find(dwSkinID)); auto it = m_AdditionalSkinBoxes.find(dwSkinID);
if(it!=m_AdditionalSkinBoxes.end()) if(it!=m_AdditionalSkinBoxes.end())
{ {
pvSkinBoxes = (*it).second; pvSkinBoxes = (*it).second;
@ -9267,7 +9236,7 @@ unsigned int CMinecraftApp::GetAnimOverrideBitmask(DWORD dwSkinID)
if(m_AnimOverrides.size()>0) if(m_AnimOverrides.size()>0)
{ {
AUTO_VAR(it, m_AnimOverrides.find(dwSkinID)); auto it = m_AnimOverrides.find(dwSkinID);
if(it!=m_AnimOverrides.end()) if(it!=m_AnimOverrides.end())
{ {
uiAnimOverrideBitmask = (*it).second; uiAnimOverrideBitmask = (*it).second;
@ -9285,7 +9254,7 @@ void CMinecraftApp::SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOve
if(m_AnimOverrides.size()>0) if(m_AnimOverrides.size()>0)
{ {
AUTO_VAR(it, m_AnimOverrides.find(dwSkinID)); auto it = m_AnimOverrides.find(dwSkinID);
if(it!=m_AnimOverrides.end()) if(it!=m_AnimOverrides.end())
{ {
LeaveCriticalSection( &csAnimOverrideBitmask ); LeaveCriticalSection( &csAnimOverrideBitmask );

View file

@ -178,7 +178,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
{ {
//EAudioParameterType paramType = e_AudioParamType_Invalid; //EAudioParameterType paramType = e_AudioParamType_Invalid;
AUTO_VAR(it, parameterMapping.find( pParams->dwType )); auto it = parameterMapping.find(pParams->dwType);
if(it != parameterMapping.end() ) if(it != parameterMapping.end() )
{ {

View file

@ -32,9 +32,9 @@ DLCManager::DLCManager()
DLCManager::~DLCManager() DLCManager::~DLCManager()
{ {
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for ( DLCPack *pack : m_packs )
{ {
DLCPack *pack = *it; if ( pack )
delete pack; delete pack;
} }
} }
@ -60,10 +60,9 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
DWORD packCount = 0; DWORD packCount = 0;
if( type != e_DLCType_All ) if( type != e_DLCType_All )
{ {
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *pack : m_packs )
{ {
DLCPack *pack = *it; if( pack && pack->getDLCItemsCount(type) > 0 )
if( pack->getDLCItemsCount(type) > 0 )
{ {
++packCount; ++packCount;
} }
@ -85,7 +84,7 @@ void DLCManager::removePack(DLCPack *pack)
{ {
if(pack != NULL) if(pack != NULL)
{ {
AUTO_VAR(it, find(m_packs.begin(),m_packs.end(),pack)); auto it = find(m_packs.begin(), m_packs.end(), pack);
if(it != m_packs.end() ) m_packs.erase(it); if(it != m_packs.end() ) m_packs.erase(it);
delete pack; delete pack;
} }
@ -93,9 +92,9 @@ void DLCManager::removePack(DLCPack *pack)
void DLCManager::removeAllPacks(void) void DLCManager::removeAllPacks(void)
{ {
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *pack : m_packs )
{ {
DLCPack *pack = (DLCPack *)*it; if ( pack )
delete pack; delete pack;
} }
@ -104,23 +103,19 @@ void DLCManager::removeAllPacks(void)
void DLCManager::LanguageChanged(void) void DLCManager::LanguageChanged(void)
{ {
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *pack : m_packs )
{ {
DLCPack *pack = (DLCPack *)*it;
// update the language // update the language
pack->UpdateLanguage(); pack->UpdateLanguage();
} }
} }
DLCPack *DLCManager::getPack(const wstring &name) DLCPack *DLCManager::getPack(const wstring &name)
{ {
DLCPack *pack = NULL; DLCPack *pack = NULL;
//DWORD currentIndex = 0; //DWORD currentIndex = 0;
DLCPack *currentPack = NULL; for( DLCPack * currentPack : m_packs )
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
{ {
currentPack = *it;
wstring wsName=currentPack->getName(); wstring wsName=currentPack->getName();
if(wsName.compare(name) == 0) if(wsName.compare(name) == 0)
@ -136,11 +131,8 @@ DLCPack *DLCManager::getPack(const wstring &name)
DLCPack *DLCManager::getPackFromProductID(const wstring &productID) DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
{ {
DLCPack *pack = NULL; DLCPack *pack = NULL;
//DWORD currentIndex = 0; for( DLCPack *currentPack : m_packs )
DLCPack *currentPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
{ {
currentPack = *it;
wstring wsName=currentPack->getPurchaseOfferId(); wstring wsName=currentPack->getPurchaseOfferId();
if(wsName.compare(productID) == 0) if(wsName.compare(productID) == 0)
@ -159,10 +151,8 @@ DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
if( type != e_DLCType_All ) if( type != e_DLCType_All )
{ {
DWORD currentIndex = 0; DWORD currentIndex = 0;
DLCPack *currentPack = NULL; for( DLCPack *currentPack : m_packs )
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
{ {
currentPack = *it;
if(currentPack->getDLCItemsCount(type)>0) if(currentPack->getDLCItemsCount(type)>0)
{ {
if(currentIndex == index) if(currentIndex == index)
@ -200,9 +190,8 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
if( type != e_DLCType_All ) if( type != e_DLCType_All )
{ {
DWORD index = 0; DWORD index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *thisPack : m_packs )
{ {
DLCPack *thisPack = *it;
if(thisPack->getDLCItemsCount(type)>0) if(thisPack->getDLCItemsCount(type)>0)
{ {
if(thisPack == pack) if(thisPack == pack)
@ -218,9 +207,8 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
else else
{ {
DWORD index = 0; DWORD index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *thisPack : m_packs )
{ {
DLCPack *thisPack = *it;
if(thisPack == pack) if(thisPack == pack)
{ {
found = true; found = true;
@ -238,9 +226,8 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
DWORD foundIndex = 0; DWORD foundIndex = 0;
found = false; found = false;
DWORD index = 0; DWORD index = 0;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *pack : m_packs )
{ {
DLCPack *pack = *it;
if(pack->getDLCItemsCount(e_DLCType_Skin)>0) if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
{ {
if(pack->doesPackContainSkin(path)) if(pack->doesPackContainSkin(path))
@ -258,9 +245,8 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
DLCPack *DLCManager::getPackContainingSkin(const wstring &path) DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
{ {
DLCPack *foundPack = NULL; DLCPack *foundPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *pack : m_packs )
{ {
DLCPack *pack = *it;
if(pack->getDLCItemsCount(e_DLCType_Skin)>0) if(pack->getDLCItemsCount(e_DLCType_Skin)>0)
{ {
if(pack->doesPackContainSkin(path)) if(pack->doesPackContainSkin(path))
@ -276,9 +262,8 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
DLCSkinFile *DLCManager::getSkinFile(const wstring &path) DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
{ {
DLCSkinFile *foundSkinfile = NULL; DLCSkinFile *foundSkinfile = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *pack : m_packs )
{ {
DLCPack *pack = *it;
foundSkinfile=pack->getSkinFile(path); foundSkinfile=pack->getSkinFile(path);
if(foundSkinfile!=NULL) if(foundSkinfile!=NULL)
{ {
@ -291,12 +276,10 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
{ {
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount; DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
DLCPack *pack = NULL;
DLCPack *firstCorruptPack = NULL; DLCPack *firstCorruptPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) for( DLCPack *pack : m_packs )
{ {
pack = *it;
if( pack->IsCorrupt() ) if( pack->IsCorrupt() )
{ {
++corruptDLCCount; ++corruptDLCCount;
@ -468,7 +451,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
{ {
//DLCManager::EDLCParameterType paramType = DLCManager::e_DLCParamType_Invalid; //DLCManager::EDLCParameterType paramType = DLCManager::e_DLCParamType_Invalid;
AUTO_VAR(it, parameterMapping.find( pParams->dwType )); auto it = parameterMapping.find(pParams->dwType);
if(it != parameterMapping.end() ) if(it != parameterMapping.end() )
{ {
@ -658,7 +641,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
for(unsigned int j=0;j<uiParameterCount;j++) for(unsigned int j=0;j<uiParameterCount;j++)
{ {
AUTO_VAR(it, parameterMapping.find( pParams->dwType )); auto it = parameterMapping.find(pParams->dwType);
if(it != parameterMapping.end() ) if(it != parameterMapping.end() )
{ {

View file

@ -54,16 +54,18 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas
DLCPack::~DLCPack() DLCPack::~DLCPack()
{ {
for(AUTO_VAR(it, m_childPacks.begin()); it != m_childPacks.end(); ++it) for( auto& it : m_childPacks )
{ {
delete *it; if ( it )
delete it;
} }
for(unsigned int i = 0; i < DLCManager::e_DLCType_Max; ++i) for(unsigned int i = 0; i < DLCManager::e_DLCType_Max; ++i)
{ {
for(AUTO_VAR(it,m_files[i].begin()); it != m_files[i].end(); ++it) for (auto& it : m_files[i] )
{ {
delete *it; if ( it )
delete it;
} }
} }
@ -161,7 +163,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, const wstring &va
bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int &param) bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned int &param)
{ {
AUTO_VAR(it,m_parameters.find((int)type)); auto it = m_parameters.find((int)type);
if(it != m_parameters.end()) if(it != m_parameters.end())
{ {
switch(type) switch(type)
@ -270,7 +272,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
else else
{ {
g_pathCmpString = &path; g_pathCmpString = &path;
AUTO_VAR(it, find_if( m_files[type].begin(), m_files[type].end(), pathCmp )); auto it = find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
hasFile = it != m_files[type].end(); hasFile = it != m_files[type].end();
if(!hasFile && m_parentPack ) if(!hasFile && m_parentPack )
{ {
@ -316,7 +318,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
else else
{ {
g_pathCmpString = &path; g_pathCmpString = &path;
AUTO_VAR(it, find_if( m_files[type].begin(), m_files[type].end(), pathCmp )); auto it = find_if(m_files[type].begin(), m_files[type].end(), pathCmp);
if(it == m_files[type].end()) if(it == m_files[type].end())
{ {
@ -368,9 +370,9 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const wstring &path, bo
DWORD foundIndex = 0; DWORD foundIndex = 0;
found = false; found = false;
DWORD index = 0; DWORD index = 0;
for(AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it) for( auto& it : m_files[type] )
{ {
if(path.compare((*it)->getPath()) == 0) if(path.compare(it->getPath()) == 0)
{ {
foundIndex = index; foundIndex = index;
found = true; found = true;

View file

@ -14,10 +14,10 @@ void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
GameRuleDefinition::writeAttributes(dos, numAttributes + 2); GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId);
dos->writeUTF( _toString( m_enchantmentId ) ); dos->writeUTF( std::to_wstring( m_enchantmentId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentLevel); 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) void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)

View file

@ -17,26 +17,26 @@ void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs
GameRuleDefinition::writeAttributes(dos, numAttrs + 5); GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
dos->writeUTF( _toString( m_itemId ) ); dos->writeUTF( std::to_wstring( m_itemId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
dos->writeUTF( _toString( m_quantity ) ); dos->writeUTF( std::to_wstring( m_quantity ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
dos->writeUTF( _toString( m_auxValue ) ); dos->writeUTF( std::to_wstring( m_auxValue ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
dos->writeUTF( _toString( m_dataTag ) ); dos->writeUTF( std::to_wstring( m_dataTag ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot);
dos->writeUTF( _toString( m_slot ) ); dos->writeUTF( std::to_wstring( m_slot ) );
} }
void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{ {
GameRuleDefinition::getChildren( children ); GameRuleDefinition::getChildren( children );
for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++) for ( const auto& it : m_enchantments )
children->push_back( *it ); children->push_back( it );
} }
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
@ -99,13 +99,13 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
bool added = false; bool added = false;
if(Item::items[m_itemId] != NULL) 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) ); shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
newItem->set4JData(m_dataTag); 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() ) if(m_slot >= 0 && m_slot < container->getContainerSize() )

View file

@ -37,19 +37,19 @@ void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename);
dos->writeUTF(m_schematicName); dos->writeUTF(m_schematicName);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); 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); 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); 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); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot);
switch (m_rotation) switch (m_rotation)
{ {
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(_toString( 0 )); break; case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(L"0"); break;
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(_toString( 90 )); break; case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(L"90"); break;
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(_toString( 180 )); break; case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(L"180"); break;
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(_toString( 270 )); break; case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(L"270"); break;
} }
} }

View file

@ -14,11 +14,11 @@ void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs)
GameRuleDefinition::writeAttributes(dos, numAttrs + 3); GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
dos->writeUTF(_toString(m_biomeId)); dos->writeUTF(std::to_wstring(m_biomeId));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
dos->writeUTF(_toString(m_tile)); dos->writeUTF(std::to_wstring(m_tile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId); 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) void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue)

View file

@ -22,13 +22,13 @@ void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numA
GameRuleDefinition::writeAttributes(dos, numAttributes + 3); GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
dos->writeUTF( _toString( m_itemId ) ); dos->writeUTF( std::to_wstring( m_itemId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
dos->writeUTF( _toString( m_auxValue ) ); dos->writeUTF( std::to_wstring( m_auxValue ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity); 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) void CollectItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@ -108,9 +108,9 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
wstring xml = L""; wstring xml = L"";
if(item != NULL) if(item != NULL)
{ {
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\""; xml = L"<CollectItemRule itemId=\"" + std::to_wstring(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + _toString<int>(item->getAuxValue()) + L"\""; if(item->getAuxValue() != 0) xml += L" auxValue=\"" + std::to_wstring(item->getAuxValue()) + L"\"";
if(item->get4JData() != 0) xml += L" dataTag=\"" + _toString<int>(item->get4JData()) + L"\""; if(item->get4JData() != 0) xml += L" dataTag=\"" + std::to_wstring(item->get4JData()) + L"\"";
xml += L"/>\n"; xml += L"/>\n";
} }
return xml; return xml;

View file

@ -28,12 +28,12 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
{ {
int goal = 0; int goal = 0;
int progress = 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(); goal += it.second.gr->getGameRuleDefinition()->getGoal();
progress += it->second.gr->getGameRuleDefinition()->getProgress(it->second.gr); progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
} }
} }
if(rule->getConnection() != NULL) if(rule->getConnection() != NULL)
@ -60,7 +60,7 @@ wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &desc
{ {
PacketData *values = (PacketData *)data; PacketData *values = (PacketData *)data;
wstring newDesc = description; wstring newDesc = description;
newDesc = replaceAll(newDesc,L"{*progress*}",_toString<int>(values->progress)); newDesc = replaceAll(newDesc,L"{*progress*}",std::to_wstring(values->progress));
newDesc = replaceAll(newDesc,L"{*goal*}",_toString<int>(values->goal)); newDesc = replaceAll(newDesc,L"{*goal*}",std::to_wstring(values->goal));
return newDesc; return newDesc;
} }

View file

@ -11,17 +11,17 @@ CompoundGameRuleDefinition::CompoundGameRuleDefinition()
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) void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{ {
GameRuleDefinition::getChildren(children); GameRuleDefinition::getChildren(children);
for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++) for (auto& it : m_children )
children->push_back(*it); children->push_back(it);
} }
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
@ -57,17 +57,17 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
{ {
GameRule *newRule = NULL; GameRule *newRule = NULL;
int i = 0; 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() ); newRule = new GameRule(it, rule->getConnection() );
(*it)->populateGameRule(type,newRule); it->populateGameRule(type,newRule);
GameRule::ValueType value; GameRule::ValueType value;
value.gr = newRule; value.gr = newRule;
value.isPointer = true; value.isPointer = true;
// Somehow add the newRule to the current rule // 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; ++i;
} }
GameRuleDefinition::populateGameRule(type, rule); 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 CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
{ {
bool statusChanged = false; 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) if(!statusChanged && changed)
{ {
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition(); m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
statusChanged = true; 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 CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
{ {
bool statusChanged = false; 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) if(!statusChanged && changed)
{ {
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition(); m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
statusChanged = true; statusChanged = true;
} }
} }
@ -111,8 +111,8 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player) 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);
} }
} }

View file

@ -19,8 +19,8 @@ void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *childre
{ {
GameRuleDefinition::getChildren(children); GameRuleDefinition::getChildren(children);
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++) for ( auto& action : m_actions )
children->push_back( *it ); children->push_back( action );
} }
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType) GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
@ -60,16 +60,16 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAt
GameRuleDefinition::writeAttributes(dos, numAttrs + 5); GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_x)); dos->writeUTF(std::to_wstring(m_x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_y)); dos->writeUTF(std::to_wstring(m_y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_z)); dos->writeUTF(std::to_wstring(m_z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
dos->writeUTF(_toString(orientation)); dos->writeUTF(std::to_wstring(orientation));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension); 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) void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@ -117,12 +117,11 @@ BoundingBox* ConsoleGenerateStructure::getBoundingBox()
// Find the max bounds // Find the max bounds
int maxX, maxY, maxZ; int maxX, maxY, maxZ;
maxX = maxY = maxZ = 1; 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 = std::max<int>(maxX,action->getEndX());
maxX = max(maxX,action->getEndX()); maxY = std::max<int>(maxY,action->getEndY());
maxY = max(maxY,action->getEndY()); maxZ = std::max<int>(maxZ,action->getEndZ());
maxZ = max(maxZ,action->getEndZ());
} }
boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ); boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ);
@ -134,10 +133,8 @@ bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, Boundin
{ {
if(level->dimension->id != m_dimension) return false; 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()) switch(action->getActionType())
{ {
case ConsoleGameRules::eGameRuleType_GenerateBox: case ConsoleGameRules::eGameRuleType_GenerateBox:

View file

@ -167,18 +167,18 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>(); ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
tag->put(L"TileEntities", tileEntityTags); 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(); CompoundTag *cTag = new CompoundTag();
(*it)->save(cTag); it->save(cTag);
tileEntityTags->add(cTag); tileEntityTags->add(cTag);
} }
ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>(); ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>();
tag->put(L"Entities", entityTags); tag->put(L"Entities", entityTags);
for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end(); it++) for (auto& it : m_entities )
entityTags->add( (CompoundTag *)(*it).second->copy() ); entityTags->add( (CompoundTag *)(it).second->copy() );
NbtIo::write(tag,dos); NbtIo::write(tag,dos);
delete tag; delete tag;
@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot) __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{ {
int xStart = max(destinationBox->x0, (double)chunk->x*16); int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16); int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
int yStart = destinationBox->y0; int yStart = destinationBox->y0;
int yEnd = destinationBox->y1; int yEnd = destinationBox->y1;
if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight; if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight;
int zStart = max(destinationBox->z0, (double)chunk->z*16); int zStart = static_cast<int>(std::fmax<double>(destinationBox->z0, (double)chunk->z * 16));
int zEnd = min(destinationBox->z1, (double)((zStart>>4)<<4) + 16); int zEnd = static_cast<int>(std::fmin<double>(destinationBox->z1, (double)((zStart >> 4) << 4) + 16));
#ifdef _DEBUG #ifdef _DEBUG
app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1); 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) 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 targetX = te->x;
double targetY = te->y + destinationBox->y0; double targetY = te->y + destinationBox->y0;
double targetZ = te->z; double targetZ = te->z;
@ -477,7 +475,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
teCopy->setChanged(); 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; Vec3 *source = it->first;
@ -679,9 +677,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
for (int zc = zc0; zc <= zc1; zc++) 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); 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(); CompoundTag *teTag = new CompoundTag();
shared_ptr<TileEntity> teCopy = te->clone(); 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); vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities"); 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; bool mobCanBeSaved = false;
if (bSaveMobs) if (bSaveMobs)
{ {
@ -1012,13 +1007,16 @@ 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> > *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> >; 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; for ( auto& it : chunk->tileEntities )
{
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) if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
{ {
result->push_back(te); result->push_back(te);
} }
} }
}
return result; return result;
} }

View file

@ -9,11 +9,11 @@ GameRule::GameRule(GameRuleDefinition *definition, Connection *connection)
GameRule::~GameRule() 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. // Find required parameters.
dos->writeInt(m_parameters.size()); 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; wstring pName = parameter.first;
ValueType vType = (*it).second; ValueType vType = parameter.second;
dos->writeUTF( (*it).first ); dos->writeUTF( parameter.first );
dos->writeBoolean( vType.isPointer ); dos->writeBoolean( vType.isPointer );
if (vType.isPointer) if (vType.isPointer)

View file

@ -25,8 +25,8 @@ void GameRuleDefinition::write(DataOutputStream *dos)
// Write children. // Write children.
dos->writeInt( children->size() ); dos->writeInt( children->size() );
for (AUTO_VAR(it, children->begin()); it != children->end(); it++) for ( auto& it : *children )
(*it)->write(dos); it->write(dos);
} }
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes) void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
@ -40,7 +40,7 @@ void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttribut
dos->writeUTF(m_promptId); dos->writeUTF(m_promptId);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
dos->writeUTF(_toString(m_4JDataValue)); dos->writeUTF(std::to_wstring(m_4JDataValue));
} }
void GameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) {} void GameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) {}
@ -121,8 +121,8 @@ unordered_map<GameRuleDefinition *, int> *GameRuleDefinition::enumerateMap()
int i = 0; int i = 0;
vector<GameRuleDefinition *> *gRules = enumerate(); vector<GameRuleDefinition *> *gRules = enumerate();
for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++) for ( auto& it : *gRules )
out->insert( pair<GameRuleDefinition *, int>( *it, i++ ) ); out->emplace(it, i++);
return out; return out;
} }

View file

@ -344,11 +344,10 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
// Write schematic files. // Write schematic files.
unordered_map<wstring, ConsoleSchematicFile *> *files; unordered_map<wstring, ConsoleSchematicFile *> *files;
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles(); files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
dos->writeInt( files->size() ); for ( auto& it : *files )
for (AUTO_VAR(it, files->begin()); it != files->end(); it++)
{ {
wstring filename = it->first; const wstring& filename = it.first;
ConsoleSchematicFile *file = it->second; ConsoleSchematicFile *file = it.second;
ByteArrayOutputStream fileBaos; ByteArrayOutputStream fileBaos;
DataOutputStream fileDos(&fileBaos); DataOutputStream fileDos(&fileBaos);
@ -519,7 +518,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
{ {
int tagId = contentDis->readInt(); int tagId = contentDis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid; ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
AUTO_VAR(it,tagIdMap.find(tagId)); auto it = tagIdMap.find(tagId);
if(it != tagIdMap.end()) tagVal = it->second; if(it != tagIdMap.end()) tagVal = it->second;
GameRuleDefinition *rule = NULL; GameRuleDefinition *rule = NULL;
@ -595,7 +594,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
{ {
int tagId = dis->readInt(); int tagId = dis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid; ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
AUTO_VAR(it,tagIdMap->find(tagId)); auto it = tagIdMap->find(tagId);
if(it != tagIdMap->end()) tagVal = it->second; if(it != tagIdMap->end()) tagVal = it->second;
GameRuleDefinition *childRule = NULL; GameRuleDefinition *childRule = NULL;
@ -640,18 +639,6 @@ void GameRuleManager::loadDefaultGameRules()
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME)); 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 #else // _XBOX
#ifdef _WINDOWS64 #ifdef _WINDOWS64

View file

@ -67,23 +67,24 @@ LevelGenerationOptions::~LevelGenerationOptions()
{ {
clearSchematics(); clearSchematics();
if(m_spawnPos != NULL) delete m_spawnPos; 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; delete it;
}
for(AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); ++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) if (m_stringTable)
@ -100,16 +101,16 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttr
GameRuleDefinition::writeAttributes(dos, numAttrs + 5); GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX); 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); 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); 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); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed);
dos->writeUTF(_toString(m_seed)); dos->writeUTF(std::to_wstring(m_seed));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld);
dos->writeUTF(_toString(m_useFlatWorld)); dos->writeUTF(std::to_wstring(m_useFlatWorld));
} }
void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children) void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
@ -117,18 +118,25 @@ void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
GameRuleDefinition::getChildren(children); GameRuleDefinition::getChildren(children);
vector<ApplySchematicRuleDefinition *> used_schematics; vector<ApplySchematicRuleDefinition *> used_schematics;
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++) for (auto& it : m_schematicRules )
if ( !(*it)->isComplete() ) if ( it && !it->isComplete() )
used_schematics.push_back( *it ); used_schematics.push_back( it );
for(AUTO_VAR(it, m_structureRules.begin()); it!=m_structureRules.end(); it++) for (auto& it : m_structureRules)
children->push_back( *it ); if ( it )
for(AUTO_VAR(it, used_schematics.begin()); it!=used_schematics.end(); it++) children->push_back( it );
children->push_back( *it );
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it) for (auto& it : used_schematics)
children->push_back( *it ); if ( it )
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) children->push_back( 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) GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
@ -249,19 +257,14 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk)
{ {
PIXBeginNamedEvent(0,"Processing schematics for chunk (%d,%d)", chunk->x, chunk->z); 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); 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->processSchematic(chunkBox, chunk); rule->processSchematic(chunkBox, chunk);
}
int cx = (chunk->x << 4); int cx = (chunk->x << 4);
int cz = (chunk->z << 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)) if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
{ {
BoundingBox *bb = new BoundingBox(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); 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); 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); rule->processSchematicLighting(chunkBox, chunk);
} }
PIXEndNamedEvent(); 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 // a) ores generally being below ground/sea level and b) tutorial world additions generally being above ground/sea level
if(!m_bHaveMinY) 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(); int minY = rule->getMinY();
if(minY < m_minY) m_minY = minY; 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(); int minY = structureStart->getMinY();
if(minY < m_minY) m_minY = minY; 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; if( y1 < m_minY ) return false;
bool intersects = 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); intersects = rule->checkIntersects(x0,y0,z0,x1,y1,z1);
if(intersects) break; if(intersects) break;
} }
if(!intersects) 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); intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1);
if(intersects) break; if(intersects) break;
} }
@ -335,9 +333,9 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
void LevelGenerationOptions::clearSchematics() 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(); m_schematics.clear();
} }
@ -345,7 +343,7 @@ void LevelGenerationOptions::clearSchematics()
ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen) ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen)
{ {
// If we have already loaded this, just return // 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()) if(it != m_schematics.end())
{ {
#ifndef _CONTENT_PACKAGE #ifndef _CONTENT_PACKAGE
@ -370,7 +368,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
{ {
ConsoleSchematicFile *schematic = NULL; ConsoleSchematicFile *schematic = NULL;
// If we have already loaded this, just return // 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()) if(it != m_schematics.end())
{ {
schematic = it->second; schematic = it->second;
@ -381,7 +379,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
void LevelGenerationOptions::releaseSchematicFile(const wstring &filename) 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 // 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()) //if(it != m_schematics.end())
//{ //{
// ConsoleSchematicFile *schematic = it->second; // ConsoleSchematicFile *schematic = it->second;
@ -413,10 +411,9 @@ LPCWSTR LevelGenerationOptions::getString(const wstring &key)
void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile) 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 && bo->isBiome(biomeId) )
if(bo->isBiome(biomeId))
{ {
bo->getTileValues(tile,topTile); bo->getTileValues(tile,topTile);
break; break;
@ -428,9 +425,8 @@ bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFea
{ {
bool isFeature = false; 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)) if(sf->isFeatureChunk(chunkX, chunkZ, feature, orientation))
{ {
isFeature = true; isFeature = true;
@ -444,15 +440,15 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
{ {
// Clean schematic rules. // Clean schematic rules.
unordered_set<wstring> usedFiles = unordered_set<wstring>(); unordered_set<wstring> usedFiles = unordered_set<wstring>();
for (AUTO_VAR(it, m_schematicRules.begin()); it!=m_schematicRules.end(); it++) for ( auto& it : m_schematicRules )
if ( !(*it)->isComplete() ) if ( !it->isComplete() )
usedFiles.insert( (*it)->getSchematicName() ); usedFiles.insert( it->getSchematicName() );
// Clean schematic files. // Clean schematic files.
unordered_map<wstring, ConsoleSchematicFile *> *out unordered_map<wstring, ConsoleSchematicFile *> *out
= new unordered_map<wstring, ConsoleSchematicFile *>(); = new unordered_map<wstring, ConsoleSchematicFile *>();
for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++) for ( auto& it : usedFiles )
out->insert( pair<wstring, ConsoleSchematicFile *>(*it, getSchematicFile(*it)) ); out->insert( pair<wstring, ConsoleSchematicFile *>(it, getSchematicFile(it)) );
return out; return out;
} }
@ -619,11 +615,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
void LevelGenerationOptions::reset_start() void LevelGenerationOptions::reset_start()
{ {
for ( AUTO_VAR( it, m_schematicRules.begin()); for ( auto& it : m_schematicRules )
it != m_schematicRules.end();
it++ )
{ {
(*it)->reset(); if ( it )
it->reset();
} }
} }

View file

@ -11,7 +11,7 @@ LevelRuleset::LevelRuleset()
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; delete *it;
} }
@ -20,8 +20,8 @@ LevelRuleset::~LevelRuleset()
void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children) void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
{ {
CompoundGameRuleDefinition::getChildren(children); CompoundGameRuleDefinition::getChildren(children);
for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++) for (const auto& area : m_areas)
children->push_back(*it); children->push_back(area);
} }
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType) GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
@ -58,12 +58,12 @@ LPCWSTR LevelRuleset::getString(const wstring &key)
AABB *LevelRuleset::getNamedArea(const wstring &areaName) AABB *LevelRuleset::getNamedArea(const wstring &areaName)
{ {
AABB *area = NULL; AABB *area = nullptr;
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it) for(auto& it : m_areas)
{ {
if( (*it)->getName().compare(areaName) == 0 ) if( it->getName().compare(areaName) == 0 )
{ {
area = (*it)->getArea(); area = it->getArea();
break; break;
} }
} }

View file

@ -22,18 +22,18 @@ void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAtt
dos->writeUTF(m_name); dos->writeUTF(m_name);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0); 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); 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); 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); 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); 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); 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) void NamedAreaRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)

View file

@ -15,13 +15,13 @@ void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs)
GameRuleDefinition::writeAttributes(dos, numAttrs + 4); GameRuleDefinition::writeAttributes(dos, numAttrs + 4);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX);
dos->writeUTF(_toString(m_chunkX)); dos->writeUTF(std::to_wstring(m_chunkX));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ);
dos->writeUTF(_toString(m_chunkZ)); dos->writeUTF(std::to_wstring(m_chunkZ));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature); 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); 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) void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue)

View file

@ -18,9 +18,9 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition()
UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition() 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 ); GameRuleDefinition::writeAttributes(dos, numAttributes + attrCount );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX); 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); 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); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
dos->writeUTF(_toString(m_spawnPos->z)); dos->writeUTF(std::to_wstring(m_spawnPos->z));
if(m_bUpdateYRot) if(m_bUpdateYRot)
{ {
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot);
dos->writeUTF(_toString(m_yRot)); dos->writeUTF(std::to_wstring(m_yRot));
} }
if(m_bUpdateHealth) if(m_bUpdateHealth)
{ {
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food);
dos->writeUTF(_toString(m_health)); dos->writeUTF(std::to_wstring(m_health));
} }
if(m_bUpdateFood) if(m_bUpdateFood)
{ {
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health);
dos->writeUTF(_toString(m_food)); dos->writeUTF(std::to_wstring(m_food));
} }
} }
void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{ {
GameRuleDefinition::getChildren(children); GameRuleDefinition::getChildren(children);
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++) for(auto& item : m_items)
children->push_back(*it); children->push_back(item);
} }
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) 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); 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); addItem->addItemToContainer(player->inventory, -1);
} }
} }

View file

@ -13,19 +13,19 @@ void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttri
GameRuleDefinition::writeAttributes(dos, numAttributes + 5); GameRuleDefinition::writeAttributes(dos, numAttributes + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
dos->writeUTF(_toString(m_tileId)); dos->writeUTF(std::to_wstring(m_tileId));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords);
dos->writeUTF(_toString(m_useCoords)); dos->writeUTF(std::to_wstring(m_useCoords));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); 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); 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); 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) void UseTileRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)

View file

@ -14,25 +14,25 @@ void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9); ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
dos->writeUTF(_toString(m_x0)); dos->writeUTF(std::to_wstring(m_x0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
dos->writeUTF(_toString(m_y0)); dos->writeUTF(std::to_wstring(m_y0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
dos->writeUTF(_toString(m_z0)); dos->writeUTF(std::to_wstring(m_z0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
dos->writeUTF(_toString(m_x1)); dos->writeUTF(std::to_wstring(m_x1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
dos->writeUTF(_toString(m_y1)); dos->writeUTF(std::to_wstring(m_y1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
dos->writeUTF(_toString(m_z1)); dos->writeUTF(std::to_wstring(m_z1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile);
dos->writeUTF(_toString(m_edgeTile)); dos->writeUTF(std::to_wstring(m_edgeTile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile);
dos->writeUTF(_toString(m_fillTile)); dos->writeUTF(std::to_wstring(m_fillTile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir); 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) void XboxStructureActionGenerateBox::addAttribute(const wstring &attributeName, const wstring &attributeValue)

View file

@ -13,16 +13,16 @@ void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, UINT
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5); ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_x)); dos->writeUTF(std::to_wstring(m_x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_y)); dos->writeUTF(std::to_wstring(m_y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_z)); dos->writeUTF(std::to_wstring(m_z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data);
dos->writeUTF(_toString(m_data)); dos->writeUTF(std::to_wstring(m_data));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block); ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block);
dos->writeUTF(_toString(m_tile)); dos->writeUTF(std::to_wstring(m_tile));
} }

View file

@ -14,9 +14,9 @@ XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer()
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;
} }
} }
@ -27,8 +27,8 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer()
void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *> *children) void XboxStructureActionPlaceContainer::getChildren(vector<GameRuleDefinition *> *children)
{ {
XboxStructureActionPlaceBlock::getChildren(children); XboxStructureActionPlaceBlock::getChildren(children);
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++) for(auto & item : m_items)
children->push_back( *it ); children->push_back( item );
} }
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType) GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
@ -86,7 +86,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS); level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
// Add items // Add items
int slotId = 0; 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; AddItemRuleDefinition *addItem = *it;

View file

@ -492,9 +492,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
do do
{ {
// We need to keep ticking the connections for players that already logged in // We need to keep ticking the connections for players that already logged in
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it) for (auto& it : createdConnections )
{ {
(*it)->tick(); if ( it )
it->tick();
} }
// 4J Stu - We were ticking this way too fast which could cause the connection to time out // 4J Stu - We were ticking this way too fast which could cause the connection to time out
@ -522,7 +523,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
else else
{ {
connection->close(); connection->close();
AUTO_VAR(it, find( createdConnections.begin(), createdConnections.end(), connection )); auto it = find(createdConnections.begin(), createdConnections.end(), connection);
if(it != createdConnections.end() ) createdConnections.erase( it ); if(it != createdConnections.end() ) createdConnections.erase( it );
} }
} }
@ -539,9 +540,9 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
if(g_NetworkManager.IsLeavingGame() || !IsInSession() ) if(g_NetworkManager.IsLeavingGame() || !IsInSession() )
{ {
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it) for (auto& it : createdConnections)
{ {
(*it)->close(); it->close();
} }
// assert(false); // assert(false);
MinecraftServer::HaltServer(); MinecraftServer::HaltServer();
@ -1218,9 +1219,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
if( pServer != NULL ) if( pServer != NULL )
{ {
PlayerList *players = pServer->getPlayers(); PlayerList *players = pServer->getPlayers();
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it) for(auto& servPlayer : players->players)
{ {
shared_ptr<ServerPlayer> servPlayer = *it;
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() ) if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
{ {
servPlayer->connection->connection->getSocket()->setPlayer(NULL); servPlayer->connection->connection->getSocket()->setPlayer(NULL);
@ -1286,9 +1286,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid(); PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid();
PlayerList *players = pServer->getPlayers(); PlayerList *players = pServer->getPlayers();
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it) for(auto& servPlayer : players->players)
{ {
shared_ptr<ServerPlayer> servPlayer = *it;
if( servPlayer->getXuid() == localPlayerXuid ) if( servPlayer->getXuid() == localPlayerXuid )
{ {
servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) ); servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) );

View file

@ -64,9 +64,8 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
{ {
// Do we already have a primary player for this system? // Do we already have a primary player for this system?
bool systemHasPrimaryPlayer = false; bool systemHasPrimaryPlayer = false;
for(AUTO_VAR(it, m_machineQNetPrimaryPlayers.begin()); it < m_machineQNetPrimaryPlayers.end(); ++it) for (auto& pQNetPrimaryPlayer : m_machineQNetPrimaryPlayers)
{ {
IQNetPlayer *pQNetPrimaryPlayer = *it;
if( pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer) ) if( pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer) )
{ {
systemHasPrimaryPlayer = true; systemHasPrimaryPlayer = true;
@ -318,8 +317,8 @@ bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost)
m_pIQNet->EndGame(); m_pIQNet->EndGame();
} }
for (AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++) for (auto & it : currentNetworkPlayers)
delete* it; delete it;
currentNetworkPlayers.clear(); currentNetworkPlayers.clear();
m_machineQNetPrimaryPlayers.clear(); m_machineQNetPrimaryPlayers.clear();
SystemFlagReset(); SystemFlagReset();
@ -844,7 +843,7 @@ INetworkPlayer *CPlatformNetworkManagerStub::addNetworkPlayer(IQNetPlayer *pQNet
void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer)
{ {
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer);
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ ) for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++)
{ {
if( *it == pNetworkPlayer ) if( *it == pNetworkPlayer )
{ {

View file

@ -188,9 +188,8 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
{ {
// Do we already have a primary player for this system? // Do we already have a primary player for this system?
bool systemHasPrimaryPlayer = false; bool systemHasPrimaryPlayer = false;
for(AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); it < m_machineSQRPrimaryPlayers.end(); ++it) for( SQRNetworkPlayer *pQNetPrimaryPlayer : m_machineSQRPrimaryPlayers )
{ {
SQRNetworkPlayer *pQNetPrimaryPlayer = *it;
if( pSQRPlayer->IsSameSystem(pQNetPrimaryPlayer) ) if( pSQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
{ {
systemHasPrimaryPlayer = true; systemHasPrimaryPlayer = true;
@ -293,7 +292,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
break; break;
} }
} }
AUTO_VAR(it, find( m_machineSQRPrimaryPlayers.begin(), m_machineSQRPrimaryPlayers.end(), pSQRPlayer)); auto it = find( m_machineSQRPrimaryPlayers.begin(), m_machineSQRPrimaryPlayers.end(), pSQRPlayer);
if( it != m_machineSQRPrimaryPlayers.end() ) if( it != m_machineSQRPrimaryPlayers.end() )
{ {
m_machineSQRPrimaryPlayers.erase( it ); m_machineSQRPrimaryPlayers.erase( it );
@ -529,9 +528,8 @@ int CPlatformNetworkManagerSony::CorrectErrorIDS(int IDS)
bool CPlatformNetworkManagerSony::isSystemPrimaryPlayer(SQRNetworkPlayer *pSQRPlayer) bool CPlatformNetworkManagerSony::isSystemPrimaryPlayer(SQRNetworkPlayer *pSQRPlayer)
{ {
bool playerIsSystemPrimary = false; bool playerIsSystemPrimary = false;
for(AUTO_VAR(it, m_machineSQRPrimaryPlayers.begin()); it < m_machineSQRPrimaryPlayers.end(); ++it) for( SQRNetworkPlayer *pSQRPrimaryPlayer : m_machineSQRPrimaryPlayers )
{ {
SQRNetworkPlayer *pSQRPrimaryPlayer = *it;
if( pSQRPrimaryPlayer == pSQRPlayer ) if( pSQRPrimaryPlayer == pSQRPlayer )
{ {
playerIsSystemPrimary = true; playerIsSystemPrimary = true;
@ -1066,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer,
wstring CPlatformNetworkManagerSony::GatherStats() wstring CPlatformNetworkManagerSony::GatherStats()
{ {
#if 0 #if 0
return L"Queue messages: " + _toString(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
+ L" Queue bytes: " + _toString( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); + L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
#else #else
return L""; return L"";
#endif #endif
@ -1192,7 +1190,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
bool foundSession = false; bool foundSession = false;
FriendSessionInfo *sessionInfo = NULL; FriendSessionInfo *sessionInfo = NULL;
AUTO_VAR(itFriendSession, friendsSessions[iPad].begin()); auto itFriendSession = friendsSessions[iPad].begin();
for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession) for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession)
{ {
sessionInfo = *itFriendSession; sessionInfo = *itFriendSession;
@ -1283,7 +1281,7 @@ INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *
void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlayer)
{ {
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer);
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ ) for( auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++ )
{ {
if( *it == pNetworkPlayer ) if( *it == pNetworkPlayer )
{ {

View file

@ -23,9 +23,8 @@ bool AreaTask::isCompleted()
case eAreaTaskCompletion_CompleteOnConstraintsSatisfied: case eAreaTaskCompletion_CompleteOnConstraintsSatisfied:
{ {
bool allSatisfied = true; bool allSatisfied = true;
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) for( auto& constraint : constraints )
{ {
TutorialConstraint *constraint = *it;
if(!constraint->isConstraintSatisfied(tutorial->getPad())) if(!constraint->isConstraintSatisfied(tutorial->getPad()))
{ {
allSatisfied = false; allSatisfied = false;

View file

@ -53,15 +53,15 @@ bool ControllerTask::isCompleted()
if(m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(),eGameSetting_ControlSouthPaw)) if(m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(),eGameSetting_ControlSouthPaw))
{ {
for(AUTO_VAR(it, southpawCompletedMappings.begin()); it != southpawCompletedMappings.end(); ++it) for (auto& it : southpawCompletedMappings )
{ {
bool current = (*it).second; bool current = it.second;
if(!current) if(!current)
{ {
// TODO Use a different pad // TODO Use a different pad
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 ) if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 )
{ {
(*it).second = true; it.second = true;
m_uiCompletionMask|=1<<iCurrent; m_uiCompletionMask|=1<<iCurrent;
} }
else else
@ -78,15 +78,15 @@ bool ControllerTask::isCompleted()
} }
else else
{ {
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it) for (auto& it : completedMappings )
{ {
bool current = (*it).second; bool current = it.second;
if(!current) if(!current)
{ {
// TODO Use a different pad // TODO Use a different pad
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 ) if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 )
{ {
(*it).second = true; it.second = true;
m_uiCompletionMask|=1<<iCurrent; m_uiCompletionMask|=1<<iCurrent;
} }
else else

View file

@ -47,9 +47,9 @@ bool InfoTask::isCompleted()
{ {
// If a menu is displayed, then we use the handleUIInput to complete the task // If a menu is displayed, then we use the handleUIInput to complete the task
bAllComplete = true; bAllComplete = true;
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it) for( auto& it : completedMappings )
{ {
bool current = (*it).second; bool current = it.second;
if(!current) if(!current)
{ {
bAllComplete = false; bAllComplete = false;
@ -61,18 +61,18 @@ bool InfoTask::isCompleted()
{ {
int iCurrent=0; int iCurrent=0;
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it) for( auto& it : completedMappings )
{ {
bool current = (*it).second; bool current = it.second;
if(!current) if(!current)
{ {
#ifdef _WINDOWS64 #ifdef _WINDOWS64
if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 || g_KBMInput.IsKeyDown(VK_SPACE)) if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 || g_KBMInput.IsKeyDown(VK_SPACE))
#else #else
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0) if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0)
#endif #endif
{ {
(*it).second = true; it.second = true;
bAllComplete=true; bAllComplete=true;
} }
else else
@ -111,11 +111,11 @@ void InfoTask::handleUIInput(int iAction)
{ {
if(bHasBeenActivated) if(bHasBeenActivated)
{ {
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it) for( auto& it : completedMappings )
{ {
if( iAction == (*it).first ) if( iAction == it.first )
{ {
(*it).second = true; it.second = true;
} }
} }
} }

View file

@ -3,7 +3,7 @@
ProcedureCompoundTask::~ProcedureCompoundTask() ProcedureCompoundTask::~ProcedureCompoundTask()
{ {
for(AUTO_VAR(it, m_taskSequence.begin()); it < m_taskSequence.end(); ++it) for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it)
{ {
delete (*it); delete (*it);
} }
@ -24,10 +24,8 @@ int ProcedureCompoundTask::getDescriptionId()
// Return the id of the first task not completed // Return the id of the first task not completed
int descriptionId = -1; int descriptionId = -1;
AUTO_VAR(itEnd, m_taskSequence.end()); for (auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
if(!task->isCompleted()) if(!task->isCompleted())
{ {
task->setAsCurrentTask(true); task->setAsCurrentTask(true);
@ -50,10 +48,8 @@ int ProcedureCompoundTask::getPromptId()
// Return the id of the first task not completed // Return the id of the first task not completed
int promptId = -1; int promptId = -1;
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
if(!task->isCompleted()) if(!task->isCompleted())
{ {
promptId = task->getPromptId(); promptId = task->getPromptId();
@ -69,11 +65,8 @@ bool ProcedureCompoundTask::isCompleted()
bool allCompleted = true; bool allCompleted = true;
bool isCurrentTask = true; bool isCurrentTask = true;
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
if(allCompleted && isCurrentTask) if(allCompleted && isCurrentTask)
{ {
if(task->isCompleted()) if(task->isCompleted())
@ -100,10 +93,8 @@ bool ProcedureCompoundTask::isCompleted()
if(allCompleted) if(allCompleted)
{ {
// Disable all constraints // Disable all constraints
itEnd = m_taskSequence.end(); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
task->enableConstraints(false); task->enableConstraints(false);
} }
} }
@ -113,20 +104,16 @@ bool ProcedureCompoundTask::isCompleted()
void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item) void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
task->onCrafted(item); task->onCrafted(item);
} }
} }
void ProcedureCompoundTask::handleUIInput(int iAction) void ProcedureCompoundTask::handleUIInput(int iAction)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
task->handleUIInput(iAction); task->handleUIInput(iAction);
} }
} }
@ -135,10 +122,8 @@ void ProcedureCompoundTask::handleUIInput(int iAction)
void ProcedureCompoundTask::setAsCurrentTask(bool active /*= true*/) void ProcedureCompoundTask::setAsCurrentTask(bool active /*= true*/)
{ {
bool allCompleted = true; bool allCompleted = true;
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
if(allCompleted && !task->isCompleted()) if(allCompleted && !task->isCompleted())
{ {
task->setAsCurrentTask(true); task->setAsCurrentTask(true);
@ -157,10 +142,8 @@ bool ProcedureCompoundTask::ShowMinimumTime()
return false; return false;
bool showMinimumTime = false; bool showMinimumTime = false;
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
if(!task->isCompleted()) if(!task->isCompleted())
{ {
showMinimumTime = task->ShowMinimumTime(); showMinimumTime = task->ShowMinimumTime();
@ -176,10 +159,8 @@ bool ProcedureCompoundTask::hasBeenActivated()
return true; return true;
bool hasBeenActivated = false; bool hasBeenActivated = false;
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
if(!task->isCompleted()) if(!task->isCompleted())
{ {
hasBeenActivated = task->hasBeenActivated(); hasBeenActivated = task->hasBeenActivated();
@ -191,10 +172,8 @@ bool ProcedureCompoundTask::hasBeenActivated()
void ProcedureCompoundTask::setShownForMinimumTime() void ProcedureCompoundTask::setShownForMinimumTime()
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
if(!task->isCompleted()) if(!task->isCompleted())
{ {
task->setShownForMinimumTime(); task->setShownForMinimumTime();
@ -209,10 +188,8 @@ bool ProcedureCompoundTask::AllowFade()
return true; return true;
bool allowFade = true; bool allowFade = true;
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
if(!task->isCompleted()) if(!task->isCompleted())
{ {
allowFade = task->AllowFade(); allowFade = task->AllowFade();
@ -224,40 +201,32 @@ bool ProcedureCompoundTask::AllowFade()
void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly) void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
task->useItemOn(level, item, x, y, z, bTestUseOnly); task->useItemOn(level, item, x, y, z, bTestUseOnly);
} }
} }
void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly) void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
task->useItem(item, bTestUseOnly); task->useItem(item, bTestUseOnly);
} }
} }
void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
task->onTake(item, invItemCountAnyAux, invItemCountThisAux); task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
} }
} }
void ProcedureCompoundTask::onStateChange(eTutorial_State newState) void ProcedureCompoundTask::onStateChange(eTutorial_State newState)
{ {
AUTO_VAR(itEnd, m_taskSequence.end()); for(auto& task : m_taskSequence)
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{ {
TutorialTask *task = *it;
task->onStateChange(newState); task->onStateChange(newState);
} }
} }

View file

@ -1144,23 +1144,23 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
Tutorial::~Tutorial() Tutorial::~Tutorial()
{ {
for(AUTO_VAR(it, m_globalConstraints.begin()); it != m_globalConstraints.end(); ++it) for(auto& it : m_globalConstraints)
{ {
delete (*it); delete it;
} }
for(unordered_map<int, TutorialMessage *>::iterator it = messages.begin(); it != messages.end(); ++it) for(auto& message : messages)
{ {
delete (*it).second; delete message.second;
} }
for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i) for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i)
{ {
for(AUTO_VAR(it, activeTasks[i].begin()); it < activeTasks[i].end(); ++it) for(auto& it : activeTasks[i])
{ {
delete (*it); delete it;
} }
for(AUTO_VAR(it, hints[i].begin()); it < hints[i].end(); ++it) for(auto& it : hints[i])
{ {
delete (*it); delete it;
} }
currentTask[i] = NULL; currentTask[i] = NULL;
@ -1188,10 +1188,10 @@ void Tutorial::setCompleted( int completableId )
int completableIndex = -1; int completableIndex = -1;
for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it) for (int task : s_completableTasks)
{ {
++completableIndex; ++completableIndex;
if( *it == completableId ) if( task == completableId )
{ {
break; break;
} }
@ -1220,10 +1220,10 @@ bool Tutorial::getCompleted( int completableId )
//} //}
int completableIndex = -1; int completableIndex = -1;
for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it) for (int it : s_completableTasks)
{ {
++completableIndex; ++completableIndex;
if( *it == completableId ) if( it == completableId )
{ {
break; break;
} }
@ -1318,8 +1318,8 @@ void Tutorial::tick()
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
{ {
AUTO_VAR(it, constraintsToRemove[state].begin()); auto it = constraintsToRemove[state].begin();
while(it < constraintsToRemove[state].end() ) while(it != constraintsToRemove[state].end() )
{ {
++(*it).second; ++(*it).second;
if( (*it).second > m_iTutorialConstraintDelayRemoveTicks ) if( (*it).second > m_iTutorialConstraintDelayRemoveTicks )
@ -1427,9 +1427,8 @@ void Tutorial::tick()
} }
// Check constraints // Check constraints
for(AUTO_VAR(it, m_globalConstraints.begin()); it < m_globalConstraints.end(); ++it) for (auto& constraint : m_globalConstraints)
{ {
TutorialConstraint *constraint = *it;
constraint->tick(m_iPad); constraint->tick(m_iPad);
} }
@ -1443,9 +1442,8 @@ void Tutorial::tick()
if(hintsOn) if(hintsOn)
{ {
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for (auto& hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->tick(); hintNeeded = hint->tick();
if(hintNeeded >= 0) if(hintNeeded >= 0)
{ {
@ -1469,9 +1467,8 @@ void Tutorial::tick()
constraintChanged = true; constraintChanged = true;
currentFailedConstraint[m_CurrentState] = NULL; currentFailedConstraint[m_CurrentState] = NULL;
} }
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it) for (auto& constraint : constraints[m_CurrentState])
{ {
TutorialConstraint *constraint = *it;
if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) ) if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) )
{ {
constraintChanged = true; constraintChanged = true;
@ -1484,8 +1481,8 @@ void Tutorial::tick()
{ {
// Update tasks // Update tasks
bool isCurrentTask = true; bool isCurrentTask = true;
AUTO_VAR(it, activeTasks[m_CurrentState].begin()); auto it = activeTasks[m_CurrentState].begin();
while(activeTasks[m_CurrentState].size() > 0 && it < activeTasks[m_CurrentState].end()) while(activeTasks[m_CurrentState].size() > 0 && it != activeTasks[m_CurrentState].end())
{ {
TutorialTask *task = *it; TutorialTask *task = *it;
if( isCurrentTask || task->isPreCompletionEnabled() ) if( isCurrentTask || task->isPreCompletionEnabled() )
@ -1509,7 +1506,7 @@ void Tutorial::tick()
{ {
// 4J Stu - Move the delayed constraints to the gameplay state so that they are in // 4J Stu - Move the delayed constraints to the gameplay state so that they are in
// effect for a bit longer // effect for a bit longer
AUTO_VAR(itCon, constraintsToRemove[m_CurrentState].begin()); auto itCon = constraintsToRemove[m_CurrentState].begin();
while(itCon != constraintsToRemove[m_CurrentState].end() ) while(itCon != constraintsToRemove[m_CurrentState].end() )
{ {
constraints[e_Tutorial_State_Gameplay].push_back(itCon->first); constraints[e_Tutorial_State_Gameplay].push_back(itCon->first);
@ -1521,9 +1518,9 @@ void Tutorial::tick()
} }
// Fall through the the normal complete state // Fall through the the normal complete state
case e_Tutorial_Completion_Complete_State: case e_Tutorial_Completion_Complete_State:
for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem) for (auto& itRem : activeTasks[m_CurrentState])
{ {
delete (*itRem); delete itRem;
} }
activeTasks[m_CurrentState].clear(); activeTasks[m_CurrentState].clear();
break; break;
@ -1531,9 +1528,9 @@ void Tutorial::tick()
{ {
TutorialTask *lastTask = activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1 ); TutorialTask *lastTask = activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1 );
activeTasks[m_CurrentState].pop_back(); activeTasks[m_CurrentState].pop_back();
for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem) for(auto& itRem : activeTasks[m_CurrentState])
{ {
delete (*itRem); delete itRem;
} }
activeTasks[m_CurrentState].clear(); activeTasks[m_CurrentState].clear();
activeTasks[m_CurrentState].push_back( lastTask ); activeTasks[m_CurrentState].push_back( lastTask );
@ -1697,7 +1694,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
} }
else else
{ {
AUTO_VAR(it, messages.find(message->m_messageId)); auto it = messages.find(message->m_messageId);
if( it != messages.end() && it->second != NULL ) if( it != messages.end() && it->second != NULL )
{ {
TutorialMessage *messageString = it->second; TutorialMessage *messageString = it->second;
@ -1727,7 +1724,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
} }
else if(message->m_promptId >= 0) else if(message->m_promptId >= 0)
{ {
AUTO_VAR(it, messages.find(message->m_promptId)); auto it = messages.find(message->m_promptId);
if(it != messages.end() && it->second != NULL) if(it != messages.end() && it->second != NULL)
{ {
TutorialMessage *prompt = it->second; TutorialMessage *prompt = it->second;
@ -1828,36 +1825,32 @@ void Tutorial::showTutorialPopup(bool show)
void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly) void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
{ {
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) for(auto& task : activeTasks[m_CurrentState])
{ {
TutorialTask *task = *it;
task->useItemOn(level, item, x, y, z, bTestUseOnly); task->useItemOn(level, item, x, y, z, bTestUseOnly);
} }
} }
void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly) void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
{ {
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) for(auto& task : activeTasks[m_CurrentState])
{ {
TutorialTask *task = *it;
task->useItem(item, bTestUseOnly); task->useItem(item, bTestUseOnly);
} }
} }
void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item) void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
{ {
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) for(auto task : activeTasks[m_CurrentState])
{ {
TutorialTask *task = *it;
task->completeUsingItem(item); task->completeUsingItem(item);
} }
// Fix for #46922 - TU5: UI: Player receives a reminder that he is hungry while "hunger bar" is full (triggered in split-screen mode) // Fix for #46922 - TU5: UI: Player receives a reminder that he is hungry while "hunger bar" is full (triggered in split-screen mode)
if(m_CurrentState != e_Tutorial_State_Gameplay) if(m_CurrentState != e_Tutorial_State_Gameplay)
{ {
for(AUTO_VAR(it, activeTasks[e_Tutorial_State_Gameplay].begin()); it < activeTasks[e_Tutorial_State_Gameplay].end(); ++it) for(auto task : activeTasks[e_Tutorial_State_Gameplay])
{ {
TutorialTask *task = *it;
task->completeUsingItem(item); task->completeUsingItem(item);
} }
} }
@ -1866,9 +1859,8 @@ void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile) void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
{ {
int hintNeeded = -1; int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for(auto& hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->startDestroyBlock(item, tile); hintNeeded = hint->startDestroyBlock(item, tile);
if(hintNeeded >= 0) if(hintNeeded >= 0)
{ {
@ -1877,16 +1869,14 @@ void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
setMessage( hint, message ); setMessage( hint, message );
break; break;
} }
} }
} }
void Tutorial::destroyBlock(Tile *tile) void Tutorial::destroyBlock(Tile *tile)
{ {
int hintNeeded = -1; int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for(auto& hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->destroyBlock(tile); hintNeeded = hint->destroyBlock(tile);
if(hintNeeded >= 0) if(hintNeeded >= 0)
{ {
@ -1895,16 +1885,14 @@ void Tutorial::destroyBlock(Tile *tile)
setMessage( hint, message ); setMessage( hint, message );
break; break;
} }
} }
} }
void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity) void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
{ {
int hintNeeded = -1; int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for(auto& hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->attack(player->inventory->getSelected(), entity); hintNeeded = hint->attack(player->inventory->getSelected(), entity);
if(hintNeeded >= 0) if(hintNeeded >= 0)
{ {
@ -1920,9 +1908,8 @@ void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
void Tutorial::itemDamaged(shared_ptr<ItemInstance> item) void Tutorial::itemDamaged(shared_ptr<ItemInstance> item)
{ {
int hintNeeded = -1; int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for(auto& hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->itemDamaged(item); hintNeeded = hint->itemDamaged(item);
if(hintNeeded >= 0) if(hintNeeded >= 0)
{ {
@ -1939,11 +1926,6 @@ void Tutorial::handleUIInput(int iAction)
{ {
if( m_hintDisplayed ) return; if( m_hintDisplayed ) return;
//for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
//{
// TutorialTask *task = *it;
// task->handleUIInput(iAction);
//}
if(currentTask[m_CurrentState] != NULL) if(currentTask[m_CurrentState] != NULL)
currentTask[m_CurrentState]->handleUIInput(iAction); currentTask[m_CurrentState]->handleUIInput(iAction);
} }
@ -1951,9 +1933,8 @@ void Tutorial::handleUIInput(int iAction)
void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake) void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
{ {
int hintNeeded = -1; int hintNeeded = -1;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for(auto& hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->createItemSelected(item, canMake); hintNeeded = hint->createItemSelected(item, canMake);
if(hintNeeded >= 0) if(hintNeeded >= 0)
{ {
@ -1968,11 +1949,10 @@ void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
void Tutorial::onCrafted(shared_ptr<ItemInstance> item) void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
{ {
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) for(auto& subtasks : activeTasks)
{ {
for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it) for(auto& task : subtasks)
{ {
TutorialTask *task = *it;
task->onCrafted(item); task->onCrafted(item);
} }
} }
@ -1983,23 +1963,20 @@ void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAn
if( !m_hintDisplayed ) if( !m_hintDisplayed )
{ {
bool hintNeeded = false; bool hintNeeded = false;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for(auto hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->onTake(item); hintNeeded = hint->onTake(item);
if(hintNeeded) if(hintNeeded)
{ {
break; break;
} }
} }
} }
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state) for(auto& subtasks : activeTasks)
{ {
for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it) for(auto& task : subtasks)
{ {
TutorialTask *task = *it;
task->onTake(item, invItemCountAnyAux, invItemCountThisAux); task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
} }
} }
@ -2035,9 +2012,8 @@ void Tutorial::onLookAt(int id, int iData)
if( m_hintDisplayed ) return; if( m_hintDisplayed ) return;
bool hintNeeded = false; bool hintNeeded = false;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for(auto& hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->onLookAt(id, iData); hintNeeded = hint->onLookAt(id, iData);
if(hintNeeded) if(hintNeeded)
{ {
@ -2066,9 +2042,8 @@ void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
if( m_hintDisplayed ) return; if( m_hintDisplayed ) return;
bool hintNeeded = false; bool hintNeeded = false;
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it) for(auto& hint : hints[m_CurrentState])
{ {
TutorialHint *hint = *it;
hintNeeded = hint->onLookAtEntity(entity->GetType()); hintNeeded = hint->onLookAtEntity(entity->GetType());
if(hintNeeded) if(hintNeeded)
{ {
@ -2081,9 +2056,9 @@ void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
changeTutorialState(e_Tutorial_State_Horse); changeTutorialState(e_Tutorial_State_Horse);
} }
for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it != activeTasks[m_CurrentState].end(); ++it) for (auto& it : activeTasks[m_CurrentState])
{ {
(*it)->onLookAtEntity(entity); it->onLookAtEntity(entity);
} }
} }
@ -2098,17 +2073,16 @@ void Tutorial::onRideEntity(shared_ptr<Entity> entity)
} }
} }
for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it != activeTasks[m_CurrentState].end(); ++it) for (auto& it : activeTasks[m_CurrentState])
{ {
(*it)->onRideEntity(entity); it->onRideEntity(entity);
} }
} }
void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved) void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved)
{ {
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it) for(auto& task : activeTasks[m_CurrentState])
{ {
TutorialTask *task = *it;
task->onEffectChanged(effect,bRemoved); task->onEffectChanged(effect,bRemoved);
} }
} }
@ -2116,9 +2090,8 @@ void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved)
bool Tutorial::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt) bool Tutorial::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt)
{ {
bool allowed = true; bool allowed = true;
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it) for(auto& constraint : constraints[m_CurrentState])
{ {
TutorialConstraint *constraint = *it;
if( !constraint->isConstraintSatisfied(m_iPad) && !constraint->canMoveToPosition(xo,yo,zo,xt,yt,zt) ) if( !constraint->isConstraintSatisfied(m_iPad) && !constraint->canMoveToPosition(xo,yo,zo,xt,yt,zt) )
{ {
allowed = false; allowed = false;
@ -2136,9 +2109,8 @@ bool Tutorial::isInputAllowed(int mapping)
if( Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid(Material::water) ) return true; if( Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid(Material::water) ) return true;
bool allowed = true; bool allowed = true;
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it) for(auto& constraint : constraints[m_CurrentState])
{ {
TutorialConstraint *constraint = *it;
if( constraint->isMappingConstrained( m_iPad, mapping ) ) if( constraint->isMappingConstrained( m_iPad, mapping ) )
{ {
allowed = false; allowed = false;
@ -2156,9 +2128,9 @@ vector<TutorialTask *> *Tutorial::getTasks()
unsigned int Tutorial::getCurrentTaskIndex() unsigned int Tutorial::getCurrentTaskIndex()
{ {
unsigned int index = 0; unsigned int index = 0;
for(AUTO_VAR(it, tasks.begin()); it < tasks.end(); ++it) for(const auto& task : tasks)
{ {
if(*it == currentTask[e_Tutorial_State_Gameplay]) if(task == currentTask[e_Tutorial_State_Gameplay])
break; break;
++index; ++index;
@ -2184,11 +2156,11 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
if( c->getQueuedForRemoval() ) if( c->getQueuedForRemoval() )
{ {
// If it is already queued for removal, remove it on the next tick // If it is already queued for removal, remove it on the next tick
/*for(AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it) /*for(auto& it : constraintsToRemove[m_CurrentState])
{ {
if( it->first == c ) if( it.first == c )
{ {
it->second = m_iTutorialConstraintDelayRemoveTicks; it.second = m_iTutorialConstraintDelayRemoveTicks;
break; break;
} }
}*/ }*/
@ -2196,11 +2168,11 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
else if(delayedRemove) else if(delayedRemove)
{ {
c->setQueuedForRemoval(true); c->setQueuedForRemoval(true);
constraintsToRemove[m_CurrentState].push_back( pair<TutorialConstraint *, unsigned char>(c, 0) ); constraintsToRemove[m_CurrentState].emplace_back(c, 0);
} }
else else
{ {
for( AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it) for (auto it = constraintsToRemove[m_CurrentState].begin(); it != constraintsToRemove[m_CurrentState].end(); ++it)
{ {
if( it->first == c ) if( it->first == c )
{ {
@ -2209,7 +2181,7 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
} }
} }
AUTO_VAR(it, find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c)); auto it = find(constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c);
if( it != constraints[m_CurrentState].end() ) constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c) ); if( it != constraints[m_CurrentState].end() ) constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c) );
// It may be in the gameplay list, so remove it from there if it is // It may be in the gameplay list, so remove it from there if it is
@ -2304,9 +2276,8 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
if( m_CurrentState != newState ) if( m_CurrentState != newState )
{ {
for(AUTO_VAR(it, activeTasks[newState].begin()); it < activeTasks[newState].end(); ++it) for (auto& task : activeTasks[newState] )
{ {
TutorialTask *task = *it;
task->onStateChange(newState); task->onStateChange(newState);
} }
m_CurrentState = newState; m_CurrentState = newState;

View file

@ -11,9 +11,8 @@ TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePre
{ {
if(inConstraints != NULL) if(inConstraints != NULL)
{ {
for(AUTO_VAR(it, inConstraints->begin()); it < inConstraints->end(); ++it) for(auto& constraint : *inConstraints)
{ {
TutorialConstraint *constraint = *it;
constraints.push_back( constraint ); constraints.push_back( constraint );
} }
delete inConstraints; delete inConstraints;
@ -26,10 +25,8 @@ TutorialTask::~TutorialTask()
{ {
enableConstraints(false); enableConstraints(false);
for(AUTO_VAR(it, constraints.begin()); it < constraints.end(); ++it) for(auto& constraint : constraints)
{ {
TutorialConstraint *constraint = *it;
if( constraint->getQueuedForRemoval() ) if( constraint->getQueuedForRemoval() )
{ {
constraint->setDeleteOnDeactivate(true); constraint->setDeleteOnDeactivate(true);
@ -52,9 +49,8 @@ void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/)
if( !enable && (areConstraintsEnabled || !delayRemove) ) if( !enable && (areConstraintsEnabled || !delayRemove) )
{ {
// Remove // Remove
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) for(auto& constraint : constraints)
{ {
TutorialConstraint *constraint = *it;
//app.DebugPrintf(">>>>>>>> %i\n", constraints.size()); //app.DebugPrintf(">>>>>>>> %i\n", constraints.size());
tutorial->RemoveConstraint( constraint, delayRemove ); tutorial->RemoveConstraint( constraint, delayRemove );
} }
@ -63,9 +59,8 @@ void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/)
else if( !areConstraintsEnabled && enable ) else if( !areConstraintsEnabled && enable )
{ {
// Add // Add
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) for(auto& constraint : constraints)
{ {
TutorialConstraint *constraint = *it;
tutorial->AddConstraint( constraint ); tutorial->AddConstraint( constraint );
} }
areConstraintsEnabled = true; areConstraintsEnabled = true;

View file

@ -621,7 +621,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies(); RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray(); Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
int iRecipeC=(int)recipes->size(); int iRecipeC=(int)recipes->size();
AUTO_VAR(itRecipe, recipes->begin()); auto itRecipe = recipes->begin();
// dump out the recipe products // dump out the recipe products

View file

@ -828,7 +828,7 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i
// Fill the dynamic group // Fill the dynamic group
if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL) if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL)
{ {
for(AUTO_VAR(it, categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin()); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it) for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it)
{ {
Slot *slot = menu->getSlot(++lastSlotIndex); Slot *slot = menu->getSlot(++lastSlotIndex);
slot->set( *it ); slot->set( *it );

View file

@ -78,7 +78,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
int buyBMatches = player->inventory->countMatches(buyBItem); int buyBMatches = player->inventory->countMatches(buyBItem);
if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) ) if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) )
{ {
// 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple Enchanted Books will cause the title to crash. // 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple <EFBFBD>Enchanted Books<6B> will cause the title to crash.
int actualShopItem = m_activeOffers.at(selectedShopItem).second; int actualShopItem = m_activeOffers.at(selectedShopItem).second;
m_merchant->notifyTrade(activeRecipe); m_merchant->notifyTrade(activeRecipe);
@ -186,13 +186,12 @@ void IUIScene_TradingMenu::updateDisplay()
m_activeOffers.clear(); m_activeOffers.clear();
int unfilteredIndex = 0; int unfilteredIndex = 0;
int firstValidTrade = INT_MAX; int firstValidTrade = INT_MAX;
for(AUTO_VAR(it, unfilteredOffers->begin()); it != unfilteredOffers->end(); ++it) for(auto& recipe : *unfilteredOffers)
{ {
MerchantRecipe *recipe = *it;
if(!recipe->isDeprecated()) if(!recipe->isDeprecated())
{ {
m_activeOffers.push_back( pair<MerchantRecipe *,int>(recipe,unfilteredIndex)); m_activeOffers.emplace_back(recipe,unfilteredIndex);
firstValidTrade = min(firstValidTrade,unfilteredIndex); firstValidTrade = std::min<int>(firstValidTrade, unfilteredIndex);
} }
++unfilteredIndex; ++unfilteredIndex;
} }

View file

@ -101,7 +101,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1f); glAlphaFunc(GL_GREATER, 0.1f);
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
wstring line = _toString<int>(cost); wstring line = std::to_wstring(cost);
Font *font = pMinecraft->altFont; Font *font = pMinecraft->altFont;
//int col = 0x685E4A; //int col = 0x685E4A;
unsigned int col = m_textColour; unsigned int col = m_textColour;
@ -165,7 +165,7 @@ void UIControl_EnchantmentButton::updateState()
if(cost != m_lastCost) if(cost != m_lastCost)
{ {
setLabel( _toString<int>(cost) ); setLabel( std::to_wstring(cost) );
m_lastCost = cost; m_lastCost = cost;
m_enchantmentString = EnchantmentNames::instance.getRandomName(); m_enchantmentString = EnchantmentNames::instance.getRandomName();
} }

View file

@ -225,10 +225,8 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{ {
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it) for(auto& pModelPart : *m_pvAdditionalModelParts)
{ {
ModelPart *pModelPart=*it;
pModelPart->visible=true; pModelPart->visible=true;
} }
} }
@ -239,10 +237,8 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
// hide the additional parts // hide the additional parts
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{ {
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it) for(auto& pModelPart : *m_pvAdditionalModelParts)
{ {
ModelPart *pModelPart=*it;
pModelPart->visible=false; pModelPart->visible=false;
} }
} }

View file

@ -500,7 +500,7 @@ void UIController::tick()
// Clear out the cached movie file data // Clear out the cached movie file data
__int64 currentTime = System::currentTimeMillis(); __int64 currentTime = System::currentTimeMillis();
for(AUTO_VAR(it, m_cachedMovieData.begin()); it != m_cachedMovieData.end();) for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();)
{ {
if(it->second.m_expiry < currentTime) if(it->second.m_expiry < currentTime)
{ {
@ -738,9 +738,8 @@ void UIController::CleanUpSkinReload()
} }
} }
for(AUTO_VAR(it,m_queuedMessageBoxData.begin()); it != m_queuedMessageBoxData.end(); ++it) for(auto queuedData : m_queuedMessageBoxData)
{ {
QueuedMessageBoxData *queuedData = *it;
ui.NavigateToScene(queuedData->iPad, eUIScene_MessageBox, &queuedData->info, queuedData->layer, eUIGroup_Fullscreen); ui.NavigateToScene(queuedData->iPad, eUIScene_MessageBox, &queuedData->info, queuedData->layer, eUIGroup_Fullscreen);
delete queuedData->info.uiOptionA; delete queuedData->info.uiOptionA;
delete queuedData; delete queuedData;
@ -752,7 +751,7 @@ byteArray UIController::getMovieData(const wstring &filename)
{ {
// Cache everything we load in the current tick // Cache everything we load in the current tick
__int64 targetTime = System::currentTimeMillis() + (1000LL * 60); __int64 targetTime = System::currentTimeMillis() + (1000LL * 60);
AUTO_VAR(it,m_cachedMovieData.find(filename)); auto it = m_cachedMovieData.find(filename);
if(it == m_cachedMovieData.end() ) if(it == m_cachedMovieData.end() )
{ {
byteArray baFile = app.getArchiveFile(filename); byteArray baFile = app.getArchiveFile(filename);
@ -1645,12 +1644,12 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl
//If your texture includes an alpha channel, you must use a premultiplied alpha (where the R,G, and B channels have been multiplied by the alpha value); all Iggy shaders assume premultiplied alpha (and it looks better anyway). //If your texture includes an alpha channel, you must use a premultiplied alpha (where the R,G, and B channels have been multiplied by the alpha value); all Iggy shaders assume premultiplied alpha (and it looks better anyway).
GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void * * destroy_callback_data ) GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void * * destroy_callback_data )
{ {
UIController *uiController = (UIController *)user_callback_data; UIController *uiController = static_cast<UIController *>(user_callback_data);
AUTO_VAR(it,uiController->m_substitutionTextures.find((wchar_t *)texture_name)); auto it = uiController->m_substitutionTextures.find(texture_name);
if(it != uiController->m_substitutionTextures.end()) if(it != uiController->m_substitutionTextures.end())
{ {
app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", (wchar_t *)texture_name,it->second.length); app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", texture_name,it->second.length);
BufferedImage image(it->second.data, it->second.length); BufferedImage image(it->second.data, it->second.length);
if( image.getData() != NULL ) if( image.getData() != NULL )
@ -1711,7 +1710,7 @@ void UIController::registerSubstitutionTexture(const wstring &textureName, PBYTE
void UIController::unregisterSubstitutionTexture(const wstring &textureName, bool deleteData) void UIController::unregisterSubstitutionTexture(const wstring &textureName, bool deleteData)
{ {
AUTO_VAR(it,m_substitutionTextures.find(textureName)); auto it = m_substitutionTextures.find(textureName);
if(it != m_substitutionTextures.end()) if(it != m_substitutionTextures.end())
{ {
@ -1953,7 +1952,7 @@ size_t UIController::RegisterForCallbackId(UIScene *scene)
void UIController::UnregisterCallbackId(size_t id) void UIController::UnregisterCallbackId(size_t id)
{ {
EnterCriticalSection(&m_registeredCallbackScenesCS); EnterCriticalSection(&m_registeredCallbackScenesCS);
AUTO_VAR(it, m_registeredCallbackScenes.find(id) ); auto it = m_registeredCallbackScenes.find(id);
if(it != m_registeredCallbackScenes.end() ) if(it != m_registeredCallbackScenes.end() )
{ {
m_registeredCallbackScenes.erase(it); m_registeredCallbackScenes.erase(it);
@ -1964,7 +1963,7 @@ void UIController::UnregisterCallbackId(size_t id)
UIScene *UIController::GetSceneFromCallbackId(size_t id) UIScene *UIController::GetSceneFromCallbackId(size_t id)
{ {
UIScene *scene = NULL; UIScene *scene = NULL;
AUTO_VAR(it, m_registeredCallbackScenes.find(id) ); auto it = m_registeredCallbackScenes.find(id);
if(it != m_registeredCallbackScenes.end() ) if(it != m_registeredCallbackScenes.end() )
{ {
scene = it->second; scene = it->second;
@ -3002,11 +3001,8 @@ void UIController::TouchBoxRebuild(UIScene *pUIScene)
ui.TouchBoxesClear(pUIScene); ui.TouchBoxesClear(pUIScene);
// rebuild boxes // rebuild boxes
AUTO_VAR(itEnd, pUIScene->GetControls()->end()); for ( UIControl *control : *pUIScene->GetControls() )
for (AUTO_VAR(it, pUIScene->GetControls()->begin()); it != itEnd; it++)
{ {
UIControl *control=(UIControl *)*it;
if(control->getControlType() == UIControl::eButton || if(control->getControlType() == UIControl::eButton ||
control->getControlType() == UIControl::eSlider || control->getControlType() == UIControl::eSlider ||
control->getControlType() == UIControl::eCheckBox || control->getControlType() == UIControl::eCheckBox ||
@ -3035,10 +3031,8 @@ void UIController::TouchBoxesClear(UIScene *pUIScene)
EUILayer eUILayer=pUIScene->GetParentLayer()->m_iLayer; EUILayer eUILayer=pUIScene->GetParentLayer()->m_iLayer;
EUIScene eUIscene=pUIScene->getSceneType(); EUIScene eUIscene=pUIScene->getSceneType();
AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end()); for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] )
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
{ {
UIELEMENT *element=(UIELEMENT *)*it;
delete element; delete element;
} }
m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear(); m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear();
@ -3056,10 +3050,8 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y)
if(m_TouchBoxes[eUIGroup][eUILayer][eUIscene].size()>0) if(m_TouchBoxes[eUIGroup][eUILayer][eUIscene].size()>0)
{ {
AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end()); for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] )
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
{ {
UIELEMENT *element=(UIELEMENT *)*it;
if(element->pControl->getHidden() == false && element->pControl->getVisible()) // ignore removed controls if(element->pControl->getHidden() == false && element->pControl->getVisible()) // ignore removed controls
{ {
if((x>=element->x1) &&(x<=element->x2) && (y>=element->y1) && (y<=element->y2)) if((x>=element->x1) &&(x<=element->x2) && (y>=element->y1) && (y<=element->y2))

View file

@ -18,18 +18,16 @@ void UILayer::tick()
{ {
// Delete old scenes - deleting a scene can cause a new scene to be deleted, so we need to make a copy of the scenes that we are going to try and destroy this tick // Delete old scenes - deleting a scene can cause a new scene to be deleted, so we need to make a copy of the scenes that we are going to try and destroy this tick
vector<UIScene *>scenesToDeleteCopy; vector<UIScene *>scenesToDeleteCopy;
for( AUTO_VAR(it,m_scenesToDelete.begin()); it != m_scenesToDelete.end(); it++) for(auto& scene : m_scenesToDelete)
{ {
UIScene *scene = (*it);
scenesToDeleteCopy.push_back(scene); scenesToDeleteCopy.push_back(scene);
} }
m_scenesToDelete.clear(); m_scenesToDelete.clear();
// Delete the scenes in our copy if they are ready to delete, otherwise add back to the ones that are still to be deleted. Actually deleting a scene might also add something back into m_scenesToDelete. // Delete the scenes in our copy if they are ready to delete, otherwise add back to the ones that are still to be deleted. Actually deleting a scene might also add something back into m_scenesToDelete.
for( AUTO_VAR(it,scenesToDeleteCopy.begin()); it != scenesToDeleteCopy.end(); it++) for(auto& scene : scenesToDeleteCopy)
{ {
UIScene *scene = (*it); if( scene && scene->isReadyToDelete())
if( scene->isReadyToDelete())
{ {
delete scene; delete scene;
} }
@ -47,13 +45,12 @@ void UILayer::tick()
} }
m_scenesToDestroy.clear(); m_scenesToDestroy.clear();
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) for(auto & component : m_components)
{ {
(*it)->tick(); component->tick();
} }
// Note: reverse iterator, the last element is the top of the stack // Note: reverse iterator, the last element is the top of the stack
int sceneIndex = m_sceneStack.size() - 1; int sceneIndex = m_sceneStack.size() - 1;
//for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it)
while( sceneIndex >= 0 && sceneIndex < m_sceneStack.size() ) while( sceneIndex >= 0 && sceneIndex < m_sceneStack.size() )
{ {
//(*it)->tick(); //(*it)->tick();
@ -68,15 +65,15 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport)
{ {
if(!ui.IsExpectingOrReloadingSkin()) if(!ui.IsExpectingOrReloadingSkin())
{ {
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) for(auto& it : m_components)
{ {
AUTO_VAR(itRef,m_componentRefCount.find((*it)->getSceneType())); auto itRef = m_componentRefCount.find(it->getSceneType());
if(itRef != m_componentRefCount.end() && itRef->second.second) if(itRef != m_componentRefCount.end() && itRef->second.second)
{ {
if((*it)->isVisible() ) if(it->isVisible() )
{ {
PIXBeginNamedEvent(0, "Rendering component %d", (*it)->getSceneType() ); PIXBeginNamedEvent(0, "Rendering component %d", it->getSceneType() );
(*it)->render(width, height,viewport); it->render(width, height,viewport);
PIXEndNamedEvent(); PIXEndNamedEvent();
} }
} }
@ -139,9 +136,9 @@ bool UILayer::HasFocus(int iPad)
bool UILayer::hidesLowerScenes() bool UILayer::hidesLowerScenes()
{ {
bool hidesScenes = false; bool hidesScenes = false;
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) for(auto& it : m_components)
{ {
if((*it)->hidesLowerScenes()) if(it->hidesLowerScenes())
{ {
hidesScenes = true; hidesScenes = true;
break; break;
@ -168,28 +165,27 @@ void UILayer::getRenderDimensions(S32 &width, S32 &height)
void UILayer::DestroyAll() void UILayer::DestroyAll()
{ {
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) for(auto& it : m_components)
{ {
(*it)->destroyMovie(); it->destroyMovie();
} }
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) for(auto& it : m_sceneStack)
{ {
(*it)->destroyMovie(); it->destroyMovie();
} }
} }
void UILayer::ReloadAll(bool force) void UILayer::ReloadAll(bool force)
{ {
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) for(auto& it : m_components)
{ {
(*it)->reloadMovie(force); it->reloadMovie(force);
} }
if(!m_sceneStack.empty()) if(!m_sceneStack.empty())
{ {
int lowestRenderable = 0; for(auto& lowestRenderable : m_sceneStack)
for(;lowestRenderable < m_sceneStack.size(); ++lowestRenderable)
{ {
m_sceneStack[lowestRenderable]->reloadMovie(force); lowestRenderable->reloadMovie(force);
} }
} }
} }
@ -493,7 +489,7 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene)
void UILayer::showComponent(int iPad, EUIScene scene, bool show) void UILayer::showComponent(int iPad, EUIScene scene, bool show)
{ {
AUTO_VAR(it,m_componentRefCount.find(scene)); auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end()) if(it != m_componentRefCount.end())
{ {
it->second.second = show; it->second.second = show;
@ -505,7 +501,7 @@ void UILayer::showComponent(int iPad, EUIScene scene, bool show)
bool UILayer::isComponentVisible(EUIScene scene) bool UILayer::isComponentVisible(EUIScene scene)
{ {
bool visible = false; bool visible = false;
AUTO_VAR(it,m_componentRefCount.find(scene)); auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end()) if(it != m_componentRefCount.end())
{ {
visible = it->second.second; visible = it->second.second;
@ -515,16 +511,16 @@ bool UILayer::isComponentVisible(EUIScene scene)
UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData) UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
{ {
AUTO_VAR(it,m_componentRefCount.find(scene)); auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end()) if(it != m_componentRefCount.end())
{ {
++it->second.first; ++it->second.first;
for(AUTO_VAR(itComp,m_components.begin()); itComp != m_components.end(); ++itComp) for(auto& itComp : m_components)
{ {
if( (*itComp)->getSceneType() == scene ) if( itComp->getSceneType() == scene )
{ {
return *itComp; return itComp;
} }
} }
return NULL; return NULL;
@ -586,7 +582,7 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
void UILayer::removeComponent(EUIScene scene) void UILayer::removeComponent(EUIScene scene)
{ {
AUTO_VAR(it,m_componentRefCount.find(scene)); auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end()) if(it != m_componentRefCount.end())
{ {
--it->second.first; --it->second.first;
@ -594,7 +590,7 @@ void UILayer::removeComponent(EUIScene scene)
if(it->second.first <= 0) if(it->second.first <= 0)
{ {
m_componentRefCount.erase(it); m_componentRefCount.erase(it);
for(AUTO_VAR(compIt, m_components.begin()) ; compIt != m_components.end(); ) for (auto compIt = m_components.begin(); compIt != m_components.end();)
{ {
if( (*compIt)->getSceneType() == scene) if( (*compIt)->getSceneType() == scene)
{ {
@ -622,7 +618,7 @@ void UILayer::removeScene(UIScene *scene)
ui.TouchBoxesClear(scene); ui.TouchBoxesClear(scene);
#endif #endif
AUTO_VAR(newEnd, std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene) ); auto newEnd = std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene);
m_sceneStack.erase(newEnd, m_sceneStack.end()); m_sceneStack.erase(newEnd, m_sceneStack.end());
m_scenesToDelete.push_back(scene); m_scenesToDelete.push_back(scene);
@ -645,14 +641,14 @@ void UILayer::closeAllScenes()
vector<UIScene *> temp; vector<UIScene *> temp;
temp.insert(temp.end(), m_sceneStack.begin(), m_sceneStack.end()); temp.insert(temp.end(), m_sceneStack.begin(), m_sceneStack.end());
m_sceneStack.clear(); m_sceneStack.clear();
for(AUTO_VAR(it, temp.begin()); it != temp.end(); ++it) for(auto& it : temp)
{ {
#ifdef __PSVITA__ #ifdef __PSVITA__
// remove any touchboxes // remove any touchboxes
ui.TouchBoxesClear(*it); ui.TouchBoxesClear(it);
#endif #endif
m_scenesToDelete.push_back(*it); m_scenesToDelete.push_back(it);
(*it)->handleDestroy(); // For anything that might require the pointer be valid it->handleDestroy(); // For anything that might require the pointer be valid
} }
updateFocusState(); updateFocusState();
@ -696,7 +692,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
m_bIgnorePlayerJoinMenuDisplayed = false; m_bIgnorePlayerJoinMenuDisplayed = false;
bool layerFocusSet = false; bool layerFocusSet = false;
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{ {
UIScene *scene = *it; UIScene *scene = *it;
@ -783,7 +779,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
UIScene *UILayer::getCurrentScene() UIScene *UILayer::getCurrentScene()
{ {
// Note: reverse iterator, the last element is the top of the stack // Note: reverse iterator, the last element is the top of the stack
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) for( auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{ {
UIScene *scene = *it; UIScene *scene = *it;
// 4J-PB - only used on Vita, so iPad 0 is fine // 4J-PB - only used on Vita, so iPad 0 is fine
@ -800,7 +796,7 @@ UIScene *UILayer::getCurrentScene()
void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{ {
// Note: reverse iterator, the last element is the top of the stack // Note: reverse iterator, the last element is the top of the stack
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{ {
UIScene *scene = *it; UIScene *scene = *it;
if(scene->hasFocus(iPad) && scene->canHandleInput()) if(scene->hasFocus(iPad) && scene->canHandleInput())
@ -825,7 +821,7 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
void UILayer::HandleDLCMountingComplete() void UILayer::HandleDLCMountingComplete()
{ {
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{ {
UIScene *topScene = *it; UIScene *topScene = *it;
app.DebugPrintf("UILayer::HandleDLCMountingComplete - topScene\n"); app.DebugPrintf("UILayer::HandleDLCMountingComplete - topScene\n");
@ -835,7 +831,7 @@ void UILayer::HandleDLCMountingComplete()
void UILayer::HandleDLCInstalled() void UILayer::HandleDLCInstalled()
{ {
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{ {
UIScene *topScene = *it; UIScene *topScene = *it;
topScene->HandleDLCInstalled(); topScene->HandleDLCInstalled();
@ -845,7 +841,7 @@ void UILayer::HandleDLCInstalled()
#ifdef _XBOX_ONE #ifdef _XBOX_ONE
void UILayer::HandleDLCLicenseChange() void UILayer::HandleDLCLicenseChange()
{ {
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) for( auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{ {
UIScene *topScene = *it; UIScene *topScene = *it;
topScene->HandleDLCLicenseChange(); topScene->HandleDLCLicenseChange();
@ -855,7 +851,7 @@ void UILayer::HandleDLCLicenseChange()
void UILayer::HandleMessage(EUIMessage message, void *data) void UILayer::HandleMessage(EUIMessage message, void *data)
{ {
for(AUTO_VAR(it,m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) for (auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it)
{ {
UIScene *topScene = *it; UIScene *topScene = *it;
topScene->HandleMessage(message, data); topScene->HandleMessage(message, data);
@ -875,9 +871,9 @@ C4JRender::eViewportType UILayer::getViewport()
void UILayer::handleUnlockFullVersion() void UILayer::handleUnlockFullVersion()
{ {
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) for(auto& it : m_sceneStack)
{ {
(*it)->handleUnlockFullVersion(); it->handleUnlockFullVersion();
} }
} }
@ -885,13 +881,13 @@ void UILayer::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic)
{ {
__int64 layerStatic = 0; __int64 layerStatic = 0;
__int64 layerDynamic = 0; __int64 layerDynamic = 0;
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it) for(auto& it : m_components)
{ {
(*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic); it->PrintTotalMemoryUsage(layerStatic, layerDynamic);
} }
for(AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) for(auto& it : m_sceneStack)
{ {
(*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic); it->PrintTotalMemoryUsage(layerStatic, layerDynamic);
} }
app.DebugPrintf(app.USER_SR, " \\- Layer static: %d , Layer dynamic: %d\n", layerStatic, layerDynamic); app.DebugPrintf(app.USER_SR, " \\- Layer static: %d , Layer dynamic: %d\n", layerStatic, layerDynamic);
totalStatic += layerStatic; totalStatic += layerStatic;

View file

@ -39,9 +39,9 @@ UIScene::~UIScene()
/* Destroy the Iggy player. */ /* Destroy the Iggy player. */
IggyPlayerDestroy( swf ); IggyPlayerDestroy( swf );
for(AUTO_VAR(it,m_registeredTextures.begin()); it != m_registeredTextures.end(); ++it) for(auto & it : m_registeredTextures)
{ {
ui.unregisterSubstitutionTexture( it->first, it->second ); ui.unregisterSubstitutionTexture( it.first, it.second );
} }
if(m_callbackUniqueId != 0) if(m_callbackUniqueId != 0)
@ -88,9 +88,9 @@ void UIScene::reloadMovie(bool force)
handlePreReload(); handlePreReload();
// Reload controls // Reload controls
for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it) for(auto & it : m_controls)
{ {
(*it)->ReInit(); it->ReInit();
} }
updateComponents(); updateComponents();
@ -440,9 +440,9 @@ void UIScene::tick()
while(IggyPlayerReadyToTick( swf )) while(IggyPlayerReadyToTick( swf ))
{ {
tickTimers(); tickTimers();
for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it) for(auto & it : m_controls)
{ {
(*it)->tick(); it->tick();
} }
IggyPlayerTickRS( swf ); IggyPlayerTickRS( swf );
m_hasTickedOnce = true; m_hasTickedOnce = true;
@ -468,7 +468,7 @@ void UIScene::addTimer(int id, int ms)
void UIScene::killTimer(int id) void UIScene::killTimer(int id)
{ {
AUTO_VAR(it, m_timers.find(id)); auto it = m_timers.find(id);
if(it != m_timers.end()) if(it != m_timers.end())
{ {
it->second.running = false; it->second.running = false;
@ -478,7 +478,7 @@ void UIScene::killTimer(int id)
void UIScene::tickTimers() void UIScene::tickTimers()
{ {
int currentTime = System::currentTimeMillis(); int currentTime = System::currentTimeMillis();
for(AUTO_VAR(it, m_timers.begin()); it != m_timers.end();) for (auto it = m_timers.begin(); it != m_timers.end();)
{ {
if(!it->second.running) if(!it->second.running)
{ {
@ -501,7 +501,7 @@ void UIScene::tickTimers()
IggyName UIScene::registerFastName(const wstring &name) IggyName UIScene::registerFastName(const wstring &name)
{ {
IggyName var; IggyName var;
AUTO_VAR(it,m_fastNames.find(name)); auto it = m_fastNames.find(name);
if(it != m_fastNames.end()) if(it != m_fastNames.end())
{ {
var = it->second; var = it->second;
@ -642,9 +642,8 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
PIXBeginNamedEvent(0,"Draw all cache"); PIXBeginNamedEvent(0,"Draw all cache");
// Draw all the cached slots // Draw all the cached slots
for(AUTO_VAR(it, m_cachedSlotDraw.begin()); it != m_cachedSlotDraw.end(); ++it) for(auto& drawData : m_cachedSlotDraw)
{ {
CachedSlotDrawData *drawData = *it;
ui.setupCustomDrawMatrices(this, drawData->customDrawRegion); ui.setupCustomDrawMatrices(this, drawData->customDrawRegion);
_customDrawSlotControl(drawData->customDrawRegion, iPad, drawData->item, drawData->fAlpha, drawData->isFoil, drawData->bDecorations, useCommandBuffers); _customDrawSlotControl(drawData->customDrawRegion, iPad, drawData->item, drawData->fAlpha, drawData->isFoil, drawData->bDecorations, useCommandBuffers);
delete drawData->customDrawRegion; delete drawData->customDrawRegion;
@ -1185,7 +1184,7 @@ void UIScene::registerSubstitutionTexture(const wstring &textureName, PBYTE pbDa
bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName) bool UIScene::hasRegisteredSubstitutionTexture(const wstring &textureName)
{ {
AUTO_VAR(it, m_registeredTextures.find( textureName ) ); auto it = m_registeredTextures.find(textureName);
return it != m_registeredTextures.end(); return it != m_registeredTextures.end();
} }
@ -1240,10 +1239,8 @@ UIScene *UIScene::getBackScene()
#ifdef __PSVITA__ #ifdef __PSVITA__
void UIScene::UpdateSceneControls() void UIScene::UpdateSceneControls()
{ {
AUTO_VAR(itEnd, GetControls()->end()); for ( UIControl *control : *GetControls() )
for (AUTO_VAR(it, GetControls()->begin()); it != itEnd; it++)
{ {
UIControl *control=(UIControl *)*it;
control->UpdateControl(); control->UpdateControl();
} }
} }

View file

@ -191,13 +191,13 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre
switch(iTextC) switch(iTextC)
{ {
case 0: case 0:
m_labelHTMLSellText.init("Voici un fantastique mini-pack de 24 apparences pour personnaliser votre personnage Minecraft et vous mettre dans l'ambiance des fêtes de fin d'année.<br><br>1-4 joueurs<br>2-8 joueurs en réseau<br><br> Cet article fait lobjet dune licence ou dune sous-licence de Sony Computer Entertainment America, et est soumis aux conditions générales du service du réseau, au contrat dutilisateur, aux restrictions dutilisation de cet article et aux autres conditions applicables, disponibles sur le site www.us.playstation.com/support/useragreements. Si vous ne souhaitez pas accepter ces conditions, ne téléchargez pas ce produit. Cet article peut être utilisé avec un maximum de deux systèmes PlayStation®3 activés associés à ce compte Sony Entertainment Network. <br><br>'Minecraft' est une marque commerciale de Notch Development AB."); m_labelHTMLSellText.init("Voici un fantastique mini-pack de 24 apparences pour personnaliser votre personnage Minecraft et vous mettre dans l'ambiance des f<EFBFBD>tes de fin d'ann<6E>e.<br><br>1-4 joueurs<br>2-8 joueurs en r<>seau<br><br> Cet article fait l<>objet d<>une licence ou d<>une sous-licence de Sony Computer Entertainment America, et est soumis aux conditions g<>n<EFBFBD>rales du service du r<>seau, au contrat d<>utilisateur, aux restrictions d<>utilisation de cet article et aux autres conditions applicables, disponibles sur le site www.us.playstation.com/support/useragreements. Si vous ne souhaitez pas accepter ces conditions, ne t<EFBFBD>l<EFBFBD>chargez pas ce produit. Cet article peut <20>tre utilis<69> avec un maximum de deux syst<73>mes PlayStation<6F>3 activ<69>s associ<63>s <20> ce compte Sony Entertainment Network.<2E><br><br>'Minecraft' est une marque commerciale de Notch Development AB.");
break; break;
case 1: case 1:
m_labelHTMLSellText.init("Un fabuloso minipack de 24 aspectos para personalizar tu personaje de Minecraft y ponerte a tono con las fiestas.<br><br>1-4 jugadores<br>2-8 jugadores en red<br><br> Sony Computer Entertainment America le concede la licencia o sublicencia de este artículo, que está sujeto a los términos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este artículo, así como otros términos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos términos, no descargue este artículo. Este artículo puede usarse en hasta dos sistemas PlayStation®3 activados asociados con esta cuenta de Sony Entertainment Network. <br><br>'Minecraft' es una marca comercial de Notch Development AB."); m_labelHTMLSellText.init("Un fabuloso minipack de 24 aspectos para personalizar tu personaje de Minecraft y ponerte a tono con las fiestas.<br><br>1-4 jugadores<br>2-8 jugadores en red<br><br> Sony Computer Entertainment America le concede la licencia o sublicencia de este art<EFBFBD>culo, que est<73> sujeto a los t<>rminos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este art<72>culo, as<61> como otros t<>rminos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos t<EFBFBD>rminos, no descargue este art<72>culo. Este art<72>culo puede usarse en hasta dos sistemas PlayStation<6F>3 activados asociados con esta cuenta de Sony Entertainment Network.<2E><br><br>'Minecraft' es una marca comercial de Notch Development AB.");
break; break;
case 2: case 2:
m_labelHTMLSellText.init("Este é um incrível pacote com 24 capas para personalizar seu personagem no Minecraft e entrar no clima de final de ano.<br><br>1-4 Jogadores<br>Jogadores em rede 2-8<br><br> Este item está sendo licenciado ou sublicenciado para você pela Sony Computer Entertainment America e está sujeito aos Termos de Serviço da Rede e Acordo do Usuário, as restrições de uso deste item e outros termos aplicáveis estão localizados em www.us.playstation.com/support/useragreements. Caso não queira aceitar todos esses termos, não baixe este item. Este item pode ser usado com até 2 sistemas PlayStation®3 ativados associados a esta Conta de Rede Sony Entertainment. <br><br>'Minecraft' é uma marca registrada da Notch Development AB"); m_labelHTMLSellText.init("Este <EFBFBD> um incr<63>vel pacote com 24 capas para personalizar seu personagem no Minecraft e entrar no clima de final de ano.<br><br>1-4 Jogadores<br>Jogadores em rede 2-8<br><br> Este item est<EFBFBD> sendo licenciado ou sublicenciado para voc<6F> pela Sony Computer Entertainment America e est<73> sujeito aos Termos de Servi<76>o da Rede e Acordo do Usu<73>rio, as restri<72><69>es de uso deste item e outros termos aplic<69>veis est<73>o localizados em www.us.playstation.com/support/useragreements. Caso n<>o queira aceitar todos esses termos, n<>o baixe este item. Este item pode ser usado com at<61> 2 sistemas PlayStation<6F>3 ativados associados a esta Conta de Rede Sony Entertainment.<2E><br><br>'Minecraft' <20> uma marca registrada da Notch Development AB");
break; break;
} }
iTextC++; iTextC++;
@ -660,25 +660,6 @@ void UIScene_DLCOffersMenu::tick()
} }
} }
} }
// if(m_bBitmapOfferIconDisplayed==false)
// {
// // do we have it yet?
// if
// }
// retrieve the icons for the DLC
// if(m_vIconRetrieval.size()>0)
// {
// // for each icon, request it, and remove it from the list
// // the callback for the retrieval will update the display if needed
//
// AUTO_VAR(itEnd, m_vIconRetrieval.end());
// for (AUTO_VAR(it, m_vIconRetrieval.begin()); it != itEnd; it++)
// {
//
// }
//
// }
#endif #endif
} }

View file

@ -80,7 +80,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa
for(unsigned int level = ench->getMinLevel(); level <= ench->getMaxLevel(); ++level) for(unsigned int level = ench->getMinLevel(); level <= ench->getMaxLevel(); ++level)
{ {
m_enchantmentIdAndLevels.push_back(pair<int,int>(ench->id,level)); m_enchantmentIdAndLevels.push_back(pair<int,int>(ench->id,level));
m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + _toString<int>(level) ); m_buttonListEnchantments.addItem(app.GetString( ench->getDescriptionId() ) + std::to_wstring(level) );
} }
} }

View file

@ -61,13 +61,13 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer)
noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName); noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName);
Random random(8124371); Random random(8124371);
int found=(int)noNoiseString.find(L"{*NOISE*}"); size_t found=noNoiseString.find(L"{*NOISE*}");
int length; int length;
while (found!=string::npos) while (found!=string::npos)
{ {
length = random.nextInt(4) + 3; length = random.nextInt(4) + 3;
m_noiseLengths.push_back(length); m_noiseLengths.push_back(length);
found=(int)noNoiseString.find(L"{*NOISE*}",found+1); found=noNoiseString.find(L"{*NOISE*}",found+1);
} }
updateNoise(); updateNoise();
@ -209,8 +209,8 @@ void UIScene_EndPoem::updateNoise()
wstring tag = L"{*NOISE*}"; wstring tag = L"{*NOISE*}";
AUTO_VAR(it, m_noiseLengths.begin()); auto it = m_noiseLengths.begin();
int found=(int)noiseString.find(tag); size_t found= noiseString.find(tag);
while (found!=string::npos && it != m_noiseLengths.end() ) while (found!=string::npos && it != m_noiseLengths.end() )
{ {
length = *it; length = *it;
@ -275,6 +275,6 @@ void UIScene_EndPoem::updateNoise()
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0)); //ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
//ib.put(listPos + pos + 32); //ib.put(listPos + pos + 32);
found=(int)noiseString.find(tag,found+1); found=noiseString.find(tag,found+1);
} }
} }

View file

@ -261,10 +261,8 @@ void UIScene_InventoryMenu::updateEffectsDisplay()
int iValue = 0; int iValue = 0;
IggyDataValue *UpdateValue = new IggyDataValue[activeEffects->size()*2]; IggyDataValue *UpdateValue = new IggyDataValue[activeEffects->size()*2];
for(AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); ++it) for(auto& effect : *activeEffects)
{ {
MobEffectInstance *effect = *it;
if(effect->getDuration() >= m_bEffectTime[effect->getId()]) if(effect->getDuration() >= m_bEffectTime[effect->getId()])
{ {
wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim(); wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim();

View file

@ -1054,10 +1054,8 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons()
int i = 0; int i = 0;
for(AUTO_VAR(it, app.getLevelGenerators()->begin()); it != app.getLevelGenerators()->end(); ++it) for ( LevelGenerationOptions *levelGen : *app.getLevelGenerators() )
{ {
LevelGenerationOptions *levelGen = *it;
// retrieve the save icon from the texture pack, if there is one // retrieve the save icon from the texture pack, if there is one
unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId(); unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId();
@ -1859,10 +1857,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList()
unsigned int sessionIndex = 0; unsigned int sessionIndex = 0;
m_buttonListGames.setCurrentSelection(0); m_buttonListGames.setCurrentSelection(0);
for( AUTO_VAR(it, m_currentSessions->begin()); it < m_currentSessions->end(); ++it) for( FriendSessionInfo *sessionInfo : *m_currentSessions )
{ {
FriendSessionInfo *sessionInfo = *it;
wchar_t textureName[64] = L"\0"; wchar_t textureName[64] = L"\0";
// Is this a default game or a texture pack game? // Is this a default game or a texture pack game?

View file

@ -74,7 +74,7 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
#ifdef _DEBUG #ifdef _DEBUG
int iCount=0; int iCount=0;
for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++) for ( auto it : m_vListData )
{ {
PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it; PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
app.DebugPrintf("%d. ",iCount++); app.DebugPrintf("%d. ",iCount++);
@ -103,18 +103,6 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
} }
} }
LeaveCriticalSection(&m_AccessListData); LeaveCriticalSection(&m_AccessListData);
// #ifdef _DEBUG
//
// iCount=0;
// for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++)
// {
// PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
// app.DebugPrintf("After Sort - %d. ",iCount++);
// OutputDebugStringW(pInfo->pwszText);
// app.DebugPrintf(" - %d\n",pInfo->iSortIndex);
//
// }
// #endif
InsertItems( 0, 1 ); InsertItems( 0, 1 );
} }

View file

@ -69,7 +69,7 @@ HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText *
// Light background and focus background // Light background and focus background
SetEnable(TRUE); SetEnable(TRUE);
} }
m_costString = _toString<int>(cost); m_costString = std::to_wstring(cost);
m_lastCost = cost; m_lastCost = cost;
} }
if(cost == 0) if(cost == 0)

View file

@ -124,7 +124,7 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B
glColor4f(1, 1, 1, 1); glColor4f(1, 1, 1, 1);
if (cost != 0) if (cost != 0)
{ {
wstring line = _toString<int>(cost); wstring line = std::to_wstring(cost);
Font *font = pMinecraft->altFont; Font *font = pMinecraft->altFont;
//int col = 0x685E4A; //int col = 0x685E4A;
unsigned int col = m_textColour; unsigned int col = m_textColour;

View file

@ -256,10 +256,8 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{ {
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it) for(auto& pModelPart : *m_pvAdditionalModelParts)
{ {
ModelPart *pModelPart=*it;
pModelPart->visible=true; pModelPart->visible=true;
} }
} }
@ -270,10 +268,8 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
// hide the additional parts // hide the additional parts
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
{ {
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it) for(auto& pModelPart : *m_pvAdditionalModelParts)
{ {
ModelPart *pModelPart=*it;
pModelPart->visible=false; pModelPart->visible=false;
} }
} }

View file

@ -137,9 +137,8 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri
wstring desc = L""; wstring desc = L"";
vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings); vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings);
bool firstLine = true; bool firstLine = true;
for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) for ( wstring& thisString : *strings )
{ {
wstring thisString = *it;
if(!firstLine) if(!firstLine)
{ {
desc.append( L"<br />" ); desc.append( L"<br />" );

View file

@ -25,10 +25,10 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil()); m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) ); m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
m_itemId .SetText( _toString<int>(m_item->id).c_str() ); m_itemId .SetText( std::to_wstring(m_item->id).c_str() );
m_itemAuxValue .SetText( _toString<int>(m_item->getAuxValue()).c_str() ); m_itemAuxValue .SetText( std::to_wstring(m_item->getAuxValue()).c_str() );
m_itemCount .SetText( _toString<int>(m_item->count).c_str() ); m_itemCount .SetText( std::to_wstring(m_item->count).c_str() );
m_item4JData .SetText( _toString<int>(m_item->get4JData()).c_str() ); m_item4JData .SetText( std::to_wstring(m_item->get4JData()).c_str() );
} }
m_itemId .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric); m_itemId .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);

View file

@ -365,10 +365,10 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius)
RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized
{ {
File file( prefix + wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" ); File file( prefix + wstring(L"r.") + std::to_wstring(chunkX>>5) + L"." + std::to_wstring(chunkZ>>5) + L".mcr" );
RegionFile *ref = NULL; RegionFile *ref = NULL;
AUTO_VAR(it, newFileCache.find(file)); auto it = newFileCache.find(file);
if( it != newFileCache.end() ) if( it != newFileCache.end() )
ref = it->second; ref = it->second;

View file

@ -43,12 +43,12 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled
m_yRot.SetKeyboardType(C_4JInput::EKeyboardMode_Full); m_yRot.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
m_elevation.SetKeyboardType(C_4JInput::EKeyboardMode_Full); m_elevation.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
m_camX.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camX).c_str()); m_camX.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camX).c_str());
m_camY.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camY + 1.62).c_str()); m_camY.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camY + 1.62).c_str());
m_camZ.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camZ).c_str()); m_camZ.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camZ).c_str());
m_yRot.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_yRot).c_str()); m_yRot.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_yRot).c_str());
m_elevation.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_elev).c_str()); m_elevation.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_elev).c_str());
//fpp = new FreezePlayerParam(); //fpp = new FreezePlayerParam();
//fpp->player = playerNo; //fpp->player = playerNo;

View file

@ -267,9 +267,8 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons()
int iGeneratorIndex = 0; int iGeneratorIndex = 0;
m_iMashUpButtonsC=0; m_iMashUpButtonsC=0;
for(AUTO_VAR(it, m_generators->begin()); it != m_generators->end(); ++it) for (LevelGenerationOptions *levelGen : *m_generators )
{ {
LevelGenerationOptions *levelGen = *it;
ListInfo.pwszText = levelGen->getWorldName(); ListInfo.pwszText = levelGen->getWorldName();
ListInfo.fEnabled = TRUE; ListInfo.fEnabled = TRUE;
ListInfo.iData = iGeneratorIndex++; // used to index into the list of generators ListInfo.iData = iGeneratorIndex++; // used to index into the list of generators
@ -387,9 +386,9 @@ HRESULT CScene_MultiGameJoinLoad::OnDestroy()
{ {
g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL ); g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL );
for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it) for (auto& it : currentSessions )
{ {
delete (*it); delete it;
} }
if(m_bSaveTransferInProgress) if(m_bSaveTransferInProgress)
@ -1145,9 +1144,9 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId; if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId;
pSelectedSession = NULL; pSelectedSession = NULL;
for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it) for (auto& it : currentSessions )
{ {
delete (*it); delete it;
} }
currentSessions.clear(); currentSessions.clear();
@ -1248,9 +1247,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
unsigned int sessionIndex = 0; unsigned int sessionIndex = 0;
m_pGamesList->SetCurSel(0); m_pGamesList->SetCurSel(0);
for( AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it) for ( FriendSessionInfo *sessionInfo : currentSessions )
{ {
FriendSessionInfo *sessionInfo = *it;
HXUIBRUSH hXuiBrush; HXUIBRUSH hXuiBrush;
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo; CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
@ -1390,7 +1388,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
FriendSessionInfo *sessionInfo = NULL; FriendSessionInfo *sessionInfo = NULL;
bool foundSession = false; bool foundSession = false;
for(AUTO_VAR(it, friendsSessions.begin()); it < friendsSessions.end(); ++it) for( auto it = friendsSessions.begin(); it != friendsSessions.end(); ++it)
{ {
sessionInfo = *it; sessionInfo = *it;
if(memcmp( &pSearchResult->info.sessionID, &sessionInfo->sessionId, sizeof(SessionID) ) == 0) if(memcmp( &pSearchResult->info.sessionID, &sessionInfo->sessionId, sizeof(SessionID) ) == 0)

View file

@ -388,15 +388,15 @@ void CXuiSceneAbstractContainer::SetPointerText(const wstring &description, vect
} }
bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()); bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen());
wstring desc = L"<font size=\"" + _toString<int>(smallPointer ? 12 :14) + L"\">" + description + L"</font>"; wstring desc = L"<font size=\"" + std::to_wstring(smallPointer ? 12 :14) + L"\">" + description + L"</font>";
XUIRect tempXuiRect, xuiRect; XUIRect tempXuiRect, xuiRect;
HRESULT hr; HRESULT hr;
xuiRect.right = 0; xuiRect.right = 0;
for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it) for (auto& it : unformattedStrings )
{ {
XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials((*it)).c_str(), &tempXuiRect); XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials(it).c_str(), &tempXuiRect);
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect; if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
} }

View file

@ -176,7 +176,7 @@ void CXuiSceneInventory::updateEffectsDisplay()
// Fill out details for display // Fill out details for display
D3DXVECTOR3 position; D3DXVECTOR3 position;
m_hEffectDisplayA[0]->GetPosition(&position); m_hEffectDisplayA[0]->GetPosition(&position);
AUTO_VAR(it, activeEffects->begin()); auto it = activeEffects->begin();
for(unsigned int i = 0; i < MAX_EFFECTS; ++i) for(unsigned int i = 0; i < MAX_EFFECTS; ++i)
{ {
if(it != activeEffects->end()) if(it != activeEffects->end())

View file

@ -270,15 +270,15 @@ void CXuiSceneTrading::setOfferDescription(const wstring &name, vector<wstring>
} }
bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()); bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen());
wstring desc = L"<font size=\"" + _toString<int>(smallPointer ? 12 :14) + L"\">" + name + L"</font>"; wstring desc = L"<font size=\"" + std::to_wstring(smallPointer ? 12 :14) + L"\">" + name + L"</font>";
XUIRect tempXuiRect, xuiRect; XUIRect tempXuiRect, xuiRect;
HRESULT hr; HRESULT hr;
xuiRect.right = 0; xuiRect.right = 0;
for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it) for (auto& it : unformattedStrings )
{ {
XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, (*it).c_str(), &tempXuiRect); XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, it.c_str(), &tempXuiRect);
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect; if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
} }

View file

@ -195,7 +195,7 @@ void CScene_Win::updateNoise()
Minecraft *pMinecraft = Minecraft::GetInstance(); Minecraft *pMinecraft = Minecraft::GetInstance();
noiseString = noNoiseString; noiseString = noNoiseString;
int length = 0; size_t length = 0;
wchar_t replacements[64]; wchar_t replacements[64];
wstring replaceString = L""; wstring replaceString = L"";
wchar_t randomChar = L'a'; wchar_t randomChar = L'a';
@ -205,17 +205,17 @@ void CScene_Win::updateNoise()
wstring tag = L"{*NOISE*}"; wstring tag = L"{*NOISE*}";
AUTO_VAR(it, m_noiseLengths.begin()); auto it = m_noiseLengths.begin();
int found=(int)noiseString.find_first_of(L"{"); size_t found = noiseString.find_first_of(L"{");
while (found!=string::npos && it != m_noiseLengths.end() ) while (found!=string::npos && it != m_noiseLengths.end() )
{ {
length = *it; length = *it;
++it; ++it;
replaceString = L""; replaceString = L"";
for(int i = 0; i < length; ++i) for(size_t i = 0; i < length; ++i)
{ {
randomChar = SharedConstants::acceptableLetters[random->nextInt((int)SharedConstants::acceptableLetters.length())]; randomChar = SharedConstants::acceptableLetters[random->nextInt(SharedConstants::acceptableLetters.length())];
wstring randomCharStr = L""; wstring randomCharStr = L"";
randomCharStr.push_back(randomChar); randomCharStr.push_back(randomChar);
@ -262,7 +262,7 @@ void CScene_Win::updateNoise()
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0)); //ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
//ib.put(listPos + pos + 32); //ib.put(listPos + pos + 32);
found=(int)noiseString.find_first_of(L"{",found+1); found = noiseString.find_first_of(L"{",found+1);
} }
} }

View file

@ -113,7 +113,7 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText)
swscanf_s(wsText.c_str(), L"%s", wchCommand,40); swscanf_s(wsText.c_str(), L"%s", wchCommand,40);
#endif #endif
AUTO_VAR(it, m_CommandSet.find(wchCommand)); auto it = m_CommandSet.find(wchCommand);
if(it != m_CommandSet.end()) if(it != m_CommandSet.end())
{ {
// found it // found it

View file

@ -48,7 +48,7 @@ void DeathScreen::render(int xm, int ym, float a)
glScalef(2, 2, 2); glScalef(2, 2, 2);
drawCenteredString(font, L"Game over!", width / 2 / 2, 60 / 2, 0xffffff); drawCenteredString(font, L"Game over!", width / 2 / 2, 60 / 2, 0xffffff);
glPopMatrix(); glPopMatrix();
drawCenteredString(font, L"Score: &e" + _toString( minecraft->player->getScore() ), width / 2, 100, 0xffffff); drawCenteredString(font, L"Score: &e" + std::to_wstring( minecraft->player->getScore() ), width / 2, 100, 0xffffff);
Screen::render(xm, ym, a); Screen::render(xm, ym, a);

View file

@ -26,7 +26,7 @@ void DemoMode::tick()
{ {
if (day <= (DEMO_DAYS + 1)) if (day <= (DEMO_DAYS + 1))
{ {
minecraft->gui->displayClientMessage(L"demo.day." + _toString<__int64>(day)); minecraft->gui->displayClientMessage(L"demo.day." + std::to_wstring(day));
} }
} }
else if (day == 1) else if (day == 1)

View file

@ -171,7 +171,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages()
{ {
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo(); unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
// 4J-PB - Any local graphic files for the Minecraft Store? // 4J-PB - Any local graphic files for the Minecraft Store?
for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) for (auto it = pDLCInfoA->begin(); it != pDLCInfoA->end(); it++)
{ {
DLC_INFO * pDLCInfo=(*it).second; DLC_INFO * pDLCInfo=(*it).second;
@ -185,7 +185,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages()
// 4J-PB - Any local graphic files for the Minecraft Store? // 4J-PB - Any local graphic files for the Minecraft Store?
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo(); unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
for( AUTO_VAR(it, pDLCInfoA->begin()); it != pDLCInfoA->end(); it++ ) for (auto it = pDLCInfoA->begin(); it != pDLCInfoA->end(); it++)
{ {
DLC_INFO * pDLCInfo=(*it).second; DLC_INFO * pDLCInfo=(*it).second;
@ -567,8 +567,8 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad,
// dump out the file list // dump out the file list
app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size()); app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size());
int iCount=0; int iCount=0;
AUTO_VAR(itEnd, pvTmsFileDetails->end()); auto itEnd = pvTmsFileDetails->end();
for( AUTO_VAR(it, pvTmsFileDetails->begin()); it != itEnd; it++ ) for (auto it = pvTmsFileDetails->begin(); it != itEnd; it++)
{ {
C4JStorage::PTMSPP_FILE_DETAILS fd = *it; C4JStorage::PTMSPP_FILE_DETAILS fd = *it;
app.DebugPrintf("%2d. %ls (size - %d)\n",iCount++,fd->wchFilename,fd->ulFileSize); app.DebugPrintf("%2d. %ls (size - %d)\n",iCount++,fd->wchFilename,fd->ulFileSize);

View file

@ -1102,12 +1102,12 @@ SIZE_T WINAPI XMemSize(
void DumpMem() void DumpMem()
{ {
int totalLeak = 0; int totalLeak = 0;
for(AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++ ) for( auto& it : allocCounts )
{ {
if(it->second > 0 ) if(it.second > 0 )
{ {
app.DebugPrintf("%d %d %d %d\n",( it->first >> 26 ) & 0x3f,it->first & 0x03ffffff, it->second, (it->first & 0x03ffffff) * it->second); app.DebugPrintf("%d %d %d %d\n",( it.first >> 26 ) & 0x3f,it.first & 0x03ffffff, it.second, (it.first & 0x03ffffff) * it.second);
totalLeak += ( it->first & 0x03ffffff ) * it->second; totalLeak += ( it.first & 0x03ffffff ) * it.second;
} }
} }
app.DebugPrintf("Total %d\n",totalLeak); app.DebugPrintf("Total %d\n",totalLeak);
@ -1150,13 +1150,13 @@ void MemPixStuff()
int totals[MAX_SECT] = {0}; int totals[MAX_SECT] = {0};
for(AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++ ) for ( auto& it : allocCounts )
{ {
if(it->second > 0 ) if ( it.second > 0 )
{ {
int sect = ( it->first >> 26 ) & 0x3f; int sect = ( it.first >> 26 ) & 0x3f;
int bytes = it->first & 0x03ffffff; int bytes = it.first & 0x03ffffff;
totals[sect] += bytes * it->second; totals[sect] += bytes * it.second;
} }
} }

View file

@ -28,43 +28,43 @@ DurangoLeaderboardManager::DurangoLeaderboardManager()
for(unsigned int difficulty = 0; difficulty < 4; ++difficulty) for(unsigned int difficulty = 0; difficulty < 4; ++difficulty)
{ {
m_leaderboardNames[difficulty][eStatsType_Travelling] = L"LeaderboardTravelling" + _toString(difficulty); m_leaderboardNames[difficulty][eStatsType_Travelling] = L"LeaderboardTravelling" + std::to_wstring(difficulty);
m_leaderboardNames[difficulty][eStatsType_Mining] = L"LeaderboardMining" + _toString(difficulty); m_leaderboardNames[difficulty][eStatsType_Mining] = L"LeaderboardMining" + std::to_wstring(difficulty);
m_leaderboardNames[difficulty][eStatsType_Farming] = L"LeaderboardFarming" + _toString(difficulty); m_leaderboardNames[difficulty][eStatsType_Farming] = L"LeaderboardFarming" + std::to_wstring(difficulty);
m_leaderboardNames[difficulty][eStatsType_Kills] = L"LeaderboardKills" + _toString(difficulty); m_leaderboardNames[difficulty][eStatsType_Kills] = L"LeaderboardKills" + std::to_wstring(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Travelling] = L"Leaderboard.LeaderboardId.0.DifficultyLevelId." + _toString(difficulty); m_socialLeaderboardNames[difficulty][eStatsType_Travelling] = L"Leaderboard.LeaderboardId.0.DifficultyLevelId." + std::to_wstring(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Mining] = L"Leaderboard.LeaderboardId.1.DifficultyLevelId." + _toString(difficulty); m_socialLeaderboardNames[difficulty][eStatsType_Mining] = L"Leaderboard.LeaderboardId.1.DifficultyLevelId." + std::to_wstring(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Farming] = L"Leaderboard.LeaderboardId.2.DifficultyLevelId." + _toString(difficulty); m_socialLeaderboardNames[difficulty][eStatsType_Farming] = L"Leaderboard.LeaderboardId.2.DifficultyLevelId." + std::to_wstring(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Kills] = L"Leaderboard.LeaderboardId.3.DifficultyLevelId." + _toString(difficulty); m_socialLeaderboardNames[difficulty][eStatsType_Kills] = L"Leaderboard.LeaderboardId.3.DifficultyLevelId." + std::to_wstring(difficulty);
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.0"); // Walked m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.0"); // Walked
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.2"); // Fallen m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.2"); // Fallen
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.4"); // Minecart m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.4"); // Minecart
m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + _toString(difficulty) + L".TravelMethodId.5"); // Boat m_leaderboardStatNames[difficulty][eStatsType_Travelling].push_back( L"DistanceTravelled.DifficultyLevelId." + std::to_wstring(difficulty) + L".TravelMethodId.5"); // Boat
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.3"); // Dirt m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.3"); // Dirt
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.4"); // Cobblestone m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.4"); // Cobblestone
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.12"); // Sand m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.12"); // Sand
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.1"); // Stone m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.1"); // Stone
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.13"); // Gravel m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.13"); // Gravel
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.82"); // Clay m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.82"); // Clay
m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.49"); // Obsidian m_leaderboardStatNames[difficulty][eStatsType_Mining].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.49"); // Obsidian
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.1.ItemId.344"); // Eggs m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.1.ItemId.344"); // Eggs
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.59"); // Wheat m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.59"); // Wheat
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.39"); // Mushroom m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.39"); // Mushroom
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + _toString(difficulty) + L".BlockId.83"); // Sugarcane m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"BlockBroken.DifficultyLevelId." + std::to_wstring(difficulty) + L".BlockId.83"); // Sugarcane
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.2.ItemId.335"); // Milk m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.2.ItemId.335"); // Milk
m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + _toString(difficulty) + L".AcquisitionMethodId.1.ItemId.86"); // Pumpkin m_leaderboardStatNames[difficulty][eStatsType_Farming].push_back( L"McItemAcquired.DifficultyLevelId." + std::to_wstring(difficulty) + L".AcquisitionMethodId.1.ItemId.86"); // Pumpkin
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.54"); // Zombie m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.54"); // Zombie
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.51"); // Skeleton m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.51"); // Skeleton
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.50"); // Creeper m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.50"); // Creeper
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.52"); // Spider m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.52"); // Spider
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.49"); // Spider Jockey m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.49"); // Spider Jockey
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.57"); // Zombie Pigman m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.57"); // Zombie Pigman
m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + _toString(difficulty) + L".EnemyRoleId.55"); // Slime m_leaderboardStatNames[difficulty][eStatsType_Kills].push_back( L"MobKilledTotal.DifficultyLevelId." + std::to_wstring(difficulty) + L".EnemyRoleId.55"); // Slime
} }
} }

View file

@ -1460,7 +1460,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
{ {
PlayerSyncData *pNewPlayer = &pNewSyncData->players[i]; PlayerSyncData *pNewPlayer = &pNewSyncData->players[i];
bool bAlreadyExisted = false; bool bAlreadyExisted = false;
for( AUTO_VAR(it, tempPlayers.begin()); it != tempPlayers.end(); it++ ) for (auto it = tempPlayers.begin(); it != tempPlayers.end(); it++)
{ {
if( pNewPlayer->m_smallId == (*it)->GetSmallId() ) if( pNewPlayer->m_smallId == (*it)->GetSmallId() )
{ {

View file

@ -131,9 +131,8 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl
{ {
// Do we already have a primary player for this system? // Do we already have a primary player for this system?
bool systemHasPrimaryPlayer = false; bool systemHasPrimaryPlayer = false;
for(AUTO_VAR(it, m_machineDQRPrimaryPlayers.begin()); it < m_machineDQRPrimaryPlayers.end(); ++it) for ( DQRNetworkPlayer *pQNetPrimaryPlayer : m_machineDQRPrimaryPlayers )
{ {
DQRNetworkPlayer *pQNetPrimaryPlayer = *it;
if( pDQRPlayer->IsSameSystem(pQNetPrimaryPlayer) ) if( pDQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
{ {
systemHasPrimaryPlayer = true; systemHasPrimaryPlayer = true;
@ -233,7 +232,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP
break; break;
} }
} }
AUTO_VAR(it, find( m_machineDQRPrimaryPlayers.begin(), m_machineDQRPrimaryPlayers.end(), pDQRPlayer)); auto it = find(m_machineDQRPrimaryPlayers.begin(), m_machineDQRPrimaryPlayers.end(), pDQRPlayer);
if( it != m_machineDQRPrimaryPlayers.end() ) if( it != m_machineDQRPrimaryPlayers.end() )
{ {
m_machineDQRPrimaryPlayers.erase( it ); m_machineDQRPrimaryPlayers.erase( it );
@ -847,7 +846,7 @@ INetworkPlayer *CPlatformNetworkManagerDurango::addNetworkPlayer(DQRNetworkPlaye
void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRPlayer) void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRPlayer)
{ {
INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pDQRPlayer); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pDQRPlayer);
for( AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++ ) for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); ++it)
{ {
if( *it == pNetworkPlayer ) if( *it == pNetworkPlayer )
{ {

View file

@ -974,11 +974,11 @@ DurangoStats *CDurangoTelemetryManager::durangoStats()
wstring CDurangoTelemetryManager::guid2str(LPCGUID guid) wstring CDurangoTelemetryManager::guid2str(LPCGUID guid)
{ {
wstring out = L"GUID<"; wstring out = L"GUID<";
out += _toString<unsigned long>(guid->Data1); out += std::to_wstring(guid->Data1);
out += L":"; out += L":";
out += _toString<unsigned short>(guid->Data2); out += std::to_wstring(guid->Data2);
out += L":"; out += L":";
out += _toString<unsigned short>(guid->Data3); out += std::to_wstring(guid->Data3);
//out += L":"; //out += L":";
//out += convStringToWstring(string((char*)&guid->Data4,8)); //out += convStringToWstring(string((char*)&guid->Data4,8));
out += L">"; out += L">";

View file

@ -169,10 +169,9 @@ EntityRenderDispatcher::EntityRenderDispatcher()
renderers[eTYPE_LIGHTNINGBOLT] = new LightningBoltRenderer(); renderers[eTYPE_LIGHTNINGBOLT] = new LightningBoltRenderer();
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
AUTO_VAR(itEnd, renderers.end()); for( auto& it : renderers )
for( classToRendererMap::iterator it = renderers.begin(); it != itEnd; it++ )
{ {
it->second->init(this); it.second->init(this);
} }
isGuiRender = false; // 4J added isGuiRender = false; // 4J added
@ -182,7 +181,7 @@ EntityRenderer *EntityRenderDispatcher::getRenderer(eINSTANCEOF e)
{ {
if( (e & eTYPE_PLAYER) == eTYPE_PLAYER) e = eTYPE_PLAYER; if( (e & eTYPE_PLAYER) == eTYPE_PLAYER) e = eTYPE_PLAYER;
//EntityRenderer * r = renderers[e]; //EntityRenderer * r = renderers[e];
AUTO_VAR(it, renderers.find( e )); // 4J Stu - The .at and [] accessors insert elements if they don't exist auto it = renderers.find(e); // 4J Stu - The .at and [] accessors insert elements if they don't exist
if( it == renderers.end() ) if( it == renderers.end() )
{ {
@ -305,10 +304,9 @@ Font *EntityRenderDispatcher::getFont()
void EntityRenderDispatcher::registerTerrainTextures(IconRegister *iconRegister) void EntityRenderDispatcher::registerTerrainTextures(IconRegister *iconRegister)
{ {
//for (EntityRenderer<? extends Entity> renderer : renderers.values()) for( auto& it : renderers )
for(AUTO_VAR(it, renderers.begin()); it != renderers.end(); ++it)
{ {
EntityRenderer *renderer = it->second; EntityRenderer *renderer = it.second;
renderer->registerTerrainTextures(iconRegister); renderer->registerTerrainTextures(iconRegister);
} }
} }

View file

@ -33,11 +33,11 @@ void EntityTracker::addEntity(shared_ptr<Entity> e)
{ {
addEntity(e, 32 * 16, 2); addEntity(e, 32 * 16, 2);
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(e); shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(e);
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) for ( auto& it : entities )
{ {
if( (*it)->e != player ) if( it && it->e != player )
{ {
(*it)->updatePlayer(this, player); it->updatePlayer(this, player);
} }
} }
} }
@ -95,7 +95,7 @@ void EntityTracker::addEntity(shared_ptr<Entity> e, int range, int updateInterva
// This is to allow us to now choose to remove the player as a "seenBy" only when the player has actually been removed from the level's own player array // This is to allow us to now choose to remove the player as a "seenBy" only when the player has actually been removed from the level's own player array
void EntityTracker::removeEntity(shared_ptr<Entity> e) void EntityTracker::removeEntity(shared_ptr<Entity> e)
{ {
AUTO_VAR(it, entityMap.find(e->entityId)); auto it = entityMap.find(e->entityId);
if( it != entityMap.end() ) if( it != entityMap.end() )
{ {
shared_ptr<TrackedEntity> te = it->second; shared_ptr<TrackedEntity> te = it->second;
@ -110,9 +110,10 @@ void EntityTracker::removePlayer(shared_ptr<Entity> e)
if (e->GetType() == eTYPE_SERVERPLAYER) if (e->GetType() == eTYPE_SERVERPLAYER)
{ {
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(e); shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(e);
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) for( auto& it : entities )
{ {
(*it)->removePlayer(player); if ( it )
it->removePlayer(player);
} }
// 4J: Flush now to ensure remove packets are sent before player respawns and add entity packets are sent // 4J: Flush now to ensure remove packets are sent before player respawns and add entity packets are sent
@ -123,15 +124,17 @@ void EntityTracker::removePlayer(shared_ptr<Entity> e)
void EntityTracker::tick() void EntityTracker::tick()
{ {
vector<shared_ptr<ServerPlayer> > movedPlayers; vector<shared_ptr<ServerPlayer> > movedPlayers;
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) for( auto& te : entities )
{
if ( te )
{ {
shared_ptr<TrackedEntity> te = *it;
te->tick(this, &level->players); te->tick(this, &level->players);
if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER) if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER)
{ {
movedPlayers.push_back(dynamic_pointer_cast<ServerPlayer>(te->e)); movedPlayers.push_back(dynamic_pointer_cast<ServerPlayer>(te->e));
} }
} }
}
// 4J Stu - If one player on a system is updated, then make sure they all are as they all have their // 4J Stu - If one player on a system is updated, then make sure they all are as they all have their
// range extended to include entities visible by any other player on the system // range extended to include entities visible by any other player on the system
@ -168,10 +171,9 @@ void EntityTracker::tick()
{ {
shared_ptr<ServerPlayer> player = movedPlayers[i]; shared_ptr<ServerPlayer> player = movedPlayers[i];
if(player->connection == NULL) continue; if(player->connection == NULL) continue;
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) for( auto& te : entities )
{ {
shared_ptr<TrackedEntity> te = *it; if ( te && te->e != player)
if (te->e != player)
{ {
te->updatePlayer(this, player); te->updatePlayer(this, player);
} }
@ -179,10 +181,10 @@ void EntityTracker::tick()
} }
// 4J Stu - We want to do this for dead players as they don't tick normally // 4J Stu - We want to do this for dead players as they don't tick normally
for(AUTO_VAR(it, level->players.begin()); it != level->players.end(); ++it) for (auto& it : level->players )
{ {
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(*it); shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(it);
if(!player->isAlive()) if( player && !player->isAlive())
{ {
player->flushEntitiesToRemove(); player->flushEntitiesToRemove();
} }
@ -191,7 +193,7 @@ void EntityTracker::tick()
void EntityTracker::broadcast(shared_ptr<Entity> e, shared_ptr<Packet> packet) void EntityTracker::broadcast(shared_ptr<Entity> e, shared_ptr<Packet> packet)
{ {
AUTO_VAR(it, entityMap.find( e->entityId )); auto it = entityMap.find(e->entityId);
if( it != entityMap.end() ) if( it != entityMap.end() )
{ {
shared_ptr<TrackedEntity> te = it->second; shared_ptr<TrackedEntity> te = it->second;
@ -201,7 +203,7 @@ void EntityTracker::broadcast(shared_ptr<Entity> e, shared_ptr<Packet> packet)
void EntityTracker::broadcastAndSend(shared_ptr<Entity> e, shared_ptr<Packet> packet) void EntityTracker::broadcastAndSend(shared_ptr<Entity> e, shared_ptr<Packet> packet)
{ {
AUTO_VAR(it, entityMap.find( e->entityId )); auto it = entityMap.find(e->entityId);
if( it != entityMap.end() ) if( it != entityMap.end() )
{ {
shared_ptr<TrackedEntity> te = it->second; shared_ptr<TrackedEntity> te = it->second;
@ -211,18 +213,17 @@ void EntityTracker::broadcastAndSend(shared_ptr<Entity> e, shared_ptr<Packet> pa
void EntityTracker::clear(shared_ptr<ServerPlayer> serverPlayer) void EntityTracker::clear(shared_ptr<ServerPlayer> serverPlayer)
{ {
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ ) for ( auto& te : entities )
{ {
shared_ptr<TrackedEntity> te = *it; if ( te )
te->clear(serverPlayer); te->clear(serverPlayer);
} }
} }
void EntityTracker::playerLoadedChunk(shared_ptr<ServerPlayer> player, LevelChunk *chunk) void EntityTracker::playerLoadedChunk(shared_ptr<ServerPlayer> player, LevelChunk *chunk)
{ {
for (AUTO_VAR(it,entities.begin()); it != entities.end(); ++it) for ( auto& te : entities )
{ {
shared_ptr<TrackedEntity> te = *it;
if (te->e != player && te->e->xChunk == chunk->x && te->e->zChunk == chunk->z) if (te->e != player && te->e->xChunk == chunk->x && te->e->zChunk == chunk->z)
{ {
te->updatePlayer(this, player); te->updatePlayer(this, player);
@ -239,7 +240,7 @@ void EntityTracker::updateMaxRange()
shared_ptr<TrackedEntity> EntityTracker::getTracker(shared_ptr<Entity> e) shared_ptr<TrackedEntity> EntityTracker::getTracker(shared_ptr<Entity> e)
{ {
AUTO_VAR(it, entityMap.find(e->entityId)); auto it = entityMap.find(e->entityId);
if( it != entityMap.end() ) if( it != entityMap.end() )
{ {
return it->second; return it->second;

View file

@ -366,13 +366,12 @@ void Font::drawWordWrapInternal(const wstring& string, int x, int y, int w, int
vector<wstring>lines = stringSplit(string,L'\n'); vector<wstring>lines = stringSplit(string,L'\n');
if (lines.size() > 1) if (lines.size() > 1)
{ {
AUTO_VAR(itEnd, lines.end()); for ( auto& it : lines )
for (AUTO_VAR(it, lines.begin()); it != itEnd; it++)
{ {
// 4J Stu - Don't draw text that will be partially cutoff/overlap something it shouldn't // 4J Stu - Don't draw text that will be partially cutoff/overlap something it shouldn't
if( (y + this->wordWrapHeight(*it, w)) > h) break; if( (y + this->wordWrapHeight(it, w)) > h) break;
drawWordWrapInternal(*it, x, y, w, col, h); drawWordWrapInternal(it, x, y, w, col, h);
y += this->wordWrapHeight(*it, w); y += this->wordWrapHeight(it, w);
} }
return; return;
} }
@ -418,10 +417,9 @@ int Font::wordWrapHeight(const wstring& string, int w)
if (lines.size() > 1) if (lines.size() > 1)
{ {
int h = 0; int h = 0;
AUTO_VAR(itEnd, lines.end()); for ( auto& it : lines )
for (AUTO_VAR(it, lines.begin()); it != itEnd; it++)
{ {
h += this->wordWrapHeight(*it, w); h += this->wordWrapHeight(it, w);
} }
return h; return h;
} }

View file

@ -308,11 +308,9 @@ void GameRenderer::pick(float a)
vector<shared_ptr<Entity> > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap)); vector<shared_ptr<Entity> > *objects = mc->level->getEntities(mc->cameraTargetPlayer, mc->cameraTargetPlayer->bb->expand(b->x * (range), b->y * (range), b->z * (range))->grow(overlap, overlap, overlap));
double nearest = dist; double nearest = dist;
AUTO_VAR(itEnd, objects->end()); for (auto& e : *objects )
for (AUTO_VAR(it, objects->begin()); it != itEnd; it++)
{ {
shared_ptr<Entity> e = *it; //objects->at(i); if ( e == nullptr || !e->isPickable() ) continue;
if (!e->isPickable()) continue;
float rr = e->getPickRadius(); float rr = e->getPickRadius();
AABB *bb = e->bb->grow(rr, rr, rr); AABB *bb = e->bb->grow(rr, rr, rr);
@ -325,7 +323,7 @@ void GameRenderer::pick(float a)
nearest = 0; nearest = 0;
} }
} }
else if (p != NULL) else if (p != nullptr)
{ {
double dd = from->distanceTo(p->pos); double dd = from->distanceTo(p->pos);
if (e == mc->cameraTargetPlayer->riding != NULL) if (e == mc->cameraTargetPlayer->riding != NULL)

View file

@ -849,7 +849,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
glPushMatrix(); glPushMatrix();
if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0); if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0);
font->drawShadow(ClientConstants::VERSION_STRING + L" (" + minecraft->fpsString + L")", iSafezoneXHalf+2, 20, 0xffffff); font->drawShadow(ClientConstants::VERSION_STRING + L" (" + minecraft->fpsString + L")", iSafezoneXHalf+2, 20, 0xffffff);
font->drawShadow(L"Seed: " + _toString<__int64>(minecraft->level->getLevelData()->getSeed() ), iSafezoneXHalf+2, 32 + 00, 0xffffff); font->drawShadow(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed() ), iSafezoneXHalf+2, 32 + 00, 0xffffff);
font->drawShadow(minecraft->gatherStats1(), iSafezoneXHalf+2, 32 + 10, 0xffffff); font->drawShadow(minecraft->gatherStats1(), iSafezoneXHalf+2, 32 + 10, 0xffffff);
font->drawShadow(minecraft->gatherStats2(), iSafezoneXHalf+2, 32 + 20, 0xffffff); font->drawShadow(minecraft->gatherStats2(), iSafezoneXHalf+2, 32 + 20, 0xffffff);
font->drawShadow(minecraft->gatherStats3(), iSafezoneXHalf+2, 32 + 30, 0xffffff); font->drawShadow(minecraft->gatherStats3(), iSafezoneXHalf+2, 32 + 30, 0xffffff);
@ -871,7 +871,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
{ {
FEATURE_DATA *pFeatureData=app.m_vTerrainFeatures[i]; FEATURE_DATA *pFeatureData=app.m_vTerrainFeatures[i];
wstring itemInfo = L"[" + _toString<int>( pFeatureData->x*16 ) + L", " + _toString<int>( pFeatureData->z*16 ) + L"] "; wstring itemInfo = L"[" + std::to_wstring( pFeatureData->x*16 ) + L", " + std::to_wstring( pFeatureData->z*16 ) + L"] ";
wfeature[pFeatureData->eTerrainFeature] += itemInfo; wfeature[pFeatureData->eTerrainFeature] += itemInfo;
} }
@ -899,10 +899,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
double xBlockPos = floor(minecraft->player->x); double xBlockPos = floor(minecraft->player->x);
double yBlockPos = floor(minecraft->player->y); double yBlockPos = floor(minecraft->player->y);
double zBlockPos = floor(minecraft->player->z); double zBlockPos = floor(minecraft->player->z);
drawString(font, L"x: " + _toString<double>(minecraft->player->x) + L"/ Head: " + _toString<double>(xBlockPos) + L"/ Chunk: " + _toString<double>(minecraft->player->xChunk), iSafezoneXHalf+2, iYPos + 8 * 0, 0xe0e0e0); drawString(font, L"x: " + std::to_wstring(minecraft->player->x) + L"/ Head: " + std::to_wstring(static_cast<int>(xBlockPos)) + L"/ Chunk: " + std::to_wstring(minecraft->player->xChunk), iSafezoneXHalf+2, iYPos + 8 * 0, 0xe0e0e0);
drawString(font, L"y: " + _toString<double>(minecraft->player->y) + L"/ Head: " + _toString<double>(yBlockPos), iSafezoneXHalf+2, iYPos + 8 * 1, 0xe0e0e0); drawString(font, L"y: " + std::to_wstring(minecraft->player->y) + L"/ Head: " + std::to_wstring(static_cast<int>(yBlockPos)), iSafezoneXHalf+2, iYPos + 8 * 1, 0xe0e0e0);
drawString(font, L"z: " + _toString<double>(minecraft->player->z) + L"/ Head: " + _toString<double>(zBlockPos) + L"/ Chunk: " + _toString<double>(minecraft->player->zChunk), iSafezoneXHalf+2, iYPos + 8 * 2, 0xe0e0e0); drawString(font, L"z: " + std::to_wstring(minecraft->player->z) + L"/ Head: " + std::to_wstring(static_cast<int>(zBlockPos)) + L"/ Chunk: " + std::to_wstring(minecraft->player->zChunk), iSafezoneXHalf+2, iYPos + 8 * 2, 0xe0e0e0);
drawString(font, L"f: " + _toString<double>(Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3) + L"/ yRot: " + _toString<double>(minecraft->player->yRot), iSafezoneXHalf+2, iYPos + 8 * 3, 0xe0e0e0); drawString(font, L"f: " + std::to_wstring(Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) & 0x3) + L"/ yRot: " + std::to_wstring(minecraft->player->yRot), iSafezoneXHalf+2, iYPos + 8 * 3, 0xe0e0e0);
iYPos += 8*4; iYPos += 8*4;
int px = Mth::floor(minecraft->player->x); int px = Mth::floor(minecraft->player->x);
@ -914,7 +914,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
Biome *biome = chunkAt->getBiome(px & 15, pz & 15, minecraft->level->getBiomeSource()); Biome *biome = chunkAt->getBiome(px & 15, pz & 15, minecraft->level->getBiomeSource());
drawString( drawString(
font, font,
L"b: " + biome->m_name + L" (" + _toString<int>(biome->id) + L")", iSafezoneXHalf+2, iYPos, 0xe0e0e0); L"b: " + biome->m_name + L" (" + std::to_wstring(biome->id) + L")", iSafezoneXHalf+2, iYPos, 0xe0e0e0);
} }
glPopMatrix(); glPopMatrix();
@ -1248,10 +1248,9 @@ void Gui::tick()
// We don't show the guiMessages when a menu is up, so don't fade them out // We don't show the guiMessages when a menu is up, so don't fade them out
if(!ui.GetMenuDisplayed(iPad)) if(!ui.GetMenuDisplayed(iPad))
{ {
AUTO_VAR(itEnd, guiMessages[iPad].end()); for (auto& it : guiMessages[iPad])
for (AUTO_VAR(it, guiMessages[iPad].begin()); it != itEnd; it++)
{ {
(*it).ticks++; it.ticks++;
} }
} }
} }

View file

@ -37,10 +37,8 @@ void GuiParticles::render(float a)
#if 0 #if 0
mc->textures->bindTexture(L"/gui/particles.png"); mc->textures->bindTexture(L"/gui/particles.png");
AUTO_VAR(itEnd, particles.end()); for ( GuiParticle *gp : particles )
for (AUTO_VAR(it, particles.begin()); it != itEnd; it++)
{ {
GuiParticle *gp = *it; //particles[i];
int xx = (int) (gp->xo + (gp->x - gp->xo) * a - 4); int xx = (int) (gp->xo + (gp->x - gp->xo) * a - 4);
int yy = (int) (gp->yo + (gp->y - gp->yo) * a - 4); int yy = (int) (gp->yo + (gp->y - gp->yo) * a - 4);

View file

@ -83,7 +83,7 @@ ResourceLocation *HorseRenderer::getOrCreateLayeredTextureLocation(shared_ptr<En
{ {
wstring textureName = horse->getLayeredTextureHashName(); wstring textureName = horse->getLayeredTextureHashName();
AUTO_VAR(it, LAYERED_LOCATION_CACHE.find(textureName)); auto it = LAYERED_LOCATION_CACHE.find(textureName);
ResourceLocation *location; ResourceLocation *location;
if (it != LAYERED_LOCATION_CACHE.end()) if (it != LAYERED_LOCATION_CACHE.end())

View file

@ -53,7 +53,7 @@ ResourceLocation *HumanoidMobRenderer::getArmorLocation(ArmorItem *armorItem, in
case 4: case 4:
break; break;
}; };
wstring path = wstring(L"armor/" + MATERIAL_NAMES[armorItem->modelIndex]).append(L"_").append(_toString<int>(layer == 2 ? 2 : 1)).append((overlay ? L"_b" :L"")).append(L".png"); wstring path = wstring(L"armor/" + MATERIAL_NAMES[armorItem->modelIndex]).append(L"_").append(std::to_wstring(layer == 2 ? 2 : 1)).append((overlay ? L"_b" :L"")).append(L".png");
std::map<wstring, ResourceLocation>::iterator it = ARMOR_LOCATION_CACHE.find(path); std::map<wstring, ResourceLocation>::iterator it = ARMOR_LOCATION_CACHE.find(path);

View file

@ -607,11 +607,11 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shar
int count = item->count; int count = item->count;
if(count > 64) if(count > 64)
{ {
amount = _toString<int>(64) + L"+"; amount = L"64+";
} }
else else
{ {
amount = _toString<int>(item->count); amount = std::to_wstring(item->count);
} }
} }
MemSect(0); MemSect(0);

View file

@ -533,19 +533,14 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
vector<shared_ptr<Entity> > entities = level[playerIndex]->getAllEntities(); vector<shared_ptr<Entity> > entities = level[playerIndex]->getAllEntities();
totalEntities = (int)entities.size(); totalEntities = (int)entities.size();
AUTO_VAR(itEndGE, level[playerIndex]->globalEntities.end()); for (auto& entity : level[playerIndex]->globalEntities)
for (AUTO_VAR(it, level[playerIndex]->globalEntities.begin()); it != itEndGE; it++)
{ {
shared_ptr<Entity> entity = *it; //level->globalEntities[i];
renderedEntities++; renderedEntities++;
if (entity->shouldRender(cam)) EntityRenderDispatcher::instance->render(entity, a); if (entity->shouldRender(cam)) EntityRenderDispatcher::instance->render(entity, a);
} }
AUTO_VAR(itEndEnts, entities.end()); for (auto& entity : entities)
for (AUTO_VAR(it, entities.begin()); it != itEndEnts; it++)
{ {
shared_ptr<Entity> entity = *it; //entities[i];
bool shouldRender = (entity->shouldRender(cam) && (entity->noCulling || culler->isVisible(entity->bb))); bool shouldRender = (entity->shouldRender(cam) && (entity->noCulling || culler->isVisible(entity->bb)));
// Render the mob if the mob's leash holder is within the culler // Render the mob if the mob's leash holder is within the culler
@ -580,24 +575,24 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
// 4J - have restructed this so that the tile entities are stored within a hashmap by chunk/dimension index. The index // 4J - have restructed this so that the tile entities are stored within a hashmap by chunk/dimension index. The index
// is calculated in the same way as the global flags. // is calculated in the same way as the global flags.
EnterCriticalSection(&m_csRenderableTileEntities); EnterCriticalSection(&m_csRenderableTileEntities);
for (AUTO_VAR(it, renderableTileEntities.begin()); it != renderableTileEntities.end(); it++) for (auto & it : renderableTileEntities)
{ {
int idx = it->first; int idx = it.first;
// Don't render if it isn't in the same dimension as this player // Don't render if it isn't in the same dimension as this player
if( !isGlobalIndexInSameDimension(idx, level[playerIndex]) ) continue; if( !isGlobalIndexInSameDimension(idx, level[playerIndex]) ) continue;
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); it2++) for( auto& it2 : it.second)
{ {
TileEntityRenderDispatcher::instance->render(*it2, a); TileEntityRenderDispatcher::instance->render(it2, a);
} }
} }
// Now consider if any of these renderable tile entities have been flagged for removal, and if so, remove // Now consider if any of these renderable tile entities have been flagged for removal, and if so, remove
for (AUTO_VAR(it, renderableTileEntities.begin()); it != renderableTileEntities.end();) for (auto it = renderableTileEntities.begin(); it != renderableTileEntities.end();)
{ {
int idx = it->first; int idx = it->first;
for( AUTO_VAR(it2, it->second.begin()); it2 != it->second.end(); ) for (auto it2 = it->second.begin(); it2 != it->second.end();)
{ {
// If it has been flagged for removal, remove // If it has been flagged for removal, remove
if((*it2)->shouldRemoveForRender()) if((*it2)->shouldRemoveForRender())
@ -628,12 +623,12 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
wstring LevelRenderer::gatherStats1() wstring LevelRenderer::gatherStats1()
{ {
return L"C: " + _toString<int>(renderedChunks) + L"/" + _toString<int>(totalChunks) + L". F: " + _toString<int>(offscreenChunks) + L", O: " + _toString<int>(occludedChunks) + L", E: " + _toString<int>(emptyChunks); return L"C: " + std::to_wstring(renderedChunks) + L"/" + std::to_wstring(totalChunks) + L". F: " + std::to_wstring(offscreenChunks) + L", O: " + std::to_wstring(occludedChunks) + L", E: " + std::to_wstring(emptyChunks);
} }
wstring LevelRenderer::gatherStats2() wstring LevelRenderer::gatherStats2()
{ {
return L"E: " + _toString<int>(renderedEntities) + L"/" + _toString<int>(totalEntities) + L". B: " + _toString<int>(culledEntities) + L", I: " + _toString<int>((totalEntities - culledEntities) - renderedEntities); return L"E: " + std::to_wstring(renderedEntities) + L"/" + std::to_wstring(totalEntities) + L". B: " + std::to_wstring(culledEntities) + L", I: " + std::to_wstring((totalEntities - culledEntities) - renderedEntities);
} }
void LevelRenderer::resortChunks(int xc, int yc, int zc) void LevelRenderer::resortChunks(int xc, int yc, int zc)
@ -888,11 +883,8 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
renderLists[l].clear(); renderLists[l].clear();
} }
AUTO_VAR(itEnd, _renderChunks.end()); for ( Chunk *chunk : _renderChunks )
for (AUTO_VAR(it, _renderChunks.begin()); it != itEnd; it++)
{ {
Chunk *chunk = *it; //_renderChunks[i];
int list = -1; int list = -1;
for (int l = 0; l < lists; l++) for (int l = 0; l < lists; l++)
{ {
@ -932,7 +924,7 @@ void LevelRenderer::tick()
if ((ticks % SharedConstants::TICKS_PER_SECOND) == 0) if ((ticks % SharedConstants::TICKS_PER_SECOND) == 0)
{ {
AUTO_VAR(it , destroyingBlocks.begin()); auto it = destroyingBlocks.begin();
while (it != destroyingBlocks.end()) while (it != destroyingBlocks.end())
{ {
BlockDestructionProgress *block = it->second; BlockDestructionProgress *block = it->second;
@ -1970,7 +1962,7 @@ bool LevelRenderer::updateDirtyChunks()
// Is this chunk nearer than our nearest? // Is this chunk nearer than our nearest?
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
bool isNearer = nearestClipChunks.empty(); bool isNearer = nearestClipChunks.empty();
AUTO_VAR(itNearest, nearestClipChunks.begin()); auto itNearest = nearestClipChunks.begin();
for(; itNearest != nearestClipChunks.end(); ++itNearest) for(; itNearest != nearestClipChunks.end(); ++itNearest)
{ {
isNearer = distSqWeighted < itNearest->second; isNearer = distSqWeighted < itNearest->second;
@ -2002,7 +1994,7 @@ bool LevelRenderer::updateDirtyChunks()
nearChunk = pClipChunk; nearChunk = pClipChunk;
minDistSq = distSqWeighted; minDistSq = distSqWeighted;
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
nearestClipChunks.insert(itNearest, std::pair<ClipChunk *, int>(nearChunk, minDistSq) ); nearestClipChunks.insert(itNearest, std::make_pair(nearChunk, minDistSq) );
if(nearestClipChunks.size() > maxNearestChunks) if(nearestClipChunks.size() > maxNearestChunks)
{ {
nearestClipChunks.pop_back(); nearestClipChunks.pop_back();
@ -2044,9 +2036,9 @@ bool LevelRenderer::updateDirtyChunks()
if(!nearestClipChunks.empty()) if(!nearestClipChunks.empty())
{ {
int index = 0; int index = 0;
for(AUTO_VAR(it, nearestClipChunks.begin()); it != nearestClipChunks.end(); ++it) for(auto & it : nearestClipChunks)
{ {
chunk = it->first->chunk; chunk = it.first->chunk;
// If this chunk is very near, then move the renderer into a deferred mode. This won't commit any command buffers // If this chunk is very near, then move the renderer into a deferred mode. This won't commit any command buffers
// for rendering until we call CBuffDeferredModeEnd(), allowing us to group any near changes into an atomic unit. This // for rendering until we call CBuffDeferredModeEnd(), allowing us to group any near changes into an atomic unit. This
// is essential so we don't temporarily create any holes in the environment whilst updating one chunk and not the neighbours. // is essential so we don't temporarily create any holes in the environment whilst updating one chunk and not the neighbours.
@ -2233,7 +2225,7 @@ void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr<Player> pla
#endif #endif
t->noColor(); t->noColor();
AUTO_VAR(it, destroyingBlocks.begin()); auto it = destroyingBlocks.begin();
while (it != destroyingBlocks.end()) while (it != destroyingBlocks.end())
{ {
BlockDestructionProgress *block = it->second; BlockDestructionProgress *block = it->second;
@ -3284,7 +3276,7 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres
{ {
if (progress < 0 || progress >= 10) if (progress < 0 || progress >= 10)
{ {
AUTO_VAR(it, destroyingBlocks.find(id)); auto it = destroyingBlocks.find(id);
if(it != destroyingBlocks.end()) if(it != destroyingBlocks.end())
{ {
delete it->second; delete it->second;
@ -3296,7 +3288,7 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres
{ {
BlockDestructionProgress *entry = NULL; BlockDestructionProgress *entry = NULL;
AUTO_VAR(it, destroyingBlocks.find(id)); auto it = destroyingBlocks.find(id);
if(it != destroyingBlocks.end()) entry = it->second; if(it != destroyingBlocks.end()) entry = it->second;
if (entry == NULL || entry->getX() != x || entry->getY() != y || entry->getZ() != z) if (entry == NULL || entry->getX() != x || entry->getY() != y || entry->getZ() != z)
@ -3316,7 +3308,7 @@ void LevelRenderer::registerTextures(IconRegister *iconRegister)
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
breakingTextures[i] = iconRegister->registerIcon(L"destroy_" + _toString(i) ); breakingTextures[i] = iconRegister->registerIcon(L"destroy_" + std::to_wstring(i) );
} }
} }
@ -3509,13 +3501,11 @@ unsigned char LevelRenderer::decGlobalChunkRefCount(int x, int y, int z, Level *
void LevelRenderer::fullyFlagRenderableTileEntitiesToBeRemoved() void LevelRenderer::fullyFlagRenderableTileEntitiesToBeRemoved()
{ {
EnterCriticalSection(&m_csRenderableTileEntities); EnterCriticalSection(&m_csRenderableTileEntities);
AUTO_VAR(itChunkEnd, renderableTileEntities.end()); for (auto& it : renderableTileEntities)
for (AUTO_VAR(it, renderableTileEntities.begin()); it != itChunkEnd; it++)
{ {
AUTO_VAR(itTEEnd, it->second.end()); for(auto& it2 : it.second)
for( AUTO_VAR(it2, it->second.begin()); it2 != itTEEnd; it2++ )
{ {
(*it2)->upgradeRenderRemoveStage(); it2->upgradeRenderRemoveStage();
} }
} }
LeaveCriticalSection(&m_csRenderableTileEntities); LeaveCriticalSection(&m_csRenderableTileEntities);
@ -3529,9 +3519,9 @@ LevelRenderer::DestroyedTileManager::RecentTile::RecentTile(int x, int y, int z,
LevelRenderer::DestroyedTileManager::RecentTile::~RecentTile() LevelRenderer::DestroyedTileManager::RecentTile::~RecentTile()
{ {
for( AUTO_VAR(it, boxes.begin()); it!= boxes.end(); it++ ) for(auto& it : boxes)
{ {
delete *it; delete it;
} }
} }

View file

@ -23,7 +23,7 @@ int MemoryTracker::genTextures()
void MemoryTracker::releaseLists(int id) void MemoryTracker::releaseLists(int id)
{ {
AUTO_VAR(it, GL_LIST_IDS.find(id)); auto it = GL_LIST_IDS.find(id);
if( it != GL_LIST_IDS.end() ) if( it != GL_LIST_IDS.end() )
{ {
glDeleteLists(id, it->second); glDeleteLists(id, it->second);
@ -43,9 +43,9 @@ void MemoryTracker::releaseTextures()
void MemoryTracker::release() void MemoryTracker::release()
{ {
//for (Map.Entry<Integer, Integer> entry : GL_LIST_IDS.entrySet()) //for (Map.Entry<Integer, Integer> entry : GL_LIST_IDS.entrySet())
for(AUTO_VAR(it, GL_LIST_IDS.begin()); it != GL_LIST_IDS.end(); ++it) for(auto& it : GL_LIST_IDS)
{ {
glDeleteLists(it->first, it->second); glDeleteLists(it.first, it.second);
} }
GL_LIST_IDS.clear(); GL_LIST_IDS.clear();

View file

@ -747,6 +747,9 @@
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput> <ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
@ -778,6 +781,9 @@
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput> <ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64EC'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64EC'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
@ -793,6 +799,9 @@
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput> <ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ARM64EC'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ARM64EC'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
@ -909,6 +918,9 @@
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile> <OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput> <ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|ARM64EC'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|ARM64EC'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
@ -927,6 +939,9 @@
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile> <OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput> <ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|ARM64EC'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|ARM64EC'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
@ -945,6 +960,9 @@
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile> <OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput> <ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseForArt|ARM64EC'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseForArt|ARM64EC'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
@ -963,6 +981,9 @@
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile> <OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput> <ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|ARM64EC'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|ARM64EC'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>

View file

@ -741,7 +741,7 @@ void Minecraft::run()
while (System::currentTimeMillis() >= lastTime + 1000) while (System::currentTimeMillis() >= lastTime + 1000)
{ {
fpsString = _toString<int>(frames) + L" fps, " + _toString<int>(Chunk::updates) + L" chunk updates"; fpsString = std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates";
Chunk::updates = 0; Chunk::updates = 0;
lastTime += 1000; lastTime += 1000;
frames = 0; frames = 0;
@ -2034,7 +2034,7 @@ void Minecraft::run_middle()
while (System::nanoTime() >= lastTime + 1000000000) while (System::nanoTime() >= lastTime + 1000000000)
{ {
MemSect(31); MemSect(31);
fpsString = _toString<int>(frames) + L" fps, " + _toString<int>(Chunk::updates) + L" chunk updates"; fpsString = std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates";
MemSect(0); MemSect(0);
Chunk::updates = 0; Chunk::updates = 0;
lastTime += 1000000000; lastTime += 1000000000;
@ -4432,7 +4432,7 @@ void Minecraft::prepareLevel(int title)
wstring Minecraft::gatherStats1() wstring Minecraft::gatherStats1()
{ {
//return levelRenderer->gatherStats1(); //return levelRenderer->gatherStats1();
return L"Time to autosave: " + _toString<unsigned int>( app.SecondsToAutosave() ) + L"s"; return L"Time to autosave: " + std::to_wstring( app.SecondsToAutosave() ) + L"s";
} }
wstring Minecraft::gatherStats2() wstring Minecraft::gatherStats2()
@ -4610,7 +4610,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const
} }
else else
{ {
minecraft->user = new User(L"Player" + _toString<int>(System::currentTimeMillis() % 1000), L""); minecraft->user = new User(L"Player" + std::to_wstring(System::currentTimeMillis() % 1000), L"");
} }
} }
//else //else
@ -4705,7 +4705,7 @@ void Minecraft::main()
// 4J-PB - Can't call this for the first 5 seconds of a game - MS rule // 4J-PB - Can't call this for the first 5 seconds of a game - MS rule
//if (ProfileManager.IsFullVersion()) //if (ProfileManager.IsFullVersion())
{ {
name = L"Player" + _toString<__int64>(System::currentTimeMillis() % 1000); name = L"Player" + std::to_wstring(System::currentTimeMillis() % 1000);
sessionId = L"-"; sessionId = L"-";
/* 4J - TODO - get a session ID from somewhere? /* 4J - TODO - get a session ID from somewhere?
if (args.length > 0) name = args[0]; if (args.length > 0) name = args[0];
@ -5106,7 +5106,7 @@ void Minecraft::tickAllConnections()
bool Minecraft::addPendingClientTextureRequest(const wstring &textureName) bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
{ {
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
if( it == m_pendingTextureRequests.end() ) if( it == m_pendingTextureRequests.end() )
{ {
m_pendingTextureRequests.push_back(textureName); m_pendingTextureRequests.push_back(textureName);
@ -5117,7 +5117,7 @@ bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
void Minecraft::handleClientTextureReceived(const wstring &textureName) void Minecraft::handleClientTextureReceived(const wstring &textureName)
{ {
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
if( it != m_pendingTextureRequests.end() ) if( it != m_pendingTextureRequests.end() )
{ {
m_pendingTextureRequests.erase(it); m_pendingTextureRequests.erase(it);

View file

@ -211,7 +211,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
{ {
wstring playerNames = (playerList != NULL) ? playerList->getPlayerNames() : L""; wstring playerNames = (playerList != NULL) ? playerList->getPlayerNames() : L"";
if (playerNames.empty()) playerNames = L"(none)"; if (playerNames.empty()) playerNames = L"(none)";
server->info(L"Players (" + _toString((playerList != NULL) ? playerList->getPlayerCount() : 0) + L"): " + playerNames); server->info(L"Players (" + std::to_wstring((playerList != NULL) ? playerList->getPlayerCount() : 0) + L"): " + playerNames);
return true; return true;
} }
@ -273,7 +273,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
} }
} }
server->info(L"Added " + _toString(delta) + L" ticks."); server->info(L"Added " + std::to_wstring(delta) + L" ticks.");
return true; return true;
} }
@ -304,7 +304,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
} }
SetAllLevelTimes(server, targetTime); SetAllLevelTimes(server, targetTime);
server->info(L"Time set to " + _toString(targetTime) + L"."); server->info(L"Time set to " + std::to_wstring(targetTime) + L".");
return true; return true;
} }
@ -427,7 +427,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
} }
if (itemId <= 0 || Item::items[itemId] == NULL) if (itemId <= 0 || Item::items[itemId] == NULL)
{ {
server->warn(L"Unknown item id: " + _toString(itemId)); server->warn(L"Unknown item id: " + std::to_wstring(itemId));
return false; return false;
} }
if (amount <= 0) if (amount <= 0)
@ -442,7 +442,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
{ {
drop->throwTime = 0; drop->throwTime = 0;
} }
server->info(L"Gave item " + _toString(itemId) + L" x" + _toString(amount) + L" to " + player->getName() + L"."); server->info(L"Gave item " + std::to_wstring(itemId) + L" x" + std::to_wstring(amount) + L" to " + player->getName() + L".");
return true; return true;
} }
@ -484,7 +484,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
Enchantment *enchantment = Enchantment::enchantments[enchantmentId]; Enchantment *enchantment = Enchantment::enchantments[enchantmentId];
if (enchantment == NULL) if (enchantment == NULL)
{ {
server->warn(L"Unknown enchantment id: " + _toString(enchantmentId)); server->warn(L"Unknown enchantment id: " + std::to_wstring(enchantmentId));
return false; return false;
} }
if (!enchantment->canEnchant(selectedItem)) if (!enchantment->canEnchant(selectedItem))
@ -514,7 +514,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
} }
selectedItem->enchant(enchantment, enchantmentLevel); selectedItem->enchant(enchantment, enchantmentLevel);
server->info(L"Enchanted " + player->getName() + L"'s held item with " + _toString(enchantmentId) + L" " + _toString(enchantmentLevel) + L"."); server->info(L"Enchanted " + player->getName() + L"'s held item with " + std::to_wstring(enchantmentId) + L" " + std::to_wstring(enchantmentLevel) + L".");
return true; return true;
} }
@ -2064,21 +2064,21 @@ void MinecraftServer::broadcastStopSavingPacket()
void MinecraftServer::tick() void MinecraftServer::tick()
{ {
vector<wstring> toRemove; vector<wstring> toRemove;
for (AUTO_VAR(it, ironTimers.begin()); it != ironTimers.end(); it++ ) for ( auto& it : ironTimers )
{ {
int t = it->second; int t = it.second;
if (t > 0) if (t > 0)
{ {
ironTimers[it->first] = t - 1; ironTimers[it.first] = t - 1;
} }
else else
{ {
toRemove.push_back(it->first); toRemove.push_back(it.first);
} }
} }
for (unsigned int i = 0; i < toRemove.size(); i++) for (const auto& i : toRemove)
{ {
ironTimers.erase(toRemove[i]); ironTimers.erase(i);
} }
AABB::resetPool(); AABB::resetPool();
@ -2316,8 +2316,8 @@ void MinecraftServer::chunkPacketManagement_PreTick()
do do
{ {
int longestTime = 0; int longestTime = 0;
AUTO_VAR(playerConnectionBest,playersOrig.begin()); auto playerConnectionBest = playersOrig.begin();
for( AUTO_VAR(it, playersOrig.begin()); it != playersOrig.end(); it++) for( auto it = playersOrig.begin(); it != playersOrig.end(); it++)
{ {
int thisTime = 0; int thisTime = 0;
INetworkPlayer *np = (*it)->getNetworkPlayer(); INetworkPlayer *np = (*it)->getNetworkPlayer();

View file

@ -144,18 +144,14 @@ void Minimap::render(shared_ptr<Player> player, Textures *textures, shared_ptr<M
textures->bind(textures->loadTexture(TN_MISC_MAPICONS));//L"/misc/mapicons.png")); textures->bind(textures->loadTexture(TN_MISC_MAPICONS));//L"/misc/mapicons.png"));
AUTO_VAR(itEnd, data->decorations.end());
#ifdef _LARGE_WORLDS #ifdef _LARGE_WORLDS
vector<MapItemSavedData::MapDecoration *> m_edgeIcons; vector<MapItemSavedData::MapDecoration *> m_edgeIcons;
#endif #endif
// 4J-PB - stack the map icons // 4J-PB - stack the map icons
float fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting float fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting
for( vector<MapItemSavedData::MapDecoration *>::iterator it = data->decorations.begin(); it != itEnd; it++ ) for( MapItemSavedData::MapDecoration *dec : data->decorations )
{ {
MapItemSavedData::MapDecoration *dec = *it;
if(!dec->visible) continue; if(!dec->visible) continue;
char imgIndex = dec->img; char imgIndex = dec->img;
@ -200,10 +196,8 @@ void Minimap::render(shared_ptr<Player> player, Textures *textures, shared_ptr<M
textures->bind(textures->loadTexture(TN_MISC_ADDITIONALMAPICONS)); textures->bind(textures->loadTexture(TN_MISC_ADDITIONALMAPICONS));
fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting fIconZ=-0.04f;// 4J - moved to -0.04 (was -0.02) to stop z fighting
for( AUTO_VAR(it,m_edgeIcons.begin()); it != m_edgeIcons.end(); it++ ) for( MapItemSavedData::MapDecoration *dec : m_edgeIcons )
{ {
MapItemSavedData::MapDecoration *dec = *it;
char imgIndex = dec->img; char imgIndex = dec->img;
imgIndex -= 16; imgIndex -= 16;

View file

@ -71,14 +71,10 @@ void ModelPart::addChild(ModelPart *child)
ModelPart * ModelPart::retrieveChild(SKIN_BOX *pBox) ModelPart * ModelPart::retrieveChild(SKIN_BOX *pBox)
{ {
for(AUTO_VAR(it, children.begin()); it != children.end(); ++it) for( ModelPart *child : children )
{ {
ModelPart *child=*it; for ( const Cube *pCube : child->cubes )
for(AUTO_VAR(itcube, child->cubes.begin()); itcube != child->cubes.end(); ++itcube)
{ {
Cube *pCube=*itcube;
if((pCube->x0==pBox->fX) && if((pCube->x0==pBox->fX) &&
(pCube->y0==pBox->fY) && (pCube->y0==pBox->fY) &&
(pCube->z0==pBox->fZ) && (pCube->z0==pBox->fZ) &&

View file

@ -105,9 +105,11 @@ MultiPlayerChunkCache::~MultiPlayerChunkCache()
delete cache; delete cache;
delete hasData; delete hasData;
AUTO_VAR(itEnd, loadedChunkList.end()); for (auto& it : loadedChunkList)
for (AUTO_VAR(it, loadedChunkList.begin()); it != itEnd; it++) {
delete *it; if ( it )
delete it;
}
DeleteCriticalSection(&m_csLoadCreate); DeleteCriticalSection(&m_csLoadCreate);
} }
@ -294,7 +296,7 @@ wstring MultiPlayerChunkCache::gatherStats()
EnterCriticalSection(&m_csLoadCreate); EnterCriticalSection(&m_csLoadCreate);
int size = (int)loadedChunkList.size(); int size = (int)loadedChunkList.size();
LeaveCriticalSection(&m_csLoadCreate); LeaveCriticalSection(&m_csLoadCreate);
return L"MultiplayerChunkCache: " + _toString<int>(size); return L"MultiplayerChunkCache: " + std::to_wstring(size);
} }

View file

@ -131,9 +131,10 @@ void MultiPlayerLevel::tick()
PIXBeginNamedEvent(0,"Connection ticking"); PIXBeginNamedEvent(0,"Connection ticking");
// 4J HEG - Copy the connections vector to prevent crash when moving to Nether // 4J HEG - Copy the connections vector to prevent crash when moving to Nether
vector<ClientConnection *> connectionsTemp = connections; vector<ClientConnection *> connectionsTemp = connections;
for(AUTO_VAR(connection, connectionsTemp.begin()); connection < connectionsTemp.end(); ++connection ) for (auto connection : connectionsTemp )
{ {
(*connection)->tick(); if ( connection )
connection->tick();
} }
PIXEndNamedEvent(); PIXEndNamedEvent();
@ -383,10 +384,8 @@ void MultiPlayerLevel::tickTiles()
{ {
ChunkPos cp = chunksToPoll.get(i); ChunkPos cp = chunksToPoll.get(i);
#else #else
AUTO_VAR(itEndCtp, chunksToPoll.end()); for (ChunkPos cp : chunksToPoll)
for (AUTO_VAR(it, chunksToPoll.begin()); it != itEndCtp; it++)
{ {
ChunkPos cp = *it;
#endif #endif
int xo = cp.x * 16; int xo = cp.x * 16;
int zo = cp.z * 16; int zo = cp.z * 16;
@ -433,7 +432,7 @@ void MultiPlayerLevel::removeEntity(shared_ptr<Entity> e)
{ {
// 4J Stu - Add this remove from the reEntries collection to stop us continually removing and re-adding things, // 4J Stu - Add this remove from the reEntries collection to stop us continually removing and re-adding things,
// in particular the MultiPlayerLocalPlayer when they die // in particular the MultiPlayerLocalPlayer when they die
AUTO_VAR(it, reEntries.find(e)); auto it = reEntries.find(e);
if (it!=reEntries.end()) if (it!=reEntries.end())
{ {
reEntries.erase(it); reEntries.erase(it);
@ -446,7 +445,7 @@ void MultiPlayerLevel::removeEntity(shared_ptr<Entity> e)
void MultiPlayerLevel::entityAdded(shared_ptr<Entity> e) void MultiPlayerLevel::entityAdded(shared_ptr<Entity> e)
{ {
Level::entityAdded(e); Level::entityAdded(e);
AUTO_VAR(it, reEntries.find(e)); auto it = reEntries.find(e);
if (it!=reEntries.end()) if (it!=reEntries.end())
{ {
reEntries.erase(it); reEntries.erase(it);
@ -456,7 +455,7 @@ void MultiPlayerLevel::entityAdded(shared_ptr<Entity> e)
void MultiPlayerLevel::entityRemoved(shared_ptr<Entity> e) void MultiPlayerLevel::entityRemoved(shared_ptr<Entity> e)
{ {
Level::entityRemoved(e); Level::entityRemoved(e);
AUTO_VAR(it, forced.find(e)); auto it = forced.find(e);
if (it!=forced.end()) if (it!=forced.end())
{ {
reEntries.insert(e); reEntries.insert(e);
@ -482,7 +481,7 @@ void MultiPlayerLevel::putEntity(int id, shared_ptr<Entity> e)
shared_ptr<Entity> MultiPlayerLevel::getEntity(int id) shared_ptr<Entity> MultiPlayerLevel::getEntity(int id)
{ {
AUTO_VAR(it, entitiesById.find(id)); auto it = entitiesById.find(id);
if( it == entitiesById.end() ) return nullptr; if( it == entitiesById.end() ) return nullptr;
return it->second; return it->second;
} }
@ -490,7 +489,7 @@ shared_ptr<Entity> MultiPlayerLevel::getEntity(int id)
shared_ptr<Entity> MultiPlayerLevel::removeEntity(int id) shared_ptr<Entity> MultiPlayerLevel::removeEntity(int id)
{ {
shared_ptr<Entity> e; shared_ptr<Entity> e;
AUTO_VAR(it, entitiesById.find(id)); auto it = entitiesById.find(id);
if( it != entitiesById.end() ) if( it != entitiesById.end() )
{ {
e = it->second; e = it->second;
@ -508,11 +507,11 @@ shared_ptr<Entity> MultiPlayerLevel::removeEntity(int id)
// This gets called when a chunk is unloaded, but we only do half an unload to remove entities slightly differently // This gets called when a chunk is unloaded, but we only do half an unload to remove entities slightly differently
void MultiPlayerLevel::removeEntities(vector<shared_ptr<Entity> > *list) void MultiPlayerLevel::removeEntities(vector<shared_ptr<Entity> > *list)
{ {
for(AUTO_VAR(it, list->begin()); it < list->end(); ++it) if ( list )
{ {
shared_ptr<Entity> e = *it; for (auto& e : *list )
{
AUTO_VAR(reIt, reEntries.find(e)); auto reIt = reEntries.find(e);
if (reIt!=reEntries.end()) if (reIt!=reEntries.end())
{ {
reEntries.erase(reIt); reEntries.erase(reIt);
@ -522,6 +521,7 @@ void MultiPlayerLevel::removeEntities(vector<shared_ptr<Entity> > *list)
} }
Level::removeEntities(list); Level::removeEntities(list);
} }
}
bool MultiPlayerLevel::setData(int x, int y, int z, int data, int updateFlags, bool forceUpdate/*=false*/) // 4J added forceUpdate) bool MultiPlayerLevel::setData(int x, int y, int z, int data, int updateFlags, bool forceUpdate/*=false*/) // 4J added forceUpdate)
{ {
@ -615,16 +615,18 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/)
{ {
if( sendDisconnect ) if( sendDisconnect )
{ {
for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it ) for (auto& it : connections )
{ {
(*it)->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); if ( it )
it->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
} }
} }
else else
{ {
for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it ) for (auto& it : connections )
{ {
(*it)->close(); if ( it )
it->close();
} }
} }
} }
@ -707,9 +709,8 @@ void MultiPlayerLevel::animateTickDoWork()
for( int i = 0; i < ticksPerChunk; i++ ) for( int i = 0; i < ticksPerChunk; i++ )
{ {
for( AUTO_VAR(it, chunksToAnimate.begin()); it != chunksToAnimate.end(); it++ ) for(int packed : chunksToAnimate)
{ {
int packed = *it;
int cx = ( packed << 8 ) >> 24; int cx = ( packed << 8 ) >> 24;
int cy = ( packed << 16 ) >> 24; int cy = ( packed << 16 ) >> 24;
int cz = ( packed << 24 ) >> 24; int cz = ( packed << 24 ) >> 24;
@ -809,12 +810,12 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals()
//entities.removeAll(entitiesToRemove); //entities.removeAll(entitiesToRemove);
EnterCriticalSection(&m_entitiesCS); EnterCriticalSection(&m_entitiesCS);
for( AUTO_VAR(it, entities.begin()); it != entities.end(); ) for (auto it = entities.begin(); it != entities.end();)
{ {
bool found = false; bool found = false;
for( AUTO_VAR(it2, entitiesToRemove.begin()); it2 != entitiesToRemove.end(); it2++ ) for(auto & it2 : entitiesToRemove)
{ {
if( (*it) == (*it2) ) if( (*it) == it2 )
{ {
found = true; found = true;
break; break;
@ -831,10 +832,10 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals()
} }
LeaveCriticalSection(&m_entitiesCS); LeaveCriticalSection(&m_entitiesCS);
AUTO_VAR(endIt, entitiesToRemove.end()); for (auto& e : entitiesToRemove)
for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++) {
if ( e )
{ {
shared_ptr<Entity> e = *it;
int xc = e->xChunk; int xc = e->xChunk;
int zc = e->zChunk; int zc = e->zChunk;
if (e->inChunk && hasChunk(xc, zc)) if (e->inChunk && hasChunk(xc, zc))
@ -842,18 +843,19 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals()
getChunk(xc, zc)->removeEntity(e); getChunk(xc, zc)->removeEntity(e);
} }
} }
}
// 4J Stu - Is there a reason do this in a separate loop? Thats what the Java does... // 4J Stu - Is there a reason do this in a separate loop? Thats what the Java does...
endIt = entitiesToRemove.end(); for (auto& it : entitiesToRemove)
for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++)
{ {
entityRemoved(*it); if ( it )
entityRemoved(it);
} }
entitiesToRemove.clear(); entitiesToRemove.clear();
//for (int i = 0; i < entities.size(); i++) //for (int i = 0; i < entities.size(); i++)
EnterCriticalSection(&m_entitiesCS); EnterCriticalSection(&m_entitiesCS);
vector<shared_ptr<Entity> >::iterator it = entities.begin(); auto it = entities.begin();
while( it != entities.end() ) while( it != entities.end() )
{ {
shared_ptr<Entity> e = *it;//entities.at(i); shared_ptr<Entity> e = *it;//entities.at(i);
@ -900,7 +902,7 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc
c->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) ); c->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
} }
AUTO_VAR(it, find( connections.begin(), connections.end(), c )); auto it = find(connections.begin(), connections.end(), c);
if( it != connections.end() ) if( it != connections.end() )
{ {
connections.erase( it ); connections.erase( it );
@ -910,9 +912,10 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc
void MultiPlayerLevel::tickAllConnections() void MultiPlayerLevel::tickAllConnections()
{ {
PIXBeginNamedEvent(0,"Connection ticking"); PIXBeginNamedEvent(0,"Connection ticking");
for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it ) for (auto& it : connections )
{ {
(*it)->tick(); if ( it )
it->tick();
} }
PIXEndNamedEvent(); PIXEndNamedEvent();
} }

View file

@ -328,7 +328,7 @@ wstring Options::getMessage(const Options::Option *item)
{ {
return caption + language->getElement(L"options.sensitivity.max"); return caption + language->getElement(L"options.sensitivity.max");
} }
return caption + _toString<int>((int) (progressValue * 200)) + L"%"; return caption + std::to_wstring(static_cast<int>(progressValue * 200)) + L"%";
} else if (item == Option::FOV) } else if (item == Option::FOV)
{ {
if (progressValue == 0) if (progressValue == 0)
@ -339,7 +339,7 @@ wstring Options::getMessage(const Options::Option *item)
{ {
return caption + language->getElement(L"options.fov.max"); return caption + language->getElement(L"options.fov.max");
} }
return caption + _toString<int>((int) (70 + progressValue * 40)); return caption + std::to_wstring(static_cast<int>(70.0f + progressValue * 40.0f));
} else if (item == Option::GAMMA) } else if (item == Option::GAMMA)
{ {
if (progressValue == 0) if (progressValue == 0)
@ -350,7 +350,7 @@ wstring Options::getMessage(const Options::Option *item)
{ {
return caption + language->getElement(L"options.gamma.max"); return caption + language->getElement(L"options.gamma.max");
} }
return caption + L"+" + _toString<int>((int) (progressValue * 100)) + L"%"; return caption + L"+" + std::to_wstring( static_cast<int>(progressValue * 100.0f)) + L"%";
} }
else else
{ {
@ -358,7 +358,7 @@ wstring Options::getMessage(const Options::Option *item)
{ {
return caption + language->getElement(L"options.off"); return caption + language->getElement(L"options.off");
} }
return caption + _toString<int>((int) (progressValue * 100)) + L"%"; return caption + std::to_wstring(static_cast<int>(progressValue * 100.0f)) + L"%";
} }
} else if (item->isBoolean()) } else if (item->isBoolean())
{ {
@ -486,29 +486,29 @@ void Options::save()
DataOutputStream dos = DataOutputStream(&fos); DataOutputStream dos = DataOutputStream(&fos);
// PrintWriter pw = new PrintWriter(new FileWriter(optionsFile)); // PrintWriter pw = new PrintWriter(new FileWriter(optionsFile));
dos.writeChars(L"music:" + _toString<float>(music) + L"\n"); dos.writeChars(L"music:" + std::to_wstring(music) + L"\n");
dos.writeChars(L"sound:" + _toString<float>(sound) + L"\n"); dos.writeChars(L"sound:" + std::to_wstring(sound) + L"\n");
dos.writeChars(L"invertYMouse:" + wstring(invertYMouse ? L"true" : L"false") + L"\n"); dos.writeChars(L"invertYMouse:" + wstring(invertYMouse ? L"true" : L"false") + L"\n");
dos.writeChars(L"mouseSensitivity:" + _toString<float>(sensitivity)); dos.writeChars(L"mouseSensitivity:" + std::to_wstring(sensitivity));
dos.writeChars(L"fov:" + _toString<float>(fov)); dos.writeChars(L"fov:" + std::to_wstring(fov));
dos.writeChars(L"gamma:" + _toString<float>(gamma)); dos.writeChars(L"gamma:" + std::to_wstring(gamma));
dos.writeChars(L"viewDistance:" + _toString<int>(viewDistance)); dos.writeChars(L"viewDistance:" + std::to_wstring(viewDistance));
dos.writeChars(L"guiScale:" + _toString<int>(guiScale)); dos.writeChars(L"guiScale:" + std::to_wstring(guiScale));
dos.writeChars(L"particles:" + _toString<int>(particles)); dos.writeChars(L"particles:" + std::to_wstring(particles));
dos.writeChars(L"bobView:" + wstring(bobView ? L"true" : L"false")); dos.writeChars(L"bobView:" + wstring(bobView ? L"true" : L"false"));
dos.writeChars(L"anaglyph3d:" + wstring(anaglyph3d ? L"true" : L"false")); dos.writeChars(L"anaglyph3d:" + wstring(anaglyph3d ? L"true" : L"false"));
dos.writeChars(L"advancedOpengl:" + wstring(advancedOpengl ? L"true" : L"false")); dos.writeChars(L"advancedOpengl:" + wstring(advancedOpengl ? L"true" : L"false"));
dos.writeChars(L"fpsLimit:" + _toString<int>(framerateLimit)); dos.writeChars(L"fpsLimit:" + std::to_wstring(framerateLimit));
dos.writeChars(L"difficulty:" + _toString<int>(difficulty)); dos.writeChars(L"difficulty:" + std::to_wstring(difficulty));
dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false")); dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false"));
dos.writeChars(L"ao:" + wstring(ambientOcclusion ? L"true" : L"false")); dos.writeChars(ambientOcclusion ? L"ao:true" : L"ao:false");
dos.writeChars(L"clouds:" + _toString<bool>(renderClouds)); dos.writeChars(renderClouds ? L"clouds:true" : L"clouds:false");
dos.writeChars(L"skin:" + skin); dos.writeChars(L"skin:" + skin);
dos.writeChars(L"lastServer:" + lastMpIp); dos.writeChars(L"lastServer:" + lastMpIp);
for (int i = 0; i < keyMappings_length; i++) for (int i = 0; i < keyMappings_length; i++)
{ {
dos.writeChars(L"key_" + keyMappings[i]->name + L":" + _toString<int>(keyMappings[i]->key)); dos.writeChars(L"key_" + keyMappings[i]->name + L":" + std::to_wstring(keyMappings[i]->key));
} }
dos.close(); dos.close();

View file

@ -1588,7 +1588,7 @@ void SQRNetworkManager_Orbis::GetInviteDataAndProcess(sce::Toolkit::NP::MessageA
// and there's a period when starting up the host game where it doesn't accurately know the memberId for its own local players // and there's a period when starting up the host game where it doesn't accurately know the memberId for its own local players
void SQRNetworkManager_Orbis::FindOrCreateNonNetworkPlayer(int slot, int playerType, SceNpMatching2RoomMemberId memberId, int localPlayerIdx, int smallId) void SQRNetworkManager_Orbis::FindOrCreateNonNetworkPlayer(int slot, int playerType, SceNpMatching2RoomMemberId memberId, int localPlayerIdx, int smallId)
{ {
for(AUTO_VAR(it, m_vecTempPlayers.begin()); it != m_vecTempPlayers.end(); it++ ) for (auto it = m_vecTempPlayers.begin(); it != m_vecTempPlayers.end(); it++)
{ {
if( ((*it)->m_type == playerType ) && ( (*it)->m_localPlayerIdx == localPlayerIdx ) ) if( ((*it)->m_type == playerType ) && ( (*it)->m_localPlayerIdx == localPlayerIdx ) )
{ {
@ -1759,7 +1759,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/)
} }
// Clear up any non-network players that are no longer required - this would be a good point to notify of players leaving when we support that // Clear up any non-network players that are no longer required - this would be a good point to notify of players leaving when we support that
// FindOrCreateNonNetworkPlayer will have pulled any players that we Do need out of m_vecTempPlayers, so the ones that are remaining are no longer in the game // FindOrCreateNonNetworkPlayer will have pulled any players that we Do need out of m_vecTempPlayers, so the ones that are remaining are no longer in the game
for(AUTO_VAR(it, m_vecTempPlayers.begin()); it != m_vecTempPlayers.end(); it++ ) for (auto it = m_vecTempPlayers.begin(); it != m_vecTempPlayers.end(); it++)
{ {
if( m_listener ) if( m_listener )
{ {
@ -1964,7 +1964,7 @@ void SQRNetworkManager_Orbis::RemoveNetworkPlayers( int mask )
{ {
assert( !m_isHosting ); assert( !m_isHosting );
for(AUTO_VAR(it, m_RudpCtxToPlayerMap.begin()); it != m_RudpCtxToPlayerMap.end(); ) for (auto it = m_RudpCtxToPlayerMap.begin(); it != m_RudpCtxToPlayerMap.end();)
{ {
SQRNetworkPlayer *player = it->second; SQRNetworkPlayer *player = it->second;
if( (player->m_roomMemberId == m_localMemberId ) && ( ( 1 << player->m_localPlayerIdx ) & mask ) ) if( (player->m_roomMemberId == m_localMemberId ) && ( ( 1 << player->m_localPlayerIdx ) & mask ) )
@ -2606,7 +2606,7 @@ bool SQRNetworkManager_Orbis::CreateRudpConnections(SceNpMatching2RoomId roomId,
SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx) SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx)
{ {
AUTO_VAR(it,m_RudpCtxToPlayerMap.find(rudpCtx)); auto it = m_RudpCtxToPlayerMap.find(rudpCtx);
if( it != m_RudpCtxToPlayerMap.end() ) if( it != m_RudpCtxToPlayerMap.end() )
{ {
return it->second; return it->second;
@ -2618,7 +2618,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx)
SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx) SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx)
{ {
for(AUTO_VAR(it, m_RudpCtxToPlayerMap.begin()); it != m_RudpCtxToPlayerMap.end(); it++ ) for (auto it = m_RudpCtxToPlayerMap.begin(); it != m_RudpCtxToPlayerMap.end(); it++)
{ {
if( (it->second->m_roomMemberId == roomMember ) && ( it->second->m_localPlayerIdx == localIdx ) ) if( (it->second->m_roomMemberId == roomMember ) && ( it->second->m_localPlayerIdx == localIdx ) )
{ {

View file

@ -170,7 +170,3 @@ typedef LPVOID LPSECURITY_ATTRIBUTES;
#define __in_ecount(a) #define __in_ecount(a)
#define __in_bcount(a) #define __in_bcount(a)
#ifndef AUTO_VAR
#define AUTO_VAR(_var, _val) auto _var = _val
#endif

Some files were not shown because too many files have changed in this diff Show more