From 4788dc42fb8902c4f62ca096837ee893da511164 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 5 Mar 2020 01:17:31 +0100 Subject: [PATCH] - cleanup of the screentext consolidation Since SetIfGreater is only used by the text code, the redundant copies could be removed. --- source/blood/src/common_game.h | 8 -------- source/blood/src/nnexts.cpp | 2 +- source/common/2d/screentext.cpp | 2 +- source/rr/src/game.h | 13 ------------- 4 files changed, 2 insertions(+), 23 deletions(-) diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index 4ea644975..6d52d6796 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -763,14 +763,6 @@ inline int approxDist(int dx, int dy) return dx+dy; } -// the point of this is to prevent re-running a function or calculation passed to potentialValue -// without making a new variable under each individual circumstance -inline void SetIfGreater(int32_t* variable, int32_t potentialValue) -{ - if (potentialValue > * variable) - * variable = potentialValue; -} - class Rect { public: int x0, y0, x1, y1; diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index 13e4d6b97..069bfc5f0 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -1734,7 +1734,7 @@ void useEffectGen(XSPRITE* pXSource, spritetype* pSprite) { break; case 3: case 4: - // if (!sectRangeIsFine(pSprite->sectnum)) fallthrough__; Code is wrong + // if (!sectRangeIsFine(pSprite->sectnum)) f allthrough__; Code is wrong pos = (pXSource->data4 == 3) ? sector[pSprite->sectnum].floorz : sector[pSprite->sectnum].ceilingz; break; default: diff --git a/source/common/2d/screentext.cpp b/source/common/2d/screentext.cpp index dfc165f02..4202ea1e0 100644 --- a/source/common/2d/screentext.cpp +++ b/source/common/2d/screentext.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "screentext.h" #include "build.h" -static inline void SetIfGreater(int32_t *variable, int32_t potentialValue) +inline void SetIfGreater(int32_t *variable, int32_t potentialValue) { if (potentialValue > *variable) *variable = potentialValue; diff --git a/source/rr/src/game.h b/source/rr/src/game.h index b66637ff1..bf4a51a21 100644 --- a/source/rr/src/game.h +++ b/source/rr/src/game.h @@ -426,8 +426,6 @@ static inline int G_GetMusicIdx(const char *str) extern void G_PrintCurrentMusic(void); -EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue); - template static inline int G_GetViewscreenSizeShift(T const *tspr) { @@ -446,17 +444,6 @@ static inline int G_GetViewscreenSizeShift(T const *tspr) #endif } -#if defined game_c_ || !defined DISABLE_INLINING - -// the point of this is to prevent re-running a function or calculation passed to potentialValue -// without making a new variable under each individual circumstance -EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue) -{ - if (potentialValue > *variable) - *variable = potentialValue; -} - -#endif #endif