diff options
Diffstat (limited to 'src/Generating/HeiGen.cpp')
-rw-r--r-- | src/Generating/HeiGen.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp index aa1c1893b..6cfd53837 100644 --- a/src/Generating/HeiGen.cpp +++ b/src/Generating/HeiGen.cpp @@ -102,16 +102,16 @@ void cHeiGenFlat::InitializeHeightGen(cIniFile & a_IniFile) //////////////////////////////////////////////////////////////////////////////// // cHeiGenCache: -cHeiGenCache::cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, int a_CacheSize) : +cHeiGenCache::cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, size_t a_CacheSize) : m_HeiGenToCache(a_HeiGenToCache), m_CacheSize(a_CacheSize), - m_CacheOrder(new int[a_CacheSize]), + m_CacheOrder(new size_t[a_CacheSize]), m_CacheData(new sCacheData[a_CacheSize]), m_NumHits(0), m_NumMisses(0), m_TotalChain(0) { - for (int i = 0; i < m_CacheSize; i++) + for (size_t i = 0; i < m_CacheSize; i++) { m_CacheOrder[i] = i; m_CacheData[i].m_ChunkX = 0x7fffffff; @@ -141,11 +141,11 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap if (((m_NumHits + m_NumMisses) % 1024) == 10) { LOGD("HeiGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses)); - LOGD("HeiGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits); + LOGD("HeiGenCache: Avg cache chain length: %.2f", static_cast<double>(m_TotalChain) / m_NumHits); } //*/ - for (int i = 0; i < m_CacheSize; i++) + for (size_t i = 0; i < m_CacheSize; i++) { if ( (m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) || @@ -155,10 +155,10 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap continue; } // Found it in the cache - int Idx = m_CacheOrder[i]; + auto Idx = m_CacheOrder[i]; // Move to front: - for (int j = i; j > 0; j--) + for (size_t j = i; j > 0; j--) { m_CacheOrder[j] = m_CacheOrder[j - 1]; } @@ -177,8 +177,8 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap m_HeiGenToCache->GenHeightMap(a_ChunkX, a_ChunkZ, a_HeightMap); // Insert it as the first item in the MRU order: - int Idx = m_CacheOrder[m_CacheSize - 1]; - for (int i = m_CacheSize - 1; i > 0; i--) + auto Idx = m_CacheOrder[m_CacheSize - 1]; + for (auto i = m_CacheSize - 1; i > 0; i--) { m_CacheOrder[i] = m_CacheOrder[i - 1]; } // for i - m_CacheOrder[] @@ -194,7 +194,7 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap bool cHeiGenCache::GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE & a_Height) { - for (int i = 0; i < m_CacheSize; i++) + for (size_t i = 0; i < m_CacheSize; i++) { if ((m_CacheData[i].m_ChunkX == a_ChunkX) && (m_CacheData[i].m_ChunkZ == a_ChunkZ)) { |