From 014308ef0195b15f5fc2b3eb4c70fa6a50a857da Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 14 May 2020 11:17:34 +0200 Subject: [PATCH] Explicit casting --- Source/lighting.cpp | 2 +- Source/loadsave.cpp | 2 +- Source/scrollrt.cpp | 2 +- SourceX/soundsample.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/lighting.cpp b/Source/lighting.cpp index e42716f7a..cce1f3b11 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -962,7 +962,7 @@ void MakeLightTable() for (j = 0; j < 8; j++) { for (k = 0; k < 16; k++) { for (l = 0; l < 16; l++) { - fs = (BYTE)sqrt((8 * l - j) * (8 * l - j) + (8 * k - i) * (8 * k - i)); + fs = (BYTE)sqrt((double)(8 * l - j) * (8 * l - j) + (8 * k - i) * (8 * k - i)); if (fs < 0.0) { fa = -0.5; } else { diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index ca3d4a9c2..d0d900c4d 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -258,7 +258,7 @@ void CopyInts(const void *src, const int n, void *dst) const auto *s = reinterpret_cast(src); auto *d = reinterpret_cast(dst); for (int i = 0; i < n; i++) { - CopyInt(s, d); + CopyInt(s, (void*)d); ++d; ++s; } diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index ee5725211..d2027f142 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -904,7 +904,7 @@ static void DrawGame(int x, int y) y--; // Keep evaulating untill MicroTiles can't affect screen - blocks += ceil(MicroTileLen / 2); + blocks += ceil((double)MicroTileLen / 2); if (PANELS_COVER) { if (zoomflag) { diff --git a/SourceX/soundsample.cpp b/SourceX/soundsample.cpp index 3b9124de8..ef0b23cd5 100644 --- a/SourceX/soundsample.cpp +++ b/SourceX/soundsample.cpp @@ -30,8 +30,8 @@ void SoundSample::Play(int lVolume, int lPan) return; } - Mix_Volume(channel, pow(10, lVolume / 2000.0) * MIX_MAX_VOLUME); - int pan = copysign(pow(10, -abs(lPan) / 2000.0) * 255, lPan); + Mix_Volume(channel, pow((double)10, (double)lVolume / 2000.0) * MIX_MAX_VOLUME); + int pan = copysign(pow((double)10, -abs(lPan) / 2000.0) * 255, (double)lPan); Mix_SetPanning(channel, pan > 0 ? pan : 255, pan < 0 ? abs(pan) : 255); };