From 8dbbdcca0da12134e974e2161e68deb84b8b864d Mon Sep 17 00:00:00 2001 From: ephphatha Date: Fri, 9 Jul 2021 00:05:20 +1000 Subject: [PATCH] remove unnecessary cast from MakeLightTable Also changed the c-style cast to static_cast with appropriate type for destination. --- Source/lighting.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/lighting.cpp b/Source/lighting.cpp index 6d24f5de1..cae2324d5 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -919,10 +919,9 @@ void MakeLightTable() for (int i = 0; i < 8; i++) { for (int k = 0; k < 16; k++) { for (int l = 0; l < 16; l++) { - double fs = (BYTE)sqrt((double)(8 * l - j) * (8 * l - j) + (8 * k - i) * (8 * k - i)); - fs += fs < 0 ? -0.5 : 0.5; - - lightblock[j * 8 + i][k][l] = fs; + int a = (8 * l - j); + int b = (8 * k - i); + lightblock[j * 8 + i][k][l] = static_cast(sqrt(a * a + b * b)); } } }