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
294 changed files with 5067 additions and 5773 deletions
+18
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
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
+2 -7
View File
@@ -53,11 +53,8 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
Slot *hoveredSlot = NULL;
AUTO_VAR(itEnd, menu->slots->end());
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
for ( Slot *slot : *menu->slots )
{
Slot *slot = *it; //menu->slots->at(i);
renderSlot(slot);
if (isHovering(slot, xm, ym))
@@ -150,10 +147,8 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
Slot *AbstractContainerScreen::findSlot(int x, int y)
{
AUTO_VAR(itEnd, menu->slots->end());
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
for (Slot* slot : menu->slots )
{
Slot *slot = *it; //menu->slots->at(i);
if (isHovering(slot, x, y)) return slot;
}
return NULL;
+3 -8
View File
@@ -262,11 +262,9 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
glDisable(GL_TEXTURE_2D);
AUTO_VAR(itEnd, Achievements::achievements->end());
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
for ( Achievement *ach : *Achievements::achievements )
{
Achievement *ach = *it; //Achievements::achievements->at(i);
if (ach->requires == NULL) continue;
if ( ach == nullptr || ach->requires == nullptr) continue;
int x1 = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll + 11 + xBigMap;
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_COLOR_MATERIAL);
itEnd = Achievements::achievements->end();
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
for ( Achievement *ach : *Achievements::achievements )
{
Achievement *ach = *it; //Achievements::achievements->at(i);
int x = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll;
int y = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll;
+3 -6
View File
@@ -78,11 +78,8 @@ vector<wstring> *ArchiveFile::getFileList()
{
vector<wstring> *out = new vector<wstring>();
for ( AUTO_VAR(it, m_index.begin());
it != m_index.end();
it++ )
out->push_back( it->first );
for ( const auto& it : m_index )
out->push_back( it.first );
return out;
}
@@ -100,7 +97,7 @@ int ArchiveFile::getFileSize(const wstring &filename)
byteArray ArchiveFile::getFile(const wstring &filename)
{
byteArray out;
AUTO_VAR(it,m_index.find(filename));
auto it = m_index.find(filename);
if(it == m_index.end())
{
+2 -2
View File
@@ -149,7 +149,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
wstring mipMapPath = L"";
if( l != 0 )
{
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
mipMapPath = L"MipMapLevel" + std::to_wstring(l+1);
}
if( filenameHasExtension )
{
@@ -207,7 +207,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam
wstring mipMapPath = L"";
if( l != 0 )
{
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
mipMapPath = L"MipMapLevel" + std::to_wstring(l+1);
}
if( filenameHasExtension )
{
+21 -22
View File
@@ -484,7 +484,6 @@ void Chunk::rebuild()
PIXEndNamedEvent();
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
// 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)
@@ -493,25 +492,25 @@ void Chunk::rebuild()
EnterCriticalSection(globalRenderableTileEntities_cs);
if( renderableTileEntities.size() )
{
AUTO_VAR(it, globalRenderableTileEntities->find(key));
if( it != globalRenderableTileEntities->end() )
auto it = globalRenderableTileEntities->find(key);
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 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
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
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] ));
if( it2 == it->second.end() )
auto it2 = find(it->second.begin(), it->second.end(), it3);
if( it2 == it->second.end() )
{
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
(*globalRenderableTileEntities)[key].push_back(it3);
}
else
{
@@ -531,12 +530,12 @@ void Chunk::rebuild()
else
{
// 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));
if( it != globalRenderableTileEntities->end() )
auto it = globalRenderableTileEntities->find(key);
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());
AUTO_VAR(endIt, oldTileEntities.end());
auto endIt = oldTileEntities.end();
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
{
newTileEntities.erase(*it);
@@ -576,7 +575,7 @@ void Chunk::rebuild()
// 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++ )
{
oldTileEntities.erase(*it);
@@ -814,14 +813,14 @@ void Chunk::rebuild_SPU()
EnterCriticalSection(globalRenderableTileEntities_cs);
if( renderableTileEntities.size() )
{
AUTO_VAR(it, globalRenderableTileEntities->find(key));
auto it = globalRenderableTileEntities->find(key);
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 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
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);
}
@@ -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
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() )
{
(*globalRenderableTileEntities)[key].push_back(renderableTileEntities[i]);
@@ -852,10 +851,10 @@ void Chunk::rebuild_SPU()
else
{
// 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() )
{
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);
}
@@ -879,7 +878,7 @@ void Chunk::rebuild_SPU()
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++ )
{
newTileEntities.erase(*it);
@@ -896,7 +895,7 @@ void Chunk::rebuild_SPU()
// 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++ )
{
oldTileEntities.erase(*it);
+20 -25
View File
@@ -627,15 +627,12 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
}
vector<shared_ptr<Entity> > *subEntities = e->getSubEntities();
if (subEntities != NULL)
if (subEntities)
{
int offs = packet->id - e->entityId;
//for (int i = 0; i < subEntities.length; i++)
for(AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); ++it)
{
(*it)->entityId += offs;
//subEntities[i].entityId += offs;
//System.out.println(subEntities[i].entityId);
for ( auto it : *subEntities )
{
it->entityId += offs;
}
}
@@ -2345,14 +2342,12 @@ void ClientConnection::handleAddMob(shared_ptr<AddMobPacket> packet)
mob->xRotp = packet->xRot;
vector<shared_ptr<Entity> > *subEntities = mob->getSubEntities();
if (subEntities != NULL)
if (subEntities)
{
int offs = packet->id - mob->entityId;
//for (int i = 0; i < subEntities.length; i++)
for(AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); ++it)
{
//subEntities[i].entityId += offs;
(*it)->entityId += offs;
for (auto& it : *subEntities )
{
it->entityId += offs;
}
}
@@ -3897,26 +3892,26 @@ void ClientConnection::handleUpdateAttributes(shared_ptr<UpdateAttributesPacket>
BaseAttributeMap *attributes = (dynamic_pointer_cast<LivingEntity>(entity))->getAttributes();
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());
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
instance = attributes->registerAttribute(new RangedAttribute(attribute->getId(), 0, Double::MIN_NORMAL, Double::MAX_VALUE));
}
instance->setBaseValue(attribute->getBase());
instance->removeModifiers();
instance->setBaseValue(attribute->getBase());
instance->removeModifiers();
unordered_set<AttributeModifier *> *modifiers = attribute->getModifiers();
unordered_set<AttributeModifier *> *modifiers = attribute->getModifiers();
for (AUTO_VAR(it2,modifiers->begin()); it2 != modifiers->end(); ++it2)
{
AttributeModifier* modifier = *it2;
instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation() ) );
if ( modifiers )
{
for ( AttributeModifier* modifier : *modifiers )
{
instance->addModifier(new AttributeModifier(modifier->getId(), modifier->getAmount(), modifier->getOperation()));
}
}
}
}
}
@@ -42,7 +42,7 @@ void ConsoleSoundEngine::tick()
return;
}
for(AUTO_VAR(it,scheduledSounds.begin()); it != scheduledSounds.end();)
for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();)
{
SoundEngine::ScheduledSound *next = *it;
next->delay--;
@@ -355,7 +355,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
wstring colourId = dis.readUTF();
int colourValue = dis.readInt();
setColour(colourId, colourValue);
AUTO_VAR(it,s_colourNamesMap.find(colourId));
auto it = s_colourNamesMap.find(colourId); // ?
}
bais.reset();
@@ -363,7 +363,7 @@ void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
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())
{
m_colourValues[(int)it->second] = value;
+57 -88
View File
@@ -1475,9 +1475,8 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_Gamertags);
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);
}
}
@@ -5641,7 +5640,7 @@ bool CMinecraftApp::isXuidNotch(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() )
{
MOJANG_DATA *pMojangData=MojangData[xuid];
@@ -5659,7 +5658,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD
EnterCriticalSection(&csMemFilesLock);
// check it's not already in
PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_Files.find(wName));
auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end())
{
#ifndef _CONTENT_PACKAGE
@@ -5704,7 +5703,7 @@ void CMinecraftApp::RemoveMemoryTextureFile(const wstring &wName)
{
EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName));
auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end())
{
#ifndef _CONTENT_PACKAGE
@@ -5730,7 +5729,7 @@ bool CMinecraftApp::DefaultCapeExists()
bool val = false;
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;
LeaveCriticalSection(&csMemFilesLock);
@@ -5742,7 +5741,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName)
bool val = false;
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;
LeaveCriticalSection(&csMemFilesLock);
@@ -5752,7 +5751,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const wstring &wName)
void CMinecraftApp::GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes)
{
EnterCriticalSection(&csMemFilesLock);
AUTO_VAR(it, m_MEM_Files.find(wName));
auto it = m_MEM_Files.find(wName);
if(it != m_MEM_Files.end())
{
PMEMDATA pData = (*it).second;
@@ -5767,7 +5766,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes)
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
auto it = m_MEM_TPD.find(iConfig);
if(it == m_MEM_TPD.end())
{
pData = (PMEMDATA)new BYTE[sizeof(MEMDATA)];
@@ -5787,7 +5786,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig)
EnterCriticalSection(&csMemTPDLock);
// check it's not already in
PMEMDATA pData=NULL;
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end())
{
pData=m_MEM_TPD[iConfig];
@@ -5844,7 +5843,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
bool val = false;
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;
LeaveCriticalSection(&csMemTPDLock);
@@ -5854,7 +5853,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig)
void CMinecraftApp::GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes)
{
EnterCriticalSection(&csMemTPDLock);
AUTO_VAR(it, m_MEM_TPD.find(iConfig));
auto it = m_MEM_TPD.find(iConfig);
if(it != m_MEM_TPD.end())
{
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
wstring wsTemp=wchUppercaseProductID;
AUTO_VAR(it, DLCInfo_Full.find(wsTemp));
auto it = DLCInfo_Full.find(wsTemp);
if( it == DLCInfo_Full.end() )
{
// Not found
@@ -7097,7 +7096,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
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() )
{
return false;
@@ -7110,7 +7109,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLON
}
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() )
{
*ppchKeyID=NULL;
@@ -7128,7 +7127,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName)
if(DLCInfo.size()>0)
{
AUTO_VAR(it, DLCInfo.find(tempString));
auto it = DLCInfo.find(tempString);
if( it == DLCInfo.end() )
{
@@ -7185,7 +7184,7 @@ char *CMinecraftApp::GetDLCInfoTextures(int iIndex)
#elif defined _XBOX_ONE
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() )
{
return false;
@@ -7198,7 +7197,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring
}
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() )
{
return false;
@@ -7243,7 +7242,7 @@ wstring CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex)
#else
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() )
{
return false;
@@ -7256,15 +7255,15 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLON
}
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() )
{
*pullVal=(ULONGLONG)0;
*pullVal=0ULL;
return false;
}
else
{
*pullVal=(ULONGLONG)it->second;
*pullVal=it->second;
return true;
}
}
@@ -7273,7 +7272,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial)
//DLC_INFO *pDLCInfo=NULL;
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() )
{
@@ -7330,7 +7329,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID)
wstring wsTemp = pwchProductID;
if(DLCInfo_Full.size()>0)
{
AUTO_VAR(it, DLCInfo_Full.find(wsTemp));
auto it = DLCInfo_Full.find(wsTemp);
if( it == DLCInfo_Full.end() )
{
@@ -7370,7 +7369,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full)
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() )
{
@@ -7570,9 +7569,8 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size());
PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]);
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));
}
@@ -7590,9 +7588,8 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps
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
PlayerUID bannedPlayerUID = pData->wchPlayerUID;
if(IsEqualXUID (bannedPlayerUID,xuid) && (strcmp(pData->pszLevelName,pszLevelName)==0))
@@ -7613,7 +7610,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha
//bool bRes;
// 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;
@@ -8321,10 +8318,8 @@ unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, __int64 see
void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,int x,int z)
{
// 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;
}
@@ -8338,10 +8333,8 @@ void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType,
_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;
}
@@ -8350,10 +8343,8 @@ _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x,int z)
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)
{
*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
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])
{
// already got this in the list
@@ -8543,7 +8532,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
bool bPromoted=false;
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for ( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
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
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)
{
bAlreadyInQueue=true;
@@ -8664,10 +8651,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
if(!bPresent) // retrieve it from TMSPP
{
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)
{
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
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)
{
bAlreadyInQueue=true;
@@ -8767,10 +8750,8 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool
bool CMinecraftApp::CheckTMSDLCCanStop()
{
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)
{
LeaveCriticalSection(&csTMSPPDownloadQueue);
@@ -8796,10 +8777,8 @@ bool CMinecraftApp::RetrieveNextDLCContent()
}
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)
{
LeaveCriticalSection(&csDLCDownloadQueue);
@@ -8808,10 +8787,8 @@ bool CMinecraftApp::RetrieveNextDLCContent()
}
// 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)
{
#ifdef _DEBUG
@@ -8853,9 +8830,8 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto
// find the right one in the vector
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)
char szFile[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;
EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
@@ -8970,7 +8945,7 @@ bool CMinecraftApp::RetrieveNextTMSPPContent()
}
// 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;
@@ -9074,11 +9049,10 @@ void CMinecraftApp::ClearAndResetDLCDownloadQueue()
int iPosition=0;
EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_DLCDownloadQueue.begin()); it != m_DLCDownloadQueue.end(); ++it)
for( DLCRequest *pCurrent : m_DLCDownloadQueue )
{
DLCRequest *pCurrent = *it;
delete pCurrent;
if ( pCurrent )
delete pCurrent;
iPosition++;
}
m_DLCDownloadQueue.clear();
@@ -9100,11 +9074,10 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved()
{
int iPosition=0;
EnterCriticalSection(&csTMSPPDownloadQueue);
for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != m_TMSPPDownloadQueue.end(); ++it)
for ( TMSPPRequest *pCurrent : m_TMSPPDownloadQueue )
{
TMSPPRequest *pCurrent = *it;
delete pCurrent;
if ( pCurrent )
delete pCurrent;
iPosition++;
}
m_TMSPPDownloadQueue.clear();
@@ -9118,10 +9091,8 @@ int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, in
// find the right one in the vector
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
if(pCurrent->dwType==dwType)
{
@@ -9151,10 +9122,8 @@ bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType)
// If there's already a retrieve in progress, quit
// we may have re-ordered the list, so need to check every item
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))
{
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);
// 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)
{
ModelPart *pModelPart=pModel->AddOrRetrievePart(*it);
ModelPart *pModelPart=pModel->AddOrRetrievePart(it);
pvModelPart->push_back(pModelPart);
}
}
m_AdditionalModelParts.insert( std::pair<DWORD, vector<ModelPart *> *>(dwSkinID, pvModelPart) );
m_AdditionalSkinBoxes.insert( std::pair<DWORD, vector<SKIN_BOX *> *>(dwSkinID, pvSkinBoxA) );
m_AdditionalModelParts.emplace(dwSkinID, pvModelPart);
m_AdditionalSkinBoxes.emplace(dwSkinID, pvSkinBoxA);
LeaveCriticalSection( &csAdditionalSkinBoxes );
LeaveCriticalSection( &csAdditionalModelParts );
@@ -9232,7 +9201,7 @@ vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID)
vector<ModelPart *> *pvModelParts=NULL;
if(m_AdditionalModelParts.size()>0)
{
AUTO_VAR(it, m_AdditionalModelParts.find(dwSkinID));
auto it = m_AdditionalModelParts.find(dwSkinID);
if(it!=m_AdditionalModelParts.end())
{
pvModelParts = (*it).second;
@@ -9249,7 +9218,7 @@ vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID)
vector<SKIN_BOX *> *pvSkinBoxes=NULL;
if(m_AdditionalSkinBoxes.size()>0)
{
AUTO_VAR(it,m_AdditionalSkinBoxes.find(dwSkinID));
auto it = m_AdditionalSkinBoxes.find(dwSkinID);
if(it!=m_AdditionalSkinBoxes.end())
{
pvSkinBoxes = (*it).second;
@@ -9267,7 +9236,7 @@ unsigned int CMinecraftApp::GetAnimOverrideBitmask(DWORD dwSkinID)
if(m_AnimOverrides.size()>0)
{
AUTO_VAR(it, m_AnimOverrides.find(dwSkinID));
auto it = m_AnimOverrides.find(dwSkinID);
if(it!=m_AnimOverrides.end())
{
uiAnimOverrideBitmask = (*it).second;
@@ -9285,7 +9254,7 @@ void CMinecraftApp::SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOve
if(m_AnimOverrides.size()>0)
{
AUTO_VAR(it, m_AnimOverrides.find(dwSkinID));
auto it = m_AnimOverrides.find(dwSkinID);
if(it!=m_AnimOverrides.end())
{
LeaveCriticalSection( &csAnimOverrideBitmask );
+1 -1
View File
@@ -178,7 +178,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength)
{
//EAudioParameterType paramType = e_AudioParamType_Invalid;
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
auto it = parameterMapping.find(pParams->dwType);
if(it != parameterMapping.end() )
{
+21 -38
View File
@@ -32,10 +32,10 @@ DLCManager::DLCManager()
DLCManager::~DLCManager()
{
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for ( DLCPack *pack : m_packs )
{
DLCPack *pack = *it;
delete pack;
if ( pack )
delete pack;
}
}
@@ -60,10 +60,9 @@ DWORD DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/)
DWORD packCount = 0;
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->getDLCItemsCount(type) > 0 )
if( pack && pack->getDLCItemsCount(type) > 0 )
{
++packCount;
}
@@ -85,7 +84,7 @@ void DLCManager::removePack(DLCPack *pack)
{
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);
delete pack;
}
@@ -93,10 +92,10 @@ void DLCManager::removePack(DLCPack *pack)
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;
delete pack;
if ( pack )
delete pack;
}
m_packs.clear();
@@ -104,23 +103,19 @@ void DLCManager::removeAllPacks(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
pack->UpdateLanguage();
}
}
DLCPack *DLCManager::getPack(const wstring &name)
{
DLCPack *pack = NULL;
//DWORD currentIndex = 0;
DLCPack *currentPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack * currentPack : m_packs )
{
currentPack = *it;
wstring wsName=currentPack->getName();
if(wsName.compare(name) == 0)
@@ -136,11 +131,8 @@ DLCPack *DLCManager::getPack(const wstring &name)
DLCPack *DLCManager::getPackFromProductID(const wstring &productID)
{
DLCPack *pack = NULL;
//DWORD currentIndex = 0;
DLCPack *currentPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *currentPack : m_packs )
{
currentPack = *it;
wstring wsName=currentPack->getPurchaseOfferId();
if(wsName.compare(productID) == 0)
@@ -159,10 +151,8 @@ DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/)
if( type != e_DLCType_All )
{
DWORD currentIndex = 0;
DLCPack *currentPack = NULL;
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
for( DLCPack *currentPack : m_packs )
{
currentPack = *it;
if(currentPack->getDLCItemsCount(type)>0)
{
if(currentIndex == index)
@@ -200,9 +190,8 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
if( type != e_DLCType_All )
{
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 == pack)
@@ -218,9 +207,8 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D
else
{
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)
{
found = true;
@@ -238,9 +226,8 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
DWORD foundIndex = 0;
found = false;
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->doesPackContainSkin(path))
@@ -258,9 +245,8 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found)
DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
{
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->doesPackContainSkin(path))
@@ -276,9 +262,8 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path)
DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
{
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);
if(foundSkinfile!=NULL)
{
@@ -291,12 +276,10 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path)
DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
{
DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount;
DLCPack *pack = 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() )
{
++corruptDLCCount;
@@ -468,7 +451,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
{
//DLCManager::EDLCParameterType paramType = DLCManager::e_DLCParamType_Invalid;
AUTO_VAR(it, parameterMapping.find( pParams->dwType ));
auto it = parameterMapping.find(pParams->dwType);
if(it != parameterMapping.end() )
{
@@ -658,7 +641,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp;
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() )
{
+11 -9
View File
@@ -54,16 +54,18 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas
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(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)
{
AUTO_VAR(it,m_parameters.find((int)type));
auto it = m_parameters.find((int)type);
if(it != m_parameters.end())
{
switch(type)
@@ -270,7 +272,7 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path
else
{
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();
if(!hasFile && m_parentPack )
{
@@ -316,7 +318,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path)
else
{
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())
{
@@ -368,9 +370,9 @@ DWORD DLCPack::getFileIndexAt(DLCManager::EDLCType type, const wstring &path, bo
DWORD foundIndex = 0;
found = false;
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;
found = true;
@@ -14,10 +14,10 @@ void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId);
dos->writeUTF( _toString( m_enchantmentId ) );
dos->writeUTF( std::to_wstring( m_enchantmentId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentLevel);
dos->writeUTF( _toString( m_enchantmentLevel ) );
dos->writeUTF( std::to_wstring( m_enchantmentLevel ) );
}
void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -17,26 +17,26 @@ void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
dos->writeUTF( _toString( m_itemId ) );
dos->writeUTF( std::to_wstring( m_itemId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
dos->writeUTF( _toString( m_quantity ) );
dos->writeUTF( std::to_wstring( m_quantity ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
dos->writeUTF( _toString( m_auxValue ) );
dos->writeUTF( std::to_wstring( m_auxValue ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
dos->writeUTF( _toString( m_dataTag ) );
dos->writeUTF( std::to_wstring( m_dataTag ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot);
dos->writeUTF( _toString( m_slot ) );
dos->writeUTF( std::to_wstring( m_slot ) );
}
void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{
GameRuleDefinition::getChildren( children );
for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++)
children->push_back( *it );
for ( const auto& it : m_enchantments )
children->push_back( it );
}
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -99,13 +99,13 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container,
bool added = false;
if(Item::items[m_itemId] != NULL)
{
int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
int quantity = std::min<int>(m_quantity, Item::items[m_itemId]->getMaxStackSize());
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
newItem->set4JData(m_dataTag);
for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)
for( auto& it : m_enchantments )
{
(*it)->enchantItem(newItem);
it->enchantItem(newItem);
}
if(m_slot >= 0 && m_slot < container->getContainerSize() )
@@ -37,19 +37,19 @@ void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT n
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename);
dos->writeUTF(m_schematicName);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_location->x));
dos->writeUTF(std::to_wstring(m_location->x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_location->y));
dos->writeUTF(std::to_wstring(m_location->y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_location->z));
dos->writeUTF(std::to_wstring(m_location->z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot);
switch (m_rotation)
{
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(_toString( 0 )); break;
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(_toString( 90 )); break;
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(_toString( 180 )); break;
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(_toString( 270 )); break;
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(L"0"); break;
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(L"90"); break;
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(L"180"); break;
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(L"270"); break;
}
}
@@ -14,11 +14,11 @@ void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs)
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
dos->writeUTF(_toString(m_biomeId));
dos->writeUTF(std::to_wstring(m_biomeId));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
dos->writeUTF(_toString(m_tile));
dos->writeUTF(std::to_wstring(m_tile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId);
dos->writeUTF(_toString(m_topTile));
dos->writeUTF(std::to_wstring(m_topTile));
}
void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -22,13 +22,13 @@ void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numA
GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
dos->writeUTF( _toString( m_itemId ) );
dos->writeUTF( std::to_wstring( m_itemId ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
dos->writeUTF( _toString( m_auxValue ) );
dos->writeUTF( std::to_wstring( m_auxValue ) );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
dos->writeUTF( _toString( m_quantity ) );
dos->writeUTF( std::to_wstring( m_quantity ) );
}
void CollectItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -108,9 +108,9 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
wstring xml = L"";
if(item != NULL)
{
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + _toString<int>(item->getAuxValue()) + L"\"";
if(item->get4JData() != 0) xml += L" dataTag=\"" + _toString<int>(item->get4JData()) + L"\"";
xml = L"<CollectItemRule itemId=\"" + std::to_wstring(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + std::to_wstring(item->getAuxValue()) + L"\"";
if(item->get4JData() != 0) xml += L" dataTag=\"" + std::to_wstring(item->get4JData()) + L"\"";
xml += L"/>\n";
}
return xml;
@@ -28,12 +28,12 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
{
int goal = 0;
int progress = 0;
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
for (auto& it : rule->m_parameters )
{
if(it->second.isPointer)
if(it.second.isPointer)
{
goal += it->second.gr->getGameRuleDefinition()->getGoal();
progress += it->second.gr->getGameRuleDefinition()->getProgress(it->second.gr);
goal += it.second.gr->getGameRuleDefinition()->getGoal();
progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr);
}
}
if(rule->getConnection() != NULL)
@@ -60,7 +60,7 @@ wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &desc
{
PacketData *values = (PacketData *)data;
wstring newDesc = description;
newDesc = replaceAll(newDesc,L"{*progress*}",_toString<int>(values->progress));
newDesc = replaceAll(newDesc,L"{*goal*}",_toString<int>(values->goal));
newDesc = replaceAll(newDesc,L"{*progress*}",std::to_wstring(values->progress));
newDesc = replaceAll(newDesc,L"{*goal*}",std::to_wstring(values->goal));
return newDesc;
}
@@ -11,17 +11,17 @@ CompoundGameRuleDefinition::CompoundGameRuleDefinition()
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
{
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
for (auto it : m_children )
{
delete (*it);
delete it;
}
}
void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{
GameRuleDefinition::getChildren(children);
for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++)
children->push_back(*it);
for (auto& it : m_children )
children->push_back(it);
}
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -57,17 +57,17 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
{
GameRule *newRule = NULL;
int i = 0;
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
for (auto& it : m_children )
{
newRule = new GameRule(*it, rule->getConnection() );
(*it)->populateGameRule(type,newRule);
newRule = new GameRule(it, rule->getConnection() );
it->populateGameRule(type,newRule);
GameRule::ValueType value;
value.gr = newRule;
value.isPointer = true;
// Somehow add the newRule to the current rule
rule->setParameter(L"rule" + _toString<int>(i),value);
rule->setParameter(L"rule" + std::to_wstring(i),value);
++i;
}
GameRuleDefinition::populateGameRule(type, rule);
@@ -76,14 +76,14 @@ void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesI
bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
{
bool statusChanged = false;
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
for (auto& it : rule->m_parameters )
{
if(it->second.isPointer)
if(it.second.isPointer)
{
bool changed = it->second.gr->getGameRuleDefinition()->onUseTile(it->second.gr,tileId,x,y,z);
bool changed = it.second.gr->getGameRuleDefinition()->onUseTile(it.second.gr,tileId,x,y,z);
if(!statusChanged && changed)
{
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
statusChanged = true;
}
}
@@ -94,14 +94,14 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
{
bool statusChanged = false;
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
for (auto& it : rule->m_parameters )
{
if(it->second.isPointer)
if(it.second.isPointer)
{
bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem(it->second.gr,item);
bool changed = it.second.gr->getGameRuleDefinition()->onCollectItem(it.second.gr,item);
if(!statusChanged && changed)
{
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
m_lastRuleStatusChanged = it.second.gr->getGameRuleDefinition();
statusChanged = true;
}
}
@@ -111,8 +111,8 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
{
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
for (auto it : m_children )
{
(*it)->postProcessPlayer(player);
it->postProcessPlayer(player);
}
}
@@ -19,8 +19,8 @@ void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *childre
{
GameRuleDefinition::getChildren(children);
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++)
children->push_back( *it );
for ( auto& action : m_actions )
children->push_back( action );
}
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -60,16 +60,16 @@ void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAt
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_x));
dos->writeUTF(std::to_wstring(m_x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_y));
dos->writeUTF(std::to_wstring(m_y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_z));
dos->writeUTF(std::to_wstring(m_z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
dos->writeUTF(_toString(orientation));
dos->writeUTF(std::to_wstring(orientation));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension);
dos->writeUTF(_toString(m_dimension));
dos->writeUTF(std::to_wstring(m_dimension));
}
void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -117,12 +117,11 @@ BoundingBox* ConsoleGenerateStructure::getBoundingBox()
// Find the max bounds
int maxX, maxY, maxZ;
maxX = maxY = maxZ = 1;
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
for( ConsoleGenerateStructureAction *action : m_actions )
{
ConsoleGenerateStructureAction *action = *it;
maxX = max(maxX,action->getEndX());
maxY = max(maxY,action->getEndY());
maxZ = max(maxZ,action->getEndZ());
maxX = std::max<int>(maxX,action->getEndX());
maxY = std::max<int>(maxY,action->getEndY());
maxZ = std::max<int>(maxZ,action->getEndZ());
}
boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ);
@@ -134,10 +133,8 @@ bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, Boundin
{
if(level->dimension->id != m_dimension) return false;
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
for( ConsoleGenerateStructureAction *action : m_actions )
{
ConsoleGenerateStructureAction *action = *it;
switch(action->getActionType())
{
case ConsoleGameRules::eGameRuleType_GenerateBox:
@@ -167,18 +167,18 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
tag->put(L"TileEntities", tileEntityTags);
for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); it++)
for ( auto& it : m_tileEntities )
{
CompoundTag *cTag = new CompoundTag();
(*it)->save(cTag);
it->save(cTag);
tileEntityTags->add(cTag);
}
ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>();
tag->put(L"Entities", entityTags);
for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end(); it++)
entityTags->add( (CompoundTag *)(*it).second->copy() );
for (auto& it : m_entities )
entityTags->add( (CompoundTag *)(it).second->copy() );
NbtIo::write(tag,dos);
delete tag;
@@ -186,15 +186,15 @@ void ConsoleSchematicFile::save_tags(DataOutputStream *dos)
__int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
int xStart = max(destinationBox->x0, (double)chunk->x*16);
int xEnd = min(destinationBox->x1, (double)((xStart>>4)<<4) + 16);
int xStart = static_cast<int>(std::fmax<double>(destinationBox->x0, (double)chunk->x*16));
int xEnd = static_cast<int>(std::fmin<double>(destinationBox->x1, (double)((xStart >> 4) << 4) + 16));
int yStart = destinationBox->y0;
int yEnd = destinationBox->y1;
if(yEnd > Level::maxBuildHeight) yEnd = Level::maxBuildHeight;
int zStart = max(destinationBox->z0, (double)chunk->z*16);
int zEnd = min(destinationBox->z1, (double)((zStart>>4)<<4) + 16);
int zStart = static_cast<int>(std::fmax<double>(destinationBox->z0, (double)chunk->z * 16));
int zEnd = static_cast<int>(std::fmin<double>(destinationBox->z1, (double)((zStart >> 4) << 4) + 16));
#ifdef _DEBUG
app.DebugPrintf("Range is (%d,%d,%d) to (%d,%d,%d)\n",xStart,yStart,zStart,xEnd-1,yEnd-1,zEnd-1);
@@ -431,10 +431,8 @@ void ConsoleSchematicFile::schematicCoordToChunkCoord(AABB *destinationBox, doub
void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot)
{
for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it)
for (auto& te : m_tileEntities )
{
shared_ptr<TileEntity> te = *it;
double targetX = te->x;
double targetY = te->y + destinationBox->y0;
double targetZ = te->z;
@@ -477,7 +475,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
teCopy->setChanged();
}
}
for(AUTO_VAR(it, m_entities.begin()); it != m_entities.end();)
for (auto it = m_entities.begin(); it != m_entities.end();)
{
Vec3 *source = it->first;
@@ -679,9 +677,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
for (int zc = zc0; zc <= zc1; zc++)
{
vector<shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it)
for( auto& te : *tileEntities )
{
shared_ptr<TileEntity> te = *it;
CompoundTag *teTag = new CompoundTag();
shared_ptr<TileEntity> teCopy = te->clone();
@@ -701,10 +698,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities");
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
for (auto& e : *entities )
{
shared_ptr<Entity> e = *it;
bool mobCanBeSaved = false;
if (bSaveMobs)
{
@@ -1012,12 +1007,15 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa
vector<shared_ptr<TileEntity> > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1)
{
vector<shared_ptr<TileEntity> > *result = new vector<shared_ptr<TileEntity> >;
for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it)
if ( result )
{
shared_ptr<TileEntity> te = it->second;
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
for ( auto& it : chunk->tileEntities )
{
result->push_back(te);
shared_ptr<TileEntity> te = it.second;
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
{
result->push_back(te);
}
}
}
return result;
@@ -9,11 +9,11 @@ GameRule::GameRule(GameRuleDefinition *definition, Connection *connection)
GameRule::~GameRule()
{
for(AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); ++it)
for(auto& it : m_parameters )
{
if(it->second.isPointer)
if(it.second.isPointer)
{
delete it->second.gr;
delete it.second.gr;
}
}
}
@@ -59,12 +59,12 @@ void GameRule::write(DataOutputStream *dos)
{
// Find required parameters.
dos->writeInt(m_parameters.size());
for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); it++)
for ( const auto& parameter : m_parameters )
{
wstring pName = (*it).first;
ValueType vType = (*it).second;
wstring pName = parameter.first;
ValueType vType = parameter.second;
dos->writeUTF( (*it).first );
dos->writeUTF( parameter.first );
dos->writeBoolean( vType.isPointer );
if (vType.isPointer)
@@ -25,8 +25,8 @@ void GameRuleDefinition::write(DataOutputStream *dos)
// Write children.
dos->writeInt( children->size() );
for (AUTO_VAR(it, children->begin()); it != children->end(); it++)
(*it)->write(dos);
for ( auto& it : *children )
it->write(dos);
}
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
@@ -40,7 +40,7 @@ void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttribut
dos->writeUTF(m_promptId);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
dos->writeUTF(_toString(m_4JDataValue));
dos->writeUTF(std::to_wstring(m_4JDataValue));
}
void GameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) {}
@@ -121,8 +121,8 @@ unordered_map<GameRuleDefinition *, int> *GameRuleDefinition::enumerateMap()
int i = 0;
vector<GameRuleDefinition *> *gRules = enumerate();
for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++)
out->insert( pair<GameRuleDefinition *, int>( *it, i++ ) );
for ( auto& it : *gRules )
out->emplace(it, i++);
return out;
}
@@ -344,11 +344,10 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
// Write schematic files.
unordered_map<wstring, ConsoleSchematicFile *> *files;
files = getLevelGenerationOptions()->getUnfinishedSchematicFiles();
dos->writeInt( files->size() );
for (AUTO_VAR(it, files->begin()); it != files->end(); it++)
for ( auto& it : *files )
{
wstring filename = it->first;
ConsoleSchematicFile *file = it->second;
const wstring& filename = it.first;
ConsoleSchematicFile *file = it.second;
ByteArrayOutputStream fileBaos;
DataOutputStream fileDos(&fileBaos);
@@ -519,7 +518,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT
{
int tagId = contentDis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
AUTO_VAR(it,tagIdMap.find(tagId));
auto it = tagIdMap.find(tagId);
if(it != tagIdMap.end()) tagVal = it->second;
GameRuleDefinition *rule = NULL;
@@ -595,7 +594,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector<wstring> *tagsAn
{
int tagId = dis->readInt();
ConsoleGameRules::EGameRuleType tagVal = ConsoleGameRules::eGameRuleType_Invalid;
AUTO_VAR(it,tagIdMap->find(tagId));
auto it = tagIdMap->find(tagId);
if(it != tagIdMap->end()) tagVal = it->second;
GameRuleDefinition *childRule = NULL;
@@ -640,18 +639,6 @@ void GameRuleManager::loadDefaultGameRules()
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
}
#ifndef _CONTENT_PACKAGE
// 4J Stu - Remove these just now
//File testRulesPath(L"GAME:\\GameRules");
//vector<File *> *packFiles = testRulesPath.listFiles();
//for(AUTO_VAR(it,packFiles->begin()); it != packFiles->end(); ++it)
//{
// loadGameRulesPack(*it);
//}
//delete packFiles;
#endif
#else // _XBOX
#ifdef _WINDOWS64
@@ -67,23 +67,24 @@ LevelGenerationOptions::~LevelGenerationOptions()
{
clearSchematics();
if(m_spawnPos != NULL) delete m_spawnPos;
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); ++it)
for (auto& it : m_schematicRules )
{
delete *it;
}
for(AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); ++it)
{
delete *it;
delete it;
}
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
for (auto& it : m_structureRules )
{
delete *it;
delete it;
}
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
for (auto& it : m_biomeOverrides )
{
delete *it;
delete it;
}
for (auto& it : m_features )
{
delete it;
}
if (m_stringTable)
@@ -100,16 +101,16 @@ void LevelGenerationOptions::writeAttributes(DataOutputStream *dos, UINT numAttr
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
dos->writeUTF(_toString(m_spawnPos->x));
dos->writeUTF(std::to_wstring(m_spawnPos->x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
dos->writeUTF(_toString(m_spawnPos->y));
dos->writeUTF(std::to_wstring(m_spawnPos->y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
dos->writeUTF(_toString(m_spawnPos->z));
dos->writeUTF(std::to_wstring(m_spawnPos->z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_seed);
dos->writeUTF(_toString(m_seed));
dos->writeUTF(std::to_wstring(m_seed));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_flatworld);
dos->writeUTF(_toString(m_useFlatWorld));
dos->writeUTF(std::to_wstring(m_useFlatWorld));
}
void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
@@ -117,18 +118,25 @@ void LevelGenerationOptions::getChildren(vector<GameRuleDefinition *> *children)
GameRuleDefinition::getChildren(children);
vector<ApplySchematicRuleDefinition *> used_schematics;
for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); it++)
if ( !(*it)->isComplete() )
used_schematics.push_back( *it );
for (auto& it : m_schematicRules )
if ( it && !it->isComplete() )
used_schematics.push_back( it );
for(AUTO_VAR(it, m_structureRules.begin()); it!=m_structureRules.end(); it++)
children->push_back( *it );
for(AUTO_VAR(it, used_schematics.begin()); it!=used_schematics.end(); it++)
children->push_back( *it );
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
children->push_back( *it );
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
children->push_back( *it );
for (auto& it : m_structureRules)
if ( it )
children->push_back( it );
for (auto& it : used_schematics)
if ( it )
children->push_back( it );
for (auto& it : m_biomeOverrides)
if ( it )
children->push_back( it );
for (auto& it : m_features)
if ( it )
children->push_back( it );
}
GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -249,19 +257,14 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk)
{
PIXBeginNamedEvent(0,"Processing schematics for chunk (%d,%d)", chunk->x, chunk->z);
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
{
ApplySchematicRuleDefinition *rule = *it;
for( ApplySchematicRuleDefinition *rule : m_schematicRules )
rule->processSchematic(chunkBox, chunk);
}
int cx = (chunk->x << 4);
int cz = (chunk->z << 4);
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
for ( ConsoleGenerateStructure *structureStart : m_structureRules )
{
ConsoleGenerateStructure *structureStart = *it;
if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15))
{
BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15);
@@ -276,9 +279,8 @@ void LevelGenerationOptions::processSchematicsLighting(LevelChunk *chunk)
{
PIXBeginNamedEvent(0,"Processing schematics (lighting) for chunk (%d,%d)", chunk->x, chunk->z);
AABB *chunkBox = AABB::newTemp(chunk->x*16,0,chunk->z*16,chunk->x*16 + 16,Level::maxBuildHeight,chunk->z*16 + 16);
for( AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
for ( ApplySchematicRuleDefinition *rule : m_schematicRules )
{
ApplySchematicRuleDefinition *rule = *it;
rule->processSchematicLighting(chunkBox, chunk);
}
PIXEndNamedEvent();
@@ -292,16 +294,14 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
// a) ores generally being below ground/sea level and b) tutorial world additions generally being above ground/sea level
if(!m_bHaveMinY)
{
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
for ( ApplySchematicRuleDefinition *rule : m_schematicRules )
{
ApplySchematicRuleDefinition *rule = *it;
int minY = rule->getMinY();
if(minY < m_minY) m_minY = minY;
}
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
for ( ConsoleGenerateStructure *structureStart : m_structureRules )
{
ConsoleGenerateStructure *structureStart = *it;
int minY = structureStart->getMinY();
if(minY < m_minY) m_minY = minY;
}
@@ -313,18 +313,16 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
if( y1 < m_minY ) return false;
bool intersects = false;
for(AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end();++it)
for( ApplySchematicRuleDefinition *rule : m_schematicRules )
{
ApplySchematicRuleDefinition *rule = *it;
intersects = rule->checkIntersects(x0,y0,z0,x1,y1,z1);
if(intersects) break;
}
if(!intersects)
{
for( AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); it++ )
for( ConsoleGenerateStructure *structureStart : m_structureRules )
{
ConsoleGenerateStructure *structureStart = *it;
intersects = structureStart->checkIntersects(x0,y0,z0,x1,y1,z1);
if(intersects) break;
}
@@ -335,9 +333,9 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
void LevelGenerationOptions::clearSchematics()
{
for(AUTO_VAR(it, m_schematics.begin()); it != m_schematics.end(); ++it)
for ( auto& it : m_schematics )
{
delete it->second;
delete it.second;
}
m_schematics.clear();
}
@@ -345,7 +343,7 @@ void LevelGenerationOptions::clearSchematics()
ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &filename, PBYTE pbData, DWORD dwLen)
{
// If we have already loaded this, just return
AUTO_VAR(it, m_schematics.find(filename));
auto it = m_schematics.find(filename);
if(it != m_schematics.end())
{
#ifndef _CONTENT_PACKAGE
@@ -370,7 +368,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
{
ConsoleSchematicFile *schematic = NULL;
// If we have already loaded this, just return
AUTO_VAR(it, m_schematics.find(filename));
auto it = m_schematics.find(filename);
if(it != m_schematics.end())
{
schematic = it->second;
@@ -381,7 +379,7 @@ ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &fi
void LevelGenerationOptions::releaseSchematicFile(const wstring &filename)
{
// 4J Stu - We don't want to delete them when done, but probably want to keep a set of active schematics for the current world
//AUTO_VAR(it, m_schematics.find(filename));
// auto it = m_schematics.find(filename);
//if(it != m_schematics.end())
//{
// ConsoleSchematicFile *schematic = it->second;
@@ -413,10 +411,9 @@ LPCWSTR LevelGenerationOptions::getString(const wstring &key)
void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile)
{
for(AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); ++it)
for ( BiomeOverride *bo : m_biomeOverrides )
{
BiomeOverride *bo = *it;
if(bo->isBiome(biomeId))
if ( bo && bo->isBiome(biomeId) )
{
bo->getTileValues(tile,topTile);
break;
@@ -428,9 +425,8 @@ bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFea
{
bool isFeature = false;
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
for( StartFeature *sf : m_features )
{
StartFeature *sf = *it;
if(sf->isFeatureChunk(chunkX, chunkZ, feature, orientation))
{
isFeature = true;
@@ -444,15 +440,15 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
{
// Clean schematic rules.
unordered_set<wstring> usedFiles = unordered_set<wstring>();
for (AUTO_VAR(it, m_schematicRules.begin()); it!=m_schematicRules.end(); it++)
if ( !(*it)->isComplete() )
usedFiles.insert( (*it)->getSchematicName() );
for ( auto& it : m_schematicRules )
if ( !it->isComplete() )
usedFiles.insert( it->getSchematicName() );
// Clean schematic files.
unordered_map<wstring, ConsoleSchematicFile *> *out
= new unordered_map<wstring, ConsoleSchematicFile *>();
for (AUTO_VAR(it, usedFiles.begin()); it!=usedFiles.end(); it++)
out->insert( pair<wstring, ConsoleSchematicFile *>(*it, getSchematicFile(*it)) );
for ( auto& it : usedFiles )
out->insert( pair<wstring, ConsoleSchematicFile *>(it, getSchematicFile(it)) );
return out;
}
@@ -619,11 +615,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD
void LevelGenerationOptions::reset_start()
{
for ( AUTO_VAR( it, m_schematicRules.begin());
it != m_schematicRules.end();
it++ )
for ( auto& it : m_schematicRules )
{
(*it)->reset();
if ( it )
it->reset();
}
}
@@ -11,7 +11,7 @@ LevelRuleset::LevelRuleset()
LevelRuleset::~LevelRuleset()
{
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it)
for (auto it = m_areas.begin(); it != m_areas.end(); ++it)
{
delete *it;
}
@@ -20,8 +20,8 @@ LevelRuleset::~LevelRuleset()
void LevelRuleset::getChildren(vector<GameRuleDefinition *> *children)
{
CompoundGameRuleDefinition::getChildren(children);
for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++)
children->push_back(*it);
for (const auto& area : m_areas)
children->push_back(area);
}
GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -58,12 +58,12 @@ LPCWSTR LevelRuleset::getString(const wstring &key)
AABB *LevelRuleset::getNamedArea(const wstring &areaName)
{
AABB *area = NULL;
for(AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it)
AABB *area = nullptr;
for(auto& it : m_areas)
{
if( (*it)->getName().compare(areaName) == 0 )
if( it->getName().compare(areaName) == 0 )
{
area = (*it)->getArea();
area = it->getArea();
break;
}
}
@@ -22,18 +22,18 @@ void NamedAreaRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAtt
dos->writeUTF(m_name);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
dos->writeUTF(_toString(m_area->x0));
dos->writeUTF(std::to_wstring(m_area->x0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
dos->writeUTF(_toString(m_area->y0));
dos->writeUTF(std::to_wstring(m_area->y0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
dos->writeUTF(_toString(m_area->z0));
dos->writeUTF(std::to_wstring(m_area->z0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
dos->writeUTF(_toString(m_area->x1));
dos->writeUTF(std::to_wstring(m_area->x1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
dos->writeUTF(_toString(m_area->y1));
dos->writeUTF(std::to_wstring(m_area->y1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
dos->writeUTF(_toString(m_area->z1));
dos->writeUTF(std::to_wstring(m_area->z1));
}
void NamedAreaRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -15,13 +15,13 @@ void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs)
GameRuleDefinition::writeAttributes(dos, numAttrs + 4);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX);
dos->writeUTF(_toString(m_chunkX));
dos->writeUTF(std::to_wstring(m_chunkX));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ);
dos->writeUTF(_toString(m_chunkZ));
dos->writeUTF(std::to_wstring(m_chunkZ));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature);
dos->writeUTF(_toString((int)m_feature));
dos->writeUTF(std::to_wstring((int)m_feature));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
dos->writeUTF(_toString(m_orientation));
dos->writeUTF(std::to_wstring(m_orientation));
}
void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -18,9 +18,9 @@ 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 );
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnX);
dos->writeUTF(_toString(m_spawnPos->x));
dos->writeUTF(std::to_wstring(m_spawnPos->x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnY);
dos->writeUTF(_toString(m_spawnPos->y));
dos->writeUTF(std::to_wstring(m_spawnPos->y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_spawnZ);
dos->writeUTF(_toString(m_spawnPos->z));
dos->writeUTF(std::to_wstring(m_spawnPos->z));
if(m_bUpdateYRot)
{
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_yRot);
dos->writeUTF(_toString(m_yRot));
dos->writeUTF(std::to_wstring(m_yRot));
}
if(m_bUpdateHealth)
{
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_food);
dos->writeUTF(_toString(m_health));
dos->writeUTF(std::to_wstring(m_health));
}
if(m_bUpdateFood)
{
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_health);
dos->writeUTF(_toString(m_food));
dos->writeUTF(std::to_wstring(m_food));
}
}
void UpdatePlayerRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
{
GameRuleDefinition::getChildren(children);
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++)
children->push_back(*it);
for(auto& item : m_items)
children->push_back(item);
}
GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -162,10 +162,8 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot);
for(AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it)
for(auto& addItem : m_items)
{
AddItemRuleDefinition *addItem = *it;
addItem->addItemToContainer(player->inventory, -1);
}
}
@@ -13,19 +13,19 @@ void UseTileRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttri
GameRuleDefinition::writeAttributes(dos, numAttributes + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
dos->writeUTF(_toString(m_tileId));
dos->writeUTF(std::to_wstring(m_tileId));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_useCoords);
dos->writeUTF(_toString(m_useCoords));
dos->writeUTF(std::to_wstring(m_useCoords));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_coordinates.x));
dos->writeUTF(std::to_wstring(m_coordinates.x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_coordinates.y));
dos->writeUTF(std::to_wstring(m_coordinates.y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_coordinates.z));
dos->writeUTF(std::to_wstring(m_coordinates.z));
}
void UseTileRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -14,25 +14,25 @@ void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
dos->writeUTF(_toString(m_x0));
dos->writeUTF(std::to_wstring(m_x0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
dos->writeUTF(_toString(m_y0));
dos->writeUTF(std::to_wstring(m_y0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
dos->writeUTF(_toString(m_z0));
dos->writeUTF(std::to_wstring(m_z0));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
dos->writeUTF(_toString(m_x1));
dos->writeUTF(std::to_wstring(m_x1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
dos->writeUTF(_toString(m_y1));
dos->writeUTF(std::to_wstring(m_y1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
dos->writeUTF(_toString(m_z1));
dos->writeUTF(std::to_wstring(m_z1));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile);
dos->writeUTF(_toString(m_edgeTile));
dos->writeUTF(std::to_wstring(m_edgeTile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile);
dos->writeUTF(_toString(m_fillTile));
dos->writeUTF(std::to_wstring(m_fillTile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir);
dos->writeUTF(_toString(m_skipAir));
dos->writeUTF(std::to_wstring(m_skipAir));
}
void XboxStructureActionGenerateBox::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -13,16 +13,16 @@ void XboxStructureActionPlaceBlock::writeAttributes(DataOutputStream *dos, UINT
ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 5);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
dos->writeUTF(_toString(m_x));
dos->writeUTF(std::to_wstring(m_x));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
dos->writeUTF(_toString(m_y));
dos->writeUTF(std::to_wstring(m_y));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
dos->writeUTF(_toString(m_z));
dos->writeUTF(std::to_wstring(m_z));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_data);
dos->writeUTF(_toString(m_data));
dos->writeUTF(std::to_wstring(m_data));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_block);
dos->writeUTF(_toString(m_tile));
dos->writeUTF(std::to_wstring(m_tile));
}
@@ -14,9 +14,9 @@ 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)
{
XboxStructureActionPlaceBlock::getChildren(children);
for(AUTO_VAR(it, m_items.begin()); it!=m_items.end(); it++)
children->push_back( *it );
for(auto & item : m_items)
children->push_back( item );
}
GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType)
@@ -86,8 +86,8 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
// Add items
int slotId = 0;
for(AUTO_VAR(it, m_items.begin()); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId )
{
for (auto it = m_items.begin(); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId)
{
AddItemRuleDefinition *addItem = *it;
addItem->addItemToContainer(container,slotId);
@@ -492,9 +492,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
do
{
// We need to keep ticking the connections for players that already logged in
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it)
{
(*it)->tick();
for (auto& it : createdConnections )
{
if ( it )
it->tick();
}
// 4J Stu - We were ticking this way too fast which could cause the connection to time out
@@ -522,8 +523,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
else
{
connection->close();
AUTO_VAR(it, find( createdConnections.begin(), createdConnections.end(), connection ));
if(it != createdConnections.end() ) createdConnections.erase( it );
auto it = find(createdConnections.begin(), createdConnections.end(), connection);
if(it != createdConnections.end() ) createdConnections.erase( it );
}
}
@@ -539,9 +540,9 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
if(g_NetworkManager.IsLeavingGame() || !IsInSession() )
{
for(AUTO_VAR(it, createdConnections.begin()); it < createdConnections.end(); ++it)
{
(*it)->close();
for (auto& it : createdConnections)
{
it->close();
}
// assert(false);
MinecraftServer::HaltServer();
@@ -1218,9 +1219,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
if( pServer != NULL )
{
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() )
{
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
@@ -1286,9 +1286,8 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid();
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 )
{
servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) );
@@ -64,9 +64,8 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer )
{
// Do we already have a primary player for this system?
bool systemHasPrimaryPlayer = false;
for(AUTO_VAR(it, m_machineQNetPrimaryPlayers.begin()); it < m_machineQNetPrimaryPlayers.end(); ++it)
{
IQNetPlayer *pQNetPrimaryPlayer = *it;
for (auto& pQNetPrimaryPlayer : m_machineQNetPrimaryPlayers)
{
if( pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer) )
{
systemHasPrimaryPlayer = true;
@@ -318,8 +317,8 @@ bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost)
m_pIQNet->EndGame();
}
for (AUTO_VAR(it, currentNetworkPlayers.begin()); it != currentNetworkPlayers.end(); it++)
delete* it;
for (auto & it : currentNetworkPlayers)
delete it;
currentNetworkPlayers.clear();
m_machineQNetPrimaryPlayers.clear();
SystemFlagReset();
@@ -844,8 +843,8 @@ INetworkPlayer *CPlatformNetworkManagerStub::addNetworkPlayer(IQNetPlayer *pQNet
void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *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 )
{
currentNetworkPlayers.erase(it);
@@ -188,9 +188,8 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer *
{
// Do we already have a primary player for this system?
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) )
{
systemHasPrimaryPlayer = true;
@@ -293,7 +292,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay
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() )
{
m_machineSQRPrimaryPlayers.erase( it );
@@ -529,9 +528,8 @@ int CPlatformNetworkManagerSony::CorrectErrorIDS(int IDS)
bool CPlatformNetworkManagerSony::isSystemPrimaryPlayer(SQRNetworkPlayer *pSQRPlayer)
{
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 )
{
playerIsSystemPrimary = true;
@@ -1066,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer,
wstring CPlatformNetworkManagerSony::GatherStats()
{
#if 0
return L"Queue messages: " + _toString(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
+ L" Queue bytes: " + _toString( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) )
+ L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) );
#else
return L"";
#endif
@@ -1192,7 +1190,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session
bool foundSession = false;
FriendSessionInfo *sessionInfo = NULL;
AUTO_VAR(itFriendSession, friendsSessions[iPad].begin());
auto itFriendSession = friendsSessions[iPad].begin();
for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession)
{
sessionInfo = *itFriendSession;
@@ -1283,7 +1281,7 @@ INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *
void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *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 )
{
@@ -23,9 +23,8 @@ bool AreaTask::isCompleted()
case eAreaTaskCompletion_CompleteOnConstraintsSatisfied:
{
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()))
{
allSatisfied = false;
@@ -53,15 +53,15 @@ bool ControllerTask::isCompleted()
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)
{
// 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;
}
else
@@ -78,15 +78,15 @@ bool ControllerTask::isCompleted()
}
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)
{
// 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;
}
else
+10 -10
View File
@@ -47,9 +47,9 @@ bool InfoTask::isCompleted()
{
// If a menu is displayed, then we use the handleUIInput to complete the task
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)
{
bAllComplete = false;
@@ -61,18 +61,18 @@ bool InfoTask::isCompleted()
{
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)
{
#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
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0)
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0)
#endif
{
(*it).second = true;
it.second = true;
bAllComplete=true;
}
else
@@ -111,11 +111,11 @@ void InfoTask::handleUIInput(int iAction)
{
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;
}
}
}
@@ -3,8 +3,8 @@
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);
}
}
@@ -24,10 +24,8 @@ int ProcedureCompoundTask::getDescriptionId()
// Return the id of the first task not completed
int descriptionId = -1;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
{
TutorialTask *task = *it;
for (auto& task : m_taskSequence)
{
if(!task->isCompleted())
{
task->setAsCurrentTask(true);
@@ -50,10 +48,8 @@ int ProcedureCompoundTask::getPromptId()
// Return the id of the first task not completed
int promptId = -1;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
promptId = task->getPromptId();
@@ -69,11 +65,8 @@ bool ProcedureCompoundTask::isCompleted()
bool allCompleted = true;
bool isCurrentTask = true;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(allCompleted && isCurrentTask)
{
if(task->isCompleted())
@@ -99,11 +92,9 @@ bool ProcedureCompoundTask::isCompleted()
if(allCompleted)
{
//Disable all constraints
itEnd = m_taskSequence.end();
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
// Disable all constraints
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->enableConstraints(false);
}
}
@@ -113,20 +104,16 @@ bool ProcedureCompoundTask::isCompleted()
void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->onCrafted(item);
}
}
void ProcedureCompoundTask::handleUIInput(int iAction)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto task : m_taskSequence)
{
TutorialTask *task = *it;
task->handleUIInput(iAction);
}
}
@@ -135,10 +122,8 @@ void ProcedureCompoundTask::handleUIInput(int iAction)
void ProcedureCompoundTask::setAsCurrentTask(bool active /*= true*/)
{
bool allCompleted = true;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(allCompleted && !task->isCompleted())
{
task->setAsCurrentTask(true);
@@ -157,10 +142,8 @@ bool ProcedureCompoundTask::ShowMinimumTime()
return false;
bool showMinimumTime = false;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
showMinimumTime = task->ShowMinimumTime();
@@ -176,10 +159,8 @@ bool ProcedureCompoundTask::hasBeenActivated()
return true;
bool hasBeenActivated = false;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
hasBeenActivated = task->hasBeenActivated();
@@ -191,10 +172,8 @@ bool ProcedureCompoundTask::hasBeenActivated()
void ProcedureCompoundTask::setShownForMinimumTime()
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
task->setShownForMinimumTime();
@@ -209,10 +188,8 @@ bool ProcedureCompoundTask::AllowFade()
return true;
bool allowFade = true;
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
if(!task->isCompleted())
{
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)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->useItemOn(level, item, x, y, z, bTestUseOnly);
}
}
void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->useItem(item, bTestUseOnly);
}
}
void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
}
}
void ProcedureCompoundTask::onStateChange(eTutorial_State newState)
{
AUTO_VAR(itEnd, m_taskSequence.end());
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
for(auto& task : m_taskSequence)
{
TutorialTask *task = *it;
task->onStateChange(newState);
}
}
+70 -99
View File
@@ -1144,23 +1144,23 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
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(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;
@@ -1188,10 +1188,10 @@ void Tutorial::setCompleted( int completableId )
int completableIndex = -1;
for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it)
{
for (int task : s_completableTasks)
{
++completableIndex;
if( *it == completableId )
if( task == completableId )
{
break;
}
@@ -1220,10 +1220,10 @@ bool Tutorial::getCompleted( int completableId )
//}
int completableIndex = -1;
for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it)
{
for (int it : s_completableTasks)
{
++completableIndex;
if( *it == completableId )
if( it == completableId )
{
break;
}
@@ -1318,8 +1318,8 @@ void Tutorial::tick()
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
{
AUTO_VAR(it, constraintsToRemove[state].begin());
while(it < constraintsToRemove[state].end() )
auto it = constraintsToRemove[state].begin();
while(it != constraintsToRemove[state].end() )
{
++(*it).second;
if( (*it).second > m_iTutorialConstraintDelayRemoveTicks )
@@ -1427,9 +1427,8 @@ void Tutorial::tick()
}
// Check constraints
for(AUTO_VAR(it, m_globalConstraints.begin()); it < m_globalConstraints.end(); ++it)
{
TutorialConstraint *constraint = *it;
for (auto& constraint : m_globalConstraints)
{
constraint->tick(m_iPad);
}
@@ -1443,9 +1442,8 @@ void Tutorial::tick()
if(hintsOn)
{
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
{
TutorialHint *hint = *it;
for (auto& hint : hints[m_CurrentState])
{
hintNeeded = hint->tick();
if(hintNeeded >= 0)
{
@@ -1469,9 +1467,8 @@ void Tutorial::tick()
constraintChanged = true;
currentFailedConstraint[m_CurrentState] = NULL;
}
for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
{
TutorialConstraint *constraint = *it;
for (auto& constraint : constraints[m_CurrentState])
{
if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) )
{
constraintChanged = true;
@@ -1484,8 +1481,8 @@ void Tutorial::tick()
{
// Update tasks
bool isCurrentTask = true;
AUTO_VAR(it, activeTasks[m_CurrentState].begin());
while(activeTasks[m_CurrentState].size() > 0 && it < activeTasks[m_CurrentState].end())
auto it = activeTasks[m_CurrentState].begin();
while(activeTasks[m_CurrentState].size() > 0 && it != activeTasks[m_CurrentState].end())
{
TutorialTask *task = *it;
if( isCurrentTask || task->isPreCompletionEnabled() )
@@ -1509,8 +1506,8 @@ void Tutorial::tick()
{
// 4J Stu - Move the delayed constraints to the gameplay state so that they are in
// effect for a bit longer
AUTO_VAR(itCon, constraintsToRemove[m_CurrentState].begin());
while(itCon != constraintsToRemove[m_CurrentState].end() )
auto itCon = constraintsToRemove[m_CurrentState].begin();
while(itCon != constraintsToRemove[m_CurrentState].end() )
{
constraints[e_Tutorial_State_Gameplay].push_back(itCon->first);
constraintsToRemove[e_Tutorial_State_Gameplay].push_back( pair<TutorialConstraint *, unsigned char>(itCon->first, itCon->second) );
@@ -1521,9 +1518,9 @@ void Tutorial::tick()
}
// Fall through the the normal complete state
case e_Tutorial_Completion_Complete_State:
for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem)
{
delete (*itRem);
for (auto& itRem : activeTasks[m_CurrentState])
{
delete itRem;
}
activeTasks[m_CurrentState].clear();
break;
@@ -1531,9 +1528,9 @@ void Tutorial::tick()
{
TutorialTask *lastTask = activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1 );
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].push_back( lastTask );
@@ -1697,8 +1694,8 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
}
else
{
AUTO_VAR(it, messages.find(message->m_messageId));
if( it != messages.end() && it->second != NULL )
auto it = messages.find(message->m_messageId);
if( it != messages.end() && it->second != NULL )
{
TutorialMessage *messageString = it->second;
text = wstring( messageString->getMessageForDisplay() );
@@ -1727,8 +1724,8 @@ bool Tutorial::setMessage(PopupMessageDetails *message)
}
else if(message->m_promptId >= 0)
{
AUTO_VAR(it, messages.find(message->m_promptId));
if(it != messages.end() && it->second != NULL)
auto it = messages.find(message->m_promptId);
if(it != messages.end() && it->second != NULL)
{
TutorialMessage *prompt = it->second;
text.append( prompt->getMessageForDisplay() );
@@ -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)
{
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);
}
}
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);
}
}
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);
}
// 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)
{
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);
}
}
@@ -1866,9 +1859,8 @@ void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
{
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);
if(hintNeeded >= 0)
{
@@ -1877,16 +1869,14 @@ void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
setMessage( hint, message );
break;
}
}
}
void Tutorial::destroyBlock(Tile *tile)
{
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);
if(hintNeeded >= 0)
{
@@ -1895,16 +1885,14 @@ void Tutorial::destroyBlock(Tile *tile)
setMessage( hint, message );
break;
}
}
}
void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
{
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);
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)
{
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);
if(hintNeeded >= 0)
{
@@ -1939,11 +1926,6 @@ void Tutorial::handleUIInput(int iAction)
{
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)
currentTask[m_CurrentState]->handleUIInput(iAction);
}
@@ -1951,9 +1933,8 @@ void Tutorial::handleUIInput(int iAction)
void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
{
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);
if(hintNeeded >= 0)
{
@@ -1968,11 +1949,10 @@ void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
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);
}
}
@@ -1983,23 +1963,20 @@ void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAn
if( !m_hintDisplayed )
{
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);
if(hintNeeded)
{
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);
}
}
@@ -2035,9 +2012,8 @@ void Tutorial::onLookAt(int id, int iData)
if( m_hintDisplayed ) return;
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);
if(hintNeeded)
{
@@ -2066,9 +2042,8 @@ void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
if( m_hintDisplayed ) return;
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());
if(hintNeeded)
{
@@ -2081,9 +2056,9 @@ void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
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)
{
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);
}
}
@@ -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 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) )
{
allowed = false;
@@ -2136,9 +2109,8 @@ bool Tutorial::isInputAllowed(int mapping)
if( Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid(Material::water) ) return 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 ) )
{
allowed = false;
@@ -2156,9 +2128,9 @@ vector<TutorialTask *> *Tutorial::getTasks()
unsigned int Tutorial::getCurrentTaskIndex()
{
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;
++index;
@@ -2184,11 +2156,11 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
if( c->getQueuedForRemoval() )
{
// 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;
}
}*/
@@ -2196,12 +2168,12 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
else if(delayedRemove)
{
c->setQueuedForRemoval(true);
constraintsToRemove[m_CurrentState].push_back( pair<TutorialConstraint *, unsigned char>(c, 0) );
constraintsToRemove[m_CurrentState].emplace_back(c, 0);
}
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 )
{
constraintsToRemove[m_CurrentState].erase( it );
@@ -2209,8 +2181,8 @@ void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= fa
}
}
AUTO_VAR(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) );
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) );
// It may be in the gameplay list, so remove it from there if it is
it = find( constraints[e_Tutorial_State_Gameplay].begin(), constraints[e_Tutorial_State_Gameplay].end(), c);
@@ -2304,9 +2276,8 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*=
if( m_CurrentState != newState )
{
for(AUTO_VAR(it, activeTasks[newState].begin()); it < activeTasks[newState].end(); ++it)
{
TutorialTask *task = *it;
for (auto& task : activeTasks[newState] )
{
task->onStateChange(newState);
}
m_CurrentState = newState;
@@ -11,9 +11,8 @@ TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePre
{
if(inConstraints != NULL)
{
for(AUTO_VAR(it, inConstraints->begin()); it < inConstraints->end(); ++it)
for(auto& constraint : *inConstraints)
{
TutorialConstraint *constraint = *it;
constraints.push_back( constraint );
}
delete inConstraints;
@@ -26,10 +25,8 @@ TutorialTask::~TutorialTask()
{
enableConstraints(false);
for(AUTO_VAR(it, constraints.begin()); it < constraints.end(); ++it)
for(auto& constraint : constraints)
{
TutorialConstraint *constraint = *it;
if( constraint->getQueuedForRemoval() )
{
constraint->setDeleteOnDeactivate(true);
@@ -52,9 +49,8 @@ void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/)
if( !enable && (areConstraintsEnabled || !delayRemove) )
{
// Remove
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it)
for(auto& constraint : constraints)
{
TutorialConstraint *constraint = *it;
//app.DebugPrintf(">>>>>>>> %i\n", constraints.size());
tutorial->RemoveConstraint( constraint, delayRemove );
}
@@ -63,9 +59,8 @@ void TutorialTask::enableConstraints(bool enable, bool delayRemove /*= false*/)
else if( !areConstraintsEnabled && enable )
{
// Add
for(AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it)
for(auto& constraint : constraints)
{
TutorialConstraint *constraint = *it;
tutorial->AddConstraint( constraint );
}
areConstraintsEnabled = true;
@@ -621,9 +621,9 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
int iRecipeC=(int)recipes->size();
AUTO_VAR(itRecipe, recipes->begin());
auto itRecipe = recipes->begin();
// dump out the recipe products
// dump out the recipe products
// for (int i = 0; i < iRecipeC; i++)
// {
@@ -828,8 +828,8 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i
// Fill the dynamic group
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->set( *it );
}
@@ -78,7 +78,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
int buyBMatches = player->inventory->countMatches(buyBItem);
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 Enchanted Books will cause the title to crash.
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
m_merchant->notifyTrade(activeRecipe);
@@ -186,13 +186,12 @@ void IUIScene_TradingMenu::updateDisplay()
m_activeOffers.clear();
int unfilteredIndex = 0;
int firstValidTrade = INT_MAX;
for(AUTO_VAR(it, unfilteredOffers->begin()); it != unfilteredOffers->end(); ++it)
for(auto& recipe : *unfilteredOffers)
{
MerchantRecipe *recipe = *it;
if(!recipe->isDeprecated())
{
m_activeOffers.push_back( pair<MerchantRecipe *,int>(recipe,unfilteredIndex));
firstValidTrade = min(firstValidTrade,unfilteredIndex);
m_activeOffers.emplace_back(recipe,unfilteredIndex);
firstValidTrade = std::min<int>(firstValidTrade, unfilteredIndex);
}
++unfilteredIndex;
}
@@ -101,7 +101,7 @@ void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1f);
Minecraft *pMinecraft = Minecraft::GetInstance();
wstring line = _toString<int>(cost);
wstring line = std::to_wstring(cost);
Font *font = pMinecraft->altFont;
//int col = 0x685E4A;
unsigned int col = m_textColour;
@@ -165,7 +165,7 @@ void UIControl_EnchantmentButton::updateState()
if(cost != m_lastCost)
{
setLabel( _toString<int>(cost) );
setLabel( std::to_wstring(cost) );
m_lastCost = cost;
m_enchantmentString = EnchantmentNames::instance.getRandomName();
}
@@ -225,10 +225,8 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
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;
}
}
@@ -239,10 +237,8 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
// hide the additional parts
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;
}
}
+18 -26
View File
@@ -500,8 +500,8 @@ void UIController::tick()
// Clear out the cached movie file data
__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)
{
delete [] it->second.m_ba.data;
@@ -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);
delete queuedData->info.uiOptionA;
delete queuedData;
@@ -752,8 +751,8 @@ byteArray UIController::getMovieData(const wstring &filename)
{
// Cache everything we load in the current tick
__int64 targetTime = System::currentTimeMillis() + (1000LL * 60);
AUTO_VAR(it,m_cachedMovieData.find(filename));
if(it == m_cachedMovieData.end() )
auto it = m_cachedMovieData.find(filename);
if(it == m_cachedMovieData.end() )
{
byteArray baFile = app.getArchiveFile(filename);
CachedMovieData cmd;
@@ -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).
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;
AUTO_VAR(it,uiController->m_substitutionTextures.find((wchar_t *)texture_name));
UIController *uiController = static_cast<UIController *>(user_callback_data);
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);
if( image.getData() != NULL )
@@ -1711,9 +1710,9 @@ void UIController::registerSubstitutionTexture(const wstring &textureName, PBYTE
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())
{
if(deleteData) delete [] it->second.data;
m_substitutionTextures.erase(it);
@@ -1953,8 +1952,8 @@ size_t UIController::RegisterForCallbackId(UIScene *scene)
void UIController::UnregisterCallbackId(size_t id)
{
EnterCriticalSection(&m_registeredCallbackScenesCS);
AUTO_VAR(it, m_registeredCallbackScenes.find(id) );
if(it != m_registeredCallbackScenes.end() )
auto it = m_registeredCallbackScenes.find(id);
if(it != m_registeredCallbackScenes.end() )
{
m_registeredCallbackScenes.erase(it);
}
@@ -1964,8 +1963,8 @@ void UIController::UnregisterCallbackId(size_t id)
UIScene *UIController::GetSceneFromCallbackId(size_t id)
{
UIScene *scene = NULL;
AUTO_VAR(it, m_registeredCallbackScenes.find(id) );
if(it != m_registeredCallbackScenes.end() )
auto it = m_registeredCallbackScenes.find(id);
if(it != m_registeredCallbackScenes.end() )
{
scene = it->second;
}
@@ -3002,11 +3001,8 @@ void UIController::TouchBoxRebuild(UIScene *pUIScene)
ui.TouchBoxesClear(pUIScene);
// rebuild boxes
AUTO_VAR(itEnd, pUIScene->GetControls()->end());
for (AUTO_VAR(it, pUIScene->GetControls()->begin()); it != itEnd; it++)
for ( UIControl *control : *pUIScene->GetControls() )
{
UIControl *control=(UIControl *)*it;
if(control->getControlType() == UIControl::eButton ||
control->getControlType() == UIControl::eSlider ||
control->getControlType() == UIControl::eCheckBox ||
@@ -3035,10 +3031,8 @@ void UIController::TouchBoxesClear(UIScene *pUIScene)
EUILayer eUILayer=pUIScene->GetParentLayer()->m_iLayer;
EUIScene eUIscene=pUIScene->getSceneType();
AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end());
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] )
{
UIELEMENT *element=(UIELEMENT *)*it;
delete element;
}
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)
{
AUTO_VAR(itEnd, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].end());
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
for ( UIELEMENT *element : m_TouchBoxes[eUIGroup][eUILayer][eUIscene] )
{
UIELEMENT *element=(UIELEMENT *)*it;
if(element->pControl->getHidden() == false && element->pControl->getVisible()) // ignore removed controls
{
if((x>=element->x1) &&(x<=element->x2) && (y>=element->y1) && (y<=element->y2))
+61 -65
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
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);
}
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.
for( AUTO_VAR(it,scenesToDeleteCopy.begin()); it != scenesToDeleteCopy.end(); it++)
for(auto& scene : scenesToDeleteCopy)
{
UIScene *scene = (*it);
if( scene->isReadyToDelete())
if( scene && scene->isReadyToDelete())
{
delete scene;
}
@@ -47,13 +45,12 @@ void UILayer::tick()
}
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
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() )
{
//(*it)->tick();
@@ -68,20 +65,20 @@ void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport)
{
if(!ui.IsExpectingOrReloadingSkin())
{
for(AUTO_VAR(it,m_components.begin()); it != m_components.end(); ++it)
{
AUTO_VAR(itRef,m_componentRefCount.find((*it)->getSceneType()));
if(itRef != m_componentRefCount.end() && itRef->second.second)
for(auto& it : m_components)
{
if((*it)->isVisible() )
auto itRef = m_componentRefCount.find(it->getSceneType());
if(itRef != m_componentRefCount.end() && itRef->second.second)
{
PIXBeginNamedEvent(0, "Rendering component %d", (*it)->getSceneType() );
(*it)->render(width, height,viewport);
PIXEndNamedEvent();
if(it->isVisible() )
{
PIXBeginNamedEvent(0, "Rendering component %d", it->getSceneType() );
it->render(width, height,viewport);
PIXEndNamedEvent();
}
}
}
}
}
if(!m_sceneStack.empty())
{
int lowestRenderable = m_sceneStack.size() - 1;
@@ -139,9 +136,9 @@ bool UILayer::HasFocus(int iPad)
bool UILayer::hidesLowerScenes()
{
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;
break;
@@ -168,28 +165,27 @@ void UILayer::getRenderDimensions(S32 &width, S32 &height)
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)
{
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())
{
int lowestRenderable = 0;
for(;lowestRenderable < m_sceneStack.size(); ++lowestRenderable)
for(auto& lowestRenderable : m_sceneStack)
{
m_sceneStack[lowestRenderable]->reloadMovie(force);
lowestRenderable->reloadMovie(force);
}
}
}
@@ -493,8 +489,8 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene)
void UILayer::showComponent(int iPad, EUIScene scene, bool show)
{
AUTO_VAR(it,m_componentRefCount.find(scene));
if(it != m_componentRefCount.end())
auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end())
{
it->second.second = show;
return;
@@ -505,8 +501,8 @@ void UILayer::showComponent(int iPad, EUIScene scene, bool show)
bool UILayer::isComponentVisible(EUIScene scene)
{
bool visible = false;
AUTO_VAR(it,m_componentRefCount.find(scene));
if(it != m_componentRefCount.end())
auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end())
{
visible = it->second.second;
}
@@ -515,16 +511,16 @@ bool UILayer::isComponentVisible(EUIScene scene)
UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
{
AUTO_VAR(it,m_componentRefCount.find(scene));
if(it != m_componentRefCount.end())
auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end())
{
++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;
@@ -586,16 +582,16 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData)
void UILayer::removeComponent(EUIScene scene)
{
AUTO_VAR(it,m_componentRefCount.find(scene));
if(it != m_componentRefCount.end())
auto it = m_componentRefCount.find(scene);
if(it != m_componentRefCount.end())
{
--it->second.first;
if(it->second.first <= 0)
{
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)
{
#ifdef __PSVITA__
@@ -622,8 +618,8 @@ void UILayer::removeScene(UIScene *scene)
ui.TouchBoxesClear(scene);
#endif
AUTO_VAR(newEnd, std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene) );
m_sceneStack.erase(newEnd, m_sceneStack.end());
auto newEnd = std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene);
m_sceneStack.erase(newEnd, m_sceneStack.end());
m_scenesToDelete.push_back(scene);
@@ -645,14 +641,14 @@ void UILayer::closeAllScenes()
vector<UIScene *> temp;
temp.insert(temp.end(), m_sceneStack.begin(), m_sceneStack.end());
m_sceneStack.clear();
for(AUTO_VAR(it, temp.begin()); it != temp.end(); ++it)
for(auto& it : temp)
{
#ifdef __PSVITA__
// remove any touchboxes
ui.TouchBoxesClear(*it);
ui.TouchBoxesClear(it);
#endif
m_scenesToDelete.push_back(*it);
(*it)->handleDestroy(); // For anything that might require the pointer be valid
m_scenesToDelete.push_back(it);
it->handleDestroy(); // For anything that might require the pointer be valid
}
updateFocusState();
@@ -696,8 +692,8 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
m_bIgnorePlayerJoinMenuDisplayed = 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;
// UPDATE FOCUS STATES
@@ -783,7 +779,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */)
UIScene *UILayer::getCurrentScene()
{
// 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;
// 4J-PB - only used on Vita, so iPad 0 is fine
@@ -800,8 +796,8 @@ UIScene *UILayer::getCurrentScene()
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
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;
if(scene->hasFocus(iPad) && scene->canHandleInput())
{
@@ -825,8 +821,8 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
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;
app.DebugPrintf("UILayer::HandleDLCMountingComplete - topScene\n");
topScene->HandleDLCMountingComplete();
@@ -835,8 +831,8 @@ void UILayer::HandleDLCMountingComplete()
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;
topScene->HandleDLCInstalled();
}
@@ -845,7 +841,7 @@ void UILayer::HandleDLCInstalled()
#ifdef _XBOX_ONE
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;
topScene->HandleDLCLicenseChange();
@@ -855,8 +851,8 @@ void UILayer::HandleDLCLicenseChange()
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;
topScene->HandleMessage(message, data);
}
@@ -875,9 +871,9 @@ C4JRender::eViewportType UILayer::getViewport()
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 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);
totalStatic += layerStatic;
+16 -19
View File
@@ -39,9 +39,9 @@ UIScene::~UIScene()
/* Destroy the Iggy player. */
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)
@@ -88,9 +88,9 @@ void UIScene::reloadMovie(bool force)
handlePreReload();
// Reload controls
for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it)
for(auto & it : m_controls)
{
(*it)->ReInit();
it->ReInit();
}
updateComponents();
@@ -440,9 +440,9 @@ void UIScene::tick()
while(IggyPlayerReadyToTick( swf ))
{
tickTimers();
for(AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it)
for(auto & it : m_controls)
{
(*it)->tick();
it->tick();
}
IggyPlayerTickRS( swf );
m_hasTickedOnce = true;
@@ -468,8 +468,8 @@ void UIScene::addTimer(int id, int ms)
void UIScene::killTimer(int id)
{
AUTO_VAR(it, m_timers.find(id));
if(it != m_timers.end())
auto it = m_timers.find(id);
if(it != m_timers.end())
{
it->second.running = false;
}
@@ -478,8 +478,8 @@ void UIScene::killTimer(int id)
void UIScene::tickTimers()
{
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)
{
it = m_timers.erase(it);
@@ -501,8 +501,8 @@ void UIScene::tickTimers()
IggyName UIScene::registerFastName(const wstring &name)
{
IggyName var;
AUTO_VAR(it,m_fastNames.find(name));
if(it != m_fastNames.end())
auto it = m_fastNames.find(name);
if(it != m_fastNames.end())
{
var = it->second;
}
@@ -642,9 +642,8 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
PIXBeginNamedEvent(0,"Draw all cache");
// 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);
_customDrawSlotControl(drawData->customDrawRegion, iPad, drawData->item, drawData->fAlpha, drawData->isFoil, drawData->bDecorations, useCommandBuffers);
delete drawData->customDrawRegion;
@@ -1185,9 +1184,9 @@ void UIScene::registerSubstitutionTexture(const wstring &textureName, PBYTE pbDa
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();
}
void UIScene::_handleFocusChange(F64 controlId, F64 childId)
@@ -1240,10 +1239,8 @@ UIScene *UIScene::getBackScene()
#ifdef __PSVITA__
void UIScene::UpdateSceneControls()
{
AUTO_VAR(itEnd, GetControls()->end());
for (AUTO_VAR(it, GetControls()->begin()); it != itEnd; it++)
for ( UIControl *control : *GetControls() )
{
UIControl *control=(UIControl *)*it;
control->UpdateControl();
}
}
@@ -191,13 +191,13 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre
switch(iTextC)
{
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 ftes de fin d'anne.<br><br>1-4 joueurs<br>2-8 joueurs en rseau<br><br> Cet article fait lobjet dune licence ou dune sous-licence de Sony Computer Entertainment America, et est soumis aux conditions gnrales du service du rseau, 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 tlchargez pas ce produit. Cet article peut tre utilis avec un maximum de deux systmes PlayStation3 activs associs ce compte Sony Entertainment Network.<br><br>'Minecraft' est une marque commerciale de Notch Development AB.");
break;
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 artculo, que est sujeto a los trminos de servicio y al acuerdo de usuario de la red. Las restricciones de uso de este artculo, as como otros trminos aplicables, se encuentran en www.us.playstation.com/support/useragreements. Si no desea aceptar todos estos trminos, no descargue este artculo. Este artculo puede usarse en hasta dos sistemas PlayStation3 activados asociados con esta cuenta de Sony Entertainment Network.<br><br>'Minecraft' es una marca comercial de Notch Development AB.");
break;
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 um incrvel 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 Servio da Rede e Acordo do Usurio, as restries de uso deste item e outros termos aplicveis esto localizados em www.us.playstation.com/support/useragreements. Caso no queira aceitar todos esses termos, no baixe este item. Este item pode ser usado com at 2 sistemas PlayStation3 ativados associados a esta Conta de Rede Sony Entertainment.<br><br>'Minecraft' uma marca registrada da Notch Development AB");
break;
}
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
}
@@ -80,7 +80,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa
for(unsigned int level = ench->getMinLevel(); level <= ench->getMaxLevel(); ++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) );
}
}
@@ -61,13 +61,13 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer)
noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName);
Random random(8124371);
int found=(int)noNoiseString.find(L"{*NOISE*}");
size_t found=noNoiseString.find(L"{*NOISE*}");
int length;
while (found!=string::npos)
{
length = random.nextInt(4) + 3;
m_noiseLengths.push_back(length);
found=(int)noNoiseString.find(L"{*NOISE*}",found+1);
found=noNoiseString.find(L"{*NOISE*}",found+1);
}
updateNoise();
@@ -209,8 +209,8 @@ void UIScene_EndPoem::updateNoise()
wstring tag = L"{*NOISE*}";
AUTO_VAR(it, m_noiseLengths.begin());
int found=(int)noiseString.find(tag);
auto it = m_noiseLengths.begin();
size_t found= noiseString.find(tag);
while (found!=string::npos && it != m_noiseLengths.end() )
{
length = *it;
@@ -275,6 +275,6 @@ void UIScene_EndPoem::updateNoise()
//ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0));
//ib.put(listPos + pos + 32);
found=(int)noiseString.find(tag,found+1);
found=noiseString.find(tag,found+1);
}
}
@@ -261,10 +261,8 @@ void UIScene_InventoryMenu::updateEffectsDisplay()
int iValue = 0;
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()])
{
wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim();
@@ -1054,10 +1054,8 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons()
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
unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId();
@@ -1859,10 +1857,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList()
unsigned int sessionIndex = 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";
// Is this a default game or a texture pack game?
@@ -74,7 +74,7 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
#ifdef _DEBUG
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;
app.DebugPrintf("%d. ",iCount++);
@@ -103,18 +103,6 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
}
}
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 );
}
@@ -69,7 +69,7 @@ HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText *
// Light background and focus background
SetEnable(TRUE);
}
m_costString = _toString<int>(cost);
m_costString = std::to_wstring(cost);
m_lastCost = cost;
}
if(cost == 0)
@@ -124,7 +124,7 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B
glColor4f(1, 1, 1, 1);
if (cost != 0)
{
wstring line = _toString<int>(cost);
wstring line = std::to_wstring(cost);
Font *font = pMinecraft->altFont;
//int col = 0x685E4A;
unsigned int col = m_textColour;
@@ -256,10 +256,8 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
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;
}
}
@@ -270,10 +268,8 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
// hide the additional parts
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;
}
}
@@ -137,9 +137,8 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri
wstring desc = L"";
vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings);
bool firstLine = true;
for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it)
{
wstring thisString = *it;
for ( wstring& thisString : *strings )
{
if(!firstLine)
{
desc.append( L"<br />" );
@@ -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_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
m_itemId .SetText( _toString<int>(m_item->id).c_str() );
m_itemAuxValue .SetText( _toString<int>(m_item->getAuxValue()).c_str() );
m_itemCount .SetText( _toString<int>(m_item->count).c_str() );
m_item4JData .SetText( _toString<int>(m_item->get4JData()).c_str() );
m_itemId .SetText( std::to_wstring(m_item->id).c_str() );
m_itemAuxValue .SetText( std::to_wstring(m_item->getAuxValue()).c_str() );
m_itemCount .SetText( std::to_wstring(m_item->count).c_str() );
m_item4JData .SetText( std::to_wstring(m_item->get4JData()).c_str() );
}
m_itemId .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
@@ -365,11 +365,11 @@ 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
{
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;
AUTO_VAR(it, newFileCache.find(file));
if( it != newFileCache.end() )
auto it = newFileCache.find(file);
if( it != newFileCache.end() )
ref = it->second;
// 4J Jev, put back in.
@@ -43,12 +43,12 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled
m_yRot.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_camY.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camY + 1.62).c_str());
m_camZ.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camZ).c_str());
m_camX.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camX).c_str());
m_camY.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camY + 1.62).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_elevation.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_elev).c_str());
m_yRot.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_yRot).c_str());
m_elevation.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_elev).c_str());
//fpp = new FreezePlayerParam();
//fpp->player = playerNo;
@@ -267,9 +267,8 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons()
int iGeneratorIndex = 0;
m_iMashUpButtonsC=0;
for(AUTO_VAR(it, m_generators->begin()); it != m_generators->end(); ++it)
{
LevelGenerationOptions *levelGen = *it;
for (LevelGenerationOptions *levelGen : *m_generators )
{
ListInfo.pwszText = levelGen->getWorldName();
ListInfo.fEnabled = TRUE;
ListInfo.iData = iGeneratorIndex++; // used to index into the list of generators
@@ -387,9 +386,9 @@ HRESULT CScene_MultiGameJoinLoad::OnDestroy()
{
g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL );
for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
{
delete (*it);
for (auto& it : currentSessions )
{
delete it;
}
if(m_bSaveTransferInProgress)
@@ -1145,9 +1144,9 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId;
pSelectedSession = NULL;
for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
{
delete (*it);
for (auto& it : currentSessions )
{
delete it;
}
currentSessions.clear();
@@ -1248,9 +1247,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
unsigned int sessionIndex = 0;
m_pGamesList->SetCurSel(0);
for( AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it)
{
FriendSessionInfo *sessionInfo = *it;
for ( FriendSessionInfo *sessionInfo : currentSessions )
{
HXUIBRUSH hXuiBrush;
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
@@ -1390,7 +1388,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
FriendSessionInfo *sessionInfo = NULL;
bool foundSession = false;
for(AUTO_VAR(it, friendsSessions.begin()); it < friendsSessions.end(); ++it)
for( auto it = friendsSessions.begin(); it != friendsSessions.end(); ++it)
{
sessionInfo = *it;
if(memcmp( &pSearchResult->info.sessionID, &sessionInfo->sessionId, sizeof(SessionID) ) == 0)
@@ -388,15 +388,15 @@ void CXuiSceneAbstractContainer::SetPointerText(const wstring &description, vect
}
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;
HRESULT hr;
xuiRect.right = 0;
for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it)
{
XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials((*it)).c_str(), &tempXuiRect);
for (auto& it : unformattedStrings )
{
XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials(it).c_str(), &tempXuiRect);
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
}
@@ -176,8 +176,8 @@ void CXuiSceneInventory::updateEffectsDisplay()
// Fill out details for display
D3DXVECTOR3 position;
m_hEffectDisplayA[0]->GetPosition(&position);
AUTO_VAR(it, activeEffects->begin());
for(unsigned int i = 0; i < MAX_EFFECTS; ++i)
auto it = activeEffects->begin();
for(unsigned int i = 0; i < MAX_EFFECTS; ++i)
{
if(it != activeEffects->end())
{
@@ -270,15 +270,15 @@ void CXuiSceneTrading::setOfferDescription(const wstring &name, vector<wstring>
}
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;
HRESULT hr;
xuiRect.right = 0;
for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it)
{
XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, (*it).c_str(), &tempXuiRect);
for (auto& it : unformattedStrings )
{
XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, it.c_str(), &tempXuiRect);
if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect;
}
@@ -195,7 +195,7 @@ void CScene_Win::updateNoise()
Minecraft *pMinecraft = Minecraft::GetInstance();
noiseString = noNoiseString;
int length = 0;
size_t length = 0;
wchar_t replacements[64];
wstring replaceString = L"";
wchar_t randomChar = L'a';
@@ -205,17 +205,17 @@ void CScene_Win::updateNoise()
wstring tag = L"{*NOISE*}";
AUTO_VAR(it, m_noiseLengths.begin());
int found=(int)noiseString.find_first_of(L"{");
auto it = m_noiseLengths.begin();
size_t found = noiseString.find_first_of(L"{");
while (found!=string::npos && it != m_noiseLengths.end() )
{
length = *it;
++it;
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"";
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 + pos + 32);
found=(int)noiseString.find_first_of(L"{",found+1);
found = noiseString.find_first_of(L"{",found+1);
}
}
@@ -113,8 +113,8 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText)
swscanf_s(wsText.c_str(), L"%s", wchCommand,40);
#endif
AUTO_VAR(it, m_CommandSet.find(wchCommand));
if(it != m_CommandSet.end())
auto it = m_CommandSet.find(wchCommand);
if(it != m_CommandSet.end())
{
// found it
+1 -1
View File
@@ -48,7 +48,7 @@ void DeathScreen::render(int xm, int ym, float a)
glScalef(2, 2, 2);
drawCenteredString(font, L"Game over!", width / 2 / 2, 60 / 2, 0xffffff);
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);
+1 -1
View File
@@ -26,7 +26,7 @@ void DemoMode::tick()
{
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)
+4 -4
View File
@@ -171,7 +171,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImages()
{
unordered_map<wstring,DLC_INFO * > *pDLCInfoA=app.GetDLCInfo();
// 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;
@@ -185,7 +185,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages()
// 4J-PB - Any local graphic files for the Minecraft Store?
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;
@@ -567,8 +567,8 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad,
// dump out the file list
app.DebugPrintf("TMSPP filecount - %d\nFiles - \n",pvTmsFileDetails->size());
int iCount=0;
AUTO_VAR(itEnd, pvTmsFileDetails->end());
for( AUTO_VAR(it, pvTmsFileDetails->begin()); it != itEnd; it++ )
auto itEnd = pvTmsFileDetails->end();
for (auto it = pvTmsFileDetails->begin(); it != itEnd; it++)
{
C4JStorage::PTMSPP_FILE_DETAILS fd = *it;
app.DebugPrintf("%2d. %ls (size - %d)\n",iCount++,fd->wchFilename,fd->ulFileSize);
@@ -1102,12 +1102,12 @@ SIZE_T WINAPI XMemSize(
void DumpMem()
{
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);
totalLeak += ( 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;
}
}
app.DebugPrintf("Total %d\n",totalLeak);
@@ -1150,13 +1150,13 @@ void MemPixStuff()
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 bytes = it->first & 0x03ffffff;
totals[sect] += bytes * it->second;
int sect = ( it.first >> 26 ) & 0x3f;
int bytes = it.first & 0x03ffffff;
totals[sect] += bytes * it.second;
}
}
@@ -28,43 +28,43 @@ DurangoLeaderboardManager::DurangoLeaderboardManager()
for(unsigned int difficulty = 0; difficulty < 4; ++difficulty)
{
m_leaderboardNames[difficulty][eStatsType_Travelling] = L"LeaderboardTravelling" + _toString(difficulty);
m_leaderboardNames[difficulty][eStatsType_Mining] = L"LeaderboardMining" + _toString(difficulty);
m_leaderboardNames[difficulty][eStatsType_Farming] = L"LeaderboardFarming" + _toString(difficulty);
m_leaderboardNames[difficulty][eStatsType_Kills] = L"LeaderboardKills" + _toString(difficulty);
m_leaderboardNames[difficulty][eStatsType_Travelling] = L"LeaderboardTravelling" + std::to_wstring(difficulty);
m_leaderboardNames[difficulty][eStatsType_Mining] = L"LeaderboardMining" + std::to_wstring(difficulty);
m_leaderboardNames[difficulty][eStatsType_Farming] = L"LeaderboardFarming" + std::to_wstring(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_Mining] = L"Leaderboard.LeaderboardId.1.DifficultyLevelId." + _toString(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Farming] = L"Leaderboard.LeaderboardId.2.DifficultyLevelId." + _toString(difficulty);
m_socialLeaderboardNames[difficulty][eStatsType_Kills] = L"Leaderboard.LeaderboardId.3.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." + std::to_wstring(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." + 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." + _toString(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." + _toString(difficulty) + L".TravelMethodId.5"); // Boat
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." + std::to_wstring(difficulty) + L".TravelMethodId.2"); // Fallen
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." + 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." + _toString(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." + _toString(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." + _toString(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.3"); // Dirt
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." + std::to_wstring(difficulty) + L".BlockId.12"); // Sand
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." + std::to_wstring(difficulty) + L".BlockId.13"); // Gravel
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." + 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"BlockBroken.DifficultyLevelId." + _toString(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." + _toString(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." + _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.344"); // Eggs
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." + std::to_wstring(difficulty) + L".BlockId.39"); // Mushroom
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." + std::to_wstring(difficulty) + L".AcquisitionMethodId.2.ItemId.335"); // Milk
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." + _toString(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." + _toString(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." + _toString(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.54"); // Zombie
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." + std::to_wstring(difficulty) + L".EnemyRoleId.50"); // Creeper
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." + std::to_wstring(difficulty) + L".EnemyRoleId.49"); // Spider Jockey
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." + std::to_wstring(difficulty) + L".EnemyRoleId.55"); // Slime
}
}
@@ -1460,7 +1460,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData)
{
PlayerSyncData *pNewPlayer = &pNewSyncData->players[i];
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() )
{
@@ -131,9 +131,8 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl
{
// Do we already have a primary player for this system?
bool systemHasPrimaryPlayer = false;
for(AUTO_VAR(it, m_machineDQRPrimaryPlayers.begin()); it < m_machineDQRPrimaryPlayers.end(); ++it)
{
DQRNetworkPlayer *pQNetPrimaryPlayer = *it;
for ( DQRNetworkPlayer *pQNetPrimaryPlayer : m_machineDQRPrimaryPlayers )
{
if( pDQRPlayer->IsSameSystem(pQNetPrimaryPlayer) )
{
systemHasPrimaryPlayer = true;
@@ -233,8 +232,8 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP
break;
}
}
AUTO_VAR(it, find( m_machineDQRPrimaryPlayers.begin(), m_machineDQRPrimaryPlayers.end(), pDQRPlayer));
if( it != m_machineDQRPrimaryPlayers.end() )
auto it = find(m_machineDQRPrimaryPlayers.begin(), m_machineDQRPrimaryPlayers.end(), pDQRPlayer);
if( it != m_machineDQRPrimaryPlayers.end() )
{
m_machineDQRPrimaryPlayers.erase( it );
}
@@ -847,8 +846,8 @@ INetworkPlayer *CPlatformNetworkManagerDurango::addNetworkPlayer(DQRNetworkPlaye
void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *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 )
{
currentNetworkPlayers.erase(it);
@@ -974,11 +974,11 @@ DurangoStats *CDurangoTelemetryManager::durangoStats()
wstring CDurangoTelemetryManager::guid2str(LPCGUID guid)
{
wstring out = L"GUID<";
out += _toString<unsigned long>(guid->Data1);
out += std::to_wstring(guid->Data1);
out += L":";
out += _toString<unsigned short>(guid->Data2);
out += std::to_wstring(guid->Data2);
out += L":";
out += _toString<unsigned short>(guid->Data3);
out += std::to_wstring(guid->Data3);
//out += L":";
//out += convStringToWstring(string((char*)&guid->Data4,8));
out += L">";
+5 -7
View File
@@ -169,10 +169,9 @@ EntityRenderDispatcher::EntityRenderDispatcher()
renderers[eTYPE_LIGHTNINGBOLT] = new LightningBoltRenderer();
glDisable(GL_LIGHTING);
AUTO_VAR(itEnd, renderers.end());
for( classToRendererMap::iterator it = renderers.begin(); it != itEnd; it++ )
for( auto& it : renderers )
{
it->second->init(this);
it.second->init(this);
}
isGuiRender = false; // 4J added
@@ -182,7 +181,7 @@ EntityRenderer *EntityRenderDispatcher::getRenderer(eINSTANCEOF e)
{
if( (e & eTYPE_PLAYER) == eTYPE_PLAYER) e = eTYPE_PLAYER;
//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() )
{
@@ -305,10 +304,9 @@ Font *EntityRenderDispatcher::getFont()
void EntityRenderDispatcher::registerTerrainTextures(IconRegister *iconRegister)
{
//for (EntityRenderer<? extends Entity> renderer : renderers.values())
for(AUTO_VAR(it, renderers.begin()); it != renderers.end(); ++it)
for( auto& it : renderers )
{
EntityRenderer *renderer = it->second;
EntityRenderer *renderer = it.second;
renderer->registerTerrainTextures(iconRegister);
}
}
+27 -26
View File
@@ -33,11 +33,11 @@ void EntityTracker::addEntity(shared_ptr<Entity> e)
{
addEntity(e, 32 * 16, 2);
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
void EntityTracker::removeEntity(shared_ptr<Entity> e)
{
AUTO_VAR(it, entityMap.find(e->entityId));
auto it = entityMap.find(e->entityId);
if( it != entityMap.end() )
{
shared_ptr<TrackedEntity> te = it->second;
@@ -110,9 +110,10 @@ void EntityTracker::removePlayer(shared_ptr<Entity> e)
if (e->GetType() == eTYPE_SERVERPLAYER)
{
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
@@ -123,14 +124,16 @@ void EntityTracker::removePlayer(shared_ptr<Entity> e)
void EntityTracker::tick()
{
vector<shared_ptr<ServerPlayer> > movedPlayers;
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ )
for( auto& te : entities )
{
shared_ptr<TrackedEntity> te = *it;
te->tick(this, &level->players);
if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER)
if ( te )
{
movedPlayers.push_back(dynamic_pointer_cast<ServerPlayer>(te->e));
}
te->tick(this, &level->players);
if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER)
{
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
@@ -168,10 +171,9 @@ void EntityTracker::tick()
{
shared_ptr<ServerPlayer> player = movedPlayers[i];
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->e != player)
if ( te && te->e != 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
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);
if(!player->isAlive())
shared_ptr<ServerPlayer> player = dynamic_pointer_cast<ServerPlayer>(it);
if( player && !player->isAlive())
{
player->flushEntitiesToRemove();
}
@@ -191,7 +193,7 @@ void EntityTracker::tick()
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() )
{
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)
{
AUTO_VAR(it, entityMap.find( e->entityId ));
auto it = entityMap.find(e->entityId);
if( it != entityMap.end() )
{
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)
{
for( AUTO_VAR(it, entities.begin()); it != entities.end(); it++ )
for ( auto& te : entities )
{
shared_ptr<TrackedEntity> te = *it;
te->clear(serverPlayer);
if ( te )
te->clear(serverPlayer);
}
}
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)
{
te->updatePlayer(this, player);
@@ -239,7 +240,7 @@ void EntityTracker::updateMaxRange()
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() )
{
return it->second;
+8 -10
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');
if (lines.size() > 1)
{
AUTO_VAR(itEnd, lines.end());
for (AUTO_VAR(it, lines.begin()); it != itEnd; it++)
{
for ( auto& it : lines )
{
// 4J Stu - Don't draw text that will be partially cutoff/overlap something it shouldn't
if( (y + this->wordWrapHeight(*it, w)) > h) break;
drawWordWrapInternal(*it, x, y, w, col, h);
y += this->wordWrapHeight(*it, w);
if( (y + this->wordWrapHeight(it, w)) > h) break;
drawWordWrapInternal(it, x, y, w, col, h);
y += this->wordWrapHeight(it, w);
}
return;
}
@@ -418,10 +417,9 @@ int Font::wordWrapHeight(const wstring& string, int w)
if (lines.size() > 1)
{
int h = 0;
AUTO_VAR(itEnd, lines.end());
for (AUTO_VAR(it, lines.begin()); it != itEnd; it++)
{
h += this->wordWrapHeight(*it, w);
for ( auto& it : lines )
{
h += this->wordWrapHeight(it, w);
}
return h;
}
+4 -6
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));
double nearest = dist;
AUTO_VAR(itEnd, objects->end());
for (AUTO_VAR(it, objects->begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it; //objects->at(i);
if (!e->isPickable()) continue;
for (auto& e : *objects )
{
if ( e == nullptr || !e->isPickable() ) continue;
float rr = e->getPickRadius();
AABB *bb = e->bb->grow(rr, rr, rr);
@@ -325,7 +323,7 @@ void GameRenderer::pick(float a)
nearest = 0;
}
}
else if (p != NULL)
else if (p != nullptr)
{
double dd = from->distanceTo(p->pos);
if (e == mc->cameraTargetPlayer->riding != NULL)
+10 -11
View File
@@ -849,7 +849,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
glPushMatrix();
if (Minecraft::warezTime > 0) glTranslatef(0, 32, 0);
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->gatherStats2(), iSafezoneXHalf+2, 32 + 20, 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];
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;
}
@@ -899,10 +899,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
double xBlockPos = floor(minecraft->player->x);
double yBlockPos = floor(minecraft->player->y);
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"y: " + _toString<double>(minecraft->player->y) + L"/ Head: " + _toString<double>(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"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"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: " + 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: " + 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: " + 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;
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());
drawString(
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();
@@ -1248,10 +1248,9 @@ void Gui::tick()
// We don't show the guiMessages when a menu is up, so don't fade them out
if(!ui.GetMenuDisplayed(iPad))
{
AUTO_VAR(itEnd, guiMessages[iPad].end());
for (AUTO_VAR(it, guiMessages[iPad].begin()); it != itEnd; it++)
{
(*it).ticks++;
for (auto& it : guiMessages[iPad])
{
it.ticks++;
}
}
}
+1 -3
View File
@@ -37,10 +37,8 @@ void GuiParticles::render(float a)
#if 0
mc->textures->bindTexture(L"/gui/particles.png");
AUTO_VAR(itEnd, particles.end());
for (AUTO_VAR(it, particles.begin()); it != itEnd; it++)
for ( GuiParticle *gp : particles )
{
GuiParticle *gp = *it; //particles[i];
int xx = (int) (gp->xo + (gp->x - gp->xo) * a - 4);
int yy = (int) (gp->yo + (gp->y - gp->yo) * a - 4);
+2 -2
View File
@@ -83,9 +83,9 @@ ResourceLocation *HorseRenderer::getOrCreateLayeredTextureLocation(shared_ptr<En
{
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())
{
location = it->second;
+1 -1
View File
@@ -53,7 +53,7 @@ ResourceLocation *HumanoidMobRenderer::getArmorLocation(ArmorItem *armorItem, in
case 4:
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);
+2 -2
View File
@@ -607,11 +607,11 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shar
int count = item->count;
if(count > 64)
{
amount = _toString<int>(64) + L"+";
amount = L"64+";
}
else
{
amount = _toString<int>(item->count);
amount = std::to_wstring(item->count);
}
}
MemSect(0);
+34 -44
View File
@@ -533,19 +533,14 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
vector<shared_ptr<Entity> > entities = level[playerIndex]->getAllEntities();
totalEntities = (int)entities.size();
AUTO_VAR(itEndGE, level[playerIndex]->globalEntities.end());
for (AUTO_VAR(it, level[playerIndex]->globalEntities.begin()); it != itEndGE; it++)
for (auto& entity : level[playerIndex]->globalEntities)
{
shared_ptr<Entity> entity = *it; //level->globalEntities[i];
renderedEntities++;
if (entity->shouldRender(cam)) EntityRenderDispatcher::instance->render(entity, a);
}
AUTO_VAR(itEndEnts, entities.end());
for (AUTO_VAR(it, entities.begin()); it != itEndEnts; it++)
for (auto& entity : entities)
{
shared_ptr<Entity> entity = *it; //entities[i];
bool shouldRender = (entity->shouldRender(cam) && (entity->noCulling || culler->isVisible(entity->bb)));
// Render the mob if the mob's leash holder is within the culler
@@ -580,25 +575,25 @@ 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
// is calculated in the same way as the global flags.
EnterCriticalSection(&m_csRenderableTileEntities);
for (AUTO_VAR(it, renderableTileEntities.begin()); it != renderableTileEntities.end(); it++)
{
int idx = it->first;
for (auto & it : renderableTileEntities)
{
int idx = it.first;
// Don't render if it isn't in the same dimension as this player
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
for (AUTO_VAR(it, renderableTileEntities.begin()); it != renderableTileEntities.end();)
{
for (auto it = renderableTileEntities.begin(); it != renderableTileEntities.end();)
{
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((*it2)->shouldRemoveForRender())
{
@@ -628,12 +623,12 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
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()
{
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)
@@ -888,11 +883,8 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
renderLists[l].clear();
}
AUTO_VAR(itEnd, _renderChunks.end());
for (AUTO_VAR(it, _renderChunks.begin()); it != itEnd; it++)
for ( Chunk *chunk : _renderChunks )
{
Chunk *chunk = *it; //_renderChunks[i];
int list = -1;
for (int l = 0; l < lists; l++)
{
@@ -932,8 +924,8 @@ void LevelRenderer::tick()
if ((ticks % SharedConstants::TICKS_PER_SECOND) == 0)
{
AUTO_VAR(it , destroyingBlocks.begin());
while (it != destroyingBlocks.end())
auto it = destroyingBlocks.begin();
while (it != destroyingBlocks.end())
{
BlockDestructionProgress *block = it->second;
@@ -1970,8 +1962,8 @@ bool LevelRenderer::updateDirtyChunks()
// Is this chunk nearer than our nearest?
#ifdef _LARGE_WORLDS
bool isNearer = nearestClipChunks.empty();
AUTO_VAR(itNearest, nearestClipChunks.begin());
for(; itNearest != nearestClipChunks.end(); ++itNearest)
auto itNearest = nearestClipChunks.begin();
for(; itNearest != nearestClipChunks.end(); ++itNearest)
{
isNearer = distSqWeighted < itNearest->second;
if(isNearer) break;
@@ -2002,7 +1994,7 @@ bool LevelRenderer::updateDirtyChunks()
nearChunk = pClipChunk;
minDistSq = distSqWeighted;
#ifdef _LARGE_WORLDS
nearestClipChunks.insert(itNearest, std::pair<ClipChunk *, int>(nearChunk, minDistSq) );
nearestClipChunks.insert(itNearest, std::make_pair(nearChunk, minDistSq) );
if(nearestClipChunks.size() > maxNearestChunks)
{
nearestClipChunks.pop_back();
@@ -2044,9 +2036,9 @@ bool LevelRenderer::updateDirtyChunks()
if(!nearestClipChunks.empty())
{
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
// 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.
@@ -2233,8 +2225,8 @@ void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr<Player> pla
#endif
t->noColor();
AUTO_VAR(it, destroyingBlocks.begin());
while (it != destroyingBlocks.end())
auto it = destroyingBlocks.begin();
while (it != destroyingBlocks.end())
{
BlockDestructionProgress *block = it->second;
double xd = block->getX() - xo;
@@ -3284,8 +3276,8 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres
{
if (progress < 0 || progress >= 10)
{
AUTO_VAR(it, destroyingBlocks.find(id));
if(it != destroyingBlocks.end())
auto it = destroyingBlocks.find(id);
if(it != destroyingBlocks.end())
{
delete it->second;
destroyingBlocks.erase(it);
@@ -3296,8 +3288,8 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres
{
BlockDestructionProgress *entry = NULL;
AUTO_VAR(it, destroyingBlocks.find(id));
if(it != destroyingBlocks.end()) entry = it->second;
auto it = destroyingBlocks.find(id);
if(it != destroyingBlocks.end()) entry = it->second;
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++)
{
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()
{
EnterCriticalSection(&m_csRenderableTileEntities);
AUTO_VAR(itChunkEnd, renderableTileEntities.end());
for (AUTO_VAR(it, renderableTileEntities.begin()); it != itChunkEnd; it++)
{
AUTO_VAR(itTEEnd, it->second.end());
for( AUTO_VAR(it2, it->second.begin()); it2 != itTEEnd; it2++ )
for (auto& it : renderableTileEntities)
{
for(auto& it2 : it.second)
{
(*it2)->upgradeRenderRemoveStage();
it2->upgradeRenderRemoveStage();
}
}
LeaveCriticalSection(&m_csRenderableTileEntities);
@@ -3529,9 +3519,9 @@ LevelRenderer::DestroyedTileManager::RecentTile::RecentTile(int x, int y, int z,
LevelRenderer::DestroyedTileManager::RecentTile::~RecentTile()
{
for( AUTO_VAR(it, boxes.begin()); it!= boxes.end(); it++ )
for(auto& it : boxes)
{
delete *it;
delete it;
}
}
+4 -4
View File
@@ -23,8 +23,8 @@ int MemoryTracker::genTextures()
void MemoryTracker::releaseLists(int id)
{
AUTO_VAR(it, GL_LIST_IDS.find(id));
if( it != GL_LIST_IDS.end() )
auto it = GL_LIST_IDS.find(id);
if( it != GL_LIST_IDS.end() )
{
glDeleteLists(id, it->second);
GL_LIST_IDS.erase(it);
@@ -43,9 +43,9 @@ void MemoryTracker::releaseTextures()
void MemoryTracker::release()
{
//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();
+21
View File
@@ -747,6 +747,9 @@
<LinkIncremental>true</LinkIncremental>
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">
<LinkIncremental>true</LinkIncremental>
@@ -778,6 +781,9 @@
<LinkIncremental>false</LinkIncremental>
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64EC'">
<LinkIncremental>true</LinkIncremental>
@@ -793,6 +799,9 @@
<LinkIncremental>true</LinkIncremental>
<ImageXexOutput>$(OutDir)$(ProjectName)_D.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\..\Minecraft.World\x64headers;$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_Vita|ARM64EC'">
<LinkIncremental>true</LinkIncremental>
@@ -909,6 +918,9 @@
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|ARM64EC'">
<LinkIncremental>false</LinkIncremental>
@@ -927,6 +939,9 @@
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|ARM64EC'">
<LinkIncremental>false</LinkIncremental>
@@ -945,6 +960,9 @@
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseForArt|ARM64EC'">
<LinkIncremental>false</LinkIncremental>
@@ -963,6 +981,9 @@
<OutputFile>$(OutDir)default$(TargetExt)</OutputFile>
<ImageXexOutput>$(OutDir)default.xex</ImageXexOutput>
<IncludePath>$(ProjectDir)\Xbox\Sentient\Include;$(IncludePath)</IncludePath>
<RunCodeAnalysis>false</RunCodeAnalysis>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableClangTidyCodeAnalysis>false</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|ARM64EC'">
<LinkIncremental>false</LinkIncremental>
+9 -9
View File
@@ -741,7 +741,7 @@ void Minecraft::run()
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;
lastTime += 1000;
frames = 0;
@@ -2034,7 +2034,7 @@ void Minecraft::run_middle()
while (System::nanoTime() >= lastTime + 1000000000)
{
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);
Chunk::updates = 0;
lastTime += 1000000000;
@@ -4432,7 +4432,7 @@ void Minecraft::prepareLevel(int title)
wstring Minecraft::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()
@@ -4610,7 +4610,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const
}
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
@@ -4705,7 +4705,7 @@ void Minecraft::main()
// 4J-PB - Can't call this for the first 5 seconds of a game - MS rule
//if (ProfileManager.IsFullVersion())
{
name = L"Player" + _toString<__int64>(System::currentTimeMillis() % 1000);
name = L"Player" + std::to_wstring(System::currentTimeMillis() % 1000);
sessionId = L"-";
/* 4J - TODO - get a session ID from somewhere?
if (args.length > 0) name = args[0];
@@ -5106,8 +5106,8 @@ void Minecraft::tickAllConnections()
bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
{
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName));
if( it == m_pendingTextureRequests.end() )
auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
if( it == m_pendingTextureRequests.end() )
{
m_pendingTextureRequests.push_back(textureName);
return true;
@@ -5117,8 +5117,8 @@ bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
void Minecraft::handleClientTextureReceived(const wstring &textureName)
{
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName));
if( it != m_pendingTextureRequests.end() )
auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
if( it != m_pendingTextureRequests.end() )
{
m_pendingTextureRequests.erase(it);
}
+16 -16
View File
@@ -211,7 +211,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
{
wstring playerNames = (playerList != NULL) ? playerList->getPlayerNames() : L"";
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;
}
@@ -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;
}
@@ -304,7 +304,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
}
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;
}
@@ -427,7 +427,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
}
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;
}
if (amount <= 0)
@@ -442,7 +442,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
{
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;
}
@@ -484,7 +484,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
Enchantment *enchantment = Enchantment::enchantments[enchantmentId];
if (enchantment == NULL)
{
server->warn(L"Unknown enchantment id: " + _toString(enchantmentId));
server->warn(L"Unknown enchantment id: " + std::to_wstring(enchantmentId));
return false;
}
if (!enchantment->canEnchant(selectedItem))
@@ -514,7 +514,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom
}
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;
}
@@ -2064,21 +2064,21 @@ void MinecraftServer::broadcastStopSavingPacket()
void MinecraftServer::tick()
{
vector<wstring> toRemove;
for (AUTO_VAR(it, ironTimers.begin()); it != ironTimers.end(); it++ )
{
int t = it->second;
for ( auto& it : ironTimers )
{
int t = it.second;
if (t > 0)
{
ironTimers[it->first] = t - 1;
ironTimers[it.first] = t - 1;
}
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();
@@ -2316,8 +2316,8 @@ void MinecraftServer::chunkPacketManagement_PreTick()
do
{
int longestTime = 0;
AUTO_VAR(playerConnectionBest,playersOrig.begin());
for( AUTO_VAR(it, playersOrig.begin()); it != playersOrig.end(); it++)
auto playerConnectionBest = playersOrig.begin();
for( auto it = playersOrig.begin(); it != playersOrig.end(); it++)
{
int thisTime = 0;
INetworkPlayer *np = (*it)->getNetworkPlayer();
+2 -8
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"));
AUTO_VAR(itEnd, data->decorations.end());
#ifdef _LARGE_WORLDS
vector<MapItemSavedData::MapDecoration *> m_edgeIcons;
#endif
// 4J-PB - stack the map icons
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;
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));
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;
imgIndex -= 16;
+3 -7
View File
@@ -71,14 +71,10 @@ void ModelPart::addChild(ModelPart *child)
ModelPart * ModelPart::retrieveChild(SKIN_BOX *pBox)
{
for(AUTO_VAR(it, children.begin()); it != children.end(); ++it)
for( ModelPart *child : children )
{
ModelPart *child=*it;
for(AUTO_VAR(itcube, child->cubes.begin()); itcube != child->cubes.end(); ++itcube)
{
Cube *pCube=*itcube;
for ( const Cube *pCube : child->cubes )
{
if((pCube->x0==pBox->fX) &&
(pCube->y0==pBox->fY) &&
(pCube->z0==pBox->fZ) &&
+7 -5
View File
@@ -105,11 +105,13 @@ MultiPlayerChunkCache::~MultiPlayerChunkCache()
delete cache;
delete hasData;
AUTO_VAR(itEnd, loadedChunkList.end());
for (AUTO_VAR(it, loadedChunkList.begin()); it != itEnd; it++)
delete *it;
for (auto& it : loadedChunkList)
{
if ( it )
delete it;
}
DeleteCriticalSection(&m_csLoadCreate);
DeleteCriticalSection(&m_csLoadCreate);
}
@@ -294,7 +296,7 @@ wstring MultiPlayerChunkCache::gatherStats()
EnterCriticalSection(&m_csLoadCreate);
int size = (int)loadedChunkList.size();
LeaveCriticalSection(&m_csLoadCreate);
return L"MultiplayerChunkCache: " + _toString<int>(size);
return L"MultiplayerChunkCache: " + std::to_wstring(size);
}
+55 -52
View File
@@ -131,9 +131,10 @@ void MultiPlayerLevel::tick()
PIXBeginNamedEvent(0,"Connection ticking");
// 4J HEG - Copy the connections vector to prevent crash when moving to Nether
vector<ClientConnection *> connectionsTemp = connections;
for(AUTO_VAR(connection, connectionsTemp.begin()); connection < connectionsTemp.end(); ++connection )
{
(*connection)->tick();
for (auto connection : connectionsTemp )
{
if ( connection )
connection->tick();
}
PIXEndNamedEvent();
@@ -383,10 +384,8 @@ void MultiPlayerLevel::tickTiles()
{
ChunkPos cp = chunksToPoll.get(i);
#else
AUTO_VAR(itEndCtp, chunksToPoll.end());
for (AUTO_VAR(it, chunksToPoll.begin()); it != itEndCtp; it++)
for (ChunkPos cp : chunksToPoll)
{
ChunkPos cp = *it;
#endif
int xo = cp.x * 16;
int zo = cp.z * 16;
@@ -433,8 +432,8 @@ 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,
// in particular the MultiPlayerLocalPlayer when they die
AUTO_VAR(it, reEntries.find(e));
if (it!=reEntries.end())
auto it = reEntries.find(e);
if (it!=reEntries.end())
{
reEntries.erase(it);
}
@@ -446,8 +445,8 @@ void MultiPlayerLevel::removeEntity(shared_ptr<Entity> e)
void MultiPlayerLevel::entityAdded(shared_ptr<Entity> e)
{
Level::entityAdded(e);
AUTO_VAR(it, reEntries.find(e));
if (it!=reEntries.end())
auto it = reEntries.find(e);
if (it!=reEntries.end())
{
reEntries.erase(it);
}
@@ -456,8 +455,8 @@ void MultiPlayerLevel::entityAdded(shared_ptr<Entity> e)
void MultiPlayerLevel::entityRemoved(shared_ptr<Entity> e)
{
Level::entityRemoved(e);
AUTO_VAR(it, forced.find(e));
if (it!=forced.end())
auto it = forced.find(e);
if (it!=forced.end())
{
reEntries.insert(e);
}
@@ -482,16 +481,16 @@ void MultiPlayerLevel::putEntity(int id, shared_ptr<Entity> e)
shared_ptr<Entity> MultiPlayerLevel::getEntity(int id)
{
AUTO_VAR(it, entitiesById.find(id));
if( it == entitiesById.end() ) return nullptr;
auto it = entitiesById.find(id);
if( it == entitiesById.end() ) return nullptr;
return it->second;
}
shared_ptr<Entity> MultiPlayerLevel::removeEntity(int id)
{
shared_ptr<Entity> e;
AUTO_VAR(it, entitiesById.find(id));
if( it != entitiesById.end() )
auto it = entitiesById.find(id);
if( it != entitiesById.end() )
{
e = it->second;
entitiesById.erase(it);
@@ -508,19 +507,20 @@ 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
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;
AUTO_VAR(reIt, reEntries.find(e));
if (reIt!=reEntries.end())
for (auto& e : *list )
{
reEntries.erase(reIt);
}
auto reIt = reEntries.find(e);
if (reIt!=reEntries.end())
{
reEntries.erase(reIt);
}
forced.erase(e);
forced.erase(e);
}
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)
@@ -615,16 +615,18 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/)
{
if( sendDisconnect )
{
for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it )
{
(*it)->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
for (auto& it : connections )
{
if ( it )
it->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
}
}
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( AUTO_VAR(it, chunksToAnimate.begin()); it != chunksToAnimate.end(); it++ )
for(int packed : chunksToAnimate)
{
int packed = *it;
int cx = ( packed << 8 ) >> 24;
int cy = ( packed << 16 ) >> 24;
int cz = ( packed << 24 ) >> 24;
@@ -809,12 +810,12 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals()
//entities.removeAll(entitiesToRemove);
EnterCriticalSection(&m_entitiesCS);
for( AUTO_VAR(it, entities.begin()); it != entities.end(); )
{
for (auto it = entities.begin(); it != entities.end();)
{
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;
break;
@@ -831,29 +832,30 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals()
}
LeaveCriticalSection(&m_entitiesCS);
AUTO_VAR(endIt, entitiesToRemove.end());
for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++)
for (auto& e : entitiesToRemove)
{
shared_ptr<Entity> e = *it;
int xc = e->xChunk;
int zc = e->zChunk;
if (e->inChunk && hasChunk(xc, zc))
if ( e )
{
getChunk(xc, zc)->removeEntity(e);
int xc = e->xChunk;
int zc = e->zChunk;
if (e->inChunk && hasChunk(xc, zc))
{
getChunk(xc, zc)->removeEntity(e);
}
}
}
// 4J Stu - Is there a reason do this in a separate loop? Thats what the Java does...
endIt = entitiesToRemove.end();
for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++)
for (auto& it : entitiesToRemove)
{
entityRemoved(*it);
if ( it )
entityRemoved(it);
}
entitiesToRemove.clear();
//for (int i = 0; i < entities.size(); i++)
EnterCriticalSection(&m_entitiesCS);
vector<shared_ptr<Entity> >::iterator it = entities.begin();
auto it = entities.begin();
while( it != entities.end() )
{
shared_ptr<Entity> e = *it;//entities.at(i);
@@ -900,8 +902,8 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc
c->sendAndDisconnect( shared_ptr<DisconnectPacket>( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );
}
AUTO_VAR(it, find( connections.begin(), connections.end(), c ));
if( it != connections.end() )
auto it = find(connections.begin(), connections.end(), c);
if( it != connections.end() )
{
connections.erase( it );
}
@@ -910,9 +912,10 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection *c, bool sendDisc
void MultiPlayerLevel::tickAllConnections()
{
PIXBeginNamedEvent(0,"Connection ticking");
for(AUTO_VAR(it, connections.begin()); it < connections.end(); ++it )
{
(*it)->tick();
for (auto& it : connections )
{
if ( it )
it->tick();
}
PIXEndNamedEvent();
}
+17 -17
View File
@@ -328,7 +328,7 @@ wstring Options::getMessage(const Options::Option *item)
{
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)
{
if (progressValue == 0)
@@ -339,7 +339,7 @@ wstring Options::getMessage(const Options::Option *item)
{
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)
{
if (progressValue == 0)
@@ -350,7 +350,7 @@ wstring Options::getMessage(const Options::Option *item)
{
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
{
@@ -358,7 +358,7 @@ wstring Options::getMessage(const Options::Option *item)
{
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())
{
@@ -486,29 +486,29 @@ void Options::save()
DataOutputStream dos = DataOutputStream(&fos);
// PrintWriter pw = new PrintWriter(new FileWriter(optionsFile));
dos.writeChars(L"music:" + _toString<float>(music) + L"\n");
dos.writeChars(L"sound:" + _toString<float>(sound) + L"\n");
dos.writeChars(L"music:" + std::to_wstring(music) + 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"mouseSensitivity:" + _toString<float>(sensitivity));
dos.writeChars(L"fov:" + _toString<float>(fov));
dos.writeChars(L"gamma:" + _toString<float>(gamma));
dos.writeChars(L"viewDistance:" + _toString<int>(viewDistance));
dos.writeChars(L"guiScale:" + _toString<int>(guiScale));
dos.writeChars(L"particles:" + _toString<int>(particles));
dos.writeChars(L"mouseSensitivity:" + std::to_wstring(sensitivity));
dos.writeChars(L"fov:" + std::to_wstring(fov));
dos.writeChars(L"gamma:" + std::to_wstring(gamma));
dos.writeChars(L"viewDistance:" + std::to_wstring(viewDistance));
dos.writeChars(L"guiScale:" + std::to_wstring(guiScale));
dos.writeChars(L"particles:" + std::to_wstring(particles));
dos.writeChars(L"bobView:" + wstring(bobView ? 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"fpsLimit:" + _toString<int>(framerateLimit));
dos.writeChars(L"difficulty:" + _toString<int>(difficulty));
dos.writeChars(L"fpsLimit:" + std::to_wstring(framerateLimit));
dos.writeChars(L"difficulty:" + std::to_wstring(difficulty));
dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false"));
dos.writeChars(L"ao:" + wstring(ambientOcclusion ? L"true" : L"false"));
dos.writeChars(L"clouds:" + _toString<bool>(renderClouds));
dos.writeChars(ambientOcclusion ? L"ao:true" : L"ao:false");
dos.writeChars(renderClouds ? L"clouds:true" : L"clouds:false");
dos.writeChars(L"skin:" + skin);
dos.writeChars(L"lastServer:" + lastMpIp);
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();
@@ -1588,8 +1588,8 @@ 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
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( ( playerType != SQRNetworkPlayer::SNP_TYPE_REMOTE ) || ( (*it)->m_roomMemberId == memberId ) )
@@ -1759,8 +1759,8 @@ 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
// 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 )
{
m_listener->HandlePlayerLeaving(*it);
@@ -1964,8 +1964,8 @@ void SQRNetworkManager_Orbis::RemoveNetworkPlayers( int mask )
{
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;
if( (player->m_roomMemberId == m_localMemberId ) && ( ( 1 << player->m_localPlayerIdx ) & mask ) )
{
@@ -2606,8 +2606,8 @@ bool SQRNetworkManager_Orbis::CreateRudpConnections(SceNpMatching2RoomId roomId,
SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx)
{
AUTO_VAR(it,m_RudpCtxToPlayerMap.find(rudpCtx));
if( it != m_RudpCtxToPlayerMap.end() )
auto it = m_RudpCtxToPlayerMap.find(rudpCtx);
if( it != m_RudpCtxToPlayerMap.end() )
{
return it->second;
}
@@ -2618,8 +2618,8 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx)
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 ) )
{
return it->second;
@@ -170,7 +170,3 @@ typedef LPVOID LPSECURITY_ATTRIBUTES;
#define __in_ecount(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