Use SDL_abs instead of std::abs

This prevents issues when calling std::abs with a float on some older
compilers. While it would normally be promoted to an int, std::abs is
special due to being overloaded despite being a C function. This can
cause errors due to the compiler being unable to find a float overload.
SDL_abs doesn't have this problem, since it's a normal C function.
This commit is contained in:
leo60228
2021-01-01 16:38:33 -05:00
committed by Ethan Lee
parent 775ac4c40c
commit c4893a133f
2 changed files with 6 additions and 6 deletions

View File

@@ -1824,7 +1824,7 @@ void gameinput()
if (game.activetele && game.readytotele > 20 && !game.intimetrial)
{
enter_already_processed = true;
if(int(std::abs(obj.entities[ie].vx))<=1 && int(obj.entities[ie].vy)==0)
if(int(SDL_abs(obj.entities[ie].vx))<=1 && int(obj.entities[ie].vy)==0)
{
//wait! space station 2 debug thingy
if (game.teleportscript != "")
@@ -1890,7 +1890,7 @@ void gameinput()
else if (INBOUNDS_VEC(game.activeactivity, obj.blocks))
{
enter_already_processed = true;
if((int(std::abs(obj.entities[ie].vx))<=1) && (int(obj.entities[ie].vy) == 0) )
if((int(SDL_abs(obj.entities[ie].vx))<=1) && (int(obj.entities[ie].vy) == 0) )
{
script.load(obj.blocks[game.activeactivity].script);
obj.removeblock(game.activeactivity);