diff --git a/Minecraft.Client/Level/MultiPlayerLevel.cpp b/Minecraft.Client/Level/MultiPlayerLevel.cpp index 071f81fa2..c12165ba7 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.cpp +++ b/Minecraft.Client/Level/MultiPlayerLevel.cpp @@ -131,7 +131,7 @@ void MultiPlayerLevel::tick() { // 4J HEG - Copy the connections vector to prevent crash when moving to // Nether std::vector connectionsTemp = connections; - for (AUTO_VAR(connection, connectionsTemp.begin()); + for (auto connection = connectionsTemp.begin(); connection < connectionsTemp.end(); ++connection) { (*connection)->tick(); } @@ -391,8 +391,8 @@ void MultiPlayerLevel::tickTiles() { PIXEndNamedEvent(); PIXBeginNamedEvent(0, "Ticking client side tiles"); - AUTO_VAR(itEndCtp, chunksToPoll.end()); - for (AUTO_VAR(it, chunksToPoll.begin()); it != itEndCtp; it++) { + auto itEndCtp = chunksToPoll.end(); + for (auto it = chunksToPoll.begin(); it != itEndCtp; it++) { ChunkPos cp = *it; int xo = cp.x * 16; int zo = cp.z * 16; @@ -432,7 +432,7 @@ void MultiPlayerLevel::removeEntity(std::shared_ptr 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)); + auto it = reEntries.find(e); if (it != reEntries.end()) { reEntries.erase(it); } @@ -443,7 +443,7 @@ void MultiPlayerLevel::removeEntity(std::shared_ptr e) { void MultiPlayerLevel::entityAdded(std::shared_ptr e) { Level::entityAdded(e); - AUTO_VAR(it, reEntries.find(e)); + auto it = reEntries.find(e); if (it != reEntries.end()) { reEntries.erase(it); } @@ -451,7 +451,7 @@ void MultiPlayerLevel::entityAdded(std::shared_ptr e) { void MultiPlayerLevel::entityRemoved(std::shared_ptr e) { Level::entityRemoved(e); - AUTO_VAR(it, forced.find(e)); + auto it = forced.find(e); if (it != forced.end()) { reEntries.insert(e); } @@ -472,14 +472,14 @@ void MultiPlayerLevel::putEntity(int id, std::shared_ptr e) { } std::shared_ptr MultiPlayerLevel::getEntity(int id) { - AUTO_VAR(it, entitiesById.find(id)); + auto it = entitiesById.find(id); if (it == entitiesById.end()) return nullptr; return it->second; } std::shared_ptr MultiPlayerLevel::removeEntity(int id) { std::shared_ptr e; - AUTO_VAR(it, entitiesById.find(id)); + auto it = entitiesById.find(id); if (it != entitiesById.end()) { e = it->second; entitiesById.erase(it); @@ -495,10 +495,10 @@ std::shared_ptr MultiPlayerLevel::removeEntity(int id) { // remove entities slightly differently void MultiPlayerLevel::removeEntities( std::vector >* list) { - for (AUTO_VAR(it, list->begin()); it < list->end(); ++it) { + for (auto it = list->begin(); it < list->end(); ++it) { std::shared_ptr e = *it; - AUTO_VAR(reIt, reEntries.find(e)); + auto reIt = reEntries.find(e); if (reIt != reEntries.end()) { reEntries.erase(reIt); } @@ -613,12 +613,12 @@ bool MultiPlayerLevel::doSetTileAndData(int x, int y, int z, int tile, void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) { if (sendDisconnect) { - for (AUTO_VAR(it, connections.begin()); it < connections.end(); ++it) { + for (auto it = connections.begin(); it < connections.end(); ++it) { (*it)->sendAndDisconnect(std::shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting))); } } else { - for (AUTO_VAR(it, connections.begin()); it < connections.end(); ++it) { + for (auto it = connections.begin(); it < connections.end(); ++it) { (*it)->close(); } } @@ -704,7 +704,7 @@ void MultiPlayerLevel::animateTickDoWork() { MemSect(0); for (int i = 0; i < ticksPerChunk; i++) { - for (AUTO_VAR(it, chunksToAnimate.begin()); it != chunksToAnimate.end(); + for (auto it = chunksToAnimate.begin(); it != chunksToAnimate.end(); it++) { int packed = *it; // 4jcraft changed the extraction logic to be safe @@ -809,9 +809,9 @@ 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()); + for (auto it2 = entitiesToRemove.begin(); it2 != entitiesToRemove.end(); it2++) { if ((*it) == (*it2)) { found = true; @@ -826,8 +826,8 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() { } LeaveCriticalSection(&m_entitiesCS); - AUTO_VAR(endIt, entitiesToRemove.end()); - for (AUTO_VAR(it, entitiesToRemove.begin()); it != endIt; it++) { + auto endIt = entitiesToRemove.end(); + for (auto it = entitiesToRemove.begin(); it != endIt; it++) { std::shared_ptr e = *it; int xc = e->xChunk; int zc = e->zChunk; @@ -839,7 +839,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() { // 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.begin(); it != endIt; it++) { entityRemoved(*it); } entitiesToRemove.clear(); @@ -884,7 +884,7 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection* c, new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting))); } - AUTO_VAR(it, find(connections.begin(), connections.end(), c)); + auto it = find(connections.begin(), connections.end(), c); if (it != connections.end()) { connections.erase(it); } @@ -892,7 +892,7 @@ void MultiPlayerLevel::removeClientConnection(ClientConnection* c, void MultiPlayerLevel::tickAllConnections() { PIXBeginNamedEvent(0, "Connection ticking"); - for (AUTO_VAR(it, connections.begin()); it < connections.end(); ++it) { + for (auto it = connections.begin(); it < connections.end(); ++it) { (*it)->tick(); } PIXEndNamedEvent(); diff --git a/Minecraft.Client/Level/ServerLevel.cpp b/Minecraft.Client/Level/ServerLevel.cpp index 00e943a91..22499a558 100644 --- a/Minecraft.Client/Level/ServerLevel.cpp +++ b/Minecraft.Client/Level/ServerLevel.cpp @@ -189,7 +189,7 @@ ServerLevel::~ServerLevel() { delete mobSpawner; EnterCriticalSection(&m_csQueueSendTileUpdates); - for (AUTO_VAR(it, m_queuedSendTileUpdates.begin()); + for (auto it = m_queuedSendTileUpdates.begin(); it != m_queuedSendTileUpdates.end(); ++it) { Pos* p = *it; delete p; @@ -270,8 +270,8 @@ void ServerLevel::tick() { if (!SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward // from 1.8.2 { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->skyColorChanged(); } } @@ -361,8 +361,8 @@ void ServerLevel::updateSleepingPlayerList() { allPlayersSleeping = !players.empty(); m_bAtLeastOnePlayerSleeping = false; - AUTO_VAR(itEnd, players.end()); - for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { + auto itEnd = players.end(); + for (auto it = players.begin(); it != itEnd; it++) { if (!(*it)->isSleeping()) { allPlayersSleeping = false; // break; @@ -377,7 +377,7 @@ void ServerLevel::awakenAllPlayers() { allPlayersSleeping = false; m_bAtLeastOnePlayerSleeping = false; - AUTO_VAR(itEnd, players.end()); + auto itEnd = players.end(); for (std::vector >::iterator it = players.begin(); it != itEnd; it++) { if ((*it)->isSleeping()) { @@ -398,7 +398,7 @@ void ServerLevel::stopWeather() { bool ServerLevel::allPlayersAreSleeping() { if (allPlayersSleeping && !isClientSide) { // all players are sleeping, but have they slept long enough? - AUTO_VAR(itEnd, players.end()); + auto itEnd = players.end(); for (std::vector >::iterator it = players.begin(); it != itEnd; it++) { @@ -483,8 +483,8 @@ void ServerLevel::tickTiles() { if (app.GetGameSettingsDebugMask() & (1L << eDebugSetting_RegularLightning)) prob = 100; - AUTO_VAR(itEndCtp, chunksToPoll.end()); - for (AUTO_VAR(it, chunksToPoll.begin()); it != itEndCtp; it++) { + auto itEndCtp = chunksToPoll.end(); + for (auto it = chunksToPoll.begin(); it != itEndCtp; it++) { ChunkPos cp = *it; int xo = cp.x * 16; int zo = cp.z * 16; @@ -653,7 +653,7 @@ bool ServerLevel::tickPendingTicks(bool force) { } if (count > MAX_TICK_TILES_PER_TICK) count = MAX_TICK_TILES_PER_TICK; - AUTO_VAR(itTickList, tickNextTickList.begin()); + auto itTickList = tickNextTickList.begin(); for (int i = 0; i < count; i++) { TickNextTickData td = *(itTickList); if (!force && td.m_delay > levelData->getGameTime()) { @@ -665,7 +665,7 @@ bool ServerLevel::tickPendingTicks(bool force) { toBeTicked.push_back(td); } - for (AUTO_VAR(it, toBeTicked.begin()); it != toBeTicked.end();) { + for (auto it = toBeTicked.begin(); it != toBeTicked.end();) { TickNextTickData td = *it; it = toBeTicked.erase(it); @@ -707,7 +707,7 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, for (int i = 0; i < 2; i++) { if (i == 0) { - for (AUTO_VAR(it, tickNextTickList.begin()); + for (auto it = tickNextTickList.begin(); it != tickNextTickList.end();) { TickNextTickData td = *it; @@ -729,7 +729,7 @@ std::vector* ServerLevel::fetchTicksInChunk(LevelChunk* chunk, if (!toBeTicked.empty()) { app.DebugPrintf("To be ticked size: %d\n", toBeTicked.size()); } - for (AUTO_VAR(it, toBeTicked.begin()); it != toBeTicked.end();) { + for (auto it = toBeTicked.begin(); it != toBeTicked.end();) { TickNextTickData td = *it; if (td.x >= xMin && td.x < xMax && td.z >= zMin && @@ -954,7 +954,7 @@ void ServerLevel::save(bool force, ProgressListener* progressListener, // clean cache std::vector* loadedChunkList = cache->getLoadedChunkList(); - for (AUTO_VAR(it, loadedChunkList->begin()); + for (auto it = loadedChunkList->begin(); it != loadedChunkList->end(); ++it) { LevelChunk* lc = *it; if (!chunkMap->hasChunk(lc->x, lc->z)) { @@ -1010,7 +1010,7 @@ void ServerLevel::entityAdded(std::shared_ptr e) { std::vector >* es = e->getSubEntities(); if (es != NULL) { // for (int i = 0; i < es.length; i++) - for (AUTO_VAR(it, es->begin()); it != es->end(); ++it) { + for (auto it = es->begin(); it != es->end(); ++it) { entitiesById.insert( intEntityMap::value_type((*it)->entityId, (*it))); } @@ -1024,7 +1024,7 @@ void ServerLevel::entityRemoved(std::shared_ptr e) { std::vector >* es = e->getSubEntities(); if (es != NULL) { // for (int i = 0; i < es.length; i++) - for (AUTO_VAR(it, es->begin()); it != es->end(); ++it) { + for (auto it = es->begin(); it != es->end(); ++it) { entitiesById.erase((*it)->entityId); } } @@ -1070,7 +1070,7 @@ std::shared_ptr ServerLevel::explode(std::shared_ptr source, } std::vector > sentTo; - for (AUTO_VAR(it, players.begin()); it != players.end(); ++it) { + for (auto it = players.begin(); it != players.end(); ++it) { std::shared_ptr player = std::dynamic_pointer_cast(*it); if (player->dimension != dimension->id) continue; @@ -1115,7 +1115,7 @@ void ServerLevel::tileEvent(int x, int y, int z, int tile, int b0, int b1) { // TileEventPacket(x, y, z, b0, b1)); TileEventData newEvent(x, y, z, tile, b0, b1); // for (TileEventData te : tileEvents[activeTileEventsList]) - for (AUTO_VAR(it, tileEvents[activeTileEventsList].begin()); + for (auto it = tileEvents[activeTileEventsList].begin(); it != tileEvents[activeTileEventsList].end(); ++it) { if ((*it).equals(newEvent)) { return; @@ -1132,7 +1132,7 @@ void ServerLevel::runTileEvents() { activeTileEventsList ^= 1; // for (TileEventData te : tileEvents[runList]) - for (AUTO_VAR(it, tileEvents[runList].begin()); + for (auto it = tileEvents[runList].begin(); it != tileEvents[runList].end(); ++it) { if (doTileEvent(&(*it))) { TileEventData te = *it; @@ -1185,7 +1185,7 @@ void ServerLevel::setTimeAndAdjustTileTicks(int64_t newTime) { // in the set. Instead move to a vector, do the adjustment, put back in the // set. std::vector temp; - for (AUTO_VAR(it, tickNextTickList.begin()); it != tickNextTickList.end(); + for (auto it = tickNextTickList.begin(); it != tickNextTickList.end(); ++it) { temp.push_back(*it); temp.back().m_delay += delta; @@ -1215,7 +1215,7 @@ void ServerLevel::sendParticles(const std::wstring& name, double x, double y, name, (float)x, (float)y, (float)z, (float)xDist, (float)yDist, (float)zDist, (float)speed, count)); - for (AUTO_VAR(it, players.begin()); it != players.end(); ++it) { + for (auto it = players.begin(); it != players.end(); ++it) { std::shared_ptr player = std::dynamic_pointer_cast(*it); player->connection->send(packet); @@ -1232,7 +1232,7 @@ void ServerLevel::queueSendTileUpdate(int x, int y, int z) { void ServerLevel::runQueuedSendTileUpdates() { EnterCriticalSection(&m_csQueueSendTileUpdates); - for (AUTO_VAR(it, m_queuedSendTileUpdates.begin()); + for (auto it = m_queuedSendTileUpdates.begin(); it != m_queuedSendTileUpdates.end(); ++it) { Pos* p = *it; sendTileUpdated(p->x, p->y, p->z); @@ -1372,7 +1372,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); - AUTO_VAR(it, find(m_itemEntities.begin(), m_itemEntities.end(), e)); + auto it = find(m_itemEntities.begin(), m_itemEntities.end(), e); if (it != m_itemEntities.end()) { // printf("Item to remove found\n"); m_itemEntities.erase(it); @@ -1384,8 +1384,8 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: item entity count //%d\n",m_itemEntities.size()); - AUTO_VAR(it, - find(m_hangingEntities.begin(), m_hangingEntities.end(), e)); + auto it = + find(m_hangingEntities.begin(), m_hangingEntities.end(), e); if (it != m_hangingEntities.end()) { // printf("Item to remove found\n"); m_hangingEntities.erase(it); @@ -1397,7 +1397,7 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: arrow entity count //%d\n",m_arrowEntities.size()); - AUTO_VAR(it, find(m_arrowEntities.begin(), m_arrowEntities.end(), e)); + auto it = find(m_arrowEntities.begin(), m_arrowEntities.end(), e); if (it != m_arrowEntities.end()) { // printf("Item to remove found\n"); m_arrowEntities.erase(it); @@ -1409,8 +1409,8 @@ void ServerLevel::entityRemovedExtra(std::shared_ptr e) { EnterCriticalSection(&m_limiterCS); // printf("entity removed: experience orb entity count //%d\n",m_arrowEntities.size()); - AUTO_VAR(it, find(m_experienceOrbEntities.begin(), - m_experienceOrbEntities.end(), e)); + auto it = find(m_experienceOrbEntities.begin(), + m_experienceOrbEntities.end(), e); if (it != m_experienceOrbEntities.end()) { // printf("Item to remove found\n"); m_experienceOrbEntities.erase(it); diff --git a/Minecraft.Client/Level/ServerLevelListener.cpp b/Minecraft.Client/Level/ServerLevelListener.cpp index a421a76db..07f97422a 100644 --- a/Minecraft.Client/Level/ServerLevelListener.cpp +++ b/Minecraft.Client/Level/ServerLevelListener.cpp @@ -120,7 +120,7 @@ void ServerLevelListener::globalLevelEvent(int type, int sourceX, int sourceY, void ServerLevelListener::destroyTileProgress(int id, int x, int y, int z, int progress) { // for (ServerPlayer p : server->getPlayers()->players) - for (AUTO_VAR(it, server->getPlayers()->players.begin()); + for (auto it = server->getPlayers()->players.begin(); it != server->getPlayers()->players.end(); ++it) { std::shared_ptr p = *it; if (p == NULL || p->level != level || p->entityId == id) continue; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 58677c90a..8ac8af1b4 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -4484,8 +4484,8 @@ void Minecraft::tickAllConnections() { bool Minecraft::addPendingClientTextureRequest( const std::wstring& textureName) { - AUTO_VAR(it, find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName)); + auto it = find(m_pendingTextureRequests.begin(), + m_pendingTextureRequests.end(), textureName); if (it == m_pendingTextureRequests.end()) { m_pendingTextureRequests.push_back(textureName); return true; @@ -4494,8 +4494,8 @@ bool Minecraft::addPendingClientTextureRequest( } void Minecraft::handleClientTextureReceived(const std::wstring& textureName) { - AUTO_VAR(it, find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName)); + auto it = find(m_pendingTextureRequests.begin(), + m_pendingTextureRequests.end(), textureName); if (it != m_pendingTextureRequests.end()) { m_pendingTextureRequests.erase(it); } diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 144419181..480659c49 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -1396,7 +1396,7 @@ void MinecraftServer::broadcastStopSavingPacket() { void MinecraftServer::tick() { std::vector toRemove; - for (AUTO_VAR(it, ironTimers.begin()); it != ironTimers.end(); it++) { + for (auto it = ironTimers.begin(); it != ironTimers.end(); it++) { int t = it->second; if (t > 0) { ironTimers[it->first] = t - 1; @@ -1512,7 +1512,7 @@ void MinecraftServer::handleConsoleInput(const std::wstring& msg, void MinecraftServer::handleConsoleInputs() { while (consoleInput.size() > 0) { - AUTO_VAR(it, consoleInput.begin()); + auto it = consoleInput.begin(); ConsoleInput* input = *it; consoleInput.erase(it); // commands->handleCommand(input); // 4J - removed @@ -1612,8 +1612,8 @@ void MinecraftServer::chunkPacketManagement_PreTick() { do { int longestTime = 0; - AUTO_VAR(playerConnectionBest, playersOrig.begin()); - for (AUTO_VAR(it, playersOrig.begin()); it != playersOrig.end(); + auto playerConnectionBest = playersOrig.begin(); + for (auto it = playersOrig.begin(); it != playersOrig.end(); it++) { int thisTime = 0; INetworkPlayer* np = (*it)->getNetworkPlayer(); diff --git a/Minecraft.Client/Network/ClientConnection.cpp b/Minecraft.Client/Network/ClientConnection.cpp index 2daccb624..bef5c82c8 100644 --- a/Minecraft.Client/Network/ClientConnection.cpp +++ b/Minecraft.Client/Network/ClientConnection.cpp @@ -605,7 +605,7 @@ void ClientConnection::handleAddEntity( if (subEntities != NULL) { int offs = packet->id - e->entityId; // for (int i = 0; i < subEntities.length; i++) - for (AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); + for (auto it = subEntities->begin(); it != subEntities->end(); ++it) { (*it)->entityId += offs; // subEntities[i].entityId += offs; @@ -2003,7 +2003,7 @@ void ClientConnection::handleAddMob(std::shared_ptr packet) { if (subEntities != NULL) { int offs = packet->id - mob->entityId; // for (int i = 0; i < subEntities.length; i++) - for (AUTO_VAR(it, subEntities->begin()); it != subEntities->end(); + for (auto it = subEntities->begin(); it != subEntities->end(); ++it) { // subEntities[i].entityId += offs; (*it)->entityId += offs; @@ -3444,7 +3444,7 @@ void ClientConnection::handleUpdateAttributes( (std::dynamic_pointer_cast(entity))->getAttributes(); std::unordered_set attributeSnapshots = packet->getValues(); - for (AUTO_VAR(it, attributeSnapshots.begin()); + for (auto it = attributeSnapshots.begin(); it != attributeSnapshots.end(); ++it) { UpdateAttributesPacket::AttributeSnapshot* attribute = *it; AttributeInstance* instance = @@ -3465,7 +3465,7 @@ void ClientConnection::handleUpdateAttributes( std::unordered_set* modifiers = attribute->getModifiers(); - for (AUTO_VAR(it2, modifiers->begin()); it2 != modifiers->end(); + for (auto it2 = modifiers->begin(); it2 != modifiers->end(); ++it2) { AttributeModifier* modifier = *it2; instance->addModifier( diff --git a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp index e20b87291..500cf5207 100644 --- a/Minecraft.Client/Network/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/Network/MultiPlayerChunkCache.cpp @@ -98,8 +98,8 @@ MultiPlayerChunkCache::~MultiPlayerChunkCache() { delete cache; delete hasData; - AUTO_VAR(itEnd, loadedChunkList.end()); - for (AUTO_VAR(it, loadedChunkList.begin()); it != itEnd; it++) delete *it; + auto itEnd = loadedChunkList.end(); + for (auto it = loadedChunkList.begin(); it != itEnd; it++) delete *it; DeleteCriticalSection(&m_csLoadCreate); } diff --git a/Minecraft.Client/Network/PendingConnection.cpp b/Minecraft.Client/Network/PendingConnection.cpp index 26889858b..435fadb15 100644 --- a/Minecraft.Client/Network/PendingConnection.cpp +++ b/Minecraft.Client/Network/PendingConnection.cpp @@ -93,7 +93,7 @@ void PendingConnection::sendPreLoginResponse() { StorageManager.GetSaveUniqueFilename(szUniqueMapName); PlayerList* playerList = MinecraftServer::getInstance()->getPlayers(); - for (AUTO_VAR(it, playerList->players.begin()); + for (auto it = playerList->players.begin(); it != playerList->players.end(); ++it) { std::shared_ptr player = *it; // If the offline Xuid is invalid but the online one is not then that's diff --git a/Minecraft.Client/Network/PlayerChunkMap.cpp b/Minecraft.Client/Network/PlayerChunkMap.cpp index be55d0174..b4ab63dd3 100644 --- a/Minecraft.Client/Network/PlayerChunkMap.cpp +++ b/Minecraft.Client/Network/PlayerChunkMap.cpp @@ -40,7 +40,7 @@ PlayerChunkMap::PlayerChunk::~PlayerChunk() { delete changedTiles.data; } // output flag array and adds to it for this ServerPlayer. void PlayerChunkMap::flagEntitiesToBeRemoved(unsigned int* flags, bool* flagToBeRemoved) { - for (AUTO_VAR(it, players.begin()); it != players.end(); it++) { + for (auto it = players.begin(); it != players.end(); it++) { std::shared_ptr serverPlayer = *it; serverPlayer->flagEntitiesToBeRemoved(flags, flagToBeRemoved); } @@ -89,7 +89,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { // app.DebugPrintf("--- PlayerChunkMap::PlayerChunk::remove // x=%d\tz=%d\n",x,z); - AUTO_VAR(it, find(players.begin(), players.end(), player)); + auto it = find(players.begin(), players.end(), player); if (it == players.end()) { app.DebugPrintf( "--- INFO - Removing player from chunk x=%d\t z=%d, but they are " @@ -104,20 +104,20 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { { LevelChunk* chunk = parent->level->getChunk(pos.x, pos.z); updateInhabitedTime(chunk); - AUTO_VAR(it, find(parent->knownChunks.begin(), - parent->knownChunks.end(), this)); + auto it = find(parent->knownChunks.begin(), + parent->knownChunks.end(), this); if (it != parent->knownChunks.end()) parent->knownChunks.erase(it); } int64_t id = (pos.x + 0x7fffffffLL) | ((pos.z + 0x7fffffffLL) << 32); - AUTO_VAR(it, parent->chunks.find(id)); + auto it = parent->chunks.find(id); if (it != parent->chunks.end()) { toDelete = it->second; // Don't delete until the end of the // function, as this might be this instance parent->chunks.erase(it); } if (changes > 0) { - AUTO_VAR(it, find(parent->changedChunks.begin(), - parent->changedChunks.end(), this)); + auto it = find(parent->changedChunks.begin(), + parent->changedChunks.end(), this); parent->changedChunks.erase(it); } parent->getLevel()->cache->drop(pos.x, pos.z); @@ -135,7 +135,7 @@ void PlayerChunkMap::PlayerChunk::remove(std::shared_ptr player) { bool noOtherPlayersFound = true; if (thisNetPlayer != NULL) { - for (AUTO_VAR(it, players.begin()); it < players.end(); ++it) { + for (auto it = players.begin(); it < players.end(); ++it) { std::shared_ptr currPlayer = *it; INetworkPlayer* currNetPlayer = currPlayer->connection->getNetworkPlayer(); @@ -405,7 +405,7 @@ PlayerChunkMap::PlayerChunkMap(ServerLevel* level, int dimension, int radius) { } PlayerChunkMap::~PlayerChunkMap() { - for (AUTO_VAR(it, chunks.begin()); it != chunks.end(); it++) { + for (auto it = chunks.begin(); it != chunks.end(); it++) { delete it->second; } } @@ -471,7 +471,7 @@ bool PlayerChunkMap::hasChunk(int x, int z) { PlayerChunkMap::PlayerChunk* PlayerChunkMap::getChunk(int x, int z, bool create) { int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); - AUTO_VAR(it, chunks.find(id)); + auto it = chunks.find(id); PlayerChunk* chunk = NULL; if (it != chunks.end()) { @@ -490,7 +490,7 @@ PlayerChunkMap::PlayerChunk* PlayerChunkMap::getChunk(int x, int z, void PlayerChunkMap::getChunkAndAddPlayer( int x, int z, std::shared_ptr player) { int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); - AUTO_VAR(it, chunks.find(id)); + auto it = chunks.find(id); if (it != chunks.end()) { it->second->add(player); @@ -503,14 +503,14 @@ void PlayerChunkMap::getChunkAndAddPlayer( // there. Otherwise attempt to remove from main chunk map. void PlayerChunkMap::getChunkAndRemovePlayer( int x, int z, std::shared_ptr player) { - for (AUTO_VAR(it, addRequests.begin()); it != addRequests.end(); it++) { + for (auto it = addRequests.begin(); it != addRequests.end(); it++) { if ((it->x == x) && (it->z == z) && (it->player == player)) { addRequests.erase(it); return; } } int64_t id = (x + 0x7fffffffLL) | ((z + 0x7fffffffLL) << 32); - AUTO_VAR(it, chunks.find(id)); + auto it = chunks.find(id); if (it != chunks.end()) { it->second->remove(player); @@ -526,8 +526,8 @@ void PlayerChunkMap::tickAddRequests(std::shared_ptr player) { int pz = (int)player->z; int minDistSq = -1; - AUTO_VAR(itNearest, addRequests.end()); - for (AUTO_VAR(it, addRequests.begin()); it != addRequests.end(); it++) { + auto itNearest = addRequests.end(); + for (auto it = addRequests.begin(); it != addRequests.end(); it++) { if (it->player == player) { int xm = (it->x * 16) + 8; int zm = (it->z * 16) + 8; @@ -693,13 +693,13 @@ void PlayerChunkMap::remove(std::shared_ptr player) { if (playerChunk != NULL) playerChunk->remove(player); } - AUTO_VAR(it, find(players.begin(), players.end(), player)); + auto it = find(players.begin(), players.end(), player); if (players.size() > 0 && it != players.end()) players.erase(find(players.begin(), players.end(), player)); // 4J - added - also remove any queued requests to be added to playerchunks // here - for (AUTO_VAR(it, addRequests.begin()); it != addRequests.end();) { + for (auto it = addRequests.begin(); it != addRequests.end();) { if (it->player == player) { it = addRequests.erase(it); } else { @@ -764,10 +764,10 @@ bool PlayerChunkMap::isPlayerIn(std::shared_ptr player, if (chunk == NULL) { return false; } else { - AUTO_VAR(it1, - find(chunk->players.begin(), chunk->players.end(), player)); - AUTO_VAR(it2, find(player->chunksToSend.begin(), - player->chunksToSend.end(), chunk->pos)); + auto it1 = + find(chunk->players.begin(), chunk->players.end(), player); + auto it2 = find(player->chunksToSend.begin(), + player->chunksToSend.end(), chunk->pos); return it1 != chunk->players.end() && it2 == player->chunksToSend.end(); } diff --git a/Minecraft.Client/Network/PlayerConnection.cpp b/Minecraft.Client/Network/PlayerConnection.cpp index e5323972e..e041c1779 100644 --- a/Minecraft.Client/Network/PlayerConnection.cpp +++ b/Minecraft.Client/Network/PlayerConnection.cpp @@ -851,8 +851,8 @@ void PlayerConnection::handleTextureAndGeometry( void PlayerConnection::handleTextureReceived(const std::wstring& textureName) { // This sends the server received texture out to any other players waiting // for the data - AUTO_VAR(it, find(m_texturesRequested.begin(), m_texturesRequested.end(), - textureName)); + auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(), + textureName); if (it != m_texturesRequested.end()) { std::uint8_t* pbData = NULL; unsigned int dwBytes = 0; @@ -870,8 +870,8 @@ void PlayerConnection::handleTextureAndGeometryReceived( const std::wstring& textureName) { // This sends the server received texture out to any other players waiting // for the data - AUTO_VAR(it, find(m_texturesRequested.begin(), m_texturesRequested.end(), - textureName)); + auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(), + textureName); if (it != m_texturesRequested.end()) { std::uint8_t* pbData = NULL; unsigned int dwTextureBytes = 0; @@ -1270,7 +1270,7 @@ void PlayerConnection::handleSetCreativeModeSlot( void PlayerConnection::handleContainerAck( std::shared_ptr packet) { - AUTO_VAR(it, expectedAcks.find(player->containerMenu->containerId)); + auto it = expectedAcks.find(player->containerMenu->containerId); if (it != expectedAcks.end() && packet->uid == it->second && player->containerMenu->containerId == packet->containerId && @@ -1335,7 +1335,7 @@ void PlayerConnection::handlePlayerInfo( player->isModerator()) { std::shared_ptr serverPlayer; // Find the player being edited - for (AUTO_VAR(it, server->getPlayers()->players.begin()); + for (auto it = server->getPlayers()->players.begin(); it != server->getPlayers()->players.end(); ++it) { std::shared_ptr checkingPlayer = *it; if (checkingPlayer->connection->getNetworkPlayer() != NULL && diff --git a/Minecraft.Client/Network/PlayerList.cpp b/Minecraft.Client/Network/PlayerList.cpp index 74e1c4fa9..64c0cd823 100644 --- a/Minecraft.Client/Network/PlayerList.cpp +++ b/Minecraft.Client/Network/PlayerList.cpp @@ -54,7 +54,7 @@ PlayerList::PlayerList(MinecraftServer* server) { } PlayerList::~PlayerList() { - for (AUTO_VAR(it, players.begin()); it < players.end(); it++) { + for (auto it = players.begin(); it < players.end(); it++) { (*it)->connection = nullptr; // Must remove reference to connection, or // else there is a circular dependency delete (*it)->gameMode; // Gamemode also needs deleted as it references @@ -100,7 +100,7 @@ void PlayerList::placeNewPlayer(Connection* connection, { bool usedIndexes[MINECRAFT_NET_MAX_PLAYERS]; ZeroMemory(&usedIndexes, MINECRAFT_NET_MAX_PLAYERS * sizeof(bool)); - for (AUTO_VAR(it, players.begin()); it < players.end(); ++it) { + for (auto it = players.begin(); it < players.end(); ++it) { usedIndexes[(int)(*it)->getPlayerIndex()] = true; } for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) { @@ -267,8 +267,8 @@ void PlayerList::placeNewPlayer(Connection* connection, level->getGameTime(), level->getDayTime(), level->getGameRules()->getBoolean(GameRules::RULE_DAYLIGHT)))); - AUTO_VAR(activeEffects, player->getActiveEffects()); - for (AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); + auto activeEffects = player->getActiveEffects(); + for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { MobEffectInstance* effect = *it; playerConnection->send(std::shared_ptr( @@ -294,7 +294,7 @@ void PlayerList::placeNewPlayer(Connection* connection, // to true so that respawning works when the EndPoem is closed INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer(); if (thisPlayer != NULL) { - for (AUTO_VAR(it, players.begin()); it != players.end(); ++it) { + for (auto it = players.begin(); it != players.end(); ++it) { std::shared_ptr servPlayer = *it; INetworkPlayer* checkPlayer = servPlayer->connection->getNetworkPlayer(); @@ -521,7 +521,7 @@ void PlayerList::remove(std::shared_ptr player) { } level->removeEntity(player); level->getChunkMap()->remove(player); - AUTO_VAR(it, find(players.begin(), players.end(), player)); + auto it = find(players.begin(), players.end(), player); if (it != players.end()) { players.erase(it); } @@ -632,7 +632,7 @@ std::shared_ptr PlayerList::respawn( } serverPlayer->getLevel()->getChunkMap()->remove(serverPlayer); - AUTO_VAR(it, find(players.begin(), players.end(), serverPlayer)); + auto it = find(players.begin(), players.end(), serverPlayer); if (it != players.end()) { players.erase(it); } @@ -752,7 +752,7 @@ std::shared_ptr PlayerList::respawn( if (keepAllPlayerData) { std::vector* activeEffects = player->getActiveEffects(); - for (AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); + for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { MobEffectInstance* effect = *it; @@ -893,7 +893,7 @@ void PlayerList::toggleDimension(std::shared_ptr player, // 4J Stu - Fix for #64683 - Customer Encountered: TU7: Content: Gameplay: // Potion effects are removed after using the Nether Portal std::vector* activeEffects = player->getActiveEffects(); - for (AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); + for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { MobEffectInstance* effect = *it; @@ -1409,7 +1409,7 @@ int PlayerList::getPlayerCount() { return (int)players.size(); } int PlayerList::getPlayerCount(ServerLevel* level) { int count = 0; - for (AUTO_VAR(it, players.begin()); it != players.end(); ++it) { + for (auto it = players.begin(); it != players.end(); ++it) { if ((*it)->level == level) ++count; } @@ -1455,7 +1455,7 @@ std::shared_ptr PlayerList::findAlivePlayerOnSystem( INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer(); if (thisPlayer != NULL) { - for (AUTO_VAR(itP, players.begin()); itP != players.end(); ++itP) { + for (auto itP = players.begin(); itP != players.end(); ++itP) { std::shared_ptr newPlayer = *itP; INetworkPlayer* otherPlayer = @@ -1488,8 +1488,8 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, #endif bool playerRemoved = false; - AUTO_VAR(it, find(receiveAllPlayers[dimIndex].begin(), - receiveAllPlayers[dimIndex].end(), player)); + auto it = find(receiveAllPlayers[dimIndex].begin(), + receiveAllPlayers[dimIndex].end(), player); if (it != receiveAllPlayers[dimIndex].end()) { #if !defined(_CONTENT_PACKAGE) app.DebugPrintf( @@ -1502,7 +1502,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, INetworkPlayer* thisPlayer = player->connection->getNetworkPlayer(); if (thisPlayer != NULL && playerRemoved) { - for (AUTO_VAR(itP, players.begin()); itP != players.end(); ++itP) { + for (auto itP = players.begin(); itP != players.end(); ++itP) { std::shared_ptr newPlayer = *itP; INetworkPlayer* otherPlayer = @@ -1528,7 +1528,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, // 4J Stu - Something went wrong, or possibly the QNet player left // before we got here. Re-check all active players and make sure they // have someone on their system to receive all packets - for (AUTO_VAR(itP, players.begin()); itP != players.end(); ++itP) { + for (auto itP = players.begin(); itP != players.end(); ++itP) { std::shared_ptr newPlayer = *itP; INetworkPlayer* checkingPlayer = newPlayer->connection->getNetworkPlayer(); @@ -1540,7 +1540,7 @@ void PlayerList::removePlayerFromReceiving(std::shared_ptr player, else if (newPlayer->dimension == 1) newPlayerDim = 2; bool foundPrimary = false; - for (AUTO_VAR(it, receiveAllPlayers[newPlayerDim].begin()); + for (auto it = receiveAllPlayers[newPlayerDim].begin(); it != receiveAllPlayers[newPlayerDim].end(); ++it) { std::shared_ptr primaryPlayer = *it; INetworkPlayer* primPlayer = @@ -1589,7 +1589,7 @@ void PlayerList::addPlayerToReceiving(std::shared_ptr player) { #endif shouldAddPlayer = false; } else { - for (AUTO_VAR(it, receiveAllPlayers[playerDim].begin()); + for (auto it = receiveAllPlayers[playerDim].begin(); it != receiveAllPlayers[playerDim].end(); ++it) { std::shared_ptr oldPlayer = *it; INetworkPlayer* checkingPlayer = @@ -1617,7 +1617,7 @@ bool PlayerList::canReceiveAllPackets(std::shared_ptr player) { playerDim = 1; else if (player->dimension == 1) playerDim = 2; - for (AUTO_VAR(it, receiveAllPlayers[playerDim].begin()); + for (auto it = receiveAllPlayers[playerDim].begin(); it != receiveAllPlayers[playerDim].end(); ++it) { std::shared_ptr newPlayer = *it; if (newPlayer == player) { @@ -1644,7 +1644,7 @@ bool PlayerList::isXuidBanned(PlayerUID xuid) { bool banned = false; - for (AUTO_VAR(it, m_bannedXuids.begin()); it != m_bannedXuids.end(); ++it) { + for (auto it = m_bannedXuids.begin(); it != m_bannedXuids.end(); ++it) { if (ProfileManager.AreXUIDSEqual(xuid, *it)) { banned = true; break; diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index b72c07d57..fdbeeef52 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -56,8 +56,8 @@ ServerChunkCache::~ServerChunkCache() { delete m_unloadedCache; #endif - AUTO_VAR(itEnd, m_loadedChunkList.end()); - for (AUTO_VAR(it, m_loadedChunkList.begin()); it != itEnd; it++) delete *it; + auto itEnd = m_loadedChunkList.end(); + for (auto it = m_loadedChunkList.begin(); it != itEnd; it++) delete *it; DeleteCriticalSection(&m_csLoadCreate); } @@ -654,7 +654,7 @@ bool ServerChunkCache::saveAllEntities() { PIXBeginNamedEvent(0, "saving to NBT"); EnterCriticalSection(&m_csLoadCreate); - for (AUTO_VAR(it, m_loadedChunkList.begin()); it != m_loadedChunkList.end(); + for (auto it = m_loadedChunkList.begin(); it != m_loadedChunkList.end(); ++it) { storage->saveEntities(level, *it); } @@ -676,8 +676,8 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) { // 4J - added this to support progressListner int count = 0; if (progressListener != NULL) { - AUTO_VAR(itEnd, m_loadedChunkList.end()); - for (AUTO_VAR(it, m_loadedChunkList.begin()); it != itEnd; it++) { + auto itEnd = m_loadedChunkList.end(); + for (auto it = m_loadedChunkList.begin(); it != itEnd; it++) { LevelChunk* chunk = *it; if (chunk->shouldSave(force)) { count++; @@ -813,8 +813,8 @@ bool ServerChunkCache::tick() { // loadedChunks.remove(cp); // loadedChunkList.remove(chunk); - AUTO_VAR(it, find(m_loadedChunkList.begin(), - m_loadedChunkList.end(), chunk)); + auto it = find(m_loadedChunkList.begin(), + m_loadedChunkList.end(), chunk); if (it != m_loadedChunkList.end()) m_loadedChunkList.erase(it); diff --git a/Minecraft.Client/Network/ServerCommandDispatcher.cpp b/Minecraft.Client/Network/ServerCommandDispatcher.cpp index 6d86fd41c..c363df0d7 100644 --- a/Minecraft.Client/Network/ServerCommandDispatcher.cpp +++ b/Minecraft.Client/Network/ServerCommandDispatcher.cpp @@ -57,7 +57,7 @@ void ServerCommandDispatcher::logAdminCommand( int customData, const std::wstring& additionalMessage) { PlayerList* playerList = MinecraftServer::getInstance()->getPlayers(); // for (Player player : MinecraftServer.getInstance().getPlayers().players) - for (AUTO_VAR(it, playerList->players.begin()); + for (auto it = playerList->players.begin(); it != playerList->players.end(); ++it) { std::shared_ptr player = *it; if (player != source && playerList->isOp(player)) { diff --git a/Minecraft.Client/Network/ServerConnection.cpp b/Minecraft.Client/Network/ServerConnection.cpp index 18dc87556..6d0cd5e99 100644 --- a/Minecraft.Client/Network/ServerConnection.cpp +++ b/Minecraft.Client/Network/ServerConnection.cpp @@ -102,8 +102,8 @@ void ServerConnection::tick() { bool ServerConnection::addPendingTextureRequest( const std::wstring& textureName) { - AUTO_VAR(it, find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName)); + auto it = find(m_pendingTextureRequests.begin(), + m_pendingTextureRequests.end(), textureName); if (it == m_pendingTextureRequests.end()) { m_pendingTextureRequests.push_back(textureName); return true; @@ -119,8 +119,8 @@ bool ServerConnection::addPendingTextureRequest( } void ServerConnection::handleTextureReceived(const std::wstring& textureName) { - AUTO_VAR(it, find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName)); + auto it = find(m_pendingTextureRequests.begin(), + m_pendingTextureRequests.end(), textureName); if (it != m_pendingTextureRequests.end()) { m_pendingTextureRequests.erase(it); } @@ -134,8 +134,8 @@ void ServerConnection::handleTextureReceived(const std::wstring& textureName) { void ServerConnection::handleTextureAndGeometryReceived( const std::wstring& textureName) { - AUTO_VAR(it, find(m_pendingTextureRequests.begin(), - m_pendingTextureRequests.end(), textureName)); + auto it = find(m_pendingTextureRequests.begin(), + m_pendingTextureRequests.end(), textureName); if (it != m_pendingTextureRequests.end()) { m_pendingTextureRequests.erase(it); } diff --git a/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp index e726002b2..60233703e 100644 --- a/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp @@ -1909,7 +1909,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--; diff --git a/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp b/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp index 5915a6f6b..04cfb7fbd 100644 --- a/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Platform/Common/Colours/ColourTable.cpp @@ -355,14 +355,14 @@ void ColourTable::loadColoursFromData(std::uint8_t* pbData, std::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(); } void ColourTable::setColour(const std::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; } diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 77c72401e..515c88a0a 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -1127,7 +1127,7 @@ void CMinecraftApp::ActionGameSettings(int iPad, eGameSetting eVal) { PlayerList* players = MinecraftServer::getInstance()->getPlayerList(); - for (AUTO_VAR(it3, players->players.begin()); + for (auto it3 = players->players.begin(); it3 != players->players.end(); ++it3) { std::shared_ptr decorationPlayer = *it3; decorationPlayer->setShowOnMaps( @@ -4564,7 +4564,7 @@ bool CMinecraftApp::isXuidNotch(PlayerUID xuid) { } bool CMinecraftApp::isXuidDeadmau5(PlayerUID xuid) { - AUTO_VAR(it, MojangData.find(xuid)); // 4J Stu - The .at and [] accessors + 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]; @@ -4582,7 +4582,7 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring& wName, 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()) { #if !defined(_CONTENT_PACKAGE) wprintf(L"Incrementing the memory texture file count for %ls\n", @@ -4625,7 +4625,7 @@ void CMinecraftApp::AddMemoryTextureFile(const std::wstring& wName, void CMinecraftApp::RemoveMemoryTextureFile(const std::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()) { #if !defined(_CONTENT_PACKAGE) wprintf(L"Decrementing the memory texture file count for %ls\n", @@ -4650,7 +4650,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); @@ -4661,7 +4661,7 @@ bool CMinecraftApp::IsFileInMemoryTextures(const std::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); @@ -4672,7 +4672,7 @@ void CMinecraftApp::GetMemFileDetails(const std::wstring& wName, std::uint8_t** ppbData, unsigned int* pByteCount) { 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; *ppbData = pData->pbData; @@ -4686,7 +4686,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig, std::uint8_t* pbData, 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 = new MEMDATA(); pData->pbData = pbData; @@ -4703,7 +4703,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]; delete pData; @@ -4720,7 +4720,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); @@ -4730,7 +4730,7 @@ bool CMinecraftApp::IsFileInTPD(int iConfig) { void CMinecraftApp::GetTPD(int iConfig, std::uint8_t** ppbData, unsigned int* pByteCount) { 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; *ppbData = pData->pbData; @@ -5610,7 +5610,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char* pchDLCName, bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, ULONGLONG* pullVal) { - AUTO_VAR(it, DLCInfo_SkinName.find(FirstSkin)); + auto it = DLCInfo_SkinName.find(FirstSkin); if (it == DLCInfo_SkinName.end()) { return false; } else { @@ -5620,7 +5620,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForSkinID(const std::wstring& FirstSkin, } 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; return false; @@ -5632,7 +5632,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID, 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()) { // nothing for this @@ -5678,7 +5678,7 @@ ULONGLONG CMinecraftApp::GetDLCInfoTexturesFullOffer(int iIndex) { 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()) { // nothing for this @@ -5857,7 +5857,7 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, static_cast(sizeof(BANNEDLISTDATA) * bannedListCount); PBANNEDLISTDATA pBannedList = new BANNEDLISTDATA[bannedListCount]; int iCount = 0; - for (AUTO_VAR(it, m_vBannedListA[iPad]->begin()); + for (auto it = m_vBannedListA[iPad]->begin(); it != m_vBannedListA[iPad]->end(); ++it) { PBANNEDLISTDATA pData = *it; memcpy(&pBannedList[iCount++], pData, sizeof(BANNEDLISTDATA)); @@ -5876,7 +5876,7 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, bool CMinecraftApp::IsInBannedLevelList(int iPad, PlayerUID xuid, char* pszLevelName) { - for (AUTO_VAR(it, m_vBannedListA[iPad]->begin()); + for (auto it = m_vBannedListA[iPad]->begin(); it != m_vBannedListA[iPad]->end(); ++it) { PBANNEDLISTDATA pData = *it; if (IsEqualXUID(pData->xuid, xuid) && @@ -5896,7 +5896,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, // 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()); + for (auto it = m_vBannedListA[iPad]->begin(); it != m_vBannedListA[iPad]->end();) { PBANNEDLISTDATA pBannedListData = *it; @@ -6507,7 +6507,7 @@ unsigned int CMinecraftApp::CreateImageTextData(std::uint8_t* textMetadata, void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType, int x, int z) { // check we don't already have this in - for (AUTO_VAR(it, m_vTerrainFeatures.begin()); + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); ++it) { FEATURE_DATA* pFeatureData = *it; @@ -6525,7 +6525,7 @@ void CMinecraftApp::AddTerrainFeaturePosition(_eTerrainFeatureType eFeatureType, } _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x, int z) { - for (AUTO_VAR(it, m_vTerrainFeatures.begin()); + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); ++it) { FEATURE_DATA* pFeatureData = *it; @@ -6538,7 +6538,7 @@ _eTerrainFeatureType CMinecraftApp::IsTerrainFeature(int x, int z) { bool CMinecraftApp::GetTerrainFeaturePosition(_eTerrainFeatureType eType, int* pX, int* pZ) { - for (AUTO_VAR(it, m_vTerrainFeatures.begin()); + for (auto it = m_vTerrainFeatures.begin(); it < m_vTerrainFeatures.end(); ++it) { FEATURE_DATA* pFeatureData = *it; @@ -6666,7 +6666,7 @@ unsigned int CMinecraftApp::AddDLCRequest(eDLCMarketplaceType eType, // If it's already in there, promote it to the top of the list int iPosition = 0; - for (AUTO_VAR(it, m_DLCDownloadQueue.begin()); + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); ++it) { DLCRequest* pCurrent = *it; @@ -6717,7 +6717,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromoted=false; - for(AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); it != + for(auto it = m_TMSPPDownloadQueue.begin(); it != m_TMSPPDownloadQueue.end(); ++it) { TMSPPRequest *pCurrent = *it; @@ -6776,7 +6776,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, // of a previous trial/full offer bool bAlreadyInQueue = false; - for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + for (auto it = m_TMSPPDownloadQueue.begin(); it != m_TMSPPDownloadQueue.end(); ++it) { TMSPPRequest* pCurrent = *it; @@ -6843,7 +6843,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, // a previous trial/full offer bool bAlreadyInQueue = false; - for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + for (auto it = m_TMSPPDownloadQueue.begin(); it != m_TMSPPDownloadQueue.end(); ++it) { TMSPPRequest* pCurrent = *it; @@ -6895,7 +6895,7 @@ unsigned int CMinecraftApp::AddTMSPPFileTypeRequest(eDLCContentType eType, bool CMinecraftApp::CheckTMSDLCCanStop() { EnterCriticalSection(&csTMSPPDownloadQueue); - for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + for (auto it = m_TMSPPDownloadQueue.begin(); it != m_TMSPPDownloadQueue.end(); ++it) { TMSPPRequest* pCurrent = *it; @@ -6921,7 +6921,7 @@ bool CMinecraftApp::RetrieveNextDLCContent() { } EnterCriticalSection(&csDLCDownloadQueue); - for (AUTO_VAR(it, m_DLCDownloadQueue.begin()); + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); ++it) { DLCRequest* pCurrent = *it; @@ -6932,7 +6932,7 @@ bool CMinecraftApp::RetrieveNextDLCContent() { } // Now look for the next retrieval - for (AUTO_VAR(it, m_DLCDownloadQueue.begin()); + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); ++it) { DLCRequest* pCurrent = *it; @@ -6970,7 +6970,7 @@ int CMinecraftApp::TMSPPFileReturned(void* pParam, int iPad, int iUserData, // find the right one in the vector EnterCriticalSection(&pClass->csTMSPPDownloadQueue); - for (AUTO_VAR(it, pClass->m_TMSPPDownloadQueue.begin()); + for (auto it = pClass->m_TMSPPDownloadQueue.begin(); it != pClass->m_TMSPPDownloadQueue.end(); ++it) { TMSPPRequest* pCurrent = *it; #if defined(_WINDOWS64) @@ -7030,7 +7030,7 @@ void CMinecraftApp::ClearAndResetDLCDownloadQueue() { int iPosition = 0; EnterCriticalSection(&csTMSPPDownloadQueue); - for (AUTO_VAR(it, m_DLCDownloadQueue.begin()); + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); ++it) { DLCRequest* pCurrent = *it; @@ -7052,7 +7052,7 @@ void CMinecraftApp::TickTMSPPFilesRetrieved() { void CMinecraftApp::ClearTMSPPFilesRetrieved() { int iPosition = 0; EnterCriticalSection(&csTMSPPDownloadQueue); - for (AUTO_VAR(it, m_TMSPPDownloadQueue.begin()); + for (auto it = m_TMSPPDownloadQueue.begin(); it != m_TMSPPDownloadQueue.end(); ++it) { TMSPPRequest* pCurrent = *it; @@ -7070,7 +7070,7 @@ int CMinecraftApp::DLCOffersReturned(void* pParam, int iOfferC, // find the right one in the vector EnterCriticalSection(&pClass->csTMSPPDownloadQueue); - for (AUTO_VAR(it, pClass->m_DLCDownloadQueue.begin()); + for (auto it = pClass->m_DLCDownloadQueue.begin(); it != pClass->m_DLCDownloadQueue.end(); ++it) { DLCRequest* pCurrent = *it; @@ -7102,7 +7102,7 @@ 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()); + for (auto it = m_DLCDownloadQueue.begin(); it != m_DLCDownloadQueue.end(); ++it) { DLCRequest* pCurrent = *it; @@ -7168,7 +7168,7 @@ std::vector* CMinecraftApp::SetAdditionalSkinBoxes( 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->begin(); it != pvSkinBoxA->end(); ++it) { if (pModel) { ModelPart* pModelPart = pModel->AddOrRetrievePart(*it); pvModelPart->push_back(pModelPart); @@ -7192,7 +7192,7 @@ std::vector* CMinecraftApp::GetAdditionalModelParts( EnterCriticalSection(&csAdditionalModelParts); std::vector* 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; } @@ -7207,7 +7207,7 @@ std::vector* CMinecraftApp::GetAdditionalSkinBoxes( EnterCriticalSection(&csAdditionalSkinBoxes); std::vector* 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; } @@ -7222,7 +7222,7 @@ unsigned int CMinecraftApp::GetAnimOverrideBitmask(std::uint32_t dwSkinID) { unsigned int uiAnimOverrideBitmask = 0L; 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; } @@ -7238,7 +7238,7 @@ void CMinecraftApp::SetAnimOverrideBitmask(std::uint32_t dwSkinID, EnterCriticalSection(&csAnimOverrideBitmask); 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); return; // already in here diff --git a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp index 1550d88e2..cddf68429 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCAudioFile.cpp @@ -227,7 +227,7 @@ bool DLCAudioFile::processDLCDataFile(std::uint8_t* pbData, for (unsigned int j = 0; j < uiParameterCount; j++) { // EAudioParameterType paramType = e_AudioParamType_Invalid; - AUTO_VAR(it, parameterMapping.find(paramBuf.dwType)); + auto it = parameterMapping.find(paramBuf.dwType); if (it != parameterMapping.end()) { addParameter(type, (EAudioParameterType)paramBuf.dwType, diff --git a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp index 868c47855..70ce347a0 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCManager.cpp @@ -151,7 +151,7 @@ DLCManager::DLCManager() { } DLCManager::~DLCManager() { - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* pack = *it; delete pack; } @@ -174,7 +174,7 @@ DLCManager::EDLCParameterType DLCManager::getParameterType( unsigned int DLCManager::getPackCount(EDLCType type /*= e_DLCType_All*/) { unsigned int packCount = 0; if (type != e_DLCType_All) { - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* pack = *it; if (pack->getDLCItemsCount(type) > 0) { ++packCount; @@ -190,14 +190,14 @@ void DLCManager::addPack(DLCPack* pack) { m_packs.push_back(pack); } 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; } } void DLCManager::removeAllPacks(void) { - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* pack = (DLCPack*)*it; delete pack; } @@ -206,7 +206,7 @@ void DLCManager::removeAllPacks(void) { } void DLCManager::LanguageChanged(void) { - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* pack = (DLCPack*)*it; // update the language pack->UpdateLanguage(); @@ -217,7 +217,7 @@ DLCPack* DLCManager::getPack(const std::wstring& name) { DLCPack* pack = NULL; // DWORD currentIndex = 0; DLCPack* currentPack = NULL; - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { currentPack = *it; std::wstring wsName = currentPack->getName(); @@ -236,7 +236,7 @@ DLCPack* DLCManager::getPack(unsigned int index, if (type != e_DLCType_All) { unsigned int currentIndex = 0; DLCPack* currentPack = NULL; - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { currentPack = *it; if (currentPack->getDLCItemsCount(type) > 0) { if (currentIndex == index) { @@ -271,7 +271,7 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found, } if (type != e_DLCType_All) { unsigned int index = 0; - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* thisPack = *it; if (thisPack->getDLCItemsCount(type) > 0) { if (thisPack == pack) { @@ -284,7 +284,7 @@ unsigned int DLCManager::getPackIndex(DLCPack* pack, bool& found, } } else { unsigned int index = 0; - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* thisPack = *it; if (thisPack == pack) { found = true; @@ -302,7 +302,7 @@ unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring& path, unsigned int foundIndex = 0; found = false; unsigned int index = 0; - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* pack = *it; if (pack->getDLCItemsCount(e_DLCType_Skin) > 0) { if (pack->doesPackContainSkin(path)) { @@ -318,7 +318,7 @@ unsigned int DLCManager::getPackIndexContainingSkin(const std::wstring& path, DLCPack* DLCManager::getPackContainingSkin(const std::wstring& path) { DLCPack* foundPack = NULL; - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* pack = *it; if (pack->getDLCItemsCount(e_DLCType_Skin) > 0) { if (pack->doesPackContainSkin(path)) { @@ -332,7 +332,7 @@ DLCPack* DLCManager::getPackContainingSkin(const std::wstring& path) { DLCSkinFile* DLCManager::getSkinFile(const std::wstring& path) { DLCSkinFile* foundSkinfile = NULL; - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { DLCPack* pack = *it; foundSkinfile = pack->getSkinFile(path); if (foundSkinfile != NULL) { @@ -348,7 +348,7 @@ unsigned int DLCManager::checkForCorruptDLCAndAlert( DLCPack* pack = NULL; DLCPack* firstCorruptPack = NULL; - for (AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it) { + for (auto it = m_packs.begin(); it != m_packs.end(); ++it) { pack = *it; if (pack->IsCorrupt()) { ++corruptDLCCount; @@ -529,7 +529,7 @@ bool DLCManager::processDLCDataFile(unsigned int& dwFilesProcessed, // DLCManager::EDLCParameterType paramType = // DLCManager::e_DLCParamType_Invalid; - AUTO_VAR(it, parameterMapping.find(parBuf.dwType)); + auto it = parameterMapping.find(parBuf.dwType); if (it != parameterMapping.end()) { if (type == e_DLCType_PackConfig) { @@ -686,7 +686,7 @@ std::uint32_t DLCManager::retrievePackID(std::uint8_t* pbData, pbTemp += sizeof(int); ReadDlcStruct(¶mBuf, pbTemp); for (unsigned int j = 0; j < uiParameterCount; j++) { - AUTO_VAR(it, parameterMapping.find(paramBuf.dwType)); + auto it = parameterMapping.find(paramBuf.dwType); if (it != parameterMapping.end()) { if (type == e_DLCType_PackConfig) { diff --git a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp index f85153f14..b5361553f 100644 --- a/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Platform/Common/DLC/DLCPack.cpp @@ -29,12 +29,12 @@ DLCPack::DLCPack(const std::wstring& name, std::uint32_t dwLicenseMask) { DLCPack::~DLCPack() { - for (AUTO_VAR(it, m_childPacks.begin()); it != m_childPacks.end(); ++it) { + for (auto it = m_childPacks.begin(); it != m_childPacks.end(); ++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].begin(); it != m_files[i].end(); ++it) { delete *it; } } @@ -122,7 +122,7 @@ void DLCPack::addParameter(DLCManager::EDLCParameterType type, 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) { case DLCManager::e_DLCParamType_NetherParticleColour: @@ -213,8 +213,8 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, } } else { g_pathCmpString = &path; - AUTO_VAR(it, std::find_if(m_files[type].begin(), m_files[type].end(), - pathCmp)); + auto it = std::find_if(m_files[type].begin(), m_files[type].end(), + pathCmp); hasFile = it != m_files[type].end(); if (!hasFile && m_parentPack) { hasFile = m_parentPack->doesPackContainFile(type, path); @@ -252,8 +252,7 @@ DLCFile* DLCPack::getFile(DLCManager::EDLCType type, const std::wstring& path) { } } else { g_pathCmpString = &path; - AUTO_VAR(it, std::find_if(m_files[type].begin(), m_files[type].end(), - pathCmp)); + auto it = std::find_if(m_files[type].begin(), m_files[type].end(), pathCmp); if (it == m_files[type].end()) { // Not found @@ -298,7 +297,7 @@ unsigned int DLCPack::getFileIndexAt(DLCManager::EDLCType type, unsigned int foundIndex = 0; found = false; unsigned int index = 0; - for (AUTO_VAR(it, m_files[type].begin()); it != m_files[type].end(); ++it) { + for (auto it = m_files[type].begin(); it != m_files[type].end(); ++it) { if (path.compare((*it)->getPath()) == 0) { foundIndex = index; found = true; diff --git a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp index 94e5ee596..969e74baa 100644 --- a/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/AddItemRuleDefinition.cpp @@ -34,7 +34,7 @@ void AddItemRuleDefinition::writeAttributes(DataOutputStream* dos, void AddItemRuleDefinition::getChildren( std::vector* children) { GameRuleDefinition::getChildren(children); - for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++) + for (auto it = m_enchantments.begin(); it != m_enchantments.end(); it++) children->push_back(*it); } @@ -95,7 +95,7 @@ bool AddItemRuleDefinition::addItemToContainer( new ItemInstance(m_itemId, quantity, m_auxValue)); newItem->set4JData(m_dataTag); - for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); + for (auto it = m_enchantments.begin(); it != m_enchantments.end(); ++it) { (*it)->enchantItem(newItem); } diff --git a/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp index 82d8fb5dd..2594bbe43 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CompleteAllRuleDefinition.cpp @@ -28,7 +28,7 @@ bool CompleteAllRuleDefinition::onCollectItem( void CompleteAllRuleDefinition::updateStatus(GameRule* rule) { int goal = 0; int progress = 0; - for (AUTO_VAR(it, rule->m_parameters.begin()); + for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end(); ++it) { if (it->second.isPointer) { goal += it->second.gr->getGameRuleDefinition()->getGoal(); diff --git a/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp index cd21388e4..8377db532 100644 --- a/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/CompoundGameRuleDefinition.cpp @@ -9,7 +9,7 @@ CompoundGameRuleDefinition::CompoundGameRuleDefinition() { } CompoundGameRuleDefinition::~CompoundGameRuleDefinition() { - for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) { + for (auto it = m_children.begin(); it != m_children.end(); ++it) { delete (*it); } } @@ -17,7 +17,7 @@ CompoundGameRuleDefinition::~CompoundGameRuleDefinition() { void CompoundGameRuleDefinition::getChildren( std::vector* children) { GameRuleDefinition::getChildren(children); - for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++) + for (auto it = m_children.begin(); it != m_children.end(); it++) children->push_back(*it); } @@ -48,7 +48,7 @@ void CompoundGameRuleDefinition::populateGameRule( GameRulesInstance::EGameRulesInstanceType type, GameRule* rule) { GameRule* newRule = NULL; int i = 0; - for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) { + for (auto it = m_children.begin(); it != m_children.end(); ++it) { newRule = new GameRule(*it, rule->getConnection()); (*it)->populateGameRule(type, newRule); @@ -66,7 +66,7 @@ void CompoundGameRuleDefinition::populateGameRule( bool CompoundGameRuleDefinition::onUseTile(GameRule* rule, int tileId, int x, int y, int z) { bool statusChanged = false; - for (AUTO_VAR(it, rule->m_parameters.begin()); + for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end(); ++it) { if (it->second.isPointer) { bool changed = it->second.gr->getGameRuleDefinition()->onUseTile( @@ -84,7 +84,7 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule* rule, int tileId, int x, bool CompoundGameRuleDefinition::onCollectItem( GameRule* rule, std::shared_ptr item) { bool statusChanged = false; - for (AUTO_VAR(it, rule->m_parameters.begin()); + for (auto it = rule->m_parameters.begin(); it != rule->m_parameters.end(); ++it) { if (it->second.isPointer) { bool changed = @@ -102,7 +102,7 @@ bool CompoundGameRuleDefinition::onCollectItem( void CompoundGameRuleDefinition::postProcessPlayer( std::shared_ptr player) { - for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it) { + for (auto it = m_children.begin(); it != m_children.end(); ++it) { (*it)->postProcessPlayer(player); } } \ No newline at end of file diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp index cec5b1214..f253ddb7e 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleGenerateStructure.cpp @@ -18,7 +18,7 @@ void ConsoleGenerateStructure::getChildren( std::vector* children) { GameRuleDefinition::getChildren(children); - for (AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++) + for (auto it = m_actions.begin(); it != m_actions.end(); it++) children->push_back(*it); } @@ -104,7 +104,7 @@ 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 (auto it = m_actions.begin(); it != m_actions.end(); ++it) { ConsoleGenerateStructureAction* action = *it; maxX = std::max(maxX, action->getEndX()); maxY = std::max(maxY, action->getEndY()); @@ -121,7 +121,7 @@ bool ConsoleGenerateStructure::postProcess(Level* level, Random* random, BoundingBox* chunkBB) { if (level->dimension->id != m_dimension) return false; - for (AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it) { + for (auto it = m_actions.begin(); it != m_actions.end(); ++it) { ConsoleGenerateStructureAction* action = *it; switch (action->getActionType()) { diff --git a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp index 3ba460f65..e98c1c58c 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ConsoleSchematicFile.cpp @@ -169,7 +169,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream* dos) { ListTag* tileEntityTags = new ListTag(); tag->put(L"TileEntities", tileEntityTags); - for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); + for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); it++) { CompoundTag* cTag = new CompoundTag(); (*it)->save(cTag); @@ -179,7 +179,7 @@ void ConsoleSchematicFile::save_tags(DataOutputStream* dos) { ListTag* entityTags = new ListTag(); tag->put(L"Entities", entityTags); - for (AUTO_VAR(it, m_entities.begin()); it != m_entities.end(); it++) + for (auto it = m_entities.begin(); it != m_entities.end(); it++) entityTags->add((CompoundTag*)(*it).second->copy()); NbtIo::write(tag, dos); @@ -452,7 +452,7 @@ void ConsoleSchematicFile::schematicCoordToChunkCoord( void ConsoleSchematicFile::applyTileEntities(LevelChunk* chunk, AABB* chunkBox, AABB* destinationBox, ESchematicRotation rot) { - for (AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end(); + for (auto it = m_tileEntities.begin(); it != m_tileEntities.end(); ++it) { std::shared_ptr te = *it; @@ -499,7 +499,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; double targetX = source.x; @@ -714,7 +714,7 @@ void ConsoleSchematicFile::generateSchematicFile( getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize); - for (AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); + for (auto it = tileEntities->begin(); it != tileEntities->end(); ++it) { std::shared_ptr te = *it; CompoundTag* teTag = new CompoundTag(); @@ -738,7 +738,7 @@ void ConsoleSchematicFile::generateSchematicFile( level->getEntities(nullptr, &bb); ListTag* entitiesTag = new ListTag(L"entities"); - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { std::shared_ptr e = *it; bool mobCanBeSaved = false; @@ -1070,7 +1070,7 @@ ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk* chunk, int x0, int y0, int z0, int x1, int y1, int z1) { std::vector >* result = new std::vector >; - for (AUTO_VAR(it, chunk->tileEntities.begin()); + for (auto it = chunk->tileEntities.begin(); it != chunk->tileEntities.end(); ++it) { std::shared_ptr te = it->second; if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRule.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRule.cpp index 95e1a9037..35c52fc55 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRule.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRule.cpp @@ -7,7 +7,7 @@ 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.begin(); it != m_parameters.end(); ++it) { if (it->second.isPointer) { delete it->second.gr; } @@ -51,7 +51,7 @@ void GameRule::onCollectItem(std::shared_ptr item) { 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 (auto it = m_parameters.begin(); it != m_parameters.end(); it++) { std::wstring pName = (*it).first; ValueType vType = (*it).second; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp index 0cf38789b..e77714f8a 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleDefinition.cpp @@ -24,7 +24,7 @@ void GameRuleDefinition::write(DataOutputStream* dos) { // Write children. dos->writeInt(children->size()); - for (AUTO_VAR(it, children->begin()); it != children->end(); it++) + for (auto it = children->begin(); it != children->end(); it++) (*it)->write(dos); } @@ -119,7 +119,7 @@ GameRuleDefinition::enumerateMap() { int i = 0; std::vector* gRules = enumerate(); - for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++) + for (auto it = gRules->begin(); it != gRules->end(); it++) out->insert(std::pair(*it, i++)); return out; diff --git a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp index e51ff9d2c..c30d696c3 100644 --- a/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/GameRuleManager.cpp @@ -348,7 +348,7 @@ void GameRuleManager::writeRuleFile(DataOutputStream* dos) { std::unordered_map* files; files = getLevelGenerationOptions()->getUnfinishedSchematicFiles(); dos->writeInt(files->size()); - for (AUTO_VAR(it, files->begin()); it != files->end(); it++) { + for (auto it = files->begin(); it != files->end(); it++) { std::wstring filename = it->first; ConsoleSchematicFile* file = it->second; @@ -528,7 +528,7 @@ bool GameRuleManager::readRuleFile( 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; @@ -601,7 +601,7 @@ void GameRuleManager::readChildren( 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; diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp index f8e13ae50..6bed5528d 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp @@ -74,21 +74,21 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack* parentPack) { LevelGenerationOptions::~LevelGenerationOptions() { clearSchematics(); if (m_spawnPos != NULL) delete m_spawnPos; - for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); ++it) { delete *it; } - for (AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); + for (auto it = m_structureRules.begin(); it != m_structureRules.end(); ++it) { delete *it; } - for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); + for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end(); ++it) { delete *it; } - for (AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) { + for (auto it = m_features.begin(); it != m_features.end(); ++it) { delete *it; } @@ -124,20 +124,20 @@ void LevelGenerationOptions::getChildren( GameRuleDefinition::getChildren(children); std::vector used_schematics; - for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); it++) if (!(*it)->isComplete()) used_schematics.push_back(*it); - for (AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); + for (auto it = m_structureRules.begin(); it != m_structureRules.end(); it++) children->push_back(*it); - for (AUTO_VAR(it, used_schematics.begin()); it != used_schematics.end(); + for (auto it = used_schematics.begin(); it != used_schematics.end(); it++) children->push_back(*it); - for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); + for (auto 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) + for (auto it = m_features.begin(); it != m_features.end(); ++it) children->push_back(*it); } @@ -255,7 +255,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk* chunk) { chunk->z); AABB chunkBox(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(); + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); ++it) { ApplySchematicRuleDefinition* rule = *it; rule->processSchematic(&chunkBox, chunk); @@ -264,7 +264,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk* chunk) { int cx = (chunk->x << 4); int cz = (chunk->z << 4); - for (AUTO_VAR(it, m_structureRules.begin()); it != m_structureRules.end(); + for (auto it = m_structureRules.begin(); it != m_structureRules.end(); it++) { ConsoleGenerateStructure* structureStart = *it; @@ -283,7 +283,7 @@ void LevelGenerationOptions::processSchematicsLighting(LevelChunk* chunk) { chunk->x, chunk->z); AABB chunkBox(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(); + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); ++it) { ApplySchematicRuleDefinition* rule = *it; rule->processSchematicLighting(&chunkBox, chunk); @@ -300,14 +300,14 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, // ground/sea level and b) tutorial world additions generally being above // ground/sea level if (!m_bHaveMinY) { - for (AUTO_VAR(it, m_schematicRules.begin()); + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); ++it) { ApplySchematicRuleDefinition* rule = *it; int minY = rule->getMinY(); if (minY < m_minY) m_minY = minY; } - for (AUTO_VAR(it, m_structureRules.begin()); + for (auto it = m_structureRules.begin(); it != m_structureRules.end(); it++) { ConsoleGenerateStructure* structureStart = *it; int minY = structureStart->getMinY(); @@ -322,7 +322,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, if (y1 < m_minY) return false; bool intersects = false; - for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); ++it) { ApplySchematicRuleDefinition* rule = *it; intersects = rule->checkIntersects(x0, y0, z0, x1, y1, z1); @@ -330,7 +330,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, } if (!intersects) { - for (AUTO_VAR(it, m_structureRules.begin()); + for (auto it = m_structureRules.begin(); it != m_structureRules.end(); it++) { ConsoleGenerateStructure* structureStart = *it; intersects = @@ -343,7 +343,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, } void LevelGenerationOptions::clearSchematics() { - for (AUTO_VAR(it, m_schematics.begin()); it != m_schematics.end(); ++it) { + for (auto it = m_schematics.begin(); it != m_schematics.end(); ++it) { delete it->second; } m_schematics.clear(); @@ -353,7 +353,7 @@ ConsoleSchematicFile* LevelGenerationOptions::loadSchematicFile( const std::wstring& filename, std::uint8_t* pbData, unsigned int dataLength) { // If we have already loaded this, just return - AUTO_VAR(it, m_schematics.find(filename)); + auto it = m_schematics.find(filename); if (it != m_schematics.end()) { #if !defined(_CONTENT_PACKAGE) wprintf(L"We have already loaded schematic file %ls\n", @@ -378,7 +378,7 @@ ConsoleSchematicFile* LevelGenerationOptions::getSchematicFile( const std::wstring& filename) { 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; } @@ -389,7 +389,7 @@ void LevelGenerationOptions::releaseSchematicFile( const std::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; @@ -416,7 +416,7 @@ const wchar_t* LevelGenerationOptions::getString(const std::wstring& key) { void LevelGenerationOptions::getBiomeOverride(int biomeId, std::uint8_t& tile, std::uint8_t& topTile) { - for (AUTO_VAR(it, m_biomeOverrides.begin()); it != m_biomeOverrides.end(); + for (auto it = m_biomeOverrides.begin(); it != m_biomeOverrides.end(); ++it) { BiomeOverride* bo = *it; if (bo->isBiome(biomeId)) { @@ -431,7 +431,7 @@ bool LevelGenerationOptions::isFeatureChunk( int* orientation) { bool isFeature = false; - for (AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it) { + for (auto it = m_features.begin(); it != m_features.end(); ++it) { StartFeature* sf = *it; if (sf->isFeatureChunk(chunkX, chunkZ, feature, orientation)) { isFeature = true; @@ -446,14 +446,14 @@ LevelGenerationOptions::getUnfinishedSchematicFiles() { // Clean schematic rules. std::unordered_set usedFiles = std::unordered_set(); - for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); it++) if (!(*it)->isComplete()) usedFiles.insert((*it)->getSchematicName()); // Clean schematic files. std::unordered_map* out = new std::unordered_map(); - for (AUTO_VAR(it, usedFiles.begin()); it != usedFiles.end(); it++) + for (auto it = usedFiles.begin(); it != usedFiles.end(); it++) out->insert(std::pair( *it, getSchematicFile(*it))); @@ -624,7 +624,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam, int iPad, DWORD dwErr, } void LevelGenerationOptions::reset_start() { - for (AUTO_VAR(it, m_schematicRules.begin()); it != m_schematicRules.end(); + for (auto it = m_schematicRules.begin(); it != m_schematicRules.end(); it++) { (*it)->reset(); } diff --git a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp index 30bc16254..c76004877 100644 --- a/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp @@ -7,14 +7,14 @@ LevelRuleset::LevelRuleset() { m_stringTable = NULL; } 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; } } void LevelRuleset::getChildren(std::vector* children) { CompoundGameRuleDefinition::getChildren(children); - for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); it++) + for (auto it = m_areas.begin(); it != m_areas.end(); it++) children->push_back(*it); } @@ -44,7 +44,7 @@ const wchar_t* LevelRuleset::getString(const std::wstring& key) { AABB* LevelRuleset::getNamedArea(const std::wstring& areaName) { AABB* area = NULL; - for (AUTO_VAR(it, m_areas.begin()); it != m_areas.end(); ++it) { + for (auto it = m_areas.begin(); it != m_areas.end(); ++it) { if ((*it)->getName().compare(areaName) == 0) { area = (*it)->getArea(); break; diff --git a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp index 1a160a017..9dc2bbf82 100644 --- a/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/UpdatePlayerRuleDefinition.cpp @@ -17,7 +17,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() { } UpdatePlayerRuleDefinition::~UpdatePlayerRuleDefinition() { - for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it) { + for (auto it = m_items.begin(); it != m_items.end(); ++it) { delete *it; } } @@ -54,7 +54,7 @@ void UpdatePlayerRuleDefinition::writeAttributes(DataOutputStream* dos, void UpdatePlayerRuleDefinition::getChildren( std::vector* children) { GameRuleDefinition::getChildren(children); - for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); it++) + for (auto it = m_items.begin(); it != m_items.end(); it++) children->push_back(*it); } @@ -147,7 +147,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer( 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 it = m_items.begin(); it != m_items.end(); ++it) { AddItemRuleDefinition* addItem = *it; addItem->addItemToContainer(player->inventory, -1); diff --git a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp index 2a8f5950b..ecfe3c385 100644 --- a/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/XboxStructureActionPlaceContainer.cpp @@ -12,7 +12,7 @@ XboxStructureActionPlaceContainer::XboxStructureActionPlaceContainer() { } XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer() { - for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); ++it) { + for (auto it = m_items.begin(); it != m_items.end(); ++it) { delete *it; } } @@ -24,7 +24,7 @@ XboxStructureActionPlaceContainer::~XboxStructureActionPlaceContainer() { void XboxStructureActionPlaceContainer::getChildren( std::vector* children) { XboxStructureActionPlaceBlock::getChildren(children); - for (AUTO_VAR(it, m_items.begin()); it != m_items.end(); it++) + for (auto it = m_items.begin(); it != m_items.end(); it++) children->push_back(*it); } @@ -88,7 +88,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel( Tile::UPDATE_CLIENTS); // Add items int slotId = 0; - for (AUTO_VAR(it, m_items.begin()); + for (auto it = m_items.begin(); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId) { diff --git a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp index 4b9a519cc..bda8428c4 100644 --- a/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp @@ -444,7 +444,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, do { // We need to keep ticking the connections for players that // already logged in - for (AUTO_VAR(it, createdConnections.begin()); + for (auto it = createdConnections.begin(); it < createdConnections.end(); ++it) { (*it)->tick(); } @@ -482,8 +482,8 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, idx, CONTEXT_PRESENCE_MULTIPLAYER, false); } else { connection->close(); - AUTO_VAR(it, find(createdConnections.begin(), - createdConnections.end(), connection)); + auto it = find(createdConnections.begin(), + createdConnections.end(), connection); if (it != createdConnections.end()) createdConnections.erase(it); } @@ -497,7 +497,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft, } if (g_NetworkManager.IsLeavingGame() || !IsInSession()) { - for (AUTO_VAR(it, createdConnections.begin()); + for (auto it = createdConnections.begin(); it < createdConnections.end(); ++it) { (*it)->close(); } @@ -940,7 +940,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { // them being removed from the server when removed from the session if (pServer != NULL) { PlayerList* players = pServer->getPlayers(); - for (AUTO_VAR(it, players->players.begin()); + for (auto it = players->players.begin(); it < players->players.end(); ++it) { std::shared_ptr servPlayer = *it; if (servPlayer->connection->isLocal() && @@ -1005,7 +1005,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) { pMinecraft->localplayers[index]->getXuid(); PlayerList* players = pServer->getPlayers(); - for (AUTO_VAR(it, players->players.begin()); + for (auto it = players->players.begin(); it < players->players.end(); ++it) { std::shared_ptr servPlayer = *it; if (servPlayer->getXuid() == localPlayerXuid) { diff --git a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp index 929351a85..46ba11489 100644 --- a/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Platform/Common/Network/PlatformNetworkManagerStub.cpp @@ -50,7 +50,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer* pQNetPlayer) { if (m_pIQNet->IsHost() && !m_bHostChanged) { // Do we already have a primary player for this system? bool systemHasPrimaryPlayer = false; - for (AUTO_VAR(it, m_machineQNetPrimaryPlayers.begin()); + for (auto it = m_machineQNetPrimaryPlayers.begin(); it < m_machineQNetPrimaryPlayers.end(); ++it) { IQNetPlayer* pQNetPrimaryPlayer = *it; if (pQNetPlayer->IsSameSystem(pQNetPrimaryPlayer)) { @@ -512,7 +512,7 @@ INetworkPlayer* CPlatformNetworkManagerStub::addNetworkPlayer( void CPlatformNetworkManagerStub::removeNetworkPlayer( IQNetPlayer* pQNetPlayer) { INetworkPlayer* pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - for (AUTO_VAR(it, currentNetworkPlayers.begin()); + for (auto it = currentNetworkPlayers.begin(); it != currentNetworkPlayers.end(); it++) { if (*it == pNetworkPlayer) { currentNetworkPlayers.erase(it); diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp index 87cdb2126..440bfa90c 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaTask.cpp @@ -21,7 +21,7 @@ bool AreaTask::isCompleted() { switch (m_completionState) { case eAreaTaskCompletion_CompleteOnConstraintsSatisfied: { bool allSatisfied = true; - for (AUTO_VAR(it, constraints.begin()); it != constraints.end(); + for (auto it = constraints.begin(); it != constraints.end(); ++it) { TutorialConstraint* constraint = *it; if (!constraint->isConstraintSatisfied(tutorial->getPad())) { diff --git a/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp index 2149d03e3..079e7bf59 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/InfoTask.cpp @@ -45,7 +45,7 @@ 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()); + for (auto it = completedMappings.begin(); it != completedMappings.end(); ++it) { bool current = (*it).second; if (!current) { @@ -56,7 +56,7 @@ bool InfoTask::isCompleted() { } else { int iCurrent = 0; - for (AUTO_VAR(it, completedMappings.begin()); + for (auto it = completedMappings.begin(); it != completedMappings.end(); ++it) { bool current = (*it).second; if (!current) { @@ -94,7 +94,7 @@ void InfoTask::setAsCurrentTask(bool active /*= true*/) { void InfoTask::handleUIInput(int iAction) { if (bHasBeenActivated) { - for (AUTO_VAR(it, completedMappings.begin()); + for (auto it = completedMappings.begin(); it != completedMappings.end(); ++it) { if (iAction == (*it).first) { (*it).second = true; diff --git a/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp index 5850ee83f..441eb708a 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ProcedureCompoundTask.cpp @@ -2,7 +2,7 @@ #include "ProcedureCompoundTask.h" ProcedureCompoundTask::~ProcedureCompoundTask() { - for (AUTO_VAR(it, m_taskSequence.begin()); it < m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < m_taskSequence.end(); ++it) { delete (*it); } @@ -19,8 +19,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) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; if (!task->isCompleted()) { task->setAsCurrentTask(true); @@ -40,8 +40,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) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; if (!task->isCompleted()) { promptId = task->getPromptId(); @@ -56,8 +56,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) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; if (allCompleted && isCurrentTask) { @@ -80,7 +80,7 @@ bool ProcedureCompoundTask::isCompleted() { if (allCompleted) { // Disable all constraints itEnd = m_taskSequence.end(); - for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; task->enableConstraints(false); } @@ -90,16 +90,16 @@ bool ProcedureCompoundTask::isCompleted() { } void ProcedureCompoundTask::onCrafted(std::shared_ptr item) { - AUTO_VAR(itEnd, m_taskSequence.end()); - for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { 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) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; task->handleUIInput(iAction); } @@ -107,8 +107,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) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; if (allCompleted && !task->isCompleted()) { task->setAsCurrentTask(true); @@ -123,8 +123,8 @@ bool ProcedureCompoundTask::ShowMinimumTime() { if (bIsCompleted) return false; bool showMinimumTime = false; - AUTO_VAR(itEnd, m_taskSequence.end()); - for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; if (!task->isCompleted()) { showMinimumTime = task->ShowMinimumTime(); @@ -138,8 +138,8 @@ bool ProcedureCompoundTask::hasBeenActivated() { if (bIsCompleted) return true; bool hasBeenActivated = false; - AUTO_VAR(itEnd, m_taskSequence.end()); - for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; if (!task->isCompleted()) { hasBeenActivated = task->hasBeenActivated(); @@ -150,8 +150,8 @@ bool ProcedureCompoundTask::hasBeenActivated() { } void ProcedureCompoundTask::setShownForMinimumTime() { - AUTO_VAR(itEnd, m_taskSequence.end()); - for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; if (!task->isCompleted()) { task->setShownForMinimumTime(); @@ -164,8 +164,8 @@ bool ProcedureCompoundTask::AllowFade() { if (bIsCompleted) return true; bool allowFade = true; - AUTO_VAR(itEnd, m_taskSequence.end()); - for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; if (!task->isCompleted()) { allowFade = task->AllowFade(); @@ -178,8 +178,8 @@ bool ProcedureCompoundTask::AllowFade() { void ProcedureCompoundTask::useItemOn(Level* level, std::shared_ptr 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) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; task->useItemOn(level, item, x, y, z, bTestUseOnly); } @@ -187,8 +187,8 @@ void ProcedureCompoundTask::useItemOn(Level* level, void ProcedureCompoundTask::useItem(std::shared_ptr item, bool bTestUseOnly) { - AUTO_VAR(itEnd, m_taskSequence.end()); - for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; task->useItem(item, bTestUseOnly); } @@ -197,16 +197,16 @@ void ProcedureCompoundTask::useItem(std::shared_ptr item, void ProcedureCompoundTask::onTake(std::shared_ptr item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { - AUTO_VAR(itEnd, m_taskSequence.end()); - for (AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { 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) { + auto itEnd = m_taskSequence.end(); + for (auto it = m_taskSequence.begin(); it < itEnd; ++it) { TutorialTask* task = *it; task->onStateChange(newState); } diff --git a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp index 0b4e6fbea..268c5bc56 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp @@ -1929,7 +1929,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad(iPad) { } Tutorial::~Tutorial() { - for (AUTO_VAR(it, m_globalConstraints.begin()); + for (auto it = m_globalConstraints.begin(); it != m_globalConstraints.end(); ++it) { delete (*it); } @@ -1939,11 +1939,11 @@ Tutorial::~Tutorial() { delete (*it).second; } for (unsigned int i = 0; i < e_Tutorial_State_Max; ++i) { - for (AUTO_VAR(it, activeTasks[i].begin()); it < activeTasks[i].end(); + for (auto it = activeTasks[i].begin(); it < activeTasks[i].end(); ++it) { delete (*it); } - for (AUTO_VAR(it, hints[i].begin()); it < hints[i].end(); ++it) { + for (auto it = hints[i].begin(); it < hints[i].end(); ++it) { delete (*it); } @@ -1968,7 +1968,7 @@ void Tutorial::setCompleted(int completableId) { // } int completableIndex = -1; - for (AUTO_VAR(it, s_completableTasks.begin()); + for (auto it = s_completableTasks.begin(); it < s_completableTasks.end(); ++it) { ++completableIndex; if (*it == completableId) { @@ -1996,7 +1996,7 @@ bool Tutorial::getCompleted(int completableId) { // } int completableIndex = -1; - for (AUTO_VAR(it, s_completableTasks.begin()); + for (auto it = s_completableTasks.begin(); it < s_completableTasks.end(); ++it) { ++completableIndex; if (*it == completableId) { @@ -2079,7 +2079,7 @@ void Tutorial::tick() { bool taskChanged = false; for (unsigned int state = 0; state < e_Tutorial_State_Max; ++state) { - AUTO_VAR(it, constraintsToRemove[state].begin()); + auto it = constraintsToRemove[state].begin(); while (it < constraintsToRemove[state].end()) { ++(*it).second; if ((*it).second > m_iTutorialConstraintDelayRemoveTicks) { @@ -2152,7 +2152,7 @@ void Tutorial::tick() { } // Check constraints - for (AUTO_VAR(it, m_globalConstraints.begin()); + for (auto it = m_globalConstraints.begin(); it < m_globalConstraints.end(); ++it) { TutorialConstraint* constraint = *it; constraint->tick(m_iPad); @@ -2167,7 +2167,7 @@ void Tutorial::tick() { m_isFullTutorial || app.GetGameSettings(m_iPad, eGameSetting_Hints); if (hintsOn) { - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->tick(); @@ -2195,7 +2195,7 @@ void Tutorial::tick() { constraintChanged = true; currentFailedConstraint[m_CurrentState] = NULL; } - for (AUTO_VAR(it, constraints[m_CurrentState].begin()); + for (auto it = constraints[m_CurrentState].begin(); it < constraints[m_CurrentState].end(); ++it) { TutorialConstraint* constraint = *it; if (!constraint->isConstraintSatisfied(m_iPad) && @@ -2210,7 +2210,7 @@ void Tutorial::tick() { currentFailedConstraint[m_CurrentState] == NULL) { // Update tasks bool isCurrentTask = true; - AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + auto it = activeTasks[m_CurrentState].begin(); while (activeTasks[m_CurrentState].size() > 0 && it < activeTasks[m_CurrentState].end()) { TutorialTask* task = *it; @@ -2233,9 +2233,9 @@ 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, + auto itCon = constraintsToRemove[m_CurrentState] - .begin()); + .begin(); while ( itCon != constraintsToRemove[m_CurrentState].end()) { @@ -2259,9 +2259,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()); + for (auto + itRem = + activeTasks[m_CurrentState].begin(); itRem < activeTasks[m_CurrentState].end(); ++itRem) { delete (*itRem); @@ -2273,9 +2273,9 @@ void Tutorial::tick() { activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1); activeTasks[m_CurrentState].pop_back(); - for (AUTO_VAR( - itRem, - activeTasks[m_CurrentState].begin()); + for (auto + itRem = + activeTasks[m_CurrentState].begin(); itRem < activeTasks[m_CurrentState].end(); ++itRem) { delete (*itRem); @@ -2433,7 +2433,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) { if (!message->m_messageString.empty()) { text = message->m_messageString; } else { - AUTO_VAR(it, messages.find(message->m_messageId)); + auto it = messages.find(message->m_messageId); if (it != messages.end() && it->second != NULL) { TutorialMessage* messageString = it->second; text = std::wstring(messageString->getMessageForDisplay()); @@ -2457,7 +2457,7 @@ bool Tutorial::setMessage(PopupMessageDetails* message) { if (!message->m_promptString.empty()) { text.append(message->m_promptString); } else if (message->m_promptId >= 0) { - AUTO_VAR(it, messages.find(message->m_promptId)); + auto it = messages.find(message->m_promptId); if (it != messages.end() && it->second != NULL) { TutorialMessage* prompt = it->second; text.append(prompt->getMessageForDisplay()); @@ -2555,7 +2555,7 @@ void Tutorial::showTutorialPopup(bool show) { void Tutorial::useItemOn(Level* level, std::shared_ptr item, int x, int y, int z, bool bTestUseOnly) { - for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + for (auto it = activeTasks[m_CurrentState].begin(); it < activeTasks[m_CurrentState].end(); ++it) { TutorialTask* task = *it; task->useItemOn(level, item, x, y, z, bTestUseOnly); @@ -2564,7 +2564,7 @@ void Tutorial::useItemOn(Level* level, std::shared_ptr item, void Tutorial::useItemOn(std::shared_ptr item, bool bTestUseOnly) { - for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + for (auto it = activeTasks[m_CurrentState].begin(); it < activeTasks[m_CurrentState].end(); ++it) { TutorialTask* task = *it; task->useItem(item, bTestUseOnly); @@ -2572,7 +2572,7 @@ void Tutorial::useItemOn(std::shared_ptr item, } void Tutorial::completeUsingItem(std::shared_ptr item) { - for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + for (auto it = activeTasks[m_CurrentState].begin(); it < activeTasks[m_CurrentState].end(); ++it) { TutorialTask* task = *it; task->completeUsingItem(item); @@ -2581,7 +2581,7 @@ void Tutorial::completeUsingItem(std::shared_ptr 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()); + for (auto it = activeTasks[e_Tutorial_State_Gameplay].begin(); it < activeTasks[e_Tutorial_State_Gameplay].end(); ++it) { TutorialTask* task = *it; task->completeUsingItem(item); @@ -2592,7 +2592,7 @@ void Tutorial::completeUsingItem(std::shared_ptr item) { void Tutorial::startDestroyBlock(std::shared_ptr item, Tile* tile) { int hintNeeded = -1; - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->startDestroyBlock(item, tile); @@ -2607,7 +2607,7 @@ void Tutorial::startDestroyBlock(std::shared_ptr item, void Tutorial::destroyBlock(Tile* tile) { int hintNeeded = -1; - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->destroyBlock(tile); @@ -2623,7 +2623,7 @@ void Tutorial::destroyBlock(Tile* tile) { void Tutorial::attack(std::shared_ptr player, std::shared_ptr entity) { int hintNeeded = -1; - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->attack(player->inventory->getSelected(), entity); @@ -2638,7 +2638,7 @@ void Tutorial::attack(std::shared_ptr player, void Tutorial::itemDamaged(std::shared_ptr item) { int hintNeeded = -1; - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->itemDamaged(item); @@ -2654,7 +2654,7 @@ void Tutorial::itemDamaged(std::shared_ptr item) { void Tutorial::handleUIInput(int iAction) { if (m_hintDisplayed) return; - // for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < + // for(auto it = activeTasks[m_CurrentState].begin(); it < // activeTasks[m_CurrentState].end(); ++it) //{ // TutorialTask *task = *it; @@ -2667,7 +2667,7 @@ void Tutorial::handleUIInput(int iAction) { void Tutorial::createItemSelected(std::shared_ptr item, bool canMake) { int hintNeeded = -1; - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->createItemSelected(item, canMake); @@ -2682,7 +2682,7 @@ void Tutorial::createItemSelected(std::shared_ptr item, void Tutorial::onCrafted(std::shared_ptr item) { for (unsigned int state = 0; state < e_Tutorial_State_Max; ++state) { - for (AUTO_VAR(it, activeTasks[state].begin()); + for (auto it = activeTasks[state].begin(); it < activeTasks[state].end(); ++it) { TutorialTask* task = *it; task->onCrafted(item); @@ -2695,7 +2695,7 @@ void Tutorial::onTake(std::shared_ptr item, unsigned int invItemCountThisAux) { if (!m_hintDisplayed) { bool hintNeeded = false; - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->onTake(item); @@ -2706,7 +2706,7 @@ void Tutorial::onTake(std::shared_ptr item, } for (unsigned int state = 0; state < e_Tutorial_State_Max; ++state) { - for (AUTO_VAR(it, activeTasks[state].begin()); + for (auto it = activeTasks[state].begin(); it < activeTasks[state].end(); ++it) { TutorialTask* task = *it; task->onTake(item, invItemCountAnyAux, invItemCountThisAux); @@ -2738,7 +2738,7 @@ void Tutorial::onLookAt(int id, int iData) { if (m_hintDisplayed) return; bool hintNeeded = false; - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->onLookAt(id, iData); @@ -2764,7 +2764,7 @@ void Tutorial::onLookAtEntity(std::shared_ptr entity) { if (m_hintDisplayed) return; bool hintNeeded = false; - for (AUTO_VAR(it, hints[m_CurrentState].begin()); + for (auto it = hints[m_CurrentState].begin(); it < hints[m_CurrentState].end(); ++it) { TutorialHint* hint = *it; hintNeeded = hint->onLookAtEntity(entity->GetType()); @@ -2778,7 +2778,7 @@ void Tutorial::onLookAtEntity(std::shared_ptr entity) { changeTutorialState(e_Tutorial_State_Horse); } - for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + for (auto it = activeTasks[m_CurrentState].begin(); it != activeTasks[m_CurrentState].end(); ++it) { (*it)->onLookAtEntity(entity); } @@ -2798,14 +2798,14 @@ void Tutorial::onRideEntity(std::shared_ptr entity) { } } - for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + for (auto it = activeTasks[m_CurrentState].begin(); it != activeTasks[m_CurrentState].end(); ++it) { (*it)->onRideEntity(entity); } } void Tutorial::onEffectChanged(MobEffect* effect, bool bRemoved) { - for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); + for (auto it = activeTasks[m_CurrentState].begin(); it < activeTasks[m_CurrentState].end(); ++it) { TutorialTask* task = *it; task->onEffectChanged(effect, bRemoved); @@ -2815,7 +2815,7 @@ 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()); + for (auto it = constraints[m_CurrentState].begin(); it < constraints[m_CurrentState].end(); ++it) { TutorialConstraint* constraint = *it; if (!constraint->isConstraintSatisfied(m_iPad) && @@ -2837,7 +2837,7 @@ bool Tutorial::isInputAllowed(int mapping) { return true; bool allowed = true; - for (AUTO_VAR(it, constraints[m_CurrentState].begin()); + for (auto it = constraints[m_CurrentState].begin(); it < constraints[m_CurrentState].end(); ++it) { TutorialConstraint* constraint = *it; if (constraint->isMappingConstrained(m_iPad, mapping)) { @@ -2852,7 +2852,7 @@ std::vector* Tutorial::getTasks() { return &tasks; } unsigned int Tutorial::getCurrentTaskIndex() { unsigned int index = 0; - for (AUTO_VAR(it, tasks.begin()); it < tasks.end(); ++it) { + for (auto it = tasks.begin(); it < tasks.end(); ++it) { if (*it == currentTask[e_Tutorial_State_Gameplay]) break; ++index; @@ -2875,7 +2875,7 @@ void Tutorial::RemoveConstraint(TutorialConstraint* c, 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 < + /*for(auto it = constraintsToRemove[m_CurrentState].begin(); it < constraintsToRemove[m_CurrentState].end(); ++it) { if( it->first == c ) @@ -2889,7 +2889,7 @@ void Tutorial::RemoveConstraint(TutorialConstraint* c, constraintsToRemove[m_CurrentState].push_back( std::pair(c, 0)); } else { - for (AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); + for (auto it = constraintsToRemove[m_CurrentState].begin(); it < constraintsToRemove[m_CurrentState].end(); ++it) { if (it->first == c) { constraintsToRemove[m_CurrentState].erase(it); @@ -2897,8 +2897,8 @@ void Tutorial::RemoveConstraint(TutorialConstraint* c, } } - AUTO_VAR(it, find(constraints[m_CurrentState].begin(), - constraints[m_CurrentState].end(), c)); + auto it = find(constraints[m_CurrentState].begin(), + constraints[m_CurrentState].end(), c); if (it != constraints[m_CurrentState].end()) constraints[m_CurrentState].erase( find(constraints[m_CurrentState].begin(), @@ -2990,7 +2990,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState, m_UIScene = scene; if (m_CurrentState != newState) { - for (AUTO_VAR(it, activeTasks[newState].begin()); + for (auto it = activeTasks[newState].begin(); it < activeTasks[newState].end(); ++it) { TutorialTask* task = *it; task->onStateChange(newState); diff --git a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp index 1d37ce30b..395c29449 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp @@ -20,7 +20,7 @@ TutorialTask::TutorialTask(Tutorial* tutorial, int descriptionId, m_bShowMinimumTime(bShowMinimumTime), m_bShownForMinimumTime(false) { if (inConstraints != NULL) { - for (AUTO_VAR(it, inConstraints->begin()); it < inConstraints->end(); + for (auto it = inConstraints->begin(); it < inConstraints->end(); ++it) { TutorialConstraint* constraint = *it; constraints.push_back(constraint); @@ -34,7 +34,7 @@ TutorialTask::TutorialTask(Tutorial* tutorial, int descriptionId, TutorialTask::~TutorialTask() { enableConstraints(false); - for (AUTO_VAR(it, constraints.begin()); it < constraints.end(); ++it) { + for (auto it = constraints.begin(); it < constraints.end(); ++it) { TutorialConstraint* constraint = *it; if (constraint->getQueuedForRemoval()) { @@ -53,7 +53,7 @@ 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 it = constraints.begin(); it != constraints.end(); ++it) { TutorialConstraint* constraint = *it; // app.DebugPrintf(">>>>>>>> %i\n", constraints.size()); tutorial->RemoveConstraint(constraint, delayRemove); @@ -61,7 +61,7 @@ void TutorialTask::enableConstraints(bool enable, areConstraintsEnabled = false; } else if (!areConstraintsEnabled && enable) { // Add - for (AUTO_VAR(it, constraints.begin()); it != constraints.end(); ++it) { + for (auto it = constraints.begin(); it != constraints.end(); ++it) { TutorialConstraint* constraint = *it; tutorial->AddConstraint(constraint); } diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp index c398b7379..847f490e4 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CraftingMenu.cpp @@ -631,7 +631,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() { 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 diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp index 47c28d4c6..f33c798aa 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp @@ -982,8 +982,8 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu* menu, // Fill the dynamic group if (m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL) { - for (AUTO_VAR(it, - categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin()); + for (auto it= + categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it) { diff --git a/Minecraft.Client/Platform/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Platform/Common/UI/IUIScene_TradingMenu.cpp index 002725781..74b9fec9a 100644 --- a/Minecraft.Client/Platform/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/IUIScene_TradingMenu.cpp @@ -180,7 +180,7 @@ void IUIScene_TradingMenu::updateDisplay() { m_activeOffers.clear(); int unfilteredIndex = 0; int firstValidTrade = INT_MAX; - for (AUTO_VAR(it, unfilteredOffers->begin()); + for (auto it = unfilteredOffers->begin(); it != unfilteredOffers->end(); ++it) { MerchantRecipe* recipe = *it; if (!recipe->isDeprecated()) { diff --git a/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.cpp index f0b94d8db..85c11e9e6 100644 --- a/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -214,7 +214,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion* region) { // *pAdditionalModelParts=mob->GetAdditionalModelParts(); if (m_pvAdditionalModelParts && m_pvAdditionalModelParts->size() != 0) { - for (AUTO_VAR(it, m_pvAdditionalModelParts->begin()); + for (auto it = m_pvAdditionalModelParts->begin(); it != m_pvAdditionalModelParts->end(); ++it) { ModelPart* pModelPart = *it; @@ -227,7 +227,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion* region) { // hide the additional parts if (m_pvAdditionalModelParts && m_pvAdditionalModelParts->size() != 0) { - for (AUTO_VAR(it, m_pvAdditionalModelParts->begin()); + for (auto it = m_pvAdditionalModelParts->begin(); it != m_pvAdditionalModelParts->end(); ++it) { ModelPart* pModelPart = *it; diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index 9f1ea23a3..ac6680c62 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -452,7 +452,7 @@ void UIController::tick() { // Clear out the cached movie file data int64_t currentTime = System::currentTimeMillis(); - for (AUTO_VAR(it, m_cachedMovieData.begin()); + for (auto it = m_cachedMovieData.begin(); it != m_cachedMovieData.end();) { if (it->second.m_expiry < currentTime) { delete[] it->second.m_ba.data; @@ -667,7 +667,7 @@ void UIController::CleanUpSkinReload() { } } - for (AUTO_VAR(it, m_queuedMessageBoxData.begin()); + for (auto it = m_queuedMessageBoxData.begin(); it != m_queuedMessageBoxData.end(); ++it) { QueuedMessageBoxData* queuedData = *it; ui.NavigateToScene(queuedData->iPad, eUIScene_MessageBox, @@ -682,7 +682,7 @@ void UIController::CleanUpSkinReload() { byteArray UIController::getMovieData(const std::wstring& filename) { // Cache everything we load in the current tick int64_t targetTime = System::currentTimeMillis() + (1000LL * 60); - AUTO_VAR(it, m_cachedMovieData.find(filename)); + auto it = m_cachedMovieData.find(filename); if (it == m_cachedMovieData.end()) { byteArray baFile = app.getArchiveFile(filename); CachedMovieData cmd; @@ -1095,8 +1095,8 @@ 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)); + auto it = + uiController->m_substitutionTextures.find((wchar_t*)texture_name); if (it != uiController->m_substitutionTextures.end()) { app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", @@ -1158,7 +1158,7 @@ void UIController::registerSubstitutionTexture(const std::wstring& textureName, void UIController::unregisterSubstitutionTexture( const std::wstring& textureName, bool deleteData) { - AUTO_VAR(it, m_substitutionTextures.find(textureName)); + auto it = m_substitutionTextures.find(textureName); if (it != m_substitutionTextures.end()) { if (deleteData) delete[] it->second.data; @@ -1393,7 +1393,7 @@ size_t UIController::RegisterForCallbackId(UIScene* scene) { void UIController::UnregisterCallbackId(size_t id) { EnterCriticalSection(&m_registeredCallbackScenesCS); - AUTO_VAR(it, m_registeredCallbackScenes.find(id)); + auto it = m_registeredCallbackScenes.find(id); if (it != m_registeredCallbackScenes.end()) { m_registeredCallbackScenes.erase(it); } @@ -1402,7 +1402,7 @@ void UIController::UnregisterCallbackId(size_t id) { UIScene* UIController::GetSceneFromCallbackId(size_t id) { UIScene* scene = NULL; - AUTO_VAR(it, m_registeredCallbackScenes.find(id)); + auto it = m_registeredCallbackScenes.find(id); if (it != m_registeredCallbackScenes.end()) { scene = it->second; } diff --git a/Minecraft.Client/Platform/Common/UI/UILayer.cpp b/Minecraft.Client/Platform/Common/UI/UILayer.cpp index 204852864..4ef4bd940 100644 --- a/Minecraft.Client/Platform/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Platform/Common/UI/UILayer.cpp @@ -18,7 +18,7 @@ void UILayer::tick() { // so we need to make a copy of the scenes that we are going to try and // destroy this tick std::vector scenesToDeleteCopy; - for (AUTO_VAR(it, m_scenesToDelete.begin()); it != m_scenesToDelete.end(); + for (auto it = m_scenesToDelete.begin(); it != m_scenesToDelete.end(); it++) { UIScene* scene = (*it); scenesToDeleteCopy.push_back(scene); @@ -28,7 +28,7 @@ void UILayer::tick() { // 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()); + for (auto it = scenesToDeleteCopy.begin(); it != scenesToDeleteCopy.end(); it++) { UIScene* scene = (*it); if (scene->isReadyToDelete()) { @@ -45,12 +45,12 @@ void UILayer::tick() { } m_scenesToDestroy.clear(); - for (AUTO_VAR(it, m_components.begin()); it != m_components.end(); ++it) { + for (auto it = m_components.begin(); it != m_components.end(); ++it) { (*it)->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) + // for(auto it = m_sceneStack.rbegin(); it != m_sceneStack.rend(); ++it) while (sceneIndex >= 0 && sceneIndex < m_sceneStack.size()) { //(*it)->tick(); UIScene* scene = m_sceneStack[sceneIndex]; @@ -63,9 +63,9 @@ void UILayer::tick() { void UILayer::render(S32 width, S32 height, C4JRender::eViewportType viewport) { if (!ui.IsExpectingOrReloadingSkin()) { - for (AUTO_VAR(it, m_components.begin()); it != m_components.end(); + for (auto it = m_components.begin(); it != m_components.end(); ++it) { - AUTO_VAR(itRef, m_componentRefCount.find((*it)->getSceneType())); + auto itRef = m_componentRefCount.find((*it)->getSceneType()); if (itRef != m_componentRefCount.end() && itRef->second.second) { if ((*it)->isVisible()) { PIXBeginNamedEvent(0, "Rendering component %d", @@ -125,7 +125,7 @@ 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.begin(); it != m_components.end(); ++it) { if ((*it)->hidesLowerScenes()) { hidesScenes = true; break; @@ -147,16 +147,16 @@ 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.begin(); it != m_components.end(); ++it) { (*it)->destroyMovie(); } - for (AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) { + for (auto it = m_sceneStack.begin(); it != m_sceneStack.end(); ++it) { (*it)->destroyMovie(); } } void UILayer::ReloadAll(bool force) { - for (AUTO_VAR(it, m_components.begin()); it != m_components.end(); ++it) { + for (auto it = m_components.begin(); it != m_components.end(); ++it) { (*it)->reloadMovie(force); } if (!m_sceneStack.empty()) { @@ -437,7 +437,7 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene) { } void UILayer::showComponent(int iPad, EUIScene scene, bool show) { - AUTO_VAR(it, m_componentRefCount.find(scene)); + auto it = m_componentRefCount.find(scene); if (it != m_componentRefCount.end()) { it->second.second = show; return; @@ -447,7 +447,7 @@ void UILayer::showComponent(int iPad, EUIScene scene, bool show) { bool UILayer::isComponentVisible(EUIScene scene) { bool visible = false; - AUTO_VAR(it, m_componentRefCount.find(scene)); + auto it = m_componentRefCount.find(scene); if (it != m_componentRefCount.end()) { visible = it->second.second; } @@ -455,11 +455,11 @@ bool UILayer::isComponentVisible(EUIScene scene) { } UIScene* UILayer::addComponent(int iPad, EUIScene scene, void* initData) { - AUTO_VAR(it, m_componentRefCount.find(scene)); + auto it = m_componentRefCount.find(scene); if (it != m_componentRefCount.end()) { ++it->second.first; - for (AUTO_VAR(itComp, m_components.begin()); + for (auto itComp = m_components.begin(); itComp != m_components.end(); ++itComp) { if ((*itComp)->getSceneType() == scene) { return *itComp; @@ -525,13 +525,13 @@ UIScene* UILayer::addComponent(int iPad, EUIScene scene, void* initData) { } void UILayer::removeComponent(EUIScene scene) { - AUTO_VAR(it, m_componentRefCount.find(scene)); + 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()); + for (auto compIt = m_components.begin(); compIt != m_components.end();) { if ((*compIt)->getSceneType() == scene) { m_scenesToDelete.push_back((*compIt)); @@ -548,8 +548,8 @@ void UILayer::removeComponent(EUIScene scene) { void UILayer::removeScene(UIScene* scene) { - AUTO_VAR(newEnd, - std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene)); + auto newEnd = + std::remove(m_sceneStack.begin(), m_sceneStack.end(), scene); m_sceneStack.erase(newEnd, m_sceneStack.end()); m_scenesToDelete.push_back(scene); @@ -571,7 +571,7 @@ void UILayer::closeAllScenes() { std::vector 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.begin(); it != temp.end(); ++it) { m_scenesToDelete.push_back(*it); (*it)->handleDestroy(); // For anything that might require the pointer // be valid @@ -612,7 +612,7 @@ 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 @@ -695,7 +695,7 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) { 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()) { // 4J-PB - ignore repeats of action ABXY buttons @@ -719,7 +719,7 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, } 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(); @@ -727,7 +727,7 @@ 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(); } @@ -735,7 +735,7 @@ void UILayer::HandleDLCInstalled() { 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); } @@ -748,7 +748,7 @@ C4JRender::eViewportType UILayer::getViewport() { } void UILayer::handleUnlockFullVersion() { - for (AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) { + for (auto it = m_sceneStack.begin(); it != m_sceneStack.end(); ++it) { (*it)->handleUnlockFullVersion(); } } @@ -757,10 +757,10 @@ void UILayer::PrintTotalMemoryUsage(int64_t& totalStatic, int64_t& totalDynamic) { int64_t layerStatic = 0; int64_t layerDynamic = 0; - for (AUTO_VAR(it, m_components.begin()); it != m_components.end(); ++it) { + for (auto it = m_components.begin(); it != m_components.end(); ++it) { (*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic); } - for (AUTO_VAR(it, m_sceneStack.begin()); it != m_sceneStack.end(); ++it) { + for (auto it = m_sceneStack.begin(); it != m_sceneStack.end(); ++it) { (*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic); } app.DebugPrintf(app.USER_SR, " \\- Layer static: %d , Layer dynamic: %d\n", diff --git a/Minecraft.Client/Platform/Common/UI/UIScene.cpp b/Minecraft.Client/Platform/Common/UI/UIScene.cpp index 5173bb516..1182eaa91 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene.cpp @@ -38,7 +38,7 @@ UIScene::~UIScene() { /* Destroy the Iggy player. */ IggyPlayerDestroy(swf); - for (AUTO_VAR(it, m_registeredTextures.begin()); + for (auto it = m_registeredTextures.begin(); it != m_registeredTextures.end(); ++it) { ui.unregisterSubstitutionTexture(it->first, it->second); } @@ -90,7 +90,7 @@ 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.begin(); it != m_controls.end(); ++it) { (*it)->ReInit(); } @@ -377,7 +377,7 @@ void UIScene::tick() { if (m_hasTickedOnce) m_bCanHandleInput = true; while (IggyPlayerReadyToTick(swf)) { tickTimers(); - for (AUTO_VAR(it, m_controls.begin()); it != m_controls.end(); ++it) { + for (auto it = m_controls.begin(); it != m_controls.end(); ++it) { (*it)->tick(); } IggyPlayerTickRS(swf); @@ -398,7 +398,7 @@ void UIScene::addTimer(int id, int ms) { } void UIScene::killTimer(int id) { - AUTO_VAR(it, m_timers.find(id)); + auto it = m_timers.find(id); if (it != m_timers.end()) { it->second.running = false; } @@ -406,7 +406,7 @@ 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); } else { @@ -423,7 +423,7 @@ void UIScene::tickTimers() { IggyName UIScene::registerFastName(const std::wstring& name) { IggyName var; - AUTO_VAR(it, m_fastNames.find(name)); + auto it = m_fastNames.find(name); if (it != m_fastNames.end()) { var = it->second; } else { @@ -551,7 +551,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion* region, PIXBeginNamedEvent(0, "Draw all cache"); // Draw all the cached slots - for (AUTO_VAR(it, m_cachedSlotDraw.begin()); + for (auto it = m_cachedSlotDraw.begin(); it != m_cachedSlotDraw.end(); ++it) { CachedSlotDrawData* drawData = *it; ui.setupCustomDrawMatrices(this, @@ -1094,7 +1094,7 @@ void UIScene::registerSubstitutionTexture(const std::wstring& textureName, bool UIScene::hasRegisteredSubstitutionTexture( const std::wstring& textureName) { - AUTO_VAR(it, m_registeredTextures.find(textureName)); + auto it = m_registeredTextures.find(textureName); return it != m_registeredTextures.end(); } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_EndPoem.cpp index 16e547d48..298e61553 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_EndPoem.cpp @@ -192,7 +192,7 @@ void UIScene_EndPoem::updateNoise() { std::wstring tag = L"{*NOISE*}"; - AUTO_VAR(it, m_noiseLengths.begin()); + auto it = m_noiseLengths.begin(); int found = (int)noiseString.find(tag); while (found != std::string::npos && it != m_noiseLengths.end()) { length = *it; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InventoryMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InventoryMenu.cpp index d5d389975..1691c7275 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InventoryMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InventoryMenu.cpp @@ -260,7 +260,7 @@ void UIScene_InventoryMenu::updateEffectsDisplay() { int iValue = 0; IggyDataValue* UpdateValue = new IggyDataValue[activeEffects->size() * 2]; - for (AUTO_VAR(it, activeEffects->begin()); it != activeEffects->end(); + for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { MobEffectInstance* effect = *it; diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index 71cb594c6..29ff11d79 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -166,7 +166,7 @@ UIScene_LoadOrJoinMenu::~UIScene_LoadOrJoinMenu() { app.SetLiveLinkRequired(false); if (m_currentSessions) { - for (AUTO_VAR(it, m_currentSessions->begin()); + for (auto it = m_currentSessions->begin(); it < m_currentSessions->end(); ++it) { delete (*it); } @@ -641,7 +641,7 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() { int i = 0; - for (AUTO_VAR(it, app.getLevelGenerators()->begin()); + for (auto it = app.getLevelGenerators()->begin(); it != app.getLevelGenerators()->end(); ++it) { LevelGenerationOptions* levelGen = *it; @@ -1176,7 +1176,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() { unsigned int sessionIndex = 0; m_buttonListGames.setCurrentSelection(0); - for (AUTO_VAR(it, m_currentSessions->begin()); + for (auto it = m_currentSessions->begin(); it < m_currentSessions->end(); ++it) { FriendSessionInfo* sessionInfo = *it; diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index ca55472dd..827a20bd9 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -1142,7 +1142,7 @@ SIZE_T WINAPI XMemSize(PVOID pAddress, DWORD dwAllocAttributes) { void DumpMem() { int totalLeak = 0; - for (AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++) { + for (auto it = allocCounts.begin(); it != allocCounts.end(); it++) { if (it->second > 0) { app.DebugPrintf("%d %d %d %d\n", (it->first >> 26) & 0x3f, it->first & 0x03ffffff, it->second, @@ -1184,7 +1184,7 @@ void MemPixStuff() { int totals[MAX_SECT] = {0}; - for (AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++) { + for (auto it = allocCounts.begin(); it != allocCounts.end(); it++) { if (it->second > 0) { int sect = (it->first >> 26) & 0x3f; int bytes = it->first & 0x03ffffff; diff --git a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp index 06a0aa2d0..a93dd7b07 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp @@ -1028,7 +1028,7 @@ SIZE_T WINAPI XMemSize(PVOID pAddress, DWORD dwAllocAttributes) { void DumpMem() { int totalLeak = 0; - for (AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++) { + for (auto it = allocCounts.begin(); it != allocCounts.end(); it++) { if (it->second > 0) { app.DebugPrintf("%d %d %d %d\n", (it->first >> 26) & 0x3f, it->first & 0x03ffffff, it->second, @@ -1070,7 +1070,7 @@ void MemPixStuff() { int totals[MAX_SECT] = {0}; - for (AUTO_VAR(it, allocCounts.begin()); it != allocCounts.end(); it++) { + for (auto it = allocCounts.begin(); it != allocCounts.end(); it++) { if (it->second > 0) { int sect = (it->first >> 26) & 0x3f; int bytes = it->first & 0x03ffffff; diff --git a/Minecraft.Client/Platform/stdafx.h b/Minecraft.Client/Platform/stdafx.h index 9befa0cbe..27283318e 100644 --- a/Minecraft.Client/Platform/stdafx.h +++ b/Minecraft.Client/Platform/stdafx.h @@ -14,7 +14,6 @@ // use - #pragma message(__LOC__"Need to do something here") -#define AUTO_VAR(_var, _val) auto _var = _val #include #include #include diff --git a/Minecraft.Client/Player/EntityTracker.cpp b/Minecraft.Client/Player/EntityTracker.cpp index 901054c14..3ce13ebc9 100644 --- a/Minecraft.Client/Player/EntityTracker.cpp +++ b/Minecraft.Client/Player/EntityTracker.cpp @@ -30,7 +30,7 @@ void EntityTracker::addEntity(std::shared_ptr e) { addEntity(e, 32 * 16, 2); std::shared_ptr player = std::dynamic_pointer_cast(e); - for (AUTO_VAR(it, entities.begin()); it != entities.end(); it++) { + for (auto it = entities.begin(); it != entities.end(); it++) { if ((*it)->e != player) { (*it)->updatePlayer(this, player); } @@ -115,7 +115,7 @@ void EntityTracker::addEntity(std::shared_ptr e, int range, // 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(std::shared_ptr e) { - AUTO_VAR(it, entityMap.find(e->entityId)); + auto it = entityMap.find(e->entityId); if (it != entityMap.end()) { std::shared_ptr te = it->second; entityMap.erase(it); @@ -128,7 +128,7 @@ void EntityTracker::removePlayer(std::shared_ptr e) { if (e->GetType() == eTYPE_SERVERPLAYER) { std::shared_ptr player = std::dynamic_pointer_cast(e); - for (AUTO_VAR(it, entities.begin()); it != entities.end(); it++) { + for (auto it = entities.begin(); it != entities.end(); it++) { (*it)->removePlayer(player); } @@ -140,7 +140,7 @@ void EntityTracker::removePlayer(std::shared_ptr e) { void EntityTracker::tick() { std::vector > movedPlayers; - for (AUTO_VAR(it, entities.begin()); it != entities.end(); it++) { + for (auto it = entities.begin(); it != entities.end(); it++) { std::shared_ptr te = *it; te->tick(this, &level->players); if (te->moved && te->e->GetType() == eTYPE_SERVERPLAYER) { @@ -182,7 +182,7 @@ void EntityTracker::tick() { for (unsigned int i = 0; i < movedPlayers.size(); i++) { std::shared_ptr player = movedPlayers[i]; if (player->connection == NULL) continue; - for (AUTO_VAR(it, entities.begin()); it != entities.end(); it++) { + for (auto it = entities.begin(); it != entities.end(); it++) { std::shared_ptr te = *it; if (te->e != player) { te->updatePlayer(this, player); @@ -191,7 +191,7 @@ 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(); + for (auto it = level->players.begin(); it != level->players.end(); ++it) { std::shared_ptr player = std::dynamic_pointer_cast(*it); @@ -203,7 +203,7 @@ void EntityTracker::tick() { void EntityTracker::broadcast(std::shared_ptr e, std::shared_ptr packet) { - AUTO_VAR(it, entityMap.find(e->entityId)); + auto it = entityMap.find(e->entityId); if (it != entityMap.end()) { std::shared_ptr te = it->second; te->broadcast(packet); @@ -212,7 +212,7 @@ void EntityTracker::broadcast(std::shared_ptr e, void EntityTracker::broadcastAndSend(std::shared_ptr e, std::shared_ptr packet) { - AUTO_VAR(it, entityMap.find(e->entityId)); + auto it = entityMap.find(e->entityId); if (it != entityMap.end()) { std::shared_ptr te = it->second; te->broadcastAndSend(packet); @@ -220,7 +220,7 @@ void EntityTracker::broadcastAndSend(std::shared_ptr e, } void EntityTracker::clear(std::shared_ptr serverPlayer) { - for (AUTO_VAR(it, entities.begin()); it != entities.end(); it++) { + for (auto it = entities.begin(); it != entities.end(); it++) { std::shared_ptr te = *it; te->clear(serverPlayer); } @@ -228,7 +228,7 @@ void EntityTracker::clear(std::shared_ptr serverPlayer) { void EntityTracker::playerLoadedChunk(std::shared_ptr player, LevelChunk* chunk) { - for (AUTO_VAR(it, entities.begin()); it != entities.end(); ++it) { + for (auto it = entities.begin(); it != entities.end(); ++it) { std::shared_ptr te = *it; if (te->e != player && te->e->xChunk == chunk->x && te->e->zChunk == chunk->z) { @@ -244,7 +244,7 @@ void EntityTracker::updateMaxRange() { std::shared_ptr EntityTracker::getTracker( std::shared_ptr e) { - AUTO_VAR(it, entityMap.find(e->entityId)); + auto it = entityMap.find(e->entityId); if (it != entityMap.end()) { return it->second; } diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index 6780660a2..c861bdad2 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -153,8 +153,8 @@ void ServerPlayer::flagEntitiesToBeRemoved(unsigned int* flags, memset(flags, 0, 2048 / 32); } - AUTO_VAR(it, entitiesToRemove.begin()); - for (AUTO_VAR(it, entitiesToRemove.begin()); it != entitiesToRemove.end(); + auto it = entitiesToRemove.begin(); + for (auto it = entitiesToRemove.begin(); it != entitiesToRemove.end(); it++) { int index = *it; if (index < 2048) { @@ -259,7 +259,7 @@ void ServerPlayer::flushEntitiesToRemove() { intArray ids(amount); int pos = 0; - AUTO_VAR(it, entitiesToRemove.begin()); + auto it = entitiesToRemove.begin(); while (it != entitiesToRemove.end() && pos < amount) { ids[pos++] = *it; it = entitiesToRemove.erase(it); @@ -331,7 +331,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) { // the spiral of chunks that that method creates, long before // transmission of them is complete. double dist = DBL_MAX; - for (AUTO_VAR(it, chunksToSend.begin()); it != chunksToSend.end(); + for (auto it = chunksToSend.begin(); it != chunksToSend.end(); it++) { ChunkPos chunk = *it; if (level->isChunkFinalised(chunk.x, chunk.z)) { @@ -572,7 +572,7 @@ void ServerPlayer::doTickB() { players.push_back( std::dynamic_pointer_cast(shared_from_this())); - for (AUTO_VAR(it, objectives->begin()); it != objectives->end(); + for (auto it = objectives->begin(); it != objectives->end(); ++it) { Objective* objective = *it; getScoreboard() @@ -806,9 +806,9 @@ void ServerPlayer::changeDimension(int i) { thisPlayer->GetUserIndex()); } if (thisPlayer != NULL) { - for (AUTO_VAR(it, MinecraftServer::getInstance() + for (auto it = MinecraftServer::getInstance() ->getPlayers() - ->players.begin()); + ->players.begin(); it != MinecraftServer::getInstance()->getPlayers()->players.end(); ++it) { diff --git a/Minecraft.Client/Player/TrackedEntity.cpp b/Minecraft.Client/Player/TrackedEntity.cpp index b7d96a3e1..e8bd02649 100644 --- a/Minecraft.Client/Player/TrackedEntity.cpp +++ b/Minecraft.Client/Player/TrackedEntity.cpp @@ -80,7 +80,7 @@ void TrackedEntity::tick(EntityTracker* tracker, !e->removed) { std::shared_ptr data = Item::map->getSavedData(item, e->level); - for (AUTO_VAR(it, players->begin()); it != players->end(); ++it) { + for (auto it = players->begin(); it != players->end(); ++it) { std::shared_ptr player = std::dynamic_pointer_cast(*it); data->tickCarriedBy(player, item); @@ -378,7 +378,7 @@ void TrackedEntity::broadcast(std::shared_ptr packet) { // can be sent to any player, but we try to restrict the network impact // this has by not resending to the one machine - for (AUTO_VAR(it, seenBy.begin()); it != seenBy.end(); it++) { + for (auto it = seenBy.begin(); it != seenBy.end(); it++) { std::shared_ptr player = *it; bool dontSend = false; if (sentTo.size()) { @@ -422,7 +422,7 @@ void TrackedEntity::broadcast(std::shared_ptr packet) { // This packet hasn't got canSendToAnyClient set, so just send to // everyone here, and it - for (AUTO_VAR(it, seenBy.begin()); it != seenBy.end(); it++) { + for (auto it = seenBy.begin(); it != seenBy.end(); it++) { (*it)->connection->send(packet); } } @@ -441,13 +441,13 @@ void TrackedEntity::broadcastAndSend(std::shared_ptr packet) { } void TrackedEntity::broadcastRemoved() { - for (AUTO_VAR(it, seenBy.begin()); it != seenBy.end(); it++) { + for (auto it = seenBy.begin(); it != seenBy.end(); it++) { (*it)->entitiesToRemove.push_back(e->entityId); } } void TrackedEntity::removePlayer(std::shared_ptr sp) { - AUTO_VAR(it, seenBy.find(sp)); + auto it = seenBy.find(sp); if (it != seenBy.end()) { sp->entitiesToRemove.push_back(e->entityId); seenBy.erase(it); @@ -635,7 +635,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, std::dynamic_pointer_cast(e); std::vector* activeEffects = mob->getActiveEffects(); - for (AUTO_VAR(it, activeEffects->begin()); + for (auto it = activeEffects->begin(); it != activeEffects->end(); ++it) { MobEffectInstance* effect = *it; @@ -645,7 +645,7 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, delete activeEffects; } } else if (visibility == eVisibility_NotVisible) { - AUTO_VAR(it, seenBy.find(sp)); + auto it = seenBy.find(sp); if (it != seenBy.end()) { seenBy.erase(it); sp->entitiesToRemove.push_back(e->entityId); @@ -838,7 +838,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { } void TrackedEntity::clear(std::shared_ptr sp) { - AUTO_VAR(it, seenBy.find(sp)); + auto it = seenBy.find(sp); if (it != seenBy.end()) { seenBy.erase(it); sp->entitiesToRemove.push_back(e->entityId); diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index e2716cb5f..bbdc29471 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -33,7 +33,7 @@ void Chunk::reconcileRenderableTileEntities( const std::vector >& renderableTileEntities) { int key = levelRenderer->getGlobalIndexForChunk(this->x, this->y, this->z, level); - AUTO_VAR(it, globalRenderableTileEntities->find(key)); + auto it = globalRenderableTileEntities->find(key); if (!renderableTileEntities.empty()) { std::unordered_set currentRenderableTileEntitySet; currentRenderableTileEntitySet.reserve(renderableTileEntities.size()); @@ -45,7 +45,7 @@ void Chunk::reconcileRenderableTileEntities( LevelRenderer::RenderableTileEntityBucket& existingBucket = it->second; - for (AUTO_VAR(it2, existingBucket.tiles.begin()); + for (auto it2 = existingBucket.tiles.begin(); it2 != existingBucket.tiles.end(); it2++) { TileEntity* tileEntity = (*it2).get(); if (currentRenderableTileEntitySet.find(tileEntity) == @@ -78,7 +78,7 @@ void Chunk::reconcileRenderableTileEntities( } } } else if (it != globalRenderableTileEntities->end()) { - for (AUTO_VAR(it2, it->second.tiles.begin()); + for (auto it2 = it->second.tiles.begin(); it2 != it->second.tiles.end(); it2++) { (*it2)->setRenderRemoveStage( diff --git a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp index 264e80488..1c62cd431 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/EntityRenderDispatcher.cpp @@ -176,7 +176,7 @@ EntityRenderDispatcher::EntityRenderDispatcher() { renderers[eTYPE_LIGHTNINGBOLT] = new LightningBoltRenderer(); glDisable(GL_LIGHTING); - AUTO_VAR(itEnd, renderers.end()); + auto itEnd = renderers.end(); for (classToRendererMap::iterator it = renderers.begin(); it != itEnd; it++) { it->second->init(this); @@ -188,7 +188,7 @@ EntityRenderDispatcher::EntityRenderDispatcher() { 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 + auto it = renderers.find(e); // 4J Stu - The .at and [] accessors // insert elements if they don't exist if (it == renderers.end()) { @@ -304,7 +304,7 @@ Font* EntityRenderDispatcher::getFont() { return font; } void EntityRenderDispatcher::registerTerrainTextures( IconRegister* iconRegister) { // for (EntityRenderer renderer : renderers.values()) - for (AUTO_VAR(it, renderers.begin()); it != renderers.end(); ++it) { + for (auto it = renderers.begin(); it != renderers.end(); ++it) { EntityRenderer* renderer = it->second; renderer->registerTerrainTextures(iconRegister); } diff --git a/Minecraft.Client/Rendering/EntityRenderers/HorseRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/HorseRenderer.cpp index 17986a24e..1fa12dcaf 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/HorseRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/HorseRenderer.cpp @@ -86,7 +86,7 @@ ResourceLocation* HorseRenderer::getOrCreateLayeredTextureLocation( std::shared_ptr horse) { std::wstring textureName = horse->getLayeredTextureHashName(); - AUTO_VAR(it, LAYERED_LOCATION_CACHE.find(textureName)); + auto it = LAYERED_LOCATION_CACHE.find(textureName); ResourceLocation* location; if (it != LAYERED_LOCATION_CACHE.end()) { diff --git a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp index 804672296..f7b28c065 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp @@ -199,7 +199,7 @@ void PlayerRenderer::render(std::shared_ptr _mob, double x, double y, mob->GetAdditionalModelParts(); // turn them on if (pAdditionalModelParts != NULL) { - for (AUTO_VAR(it, pAdditionalModelParts->begin()); + for (auto it = pAdditionalModelParts->begin(); it != pAdditionalModelParts->end(); ++it) { ModelPart* pModelPart = *it; @@ -211,7 +211,7 @@ void PlayerRenderer::render(std::shared_ptr _mob, double x, double y, // turn them off again if (pAdditionalModelParts && pAdditionalModelParts->size() != 0) { - for (AUTO_VAR(it, pAdditionalModelParts->begin()); + for (auto it = pAdditionalModelParts->begin(); it != pAdditionalModelParts->end(); ++it) { ModelPart* pModelPart = *it; diff --git a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp index 4568dc500..b3145ab30 100644 --- a/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp +++ b/Minecraft.Client/Rendering/EntityRenderers/TileEntityRenderDispatcher.cpp @@ -48,7 +48,7 @@ TileEntityRenderDispatcher::TileEntityRenderDispatcher() { renderers[eTYPE_BEACONTILEENTITY] = new BeaconRenderer(); glDisable(GL_LIGHTING); - AUTO_VAR(itEnd, renderers.end()); + auto itEnd = renderers.end(); for (classToTileRendererMap::iterator it = renderers.begin(); it != itEnd; it++) { if (it->second) it->second->init(this); @@ -58,7 +58,7 @@ TileEntityRenderDispatcher::TileEntityRenderDispatcher() { TileEntityRenderer* TileEntityRenderDispatcher::getRenderer(eINSTANCEOF e) { TileEntityRenderer* r = NULL; // TileEntityRenderer *r = renderers[e]; - AUTO_VAR(it, renderers.find(e)); // 4J Stu - The .at and [] accessors + auto it = renderers.find(e); // 4J Stu - The .at and [] accessors // insert elements if they don't exist if (it == renderers.end()) { @@ -143,7 +143,7 @@ void TileEntityRenderDispatcher::render(std::shared_ptr entity, void TileEntityRenderDispatcher::setLevel(Level* level) { this->level = level; - for (AUTO_VAR(it, renderers.begin()); it != renderers.end(); it++) { + for (auto it = renderers.begin(); it != renderers.end(); it++) { if (it->second) it->second->onNewLevel(level); } } diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index 979d578c1..fc19b782c 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -310,8 +310,8 @@ void GameRenderer::pick(float a) { mc->level->getEntities(mc->cameraTargetPlayer, &grown); double nearest = dist; - AUTO_VAR(itEnd, objects->end()); - for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { + auto itEnd = objects->end(); + for (auto it = objects->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // objects->at(i); if (!e->isPickable()) continue; diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index da8d28fa8..fc05dc08f 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -564,8 +564,8 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { level[playerIndex]->getAllEntities(); totalEntities = (int)entities.size(); - AUTO_VAR(itEndGE, level[playerIndex]->globalEntities.end()); - for (AUTO_VAR(it, level[playerIndex]->globalEntities.begin()); + auto itEndGE = level[playerIndex]->globalEntities.end(); + for (auto it = level[playerIndex]->globalEntities.begin(); it != itEndGE; it++) { std::shared_ptr entity = *it; // level->globalEntities[i]; renderedEntities++; @@ -573,8 +573,8 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { EntityRenderDispatcher::instance->render(entity, a); } - AUTO_VAR(itEndEnts, entities.end()); - for (AUTO_VAR(it, entities.begin()); it != itEndEnts; it++) { + auto itEndEnts = entities.end(); + for (auto it = entities.begin(); it != itEndEnts; it++) { std::shared_ptr entity = *it; // entities[i]; bool shouldRender = @@ -620,13 +620,13 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float 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()); + for (auto it = renderableTileEntities.begin(); it != renderableTileEntities.end(); it++) { 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.tiles.begin()); + for (auto it2 = it->second.tiles.begin(); it2 != it->second.tiles.end(); it2++) { TileEntityRenderDispatcher::instance->render(*it2, a); } @@ -854,7 +854,7 @@ void LevelRenderer::tick() { ticks++; if ((ticks % SharedConstants::TICKS_PER_SECOND) == 0) { - AUTO_VAR(it, destroyingBlocks.begin()); + auto it = destroyingBlocks.begin(); while (it != destroyingBlocks.end()) { BlockDestructionProgress* block = it->second; @@ -2153,7 +2153,7 @@ void LevelRenderer::renderDestroyAnimation(Tesselator* t, t->offset((float)-xo, (float)-yo, (float)-zo); t->noColor(); - AUTO_VAR(it, destroyingBlocks.begin()); + auto it = destroyingBlocks.begin(); while (it != destroyingBlocks.end()) { BlockDestructionProgress* block = it->second; double xd = block->getX() - xo; @@ -3578,7 +3578,7 @@ void LevelRenderer::levelEvent(std::shared_ptr source, int type, int x, void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progress) { if (progress < 0 || progress >= 10) { - AUTO_VAR(it, destroyingBlocks.find(id)); + auto it = destroyingBlocks.find(id); if (it != destroyingBlocks.end()) { delete it->second; destroyingBlocks.erase(it); @@ -3587,7 +3587,7 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, } else { BlockDestructionProgress* entry = NULL; - AUTO_VAR(it, destroyingBlocks.find(id)); + auto it = destroyingBlocks.find(id); if (it != destroyingBlocks.end()) entry = it->second; if (entry == NULL || entry->getX() != x || entry->getY() != y || @@ -3867,7 +3867,7 @@ void LevelRenderer::fullyFlagRenderableTileEntitiesToBeRemoved() { if (itChunk == renderableTileEntities.end()) continue; RenderableTileEntityBucket& bucket = itChunk->second; - for (AUTO_VAR(itPending, itKey->second.begin()); + for (auto itPending = itKey->second.begin(); itPending != itKey->second.end(); itPending++) { if (bucket.indexByTile.find(*itPending) == bucket.indexByTile.end()) { diff --git a/Minecraft.Client/Rendering/Minimap.cpp b/Minecraft.Client/Rendering/Minimap.cpp index 3b8170557..4eb884171 100644 --- a/Minecraft.Client/Rendering/Minimap.cpp +++ b/Minecraft.Client/Rendering/Minimap.cpp @@ -122,7 +122,7 @@ void Minimap::render(std::shared_ptr player, Textures* textures, textures->bind( textures->loadTexture(TN_MISC_MAPICONS)); // L"/misc/mapicons.png")); - AUTO_VAR(itEnd, data->decorations.end()); + auto itEnd = data->decorations.end(); #if defined(_LARGE_WORLDS) std::vector m_edgeIcons; @@ -188,7 +188,7 @@ void Minimap::render(std::shared_ptr player, Textures* textures, 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 (auto it = m_edgeIcons.begin(); it != m_edgeIcons.end(); it++) { MapItemSavedData::MapDecoration* dec = *it; char imgIndex = dec->img; diff --git a/Minecraft.Client/Rendering/Models/ModelPart.cpp b/Minecraft.Client/Rendering/Models/ModelPart.cpp index 0e8ccec9f..08292db03 100644 --- a/Minecraft.Client/Rendering/Models/ModelPart.cpp +++ b/Minecraft.Client/Rendering/Models/ModelPart.cpp @@ -55,10 +55,10 @@ void ModelPart::addChild(ModelPart* child) { } ModelPart* ModelPart::retrieveChild(SKIN_BOX* pBox) { - for (AUTO_VAR(it, children.begin()); it != children.end(); ++it) { + for (auto it = children.begin(); it != children.end(); ++it) { ModelPart* child = *it; - for (AUTO_VAR(itcube, child->cubes.begin()); + for (auto itcube = child->cubes.begin(); itcube != child->cubes.end(); ++itcube) { Cube* pCube = *itcube; diff --git a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp index 1959ad349..617850d06 100644 --- a/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp +++ b/Minecraft.Client/Rendering/Particles/ParticleEngine.cpp @@ -261,8 +261,8 @@ void ParticleEngine::moveParticleInList(std::shared_ptr particle, ? 0 : (particle->level->dimension->id == -1 ? 1 : 2); for (int tt = 0; tt < TEXTURE_COUNT; tt++) { - AUTO_VAR(it, find(particles[l][tt][source].begin(), - particles[l][tt][source].end(), particle)); + auto it = find(particles[l][tt][source].begin(), + particles[l][tt][source].end(), particle); if (it != particles[l][tt][source].end()) { (*it) = particles[l][tt][source].back(); particles[l][tt][source].pop_back(); diff --git a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp index dc4e4decb..00e03d2f5 100644 --- a/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp +++ b/Minecraft.Client/Textures/Packs/TexturePackRepository.cpp @@ -125,7 +125,7 @@ TexturePackRepository::getTexturePackIdNames() { std::vector >* packList = new std::vector >(); - for (AUTO_VAR(it, texturePacks->begin()); it != texturePacks->end(); ++it) { + for (auto it = texturePacks->begin(); it != texturePacks->end(); ++it) { TexturePack* pack = *it; packList->push_back(std::pair( pack->getId(), pack->getName())); @@ -142,7 +142,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { // pack is installed app.SetRequiredTexturePackID(id); - AUTO_VAR(it, cacheById.find(id)); + auto it = cacheById.find(id); if (it != cacheById.end()) { TexturePack* newPack = it->second; if (newPack != selected) { @@ -177,7 +177,7 @@ bool TexturePackRepository::selectTexturePackById(std::uint32_t id) { } TexturePack* TexturePackRepository::getTexturePackById(std::uint32_t id) { - AUTO_VAR(it, cacheById.find(id)); + auto it = cacheById.find(id); if (it != cacheById.end()) { return it->second; } @@ -213,19 +213,19 @@ TexturePack* TexturePackRepository::addTexturePackFromDLC(DLCPack* dlcPack, } void TexturePackRepository::clearInvalidTexturePacks() { - for (AUTO_VAR(it, m_texturePacksToDelete.begin()); + for (auto it = m_texturePacksToDelete.begin(); it != m_texturePacksToDelete.end(); ++it) { delete *it; } } void TexturePackRepository::removeTexturePackById(std::uint32_t id) { - AUTO_VAR(it, cacheById.find(id)); + auto it = cacheById.find(id); if (it != cacheById.end()) { TexturePack* oldPack = it->second; - AUTO_VAR(it2, - find(texturePacks->begin(), texturePacks->end(), oldPack)); + auto it2 = + find(texturePacks->begin(), texturePacks->end(), oldPack); if (it2 != texturePacks->end()) { texturePacks->erase(it2); if (lastSelected == oldPack) { @@ -264,7 +264,7 @@ TexturePack* TexturePackRepository::getTexturePackByIndex(unsigned int index) { unsigned int TexturePackRepository::getTexturePackIndex(std::uint32_t id) { int currentIndex = 0; - for (AUTO_VAR(it, texturePacks->begin()); it != texturePacks->end(); ++it) { + for (auto it = texturePacks->begin(); it != texturePacks->end(); ++it) { TexturePack* pack = *it; if (pack->getId() == id) break; ++currentIndex; diff --git a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp index 574a3c733..63cd3e256 100644 --- a/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/PreStitchedTextureMap.cpp @@ -40,7 +40,7 @@ PreStitchedTextureMap::PreStitchedTextureMap(int type, const std::wstring& name, void PreStitchedTextureMap::stitch() { // Animated StitchedTextures store a vector of textures for each frame of // the animation. Free any pre-existing ones here. - for (AUTO_VAR(it, animatedTextures.begin()); it != animatedTextures.end(); + for (auto it = animatedTextures.begin(); it != animatedTextures.end(); ++it) { StitchedTexture* animatedStitchedTexture = *it; animatedStitchedTexture->freeFrameTextures(); @@ -119,7 +119,7 @@ void PreStitchedTextureMap::stitch() { TextureManager::getInstance()->registerName(name, stitchResult); // stitchResult = stitcher->constructTexture(m_mipMap); - for (AUTO_VAR(it, texturesByName.begin()); it != texturesByName.end(); + for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) { StitchedTexture* preStitched = (StitchedTexture*)it->second; @@ -132,7 +132,7 @@ void PreStitchedTextureMap::stitch() { } MemSect(52); - for (AUTO_VAR(it, texturesByName.begin()); it != texturesByName.end(); + for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) { StitchedTexture* preStitched = (StitchedTexture*)(it->second); @@ -204,7 +204,7 @@ StitchedTexture* PreStitchedTextureMap::getTexture(const std::wstring& name) { void PreStitchedTextureMap::cycleAnimationFrames() { // for (StitchedTexture texture : animatedTextures) - for (AUTO_VAR(it, animatedTextures.begin()); it != animatedTextures.end(); + for (auto it = animatedTextures.begin(); it != animatedTextures.end(); ++it) { StitchedTexture* texture = *it; texture->cycleFrames(); @@ -225,7 +225,7 @@ Icon* PreStitchedTextureMap::registerIcon(const std::wstring& name) { // new RuntimeException("Don't register null!").printStackTrace(); } - AUTO_VAR(it, texturesByName.find(name)); + auto it = texturesByName.find(name); if (it != texturesByName.end()) result = it->second; if (result == NULL) { @@ -265,7 +265,7 @@ void PreStitchedTextureMap::loadUVs() { return; } - for (AUTO_VAR(it, texturesByName.begin()); it != texturesByName.end(); + for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) { delete it->second; } diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp index 4186ddde9..dd4d33356 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp @@ -109,7 +109,7 @@ bool StitchSlot::add(TextureHolder* textureHolder) { } // for (final StitchSlot subSlot : subSlots) - for (AUTO_VAR(it, subSlots->begin()); it != subSlots->end(); ++it) { + for (auto it = subSlots->begin(); it != subSlots->end(); ++it) { StitchSlot* subSlot = *it; if (subSlot->add(textureHolder)) { return true; @@ -124,7 +124,7 @@ void StitchSlot::collectAssignments(std::vector* result) { result->push_back(this); } else if (subSlots != NULL) { // for (StitchSlot subSlot : subSlots) - for (AUTO_VAR(it, subSlots->begin()); it != subSlots->end(); ++it) { + for (auto it = subSlots->begin(); it != subSlots->end(); ++it) { StitchSlot* subSlot = *it; subSlot->collectAssignments(result); } diff --git a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp index c4eb5c316..7df980897 100644 --- a/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchedTexture.cpp @@ -43,7 +43,7 @@ StitchedTexture::StitchedTexture(const std::wstring& name, void StitchedTexture::freeFrameTextures() { if (frames != NULL) { - for (AUTO_VAR(it, frames->begin()); it != frames->end(); ++it) { + for (auto it = frames->begin(); it != frames->end(); ++it) { TextureManager::getInstance()->unregisterTexture(L"", *it); delete *it; } @@ -54,7 +54,7 @@ void StitchedTexture::freeFrameTextures() { StitchedTexture::~StitchedTexture() { if (frames != NULL) { - for (AUTO_VAR(it, frames->begin()); it != frames->end(); ++it) { + for (auto it = frames->begin(); it != frames->end(); ++it) { delete *it; } delete frames; @@ -218,7 +218,7 @@ void StitchedTexture::loadAnimationFrames(BufferedReader* bufferedReader) { if (line.length() > 0) { std::vector tokens = stringSplit(line, L','); // for (String token : tokens) - for (AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it) { + for (auto it = tokens.begin(); it != tokens.end(); ++it) { std::wstring token = *it; int multiPos = token.find_first_of('*'); if (multiPos > 0) { @@ -258,7 +258,7 @@ void StitchedTexture::loadAnimationFrames(const std::wstring& string) { std::vector tokens = stringSplit(trimString(string), L','); // for (String token : tokens) - for (AUTO_VAR(it, tokens.begin()); it != tokens.end(); ++it) { + for (auto it = tokens.begin(); it != tokens.end(); ++it) { std::wstring token = trimString(*it); int multiPos = token.find_first_of('*'); if (multiPos > 0) { diff --git a/Minecraft.Client/Textures/Stitching/Stitcher.cpp b/Minecraft.Client/Textures/Stitching/Stitcher.cpp index 24f3332d1..4e360c76b 100644 --- a/Minecraft.Client/Textures/Stitching/Stitcher.cpp +++ b/Minecraft.Client/Textures/Stitching/Stitcher.cpp @@ -73,7 +73,7 @@ void Stitcher::stitch() { stitchedTexture = NULL; // for (int i = 0; i < textureHolders.length; i++) - for (AUTO_VAR(it, texturesToBeStitched.begin()); + for (auto it = texturesToBeStitched.begin(); it != texturesToBeStitched.end(); ++it) { TextureHolder* textureHolder = *it; // textureHolders[i]; @@ -91,7 +91,7 @@ std::vector* Stitcher::gatherAreas() { std::vector* result = new std::vector(); // for (StitchSlot slot : storage) - for (AUTO_VAR(it, storage.begin()); it != storage.end(); ++it) { + for (auto it = storage.begin(); it != storage.end(); ++it) { StitchSlot* slot = *it; slot->collectAssignments(result); } diff --git a/Minecraft.Client/Textures/Stitching/TextureMap.cpp b/Minecraft.Client/Textures/Stitching/TextureMap.cpp index a0af280bb..e37e4c8e0 100644 --- a/Minecraft.Client/Textures/Stitching/TextureMap.cpp +++ b/Minecraft.Client/Textures/Stitching/TextureMap.cpp @@ -59,7 +59,7 @@ void TextureMap::stitch() { Stitcher* stitcher = TextureManager::getInstance()->createStitcher(name); - for (AUTO_VAR(it, texturesByName.begin()); it != texturesByName.end(); + for (auto it = texturesByName.begin(); it != texturesByName.end(); ++it) { delete it->second; } @@ -83,7 +83,7 @@ void TextureMap::stitch() { // Extract frames from textures and add them to the stitchers // for (final String name : texturesToRegister.keySet()) - for (AUTO_VAR(it, texturesToRegister.begin()); + for (auto it = texturesToRegister.begin(); it != texturesToRegister.end(); ++it) { std::wstring name = it->first; @@ -120,9 +120,9 @@ void TextureMap::stitch() { stitchResult = stitcher->constructTexture(m_mipMap); // Extract all the final positions and store them - AUTO_VAR(areas, stitcher->gatherAreas()); + auto areas = stitcher->gatherAreas(); // for (StitchSlot slot : stitcher.gatherAreas()) - for (AUTO_VAR(it, areas->begin()); it != areas->end(); ++it) { + for (auto it = areas->begin(); it != areas->end(); ++it) { StitchSlot* slot = *it; TextureHolder* textureHolder = slot->getHolder(); @@ -133,7 +133,7 @@ void TextureMap::stitch() { StitchedTexture* stored = NULL; - AUTO_VAR(itTex, texturesToRegister.find(textureName)); + auto itTex = texturesToRegister.find(textureName); if (itTex != texturesToRegister.end()) stored = itTex->second; // [EB]: What is this code for? debug warnings for when during @@ -194,7 +194,7 @@ void TextureMap::stitch() { missingPosition = texturesByName.find(NAME_MISSING_TEXTURE)->second; // for (StitchedTexture texture : texturesToRegister.values()) - for (AUTO_VAR(it, texturesToRegister.begin()); + for (auto it = texturesToRegister.begin(); it != texturesToRegister.end(); ++it) { StitchedTexture* texture = it->second; texture->replaceWith(missingPosition); @@ -212,7 +212,7 @@ StitchedTexture* TextureMap::getTexture(const std::wstring& name) { void TextureMap::cycleAnimationFrames() { // for (StitchedTexture texture : animatedTextures) - for (AUTO_VAR(it, animatedTextures.begin()); it != animatedTextures.end(); + for (auto it = animatedTextures.begin(); it != animatedTextures.end(); ++it) { StitchedTexture* texture = *it; texture->cycleFrames(); @@ -233,7 +233,7 @@ Icon* TextureMap::registerIcon(const std::wstring& name) { // TODO: [EB]: Why do we allow multiple registrations? StitchedTexture* result = NULL; - AUTO_VAR(it, texturesToRegister.find(name)); + auto it = texturesToRegister.find(name); if (it != texturesToRegister.end()) result = it->second; if (result == NULL) { diff --git a/Minecraft.Client/Textures/TextureManager.cpp b/Minecraft.Client/Textures/TextureManager.cpp index 77195f4df..f9f1dd489 100644 --- a/Minecraft.Client/Textures/TextureManager.cpp +++ b/Minecraft.Client/Textures/TextureManager.cpp @@ -36,7 +36,7 @@ void TextureManager::registerName(const std::wstring& name, Texture* texture) { } void TextureManager::registerTexture(Texture* texture) { - for (AUTO_VAR(it, idToTextureMap.begin()); it != idToTextureMap.end(); + for (auto it = idToTextureMap.begin(); it != idToTextureMap.end(); ++it) { if (it->second == texture) { // Minecraft.getInstance().getLogger().warning("TextureManager.registerTexture @@ -55,10 +55,10 @@ void TextureManager::registerTexture(Texture* texture) { void TextureManager::unregisterTexture(const std::wstring& name, Texture* texture) { - AUTO_VAR(it, idToTextureMap.find(texture->getManagerId())); + auto it = idToTextureMap.find(texture->getManagerId()); if (it != idToTextureMap.end()) idToTextureMap.erase(it); - AUTO_VAR(it2, stringToIDMap.find(name)); + auto it2 = stringToIDMap.find(name); if (it2 != stringToIDMap.end()) stringToIDMap.erase(it2); } diff --git a/Minecraft.Client/Textures/Textures.cpp b/Minecraft.Client/Textures/Textures.cpp index ed06047ba..76f984b8b 100644 --- a/Minecraft.Client/Textures/Textures.cpp +++ b/Minecraft.Client/Textures/Textures.cpp @@ -993,7 +993,7 @@ void Textures::removeHttpTexture(const std::wstring& url) { int Textures::loadMemTexture(const std::wstring& url, const std::wstring& backup) { MemTexture* texture = NULL; - AUTO_VAR(it, memTextures.find(url)); + auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; } @@ -1030,7 +1030,7 @@ int Textures::loadMemTexture(const std::wstring& url, int Textures::loadMemTexture(const std::wstring& url, int backup) { MemTexture* texture = NULL; - AUTO_VAR(it, memTextures.find(url)); + auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; } @@ -1067,7 +1067,7 @@ int Textures::loadMemTexture(const std::wstring& url, int backup) { MemTexture* Textures::addMemTexture(const std::wstring& name, MemTextureProcessor* processor) { MemTexture* texture = NULL; - AUTO_VAR(it, memTextures.find(name)); + auto it = memTextures.find(name); if (it != memTextures.end()) { texture = (*it).second; } @@ -1107,7 +1107,7 @@ MemTexture* Textures::addMemTexture(const std::wstring& name, void Textures::removeMemTexture(const std::wstring& url) { MemTexture* texture = NULL; - AUTO_VAR(it, memTextures.find(url)); + auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; @@ -1153,7 +1153,7 @@ void Textures::tick( // 4J - go over all the memory textures once per frame, and free any that // haven't been used for a while. Ones that are being used will have their // ticksSinceLastUse reset in Textures::loadMemTexture. - for (AUTO_VAR(it, memTextures.begin()); it != memTextures.end();) { + for (auto it = memTextures.begin(); it != memTextures.end();) { MemTexture* tex = it->second; if (tex && diff --git a/Minecraft.Client/UI/Font.cpp b/Minecraft.Client/UI/Font.cpp index daaa769bb..9887dd95c 100644 --- a/Minecraft.Client/UI/Font.cpp +++ b/Minecraft.Client/UI/Font.cpp @@ -321,8 +321,8 @@ void Font::drawWordWrapInternal(const std::wstring& string, int x, int y, int w, int col, bool darken, int h) { std::vector lines = stringSplit(string, L'\n'); if (lines.size() > 1) { - AUTO_VAR(itEnd, lines.end()); - for (AUTO_VAR(it, lines.begin()); it != itEnd; it++) { + auto itEnd = lines.end(); + for (auto it = lines.begin(); it != itEnd; it++) { // 4J Stu - Don't draw text that will be partially cutoff/overlap // something it shouldn't if ((y + this->wordWrapHeight(*it, w)) > h) break; @@ -366,8 +366,8 @@ int Font::wordWrapHeight(const std::wstring& string, int w) { std::vector lines = stringSplit(string, L'\n'); if (lines.size() > 1) { int h = 0; - AUTO_VAR(itEnd, lines.end()); - for (AUTO_VAR(it, lines.begin()); it != itEnd; it++) { + auto itEnd = lines.end(); + for (auto it = lines.begin(); it != itEnd; it++) { h += this->wordWrapHeight(*it, w); } return h; diff --git a/Minecraft.Client/UI/Gui.cpp b/Minecraft.Client/UI/Gui.cpp index 4dd7f056f..11b530e62 100644 --- a/Minecraft.Client/UI/Gui.cpp +++ b/Minecraft.Client/UI/Gui.cpp @@ -1331,8 +1331,8 @@ void Gui::tick() { // viewing the Pause Menu. 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++) { + auto itEnd = guiMessages[iPad].end(); + for (auto it = guiMessages[iPad].begin(); it != itEnd; it++) { (*it).ticks++; } } diff --git a/Minecraft.Client/UI/Screen.cpp b/Minecraft.Client/UI/Screen.cpp index d0d0a744c..5de292651 100644 --- a/Minecraft.Client/UI/Screen.cpp +++ b/Minecraft.Client/UI/Screen.cpp @@ -18,8 +18,8 @@ Screen::Screen() // 4J added } void Screen::render(int xm, int ym, float a) { - AUTO_VAR(itEnd, buttons.end()); - for (AUTO_VAR(it, buttons.begin()); it != itEnd; it++) { + auto itEnd = buttons.end(); + for (auto it = buttons.begin(); it != itEnd; it++) { Button* button = *it; // buttons[i]; button->render(minecraft, xm, ym); } @@ -49,8 +49,8 @@ void Screen::setClipboard(const std::wstring& str) { void Screen::mouseClicked(int x, int y, int buttonNum) { if (buttonNum == 0) { - AUTO_VAR(itEnd, buttons.end()); - for (AUTO_VAR(it, buttons.begin()); it != itEnd; it++) { + auto itEnd = buttons.end(); + for (auto it = buttons.begin(); it != itEnd; it++) { Button* button = *it; // buttons[i]; if (button->clicked(minecraft, x, y)) { clickedButton = button; diff --git a/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp b/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp index 00a7e81f1..275e6ad1d 100644 --- a/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp +++ b/Minecraft.Client/UI/Screens/AbstractContainerScreen.cpp @@ -49,8 +49,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++) { + auto itEnd = menu->slots.end(); + for (auto it = menu->slots.begin(); it != itEnd; it++) { Slot* slot = *it; // menu->slots.at(i); renderSlot(slot); @@ -300,8 +300,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++) { + auto itEnd = menu->slots.end(); + for (auto it = menu->slots.begin(); it != itEnd; it++) { Slot* slot = *it; // menu->slots.at(i); if (isHovering(slot, x, y)) return slot; } diff --git a/Minecraft.Client/Utils/ArchiveFile.cpp b/Minecraft.Client/Utils/ArchiveFile.cpp index 81a0b9def..817abbfef 100644 --- a/Minecraft.Client/Utils/ArchiveFile.cpp +++ b/Minecraft.Client/Utils/ArchiveFile.cpp @@ -71,7 +71,7 @@ ArchiveFile::~ArchiveFile() { delete m_cachedData; } std::vector* ArchiveFile::getFileList() { std::vector* out = new std::vector(); - for (AUTO_VAR(it, m_index.begin()); it != m_index.end(); it++) + for (auto it = m_index.begin(); it != m_index.end(); it++) out->push_back(it->first); @@ -88,7 +88,7 @@ int ArchiveFile::getFileSize(const std::wstring& filename) { byteArray ArchiveFile::getFile(const std::wstring& filename) { byteArray out; - AUTO_VAR(it, m_index.find(filename)); + auto it = m_index.find(filename); if (it == m_index.end()) { app.DebugPrintf("Couldn't find file in archive\n"); diff --git a/Minecraft.Client/Utils/MemoryTracker.cpp b/Minecraft.Client/Utils/MemoryTracker.cpp index c9c39f8aa..918ab9338 100644 --- a/Minecraft.Client/Utils/MemoryTracker.cpp +++ b/Minecraft.Client/Utils/MemoryTracker.cpp @@ -20,7 +20,7 @@ int MemoryTracker::genTextures() { } void MemoryTracker::releaseLists(int id) { - AUTO_VAR(it, GL_LIST_IDS.find(id)); + auto it = GL_LIST_IDS.find(id); if (it != GL_LIST_IDS.end()) { glDeleteLists(id, it->second); GL_LIST_IDS.erase(it); @@ -36,7 +36,7 @@ void MemoryTracker::releaseTextures() { void MemoryTracker::release() { // for (Map.Entry 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.begin(); it != GL_LIST_IDS.end(); ++it) { glDeleteLists(it->first, it->second); } GL_LIST_IDS.clear(); diff --git a/Minecraft.Client/Utils/StringTable.cpp b/Minecraft.Client/Utils/StringTable.cpp index 281a28b4e..63f5e2303 100644 --- a/Minecraft.Client/Utils/StringTable.cpp +++ b/Minecraft.Client/Utils/StringTable.cpp @@ -43,11 +43,11 @@ void StringTable::ProcessStringTableData(void) { int dataSize = 0; // - for (AUTO_VAR(it_locales, locales.begin()); + for (auto it_locales = locales.begin(); it_locales != locales.end() && (!foundLang); it_locales++) { bytesToSkip = 0; - for (AUTO_VAR(it, langSizeMap.begin()); it != langSizeMap.end(); ++it) { + for (auto it = langSizeMap.begin(); it != langSizeMap.end(); ++it) { if (it->first.compare(*it_locales) == 0) { app.DebugPrintf("StringTable:: Found language '%ls'.\n", it_locales->c_str()); @@ -135,7 +135,7 @@ const wchar_t* StringTable::getString(const std::wstring& id) { } #endif - AUTO_VAR(it, m_stringsMap.find(id)); + auto it = m_stringsMap.find(id); if (it != m_stringsMap.end()) { return it->second.c_str(); diff --git a/Minecraft.World/AI/Attributes/BaseAttributeMap.cpp b/Minecraft.World/AI/Attributes/BaseAttributeMap.cpp index 71e3384d5..1b63edabf 100644 --- a/Minecraft.World/AI/Attributes/BaseAttributeMap.cpp +++ b/Minecraft.World/AI/Attributes/BaseAttributeMap.cpp @@ -3,7 +3,7 @@ #include "BaseAttributeMap.h" BaseAttributeMap::~BaseAttributeMap() { - for (AUTO_VAR(it, attributesById.begin()); it != attributesById.end(); + for (auto it = attributesById.begin(); it != attributesById.end(); ++it) { delete it->second; } @@ -14,7 +14,7 @@ AttributeInstance* BaseAttributeMap::getInstance(Attribute* attribute) { } AttributeInstance* BaseAttributeMap::getInstance(eATTRIBUTE_ID id) { - AUTO_VAR(it, attributesById.find(id)); + auto it = attributesById.find(id); if (it != attributesById.end()) { return it->second; } else { @@ -23,7 +23,7 @@ AttributeInstance* BaseAttributeMap::getInstance(eATTRIBUTE_ID id) { } void BaseAttributeMap::getAttributes(std::vector& atts) { - for (AUTO_VAR(it, attributesById.begin()); it != attributesById.end(); + for (auto it = attributesById.begin(); it != attributesById.end(); ++it) { atts.push_back(it->second); } @@ -35,7 +35,7 @@ void BaseAttributeMap::onAttributeModified( void BaseAttributeMap::removeItemModifiers(std::shared_ptr item) { attrAttrModMap* modifiers = item->getAttributeModifiers(); - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { AttributeInstance* attribute = getInstance(it->first); AttributeModifier* modifier = it->second; @@ -52,7 +52,7 @@ void BaseAttributeMap::removeItemModifiers(std::shared_ptr item) { void BaseAttributeMap::addItemModifiers(std::shared_ptr item) { attrAttrModMap* modifiers = item->getAttributeModifiers(); - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { AttributeInstance* attribute = getInstance(it->first); AttributeModifier* modifier = it->second; diff --git a/Minecraft.World/AI/Attributes/ModifiableAttributeInstance.cpp b/Minecraft.World/AI/Attributes/ModifiableAttributeInstance.cpp index 8abb926c8..2ad3521b1 100644 --- a/Minecraft.World/AI/Attributes/ModifiableAttributeInstance.cpp +++ b/Minecraft.World/AI/Attributes/ModifiableAttributeInstance.cpp @@ -15,7 +15,7 @@ ModifiableAttributeInstance::ModifiableAttributeInstance( ModifiableAttributeInstance::~ModifiableAttributeInstance() { for (int i = 0; i < AttributeModifier::TOTAL_OPERATIONS; i++) { - for (AUTO_VAR(it, modifiers[i].begin()); it != modifiers[i].end(); + for (auto it = modifiers[i].begin(); it != modifiers[i].end(); ++it) { // Delete all modifiers delete *it; @@ -45,7 +45,7 @@ void ModifiableAttributeInstance::getModifiers( for (int i = 0; i < AttributeModifier::TOTAL_OPERATIONS; i++) { std::unordered_set* opModifiers = &modifiers[i]; - for (AUTO_VAR(it, opModifiers->begin()); it != opModifiers->end(); + for (auto it = opModifiers->begin(); it != opModifiers->end(); ++it) { result.insert(*it); } @@ -55,7 +55,7 @@ void ModifiableAttributeInstance::getModifiers( AttributeModifier* ModifiableAttributeInstance::getModifier(eMODIFIER_ID id) { AttributeModifier* modifier = NULL; - AUTO_VAR(it, modifierById.find(id)); + auto it = modifierById.find(id); if (it != modifierById.end()) { modifier = it->second; } @@ -65,7 +65,7 @@ AttributeModifier* ModifiableAttributeInstance::getModifier(eMODIFIER_ID id) { void ModifiableAttributeInstance::addModifiers( std::unordered_set* modifiers) { - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { addModifier(*it); } } @@ -94,7 +94,7 @@ void ModifiableAttributeInstance::setDirty() { void ModifiableAttributeInstance::removeModifier(AttributeModifier* modifier) { for (int i = 0; i < AttributeModifier::TOTAL_OPERATIONS; i++) { - for (AUTO_VAR(it, modifiers[i].begin()); it != modifiers[i].end(); + for (auto it = modifiers[i].begin(); it != modifiers[i].end(); ++it) { if (modifier->equals(*it)) { modifiers[i].erase(it); @@ -117,7 +117,7 @@ void ModifiableAttributeInstance::removeModifiers() { std::unordered_set removingModifiers; getModifiers(removingModifiers); - for (AUTO_VAR(it, removingModifiers.begin()); it != removingModifiers.end(); + for (auto it = removingModifiers.begin(); it != removingModifiers.end(); ++it) { removeModifier(*it); } @@ -137,7 +137,7 @@ double ModifiableAttributeInstance::calculateValue() { std::unordered_set* modifiers; modifiers = getModifiers(AttributeModifier::OPERATION_ADDITION); - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { AttributeModifier* modifier = *it; base += modifier->getAmount(); } @@ -145,13 +145,13 @@ double ModifiableAttributeInstance::calculateValue() { double result = base; modifiers = getModifiers(AttributeModifier::OPERATION_MULTIPLY_BASE); - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { AttributeModifier* modifier = *it; result += base * modifier->getAmount(); } modifiers = getModifiers(AttributeModifier::OPERATION_MULTIPLY_TOTAL); - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { AttributeModifier* modifier = *it; result *= 1 + modifier->getAmount(); } diff --git a/Minecraft.World/AI/Attributes/ServersideAttributeMap.cpp b/Minecraft.World/AI/Attributes/ServersideAttributeMap.cpp index 9bbd1f02d..eb258c9a1 100644 --- a/Minecraft.World/AI/Attributes/ServersideAttributeMap.cpp +++ b/Minecraft.World/AI/Attributes/ServersideAttributeMap.cpp @@ -17,7 +17,7 @@ AttributeInstance* ServersideAttributeMap::getInstance(eATTRIBUTE_ID id) { // If we didn't find it, search by legacy name /*if (result == NULL) { - AUTO_VAR(it, attributesByLegacy.find(name)); + auto it = attributesByLegacy.find(name); if(it != attributesByLegacy.end()) { result = it->second; @@ -29,7 +29,7 @@ AttributeInstance* ServersideAttributeMap::getInstance(eATTRIBUTE_ID id) { AttributeInstance* ServersideAttributeMap::registerAttribute( Attribute* attribute) { - AUTO_VAR(it, attributesById.find(attribute->getId())); + auto it = attributesById.find(attribute->getId()); if (it != attributesById.end()) { return it->second; } diff --git a/Minecraft.World/AI/Control/Sensing.cpp b/Minecraft.World/AI/Control/Sensing.cpp index 35963cb66..6802f15e6 100644 --- a/Minecraft.World/AI/Control/Sensing.cpp +++ b/Minecraft.World/AI/Control/Sensing.cpp @@ -13,10 +13,10 @@ bool Sensing::canSee(std::shared_ptr target) { // if ( find(seen.begin(), seen.end(), target) != seen.end() ) return true; // if ( find(unseen.begin(), unseen.end(), target) != unseen.end()) return // false; - for (AUTO_VAR(it, seen.begin()); it != seen.end(); ++it) { + for (auto it = seen.begin(); it != seen.end(); ++it) { if (target == (*it).lock()) return true; } - for (AUTO_VAR(it, unseen.begin()); it != unseen.end(); ++it) { + for (auto it = unseen.begin(); it != unseen.end(); ++it) { if (target == (*it).lock()) return false; } diff --git a/Minecraft.World/AI/Goals/BreedGoal.cpp b/Minecraft.World/AI/Goals/BreedGoal.cpp index 7c9fc4ce7..861d150b0 100644 --- a/Minecraft.World/AI/Goals/BreedGoal.cpp +++ b/Minecraft.World/AI/Goals/BreedGoal.cpp @@ -53,7 +53,7 @@ std::shared_ptr BreedGoal::getFreePartner() { level->getEntitiesOfClass(typeid(*animal), &grown_bb); double dist = std::numeric_limits::max(); std::shared_ptr partner = nullptr; - for (AUTO_VAR(it, others->begin()); it != others->end(); ++it) { + for (auto it = others->begin(); it != others->end(); ++it) { std::shared_ptr p = std::dynamic_pointer_cast(*it); if (animal->canMate(p) && animal->distanceToSqr(p) < dist) { partner = p; diff --git a/Minecraft.World/AI/Goals/FollowParentGoal.cpp b/Minecraft.World/AI/Goals/FollowParentGoal.cpp index bcdc860ae..d1dd97a2e 100644 --- a/Minecraft.World/AI/Goals/FollowParentGoal.cpp +++ b/Minecraft.World/AI/Goals/FollowParentGoal.cpp @@ -22,7 +22,7 @@ bool FollowParentGoal::canUse() { std::shared_ptr closest = nullptr; double closestDistSqr = std::numeric_limits::max(); - for (AUTO_VAR(it, parents->begin()); it != parents->end(); ++it) { + for (auto it = parents->begin(); it != parents->end(); ++it) { std::shared_ptr parent = std::dynamic_pointer_cast(*it); if (parent->getAge() < 0) continue; double distSqr = animal->distanceToSqr(parent); diff --git a/Minecraft.World/AI/Goals/GoalSelector.cpp b/Minecraft.World/AI/Goals/GoalSelector.cpp index ac5141b38..22facd8fd 100644 --- a/Minecraft.World/AI/Goals/GoalSelector.cpp +++ b/Minecraft.World/AI/Goals/GoalSelector.cpp @@ -15,7 +15,7 @@ GoalSelector::GoalSelector() { } GoalSelector::~GoalSelector() { - for (AUTO_VAR(it, goals.begin()); it != goals.end(); ++it) { + for (auto it = goals.begin(); it != goals.end(); ++it) { if ((*it)->canDeletePointer) delete (*it)->goal; delete (*it); } @@ -29,12 +29,12 @@ void GoalSelector::addGoal( } void GoalSelector::removeGoal(Goal* toRemove) { - for (AUTO_VAR(it, goals.begin()); it != goals.end();) { + for (auto it = goals.begin(); it != goals.end();) { InternalGoal* ig = *it; Goal* goal = ig->goal; if (goal == toRemove) { - AUTO_VAR(it2, find(usingGoals.begin(), usingGoals.end(), ig)); + auto it2 = find(usingGoals.begin(), usingGoals.end(), ig); if (it2 != usingGoals.end()) { goal->stop(); usingGoals.erase(it2); @@ -54,10 +54,10 @@ void GoalSelector::tick() { if (tickCount++ % newGoalRate == 0) { // for (InternalGoal ig : goals) - for (AUTO_VAR(it, goals.begin()); it != goals.end(); ++it) { + for (auto it = goals.begin(); it != goals.end(); ++it) { InternalGoal* ig = *it; // bool isUsing = usingGoals.contains(ig); - AUTO_VAR(usingIt, find(usingGoals.begin(), usingGoals.end(), ig)); + auto usingIt = find(usingGoals.begin(), usingGoals.end(), ig); // if (isUsing) if (usingIt != usingGoals.end()) { @@ -75,7 +75,7 @@ void GoalSelector::tick() { usingGoals.push_back(ig); } } else { - for (AUTO_VAR(it, usingGoals.begin()); it != usingGoals.end();) { + for (auto it = usingGoals.begin(); it != usingGoals.end();) { InternalGoal* ig = *it; if (!ig->goal->canContinueToUse()) { ig->goal->stop(); @@ -89,14 +89,14 @@ void GoalSelector::tick() { // bool debug = false; // if (debug && toStart.size() > 0) System.out.println("Starting: "); // for (InternalGoal ig : toStart) - for (AUTO_VAR(it, toStart.begin()); it != toStart.end(); ++it) { + for (auto it = toStart.begin(); it != toStart.end(); ++it) { // if (debug) System.out.println(ig.goal.toString() + ", "); (*it)->goal->start(); } // if (debug && usingGoals.size() > 0) System.out.println("Running: "); // for (InternalGoal ig : usingGoals) - for (AUTO_VAR(it, usingGoals.begin()); it != usingGoals.end(); ++it) { + for (auto it = usingGoals.begin(); it != usingGoals.end(); ++it) { // if (debug) System.out.println(ig.goal.toString()); (*it)->goal->tick(); } @@ -112,11 +112,11 @@ bool GoalSelector::canContinueToUse(InternalGoal* ig) { bool GoalSelector::canUseInSystem(GoalSelector::InternalGoal* goal) { // for (InternalGoal ig : goals) - for (AUTO_VAR(it, goals.begin()); it != goals.end(); ++it) { + for (auto it = goals.begin(); it != goals.end(); ++it) { InternalGoal* ig = *it; if (ig == goal) continue; - AUTO_VAR(usingIt, find(usingGoals.begin(), usingGoals.end(), ig)); + auto usingIt = find(usingGoals.begin(), usingGoals.end(), ig); if (goal->prio >= ig->prio) { if (usingIt != usingGoals.end() && !canCoExist(goal, ig)) @@ -139,7 +139,7 @@ void GoalSelector::setNewGoalRate(int newGoalRate) { } void GoalSelector::setLevel(Level* level) { - for (AUTO_VAR(it, goals.begin()); it != goals.end(); ++it) { + for (auto it = goals.begin(); it != goals.end(); ++it) { InternalGoal* ig = *it; ig->goal->setLevel(level); } diff --git a/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp b/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp index 00a3e838d..4b71da462 100644 --- a/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/HurtByTargetGoal.cpp @@ -26,7 +26,7 @@ void HurtByTargetGoal::start() { std::vector >* nearby = mob->level->getEntitiesOfClass( typeid(*mob), &mob_bb); - for (AUTO_VAR(it, nearby->begin()); it != nearby->end(); ++it) { + for (auto it = nearby->begin(); it != nearby->end(); ++it) { std::shared_ptr other = std::dynamic_pointer_cast(*it); if (this->mob->shared_from_this() == other) continue; diff --git a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp index 03fe6795a..7bfa844d8 100644 --- a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp +++ b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp @@ -91,7 +91,7 @@ std::shared_ptr MoveThroughVillageGoal::getNextDoorInfo( std::vector >* doorInfos = village->getDoorInfos(); // for (DoorInfo di : doorInfos) - for (AUTO_VAR(it, doorInfos->begin()); it != doorInfos->end(); ++it) { + for (auto it = doorInfos->begin(); it != doorInfos->end(); ++it) { std::shared_ptr di = *it; int distSqr = di->distanceToSqr(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); @@ -106,7 +106,7 @@ std::shared_ptr MoveThroughVillageGoal::getNextDoorInfo( bool MoveThroughVillageGoal::hasVisited(std::shared_ptr di) { // for (DoorInfo di2 : visited) - for (AUTO_VAR(it, visited.begin()); it != visited.end();) { + for (auto it = visited.begin(); it != visited.end();) { std::shared_ptr di2 = (*it).lock(); if (di2 == NULL) { it = visited.erase(it); diff --git a/Minecraft.World/AI/Goals/PlayGoal.cpp b/Minecraft.World/AI/Goals/PlayGoal.cpp index b748d7519..d39df2954 100644 --- a/Minecraft.World/AI/Goals/PlayGoal.cpp +++ b/Minecraft.World/AI/Goals/PlayGoal.cpp @@ -28,7 +28,7 @@ bool PlayGoal::canUse() { mob->level->getEntitiesOfClass(typeid(Villager), &mob_bb); double closestDistSqr = std::numeric_limits::max(); // for (Entity c : children) - for (AUTO_VAR(it, children->begin()); it != children->end(); ++it) { + for (auto it = children->begin(); it != children->end(); ++it) { std::shared_ptr c = *it; if (c.get() == mob) continue; std::shared_ptr friendV = diff --git a/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp b/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp index 7c3a49f44..ee126f9c4 100644 --- a/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp +++ b/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp @@ -32,7 +32,7 @@ bool TakeFlowerGoal::canUse() { } // for (Entity e : golems) - for (AUTO_VAR(it, golems->begin()); it != golems->end(); ++it) { + for (auto it = golems->begin(); it != golems->end(); ++it) { std::shared_ptr vg = std::dynamic_pointer_cast(*it); if (vg->getOfferFlowerTick() > 0) { diff --git a/Minecraft.World/AI/Navigation/PathFinder.cpp b/Minecraft.World/AI/Navigation/PathFinder.cpp index 429b99302..3302e13ab 100644 --- a/Minecraft.World/AI/Navigation/PathFinder.cpp +++ b/Minecraft.World/AI/Navigation/PathFinder.cpp @@ -26,8 +26,8 @@ PathFinder::~PathFinder() { // so just need to destroy their containers delete[] neighbors->data; delete neighbors; - AUTO_VAR(itEnd, nodes.end()); - for (AUTO_VAR(it, nodes.begin()); it != itEnd; it++) { + auto itEnd = nodes.end(); + for (auto it = nodes.begin(); it != itEnd; it++) { delete it->second; } } @@ -188,7 +188,7 @@ Node* PathFinder::getNode(Entity* entity, int x, int y, int z, Node* size, /*final*/ Node* PathFinder::getNode(int x, int y, int z) { int i = Node::createHash(x, y, z); Node* node; - AUTO_VAR(it, nodes.find(i)); + auto it = nodes.find(i); if (it == nodes.end()) { MemSect(54); node = new Node(x, y, z); diff --git a/Minecraft.World/Blocks/BaseRailTile.cpp b/Minecraft.World/Blocks/BaseRailTile.cpp index 31332510e..596c89d80 100644 --- a/Minecraft.World/Blocks/BaseRailTile.cpp +++ b/Minecraft.World/Blocks/BaseRailTile.cpp @@ -117,8 +117,8 @@ BaseRailTile::Rail* BaseRailTile::Rail::getRail(TilePos* p) { bool BaseRailTile::Rail::connectsTo(Rail* rail) { if (m_bValidRail) { - AUTO_VAR(itEnd, connections.end()); - for (AUTO_VAR(it, connections.begin()); it != itEnd; it++) { + auto itEnd = connections.end(); + for (auto it = connections.begin(); it != itEnd; it++) { TilePos* p = *it; // connections[i]; if (p->x == rail->x && p->z == rail->z) { return true; @@ -130,8 +130,8 @@ bool BaseRailTile::Rail::connectsTo(Rail* rail) { bool BaseRailTile::Rail::hasConnection(int x, int y, int z) { if (m_bValidRail) { - AUTO_VAR(itEnd, connections.end()); - for (AUTO_VAR(it, connections.begin()); it != itEnd; it++) { + auto itEnd = connections.end(); + for (auto it = connections.begin(); it != itEnd; it++) { TilePos* p = *it; // connections[i]; if (p->x == x && p->z == z) { return true; @@ -278,8 +278,8 @@ void BaseRailTile::Rail::place(bool hasSignal, bool first) { if (first || level->getData(x, y, z) != data) { level->setData(x, y, z, data, Tile::UPDATE_ALL); - AUTO_VAR(itEnd, connections.end()); - for (AUTO_VAR(it, connections.begin()); it != itEnd; it++) { + auto itEnd = connections.end(); + for (auto it = connections.begin(); it != itEnd; it++) { Rail* neighbor = getRail(*it); if (neighbor == NULL) continue; neighbor->removeSoftConnections(); diff --git a/Minecraft.World/Blocks/BedTile.cpp b/Minecraft.World/Blocks/BedTile.cpp index 372e4105f..9ee23dec6 100644 --- a/Minecraft.World/Blocks/BedTile.cpp +++ b/Minecraft.World/Blocks/BedTile.cpp @@ -97,8 +97,8 @@ bool BedTile::use(Level* level, int x, int y, int z, if (isOccupied(data)) { std::shared_ptr sleepingPlayer = nullptr; - AUTO_VAR(itEnd, level->players.end()); - for (AUTO_VAR(it, level->players.begin()); it != itEnd; it++) { + auto itEnd = level->players.end(); + for (auto it = level->players.begin(); it != itEnd; it++) { std::shared_ptr p = *it; if (p->isSleeping()) { Pos pos = p->bedPosition; diff --git a/Minecraft.World/Blocks/ChestTile.cpp b/Minecraft.World/Blocks/ChestTile.cpp index 4a866151c..e22782432 100644 --- a/Minecraft.World/Blocks/ChestTile.cpp +++ b/Minecraft.World/Blocks/ChestTile.cpp @@ -348,7 +348,7 @@ bool ChestTile::isCatSittingOnChest(Level* level, int x, int y, int z) { AABB ocelot_aabb(x, y + 1, z, x + 1, y + 2, z + 1); std::vector >* entities = level->getEntitiesOfClass(typeid(Ocelot), &ocelot_aabb); - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { std::shared_ptr ocelot = std::dynamic_pointer_cast(*it); if (ocelot->isSitting()) { delete entities; diff --git a/Minecraft.World/Blocks/FallingTile.cpp b/Minecraft.World/Blocks/FallingTile.cpp index eb7adda42..72be338f7 100644 --- a/Minecraft.World/Blocks/FallingTile.cpp +++ b/Minecraft.World/Blocks/FallingTile.cpp @@ -122,7 +122,7 @@ void FallingTile::tick() { CompoundTag* swap = new CompoundTag(); tileEntity->save(swap); std::vector* allTags = tileData->getAllTags(); - for (AUTO_VAR(it, allTags->begin()); + for (auto it = allTags->begin(); it != allTags->end(); ++it) { Tag* tag = *it; if (tag->getName().compare(L"x") == 0 || @@ -173,7 +173,7 @@ void FallingTile::causeFallDamage(float distance) { ? DamageSource::anvil : DamageSource::fallingBlock; // for (Entity entity : entities) - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { (*it)->hurt(source, std::min(Mth::floor(dmg * fallDamageAmount), fallDamageMax)); } diff --git a/Minecraft.World/Blocks/MobSpawner.cpp b/Minecraft.World/Blocks/MobSpawner.cpp index 1b868aceb..29a45905d 100644 --- a/Minecraft.World/Blocks/MobSpawner.cpp +++ b/Minecraft.World/Blocks/MobSpawner.cpp @@ -133,8 +133,8 @@ const int MobSpawner::tick(ServerLevel* level, bool spawnEnemies, continue; } - AUTO_VAR(itEndCTP, chunksToPoll.end()); - for (AUTO_VAR(it, chunksToPoll.begin()); it != itEndCTP; it++) { + auto itEndCTP = chunksToPoll.end(); + for (auto it = chunksToPoll.begin(); it != itEndCTP; it++) { if (it->second) { // don't add mobs to edge chunks, to prevent adding mobs // "outside" of the active playground diff --git a/Minecraft.World/Blocks/NotGateTile.cpp b/Minecraft.World/Blocks/NotGateTile.cpp index a71e12c2b..fb2d0b679 100644 --- a/Minecraft.World/Blocks/NotGateTile.cpp +++ b/Minecraft.World/Blocks/NotGateTile.cpp @@ -30,8 +30,8 @@ bool NotGateTile::isToggledTooFrequently(Level* level, int x, int y, int z, recentToggles[level]->push_back(Toggle(x, y, z, level->getGameTime())); int count = 0; - AUTO_VAR(itEnd, recentToggles[level]->end()); - for (AUTO_VAR(it, recentToggles[level]->begin()); it != itEnd; it++) { + auto itEnd = recentToggles[level]->end(); + for (auto it = recentToggles[level]->begin(); it != itEnd; it++) { if (it->x == x && it->y == y && it->z == z) { count++; if (count >= MAX_RECENT_TOGGLES) { @@ -207,7 +207,7 @@ void NotGateTile::levelTimeChanged(Level* level, int64_t delta, std::deque* toggles = recentToggles[level]; if (toggles != NULL) { - for (AUTO_VAR(it, toggles->begin()); it != toggles->end(); ++it) { + for (auto it = toggles->begin(); it != toggles->end(); ++it) { (*it).when += delta; } } diff --git a/Minecraft.World/Blocks/PressurePlateTile.cpp b/Minecraft.World/Blocks/PressurePlateTile.cpp index 48a273f0d..d8d8946e9 100644 --- a/Minecraft.World/Blocks/PressurePlateTile.cpp +++ b/Minecraft.World/Blocks/PressurePlateTile.cpp @@ -36,7 +36,7 @@ int PressurePlateTile::getSignalStrength(Level* level, int x, int y, int z) { // location. if (entities != NULL && !entities->empty()) { - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { std::shared_ptr e = *it; if (!e->isIgnoringTileTriggers()) { if (sensitivity != everything) delete entities; diff --git a/Minecraft.World/Blocks/RedStoneDustTile.cpp b/Minecraft.World/Blocks/RedStoneDustTile.cpp index 02aceb79b..1f96b87cf 100644 --- a/Minecraft.World/Blocks/RedStoneDustTile.cpp +++ b/Minecraft.World/Blocks/RedStoneDustTile.cpp @@ -78,8 +78,8 @@ void RedStoneDustTile::updatePowerStrength(Level* level, int x, int y, int z) { std::vector(toUpdate.begin(), toUpdate.end()); toUpdate.clear(); - AUTO_VAR(itEnd, updates.end()); - for (AUTO_VAR(it, updates.begin()); it != itEnd; it++) { + auto itEnd = updates.end(); + for (auto it = updates.begin(); it != itEnd; it++) { TilePos tp = *it; level->updateNeighborsAt(tp.x, tp.y, tp.z, id); } diff --git a/Minecraft.World/Blocks/TileEntities/BeaconTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/BeaconTileEntity.cpp index 738303f3c..708a2abbf 100644 --- a/Minecraft.World/Blocks/TileEntities/BeaconTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/BeaconTileEntity.cpp @@ -74,7 +74,7 @@ void BeaconTileEntity::applyEffects() { bb.y1 = level->getMaxBuildHeight(); std::vector >* players = level->getEntitiesOfClass(typeid(Player), &bb); - for (AUTO_VAR(it, players->begin()); it != players->end(); ++it) { + for (auto it = players->begin(); it != players->end(); ++it) { std::shared_ptr player = std::dynamic_pointer_cast(*it); player->addEffect(new MobEffectInstance( @@ -84,7 +84,7 @@ void BeaconTileEntity::applyEffects() { if (levels >= 4 && primaryPower != secondaryPower && secondaryPower > 0) { - for (AUTO_VAR(it, players->begin()); it != players->end(); ++it) { + for (auto it = players->begin(); it != players->end(); ++it) { std::shared_ptr player = std::dynamic_pointer_cast(*it); player->addEffect(new MobEffectInstance( diff --git a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp index d66c15c24..305fd3562 100644 --- a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp @@ -246,7 +246,7 @@ void ChestTileEntity::tick() { y + 1 + range, z + 1 + range); std::vector >* players = level->getEntitiesOfClass(typeid(Player), &player_aabb); - for (AUTO_VAR(it, players->begin()); it != players->end(); ++it) { + for (auto it = players->begin(); it != players->end(); ++it) { std::shared_ptr player = std::dynamic_pointer_cast(*it); diff --git a/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp index 84d73b9c7..540fbb20a 100644 --- a/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/PistonPieceTileEntity.cpp @@ -89,11 +89,11 @@ void PistonPieceEntity::moveCollidedEntities(float progress, float amount) { level->getEntities(nullptr, &*aabb); if (!entities->empty()) { std::vector > collisionHolder; - for (AUTO_VAR(it, entities->begin()); it != entities->end(); it++) { + for (auto it = entities->begin(); it != entities->end(); it++) { collisionHolder.push_back(*it); } - for (AUTO_VAR(it, collisionHolder.begin()); + for (auto it = collisionHolder.begin(); it != collisionHolder.end(); it++) { (*it)->move(amount * Facing::STEP_X[facing], amount * Facing::STEP_Y[facing], diff --git a/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp b/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp index 3c3ccf249..2e0a94153 100644 --- a/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp +++ b/Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp @@ -205,7 +205,7 @@ int PotionBrewing::getColorValue(std::vector* effects) { float count = 0; // for (MobEffectInstance effect : effects){ - for (AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) { + for (auto it = effects->begin(); it != effects->end(); ++it) { MobEffectInstance* effect = *it; int potionColor = colourTable->getColor( MobEffect::effects[effect->getId()]->getColor()); @@ -227,7 +227,7 @@ int PotionBrewing::getColorValue(std::vector* effects) { bool PotionBrewing::areAllEffectsAmbient( std::vector* effects) { - for (AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) { + for (auto it = effects->begin(); it != effects->end(); ++it) { MobEffectInstance* effect = *it; if (!effect->isAmbient()) return false; } @@ -237,14 +237,14 @@ bool PotionBrewing::areAllEffectsAmbient( int PotionBrewing::getColorValue(int brew, bool includeDisabledEffects) { if (!includeDisabledEffects) { - AUTO_VAR(colIt, cachedColors.find(brew)); + auto colIt = cachedColors.find(brew); if (colIt != cachedColors.end()) { return colIt->second; // cachedColors.get(brew); } std::vector* effects = getEffects(brew, false); int color = getColorValue(effects); if (effects != NULL) { - for (AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) { + for (auto it = effects->begin(); it != effects->end(); ++it) { MobEffectInstance* effect = *it; delete effect; } @@ -528,7 +528,7 @@ std::vector* PotionBrewing::getEffects( continue; } // wstring durationString = potionEffectDuration.get(effect->getId()); - AUTO_VAR(effIt, potionEffectDuration.find(effect->getId())); + auto effIt = potionEffectDuration.find(effect->getId()); if (effIt == potionEffectDuration.end()) { continue; } @@ -538,7 +538,7 @@ std::vector* PotionBrewing::getEffects( durationString, 0, (int)durationString.length(), brew); if (duration > 0) { int amplifier = 0; - AUTO_VAR(ampIt, potionEffectAmplifier.find(effect->getId())); + auto ampIt = potionEffectAmplifier.find(effect->getId()); if (ampIt != potionEffectAmplifier.end()) { std::wstring amplifierString = ampIt->second; amplifier = parseEffectFormulaValue( diff --git a/Minecraft.World/Blocks/TileEntities/TileEntity.cpp b/Minecraft.World/Blocks/TileEntities/TileEntity.cpp index 66ae1afac..5b04c3f62 100644 --- a/Minecraft.World/Blocks/TileEntities/TileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/TileEntity.cpp @@ -83,7 +83,7 @@ void TileEntity::load(CompoundTag* tag) { } void TileEntity::save(CompoundTag* tag) { - AUTO_VAR(it, classIdMap.find(this->GetType())); + auto it = classIdMap.find(this->GetType()); if (it == classIdMap.end()) { // TODO 4J Stu - Some sort of exception handling // throw new RuntimeException(this->getClass() + " is missing a mapping! @@ -103,7 +103,7 @@ std::shared_ptr TileEntity::loadStatic(CompoundTag* tag) { // try //{ - AUTO_VAR(it, idCreateMap.find(tag->getString(L"id"))); + auto it = idCreateMap.find(tag->getString(L"id")); if (it != idCreateMap.end()) entity = std::shared_ptr(it->second()); //} diff --git a/Minecraft.World/Blocks/TripWireTile.cpp b/Minecraft.World/Blocks/TripWireTile.cpp index e72ea5cdd..23e5cec9c 100644 --- a/Minecraft.World/Blocks/TripWireTile.cpp +++ b/Minecraft.World/Blocks/TripWireTile.cpp @@ -138,7 +138,7 @@ void TripWireTile::checkPressed(Level* level, int x, int y, int z) { std::vector >* entities = level->getEntities(nullptr, &offs_aabb); if (!entities->empty()) { - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { std::shared_ptr e = *it; if (!e->isIgnoringTileTriggers()) { shouldBePressed = true; diff --git a/Minecraft.World/Commands/CommandDispatcher.cpp b/Minecraft.World/Commands/CommandDispatcher.cpp index 7e8d60b0a..4c6f0b4cd 100644 --- a/Minecraft.World/Commands/CommandDispatcher.cpp +++ b/Minecraft.World/Commands/CommandDispatcher.cpp @@ -5,7 +5,7 @@ int CommandDispatcher::performCommand(std::shared_ptr sender, EGameCommand command, byteArray commandData) { - AUTO_VAR(it, commandsById.find(command)); + auto it = commandsById.find(command); if (it != commandsById.end()) { Command* command = it->second; diff --git a/Minecraft.World/Containers/AbstractContainerMenu.cpp b/Minecraft.World/Containers/AbstractContainerMenu.cpp index 8da2a07af..34a0551de 100644 --- a/Minecraft.World/Containers/AbstractContainerMenu.cpp +++ b/Minecraft.World/Containers/AbstractContainerMenu.cpp @@ -42,24 +42,24 @@ void AbstractContainerMenu::addSlotListener(ContainerListener* listener) { } void AbstractContainerMenu::removeSlotListener(ContainerListener* listener) { - AUTO_VAR(it, find(containerListeners.begin(), containerListeners.end(), - listener)); + auto it = find(containerListeners.begin(), containerListeners.end(), + listener); if (it != containerListeners.end()) containerListeners.erase(it); } std::vector >* AbstractContainerMenu::getItems() { std::vector >* items = new std::vector >(); - AUTO_VAR(itEnd, slots.end()); - for (AUTO_VAR(it, slots.begin()); it != itEnd; it++) { + auto itEnd = slots.end(); + for (auto it = slots.begin(); it != itEnd; it++) { items->push_back((*it)->getItem()); } return items; } void AbstractContainerMenu::sendData(int id, int value) { - AUTO_VAR(itEnd, containerListeners.end()); - for (AUTO_VAR(it, containerListeners.begin()); it != itEnd; it++) { + auto itEnd = containerListeners.end(); + for (auto it = containerListeners.begin(); it != itEnd; it++) { (*it)->setContainerData(this, id, value); } } @@ -79,8 +79,8 @@ void AbstractContainerMenu::broadcastChanges() { lastSlots[i] = expected; m_bNeedsRendered = true; - AUTO_VAR(itEnd, containerListeners.end()); - for (AUTO_VAR(it, containerListeners.begin()); it != itEnd; it++) { + auto itEnd = containerListeners.end(); + for (auto it = containerListeners.begin(); it != itEnd; it++) { (*it)->slotChanged(this, i, expected); } } @@ -111,8 +111,8 @@ bool AbstractContainerMenu::clickMenuButton(std::shared_ptr player, Slot* AbstractContainerMenu::getSlotFor(std::shared_ptr c, int index) { - AUTO_VAR(itEnd, slots.end()); - for (AUTO_VAR(it, slots.begin()); it != itEnd; it++) { + auto itEnd = slots.end(); + for (auto it = slots.begin(); it != itEnd; it++) { Slot* slot = *it; // slots->at(i); if (slot->isAt(c, index)) { return slot; @@ -174,7 +174,7 @@ std::shared_ptr AbstractContainerMenu::clicked( inventory->getCarried()->copy(); int remaining = inventory->getCarried()->count; - for (AUTO_VAR(it, quickcraftSlots.begin()); + for (auto it = quickcraftSlots.begin(); it != quickcraftSlots.end(); ++it) { Slot* slot = *it; if (slot != NULL && @@ -520,7 +520,7 @@ bool AbstractContainerMenu::isSynched(std::shared_ptr player) { void AbstractContainerMenu::setSynched(std::shared_ptr player, bool synched) { if (synched) { - AUTO_VAR(it, unSynchedPlayers.find(player)); + auto it = unSynchedPlayers.find(player); if (it != unSynchedPlayers.end()) unSynchedPlayers.erase(it); } else { diff --git a/Minecraft.World/Containers/AnvilMenu.cpp b/Minecraft.World/Containers/AnvilMenu.cpp index fb4628255..1fe2f3d54 100644 --- a/Minecraft.World/Containers/AnvilMenu.cpp +++ b/Minecraft.World/Containers/AnvilMenu.cpp @@ -135,11 +135,11 @@ void AnvilMenu::createResult() { std::unordered_map* additionalEnchantments = EnchantmentHelper::getEnchantments(addition); - for (AUTO_VAR(it, additionalEnchantments->begin()); + for (auto it = additionalEnchantments->begin(); it != additionalEnchantments->end(); ++it) { int id = it->first; Enchantment* enchantment = Enchantment::enchantments[id]; - AUTO_VAR(localIt, enchantments->find(id)); + auto localIt = enchantments->find(id); int current = localIt != enchantments->end() ? localIt->second : 0; int level = it->second; @@ -152,7 +152,7 @@ void AnvilMenu::createResult() { input->id == EnchantedBookItem::enchantedBook_Id) compatible = true; - for (AUTO_VAR(it2, enchantments->begin()); + for (auto it2 = enchantments->begin(); it2 != enchantments->end(); ++it2) { int other = it2->first; if (other != id && @@ -242,7 +242,7 @@ void AnvilMenu::createResult() { } int count = 0; - for (AUTO_VAR(it, enchantments->begin()); it != enchantments->end(); + for (auto it = enchantments->begin(); it != enchantments->end(); ++it) { int id = it->first; Enchantment* enchantment = Enchantment::enchantments[id]; diff --git a/Minecraft.World/Containers/BrewingStandMenu.cpp b/Minecraft.World/Containers/BrewingStandMenu.cpp index a832870ab..93da2882e 100644 --- a/Minecraft.World/Containers/BrewingStandMenu.cpp +++ b/Minecraft.World/Containers/BrewingStandMenu.cpp @@ -44,7 +44,7 @@ void BrewingStandMenu::broadcastChanges() { AbstractContainerMenu::broadcastChanges(); // for (int i = 0; i < containerListeners->size(); i++) - for (AUTO_VAR(it, containerListeners.begin()); + for (auto it = containerListeners.begin(); it != containerListeners.end(); ++it) { ContainerListener* listener = *it; // containerListeners.at(i); if (tc != brewingStand->getBrewTime()) { diff --git a/Minecraft.World/Containers/FurnaceMenu.cpp b/Minecraft.World/Containers/FurnaceMenu.cpp index 986b1e389..ef52f3544 100644 --- a/Minecraft.World/Containers/FurnaceMenu.cpp +++ b/Minecraft.World/Containers/FurnaceMenu.cpp @@ -44,8 +44,8 @@ void FurnaceMenu::addSlotListener(ContainerListener* listener) { void FurnaceMenu::broadcastChanges() { AbstractContainerMenu::broadcastChanges(); - AUTO_VAR(itEnd, containerListeners.end()); - for (AUTO_VAR(it, containerListeners.begin()); it != itEnd; it++) { + auto itEnd = containerListeners.end(); + for (auto it = containerListeners.begin(); it != itEnd; it++) { ContainerListener* listener = *it; // containerListeners->at(i); if (tc != furnace->tickCount) { listener->setContainerData(this, 0, furnace->tickCount); diff --git a/Minecraft.World/Containers/MerchantRecipeList.cpp b/Minecraft.World/Containers/MerchantRecipeList.cpp index 3e0426032..13cc2f767 100644 --- a/Minecraft.World/Containers/MerchantRecipeList.cpp +++ b/Minecraft.World/Containers/MerchantRecipeList.cpp @@ -7,7 +7,7 @@ MerchantRecipeList::MerchantRecipeList() {} MerchantRecipeList::MerchantRecipeList(CompoundTag* tag) { load(tag); } MerchantRecipeList::~MerchantRecipeList() { - for (AUTO_VAR(it, m_recipes.begin()); it != m_recipes.end(); ++it) { + for (auto it = m_recipes.begin(); it != m_recipes.end(); ++it) { delete (*it); } } diff --git a/Minecraft.World/Core/BehaviorRegistry.cpp b/Minecraft.World/Core/BehaviorRegistry.cpp index 1666a7053..0b9e965ab 100644 --- a/Minecraft.World/Core/BehaviorRegistry.cpp +++ b/Minecraft.World/Core/BehaviorRegistry.cpp @@ -7,7 +7,7 @@ BehaviorRegistry::BehaviorRegistry(DispenseItemBehavior* defaultValue) { } BehaviorRegistry::~BehaviorRegistry() { - for (AUTO_VAR(it, storage.begin()); it != storage.end(); ++it) { + for (auto it = storage.begin(); it != storage.end(); ++it) { delete it->second; } @@ -15,7 +15,7 @@ BehaviorRegistry::~BehaviorRegistry() { } DispenseItemBehavior* BehaviorRegistry::get(Item* key) { - AUTO_VAR(it, storage.find(key)); + auto it = storage.find(key); return (it == storage.end()) ? defaultBehavior : it->second; } diff --git a/Minecraft.World/Enchantments/EnchantmentHelper.cpp b/Minecraft.World/Enchantments/EnchantmentHelper.cpp index 53ec1c6de..33d13fac5 100644 --- a/Minecraft.World/Enchantments/EnchantmentHelper.cpp +++ b/Minecraft.World/Enchantments/EnchantmentHelper.cpp @@ -60,7 +60,7 @@ void EnchantmentHelper::setEnchantments( ListTag* list = new ListTag(); // for (int id : enchantments.keySet()) - for (AUTO_VAR(it, enchantments->begin()); it != enchantments->end(); ++it) { + for (auto it = enchantments->begin(); it != enchantments->end(); ++it) { int id = it->first; CompoundTag* tag = new CompoundTag(); @@ -299,7 +299,7 @@ std::shared_ptr EnchantmentHelper::enchantItem( if (isBook) itemInstance->id = Item::enchantedBook_Id; if (newEnchantment != NULL) { - for (AUTO_VAR(it, newEnchantment->begin()); it != newEnchantment->end(); + for (auto it = newEnchantment->begin(); it != newEnchantment->end(); ++it) { EnchantmentInstance* e = *it; if (isBook) { @@ -351,7 +351,7 @@ std::vector* EnchantmentHelper::selectEnchantment( getAvailableEnchantmentResults(realValue, itemInstance); if (availableEnchantments != NULL && !availableEnchantments->empty()) { std::vector values; - for (AUTO_VAR(it, availableEnchantments->begin()); + for (auto it = availableEnchantments->begin(); it != availableEnchantments->end(); ++it) { values.push_back(it->second); } @@ -372,12 +372,12 @@ std::vector* EnchantmentHelper::selectEnchantment( // final Iterator mapIter = // availableEnchantments.keySet().iterator(); while // (mapIter.hasNext()) - for (AUTO_VAR(it, availableEnchantments->begin()); + for (auto it = availableEnchantments->begin(); it != availableEnchantments->end();) { int nextEnchantment = it->first; // mapIter.next(); bool valid = true; // for (EnchantmentInstance *current : results) - for (AUTO_VAR(resIt, results->begin()); + for (auto resIt = results->begin(); resIt != results->end(); ++resIt) { EnchantmentInstance* current = *resIt; if (!current->enchantment->isCompatibleWith( @@ -396,7 +396,7 @@ std::vector* EnchantmentHelper::selectEnchantment( } if (!availableEnchantments->empty()) { - for (AUTO_VAR(it, availableEnchantments->begin()); + for (auto it = availableEnchantments->begin(); it != availableEnchantments->end(); ++it) { values.push_back(it->second); } @@ -416,7 +416,7 @@ std::vector* EnchantmentHelper::selectEnchantment( } } if (availableEnchantments != NULL) { - for (AUTO_VAR(it, availableEnchantments->begin()); + for (auto it = availableEnchantments->begin(); it != availableEnchantments->end(); ++it) { delete it->second; } @@ -453,7 +453,7 @@ EnchantmentHelper::getAvailableEnchantmentResults( results = new std::unordered_map(); } - AUTO_VAR(it, results->find(e->id)); + auto it = results->find(e->id); if (it != results->end()) { delete it->second; } diff --git a/Minecraft.World/Entities/Entity.cpp b/Minecraft.World/Entities/Entity.cpp index 64e5a0bb4..d55a4ec62 100644 --- a/Minecraft.World/Entities/Entity.cpp +++ b/Minecraft.World/Entities/Entity.cpp @@ -721,7 +721,7 @@ void Entity::move(double xa, double ya, double za, level->getCubes(shared_from_this(), &expanded, noEntityCubes, true); // LAND FIRST, then x and z - AUTO_VAR(itEndAABB, aABBs->end()); + auto itEndAABB = aABBs->end(); // 4J Stu - Particles (and possibly other entities) don't have xChunk and // zChunk set, so calculate the chunk instead @@ -731,7 +731,7 @@ void Entity::move(double xa, double ya, double za, // 4J Stu - It's horrible that the client is doing any movement at all! // But if we don't have the chunk data then all the collision info will // be incorrect as well - for (AUTO_VAR(it, aABBs->begin()); it != itEndAABB; it++) + for (auto it = aABBs->begin(); it != itEndAABB; it++) ya = it->clipYCollide(bb, ya); bb = bb.move(0, ya, 0); } @@ -743,7 +743,7 @@ void Entity::move(double xa, double ya, double za, bool og = onGround || (yaOrg != ya && yaOrg < 0); itEndAABB = aABBs->end(); - for (AUTO_VAR(it, aABBs->begin()); it != itEndAABB; it++) + for (auto it = aABBs->begin(); it != itEndAABB; it++) xa = it->clipXCollide(bb, xa); bb = bb.move(xa, 0, 0); @@ -753,7 +753,7 @@ void Entity::move(double xa, double ya, double za, } itEndAABB = aABBs->end(); - for (AUTO_VAR(it, aABBs->begin()); it != itEndAABB; it++) + for (auto it = aABBs->begin(); it != itEndAABB; it++) za = it->clipZCollide(bb, za); bb = bb.move(0, 0, za); @@ -788,7 +788,7 @@ void Entity::move(double xa, double ya, double za, // 4J Stu - It's horrible that the client is doing any movement at // all! But if we don't have the chunk data then all the collision // info will be incorrect as well - for (AUTO_VAR(it, aABBs->begin()); it != itEndAABB; it++) + for (auto it = aABBs->begin(); it != itEndAABB; it++) ya = it->clipYCollide(bb, ya); bb = bb.move(0, ya, 0); } @@ -798,7 +798,7 @@ void Entity::move(double xa, double ya, double za, } itEndAABB = aABBs->end(); - for (AUTO_VAR(it, aABBs->begin()); it != itEndAABB; it++) + for (auto it = aABBs->begin(); it != itEndAABB; it++) xa = it->clipXCollide(bb, xa); bb = bb.move(xa, 0, 0); @@ -807,7 +807,7 @@ void Entity::move(double xa, double ya, double za, } itEndAABB = aABBs->end(); - for (AUTO_VAR(it, aABBs->begin()); it != itEndAABB; it++) + for (auto it = aABBs->begin(); it != itEndAABB; it++) za = it->clipZCollide(bb, za); bb = bb.move(0, 0, za); @@ -821,7 +821,7 @@ void Entity::move(double xa, double ya, double za, ya = -footSize; // LAND FIRST, then x and z itEndAABB = aABBs->end(); - for (AUTO_VAR(it, aABBs->begin()); it != itEndAABB; it++) + for (auto it = aABBs->begin(); it != itEndAABB; it++) ya = it->clipYCollide(bb, ya); bb = bb.move(0, ya, 0); } @@ -1524,8 +1524,8 @@ void Entity::lerpTo(double x, double y, double z, float yRot, float xRot, AABBList* collisions = level->getCubes(shared_from_this(), &shrunk); if (!collisions->empty()) { double yTop = 0; - AUTO_VAR(itEnd, collisions->end()); - for (AUTO_VAR(it, collisions->begin()); it != itEnd; it++) { + auto itEnd = collisions->end(); + for (auto it = collisions->begin(); it != itEnd; it++) { if (it->y1 > yTop) yTop = it->y1; } diff --git a/Minecraft.World/Entities/HangingEntity.cpp b/Minecraft.World/Entities/HangingEntity.cpp index aa693de88..37b99b00f 100644 --- a/Minecraft.World/Entities/HangingEntity.cpp +++ b/Minecraft.World/Entities/HangingEntity.cpp @@ -131,8 +131,8 @@ bool HangingEntity::survives() { level->getEntities(shared_from_this(), &bb); if (entities != NULL && entities->size() > 0) { - AUTO_VAR(itEnd, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { + auto itEnd = entities->end(); + for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); if (e->instanceof(eTYPE_HANGING_ENTITY)) { return false; diff --git a/Minecraft.World/Entities/ItemEntity.cpp b/Minecraft.World/Entities/ItemEntity.cpp index 8d4706e39..34478d23c 100644 --- a/Minecraft.World/Entities/ItemEntity.cpp +++ b/Minecraft.World/Entities/ItemEntity.cpp @@ -122,7 +122,7 @@ void ItemEntity::mergeWithNeighbours() { AABB grown = bb.grow(0.5, 0, 0.5); std::vector >* neighbours = level->getEntitiesOfClass(typeid(*this), &grown); - for (AUTO_VAR(it, neighbours->begin()); it != neighbours->end(); ++it) { + for (auto it = neighbours->begin(); it != neighbours->end(); ++it) { std::shared_ptr entity = std::dynamic_pointer_cast(*it); merge(entity); diff --git a/Minecraft.World/Entities/LeashFenceKnotEntity.cpp b/Minecraft.World/Entities/LeashFenceKnotEntity.cpp index d86972cad..30c33ce25 100644 --- a/Minecraft.World/Entities/LeashFenceKnotEntity.cpp +++ b/Minecraft.World/Entities/LeashFenceKnotEntity.cpp @@ -59,7 +59,7 @@ bool LeashFenceKnotEntity::interact(std::shared_ptr player) { std::vector >* mobs = level->getEntitiesOfClass(typeid(Mob), &mob_aabb); if (mobs != NULL) { - for (AUTO_VAR(it, mobs->begin()); it != mobs->end(); ++it) { + for (auto it = mobs->begin(); it != mobs->end(); ++it) { std::shared_ptr mob = std::dynamic_pointer_cast(*it); if (mob->isLeashed() && mob->getLeashHolder() == player) { @@ -83,7 +83,7 @@ bool LeashFenceKnotEntity::interact(std::shared_ptr player) { std::vector >* mobs = level->getEntitiesOfClass(typeid(Mob), &mob_aabb); if (mobs != NULL) { - for (AUTO_VAR(it, mobs->begin()); it != mobs->end(); ++it) { + for (auto it = mobs->begin(); it != mobs->end(); ++it) { std::shared_ptr mob = std::dynamic_pointer_cast(*it); if (mob->isLeashed() && @@ -125,7 +125,7 @@ std::shared_ptr LeashFenceKnotEntity::findKnotAt( std::vector >* knots = level->getEntitiesOfClass( typeid(LeashFenceKnotEntity), &leash_fence_knot_entity_aabb); if (knots != NULL) { - for (AUTO_VAR(it, knots->begin()); it != knots->end(); ++it) { + for (auto it = knots->begin(); it != knots->end(); ++it) { std::shared_ptr knot = std::dynamic_pointer_cast(*it); if (knot->xTile == x && knot->yTile == y && knot->zTile == z) { diff --git a/Minecraft.World/Entities/LivingEntity.cpp b/Minecraft.World/Entities/LivingEntity.cpp index 4013c2cc3..39b56ed03 100644 --- a/Minecraft.World/Entities/LivingEntity.cpp +++ b/Minecraft.World/Entities/LivingEntity.cpp @@ -120,7 +120,7 @@ LivingEntity::LivingEntity(Level* level) : Entity(level) { } LivingEntity::~LivingEntity() { - for (AUTO_VAR(it, activeEffects.begin()); it != activeEffects.end(); ++it) { + for (auto it = activeEffects.begin(); it != activeEffects.end(); ++it) { delete it->second; } @@ -378,7 +378,7 @@ void LivingEntity::addAdditonalSaveData(CompoundTag* entityTag) { if (!activeEffects.empty()) { ListTag* listTag = new ListTag(); - for (AUTO_VAR(it, activeEffects.begin()); it != activeEffects.end(); + for (auto it = activeEffects.begin(); it != activeEffects.end(); ++it) { MobEffectInstance* effect = it->second; listTag->add(effect->save(new CompoundTag())); @@ -429,7 +429,7 @@ void LivingEntity::readAdditionalSaveData(CompoundTag* tag) { void LivingEntity::tickEffects() { bool removed = false; - for (AUTO_VAR(it, activeEffects.begin()); it != activeEffects.end();) { + for (auto it = activeEffects.begin(); it != activeEffects.end();) { MobEffectInstance* effect = it->second; removed = false; if (!effect->tick( @@ -460,7 +460,7 @@ void LivingEntity::tickEffects() { setWeakened(false); } else { std::vector values; - for (AUTO_VAR(it, activeEffects.begin()); + for (auto it = activeEffects.begin(); it != activeEffects.end(); ++it) { values.push_back(it->second); } @@ -516,7 +516,7 @@ void LivingEntity::removeAllEffects() { // Iterator effectIdIterator = // activeEffects.keySet().iterator(); while // (effectIdIterator.hasNext()) - for (AUTO_VAR(it, activeEffects.begin()); it != activeEffects.end();) { + for (auto it = activeEffects.begin(); it != activeEffects.end();) { // Integer effectId = effectIdIterator.next(); MobEffectInstance* effect = it->second; // activeEffects.get(effectId); @@ -535,7 +535,7 @@ std::vector* LivingEntity::getActiveEffects() { std::vector* active = new std::vector(); - for (AUTO_VAR(it, activeEffects.begin()); it != activeEffects.end(); ++it) { + for (auto it = activeEffects.begin(); it != activeEffects.end(); ++it) { active->push_back(it->second); } @@ -554,7 +554,7 @@ bool LivingEntity::hasEffect(MobEffect* effect) { MobEffectInstance* LivingEntity::getEffect(MobEffect* effect) { MobEffectInstance* effectInst = NULL; - AUTO_VAR(it, activeEffects.find(effect->id)); + auto it = activeEffects.find(effect->id); if (it != activeEffects.end()) effectInst = it->second; return effectInst; @@ -611,7 +611,7 @@ bool LivingEntity::canBeAffected(MobEffectInstance* newEffect) { bool LivingEntity::isInvertedHealAndHarm() { return getMobType() == UNDEAD; } void LivingEntity::removeEffectNoUpdate(int effectId) { - AUTO_VAR(it, activeEffects.find(effectId)); + auto it = activeEffects.find(effectId); if (it != activeEffects.end()) { MobEffectInstance* effect = it->second; if (effect != NULL) { @@ -622,7 +622,7 @@ void LivingEntity::removeEffectNoUpdate(int effectId) { } void LivingEntity::removeEffect(int effectId) { - AUTO_VAR(it, activeEffects.find(effectId)); + auto it = activeEffects.find(effectId); if (it != activeEffects.end()) { MobEffectInstance* effect = it->second; if (effect != NULL) { @@ -1508,8 +1508,8 @@ void LivingEntity::aiStep() { AABBList* collisions = level->getCubes(shared_from_this(), &shrinkbb); if (collisions->size() > 0) { double yTop = 0; - AUTO_VAR(itEnd, collisions->end()); - for (AUTO_VAR(it, collisions->begin()); it != itEnd; it++) { + auto itEnd = collisions->end(); + for (auto it = collisions->begin(); it != itEnd; it++) { if (it->y1 > yTop) yTop = it->y1; } @@ -1577,8 +1577,8 @@ void LivingEntity::pushEntities() { std::vector >* entities = level->getEntities(shared_from_this(), &grown); if (entities != NULL && !entities->empty()) { - AUTO_VAR(itEnd, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { + auto itEnd = entities->end(); + for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // entities->at(i); if (e->isPushable()) e->push(shared_from_this()); } diff --git a/Minecraft.World/Entities/Mob.cpp b/Minecraft.World/Entities/Mob.cpp index 4ebcf21ac..58aa0f2a4 100644 --- a/Minecraft.World/Entities/Mob.cpp +++ b/Minecraft.World/Entities/Mob.cpp @@ -304,7 +304,7 @@ void Mob::aiStep() { AABB grown = bb.grow(1, 0, 1); std::vector >* entities = level->getEntitiesOfClass(typeid(ItemEntity), &grown); - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { std::shared_ptr entity = std::dynamic_pointer_cast(*it); if (entity->removed || entity->getItem() == NULL) continue; @@ -852,7 +852,7 @@ void Mob::restoreLeashFromSave() { std::vector >* livingEnts = level->getEntitiesOfClass(typeid(LivingEntity), &grown); - for (AUTO_VAR(it, livingEnts->begin()); it != livingEnts->end(); + for (auto it = livingEnts->begin(); it != livingEnts->end(); ++it) { std::shared_ptr le = std::dynamic_pointer_cast(*it); diff --git a/Minecraft.World/Entities/MobEffect.cpp b/Minecraft.World/Entities/MobEffect.cpp index 828b5a4e3..d10c880e0 100644 --- a/Minecraft.World/Entities/MobEffect.cpp +++ b/Minecraft.World/Entities/MobEffect.cpp @@ -412,7 +412,7 @@ MobEffect::getAttributeModifiers() { void MobEffect::removeAttributeModifiers(std::shared_ptr entity, BaseAttributeMap* attributes, int amplifier) { - for (AUTO_VAR(it, attributeModifiers.begin()); + for (auto it = attributeModifiers.begin(); it != attributeModifiers.end(); ++it) { AttributeInstance* attribute = attributes->getInstance(it->first); @@ -425,7 +425,7 @@ void MobEffect::removeAttributeModifiers(std::shared_ptr entity, void MobEffect::addAttributeModifiers(std::shared_ptr entity, BaseAttributeMap* attributes, int amplifier) { - for (AUTO_VAR(it, attributeModifiers.begin()); + for (auto it = attributeModifiers.begin(); it != attributeModifiers.end(); ++it) { AttributeInstance* attribute = attributes->getInstance(it->first); diff --git a/Minecraft.World/Entities/Mobs/Animal.cpp b/Minecraft.World/Entities/Mobs/Animal.cpp index a2ce25b5b..f477a305c 100644 --- a/Minecraft.World/Entities/Mobs/Animal.cpp +++ b/Minecraft.World/Entities/Mobs/Animal.cpp @@ -220,7 +220,7 @@ std::shared_ptr Animal::findAttackTarget() { std::vector >* others = level->getEntitiesOfClass(typeid(*this), &grown); // for (int i = 0; i < others->size(); i++) - for (AUTO_VAR(it, others->begin()); it != others->end(); ++it) { + for (auto it = others->begin(); it != others->end(); ++it) { std::shared_ptr p = std::dynamic_pointer_cast(*it); if (p != shared_from_this() && p->getInLoveValue() > 0) { delete others; @@ -234,7 +234,7 @@ std::shared_ptr Animal::findAttackTarget() { std::vector >* players = level->getEntitiesOfClass(typeid(Player), &grown); // for (int i = 0; i < players.size(); i++) - for (AUTO_VAR(it, players->begin()); it != players->end(); ++it) { + for (auto it = players->begin(); it != players->end(); ++it) { setDespawnProtected(); std::shared_ptr p = @@ -251,7 +251,7 @@ std::shared_ptr Animal::findAttackTarget() { std::vector >* others = level->getEntitiesOfClass(typeid(*this), &grown); // for (int i = 0; i < others.size(); i++) - for (AUTO_VAR(it, others->begin()); it != others->end(); ++it) { + for (auto it = others->begin(); it != others->end(); ++it) { std::shared_ptr p = std::dynamic_pointer_cast(*it); if (p != shared_from_this() && p->getAge() < 0) { diff --git a/Minecraft.World/Entities/Mobs/Arrow.cpp b/Minecraft.World/Entities/Mobs/Arrow.cpp index 4c8977b66..73ca04a0f 100644 --- a/Minecraft.World/Entities/Mobs/Arrow.cpp +++ b/Minecraft.World/Entities/Mobs/Arrow.cpp @@ -234,8 +234,8 @@ void Arrow::tick() { std::vector >* objects = level->getEntities(shared_from_this(), &grown); double nearest = 0; - AUTO_VAR(itEnd, objects->end()); - for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { + auto itEnd = objects->end(); + for (auto it = objects->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // objects->at(i); if (!e->isPickable() || (e == owner && flightTime < 5)) continue; diff --git a/Minecraft.World/Entities/Mobs/Boat.cpp b/Minecraft.World/Entities/Mobs/Boat.cpp index aafb09124..1abd6bd04 100644 --- a/Minecraft.World/Entities/Mobs/Boat.cpp +++ b/Minecraft.World/Entities/Mobs/Boat.cpp @@ -317,8 +317,8 @@ void Boat::tick() { std::vector >* entities = level->getEntities(shared_from_this(), &grown); if (entities != NULL && !entities->empty()) { - AUTO_VAR(itEnd, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { + auto itEnd = entities->end(); + for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); // entities->at(i); if (e != rider.lock() && e->isPushable() && e->GetType() == eTYPE_BOAT) { diff --git a/Minecraft.World/Entities/Mobs/DragonFireball.cpp b/Minecraft.World/Entities/Mobs/DragonFireball.cpp index 19486ffbe..bb080a965 100644 --- a/Minecraft.World/Entities/Mobs/DragonFireball.cpp +++ b/Minecraft.World/Entities/Mobs/DragonFireball.cpp @@ -35,7 +35,7 @@ void DragonFireball::onHit(HitResult* res) { if (entitiesOfClass != NULL && !entitiesOfClass->empty()) { // for (Entity e : entitiesOfClass) - for (AUTO_VAR(it, entitiesOfClass->begin()); + for (auto it = entitiesOfClass->begin(); it != entitiesOfClass->end(); ++it) { // shared_ptr e = *it; std::shared_ptr e = diff --git a/Minecraft.World/Entities/Mobs/EnderCrystal.cpp b/Minecraft.World/Entities/Mobs/EnderCrystal.cpp index 45924f472..38e73d977 100644 --- a/Minecraft.World/Entities/Mobs/EnderCrystal.cpp +++ b/Minecraft.World/Entities/Mobs/EnderCrystal.cpp @@ -83,8 +83,8 @@ bool EnderCrystal::hurt(DamageSource* source, float damage) { std::vector > entities = level->getAllEntities(); std::shared_ptr dragon = nullptr; - AUTO_VAR(itEnd, entities.end()); - for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { + auto itEnd = entities.end(); + for (auto it = entities.begin(); it != itEnd; it++) { std::shared_ptr e = *it; // entities->at(i); dragon = std::dynamic_pointer_cast(e); if (dragon != NULL) { diff --git a/Minecraft.World/Entities/Mobs/EnderDragon.cpp b/Minecraft.World/Entities/Mobs/EnderDragon.cpp index 7aa192c13..b115c3c81 100644 --- a/Minecraft.World/Entities/Mobs/EnderDragon.cpp +++ b/Minecraft.World/Entities/Mobs/EnderDragon.cpp @@ -464,7 +464,7 @@ void EnderDragon::aiStep() { std::vector >* targets = level->getEntities(shared_from_this(), &m_acidArea); - for (AUTO_VAR(it, targets->begin()); it != targets->end(); + for (auto it = targets->begin(); it != targets->end(); ++it) { if ((*it)->instanceof(eTYPE_LIVINGENTITY)) { // app.DebugPrintf("Attacking entity with acid\n"); @@ -821,7 +821,7 @@ void EnderDragon::checkCrystals() { std::shared_ptr crystal = nullptr; double nearest = std::numeric_limits::max(); // for (Entity ec : crystals) - for (AUTO_VAR(it, crystals->begin()); it != crystals->end(); ++it) { + for (auto it = crystals->begin(); it != crystals->end(); ++it) { std::shared_ptr ec = std::dynamic_pointer_cast(*it); double dist = ec->distanceToSqr(shared_from_this()); @@ -856,7 +856,7 @@ void EnderDragon::knockBack(std::vector >* entities) { double zm = (body->bb.z0 + body->bb.z1) / 2; // for (Entity e : entities) - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { if ((*it)->instanceof(eTYPE_LIVINGENTITY)) //(e instanceof Mob) { std::shared_ptr e = @@ -871,7 +871,7 @@ void EnderDragon::knockBack(std::vector >* entities) { void EnderDragon::hurt(std::vector >* entities) { // for (int i = 0; i < entities->size(); i++) - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { if ((*it)->instanceof(eTYPE_LIVINGENTITY)) //(e instanceof Mob) { std::shared_ptr e = diff --git a/Minecraft.World/Entities/Mobs/EntityHorse.cpp b/Minecraft.World/Entities/Mobs/EntityHorse.cpp index 2692045da..c436004e7 100644 --- a/Minecraft.World/Entities/Mobs/EntityHorse.cpp +++ b/Minecraft.World/Entities/Mobs/EntityHorse.cpp @@ -424,7 +424,7 @@ std::shared_ptr EntityHorse::getClosestMommy( std::vector >* list = level->getEntities(baby, &expanded, PARENT_HORSE_SELECTOR); - for (AUTO_VAR(it, list->begin()); it != list->end(); ++it) { + for (auto it = list->begin(); it != list->end(); ++it) { std::shared_ptr horse = *it; double distanceSquared = horse->distanceToSqr(baby->x, baby->y, baby->z); diff --git a/Minecraft.World/Entities/Mobs/Fireball.cpp b/Minecraft.World/Entities/Mobs/Fireball.cpp index 86ebfd150..4d02604ee 100644 --- a/Minecraft.World/Entities/Mobs/Fireball.cpp +++ b/Minecraft.World/Entities/Mobs/Fireball.cpp @@ -180,8 +180,8 @@ void Fireball::tick() { std::vector >* objects = level->getEntities(shared_from_this(), &grown); double nearest = 0; - AUTO_VAR(itEnd, objects->end()); - for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { + auto itEnd = objects->end(); + for (auto it = objects->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // objects->at(i); if (!e->isPickable() || (e->is(owner))) continue; // 4J Stu - Never collide with the owner (Enderdragon) // diff --git a/Minecraft.World/Entities/Mobs/FishingHook.cpp b/Minecraft.World/Entities/Mobs/FishingHook.cpp index 617f363e8..a18c5fec8 100644 --- a/Minecraft.World/Entities/Mobs/FishingHook.cpp +++ b/Minecraft.World/Entities/Mobs/FishingHook.cpp @@ -217,8 +217,8 @@ void FishingHook::tick() { std::vector >* objects = level->getEntities(shared_from_this(), &grown); double nearest = 0; - AUTO_VAR(itEnd, objects->end()); - for (AUTO_VAR(it, objects->begin()); it != itEnd; it++) { + auto itEnd = objects->end(); + for (auto it = objects->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // objects->at(i); if (!e->isPickable() || (e == owner && flightTime < 5)) continue; diff --git a/Minecraft.World/Entities/Mobs/LightningBolt.cpp b/Minecraft.World/Entities/Mobs/LightningBolt.cpp index 24bd495dd..6aa5a5f79 100644 --- a/Minecraft.World/Entities/Mobs/LightningBolt.cpp +++ b/Minecraft.World/Entities/Mobs/LightningBolt.cpp @@ -108,8 +108,8 @@ void LightningBolt::tick() { AABB aoe_bb = AABB(x, y, z, x, y + 6, z).grow(r, r, r); std::vector >* entities = level->getEntities(shared_from_this(), &aoe_bb); - AUTO_VAR(itEnd, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { + auto itEnd = entities->end(); + for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); // entities->at(i); e->thunderHit(this); } diff --git a/Minecraft.World/Entities/Mobs/Minecart.cpp b/Minecraft.World/Entities/Mobs/Minecart.cpp index 7c6b1e24c..f3a95fc54 100644 --- a/Minecraft.World/Entities/Mobs/Minecart.cpp +++ b/Minecraft.World/Entities/Mobs/Minecart.cpp @@ -309,8 +309,8 @@ void Minecart::tick() { std::vector >* entities = level->getEntities(shared_from_this(), &grown); if (entities != NULL && !entities->empty()) { - AUTO_VAR(itEnd, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { + auto itEnd = entities->end(); + for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = (*it); // entities->at(i); if (e != rider.lock() && e->isPushable() && e->instanceof(eTYPE_MINECART)) { diff --git a/Minecraft.World/Entities/Mobs/PigZombie.cpp b/Minecraft.World/Entities/Mobs/PigZombie.cpp index f88d30044..b3bee149f 100644 --- a/Minecraft.World/Entities/Mobs/PigZombie.cpp +++ b/Minecraft.World/Entities/Mobs/PigZombie.cpp @@ -103,8 +103,8 @@ bool PigZombie::hurt(DamageSource* source, float dmg) { AABB grown = bb.grow(32, 32, 32); std::vector >* nearby = level->getEntities(shared_from_this(), &grown); - AUTO_VAR(itEnd, nearby->end()); - for (AUTO_VAR(it, nearby->begin()); it != itEnd; it++) { + auto itEnd = nearby->end(); + for (auto it = nearby->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // nearby->at(i); if (e->instanceof(eTYPE_PIGZOMBIE)) { std::shared_ptr pigZombie = diff --git a/Minecraft.World/Entities/Mobs/SharedMonsterAttributes.cpp b/Minecraft.World/Entities/Mobs/SharedMonsterAttributes.cpp index 426862dd5..18607ed5e 100644 --- a/Minecraft.World/Entities/Mobs/SharedMonsterAttributes.cpp +++ b/Minecraft.World/Entities/Mobs/SharedMonsterAttributes.cpp @@ -25,7 +25,7 @@ ListTag* SharedMonsterAttributes::saveAttributes( std::vector atts; attributes->getAttributes(atts); - for (AUTO_VAR(it, atts.begin()); it != atts.end(); ++it) { + for (auto it = atts.begin(); it != atts.end(); ++it) { AttributeInstance* attribute = *it; list->add(saveAttribute(attribute)); } @@ -47,7 +47,7 @@ CompoundTag* SharedMonsterAttributes::saveAttribute( if (!modifiers.empty()) { ListTag* list = new ListTag(); - for (AUTO_VAR(it, modifiers.begin()); it != modifiers.end(); ++it) { + for (auto it = modifiers.begin(); it != modifiers.end(); ++it) { AttributeModifier* modifier = *it; if (modifier->isSerializable()) { list->add(saveAttributeModifier(modifier)); diff --git a/Minecraft.World/Entities/Mobs/ThrownPotion.cpp b/Minecraft.World/Entities/Mobs/ThrownPotion.cpp index 71020e479..1f364f3ae 100644 --- a/Minecraft.World/Entities/Mobs/ThrownPotion.cpp +++ b/Minecraft.World/Entities/Mobs/ThrownPotion.cpp @@ -88,7 +88,7 @@ void ThrownPotion::onHit(HitResult* res) { if (entitiesOfClass != NULL && !entitiesOfClass->empty()) { // for (Entity e : entitiesOfClass) - for (AUTO_VAR(it, entitiesOfClass->begin()); + for (auto it = entitiesOfClass->begin(); it != entitiesOfClass->end(); ++it) { // shared_ptr e = *it; std::shared_ptr e = @@ -101,7 +101,7 @@ void ThrownPotion::onHit(HitResult* res) { } // for (MobEffectInstance effect : mobEffects) - for (AUTO_VAR(itMEI, mobEffects->begin()); + for (auto itMEI = mobEffects->begin(); itMEI != mobEffects->end(); ++itMEI) { MobEffectInstance* effect = *itMEI; int id = effect->getId(); diff --git a/Minecraft.World/Entities/Mobs/Villager.cpp b/Minecraft.World/Entities/Mobs/Villager.cpp index 0c790add7..37ecd313e 100644 --- a/Minecraft.World/Entities/Mobs/Villager.cpp +++ b/Minecraft.World/Entities/Mobs/Villager.cpp @@ -127,7 +127,7 @@ void Villager::serverAiMobStep() { // improve max uses for all obsolete recipes if (offers->size() > 0) { // for (MerchantRecipe recipe : offers) - for (AUTO_VAR(it, offers->begin()); it != offers->end(); + for (auto it = offers->begin(); it != offers->end(); ++it) { MerchantRecipe* recipe = *it; if (recipe->isDeprecated()) { @@ -633,7 +633,7 @@ std::shared_ptr Villager::getItemTradeInValue(int itemId, } int Villager::getTradeInValue(int itemId, Random* random) { - AUTO_VAR(it, MIN_MAX_VALUES.find(itemId)); + auto it = MIN_MAX_VALUES.find(itemId); if (it == MIN_MAX_VALUES.end()) { return 1; } @@ -675,7 +675,7 @@ void Villager::addItemForPurchase(MerchantRecipeList* list, int itemId, } int Villager::getPurchaseCost(int itemId, Random* random) { - AUTO_VAR(it, MIN_MAX_PRICES.find(itemId)); + auto it = MIN_MAX_PRICES.find(itemId); if (it == MIN_MAX_PRICES.end()) { return 1; } diff --git a/Minecraft.World/Entities/Mobs/Witch.cpp b/Minecraft.World/Entities/Mobs/Witch.cpp index f8e970389..f1dd4dd9c 100644 --- a/Minecraft.World/Entities/Mobs/Witch.cpp +++ b/Minecraft.World/Entities/Mobs/Witch.cpp @@ -93,7 +93,7 @@ void Witch::aiStep() { std::vector* effects = Item::potion->getMobEffects(item); if (effects != NULL) { - for (AUTO_VAR(it, effects->begin()); + for (auto it = effects->begin(); it != effects->end(); ++it) { addEffect(new MobEffectInstance(*it)); } diff --git a/Minecraft.World/Entities/SyncedEntityData.cpp b/Minecraft.World/Entities/SyncedEntityData.cpp index cf99e7aec..a27b1ad55 100644 --- a/Minecraft.World/Entities/SyncedEntityData.cpp +++ b/Minecraft.World/Entities/SyncedEntityData.cpp @@ -188,8 +188,8 @@ void SynchedEntityData::pack( DataOutputStream* output) // TODO throws IOException { if (items != NULL) { - AUTO_VAR(itEnd, items->end()); - for (AUTO_VAR(it, items->begin()); it != itEnd; it++) { + auto itEnd = items->end(); + for (auto it = items->begin(); it != itEnd; it++) { std::shared_ptr dataItem = *it; writeDataItem(output, dataItem); } @@ -363,8 +363,8 @@ SynchedEntityData::unpack(DataInputStream* input) // throws IOException void SynchedEntityData::assignValues( std::vector >* items) { - AUTO_VAR(itEnd, items->end()); - for (AUTO_VAR(it, items->begin()); it != itEnd; it++) { + auto itEnd = items->end(); + for (auto it = items->begin(); it != itEnd; it++) { std::shared_ptr item = *it; std::shared_ptr itemFromId = itemsById[item->getId()]; diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp index 85361c7ed..ee163e27c 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileConverter.cpp @@ -267,7 +267,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile* sourceSave, // region files std::vector* allFilesInSave = sourceSave->getFilesWithPrefix(std::wstring(L"")); - for (AUTO_VAR(it, allFilesInSave->begin()); it < allFilesInSave->end(); + for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); ++it) { FileEntry* fe = *it; if (fe != sourceLdatFe) { diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index 8ae4310f0..01bde5335 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -857,7 +857,7 @@ void ConsoleSaveFileOriginal::ConvertToLocalPlatform() { // convert each of the region files to the local platform std::vector* allFilesInSave = getFilesWithPrefix(std::wstring(L"")); - for (AUTO_VAR(it, allFilesInSave->begin()); it < allFilesInSave->end(); + for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); ++it) { FileEntry* fe = *it; std::wstring fName(fe->data.filename); diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 0c3641815..054db7fb7 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -323,7 +323,7 @@ void ConsoleSaveFileSplit::RegionFileReference::ReleaseCompressed() { FileEntry* ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex) { // Is a region file - determine if we've got it as a separate file - AUTO_VAR(it, regionFiles.find(regionIndex)); + auto it = regionFiles.find(regionIndex); if (it != regionFiles.end()) { // Already got it return it->second->fileEntry; @@ -376,7 +376,7 @@ ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile* sourceSave, sourceSave->getFilesWithPrefix(L""); unsigned int bytesWritten = 0; - for (AUTO_VAR(it, sourceFiles->begin()); it != sourceFiles->end(); + for (auto it = sourceFiles->begin(); it != sourceFiles->end(); ++it) { FileEntry* sourceEntry = *it; sourceSave->setFilePointer(sourceEntry, 0, @@ -545,7 +545,7 @@ ConsoleSaveFileSplit::~ConsoleSaveFileSplit() { // Make sure we don't have any thumbnail data still waiting round - we can't // need it now we've destroyed the save file anyway - for (AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++) { + for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) { delete it->second; } @@ -895,7 +895,7 @@ void ConsoleSaveFileSplit::tick() { // Get total amount of data written over the time period we are interested // in averaging over. Remove any older data. unsigned int bytesWritten = 0; - for (AUTO_VAR(it, writeHistory.begin()); it != writeHistory.end();) { + for (auto it = writeHistory.begin(); it != writeHistory.end();) { if ((currentTime - it->writeTime) > (WRITE_BANDWIDTH_MEASUREMENT_PERIOD_SECONDS * 1000)) { it = writeHistory.erase(it); @@ -907,7 +907,7 @@ void ConsoleSaveFileSplit::tick() { // Compile a vector of dirty regions. std::vector dirtyRegions; - for (AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++) { + for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) { DirtyRegionFile dirtyRegion; if (it->second->dirty) { @@ -965,7 +965,7 @@ void ConsoleSaveFileSplit::tick() { unsigned int totalDirty = 0; unsigned int totalDirtyBytes = 0; int64_t oldestDirty = currentTime; - for (AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++) { + for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) { if (it->second->dirty) { if (it->second->lastWritten < oldestDirty) { oldestDirty = it->second->lastWritten; @@ -1219,7 +1219,7 @@ std::wstring ConsoleSaveFileSplit::GetNameFromNumericIdentifier( // Compress any dirty region files, and tell the storage manager about them so // that it will process them when we ask it to save sub files void ConsoleSaveFileSplit::processSubfilesForWrite() { - for (AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++) { + for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) { RegionFileReference* region = it->second; if (region->dirty) { region->Compress(); @@ -1236,7 +1236,7 @@ void ConsoleSaveFileSplit::processSubfilesForWrite() { void ConsoleSaveFileSplit::processSubfilesAfterWrite() { // This is called from the StorageManager.Tick() which should always be on // the main thread - for (AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++) { + for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) { RegionFileReference* region = it->second; region->ReleaseCompressed(); } @@ -1486,7 +1486,7 @@ std::vector* ConsoleSaveFileSplit::getRegionFilesByDimension( unsigned int dimensionIndex) { std::vector* files = NULL; - for (AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); ++it) { + for (auto it = regionFiles.begin(); it != regionFiles.end(); ++it) { unsigned int entryDimension = ((it->first) >> 16) & 0xFF; if (entryDimension == dimensionIndex) { @@ -1583,7 +1583,7 @@ void ConsoleSaveFileSplit::ConvertToLocalPlatform() { // convert each of the region files to the local platform std::vector* allFilesInSave = getFilesWithPrefix(std::wstring(L"")); - for (AUTO_VAR(it, allFilesInSave->begin()); it < allFilesInSave->end(); + for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); ++it) { FileEntry* fe = *it; std::wstring fName(fe->data.filename); diff --git a/Minecraft.World/IO/Files/FileHeader.cpp b/Minecraft.World/IO/Files/FileHeader.cpp index c790bfe58..239273ce8 100644 --- a/Minecraft.World/IO/Files/FileHeader.cpp +++ b/Minecraft.World/IO/Files/FileHeader.cpp @@ -51,7 +51,7 @@ void FileHeader::RemoveFile(FileEntry* file) { AdjustStartOffsets(file, file->getFileSize(), true); - AUTO_VAR(it, find(fileTable.begin(), fileTable.end(), file)); + auto it = find(fileTable.begin(), fileTable.end(), file); if (it < fileTable.end()) { fileTable.erase(it); diff --git a/Minecraft.World/IO/NBT/CompoundTag.h b/Minecraft.World/IO/NBT/CompoundTag.h index c80a52c94..74a42e8a3 100644 --- a/Minecraft.World/IO/NBT/CompoundTag.h +++ b/Minecraft.World/IO/NBT/CompoundTag.h @@ -20,7 +20,7 @@ public: CompoundTag(const std::wstring& name) : Tag(name) {} void write(DataOutput* dos) { - AUTO_VAR(itEnd, tags.end()); + auto itEnd = tags.end(); for (std::unordered_map::iterator it = tags.begin(); it != itEnd; it++) { Tag::writeNamedTag(it->second, dos); @@ -50,7 +50,7 @@ public: // 4J - was return tags.values(); std::vector* ret = new std::vector; - AUTO_VAR(itEnd, tags.end()); + auto itEnd = tags.end(); for (std::unordered_map::iterator it = tags.begin(); it != itEnd; it++) { ret->push_back(it->second); @@ -109,7 +109,7 @@ public: } Tag* get(const std::wstring& name) { - AUTO_VAR(it, tags.find(name)); + auto it = tags.find(name); if (it != tags.end()) return it->second; return NULL; } @@ -178,7 +178,7 @@ public: } void remove(const std::wstring& name) { - AUTO_VAR(it, tags.find(name)); + auto it = tags.find(name); if (it != tags.end()) tags.erase(it); // tags.remove(name); } @@ -199,7 +199,7 @@ public: strcpy( newPrefix, prefix); strcat( newPrefix, " "); - AUTO_VAR(itEnd, tags.end()); + auto itEnd = tags.end(); for( unordered_map::iterator it = tags.begin(); it != itEnd; it++ ) { @@ -213,8 +213,8 @@ public: bool isEmpty() { return tags.empty(); } virtual ~CompoundTag() { - AUTO_VAR(itEnd, tags.end()); - for (AUTO_VAR(it, tags.begin()); it != itEnd; it++) { + auto itEnd = tags.end(); + for (auto it = tags.begin(); it != itEnd; it++) { delete it->second; } } @@ -222,8 +222,8 @@ public: Tag* copy() { CompoundTag* tag = new CompoundTag(getName()); - AUTO_VAR(itEnd, tags.end()); - for (AUTO_VAR(it, tags.begin()); it != itEnd; it++) { + auto itEnd = tags.end(); + for (auto it = tags.begin(); it != itEnd; it++) { tag->put((wchar_t*)it->first.c_str(), it->second->copy()); } return tag; @@ -235,9 +235,9 @@ public: if (tags.size() == o->tags.size()) { bool equal = true; - AUTO_VAR(itEnd, tags.end()); - for (AUTO_VAR(it, tags.begin()); it != itEnd; it++) { - AUTO_VAR(itFind, o->tags.find(it->first)); + auto itEnd = tags.end(); + for (auto it = tags.begin(); it != itEnd; it++) { + auto itFind = o->tags.find(it->first); if (itFind == o->tags.end() || !it->second->equals(itFind->second)) { equal = false; diff --git a/Minecraft.World/IO/NBT/ListTag.h b/Minecraft.World/IO/NBT/ListTag.h index d528b12da..7df99ae4a 100644 --- a/Minecraft.World/IO/NBT/ListTag.h +++ b/Minecraft.World/IO/NBT/ListTag.h @@ -20,8 +20,8 @@ public: dos->writeByte(type); dos->writeInt((int)list.size()); - AUTO_VAR(itEnd, list.end()); - for (AUTO_VAR(it, list.begin()); it != itEnd; it++) (*it)->write(dos); + auto itEnd = list.end(); + for (auto it = list.begin(); it != itEnd; it++) (*it)->write(dos); } void load(DataInput* dis, int tagDepth) { @@ -61,8 +61,8 @@ public: char* newPrefix = new char[strlen(prefix) + 4]; strcpy(newPrefix, prefix); strcat(newPrefix, " "); - AUTO_VAR(itEnd, list.end()); - for (AUTO_VAR(it, list.begin()); it != itEnd; it++) { + auto itEnd = list.end(); + for (auto it = list.begin(); it != itEnd; it++) { (*it)->print(newPrefix, out); } delete[] newPrefix; @@ -85,8 +85,8 @@ public: int size() { return (int)list.size(); } virtual ~ListTag() { - AUTO_VAR(itEnd, list.end()); - for (AUTO_VAR(it, list.begin()); it != itEnd; it++) { + auto itEnd = list.end(); + for (auto it = list.begin(); it != itEnd; it++) { delete *it; } } @@ -94,8 +94,8 @@ public: virtual Tag* copy() { ListTag* res = new ListTag(getName()); res->type = type; - AUTO_VAR(itEnd, list.end()); - for (AUTO_VAR(it, list.begin()); it != itEnd; it++) { + auto itEnd = list.end(); + for (auto it = list.begin(); it != itEnd; it++) { T* copy = (T*)(*it)->copy(); res->list.push_back(copy); } @@ -109,13 +109,13 @@ public: bool equal = false; if (list.size() == o->list.size()) { equal = true; - AUTO_VAR(itEnd, list.end()); + auto itEnd = list.end(); // 4J Stu - Pretty inefficient method, but I think we can // live with it give how often it will happen, and the small // sizes of the data sets - for (AUTO_VAR(it, list.begin()); it != itEnd; ++it) { + for (auto it = list.begin(); it != itEnd; ++it) { bool thisMatches = false; - for (AUTO_VAR(it2, o->list.begin()); + for (auto it2 = o->list.begin(); it2 != o->list.end(); ++it2) { if ((*it)->equals(*it2)) { thisMatches = true; diff --git a/Minecraft.World/IO/NBT/NbtSlotFile.cpp b/Minecraft.World/IO/NBT/NbtSlotFile.cpp index ce4d42f84..c6766eb63 100644 --- a/Minecraft.World/IO/NBT/NbtSlotFile.cpp +++ b/Minecraft.World/IO/NBT/NbtSlotFile.cpp @@ -110,8 +110,8 @@ std::vector* NbtSlotFile::readAll(int slot) { std::vector* fileSlots = fileSlotMap[slot]; int skipped = 0; - AUTO_VAR(itEnd, fileSlots->end()); - for (AUTO_VAR(it, fileSlots->begin()); it != itEnd; it++) { + auto itEnd = fileSlots->end(); + for (auto it = fileSlots->begin(); it != itEnd; it++) { int c = *it; // fileSlots->at(i); int pos = 0; @@ -179,8 +179,8 @@ void NbtSlotFile::replaceSlot(int slot, std::vector* tags) { toReplace = fileSlotMap[slot]; fileSlotMap[slot] = new std::vector(); - AUTO_VAR(itEndTags, tags->end()); - for (AUTO_VAR(it, tags->begin()); it != itEndTags; it++) { + auto itEndTags = tags->end(); + for (auto it = tags->begin(); it != itEndTags; it++) { CompoundTag* tag = *it; // tags->at(i); byteArray compressed = NbtIo::compress(tag); if (compressed.length > largest) { @@ -235,8 +235,8 @@ void NbtSlotFile::replaceSlot(int slot, std::vector* tags) { delete[] compressed.data; } - AUTO_VAR(itEndToRep, toReplace->end()); - for (AUTO_VAR(it, toReplace->begin()); it != itEndToRep; it++) { + auto itEndToRep = toReplace->end(); + for (auto it = toReplace->begin(); it != itEndToRep; it++) { int c = *it; // toReplace->at(i); freeFileSlots.push_back(c); diff --git a/Minecraft.World/Items/BoatItem.cpp b/Minecraft.World/Items/BoatItem.cpp index 313b658e1..82594997e 100644 --- a/Minecraft.World/Items/BoatItem.cpp +++ b/Minecraft.World/Items/BoatItem.cpp @@ -88,7 +88,7 @@ std::shared_ptr BoatItem::use( std::vector >* objects = level->getEntities(player, &grown); // for (int i = 0; i < objects.size(); i++) { - for (AUTO_VAR(it, objects->begin()); it != objects->end(); ++it) { + for (auto it = objects->begin(); it != objects->end(); ++it) { std::shared_ptr e = *it; // objects.get(i); if (!e->isPickable()) continue; diff --git a/Minecraft.World/Items/ItemInstance.cpp b/Minecraft.World/Items/ItemInstance.cpp index 64703f347..91fbef997 100644 --- a/Minecraft.World/Items/ItemInstance.cpp +++ b/Minecraft.World/Items/ItemInstance.cpp @@ -624,14 +624,14 @@ std::vector* ItemInstance::getHoverText( lines->push_back(HtmlString(L"")); // Modifier descriptions - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { // 4J: Moved modifier string building to AttributeModifier lines->push_back(it->second->getHoverText(it->first)); } } // Delete modifiers map - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { AttributeModifier* modifier = it->second; delete modifier; } diff --git a/Minecraft.World/Items/LeashItem.cpp b/Minecraft.World/Items/LeashItem.cpp index 1139a5d86..cd9dd6195 100644 --- a/Minecraft.World/Items/LeashItem.cpp +++ b/Minecraft.World/Items/LeashItem.cpp @@ -40,7 +40,7 @@ bool LeashItem::bindPlayerMobs(std::shared_ptr player, Level* level, std::vector >* mobs = level->getEntitiesOfClass(typeid(Mob), &mob_bb); if (mobs != NULL) { - for (AUTO_VAR(it, mobs->begin()); it != mobs->end(); ++it) { + for (auto it = mobs->begin(); it != mobs->end(); ++it) { std::shared_ptr mob = std::dynamic_pointer_cast(*it); if (mob->isLeashed() && mob->getLeashHolder() == player) { if (activeKnot == NULL) { @@ -65,7 +65,7 @@ bool LeashItem::bindPlayerMobsTest(std::shared_ptr player, Level* level, level->getEntitiesOfClass(typeid(Mob), &mob_bb); if (mobs != NULL) { - for (AUTO_VAR(it, mobs->begin()); it != mobs->end(); ++it) { + for (auto it = mobs->begin(); it != mobs->end(); ++it) { std::shared_ptr mob = std::dynamic_pointer_cast(*it); if (mob->isLeashed() && mob->getLeashHolder() == player) return true; diff --git a/Minecraft.World/Items/PotionItem.cpp b/Minecraft.World/Items/PotionItem.cpp index 15fd1e77f..e2a0cfae1 100644 --- a/Minecraft.World/Items/PotionItem.cpp +++ b/Minecraft.World/Items/PotionItem.cpp @@ -35,7 +35,7 @@ std::vector* PotionItem::getMobEffects( if (!potion->hasTag() || !potion->getTag()->contains(L"CustomPotionEffects")) { std::vector* effects = NULL; - AUTO_VAR(it, cachedMobEffects.find(potion->getAuxValue())); + auto it = cachedMobEffects.find(potion->getAuxValue()); if (it != cachedMobEffects.end()) effects = it->second; if (effects == NULL) { effects = PotionBrewing::getEffects(potion->getAuxValue(), false); @@ -63,7 +63,7 @@ std::vector* PotionItem::getMobEffects( std::vector* PotionItem::getMobEffects(int auxValue) { std::vector* effects = NULL; - AUTO_VAR(it, cachedMobEffects.find(auxValue)); + auto it = cachedMobEffects.find(auxValue); if (it != cachedMobEffects.end()) effects = it->second; if (effects == NULL) { effects = PotionBrewing::getEffects(auxValue, false); @@ -84,7 +84,7 @@ std::shared_ptr PotionItem::useTimeDepleted( std::vector* effects = getMobEffects(instance); if (effects != NULL) { // for (MobEffectInstance effect : effects) - for (AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) { + for (auto it = effects->begin(); it != effects->end(); ++it) { player->addEffect(new MobEffectInstance(*it)); } } @@ -176,7 +176,7 @@ bool PotionItem::hasInstantenousEffects(int itemAuxValue) { return false; } // for (MobEffectInstance effect : mobEffects) { - for (AUTO_VAR(it, mobEffects->begin()); it != mobEffects->end(); ++it) { + for (auto it = mobEffects->begin(); it != mobEffects->end(); ++it) { MobEffectInstance* effect = *it; if (MobEffect::effects[effect->getId()]->isInstantenous()) { return true; @@ -238,7 +238,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, attrAttrModMap modifiers; if (effects != NULL && !effects->empty()) { // for (MobEffectInstance effect : effects) - for (AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) { + for (auto it = effects->begin(); it != effects->end(); ++it) { MobEffectInstance* effect = *it; std::wstring effectString = app.GetString(effect->getDescriptionId()); @@ -248,7 +248,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, effectModifiers = mobEffect->getAttributeModifiers(); if (effectModifiers != NULL && effectModifiers->size() > 0) { - for (AUTO_VAR(it, effectModifiers->begin()); + for (auto it = effectModifiers->begin(); it != effectModifiers->end(); ++it) { // 4J - anonymous modifiers added here are destroyed // shortly? @@ -318,7 +318,7 @@ void PotionItem::appendHoverText(std::shared_ptr itemInstance, eHTMLColor_5)); // Add modifier descriptions - for (AUTO_VAR(it, modifiers.begin()); it != modifiers.end(); ++it) { + for (auto it = modifiers.begin(); it != modifiers.end(); ++it) { // 4J: Moved modifier string building to AttributeModifier lines->push_back(it->second->getHoverText(it->first)); } @@ -388,7 +388,7 @@ std::vector >* PotionItem::getUniquePotionValues() { // http://docs.oracle.com/javase/6/docs/api/java/util/List.html#hashCode() // and adding deleting to clear up as we go int effectsHashCode = 1; - for (AUTO_VAR(it, effects->begin()); it != effects->end(); + for (auto it = effects->begin(); it != effects->end(); ++it) { MobEffectInstance* mei = *it; effectsHashCode = 31 * effectsHashCode + @@ -397,7 +397,7 @@ std::vector >* PotionItem::getUniquePotionValues() { } bool toAdd = true; - for (AUTO_VAR(it, s_uniquePotionValues.begin()); + for (auto it = s_uniquePotionValues.begin(); it != s_uniquePotionValues.end(); ++it) { // Some potions hash the same (identical effects) but // are throwable so account for that diff --git a/Minecraft.World/Items/RecordingItem.cpp b/Minecraft.World/Items/RecordingItem.cpp index 3a9a280d0..e8b2ccbe8 100644 --- a/Minecraft.World/Items/RecordingItem.cpp +++ b/Minecraft.World/Items/RecordingItem.cpp @@ -64,7 +64,7 @@ void RecordingItem::registerIcons(IconRegister* iconRegister) { } RecordingItem* RecordingItem::getByName(const std::wstring& name) { - AUTO_VAR(it, BY_NAME.find(name)); + auto it = BY_NAME.find(name); if (it != BY_NAME.end()) { return it->second; } else { diff --git a/Minecraft.World/Items/SpawnEggItem.cpp b/Minecraft.World/Items/SpawnEggItem.cpp index bf6b24582..d23e1fd65 100644 --- a/Minecraft.World/Items/SpawnEggItem.cpp +++ b/Minecraft.World/Items/SpawnEggItem.cpp @@ -36,7 +36,7 @@ std::wstring SpawnEggItem::getHoverName( int SpawnEggItem::getColor(std::shared_ptr item, int spriteLayer) { - AUTO_VAR(it, EntityIO::idsSpawnableInCreative.find(item->getAuxValue())); + auto it = EntityIO::idsSpawnableInCreative.find(item->getAuxValue()); if (it != EntityIO::idsSpawnableInCreative.end()) { EntityIO::SpawnableMobInfo* spawnableMobInfo = it->second; if (spriteLayer == 0) { diff --git a/Minecraft.World/Level/BaseMobSpawner.cpp b/Minecraft.World/Level/BaseMobSpawner.cpp index bf6fcb51c..0f022d88d 100644 --- a/Minecraft.World/Level/BaseMobSpawner.cpp +++ b/Minecraft.World/Level/BaseMobSpawner.cpp @@ -24,7 +24,7 @@ BaseMobSpawner::BaseMobSpawner() { BaseMobSpawner::~BaseMobSpawner() { if (spawnPotentials) { - for (AUTO_VAR(it, spawnPotentials->begin()); + for (auto it = spawnPotentials->begin(); it != spawnPotentials->end(); ++it) { delete *it; } @@ -134,7 +134,7 @@ std::shared_ptr BaseMobSpawner::loadDataAndAddEntity( entity->save(data); std::vector* tags = getNextSpawnData()->tag->getAllTags(); - for (AUTO_VAR(it, tags->begin()); it != tags->end(); ++it) { + for (auto it = tags->begin(); it != tags->end(); ++it) { Tag* tag = *it; data->put(tag->getName(), tag->copy()); } @@ -154,7 +154,7 @@ std::shared_ptr BaseMobSpawner::loadDataAndAddEntity( mount->save(mountData); std::vector* ridingTags = ridingTag->getAllTags(); - for (AUTO_VAR(it, ridingTags->begin()); it != ridingTags->end(); + for (auto it = ridingTags->begin(); it != ridingTags->end(); ++it) { Tag* tag = *it; mountData->put(tag->getName(), tag->copy()); @@ -258,7 +258,7 @@ void BaseMobSpawner::save(CompoundTag* tag) { ListTag* list = new ListTag(); if (spawnPotentials != NULL && spawnPotentials->size() > 0) { - for (AUTO_VAR(it, spawnPotentials->begin()); + for (auto it = spawnPotentials->begin(); it != spawnPotentials->end(); ++it) { SpawnData* data = *it; list->add(data->save()); diff --git a/Minecraft.World/Level/Events/VillageSiege.cpp b/Minecraft.World/Level/Events/VillageSiege.cpp index abf2dc517..46d0694b3 100644 --- a/Minecraft.World/Level/Events/VillageSiege.cpp +++ b/Minecraft.World/Level/Events/VillageSiege.cpp @@ -68,7 +68,7 @@ void VillageSiege::tick() { bool VillageSiege::tryToSetupSiege() { std::vector >* players = &level->players; // for (Player player : players) - for (AUTO_VAR(it, players->begin()); it != players->end(); ++it) { + for (auto it = players->begin(); it != players->end(); ++it) { std::shared_ptr player = *it; std::shared_ptr _village = level->villages->getClosestVillage( (int)player->x, (int)player->y, (int)player->z, 1); @@ -96,7 +96,7 @@ bool VillageSiege::tryToSetupSiege() { std::vector >* villages = level->villages->getVillages(); // for (Village v : level.villages.getVillages()) - for (AUTO_VAR(itV, villages->begin()); itV != villages->end(); + for (auto itV = villages->begin(); itV != villages->end(); ++itV) { std::shared_ptr v = *itV; if (v == _village) continue; diff --git a/Minecraft.World/Level/Explosion.cpp b/Minecraft.World/Level/Explosion.cpp index 9be40d49b..3386af856 100644 --- a/Minecraft.World/Level/Explosion.cpp +++ b/Minecraft.World/Level/Explosion.cpp @@ -108,8 +108,8 @@ void Explosion::explode() { levelEntities->end()); Vec3 center(x, y, z); - AUTO_VAR(itEnd, entities.end()); - for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { + auto itEnd = entities.end(); + for (auto it = entities.begin(); it != itEnd; it++) { std::shared_ptr e = *it; // entities->at(i); // 4J Stu - If the entity is not in a block that would be blown up, then @@ -117,7 +117,7 @@ void Explosion::explode() { // The player can be damaged and killed by explosions behind obsidian // walls bool canDamage = false; - for (AUTO_VAR(it2, toBlow.begin()); it2 != toBlow.end(); ++it2) { + for (auto it2 = toBlow.begin(); it2 != toBlow.end(); ++it2) { if (e->bb.intersects(it2->x, it2->y, it2->z, it2->x + 1, it2->y + 1, it2->z + 1)) { canDamage = true; @@ -201,7 +201,7 @@ void Explosion::finalizeExplosion( if (fraction == 0) fraction = 1; size_t j = toBlowArray->size() - 1; // for (size_t j = toBlowArray->size() - 1; j >= 0; j--) - for (AUTO_VAR(it, toBlowArray->rbegin()); it != toBlowArray->rend(); + for (auto it = toBlowArray->rbegin(); it != toBlowArray->rend(); ++it) { TilePos* tp = &(*it); //&toBlowArray->at(j); int xt = tp->x; @@ -261,7 +261,7 @@ void Explosion::finalizeExplosion( if (fire) { // for (size_t j = toBlowArray->size() - 1; j >= 0; j--) - for (AUTO_VAR(it, toBlowArray->rbegin()); it != toBlowArray->rend(); + for (auto it = toBlowArray->rbegin(); it != toBlowArray->rend(); ++it) { TilePos* tp = &(*it); //&toBlowArray->at(j); int xt = tp->x; @@ -282,7 +282,7 @@ void Explosion::finalizeExplosion( Explosion::playerVec3Map* Explosion::getHitPlayers() { return &hitPlayers; } Vec3 Explosion::getHitPlayerKnockback(std::shared_ptr player) { - AUTO_VAR(it, hitPlayers.find(player)); + auto it = hitPlayers.find(player); if (it == hitPlayers.end()) return Vec3(0.0, 0.0, 0.0); diff --git a/Minecraft.World/Level/GameRules.cpp b/Minecraft.World/Level/GameRules.cpp index 08436a330..fef5c9c6d 100644 --- a/Minecraft.World/Level/GameRules.cpp +++ b/Minecraft.World/Level/GameRules.cpp @@ -28,7 +28,7 @@ GameRules::GameRules() { } GameRules::~GameRules() { - /*for(AUTO_VAR(it,rules.begin()); it != rules.end(); ++it) + /*for(auto it = rules.begin(); it != rules.end(); ++it) { delete it->second; }*/ @@ -67,7 +67,7 @@ void GameRules::registerRule(const std::wstring &name, const std::wstring void GameRules::set(const std::wstring &ruleName, const std::wstring &newValue) { - AUTO_VAR(it, rules.find(ruleName)); + auto it = rules.find(ruleName); if(it != rules.end() ) { GameRule *gameRule = it->second; @@ -81,7 +81,7 @@ void GameRules::set(const std::wstring &ruleName, const std::wstring &newValue) std::wstring GameRules::get(const std::wstring &ruleName) { - AUTO_VAR(it, rules.find(ruleName)); + auto it = rules.find(ruleName); if(it != rules.end() ) { GameRule *gameRule = it->second; @@ -92,7 +92,7 @@ std::wstring GameRules::get(const std::wstring &ruleName) int GameRules::getInt(const std::wstring &ruleName) { - AUTO_VAR(it, rules.find(ruleName)); + auto it = rules.find(ruleName); if(it != rules.end() ) { GameRule *gameRule = it->second; @@ -103,7 +103,7 @@ int GameRules::getInt(const std::wstring &ruleName) double GameRules::getDouble(const std::wstring &ruleName) { - AUTO_VAR(it, rules.find(ruleName)); + auto it = rules.find(ruleName); if(it != rules.end() ) { GameRule *gameRule = it->second; @@ -116,7 +116,7 @@ CompoundTag *GameRules::createTag() { CompoundTag *result = new CompoundTag(L"GameRules"); - for(AUTO_VAR(it,rules.begin()); it != rules.end(); ++it) + for(auto it = rules.begin(); it != rules.end(); ++it) { GameRule *gameRule = it->second; result->putString(it->first, gameRule->get()); @@ -128,7 +128,7 @@ CompoundTag *GameRules::createTag() void GameRules::loadFromTag(CompoundTag *tag) { vector *allTags = tag->getAllTags(); - for (AUTO_VAR(it, allTags->begin()); it != allTags->end(); ++it) + for (auto it = allTags->begin(); it != allTags->end(); ++it) { Tag *ruleTag = *it; std::wstring ruleName = ruleTag->getName(); @@ -143,13 +143,13 @@ void GameRules::loadFromTag(CompoundTag *tag) vector *GameRules::getRuleNames() { vector *out = new vector(); - for (AUTO_VAR(it, rules.begin()); it != rules.end(); it++) + for (auto it = rules.begin(); it != rules.end(); it++) out->push_back(it->first); return out; } bool GameRules::contains(const std::wstring &rule) { - AUTO_VAR(it, rules.find(rule)); + auto it = rules.find(rule); return it != rules.end(); } diff --git a/Minecraft.World/Level/Level.cpp b/Minecraft.World/Level/Level.cpp index 567eb8e2d..62083102e 100644 --- a/Minecraft.World/Level/Level.cpp +++ b/Minecraft.World/Level/Level.cpp @@ -995,8 +995,8 @@ bool Level::setTileAndUpdate(int x, int y, int z, int tile) { } void Level::sendTileUpdated(int x, int y, int z) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->tileChanged(x, y, z); } } @@ -1029,15 +1029,15 @@ void Level::lightColumnChanged(int x, int z, int y0, int y1) { } void Level::setTileDirty(int x, int y, int z) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->setTilesDirty(x, y, z, x, y, z, this); } } void Level::setTilesDirty(int x0, int y0, int z0, int x1, int y1, int z1) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->setTilesDirty(x0, y0, z0, x1, y1, z1, this); } } @@ -1337,16 +1337,16 @@ void Level::setBrightness( cachemaxz = z; } } else { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->tileLightChanged(x, y, z); } } } void Level::setTileBrightnessChanged(int x, int y, int z) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->tileLightChanged(x, y, z); } } @@ -1515,8 +1515,8 @@ HitResult* Level::clip(Vec3* a, Vec3* b, bool liquid, bool solidOnly) { void Level::playEntitySound(std::shared_ptr entity, int iSound, float volume, float pitch) { if (entity == NULL) return; - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { // 4J-PB - if the entity is a local player, don't play the sound if (entity->GetType() == eTYPE_SERVERPLAYER) { // app.DebugPrintf("ENTITY is serverplayer\n"); @@ -1535,8 +1535,8 @@ void Level::playEntitySound(std::shared_ptr entity, int iSound, void Level::playPlayerSound(std::shared_ptr entity, int iSound, float volume, float pitch) { if (entity == NULL) return; - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->playSoundExceptPlayer(entity, iSound, entity->x, entity->y - entity->heightOffset, entity->z, volume, pitch); @@ -1547,8 +1547,8 @@ void Level::playPlayerSound(std::shared_ptr entity, int iSound, // float volume, float pitch) void Level::playSound(double x, double y, double z, int iSound, float volume, float pitch, float fClipSoundDist) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->playSound(iSound, x, y, z, volume, pitch, fClipSoundDist); } } @@ -1558,8 +1558,8 @@ void Level::playLocalSound(double x, double y, double z, int iSound, float fClipSoundDist) {} void Level::playStreamingMusic(const std::wstring& name, int x, int y, int z) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->playStreamingMusic(name, x, y, z); } } @@ -1572,8 +1572,8 @@ void Level::playMusic(double x, double y, double z, const std::wstring& string, void Level::addParticle(const wstring& id, double x, double y, double z, double xd, double yd, double zd) { -AUTO_VAR(itEnd, listeners.end()); -for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) +auto itEnd = listeners.end(); +for (auto it = listeners.begin(); it != itEnd; it++) (*it)->addParticle(id, x, y, z, xd, yd, zd); } */ @@ -1581,8 +1581,8 @@ for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) // 4J-PB added void Level::addParticle(ePARTICLE_TYPE id, double x, double y, double z, double xd, double yd, double zd) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) (*it)->addParticle(id, x, y, z, xd, yd, zd); } @@ -1638,23 +1638,23 @@ bool Level::addEntity(std::shared_ptr e) { #pragma optimize("", on) void Level::entityAdded(std::shared_ptr e) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->entityAdded(e); } } void Level::entityRemoved(std::shared_ptr e) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->entityRemoved(e); } } // 4J added void Level::playerRemoved(std::shared_ptr e) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->playerRemoved(e); } } @@ -1804,7 +1804,7 @@ AABBList* Level::getCubes(std::shared_ptr source, AABB* box, std::vector >* ee = getEntities(source, &grown); std::vector >::iterator itEnd = ee->end(); - for (AUTO_VAR(it, ee->begin()); it != itEnd; it++) { + for (auto it = ee->begin(); it != itEnd; it++) { AABB* collideBox = (*it)->getCollideBox(); if (collideBox != NULL && collideBox->intersects(*box)) { boxes.push_back(*collideBox); @@ -2086,9 +2086,9 @@ void Level::tickEntities() { 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()); + for (auto it2 = entitiesToRemove.begin(); it2 != entitiesToRemove.end(); it2++) { if ((*it) == (*it2)) { found = true; @@ -2103,8 +2103,8 @@ void Level::tickEntities() { } LeaveCriticalSection(&m_entitiesCS); - AUTO_VAR(itETREnd, entitiesToRemove.end()); - for (AUTO_VAR(it, entitiesToRemove.begin()); it != itETREnd; it++) { + auto itETREnd = entitiesToRemove.end(); + for (auto it = entitiesToRemove.begin(); it != itETREnd; it++) { std::shared_ptr e = *it; // entitiesToRemove.at(j); int xc = e->xChunk; int zc = e->zChunk; @@ -2114,7 +2114,7 @@ void Level::tickEntities() { } itETREnd = entitiesToRemove.end(); - for (AUTO_VAR(it, entitiesToRemove.begin()); it != itETREnd; it++) { + for (auto it = entitiesToRemove.begin(); it != itETREnd; it++) { entityRemoved(*it); } // @@ -2161,7 +2161,7 @@ void Level::tickEntities() { // 4J Find the entity again before deleting, as things might have // moved in the entity array eg from the explosion created by tnt - AUTO_VAR(it, find(entities.begin(), entities.end(), e)); + auto it = find(entities.begin(), entities.end(), e); if (it != entities.end()) { entities.erase(it); } @@ -2176,7 +2176,7 @@ void Level::tickEntities() { EnterCriticalSection(&m_tileEntityListCS); updatingTileEntities = true; - for (AUTO_VAR(it, tileEntityList.begin()); it != tileEntityList.end();) { + for (auto it = tileEntityList.begin(); it != tileEntityList.end();) { std::shared_ptr te = *it; // tilevector >.at(i); if (!te->isRemoved() && te->hasLevel()) { @@ -2209,7 +2209,7 @@ void Level::tickEntities() { if (!tileEntitiesToUnload.empty()) { FRAME_PROFILE_SCOPE(TileEntityUnloadCleanup); - for (AUTO_VAR(it, tileEntityList.begin()); + for (auto it = tileEntityList.begin(); it != tileEntityList.end();) { if (tileEntitiesToUnload.find(*it) != tileEntitiesToUnload.end()) { if (isClientSide) { @@ -2224,7 +2224,7 @@ void Level::tickEntities() { } if (!pendingTileEntities.empty()) { - for (AUTO_VAR(it, pendingTileEntities.begin()); + for (auto it = pendingTileEntities.begin(); it != pendingTileEntities.end(); it++) { std::shared_ptr e = *it; if (!e->isRemoved()) { @@ -2250,11 +2250,11 @@ void Level::addAllPendingTileEntities( std::vector >& entities) { EnterCriticalSection(&m_tileEntityListCS); if (updatingTileEntities) { - for (AUTO_VAR(it, entities.begin()); it != entities.end(); it++) { + for (auto it = entities.begin(); it != entities.end(); it++) { pendingTileEntities.push_back(*it); } } else { - for (AUTO_VAR(it, entities.begin()); it != entities.end(); it++) { + for (auto it = entities.begin(); it != entities.end(); it++) { tileEntityList.push_back(*it); } } @@ -2333,8 +2333,8 @@ bool Level::isUnobstructed(AABB* aabb) { return isUnobstructed(aabb, nullptr); } bool Level::isUnobstructed(AABB* aabb, std::shared_ptr ignore) { std::vector >* ents = getEntities(nullptr, aabb); - AUTO_VAR(itEnd, ents->end()); - for (AUTO_VAR(it, ents->begin()); it != itEnd; it++) { + auto itEnd = ents->end(); + for (auto it = ents->begin(); it != itEnd; it++) { std::shared_ptr e = *it; if (!e->removed && e->blocksBuilding && e != ignore) return false; } @@ -2635,7 +2635,7 @@ std::shared_ptr Level::getTileEntity(int x, int y, int z) { if (tileEntity == NULL) { EnterCriticalSection(&m_tileEntityListCS); - for (AUTO_VAR(it, pendingTileEntities.begin()); + for (auto it = pendingTileEntities.begin(); it != pendingTileEntities.end(); it++) { std::shared_ptr e = *it; @@ -2659,7 +2659,7 @@ void Level::setTileEntity(int x, int y, int z, tileEntity->z = z; // avoid adding duplicates - for (AUTO_VAR(it, pendingTileEntities.begin()); + for (auto it = pendingTileEntities.begin(); it != pendingTileEntities.end();) { std::shared_ptr next = *it; if (next->x == x && next->y == y && next->z == z) { @@ -2686,20 +2686,20 @@ void Level::removeTileEntity(int x, int y, int z) { std::shared_ptr te = getTileEntity(x, y, z); if (te != NULL && updatingTileEntities) { te->setRemoved(); - AUTO_VAR(it, find(pendingTileEntities.begin(), - pendingTileEntities.end(), te)); + auto it = find(pendingTileEntities.begin(), + pendingTileEntities.end(), te); if (it != pendingTileEntities.end()) { pendingTileEntities.erase(it); } } else { if (te != NULL) { - AUTO_VAR(it, find(pendingTileEntities.begin(), - pendingTileEntities.end(), te)); + auto it = find(pendingTileEntities.begin(), + pendingTileEntities.end(), te); if (it != pendingTileEntities.end()) { pendingTileEntities.erase(it); } - AUTO_VAR(it2, - find(tileEntityList.begin(), tileEntityList.end(), te)); + auto it2 = + find(tileEntityList.begin(), tileEntityList.end(), te); if (it2 != tileEntityList.end()) { tileEntityList.erase(it2); } @@ -3410,7 +3410,7 @@ std::shared_ptr Level::getClosestEntityOfClass( std::shared_ptr closest = nullptr; double closestDistSqr = std::numeric_limits::max(); // for (Entity entity : entities) - for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { + for (auto it = entities->begin(); it != entities->end(); ++it) { std::shared_ptr entity = *it; if (entity == source) continue; double distSqr = source->distanceToSqr(entity); @@ -3448,8 +3448,8 @@ unsigned int Level::countInstanceOf( if (protectedCount) *protectedCount = 0; if (couldWanderCount) *couldWanderCount = 0; EnterCriticalSection(&m_entitiesCS); - AUTO_VAR(itEnd, entities.end()); - for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { + auto itEnd = entities.end(); + for (auto it = entities.begin(); it != itEnd; it++) { std::shared_ptr e = *it; // entities.at(i); if (singleType) { if (e->GetType() == clas) { @@ -3476,8 +3476,8 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, int range, int x, int y, int z) { unsigned int count = 0; EnterCriticalSection(&m_entitiesCS); - AUTO_VAR(itEnd, entities.end()); - for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) { + auto itEnd = entities.end(); + for (auto it = entities.begin(); it != itEnd; it++) { std::shared_ptr e = *it; // entities.at(i); float sd = e->distanceTo(x, y, z); @@ -3502,9 +3502,9 @@ void Level::addEntities(std::vector >* list) { // entities.addAll(list); EnterCriticalSection(&m_entitiesCS); entities.insert(entities.end(), list->begin(), list->end()); - AUTO_VAR(itEnd, list->end()); + auto itEnd = list->end(); bool deleteDragons = false; - for (AUTO_VAR(it, list->begin()); it != itEnd; it++) { + for (auto it = list->begin(); it != itEnd; it++) { entityAdded(*it); // 4J Stu - Special change to remove duplicate enderdragons that a @@ -3516,7 +3516,7 @@ void Level::addEntities(std::vector >* list) { if (deleteDragons) { deleteDragons = false; - for (AUTO_VAR(it, entities.begin()); it != entities.end(); ++it) { + for (auto it = entities.begin(); it != entities.end(); ++it) { // 4J Stu - Special change to remove duplicate enderdragons that a // previous bug might have produced if ((*it)->GetType() == eTYPE_ENDERDRAGON) { @@ -3682,8 +3682,8 @@ std::shared_ptr Level::getNearestPlayer(double x, double y, double z, MemSect(21); double best = -1; std::shared_ptr result = nullptr; - AUTO_VAR(itEnd, players.end()); - for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { + auto itEnd = players.end(); + for (auto it = players.begin(); it != itEnd; it++) { std::shared_ptr p = *it; // players.at(i); double dist = p->distanceToSqr(x, y, z); @@ -3705,8 +3705,8 @@ std::shared_ptr Level::getNearestPlayer(double x, double z, double maxDist) { double best = -1; std::shared_ptr result = nullptr; - AUTO_VAR(itEnd, players.end()); - for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { + auto itEnd = players.end(); + for (auto it = players.begin(); it != itEnd; it++) { std::shared_ptr p = *it; double dist = p->distanceToSqr(x, p->y, z); if ((maxDist < 0 || dist < maxDist * maxDist) && @@ -3729,8 +3729,8 @@ std::shared_ptr Level::getNearestAttackablePlayer(double x, double y, double best = -1; std::shared_ptr result = nullptr; - AUTO_VAR(itEnd, players.end()); - for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { + auto itEnd = players.end(); + for (auto it = players.begin(); it != itEnd; it++) { std::shared_ptr p = *it; // 4J Stu - Added privilege check @@ -3765,8 +3765,8 @@ std::shared_ptr Level::getNearestAttackablePlayer(double x, double y, } std::shared_ptr Level::getPlayerByName(const std::wstring& name) { - AUTO_VAR(itEnd, players.end()); - for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { + auto itEnd = players.end(); + for (auto it = players.begin(); it != itEnd; it++) { if (name.compare((*it)->getName()) == 0) { return *it; // players.at(i); } @@ -3775,8 +3775,8 @@ std::shared_ptr Level::getPlayerByName(const std::wstring& name) { } std::shared_ptr Level::getPlayerByUUID(const std::wstring& name) { - AUTO_VAR(itEnd, players.end()); - for (AUTO_VAR(it, players.begin()); it != itEnd; it++) { + auto itEnd = players.end(); + for (auto it = players.begin(); it != itEnd; it++) { if (name.compare((*it)->getUUID()) == 0) { return *it; // players.at(i); } @@ -3900,7 +3900,7 @@ void Level::setGameTime(int64_t time) { // Apply stat to each player. if (timeDiff > 0 && levelData->getGameTime() != -1) { - AUTO_VAR(itEnd, players.end()); + auto itEnd = players.end(); for (std::vector >::iterator it = players.begin(); it != itEnd; it++) { @@ -4028,8 +4028,8 @@ int Level::getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, void Level::globalLevelEvent(int type, int sourceX, int sourceY, int sourceZ, int data) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->globalLevelEvent(type, sourceX, sourceY, sourceZ, data); } } @@ -4040,8 +4040,8 @@ void Level::levelEvent(int type, int x, int y, int z, int data) { void Level::levelEvent(std::shared_ptr source, int type, int x, int y, int z, int data) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->levelEvent(source, type, x, y, z, data); } } @@ -4078,8 +4078,8 @@ double Level::getHorizonHeight() { } void Level::destroyTileProgress(int id, int x, int y, int z, int progress) { - AUTO_VAR(itEnd, listeners.end()); - for (AUTO_VAR(it, listeners.begin()); it != itEnd; it++) { + auto itEnd = listeners.end(); + for (auto it = listeners.begin(); it != itEnd; it++) { (*it)->destroyTileProgress(id, x, y, z, progress); } } diff --git a/Minecraft.World/Level/LevelChunk.cpp b/Minecraft.World/Level/LevelChunk.cpp index ce4fc5acf..4e10429af 100644 --- a/Minecraft.World/Level/LevelChunk.cpp +++ b/Minecraft.World/Level/LevelChunk.cpp @@ -1218,7 +1218,7 @@ void LevelChunk::removeEntity(std::shared_ptr e, int yc) { #endif // 4J - was entityBlocks[yc]->remove(e); - AUTO_VAR(it, find(entityBlocks[yc]->begin(), entityBlocks[yc]->end(), e)); + auto it = find(entityBlocks[yc]->begin(), entityBlocks[yc]->end(), e); if (it != entityBlocks[yc]->end()) { entityBlocks[yc]->erase(it); // 4J - we don't want storage creeping up here as thinkgs move round the @@ -1258,7 +1258,7 @@ std::shared_ptr LevelChunk::getTileEntity(int x, int y, int z) { // shared_ptr tileEntity = tileEntities[pos]; EnterCriticalSection(&m_csTileEntities); std::shared_ptr tileEntity = nullptr; - AUTO_VAR(it, tileEntities.find(pos)); + auto it = tileEntities.find(pos); if (it == tileEntities.end()) { LeaveCriticalSection( @@ -1290,7 +1290,7 @@ std::shared_ptr LevelChunk::getTileEntity(int x, int y, int z) { // 4J Stu - It should have been inserted by now, but check to be sure EnterCriticalSection(&m_csTileEntities); - AUTO_VAR(newIt, tileEntities.find(pos)); + auto newIt = tileEntities.find(pos); if (newIt != tileEntities.end()) { tileEntity = newIt->second; } @@ -1340,7 +1340,7 @@ void LevelChunk::setTileEntity(int x, int y, int z, "tile!\n"); return; } - AUTO_VAR(it, tileEntities.find(pos)); + auto it = tileEntities.find(pos); if (it != tileEntities.end()) it->second->setRemoved(); tileEntity->clearRemoved(); @@ -1360,7 +1360,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z) { // removeThis.setRemoved(); // } EnterCriticalSection(&m_csTileEntities); - AUTO_VAR(it, tileEntities.find(pos)); + auto it = tileEntities.find(pos); if (it != tileEntities.end()) { std::shared_ptr te = tileEntities[pos]; tileEntities.erase(pos); @@ -1418,7 +1418,7 @@ void LevelChunk::load() { std::vector > values; EnterCriticalSection(&m_csTileEntities); - for (AUTO_VAR(it, tileEntities.begin()); it != tileEntities.end(); + for (auto it = tileEntities.begin(); it != tileEntities.end(); it++) { values.push_back(it->second); } @@ -1451,14 +1451,14 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter if (unloadTileEntities) { std::vector > tileEntitiesToRemove; EnterCriticalSection(&m_csTileEntities); - for (AUTO_VAR(it, tileEntities.begin()); it != tileEntities.end(); + for (auto it = tileEntities.begin(); it != tileEntities.end(); it++) { tileEntitiesToRemove.push_back(it->second); } LeaveCriticalSection(&m_csTileEntities); - AUTO_VAR(itEnd, tileEntitiesToRemove.end()); - for (AUTO_VAR(it, tileEntitiesToRemove.begin()); it != itEnd; it++) { + auto itEnd = tileEntitiesToRemove.end(); + for (auto it = tileEntitiesToRemove.begin(); it != itEnd; it++) { // 4J-PB -m 1.7.3 was it->second->setRemoved(); level->markForRemoval(*it); } @@ -1494,7 +1494,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter EnterCriticalSection(&m_csEntities); for (int i = 0; i < ENTITY_BLOCKS_LENGTH; i++) { - AUTO_VAR(itEnd, entityBlocks[i]->end()); + auto itEnd = entityBlocks[i]->end(); for (std::vector >::iterator it = entityBlocks[i]->begin(); it != itEnd; it++) { @@ -1516,7 +1516,7 @@ void LevelChunk::unload(bool unloadTileEntities) // 4J - added parameter PIXBeginNamedEvent(0, "Saving tile entities"); ListTag* tileEntityTags = new ListTag(); - AUTO_VAR(itEnd, tileEntities.end()); + auto itEnd = tileEntities.end(); for (std::unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = tileEntities.begin(); @@ -1583,8 +1583,8 @@ void LevelChunk::getEntities(std::shared_ptr except, AABB* bb, for (int yc = yc0; yc <= yc1; yc++) { std::vector >* entities = entityBlocks[yc]; - AUTO_VAR(itEnd, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { + auto itEnd = entities->end(); + for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // entities->at(i); if (e != except && e->bb.intersects(*bb) && (selector == NULL || selector->matches(e))) { @@ -1629,8 +1629,8 @@ void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb, for (int yc = yc0; yc <= yc1; yc++) { std::vector >* entities = entityBlocks[yc]; - AUTO_VAR(itEnd, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { + auto itEnd = entities->end(); + for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // entities->at(i); bool isAssignableFrom = false; @@ -1929,7 +1929,7 @@ int LevelChunk::setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, } */ - for (AUTO_VAR(it, tileEntities.begin()); it != tileEntities.end(); ++it) { + for (auto it = tileEntities.begin(); it != tileEntities.end(); ++it) { it->second->clearCache(); } // recalcHeightmap(); diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp index ed9ed16f2..e3fc2c5f3 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp @@ -117,7 +117,7 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int& id, int centreX, int64_t index = (((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | (((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ((scale & 0x7) << 2) | (dimension & 0x3); - AUTO_VAR(it, m_mappings.find(index)); + auto it = m_mappings.find(index); if (it != m_mappings.end()) { id = it->second; // app.DebugPrintf("Found mapping: %d - (%d,%d)/%d/%d [%I64d - @@ -133,7 +133,7 @@ bool DirectoryLevelStorage::PlayerMappings::getMapping(int& id, int centreX, void DirectoryLevelStorage::PlayerMappings::writeMappings( DataOutputStream* dos) { dos->writeInt(m_mappings.size()); - for (AUTO_VAR(it, m_mappings.begin()); it != m_mappings.end(); ++it) { + for (auto it = m_mappings.begin(); it != m_mappings.end(); ++it) { app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", it->first, it->first, it->second); dos->writeLong(it->first); @@ -172,7 +172,7 @@ DirectoryLevelStorage::DirectoryLevelStorage(ConsoleSaveFile* saveFile, DirectoryLevelStorage::~DirectoryLevelStorage() { delete m_saveFile; - for (AUTO_VAR(it, m_cachedSaveData.begin()); it != m_cachedSaveData.end(); + for (auto it = m_cachedSaveData.begin(); it != m_cachedSaveData.end(); ++it) { delete it->second; } @@ -371,7 +371,7 @@ void DirectoryLevelStorage::save(std::shared_ptr player) { ByteArrayOutputStream* bos = new ByteArrayOutputStream(); NbtIo::writeCompressed(tag, bos); - AUTO_VAR(it, m_cachedSaveData.find(realFile.getName())); + auto it = m_cachedSaveData.find(realFile.getName()); if (it != m_cachedSaveData.end()) { delete it->second; } @@ -404,7 +404,7 @@ CompoundTag* DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) { // 4J Jev, removed try/catch. ConsoleSavePath realFile = ConsoleSavePath(playerDir.getName() + _toString(xuid) + L".dat"); - AUTO_VAR(it, m_cachedSaveData.find(realFile.getName())); + auto it = m_cachedSaveData.find(realFile.getName()); if (it != m_cachedSaveData.end()) { ByteArrayOutputStream* bos = it->second; ByteArrayInputStream bis(bos->buf, 0, bos->size()); @@ -497,7 +497,7 @@ void DirectoryLevelStorage::resetNetherPlayerPositions() { m_saveFile->getFilesWithPrefix(playerDir.getName()); if (playerFiles != NULL) { - for (AUTO_VAR(it, playerFiles->begin()); it != playerFiles->end(); + for (auto it = playerFiles->begin(); it != playerFiles->end(); ++it) { FileEntry* realFile = *it; ConsoleSaveFileInputStream fis = @@ -535,7 +535,7 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension, bool foundMapping = false; #if defined(_LARGE_WORLDS) - AUTO_VAR(it, m_playerMappings.find(xuid)); + auto it = m_playerMappings.find(xuid); if (it != m_playerMappings.end()) { foundMapping = it->second.getMapping(mapId, centreXC, centreZC, dimension, scale); @@ -580,8 +580,8 @@ int DirectoryLevelStorage::getAuxValueForMap(PlayerUID xuid, int dimension, ConsoleSavePath file = getDataFile(id); if (m_saveFile->doesFileExist(file)) { - AUTO_VAR(it, find(m_mapFilesToDelete.begin(), - m_mapFilesToDelete.end(), mapId)); + auto it = find(m_mapFilesToDelete.begin(), + m_mapFilesToDelete.end(), mapId); if (it != m_mapFilesToDelete.end()) m_mapFilesToDelete.erase(it); m_saveFile->deleteFile(m_saveFile->createFile(file)); @@ -610,7 +610,7 @@ void DirectoryLevelStorage::saveMapIdLookup() { DataOutputStream dos(&baos); dos.writeInt(m_playerMappings.size()); app.DebugPrintf("Saving %d mappings\n", m_playerMappings.size()); - for (AUTO_VAR(it, m_playerMappings.begin()); + for (auto it = m_playerMappings.begin(); it != m_playerMappings.end(); ++it) { #if defined(_WINDOWS64) || defined(__linux__) app.DebugPrintf(" -- %d\n", it->first); @@ -644,9 +644,9 @@ void DirectoryLevelStorage::saveMapIdLookup() { void DirectoryLevelStorage::dontSaveMapMappingForPlayer(PlayerUID xuid) { #if defined(_LARGE_WORLDS) - AUTO_VAR(it, m_playerMappings.find(xuid)); + auto it = m_playerMappings.find(xuid); if (it != m_playerMappings.end()) { - for (AUTO_VAR(itMap, it->second.m_mappings.begin()); + for (auto itMap = it->second.m_mappings.begin(); itMap != it->second.m_mappings.end(); ++itMap) { int index = itMap->second / 8; int offset = itMap->second % 8; @@ -671,9 +671,9 @@ void DirectoryLevelStorage::deleteMapFilesForPlayer( void DirectoryLevelStorage::deleteMapFilesForPlayer(PlayerUID xuid) { #if defined(_LARGE_WORLDS) - AUTO_VAR(it, m_playerMappings.find(xuid)); + auto it = m_playerMappings.find(xuid); if (it != m_playerMappings.end()) { - for (AUTO_VAR(itMap, it->second.m_mappings.begin()); + for (auto itMap = it->second.m_mappings.begin(); itMap != it->second.m_mappings.end(); ++itMap) { std::wstring id = std::wstring(L"map_") + _toString(itMap->second); ConsoleSavePath file = getDataFile(id); @@ -722,7 +722,7 @@ void DirectoryLevelStorage::saveAllCachedData() { if (StorageManager.GetSaveDisabled()) return; // Save any files that were saved while saving was disabled - for (AUTO_VAR(it, m_cachedSaveData.begin()); it != m_cachedSaveData.end(); + for (auto it = m_cachedSaveData.begin(); it != m_cachedSaveData.end(); ++it) { ByteArrayOutputStream* bos = it->second; @@ -737,7 +737,7 @@ void DirectoryLevelStorage::saveAllCachedData() { } m_cachedSaveData.clear(); - for (AUTO_VAR(it, m_mapFilesToDelete.begin()); + for (auto it = m_mapFilesToDelete.begin(); it != m_mapFilesToDelete.end(); ++it) { std::wstring id = std::wstring(L"map_") + _toString(*it); ConsoleSavePath file = getDataFile(id); diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp index 4f1e54619..a77073ca4 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorageSource.cpp @@ -86,8 +86,8 @@ void DirectoryLevelStorageSource::deleteLevel(const std::wstring& levelId) { } void DirectoryLevelStorageSource::deleteRecursive(std::vector* files) { - AUTO_VAR(itEnd, files->end()); - for (AUTO_VAR(it, files->begin()); it != itEnd; it++) { + auto itEnd = files->end(); + for (auto it = files->begin(); it != itEnd; it++) { File* file = *it; if (file->isDirectory()) { deleteRecursive(file->listFiles()); diff --git a/Minecraft.World/Level/Storage/EntityIO.cpp b/Minecraft.World/Level/Storage/EntityIO.cpp index ab377ff89..313045b63 100644 --- a/Minecraft.World/Level/Storage/EntityIO.cpp +++ b/Minecraft.World/Level/Storage/EntityIO.cpp @@ -231,7 +231,7 @@ std::shared_ptr EntityIO::newEntity(const std::wstring& id, Level* level) { std::shared_ptr entity; - AUTO_VAR(it, idCreateMap->find(id)); + auto it = idCreateMap->find(id); if (it != idCreateMap->end()) { entityCreateFn create = it->second; if (create != NULL) entity = std::shared_ptr(create(level)); @@ -265,7 +265,7 @@ std::shared_ptr EntityIO::loadStatic(CompoundTag* tag, Level* level) { tag->remove(L"Type"); } - AUTO_VAR(it, idCreateMap->find(tag->getString(L"id"))); + auto it = idCreateMap->find(tag->getString(L"id")); if (it != idCreateMap->end()) { entityCreateFn create = it->second; if (create != NULL) entity = std::shared_ptr(create(level)); @@ -289,7 +289,7 @@ std::shared_ptr EntityIO::loadStatic(CompoundTag* tag, Level* level) { std::shared_ptr EntityIO::newById(int id, Level* level) { std::shared_ptr entity; - AUTO_VAR(it, numCreateMap->find(id)); + auto it = numCreateMap->find(id); if (it != numCreateMap->end()) { entityCreateFn create = it->second; if (create != NULL) entity = std::shared_ptr(create(level)); @@ -314,7 +314,7 @@ std::shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, eINSTANCEOFKeyEq>::iterator it = classNumMap->find(eType); if (it != classNumMap->end()) { - AUTO_VAR(it2, numCreateMap->find(it->second)); + auto it2 = numCreateMap->find(it->second); if (it2 != numCreateMap->end()) { entityCreateFn create = it2->second; if (create != NULL) entity = std::shared_ptr(create(level)); @@ -346,7 +346,7 @@ std::wstring EntityIO::getEncodeId(std::shared_ptr entity) { } int EntityIO::getId(const std::wstring& encodeId) { - AUTO_VAR(it, idNumMap->find(encodeId)); + auto it = idNumMap->find(encodeId); if (it == idNumMap->end()) { // defaults to pig... return 90; @@ -361,7 +361,7 @@ std::wstring EntityIO::getEncodeId(int entityIoValue) { // return classIdMap.get(class1); // } - AUTO_VAR(it, numClassMap->find(entityIoValue)); + auto it = numClassMap->find(entityIoValue); if (it != numClassMap->end()) { std::unordered_map::iterator classIdIt = @@ -378,7 +378,7 @@ std::wstring EntityIO::getEncodeId(int entityIoValue) { int EntityIO::getNameId(int entityIoValue) { int id = -1; - AUTO_VAR(it, idsSpawnableInCreative.find(entityIoValue)); + auto it = idsSpawnableInCreative.find(entityIoValue); if (it != idsSpawnableInCreative.end()) { id = it->second->nameId; } @@ -387,7 +387,7 @@ int EntityIO::getNameId(int entityIoValue) { } eINSTANCEOF EntityIO::getType(const std::wstring& idString) { - AUTO_VAR(it, numClassMap->find(getId(idString))); + auto it = numClassMap->find(getId(idString)); if (it != numClassMap->end()) { return it->second; } @@ -395,7 +395,7 @@ eINSTANCEOF EntityIO::getType(const std::wstring& idString) { } eINSTANCEOF EntityIO::getClass(int id) { - AUTO_VAR(it, numClassMap->find(id)); + auto it = numClassMap->find(id); if (it != numClassMap->end()) { return it->second; } diff --git a/Minecraft.World/Level/Storage/MapItemSavedData.cpp b/Minecraft.World/Level/Storage/MapItemSavedData.cpp index 4b5eb99f0..801bdf354 100644 --- a/Minecraft.World/Level/Storage/MapItemSavedData.cpp +++ b/Minecraft.World/Level/Storage/MapItemSavedData.cpp @@ -89,7 +89,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket( data[i * DEC_PACKET_BYTES + 7] |= md->visible ? 0x80 : 0x0; } unsigned int dataIndex = playerDecorationsSize; - for (AUTO_VAR(it, parent->nonPlayerDecorations.begin()); + for (auto it = parent->nonPlayerDecorations.begin(); it != parent->nonPlayerDecorations.end(); ++it) { MapDecoration* md = it->second; #if defined(_LARGE_WORLDS) @@ -238,7 +238,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, // 4J Stu - Put this block back in if you want to display entity positions // on a map (see below) bool addedPlayers = false; - for (AUTO_VAR(it, carriedBy.begin()); it != carriedBy.end();) { + for (auto it = carriedBy.begin(); it != carriedBy.end();) { std::shared_ptr hp = *it; // 4J Stu - Players in the same dimension as an item frame with a map @@ -246,8 +246,8 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, if (hp->player->removed) //|| (!hp->player->inventory->contains(item) //&& !item->isFramed() )) { - AUTO_VAR(it2, carriedByPlayers.find( - (std::shared_ptr)hp->player)); + auto it2 = carriedByPlayers.find( + (std::shared_ptr)hp->player); if (it2 != carriedByPlayers.end()) { carriedByPlayers.erase(it2); } @@ -262,7 +262,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, bool atLeastOnePlayerInTheEnd = false; PlayerList* players = MinecraftServer::getInstance()->getPlayerList(); - for (AUTO_VAR(it3, players->players.begin()); + for (auto it3 = players->players.begin(); it3 != players->players.end(); ++it3) { std::shared_ptr serverPlayer = *it3; if (serverPlayer->dimension == 1) { @@ -271,8 +271,8 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, } } - AUTO_VAR(currentPortalDecoration, - nonPlayerDecorations.find(END_PORTAL_DECORATION_KEY)); + auto currentPortalDecoration = + nonPlayerDecorations.find(END_PORTAL_DECORATION_KEY); if (currentPortalDecoration == nonPlayerDecorations.end() && atLeastOnePlayerInTheEnd) { float origX = 0.0f; @@ -367,7 +367,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, PlayerList* players = MinecraftServer::getInstance()->getPlayerList(); - for (AUTO_VAR(it3, players->players.begin()); + for (auto it3 = players->players.begin(); it3 != players->players.end(); ++it3) { std::shared_ptr decorationPlayer = *it3; if (decorationPlayer != NULL && @@ -465,7 +465,7 @@ void MapItemSavedData::tickCarriedBy(std::shared_ptr player, charArray MapItemSavedData::getUpdatePacket( std::shared_ptr itemInstance, Level* level, std::shared_ptr player) { - AUTO_VAR(it, carriedByPlayers.find(player)); + auto it = carriedByPlayers.find(player); if (it == carriedByPlayers.end()) return charArray(); std::shared_ptr hp = it->second; @@ -475,8 +475,8 @@ charArray MapItemSavedData::getUpdatePacket( void MapItemSavedData::setDirty(int x, int y0, int y1) { SavedData::setDirty(); - AUTO_VAR(itEnd, carriedBy.end()); - for (AUTO_VAR(it, carriedBy.begin()); it != itEnd; it++) { + auto itEnd = carriedBy.end(); + for (auto it = carriedBy.begin(); it != itEnd; it++) { std::shared_ptr hp = *it; // carriedBy.at(i); if (hp->rowsDirtyMin[x] < 0 || hp->rowsDirtyMin[x] > y0) hp->rowsDirtyMin[x] = y0; @@ -529,7 +529,7 @@ void MapItemSavedData::handleComplexItemData(charArray& data) { std::shared_ptr MapItemSavedData::getHoldingPlayer(std::shared_ptr player) { std::shared_ptr hp = nullptr; - AUTO_VAR(it, carriedByPlayers.find(player)); + auto it = carriedByPlayers.find(player); if (it == carriedByPlayers.end()) { hp = std::shared_ptr(new HoldingPlayer(player, this)); @@ -572,8 +572,8 @@ void MapItemSavedData::mergeInMapData( void MapItemSavedData::removeItemFrameDecoration( std::shared_ptr item) { - AUTO_VAR(frameDecoration, - nonPlayerDecorations.find(item->getFrame()->entityId)); + auto frameDecoration = + nonPlayerDecorations.find(item->getFrame()->entityId); if (frameDecoration != nonPlayerDecorations.end()) { delete frameDecoration->second; nonPlayerDecorations.erase(frameDecoration); diff --git a/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp b/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp index c8ddae142..b6a789fc2 100644 --- a/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp @@ -67,7 +67,7 @@ McRegionChunkStorage::McRegionChunkStorage(ConsoleSaveFile* saveFile, } McRegionChunkStorage::~McRegionChunkStorage() { - for (AUTO_VAR(it, m_entityData.begin()); it != m_entityData.end(); ++it) { + for (auto it = m_entityData.begin(); it != m_entityData.end(); ++it) { delete it->second.data; } } @@ -85,7 +85,7 @@ LevelChunk* McRegionChunkStorage::load(Level* level, int x, int z) { uint64_t index = ((uint64_t)(uint32_t)(x) << 32) | (((uint64_t)(uint32_t)(z))); - AUTO_VAR(it, m_entityData.find(index)); + auto it = m_entityData.find(index); if (it != m_entityData.end()) { delete it->second.data; m_entityData.erase(it); @@ -268,7 +268,7 @@ void McRegionChunkStorage::saveEntities(Level* level, LevelChunk* levelChunk) { m_entityData[index] = savedData; } else { - AUTO_VAR(it, m_entityData.find(index)); + auto it = m_entityData.find(index); if (it != m_entityData.end()) { m_entityData.erase(it); } @@ -283,7 +283,7 @@ void McRegionChunkStorage::loadEntities(Level* level, LevelChunk* levelChunk) { int64_t index = ((int64_t)(levelChunk->x) << 32) | (((int64_t)(levelChunk->z)) & 0x00000000FFFFFFFF); - AUTO_VAR(it, m_entityData.find(index)); + auto it = m_entityData.find(index); if (it != m_entityData.end()) { ByteArrayInputStream bais(it->second); DataInputStream dis(&bais); @@ -310,7 +310,7 @@ void McRegionChunkStorage::flush() { PIXBeginNamedEvent(0, "Writing to stream"); dos.writeInt(m_entityData.size()); - for (AUTO_VAR(it, m_entityData.begin()); it != m_entityData.end(); ++it) { + for (auto it = m_entityData.begin(); it != m_entityData.end(); ++it) { dos.writeLong(it->first); dos.write(it->second, 0, it->second.length); } diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp index 6fdbad8fc..82890db12 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorage.cpp @@ -31,7 +31,7 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { m_saveFile->getRegionFilesByDimension(1); if (netherFiles != NULL) { DWORD bytesWritten = 0; - for (AUTO_VAR(it, netherFiles->begin()); + for (auto it = netherFiles->begin(); it != netherFiles->end(); ++it) { m_saveFile->zeroFile(*it, (*it)->getFileSize(), &bytesWritten); @@ -42,7 +42,7 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { std::vector* netherFiles = m_saveFile->getFilesWithPrefix(LevelStorage::NETHER_FOLDER); if (netherFiles != NULL) { - for (AUTO_VAR(it, netherFiles->begin()); + for (auto it = netherFiles->begin(); it != netherFiles->end(); ++it) { m_saveFile->deleteFile(*it); } @@ -78,7 +78,7 @@ ChunkStorage* McRegionLevelStorage::createChunkStorage(Dimension* dimension) { // 4J-PB - There will be no End in early saves if (endFiles != NULL) { - for (AUTO_VAR(it, endFiles->begin()); it != endFiles->end(); + for (auto it = endFiles->begin(); it != endFiles->end(); ++it) { m_saveFile->deleteFile(*it); } diff --git a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp index 204a45823..d3c8a7ddb 100644 --- a/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp +++ b/Minecraft.World/Level/Storage/McRegionLevelStorageSource.cpp @@ -85,8 +85,8 @@ void McRegionLevelStorageSource::eraseFolders(std::vector* folders, int currentCount, int totalCount, ProgressListener* progress) { File* folder; - AUTO_VAR(itEnd, folders->end()); - for (AUTO_VAR(it, folders->begin()); it != itEnd; it++) { + auto itEnd = folders->end(); + for (auto it = folders->begin(); it != itEnd; it++) { folder = *it; // folders->at(i); std::vector* files = folder->listFiles(); diff --git a/Minecraft.World/Level/Storage/OldChunkStorage.cpp b/Minecraft.World/Level/Storage/OldChunkStorage.cpp index 496caeea7..e13c2abe7 100644 --- a/Minecraft.World/Level/Storage/OldChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/OldChunkStorage.cpp @@ -202,7 +202,7 @@ bool OldChunkStorage::saveEntities(LevelChunk* lc, Level* level, EnterCriticalSection(&lc->m_csEntities); #endif for (int i = 0; i < lc->ENTITY_BLOCKS_LENGTH; i++) { - AUTO_VAR(itEnd, lc->entityBlocks[i]->end()); + auto itEnd = lc->entityBlocks[i]->end(); for (std::vector >::iterator it = lc->entityBlocks[i]->begin(); it != itEnd; it++) { @@ -259,7 +259,7 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, PIXBeginNamedEvent(0, "Saving tile entities"); ListTag* tileEntityTags = new ListTag(); - AUTO_VAR(itEnd, lc->tileEntities.end()); + auto itEnd = lc->tileEntities.end(); for (std::unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); @@ -357,7 +357,7 @@ void OldChunkStorage::save(LevelChunk* lc, Level* level, CompoundTag* tag) { PIXBeginNamedEvent(0, "Saving tile entities"); ListTag* tileEntityTags = new ListTag(); - AUTO_VAR(itEnd, lc->tileEntities.end()); + auto itEnd = lc->tileEntities.end(); for (std::unordered_map, TilePosKeyHash, TilePosKeyEq>::iterator it = lc->tileEntities.begin(); diff --git a/Minecraft.World/Level/Storage/PortalForcer.cpp b/Minecraft.World/Level/Storage/PortalForcer.cpp index 85d813ef3..ed2850d83 100644 --- a/Minecraft.World/Level/Storage/PortalForcer.cpp +++ b/Minecraft.World/Level/Storage/PortalForcer.cpp @@ -17,7 +17,7 @@ PortalForcer::PortalForcer(ServerLevel* level) { } PortalForcer::~PortalForcer() { - for (AUTO_VAR(it, cachedPortals.begin()); it != cachedPortals.end(); ++it) { + for (auto it = cachedPortals.begin(); it != cachedPortals.end(); ++it) { delete it->second; } } @@ -83,7 +83,7 @@ bool PortalForcer::findPortal(std::shared_ptr e, double xOriginal, long hash = ChunkPos::hashCode(xc, zc); bool updateCache = true; - AUTO_VAR(it, cachedPortals.find(hash)); + auto it = cachedPortals.find(hash); if (it != cachedPortals.end()) { PortalPosition* pos = it->second; @@ -478,7 +478,7 @@ void PortalForcer::tick(int64_t time) { if (time % (SharedConstants::TICKS_PER_SECOND * 5) == 0) { int64_t cutoff = time - SharedConstants::TICKS_PER_SECOND * 30; - for (AUTO_VAR(it, cachedPortalKeys.begin()); + for (auto it = cachedPortalKeys.begin(); it != cachedPortalKeys.end();) { int64_t key = *it; PortalPosition* pos = cachedPortals[key]; diff --git a/Minecraft.World/Level/Storage/RegionFileCache.cpp b/Minecraft.World/Level/Storage/RegionFileCache.cpp index 357eeaa3a..b5728486b 100644 --- a/Minecraft.World/Level/Storage/RegionFileCache.cpp +++ b/Minecraft.World/Level/Storage/RegionFileCache.cpp @@ -39,7 +39,7 @@ RegionFile* RegionFileCache::_getRegionFile( MemSect(0); RegionFile* ref = NULL; - AUTO_VAR(it, cache.find(file)); + auto it = cache.find(file); if (it != cache.end()) ref = it->second; // 4J Jev, put back in. @@ -65,8 +65,8 @@ if (!regionDir.exists()) void RegionFileCache::_clear() // 4J - TODO was synchronized { - AUTO_VAR(itEnd, cache.end()); - for (AUTO_VAR(it, cache.begin()); it != itEnd; it++) { + auto itEnd = cache.end(); + for (auto it = cache.begin(); it != itEnd; it++) { // 4J - removed try/catch // try { RegionFile* regionFile = it->second; diff --git a/Minecraft.World/Level/Storage/SavedDataStorage.cpp b/Minecraft.World/Level/Storage/SavedDataStorage.cpp index 3490d30f7..da84b0a5a 100644 --- a/Minecraft.World/Level/Storage/SavedDataStorage.cpp +++ b/Minecraft.World/Level/Storage/SavedDataStorage.cpp @@ -21,7 +21,7 @@ SavedDataStorage::SavedDataStorage(LevelStorage* levelStorage) { std::shared_ptr SavedDataStorage::get(const std::type_info& clazz, const std::wstring& id) { - AUTO_VAR(it, cache.find(id)); + auto it = cache.find(id); if (it != cache.end()) return (*it).second; std::shared_ptr data = nullptr; @@ -76,9 +76,9 @@ void SavedDataStorage::set(const std::wstring& id, // TODO 4J Stu - throw new RuntimeException("Can't set null data"); assert(false); } - AUTO_VAR(it, cache.find(id)); + auto it = cache.find(id); if (it != cache.end()) { - AUTO_VAR(it2, find(savedDatas.begin(), savedDatas.end(), it->second)); + auto it2 = find(savedDatas.begin(), savedDatas.end(), it->second); if (it2 != savedDatas.end()) { savedDatas.erase(it2); } @@ -89,8 +89,8 @@ void SavedDataStorage::set(const std::wstring& id, } void SavedDataStorage::save() { - AUTO_VAR(itEnd, savedDatas.end()); - for (AUTO_VAR(it, savedDatas.begin()); it != itEnd; it++) { + auto itEnd = savedDatas.end(); + for (auto it = savedDatas.begin(); it != itEnd; it++) { std::shared_ptr data = *it; // savedDatas->at(i); if (data->isDirty()) { save(data); @@ -135,8 +135,8 @@ void SavedDataStorage::loadAuxValues() { Tag* tag; std::vector* allTags = tags->getAllTags(); - AUTO_VAR(itEnd, allTags->end()); - for (AUTO_VAR(it, allTags->begin()); it != itEnd; it++) { + auto itEnd = allTags->end(); + for (auto it = allTags->begin(); it != itEnd; it++) { tag = *it; // tags->getAllTags()->at(i); if (dynamic_cast(tag) != NULL) { @@ -151,7 +151,7 @@ void SavedDataStorage::loadAuxValues() { } int SavedDataStorage::getFreeAuxValueFor(const std::wstring& id) { - AUTO_VAR(it, usedAuxIds.find(id)); + auto it = usedAuxIds.find(id); short val = 0; if (it != usedAuxIds.end()) { val = (*it).second; @@ -167,7 +167,7 @@ int SavedDataStorage::getFreeAuxValueFor(const std::wstring& id) { // TODO 4J Stu - This was iterating over the keySet in Java, so // potentially we are looking at more items? - AUTO_VAR(itEndAuxIds, usedAuxIds.end()); + auto itEndAuxIds = usedAuxIds.end(); for (uaiMapType::iterator it2 = usedAuxIds.begin(); it2 != itEndAuxIds; it2++) { short value = it2->second; diff --git a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp index fcdc90cd2..45fff1ac8 100644 --- a/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/ZonedChunkStorage.cpp @@ -146,7 +146,7 @@ void ZonedChunkStorage::tick() { if (tickCount % (20 * 10) == 4) { std::vector toClose; - AUTO_VAR(itEndZF, zoneFiles.end()); + auto itEndZF = zoneFiles.end(); for (std::unordered_map::iterator it = zoneFiles.begin(); it != itEndZF; it++) { @@ -156,8 +156,8 @@ void ZonedChunkStorage::tick() { } } - AUTO_VAR(itEndTC, toClose.end()); - for (AUTO_VAR(it, toClose.begin()); it != itEndTC; it++) { + auto itEndTC = toClose.end(); + for (auto it = toClose.begin(); it != itEndTC; it++) { int64_t key = *it; // toClose[i]; // 4J - removed try/catch // try { @@ -174,7 +174,7 @@ void ZonedChunkStorage::tick() { } void ZonedChunkStorage::flush() { - AUTO_VAR(itEnd, zoneFiles.end()); + auto itEnd = zoneFiles.end(); for (std::unordered_map::iterator it = zoneFiles.begin(); it != itEnd; it++) { @@ -194,8 +194,8 @@ void ZonedChunkStorage::loadEntities(Level* level, LevelChunk* lc) { ZoneFile* zoneFile = getZoneFile(lc->x, lc->z, true); std::vector* tags = zoneFile->entityFile->readAll(slot); - AUTO_VAR(itEnd, tags->end()); - for (AUTO_VAR(it, tags->begin()); it != itEnd; it++) { + auto itEnd = tags->end(); + for (auto it = tags->begin(); it != itEnd; it++) { CompoundTag* tag = *it; // tags->at(i); int type = tag->getInt(L"_TYPE"); if (type == 0) { @@ -222,8 +222,8 @@ void ZonedChunkStorage::saveEntities(Level* level, LevelChunk* lc) { for (int i = 0; i < LevelChunk::ENTITY_BLOCKS_LENGTH; i++) { std::vector >* entities = lc->entityBlocks[i]; - AUTO_VAR(itEndTags, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEndTags; it++) { + auto itEndTags = entities->end(); + for (auto it = entities->begin(); it != itEndTags; it++) { std::shared_ptr e = *it; // entities->at(j); CompoundTag* cp = new CompoundTag(); cp->putInt(L"_TYPE", 0); diff --git a/Minecraft.World/Network/Packets/ExplodePacket.cpp b/Minecraft.World/Network/Packets/ExplodePacket.cpp index d636edd13..770b30382 100644 --- a/Minecraft.World/Network/Packets/ExplodePacket.cpp +++ b/Minecraft.World/Network/Packets/ExplodePacket.cpp @@ -28,7 +28,7 @@ ExplodePacket::ExplodePacket( if (toBlow != NULL) { this->toBlow.assign(toBlow->begin(), toBlow->end()); - // for( AUTO_VAR(it, toBlow->begin()); it != toBlow->end(); it++ ) + // for( auto it = toBlow->begin(); it != toBlow->end(); it++ ) //{ // this->toBlow.push_back(*it); // } @@ -86,7 +86,7 @@ void ExplodePacket::write(DataOutputStream* dos) // throws IOException //(Myset::const_iterator it = c1.begin(); // it != c1.end(); ++it) - for (AUTO_VAR(it, toBlow.begin()); it != toBlow.end(); it++) { + for (auto it = toBlow.begin(); it != toBlow.end(); it++) { TilePos tp = *it; int xx = tp.x - xp; diff --git a/Minecraft.World/Network/Packets/Packet.cpp b/Minecraft.World/Network/Packets/Packet.cpp index 276cdd8a2..70e97b47d 100644 --- a/Minecraft.World/Network/Packets/Packet.cpp +++ b/Minecraft.World/Network/Packets/Packet.cpp @@ -320,7 +320,7 @@ void Packet::recordOutgoingPacket(std::shared_ptr packet, if (packet->getId() != 51) { idx = 100; } - AUTO_VAR(it, outgoingStatistics.find(idx)); + auto it = outgoingStatistics.find(idx); if (it == outgoingStatistics.end()) { Packet::PacketStatistics* packetStatistics = new PacketStatistics(idx); @@ -337,7 +337,7 @@ void Packet::updatePacketStatsPIX() { #if !defined(_CONTENT_PACKAGE) #if PACKET_ENABLE_STAT_TRACKING - for (AUTO_VAR(it, outgoingStatistics.begin()); + for (auto it = outgoingStatistics.begin(); it != outgoingStatistics.end(); it++) { Packet::PacketStatistics* stat = it->second; int64_t count = stat->getRunningCount(); @@ -444,7 +444,7 @@ std::shared_ptr Packet::readPacket( // with what we have #if !defined(_CONTENT_PACKAGE) #if PACKET_ENABLE_STAT_TRACKING - AUTO_VAR(it, statistics.find(id)); + auto it = statistics.find(id); if (it == statistics.end()) { Packet::PacketStatistics* packetStatistics = new PacketStatistics(id); diff --git a/Minecraft.World/Network/Packets/SetPlayerTeamPacket.cpp b/Minecraft.World/Network/Packets/SetPlayerTeamPacket.cpp index 2c7afe20c..260dc2f1c 100644 --- a/Minecraft.World/Network/Packets/SetPlayerTeamPacket.cpp +++ b/Minecraft.World/Network/Packets/SetPlayerTeamPacket.cpp @@ -87,7 +87,7 @@ void SetPlayerTeamPacket::write(DataOutputStream* dos) { method == METHOD_LEAVE) { dos->writeShort(players.size()); - for (AUTO_VAR(it, players.begin()); it != players.end(); ++it) { + for (auto it = players.begin(); it != players.end(); ++it) { writeUtf(*it, dos); } } diff --git a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp index 4d94ba74c..6c1a1d446 100644 --- a/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/Network/Packets/TextureAndGeometryPacket.cpp @@ -65,7 +65,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket( std::vector* pSkinBoxes = pDLCSkinFile->getAdditionalBoxes(); int iCount = 0; - for (AUTO_VAR(it, pSkinBoxes->begin()); it != pSkinBoxes->end(); ++it) { + for (auto it = pSkinBoxes->begin(); it != pSkinBoxes->end(); ++it) { SKIN_BOX* pSkinBox = *it; this->BoxDataA[iCount++] = *pSkinBox; } @@ -98,7 +98,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket( this->BoxDataA = new SKIN_BOX[this->dwBoxC]; int iCount = 0; - for (AUTO_VAR(it, pvSkinBoxes->begin()); it != pvSkinBoxes->end(); + for (auto it = pvSkinBoxes->begin(); it != pvSkinBoxes->end(); ++it) { SKIN_BOX* pSkinBox = *it; this->BoxDataA[iCount++] = *pSkinBox; diff --git a/Minecraft.World/Network/Packets/UpdateAttributesPacket.cpp b/Minecraft.World/Network/Packets/UpdateAttributesPacket.cpp index ce74bc798..8d99bc087 100644 --- a/Minecraft.World/Network/Packets/UpdateAttributesPacket.cpp +++ b/Minecraft.World/Network/Packets/UpdateAttributesPacket.cpp @@ -10,7 +10,7 @@ UpdateAttributesPacket::UpdateAttributesPacket( int entityId, std::unordered_set* values) { this->entityId = entityId; - for (AUTO_VAR(it, values->begin()); it != values->end(); ++it) { + for (auto it = values->begin(); it != values->end(); ++it) { AttributeInstance* value = *it; std::unordered_set mods; value->getModifiers(mods); @@ -22,7 +22,7 @@ UpdateAttributesPacket::UpdateAttributesPacket( UpdateAttributesPacket::~UpdateAttributesPacket() { // Delete modifiers - these are always copies, either on construction or on // read - for (AUTO_VAR(it, attributes.begin()); it != attributes.end(); ++it) { + for (auto it = attributes.begin(); it != attributes.end(); ++it) { delete (*it); } } @@ -50,7 +50,7 @@ void UpdateAttributesPacket::read(DataInputStream* dis) { attributes.insert(new AttributeSnapshot(id, base, &modifiers)); // modifiers is copied in AttributeSnapshot ctor so delete contents - for (AUTO_VAR(it, modifiers.begin()); it != modifiers.end(); ++it) { + for (auto it = modifiers.begin(); it != modifiers.end(); ++it) { delete *it; } } @@ -60,7 +60,7 @@ void UpdateAttributesPacket::write(DataOutputStream* dos) { dos->writeInt(entityId); dos->writeInt(attributes.size()); - for (AUTO_VAR(it, attributes.begin()); it != attributes.end(); ++it) { + for (auto it = attributes.begin(); it != attributes.end(); ++it) { AttributeSnapshot* attribute = (*it); std::unordered_set* modifiers = @@ -70,7 +70,7 @@ void UpdateAttributesPacket::write(DataOutputStream* dos) { dos->writeDouble(attribute->getBase()); dos->writeShort(modifiers->size()); - for (AUTO_VAR(it2, modifiers->begin()); it2 != modifiers->end(); + for (auto it2 = modifiers->begin(); it2 != modifiers->end(); ++it2) { AttributeModifier* modifier = (*it2); dos->writeInt(modifier->getId()); @@ -101,14 +101,14 @@ UpdateAttributesPacket::AttributeSnapshot::AttributeSnapshot( this->id = id; this->base = base; - for (AUTO_VAR(it, modifiers->begin()); it != modifiers->end(); ++it) { + for (auto it = modifiers->begin(); it != modifiers->end(); ++it) { this->modifiers.insert(new AttributeModifier( (*it)->getId(), (*it)->getAmount(), (*it)->getOperation())); } } UpdateAttributesPacket::AttributeSnapshot::~AttributeSnapshot() { - for (AUTO_VAR(it, modifiers.begin()); it != modifiers.end(); ++it) { + for (auto it = modifiers.begin(); it != modifiers.end(); ++it) { delete (*it); } } diff --git a/Minecraft.World/Platform/stdafx.h b/Minecraft.World/Platform/stdafx.h index 254beb01f..22011f618 100644 --- a/Minecraft.World/Platform/stdafx.h +++ b/Minecraft.World/Platform/stdafx.h @@ -4,8 +4,6 @@ // #pragma once -#define AUTO_VAR(_var, _val) auto _var = _val - #ifdef _WINDOWS64 typedef unsigned __int64 __uint64; #endif diff --git a/Minecraft.World/Player/Player.cpp b/Minecraft.World/Player/Player.cpp index 131db939e..f9bbac324 100644 --- a/Minecraft.World/Player/Player.cpp +++ b/Minecraft.World/Player/Player.cpp @@ -861,8 +861,8 @@ void Player::aiStep() { std::vector >* entities = level->getEntities(shared_from_this(), &pickupArea); if (entities != NULL) { - AUTO_VAR(itEnd, entities->end()); - for (AUTO_VAR(it, entities->begin()); it != itEnd; it++) { + auto itEnd = entities->end(); + for (auto it = entities->begin(); it != itEnd; it++) { std::shared_ptr e = *it; // entities->at(i); if (!e->removed) { touch(e); @@ -925,7 +925,7 @@ void Player::awardKillScore(std::shared_ptr victim, int awardPoints) { // } if (objectives) { - for (AUTO_VAR(it, objectives->begin()); it != objectives->end(); ++it) { + for (auto it = objectives->begin(); it != objectives->end(); ++it) { Objective* objective = *it; Score* score = getScoreboard()->getPlayerScore(getAName(), objective); diff --git a/Minecraft.World/Recipes/FurnaceRecipes.cpp b/Minecraft.World/Recipes/FurnaceRecipes.cpp index eaa5e9e7e..825afd926 100644 --- a/Minecraft.World/Recipes/FurnaceRecipes.cpp +++ b/Minecraft.World/Recipes/FurnaceRecipes.cpp @@ -58,12 +58,12 @@ void FurnaceRecipes::addFurnaceRecipy(int itemId, ItemInstance* result, } bool FurnaceRecipes::isFurnaceItem(int itemId) { - AUTO_VAR(it, recipies.find(itemId)); + auto it = recipies.find(itemId); return it != recipies.end(); } ItemInstance* FurnaceRecipes::getResult(int itemId) { - AUTO_VAR(it, recipies.find(itemId)); + auto it = recipies.find(itemId); if (it != recipies.end()) { return it->second; } @@ -75,7 +75,7 @@ std::unordered_map* FurnaceRecipes::getRecipies() { } float FurnaceRecipes::getRecipeValue(int itemId) { - AUTO_VAR(it, recipeValue.find(itemId)); + auto it = recipeValue.find(itemId); if (it != recipeValue.end()) { return it->second; } diff --git a/Minecraft.World/Recipes/Recipes.cpp b/Minecraft.World/Recipes/Recipes.cpp index de4235894..ca34b1e02 100644 --- a/Minecraft.World/Recipes/Recipes.cpp +++ b/Minecraft.World/Recipes/Recipes.cpp @@ -1160,8 +1160,8 @@ std::shared_ptr Recipes::getItemFor( if (recipesClass->matches(craftSlots, level)) return recipesClass->assemble(craftSlots); } else { - AUTO_VAR(itEnd, recipies->end()); - for (AUTO_VAR(it, recipies->begin()); it != itEnd; it++) { + auto itEnd = recipies->end(); + for (auto it = recipies->begin(); it != itEnd; it++) { Recipy* r = *it; // recipies->at(i); if (r->matches(craftSlots, level)) return r->assemble(craftSlots); } @@ -1185,8 +1185,8 @@ void Recipes::buildRecipeIngredientsArray(void) { m_pRecipeIngredientsRequired = new Recipy::INGREDIENTS_REQUIRED[iRecipeC]; int iCount = 0; - AUTO_VAR(itEndRec, recipies->end()); - for (AUTO_VAR(it, recipies->begin()); it != itEndRec; it++) { + auto itEndRec = recipies->end(); + for (auto it = recipies->begin(); it != itEndRec; it++) { Recipy* recipe = *it; // wprintf(L"RECIPE - [%d] is // %w\n",iCount,recipe->getResultItem()->getItem()->getName()); diff --git a/Minecraft.World/Recipes/ShapelessRecipy.cpp b/Minecraft.World/Recipes/ShapelessRecipy.cpp index d8e436bf1..a2df9ac38 100644 --- a/Minecraft.World/Recipes/ShapelessRecipy.cpp +++ b/Minecraft.World/Recipes/ShapelessRecipy.cpp @@ -32,16 +32,16 @@ bool ShapelessRecipy::matches(std::shared_ptr craftSlots, if (item != NULL) { bool found = false; - AUTO_VAR(citEnd, ingredients->end()); - for (AUTO_VAR(cit, ingredients->begin()); cit != citEnd; + auto citEnd = ingredients->end(); + for (auto cit = ingredients->begin(); cit != citEnd; ++cit) { ItemInstance* ingredient = *cit; if (item->id == ingredient->id && (ingredient->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == ingredient->getAuxValue())) { found = true; - AUTO_VAR(it, find(tempList.begin(), tempList.end(), - ingredient)); + auto it = find(tempList.begin(), tempList.end(), + ingredient); if (it != tempList.end()) tempList.erase(it); break; } @@ -72,7 +72,7 @@ bool ShapelessRecipy::requiresRecipe(int iRecipe) { // printf("ShapelessRecipy %d\n",iRecipe); - AUTO_VAR(citEnd, ingredients->end()); + auto citEnd = ingredients->end(); int iCount = 0; for (std::vector::iterator ingredient = ingredients->begin(); ingredient != citEnd; ingredient++) { @@ -107,7 +107,7 @@ void ShapelessRecipy::collectRequirements(INGREDIENTS_REQUIRED* pIngReq) { memset(TempIngReq.iIngAuxValA, Recipes::ANY_AUX_VALUE, sizeof(int) * 9); ZeroMemory(TempIngReq.uiGridA, sizeof(unsigned int) * 9); - AUTO_VAR(citEnd, ingredients->end()); + auto citEnd = ingredients->end(); for (std::vector::const_iterator ingredient = ingredients->begin(); diff --git a/Minecraft.World/Scores/Criteria/HealthCriteria.cpp b/Minecraft.World/Scores/Criteria/HealthCriteria.cpp index 3b5fa6120..e8791fd30 100644 --- a/Minecraft.World/Scores/Criteria/HealthCriteria.cpp +++ b/Minecraft.World/Scores/Criteria/HealthCriteria.cpp @@ -8,7 +8,7 @@ int HealthCriteria::getScoreModifier( std::vector >* players) { float health = 0; - for (AUTO_VAR(it, players->begin()); it != players->end(); ++it) { + for (auto it = players->begin(); it != players->end(); ++it) { std::shared_ptr player = *it; health += player->getHealth() + player->getAbsorptionAmount(); } diff --git a/Minecraft.World/Util/Class.h b/Minecraft.World/Util/Class.h index 072b1c4be..752050ba3 100644 --- a/Minecraft.World/Util/Class.h +++ b/Minecraft.World/Util/Class.h @@ -379,7 +379,7 @@ public: m_parents.push_back(id); - for (AUTO_VAR(itr, parent->m_parents.begin()); + for (auto itr = parent->m_parents.begin(); itr != parent->m_parents.end(); itr++) { m_parents.push_back(*itr); } diff --git a/Minecraft.World/Util/CombatTracker.cpp b/Minecraft.World/Util/CombatTracker.cpp index 80b0a3072..d6044d765 100644 --- a/Minecraft.World/Util/CombatTracker.cpp +++ b/Minecraft.World/Util/CombatTracker.cpp @@ -9,7 +9,7 @@ CombatTracker::CombatTracker(LivingEntity* mob) { this->mob = mob; } CombatTracker::~CombatTracker() { - for (AUTO_VAR(it, entries.begin()); it != entries.end(); ++it) { + for (auto it = entries.begin(); it != entries.end(); ++it) { delete (*it); } } @@ -143,7 +143,7 @@ std::shared_ptr CombatTracker::getKiller() { float bestMobDamage = 0; float bestPlayerDamage = 0; - for (AUTO_VAR(it, entries.begin()); it != entries.end(); ++it) { + for (auto it = entries.begin(); it != entries.end(); ++it) { CombatEntry* entry = *it; if (entry->getSource() != NULL && entry->getSource()->getEntity() != NULL && @@ -232,7 +232,7 @@ void CombatTracker::recheckStatus() { int reset = inCombat ? RESET_COMBAT_STATUS_TIME : RESET_DAMAGE_STATUS_TIME; if (takingDamage && mob->tickCount - lastDamageTime > reset) { - for (AUTO_VAR(it, entries.begin()); it != entries.end(); ++it) { + for (auto it = entries.begin(); it != entries.end(); ++it) { delete (*it); } entries.clear(); diff --git a/Minecraft.World/Util/WeighedRandom.cpp b/Minecraft.World/Util/WeighedRandom.cpp index 47f61897d..6be241dec 100644 --- a/Minecraft.World/Util/WeighedRandom.cpp +++ b/Minecraft.World/Util/WeighedRandom.cpp @@ -3,7 +3,7 @@ int WeighedRandom::getTotalWeight(std::vector* items) { int totalWeight = 0; - for (AUTO_VAR(it, items->begin()); it != items->end(); it++) { + for (auto it = items->begin(); it != items->end(); it++) { totalWeight += (*it)->randomWeight; } return totalWeight; @@ -17,7 +17,7 @@ WeighedRandomItem* WeighedRandom::getRandomItem( int selection = random->nextInt(totalWeight); - for (AUTO_VAR(it, items->begin()); it != items->end(); it++) { + for (auto it = items->begin(); it != items->end(); it++) { selection -= (*it)->randomWeight; if (selection < 0) { return *it; diff --git a/Minecraft.World/WorldGen/Biomes/BiomeCache.cpp b/Minecraft.World/WorldGen/Biomes/BiomeCache.cpp index bc4f1109c..b580e33fe 100644 --- a/Minecraft.World/WorldGen/Biomes/BiomeCache.cpp +++ b/Minecraft.World/WorldGen/Biomes/BiomeCache.cpp @@ -75,7 +75,7 @@ BiomeCache::~BiomeCache() { // 4J Stu - Delete source? // delete source; - for (AUTO_VAR(it, all.begin()); it != all.end(); ++it) { + for (auto it = all.begin(); it != all.end(); ++it) { delete (*it); } DeleteCriticalSection(&m_CS); @@ -87,7 +87,7 @@ BiomeCache::Block* BiomeCache::getBlockAt(int x, int z) { z >>= ZONE_SIZE_BITS; int64_t slot = (((int64_t)x) & 0xffffffffl) | ((((int64_t)z) & 0xffffffffl) << 32l); - AUTO_VAR(it, cached.find(slot)); + auto it = cached.find(slot); Block* block = NULL; if (it == cached.end()) { MemSect(48); @@ -122,7 +122,7 @@ void BiomeCache::update() { if (utime > DECAY_TIME / 4 || utime < 0) { lastUpdateTime = now; - for (AUTO_VAR(it, all.begin()); it != all.end();) { + for (auto it = all.begin(); it != all.end();) { Block* block = *it; int64_t time = now - block->lastUse; if (time > DECAY_TIME || time < 0) { diff --git a/Minecraft.World/WorldGen/Features/CaveFeature.cpp b/Minecraft.World/WorldGen/Features/CaveFeature.cpp index ecdce794c..58a1752ec 100644 --- a/Minecraft.World/WorldGen/Features/CaveFeature.cpp +++ b/Minecraft.World/WorldGen/Features/CaveFeature.cpp @@ -74,14 +74,14 @@ bool CaveFeature::place(Level* level, Random* random, int x, int y, int z) { } } - AUTO_VAR(itEnd, toRemove.end()); - for (AUTO_VAR(it, toRemove.begin()); it != itEnd; it++) { + auto itEnd = toRemove.end(); + for (auto it = toRemove.begin(); it != itEnd; it++) { TilePos* p = *it; // toRemove[i]; level->setTileAndData(p->x, p->y, p->z, 0, 0, Tile::UPDATE_CLIENTS); } itEnd = toRemove.end(); - for (AUTO_VAR(it, toRemove.begin()); it != itEnd; it++) { + for (auto it = toRemove.begin(); it != itEnd; it++) { TilePos* p = *it; // toRemove[i]; if (level->getTile(p->x, p->y - 1, p->z) == Tile::dirt_Id && level->getDaytimeRawBrightness(p->x, p->y, p->z) > 8) { diff --git a/Minecraft.World/WorldGen/Features/MineShaftFeature.cpp b/Minecraft.World/WorldGen/Features/MineShaftFeature.cpp index f8287e4e2..a496fa701 100644 --- a/Minecraft.World/WorldGen/Features/MineShaftFeature.cpp +++ b/Minecraft.World/WorldGen/Features/MineShaftFeature.cpp @@ -13,7 +13,7 @@ MineShaftFeature::MineShaftFeature( std::unordered_map options) { chance = 0.01; - for (AUTO_VAR(it, options.begin()); it != options.end(); ++it) { + for (auto it = options.begin(); it != options.end(); ++it) { if (it->first.compare(OPTION_CHANCE) == 0) { chance = Mth::getDouble(it->second, chance); } diff --git a/Minecraft.World/WorldGen/Features/NetherBridgeFeature.cpp b/Minecraft.World/WorldGen/Features/NetherBridgeFeature.cpp index 468a96df9..6e5eeee26 100644 --- a/Minecraft.World/WorldGen/Features/NetherBridgeFeature.cpp +++ b/Minecraft.World/WorldGen/Features/NetherBridgeFeature.cpp @@ -110,7 +110,7 @@ NetherBridgeFeature::NetherBridgeStart::NetherBridgeStart(Level* level, std::vector* pendingChildren = &start->pendingChildren; while (!pendingChildren->empty()) { int pos = random->nextInt((int)pendingChildren->size()); - AUTO_VAR(it, pendingChildren->begin() + pos); + auto it = pendingChildren->begin() + pos; StructurePiece* structurePiece = *it; pendingChildren->erase(it); structurePiece->addChildren(start, &pieces, random); diff --git a/Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp b/Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp index afc1599fd..8000542eb 100644 --- a/Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp +++ b/Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp @@ -29,7 +29,7 @@ RandomScatteredLargeFeature::RandomScatteredLargeFeature( std::unordered_map options) { _init(); - for (AUTO_VAR(it, options.begin()); it != options.end(); ++it) { + for (auto it = options.begin(); it != options.end(); ++it) { if (it->first.compare(OPTION_SPACING) == 0) { spacing = Mth::getInt(it->second, spacing, minSeparation + 1); } @@ -67,7 +67,7 @@ bool RandomScatteredLargeFeature::isFeatureChunk(int x, int z, (x == xCenterFeatureChunk && z == zCenterFeatureChunk)) { Biome* biome = level->getBiomeSource()->getBiome(x * 16 + 8, z * 16 + 8); - for (AUTO_VAR(it, allowedBiomes.begin()); it != allowedBiomes.end(); + for (auto it = allowedBiomes.begin(); it != allowedBiomes.end(); ++it) { Biome* a = *it; if (biome == a) { @@ -120,7 +120,7 @@ bool RandomScatteredLargeFeature::isSwamphut(int cellX, int cellY, int cellZ) { return false; } StructurePiece* first = NULL; - AUTO_VAR(it, structureAt->pieces.begin()); + auto it = structureAt->pieces.begin(); if (it != structureAt->pieces.end()) first = *it; return dynamic_cast(first) != NULL; } diff --git a/Minecraft.World/WorldGen/Features/StrongholdFeature.cpp b/Minecraft.World/WorldGen/Features/StrongholdFeature.cpp index 60cbf19b5..64a125aef 100644 --- a/Minecraft.World/WorldGen/Features/StrongholdFeature.cpp +++ b/Minecraft.World/WorldGen/Features/StrongholdFeature.cpp @@ -47,7 +47,7 @@ StrongholdFeature::StrongholdFeature( std::unordered_map options) { _init(); - for (AUTO_VAR(it, options.begin()); it != options.end(); ++it) { + for (auto it = options.begin(); it != options.end(); ++it) { if (it->first.compare(OPTION_DISTANCE) == 0) { distance = Mth::getDouble(it->second, distance, 1); } else if (it->first.compare(OPTION_COUNT) == 0) { @@ -248,7 +248,7 @@ StrongholdFeature::StrongholdStart::StrongholdStart(Level* level, std::vector* pendingChildren = &startRoom->pendingChildren; while (!pendingChildren->empty()) { int pos = random->nextInt((int)pendingChildren->size()); - AUTO_VAR(it, pendingChildren->begin() + pos); + auto it = pendingChildren->begin() + pos; StructurePiece* structurePiece = *it; pendingChildren->erase(it); structurePiece->addChildren(startRoom, &pieces, random); diff --git a/Minecraft.World/WorldGen/Features/StructureFeature.cpp b/Minecraft.World/WorldGen/Features/StructureFeature.cpp index 5599c2705..f32e3a772 100644 --- a/Minecraft.World/WorldGen/Features/StructureFeature.cpp +++ b/Minecraft.World/WorldGen/Features/StructureFeature.cpp @@ -14,7 +14,7 @@ StructureFeature::StructureFeature() { } StructureFeature::~StructureFeature() { - for (AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); + for (auto it = cachedStructures.begin(); it != cachedStructures.end(); it++) { delete it->second; } @@ -62,7 +62,7 @@ bool StructureFeature::postProcess(Level* level, Random* random, int chunkX, int cz = ((unsigned)chunkZ << 4); // + 8; bool intersection = false; - for (AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); + for (auto it = cachedStructures.begin(); it != cachedStructures.end(); it++) { StructureStart* structureStart = it->second; @@ -88,13 +88,13 @@ bool StructureFeature::postProcess(Level* level, Random* random, int chunkX, bool StructureFeature::isIntersection(int cellX, int cellZ) { restoreSavedData(level); - for (AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); + for (auto it = cachedStructures.begin(); it != cachedStructures.end(); it++) { StructureStart* structureStart = it->second; if (structureStart->isValid()) { if (structureStart->getBoundingBox()->intersects(cellX, cellZ, cellX, cellZ)) { - AUTO_VAR(it2, structureStart->getPieces()->begin()); + auto it2 = structureStart->getPieces()->begin(); while (it2 != structureStart->getPieces()->end()) { StructurePiece* next = *it2++; if (next->getBoundingBox()->intersects(cellX, cellZ, cellX, @@ -116,7 +116,7 @@ bool StructureFeature::isInsideFeature(int cellX, int cellY, int cellZ) { StructureStart* StructureFeature::getStructureAt(int cellX, int cellY, int cellZ) { // for (StructureStart structureStart : cachedStructures.values()) - for (AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); + for (auto it = cachedStructures.begin(); it != cachedStructures.end(); ++it) { StructureStart* pStructureStart = it->second; @@ -134,7 +134,7 @@ StructureStart* StructureFeature::getStructureAt(int cellX, int cellY, std::list* pieces = pStructureStart->getPieces(); - for (AUTO_VAR(it2, pieces->begin()); it2 != pieces->end(); + for (auto it2 = pieces->begin(); it2 != pieces->end(); it2++) { StructurePiece* piece = *it2; if (piece->getBoundingBox()->isInside(cellX, cellY, @@ -152,7 +152,7 @@ bool StructureFeature::isInsideBoundingFeature(int cellX, int cellY, int cellZ) { restoreSavedData(level); - for (AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); + for (auto it = cachedStructures.begin(); it != cachedStructures.end(); ++it) { StructureStart* structureStart = it->second; if (structureStart->isValid()) { @@ -183,7 +183,7 @@ TilePos* StructureFeature::getNearestGeneratedFeature(Level* level, int cellX, double minDistance = DBL_MAX; TilePos* selected = NULL; - for (AUTO_VAR(it, cachedStructures.begin()); it != cachedStructures.end(); + for (auto it = cachedStructures.begin(); it != cachedStructures.end(); ++it) { StructureStart* pStructureStart = it->second; @@ -213,7 +213,7 @@ TilePos* StructureFeature::getNearestGeneratedFeature(Level* level, int cellX, if (guesstimatedFeaturePositions != NULL) { TilePos* pSelectedPos = new TilePos(0, 0, 0); - for (AUTO_VAR(it, guesstimatedFeaturePositions->begin()); + for (auto it = guesstimatedFeaturePositions->begin(); it != guesstimatedFeaturePositions->end(); ++it) { int dx = (*it).x - cellX; int dy = (*it).y - cellY; @@ -253,7 +253,7 @@ void StructureFeature::restoreSavedData(Level* level) { CompoundTag* fullTag = savedData->getFullTag(); std::vector* allTags = fullTag->getAllTags(); - for (AUTO_VAR(it, allTags->begin()); it != allTags->end(); ++it) { + for (auto it = allTags->begin(); it != allTags->end(); ++it) { Tag* featureTag = *it; if (featureTag->getId() == Tag::TAG_Compound) { CompoundTag* ct = (CompoundTag*)featureTag; diff --git a/Minecraft.World/WorldGen/Features/VillageFeature.cpp b/Minecraft.World/WorldGen/Features/VillageFeature.cpp index 7987c0216..3f6947b83 100644 --- a/Minecraft.World/WorldGen/Features/VillageFeature.cpp +++ b/Minecraft.World/WorldGen/Features/VillageFeature.cpp @@ -29,7 +29,7 @@ VillageFeature::VillageFeature( std::unordered_map options, int iXZSize) { _init(iXZSize); - for (AUTO_VAR(it, options.begin()); it != options.end(); ++it) { + for (auto it = options.begin(); it != options.end(); ++it) { if (it->first.compare(OPTION_SIZE_MODIFIER) == 0) { villageSizeModifier = Mth::getInt(it->second, villageSizeModifier, 0); @@ -126,13 +126,13 @@ VillageFeature::VillageStart::VillageStart(Level* level, Random* random, // prioritize roads if (pendingRoads->empty()) { int pos = random->nextInt((int)pendingHouses->size()); - AUTO_VAR(it, pendingHouses->begin() + pos); + auto it = pendingHouses->begin() + pos; StructurePiece* structurePiece = *it; pendingHouses->erase(it); structurePiece->addChildren(startRoom, &pieces, random); } else { int pos = random->nextInt((int)pendingRoads->size()); - AUTO_VAR(it, pendingRoads->begin() + pos); + auto it = pendingRoads->begin() + pos; StructurePiece* structurePiece = *it; pendingRoads->erase(it); structurePiece->addChildren(startRoom, &pieces, random); @@ -142,7 +142,7 @@ VillageFeature::VillageStart::VillageStart(Level* level, Random* random, calculateBoundingBox(); int count = 0; - for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) { + for (auto it = pieces.begin(); it != pieces.end(); it++) { StructurePiece* piece = *it; if (dynamic_cast(piece) == NULL) { count++; diff --git a/Minecraft.World/WorldGen/Flat/FlatGeneratorInfo.cpp b/Minecraft.World/WorldGen/Flat/FlatGeneratorInfo.cpp index cfc889433..02c84a0d3 100644 --- a/Minecraft.World/WorldGen/Flat/FlatGeneratorInfo.cpp +++ b/Minecraft.World/WorldGen/Flat/FlatGeneratorInfo.cpp @@ -17,7 +17,7 @@ const std::wstring FlatGeneratorInfo::STRUCTURE_DUNGEON = L"dungeon"; FlatGeneratorInfo::FlatGeneratorInfo() { biome = 0; } FlatGeneratorInfo::~FlatGeneratorInfo() { - for (AUTO_VAR(it, layers.begin()); it != layers.end(); ++it) { + for (auto it = layers.begin(); it != layers.end(); ++it) { delete *it; } } @@ -37,7 +37,7 @@ std::vector* FlatGeneratorInfo::getLayers() { return &layers; } void FlatGeneratorInfo::updateLayers() { int y = 0; - for (AUTO_VAR(it, layers.begin()); it != layers.end(); ++it) { + for (auto it = layers.begin(); it != layers.end(); ++it) { FlatLayerInfo* layer = *it; layer->setStart(y); y += layer->getHeight(); @@ -62,7 +62,7 @@ std::vector* FlatGeneratorInfo::getLayersFromString( int yOffset = 0; - for (AUTO_VAR(it, depths.begin()); it != depths.end(); ++it) { + for (auto it = depths.begin(); it != depths.end(); ++it) { FlatLayerInfo* layer = getLayerFromString(*it, yOffset); if (layer == NULL) return NULL; result->push_back(layer); diff --git a/Minecraft.World/WorldGen/StructureFeatureIO.cpp b/Minecraft.World/WorldGen/StructureFeatureIO.cpp index 9e91abe94..9c4ace1b6 100644 --- a/Minecraft.World/WorldGen/StructureFeatureIO.cpp +++ b/Minecraft.World/WorldGen/StructureFeatureIO.cpp @@ -47,7 +47,7 @@ void StructureFeatureIO::staticCtor() { } std::wstring StructureFeatureIO::getEncodeId(StructureStart* start) { - AUTO_VAR(it, startClassIdMap.find(start->GetType())); + auto it = startClassIdMap.find(start->GetType()); if (it != startClassIdMap.end()) { return it->second; } else { @@ -56,7 +56,7 @@ std::wstring StructureFeatureIO::getEncodeId(StructureStart* start) { } std::wstring StructureFeatureIO::getEncodeId(StructurePiece* piece) { - AUTO_VAR(it, pieceClassIdMap.find(piece->GetType())); + auto it = pieceClassIdMap.find(piece->GetType()); if (it != pieceClassIdMap.end()) { return it->second; } else { @@ -68,7 +68,7 @@ StructureStart* StructureFeatureIO::loadStaticStart(CompoundTag* tag, Level* level) { StructureStart* start = NULL; - AUTO_VAR(it, startIdClassMap.find(tag->getString(L"id"))); + auto it = startIdClassMap.find(tag->getString(L"id")); if (it != startIdClassMap.end()) { start = (it->second)(); } @@ -86,7 +86,7 @@ StructurePiece* StructureFeatureIO::loadStaticPiece(CompoundTag* tag, Level* level) { StructurePiece* piece = NULL; - AUTO_VAR(it, pieceIdClassMap.find(tag->getString(L"id"))); + auto it = pieceIdClassMap.find(tag->getString(L"id")); if (it != pieceIdClassMap.end()) { piece = (it->second)(); } diff --git a/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp b/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp index 53b5b6cdd..d4259d13c 100644 --- a/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp +++ b/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp @@ -113,7 +113,7 @@ MineShaftPieces::MineShaftRoom::MineShaftRoom(int genDepth, Random* random, } MineShaftPieces::MineShaftRoom::~MineShaftRoom() { - for (AUTO_VAR(it, childEntranceBoxes.begin()); + for (auto it = childEntranceBoxes.begin(); it != childEntranceBoxes.end(); ++it) { delete (*it); } @@ -225,7 +225,7 @@ bool MineShaftPieces::MineShaftRoom::postProcess(Level* level, Random* random, boundingBox->z0, boundingBox->x1, std::min(boundingBox->y0 + 3, boundingBox->y1), boundingBox->z1, 0, 0, false); - for (AUTO_VAR(it, childEntranceBoxes.begin()); + for (auto it = childEntranceBoxes.begin(); it != childEntranceBoxes.end(); ++it) { BoundingBox* entranceBox = *it; generateBox(level, chunkBB, entranceBox->x0, @@ -242,7 +242,7 @@ bool MineShaftPieces::MineShaftRoom::postProcess(Level* level, Random* random, void MineShaftPieces::MineShaftRoom::addAdditonalSaveData(CompoundTag* tag) { ListTag* entrances = new ListTag(L"Entrances"); - for (AUTO_VAR(it, childEntranceBoxes.begin()); + for (auto it = childEntranceBoxes.begin(); it != childEntranceBoxes.end(); ++it) { BoundingBox* bb = *it; entrances->add(bb->createTag(L"")); diff --git a/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp b/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp index 450100a37..73f4e5294 100644 --- a/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp +++ b/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp @@ -185,7 +185,7 @@ int NetherBridgePieces::NetherBridgePiece::updatePieceWeight( std::list* currentPieces) { bool hasAnyPieces = false; int totalWeight = 0; - for (AUTO_VAR(it, currentPieces->begin()); it != currentPieces->end(); + for (auto it = currentPieces->begin(); it != currentPieces->end(); it++) { PieceWeight* piece = *it; @@ -212,7 +212,7 @@ NetherBridgePieces::NetherBridgePiece::generatePiece( numAttempts++; int weightSelection = random->nextInt(totalWeight); - for (AUTO_VAR(it, currentPieces->begin()); it != currentPieces->end(); + for (auto it = currentPieces->begin(); it != currentPieces->end(); it++) { PieceWeight* piece = *it; weightSelection -= piece->weight; diff --git a/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp b/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp index 51af77a16..9e9bd8444 100644 --- a/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp +++ b/Minecraft.World/WorldGen/Structures/StrongholdPieces.cpp @@ -62,7 +62,7 @@ bool StrongholdPieces::PieceWeight::isValid() { } void StrongholdPieces::resetPieces() { - for (AUTO_VAR(it, currentPieces.begin()); it != currentPieces.end(); it++) { + for (auto it = currentPieces.begin(); it != currentPieces.end(); it++) { delete (*it); } currentPieces.clear(); @@ -88,7 +88,7 @@ void StrongholdPieces::resetPieces() { bool StrongholdPieces::updatePieceWeight() { bool hasAnyPieces = false; totalWeight = 0; - for (AUTO_VAR(it, currentPieces.begin()); it != currentPieces.end(); it++) { + for (auto it = currentPieces.begin(); it != currentPieces.end(); it++) { PieceWeight* piece = *it; if (piece->maxPlaceCount > 0 && piece->placeCount < piece->maxPlaceCount) { @@ -165,7 +165,7 @@ StrongholdPieces::StrongholdPiece* StrongholdPieces::generatePieceFromSmallDoor( numAttempts++; int weightSelection = random->nextInt(totalWeight); - for (AUTO_VAR(it, currentPieces.begin()); it != currentPieces.end(); + for (auto it = currentPieces.begin(); it != currentPieces.end(); it++) { PieceWeight* piece = *it; weightSelection -= piece->weight; @@ -214,7 +214,7 @@ StructurePiece* StrongholdPieces::generateAndAddPiece( if (startPiece->m_level->getOriginalSaveVersion() >= SAVE_FILE_VERSION_MOVED_STRONGHOLD && !startPiece->m_level->getLevelData()->getHasStrongholdEndPortal()) { - for (AUTO_VAR(it, currentPieces.begin()); it != currentPieces.end(); + for (auto it = currentPieces.begin(); it != currentPieces.end(); it++) { PieceWeight* piece = *it; diff --git a/Minecraft.World/WorldGen/Structures/StructurePiece.cpp b/Minecraft.World/WorldGen/Structures/StructurePiece.cpp index 06ed98963..c9353fb62 100644 --- a/Minecraft.World/WorldGen/Structures/StructurePiece.cpp +++ b/Minecraft.World/WorldGen/Structures/StructurePiece.cpp @@ -99,7 +99,7 @@ bool StructurePiece::isInChunk(ChunkPos* pos) { StructurePiece* StructurePiece::findCollisionPiece( std::list* pieces, BoundingBox* box) { - for (AUTO_VAR(it, pieces->begin()); it != pieces->end(); it++) { + for (auto it = pieces->begin(); it != pieces->end(); it++) { StructurePiece* piece = *it; if (piece->getBoundingBox() != NULL && piece->getBoundingBox()->intersects(box)) { diff --git a/Minecraft.World/WorldGen/Structures/StructureStart.cpp b/Minecraft.World/WorldGen/Structures/StructureStart.cpp index d378e9c33..34db6af0d 100644 --- a/Minecraft.World/WorldGen/Structures/StructureStart.cpp +++ b/Minecraft.World/WorldGen/Structures/StructureStart.cpp @@ -17,7 +17,7 @@ StructureStart::StructureStart(int x, int z) { } StructureStart::~StructureStart() { - for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) { + for (auto it = pieces.begin(); it != pieces.end(); it++) { delete (*it); } delete boundingBox; @@ -29,7 +29,7 @@ std::list* StructureStart::getPieces() { return &pieces; } void StructureStart::postProcess(Level* level, Random* random, BoundingBox* chunkBB) { - AUTO_VAR(it, pieces.begin()); + auto it = pieces.begin(); while (it != pieces.end()) { if ((*it)->getBoundingBox()->intersects(chunkBB) && @@ -46,7 +46,7 @@ void StructureStart::postProcess(Level* level, Random* random, void StructureStart::calculateBoundingBox() { boundingBox = BoundingBox::getUnknownBox(); - for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) { + for (auto it = pieces.begin(); it != pieces.end(); it++) { StructurePiece* piece = *it; boundingBox->expand(piece->getBoundingBox()); } @@ -61,7 +61,7 @@ CompoundTag* StructureStart::createTag(int chunkX, int chunkZ) { tag->put(L"BB", boundingBox->createTag(L"BB")); ListTag* childrenTags = new ListTag(L"Children"); - for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); ++it) { + for (auto it = pieces.begin(); it != pieces.end(); ++it) { StructurePiece* piece = *it; childrenTags->add(piece->createTag()); } @@ -107,7 +107,7 @@ void StructureStart::moveBelowSeaLevel(Level* level, Random* random, // move all bounding boxes int dy = y1Pos - boundingBox->y1; boundingBox->move(0, dy, 0); - for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) { + for (auto it = pieces.begin(); it != pieces.end(); it++) { StructurePiece* piece = *it; piece->getBoundingBox()->move(0, dy, 0); } @@ -128,7 +128,7 @@ void StructureStart::moveInsideHeights(Level* level, Random* random, // move all bounding boxes int dy = y0Pos - boundingBox->y0; boundingBox->move(0, dy, 0); - for (AUTO_VAR(it, pieces.begin()); it != pieces.end(); it++) { + for (auto it = pieces.begin(); it != pieces.end(); it++) { StructurePiece* piece = *it; piece->getBoundingBox()->move(0, dy, 0); } diff --git a/Minecraft.World/WorldGen/Structures/Village.cpp b/Minecraft.World/WorldGen/Structures/Village.cpp index 03a079387..5a150d76b 100644 --- a/Minecraft.World/WorldGen/Structures/Village.cpp +++ b/Minecraft.World/WorldGen/Structures/Village.cpp @@ -44,7 +44,7 @@ Village::Village(Level* level) { Village::~Village() { delete accCenter; delete center; - for (AUTO_VAR(it, aggressors.begin()); it != aggressors.end(); ++it) { + for (auto it = aggressors.begin(); it != aggressors.end(); ++it) { delete *it; } } @@ -164,7 +164,7 @@ std::shared_ptr Village::getClosestDoorInfo(int x, int y, int z) { std::shared_ptr closest = nullptr; int closestDistSqr = std::numeric_limits::max(); // for (DoorInfo dm : doorInfos) - for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { + for (auto it = doorInfos.begin(); it != doorInfos.end(); ++it) { std::shared_ptr dm = *it; int distSqr = dm->distanceToSqr(x, y, z); if (distSqr < closestDistSqr) { @@ -179,7 +179,7 @@ std::shared_ptr Village::getBestDoorInfo(int x, int y, int z) { std::shared_ptr closest = nullptr; int closestDist = std::numeric_limits::max(); // for (DoorInfo dm : doorInfos) - for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { + for (auto it = doorInfos.begin(); it != doorInfos.end(); ++it) { std::shared_ptr dm = *it; int distSqr = dm->distanceToSqr(x, y, z); @@ -203,7 +203,7 @@ bool Village::hasDoorInfo(int x, int y, int z) { std::shared_ptr Village::getDoorInfo(int x, int y, int z) { if (center->distSqr(x, y, z) > radius * radius) return nullptr; // for (DoorInfo di : doorInfos) - for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { + for (auto it = doorInfos.begin(); it != doorInfos.end(); ++it) { std::shared_ptr di = *it; if (di->x == x && di->z == z && abs(di->y - y) <= 1) return di; } @@ -223,7 +223,7 @@ bool Village::canRemove() { return doorInfos.empty(); } void Village::addAggressor(std::shared_ptr mob) { // for (Aggressor a : aggressors) - for (AUTO_VAR(it, aggressors.begin()); it != aggressors.end(); ++it) { + for (auto it = aggressors.begin(); it != aggressors.end(); ++it) { Aggressor* a = *it; if (a->mob == mob) { a->timeStamp = _tick; @@ -238,7 +238,7 @@ std::shared_ptr Village::getClosestAggressor( double closestSqr = std::numeric_limits::max(); Aggressor* closest = NULL; // for (int i = 0; i < aggressors.size(); ++i) - for (AUTO_VAR(it, aggressors.begin()); it != aggressors.end(); ++it) { + for (auto it = aggressors.begin(); it != aggressors.end(); ++it) { Aggressor* a = *it; // aggressors.get(i); double distSqr = a->mob->distanceToSqr(from); if (distSqr > closestSqr) continue; @@ -254,7 +254,7 @@ std::shared_ptr Village::getClosestBadStandingPlayer( std::shared_ptr closest = nullptr; // for (String player : playerStanding.keySet()) - for (AUTO_VAR(it, playerStanding.begin()); it != playerStanding.end(); + for (auto it = playerStanding.begin(); it != playerStanding.end(); ++it) { std::wstring player = it->first; if (isVeryBadStanding(player)) { @@ -273,7 +273,7 @@ std::shared_ptr Village::getClosestBadStandingPlayer( void Village::updateAggressors() { // for (Iterator it = aggressors.iterator(); it.hasNext();) - for (AUTO_VAR(it, aggressors.begin()); it != aggressors.end();) { + for (auto it = aggressors.begin(); it != aggressors.end();) { Aggressor* a = *it; // it.next(); if (!a->mob->isAlive() || abs(_tick - a->timeStamp) > 300) { delete *it; @@ -289,7 +289,7 @@ void Village::updateDoors() { bool removed = false; bool resetBookings = level->random->nextInt(50) == 0; // for (Iterator it = doorInfos.iterator(); it.hasNext();) - for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end();) { + for (auto it = doorInfos.begin(); it != doorInfos.end();) { std::shared_ptr dm = *it; // it.next(); if (resetBookings) dm->resetBookingCount(); if (!isDoor(dm->x, dm->y, dm->z) || abs(_tick - dm->timeStamp) > 1200) { @@ -325,7 +325,7 @@ void Village::calcInfo() { center->set(accCenter->x / s, accCenter->y / s, accCenter->z / s); int maxRadiusSqr = 0; // for (DoorInfo dm : doorInfos) - for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { + for (auto it = doorInfos.begin(); it != doorInfos.end(); ++it) { std::shared_ptr dm = *it; maxRadiusSqr = std::max( dm->distanceToSqr(center->x, center->y, center->z), maxRadiusSqr); @@ -338,7 +338,7 @@ void Village::calcInfo() { } int Village::getStanding(const std::wstring& playerName) { - AUTO_VAR(it, playerStanding.find(playerName)); + auto it = playerStanding.find(playerName); if (it != playerStanding.end()) { return it->second; } @@ -414,7 +414,7 @@ void Village::addAdditonalSaveData(CompoundTag* tag) { ListTag* doorTags = new ListTag(L"Doors"); // for (DoorInfo dm : doorInfos) - for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { + for (auto it = doorInfos.begin(); it != doorInfos.end(); ++it) { std::shared_ptr dm = *it; CompoundTag* doorTag = new CompoundTag(L"Door"); doorTag->putInt(L"X", dm->x); @@ -429,7 +429,7 @@ void Village::addAdditonalSaveData(CompoundTag* tag) { ListTag* playerTags = new ListTag(L"Players"); // for (String player : playerStanding.keySet()) - for (AUTO_VAR(it, playerStanding.begin()); it != playerStanding.end(); + for (auto it = playerStanding.begin(); it != playerStanding.end(); ++it) { std::wstring player = it->first; CompoundTag* playerTag = new CompoundTag(player); @@ -452,7 +452,7 @@ bool Village::isBreedTimerOk() { void Village::rewardAllPlayers(int amount) { // for (String player : playerStanding.keySet()) - for (AUTO_VAR(it, playerStanding.begin()); it != playerStanding.end(); + for (auto it = playerStanding.begin(); it != playerStanding.end(); ++it) { modifyStanding(it->first, amount); } diff --git a/Minecraft.World/WorldGen/Structures/VillagePieces.cpp b/Minecraft.World/WorldGen/Structures/VillagePieces.cpp index d1b4fefdf..9c3e88004 100644 --- a/Minecraft.World/WorldGen/Structures/VillagePieces.cpp +++ b/Minecraft.World/WorldGen/Structures/VillagePieces.cpp @@ -94,7 +94,7 @@ std::list* VillagePieces::createPieceSet( Mth::nextInt(random, 0 + villageSize, 3 + villageSize * 2))); // silly way of filtering "infinite" buildings - AUTO_VAR(it, newPieces->begin()); + auto it = newPieces->begin(); while (it != newPieces->end()) { if ((*it)->maxPlaceCount == 0) { delete (*it); @@ -110,7 +110,7 @@ std::list* VillagePieces::createPieceSet( int VillagePieces::updatePieceWeight(std::list* currentPieces) { bool hasAnyPieces = false; int totalWeight = 0; - for (AUTO_VAR(it, currentPieces->begin()); it != currentPieces->end(); + for (auto it = currentPieces->begin(); it != currentPieces->end(); it++) { PieceWeight* piece = *it; if (piece->maxPlaceCount > 0 && @@ -174,7 +174,7 @@ VillagePieces::VillagePiece* VillagePieces::generatePieceFromSmallDoor( numAttempts++; int weightSelection = random->nextInt(totalWeight); - for (AUTO_VAR(it, startPiece->pieceSet->begin()); + for (auto it = startPiece->pieceSet->begin(); it != startPiece->pieceSet->end(); it++) { PieceWeight* piece = *it; weightSelection -= piece->weight; @@ -611,7 +611,7 @@ VillagePieces::StartPiece::StartPiece(BiomeSource* biomeSource, int genDepth, } VillagePieces::StartPiece::~StartPiece() { - for (AUTO_VAR(it, pieceSet->begin()); it != pieceSet->end(); it++) { + for (auto it = pieceSet->begin(); it != pieceSet->end(); it++) { delete (*it); } delete pieceSet; diff --git a/Minecraft.World/WorldGen/Structures/Villages.cpp b/Minecraft.World/WorldGen/Structures/Villages.cpp index db20bd608..7d52509b8 100644 --- a/Minecraft.World/WorldGen/Structures/Villages.cpp +++ b/Minecraft.World/WorldGen/Structures/Villages.cpp @@ -19,14 +19,14 @@ Villages::Villages(Level* level) : SavedData(VILLAGE_FILE_ID) { } Villages::~Villages() { - for (AUTO_VAR(it, queries.begin()); it != queries.end(); ++it) delete *it; + for (auto it = queries.begin(); it != queries.end(); ++it) delete *it; } void Villages::setLevel(Level* level) { this->level = level; // for (Village village : villages) - for (AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { + for (auto it = villages.begin(); it != villages.end(); ++it) { std::shared_ptr village = *it; village->setLevel(level); } @@ -40,7 +40,7 @@ void Villages::queryUpdateAround(int x, int y, int z) { void Villages::tick() { ++_tick; // for (Village village : villages) - for (AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { + for (auto it = villages.begin(); it != villages.end(); ++it) { std::shared_ptr village = *it; village->tick(_tick); } @@ -55,7 +55,7 @@ void Villages::tick() { void Villages::removeVillages() { // for (Iterator it = villages.iterator(); it.hasNext();) - for (AUTO_VAR(it, villages.begin()); it != villages.end();) { + for (auto it = villages.begin(); it != villages.end();) { std::shared_ptr village = *it; // it.next(); if (village->canRemove()) { it = villages.erase(it); @@ -76,7 +76,7 @@ std::shared_ptr Villages::getClosestVillage(int x, int y, int z, std::shared_ptr closest = nullptr; float closestDistSqr = std::numeric_limits::max(); // for (Village village : villages) - for (AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { + for (auto it = villages.begin(); it != villages.end(); ++it) { std::shared_ptr village = *it; float distSqr = village->getCenter()->distSqr(x, y, z); if (distSqr >= closestDistSqr) continue; @@ -101,12 +101,12 @@ void Villages::processNextQuery() { void Villages::cluster() { // note doesn't merge or split existing villages // for (int i = 0; i < unclustered.size(); ++i) - for (AUTO_VAR(it, unclustered.begin()); it != unclustered.end(); ++it) { + for (auto it = unclustered.begin(); it != unclustered.end(); ++it) { std::shared_ptr di = *it; // unclustered.get(i); bool found = false; // for (Village village : villages) - for (AUTO_VAR(itV, villages.begin()); itV != villages.end(); ++itV) { + for (auto itV = villages.begin(); itV != villages.end(); ++itV) { std::shared_ptr village = *itV; int dist = (int)village->getCenter()->distSqr(di->x, di->y, di->z); int radius = MaxDoorDist + village->getRadius(); @@ -147,12 +147,12 @@ void Villages::addDoorInfos(Pos* pos) { std::shared_ptr Villages::getDoorInfo(int x, int y, int z) { // for (DoorInfo di : unclustered) - for (AUTO_VAR(it, unclustered.begin()); it != unclustered.end(); ++it) { + for (auto it = unclustered.begin(); it != unclustered.end(); ++it) { std::shared_ptr di = *it; if (di->x == x && di->z == z && abs(di->y - y) <= 1) return di; } // for (Village v : villages) - for (AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { + for (auto it = villages.begin(); it != villages.end(); ++it) { std::shared_ptr v = *it; std::shared_ptr di = v->getDoorInfo(x, y, z); if (di != NULL) return di; @@ -185,7 +185,7 @@ void Villages::createDoorInfo(int x, int y, int z) { bool Villages::hasQuery(int x, int y, int z) { // for (Pos pos : queries) - for (AUTO_VAR(it, queries.begin()); it != queries.end(); ++it) { + for (auto it = queries.begin(); it != queries.end(); ++it) { Pos* pos = *it; if (pos->x == x && pos->y == y && pos->z == z) return true; } @@ -214,7 +214,7 @@ void Villages::save(CompoundTag* tag) { tag->putInt(L"Tick", _tick); ListTag* villageTags = new ListTag(L"Villages"); // for (Village village : villages) - for (AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) { + for (auto it = villages.begin(); it != villages.end(); ++it) { std::shared_ptr village = *it; CompoundTag* villageTag = new CompoundTag(L"Village"); village->addAdditonalSaveData(villageTag);