From 1c113eca9cec97c691f3be36307e3fd2c53af018 Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Tue, 17 Apr 2018 21:34:40 +0300 Subject: [PATCH] 15 to landTextureSize-1 --- apps/opencs/view/render/terraintexturemode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/opencs/view/render/terraintexturemode.cpp b/apps/opencs/view/render/terraintexturemode.cpp index 79973b806..77d850861 100644 --- a/apps/opencs/view/render/terraintexturemode.cpp +++ b/apps/opencs/view/render/terraintexturemode.cpp @@ -277,7 +277,7 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe { for(int j=-mBrushSize/2;j= 0 && yInCell+j >= 0 && xInCell+i <= 15 && yInCell+j <= 15) + if (xInCell+i >= 0 && yInCell+j >= 0 && xInCell+i <= landTextureSize - 1 && yInCell+j <= landTextureSize - 1) mNew[(yInCell+j)*landTextureSize+(xInCell+i)] = brushInt; } } @@ -292,7 +292,7 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe for(int j = -r; j < r; j++) { distance = std::round(sqrt(pow((xInCell+i)-xInCell, 2) + pow((yInCell+j)-yInCell, 2))); - if (xInCell+i >= 0 && yInCell+j >= 0 && xInCell+i <= 15 && yInCell+j <= 15 && distance <= rf) + if (xInCell+i >= 0 && yInCell+j >= 0 && xInCell+i <= landTextureSize - 1 && yInCell+j <= landTextureSize - 1 && distance <= rf) mNew[(yInCell+j)*landTextureSize+(xInCell+i)] = brushInt; } }