- cleanup of the screentext consolidation

Since SetIfGreater is only used by the text code, the redundant copies could be removed.
This commit is contained in:
Christoph Oelckers 2020-03-05 01:17:31 +01:00
parent 822079abe0
commit 4788dc42fb
4 changed files with 2 additions and 23 deletions

View file

@ -763,14 +763,6 @@ inline int approxDist(int dx, int dy)
return dx+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 { class Rect {
public: public:
int x0, y0, x1, y1; int x0, y0, x1, y1;

View file

@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "screentext.h" #include "screentext.h"
#include "build.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) if (potentialValue > *variable)
*variable = potentialValue; *variable = potentialValue;

View file

@ -426,8 +426,6 @@ static inline int G_GetMusicIdx(const char *str)
extern void G_PrintCurrentMusic(void); extern void G_PrintCurrentMusic(void);
EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue);
template <typename T> template <typename T>
static inline int G_GetViewscreenSizeShift(T const *tspr) static inline int G_GetViewscreenSizeShift(T const *tspr)
{ {
@ -446,17 +444,6 @@ static inline int G_GetViewscreenSizeShift(T const *tspr)
#endif #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 #endif