Rename min\max to avoid conflict with c-plus plus

While trying to compile the yquake2 rebased heretic2 source from 0lvin, a name conflict with min\max of different parameter counts included by a std::cpp library occurred.
This commit is contained in:
apartfromtime 2023-12-01 11:58:21 +11:00
parent 4967b9d0ca
commit 9ac19de4ac
4 changed files with 7 additions and 11 deletions

View file

@ -116,7 +116,7 @@ GL3_TextureMode(char *string)
/* Set anisotropic filter if supported and enabled */ /* Set anisotropic filter if supported and enabled */
if (gl3config.anisotropic && gl_anisotropic->value) if (gl3config.anisotropic && gl_anisotropic->value)
{ {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max(gl_anisotropic->value, 1.f)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, Q_max(gl_anisotropic->value, 1.f));
} }
} }
else /* texture has no mipmaps */ else /* texture has no mipmaps */
@ -227,7 +227,7 @@ GL3_Upload32(unsigned *data, int width, int height, qboolean mipmap)
if (mipmap && gl3config.anisotropic && gl_anisotropic->value) if (mipmap && gl3config.anisotropic && gl_anisotropic->value)
{ {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, max(gl_anisotropic->value, 1.f)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, Q_max(gl_anisotropic->value, 1.f));
} }
return res; return res;

View file

@ -235,7 +235,7 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
if (picupscale > 1) if (picupscale > 1)
{ {
int i; int i;
int pu = min(height-v, picupscale); int pu = Q_min(height-v, picupscale);
pixel_t *dest_orig = dest; pixel_t *dest_orig = dest;
// copy first line to fill whole sector // copy first line to fill whole sector

View file

@ -53,8 +53,8 @@ R_DrawSprite(entity_t *currententity, const model_t *currentmodel)
} }
r_polydesc.pixels = skin->pixels[0]; r_polydesc.pixels = skin->pixels[0];
r_polydesc.pixel_width = min(s_psprframe->width, skin->width); r_polydesc.pixel_width = Q_min(s_psprframe->width, skin->width);
r_polydesc.pixel_height = min(s_psprframe->height, skin->height); r_polydesc.pixel_height = Q_min(s_psprframe->height, skin->height);
r_polydesc.dist = 0; r_polydesc.dist = 0;
// generate the sprite's axes, completely parallel to the viewplane. // generate the sprite's axes, completely parallel to the viewplane.

View file

@ -124,12 +124,8 @@ typedef unsigned char byte;
#define YAW 1 /* left / right */ #define YAW 1 /* left / right */
#define ROLL 2 /* fall over */ #define ROLL 2 /* fall over */
#ifndef min #define Q_min(a, b) (((a) < (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b)) #define Q_max(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
#define MAX_STRING_CHARS 2048 /* max length of a string passed to Cmd_TokenizeString */ #define MAX_STRING_CHARS 2048 /* max length of a string passed to Cmd_TokenizeString */
#define MAX_STRING_TOKENS 80 /* max tokens resulting from Cmd_TokenizeString */ #define MAX_STRING_TOKENS 80 /* max tokens resulting from Cmd_TokenizeString */