summaryrefslogtreecommitdiffstats
path: root/src/Generating/FinishGen.cpp
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-05-30 11:32:35 +0200
committerworktycho <work.tycho@gmail.com>2015-05-30 11:32:35 +0200
commit2ce405883ac34f3f2e443d60ba93a94568568f39 (patch)
tree63de5aa4fdcfe13224e954aa557096a720389401 /src/Generating/FinishGen.cpp
parentMerge pull request #2167 from SafwatHalaby/diags (diff)
parentFix FreeBSD/clang errors caused by -Werror (diff)
downloadcuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.gz
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.bz2
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.lz
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.xz
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.zst
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/FinishGen.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index 5540f80d4..656dc95db 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -1375,8 +1375,12 @@ eMonsterType cFinishGenPassiveMobs::GetRandomMob(cChunkDesc & a_ChunkDesc)
return mtInvalidType;
}
- size_t RandMob = static_cast<size_t>((m_Noise.IntNoise2DInt(chunkX - chunkZ + 2, chunkX + 5) / 7)) % ListOfSpawnables.size();
auto MobIter = ListOfSpawnables.begin();
+ using diff_type =
+ std::iterator_traits<decltype(MobIter)>::difference_type;
+ diff_type RandMob = static_cast<diff_type>
+ ((unsigned long)(m_Noise.IntNoise2DInt(chunkX - chunkZ + 2, chunkX + 5) / 7)
+ % ListOfSpawnables.size());
std::advance(MobIter, RandMob);
return *MobIter;