Loading

Paste #pnsdt7tyl

  1. diff --git a/CorsixTH/Src/th_gfx_sdl.cpp b/CorsixTH/Src/th_gfx_sdl.cpp
  2. index d3e228b..f55c6bf 100644
  3. --- a/CorsixTH/Src/th_gfx_sdl.cpp
  4. +++ b/CorsixTH/Src/th_gfx_sdl.cpp
  5. @@ -78,11 +78,11 @@ static inline uint32_t makeSwapRedBlue(uint8_t iOpacity, uint8_t iR, uint8_t iG,
  6.      // Simple swapping channels will thus distort the balance. This code compensates for that by computing
  7.      // red  = blue * 0.0722 / 0.2126 = blue * 1083 / 3189
  8.      // blue = red  * 0.2126 / 0.0722 = red  * 1063 / 361 (clipped at max blue, 255)
  9. -    uint8_t iNewRed = (unsigned int)iB * 1083 / 3189;
  10. -    unsigned int iNewBlue = (unsigned int)iR * 1063 / 361;
  11. +    uint8_t iNewRed = static_cast<uint8_t>(iB * 1083 / 3189);
  12. +    int iNewBlue = iR * 1063 / 361;
  13.      if (iNewBlue > 255)
  14.          iNewBlue = 255;
  15. -    return THPalette::packARGB(iOpacity, iNewRed, iG, iNewBlue);
  16. +    return THPalette::packARGB(iOpacity, iNewRed, iG, static_cast<uint8_t>(iNewBlue));
  17.  }
  18.  
  19.  bool FullColourRenderer::decodeImage(const unsigned char* pImg, const THPalette *pPalette, uint32_t iSpriteFlags)
  20. diff --git a/CorsixTH/Src/th_lua_anims.cpp b/CorsixTH/Src/th_lua_anims.cpp
  21. index 293b9c8..dc08604 100644
  22. --- a/CorsixTH/Src/th_lua_anims.cpp
  23. +++ b/CorsixTH/Src/th_lua_anims.cpp
  24. @@ -150,7 +150,7 @@ static int l_anims_set_alt_pal(lua_State *L)
  25.      const unsigned char *pPal = luaT_checkfile(L, 3, &iPalLen);
  26.      if(iPalLen != 256)
  27.          return luaL_typerror(L, 3, "GhostPalette string");
  28. -    uint32_t iAlt32 = luaL_checkint(L, 4);
  29. +    uint32_t iAlt32 = static_cast<uint32_t>(luaL_checkinteger(L, 4));                                                      
  30.                                                                                                                            
  31.      pAnims->setAnimationAltPaletteMap(iAnimation, pPal, iAlt32);

Comments