mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
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:
@@ -4389,8 +4389,8 @@ void entityclass::fixfriction( int t, float xfix, float xrate, float yrate )
|
||||
if (entities[t].vx > 6) entities[t].vx = 6.0f;
|
||||
if (entities[t].vx < -6) entities[t].vx = -6.0f;
|
||||
|
||||
if (std::abs(entities[t].vx-xfix) <= xrate) entities[t].vx = xfix;
|
||||
if (std::abs(entities[t].vy) < yrate) entities[t].vy = 0;
|
||||
if (SDL_abs(entities[t].vx-xfix) <= xrate) entities[t].vx = xfix;
|
||||
if (SDL_abs(entities[t].vy) < yrate) entities[t].vy = 0;
|
||||
}
|
||||
|
||||
void entityclass::applyfriction( int t, float xrate, float yrate )
|
||||
@@ -4410,8 +4410,8 @@ void entityclass::applyfriction( int t, float xrate, float yrate )
|
||||
if (entities[t].vx > 6.00f) entities[t].vx = 6.0f;
|
||||
if (entities[t].vx < -6.00f) entities[t].vx = -6.0f;
|
||||
|
||||
if (std::abs(entities[t].vx) < xrate) entities[t].vx = 0.0f;
|
||||
if (std::abs(entities[t].vy) < yrate) entities[t].vy = 0.0f;
|
||||
if (SDL_abs(entities[t].vx) < xrate) entities[t].vx = 0.0f;
|
||||
if (SDL_abs(entities[t].vy) < yrate) entities[t].vy = 0.0f;
|
||||
}
|
||||
|
||||
void entityclass::updateentitylogic( int t )
|
||||
|
||||
Reference in New Issue
Block a user