diff --git a/CorsixTH/Src/th_gfx_sdl.cpp b/CorsixTH/Src/th_gfx_sdl.cpp index d3e228b..f55c6bf 100644 --- a/CorsixTH/Src/th_gfx_sdl.cpp +++ b/CorsixTH/Src/th_gfx_sdl.cpp @@ -78,11 +78,11 @@ static inline uint32_t makeSwapRedBlue(uint8_t iOpacity, uint8_t iR, uint8_t iG, // Simple swapping channels will thus distort the balance. This code compensates for that by computing // red = blue * 0.0722 / 0.2126 = blue * 1083 / 3189 // blue = red * 0.2126 / 0.0722 = red * 1063 / 361 (clipped at max blue, 255) - uint8_t iNewRed = (unsigned int)iB * 1083 / 3189; - unsigned int iNewBlue = (unsigned int)iR * 1063 / 361; + uint8_t iNewRed = static_cast(iB * 1083 / 3189); + int iNewBlue = iR * 1063 / 361; if (iNewBlue > 255) iNewBlue = 255; - return THPalette::packARGB(iOpacity, iNewRed, iG, iNewBlue); + return THPalette::packARGB(iOpacity, iNewRed, iG, static_cast(iNewBlue)); } bool FullColourRenderer::decodeImage(const unsigned char* pImg, const THPalette *pPalette, uint32_t iSpriteFlags) diff --git a/CorsixTH/Src/th_lua_anims.cpp b/CorsixTH/Src/th_lua_anims.cpp index 293b9c8..dc08604 100644 --- a/CorsixTH/Src/th_lua_anims.cpp +++ b/CorsixTH/Src/th_lua_anims.cpp @@ -150,7 +150,7 @@ static int l_anims_set_alt_pal(lua_State *L) const unsigned char *pPal = luaT_checkfile(L, 3, &iPalLen); if(iPalLen != 256) return luaL_typerror(L, 3, "GhostPalette string"); - uint32_t iAlt32 = luaL_checkint(L, 4); + uint32_t iAlt32 = static_cast(luaL_checkinteger(L, 4)); pAnims->setAnimationAltPaletteMap(iAnimation, pPal, iAlt32);