- 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;
}
// 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;

View file

@ -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:

View file

@ -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;

View file

@ -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 <typename T>
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