From b384087e289dfbbb9af2c69e8d04b77bb055dcea Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 8 Mar 2017 17:44:54 +0100 Subject: [PATCH] Fix handling in fillVertexBuffers when the chunk is >1 ESM::Cell --- components/esm/loadland.cpp | 3 +++ components/esmterrain/storage.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/esm/loadland.cpp b/components/esm/loadland.cpp index 72c3eb98d5..0869eb7be0 100644 --- a/components/esm/loadland.cpp +++ b/components/esm/loadland.cpp @@ -335,4 +335,7 @@ namespace ESM } } } + + const int Land::LAND_SIZE; + } diff --git a/components/esmterrain/storage.cpp b/components/esmterrain/storage.cpp index d1138a1479..8009f48ade 100644 --- a/components/esmterrain/storage.cpp +++ b/components/esmterrain/storage.cpp @@ -232,8 +232,8 @@ namespace ESMTerrain // Only relevant for chunks smaller than (contained in) one cell rowStart += (origin.x() - startCellX) * ESM::Land::LAND_SIZE; colStart += (origin.y() - startCellY) * ESM::Land::LAND_SIZE; - int rowEnd = rowStart + std::min(1.f, size) * (ESM::Land::LAND_SIZE-1) + 1; - int colEnd = colStart + std::min(1.f, size) * (ESM::Land::LAND_SIZE-1) + 1; + int rowEnd = std::min(static_cast(rowStart + std::min(1.f, size) * (ESM::Land::LAND_SIZE-1) + 1), ESM::Land::LAND_SIZE); + int colEnd = std::min(static_cast(colStart + std::min(1.f, size) * (ESM::Land::LAND_SIZE-1) + 1), ESM::Land::LAND_SIZE); vertY = vertY_; for (int col=colStart; col