From ec520838dfb40df4af8153da146e22c9bf1f8460 Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 11 Dec 2022 11:00:20 -0800 Subject: [PATCH] Retype `testwallsy`'s `tx` and `ty` to be ints, not floats I have no idea why they were floats in the first place. They are coordinates, and coordinates are integer positions in this game. They get converted to float only to be explicitly `static_cast`ed back to ints in `testwallsy`. --- desktop_version/src/Entity.cpp | 6 +++--- desktop_version/src/Entity.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index cc1b3b7b..1d2eab1f 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -4473,7 +4473,7 @@ bool entityclass::testwallsx( int t, int tx, int ty, const bool skipdirblocks ) return true; } -bool entityclass::testwallsy( int t, float tx, float ty ) +bool entityclass::testwallsy( int t, int tx, int ty ) { if (!INBOUNDS_VEC(t, entities)) { @@ -4482,8 +4482,8 @@ bool entityclass::testwallsy( int t, float tx, float ty ) } SDL_Rect temprect; - temprect.x = static_cast(tx) + entities[t].cx; - temprect.y = static_cast(ty) + entities[t].cy; + temprect.x = tx + entities[t].cx; + temprect.y = ty + entities[t].cy; temprect.w = entities[t].w; temprect.h = entities[t].h; diff --git a/desktop_version/src/Entity.h b/desktop_version/src/Entity.h index da53174b..75b068a1 100644 --- a/desktop_version/src/Entity.h +++ b/desktop_version/src/Entity.h @@ -155,7 +155,7 @@ public: bool testwallsx(int t, int tx, int ty, bool skipdirblocks); - bool testwallsy(int t, float tx, float ty); + bool testwallsy(int t, int tx, int ty); void applyfriction(int t, float xrate, float yrate);