aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MobSpawner.cpp
diff options
context:
space:
mode:
authorvoid_17 <61356189+void2012@users.noreply.github.com>2026-03-06 02:11:18 +0700
committerGitHub <noreply@github.com>2026-03-06 02:11:18 +0700
commit55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch)
tree953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.World/MobSpawner.cpp
parent7d6658fe5b3095f35093701b5ab669ffc291e875 (diff)
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.World/MobSpawner.cpp')
-rw-r--r--Minecraft.World/MobSpawner.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/Minecraft.World/MobSpawner.cpp b/Minecraft.World/MobSpawner.cpp
index 8cd60e92..e593a59f 100644
--- a/Minecraft.World/MobSpawner.cpp
+++ b/Minecraft.World/MobSpawner.cpp
@@ -100,12 +100,10 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie
}
MemSect(20);
chunksToPoll.clear();
-
+
#if 0
- AUTO_VAR(itEnd, level->players.end());
- for (AUTO_VAR(it, level->players.begin()); it != itEnd; it++)
+ for (auto& player : level->players)
{
- shared_ptr<Player> player = *it; //level->players.at(i);
int xx = Mth::floor(player->x / 16);
int zz = Mth::floor(player->z / 16);
@@ -164,20 +162,20 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie
#ifdef __PSVITA__
ChunkPos cp = ChunkPos( ( xx[i] - r ) + l , ( zz[i] - r ));
if( chunksToPoll.find( cp ) ) chunksToPoll.insert(cp, true);
- cp = ChunkPos( ( xx[i] + r ), ( zz[i] - r ) + l );
+ cp = ChunkPos( ( xx[i] + r ), ( zz[i] - r ) + l );
if( chunksToPoll.find( cp ) ) chunksToPoll.insert(cp, true);
- cp = ChunkPos( ( xx[i] + r ) - l , ( zz[i] + r ));
+ cp = ChunkPos( ( xx[i] + r ) - l , ( zz[i] + r ));
if( chunksToPoll.find( cp ) ) chunksToPoll.insert(cp, true);
- cp = ChunkPos( ( xx[i] - r ), ( zz[i] + r ) - l);
+ cp = ChunkPos( ( xx[i] - r ), ( zz[i] + r ) - l);
if( chunksToPoll.find( cp ) ) chunksToPoll.insert(cp, true);
#else
ChunkPos cp = ChunkPos( ( xx[i] - r ) + l , ( zz[i] - r ));
if( chunksToPoll.find( cp ) == chunksToPoll.end() ) chunksToPoll.insert(std::pair<ChunkPos,bool>(cp, true));
- cp = ChunkPos( ( xx[i] + r ), ( zz[i] - r ) + l );
+ cp = ChunkPos( ( xx[i] + r ), ( zz[i] - r ) + l );
if( chunksToPoll.find( cp ) == chunksToPoll.end() ) chunksToPoll.insert(std::pair<ChunkPos,bool>(cp, true));
- cp = ChunkPos( ( xx[i] + r ) - l , ( zz[i] + r ));
+ cp = ChunkPos( ( xx[i] + r ) - l , ( zz[i] + r ));
if( chunksToPoll.find( cp ) == chunksToPoll.end() ) chunksToPoll.insert(std::pair<ChunkPos,bool>(cp, true));
- cp = ChunkPos( ( xx[i] - r ), ( zz[i] + r ) - l);
+ cp = ChunkPos( ( xx[i] - r ), ( zz[i] + r ) - l);
if( chunksToPoll.find( cp ) == chunksToPoll.end() ) chunksToPoll.insert(std::pair<ChunkPos,bool>(cp, true));
#endif
@@ -224,16 +222,15 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie
{
SCustomMapNode *it = chunksToPoll.get(i);
#else
- AUTO_VAR(itEndCTP, chunksToPoll.end());
- for (AUTO_VAR(it, chunksToPoll.begin()); it != itEndCTP; it++)
+ for (auto& it : chunksToPoll)
{
#endif
- if( it->second )
+ if( it.second )
{
// don't add mobs to edge chunks, to prevent adding mobs "outside" of the active playground
continue;
}
- ChunkPos *cp = (ChunkPos *) (&it->first);
+ ChunkPos *cp = (ChunkPos *) (&it.first);
// 4J - don't let this actually create/load a chunk that isn't here already - we'll let the normal updateDirtyChunks etc. processes do that, so it can happen on another thread
if( !level->hasChunk(cp->x,cp->z) ) continue;
@@ -399,7 +396,7 @@ bool MobSpawner::isSpawnPositionOk(MobCategory *category, Level *level, int x, i
// 4J - changed to spawn water things only in deep water
int yo = 0;
int liquidCount = 0;
-
+
while( ( y - yo ) >= 0 && ( yo < 5 ) )
{
if( level->getMaterial(x, y - yo, z)->isLiquid() ) liquidCount++;