SW: Fix types of min/max statements

Patch from Striker.

git-svn-id: https://svn.eduke32.com/eduke32@7501 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-04-08 06:25:42 +00:00 committed by Christoph Oelckers
parent 28ec01ef75
commit d842dc761d
6 changed files with 44 additions and 44 deletions

View file

@ -448,8 +448,8 @@ DoShadows(uspritetype * tsp, int viewz)
xrepeat = max(xrepeat - ground_dist - view_dist, 4);
yrepeat = max(yrepeat - ground_dist - view_dist, 4);
xrepeat = min(xrepeat, 255);
yrepeat = min(yrepeat, 255);
xrepeat = min(xrepeat, short(255));
yrepeat = min(yrepeat, short(255));
New->xrepeat = xrepeat;
New->yrepeat = yrepeat;

View file

@ -3812,8 +3812,8 @@ int32_t app_main(int32_t argc, char const * const * argv)
if (strlen(arg) > 1)
Skill = atoi(&arg[1])-1;
Skill = max(Skill,0);
Skill = min(Skill,3);
Skill = max(Skill,short(0));
Skill = min(Skill,short(3));
}
else if (Bstrncasecmp(arg, "commbat", 7) == 0)
{

View file

@ -404,8 +404,8 @@ int DoHornetMatchPlayerZ(short SpriteNum)
u->sz = bound;
}
u->sz = min(u->sz, loz - u->floor_dist);
u->sz = max(u->sz, hiz + u->ceiling_dist);
u->sz = min(long(u->sz), long(loz - u->floor_dist));
u->sz = max(long(u->sz), long(hiz + u->ceiling_dist));
u->Counter = (u->Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
sp->z = u->sz + ((HORNET_BOB_AMT * (long)sintable[u->Counter]) >> 14);

View file

@ -3636,8 +3636,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_MOUSESENSEMAX-1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_MOUSESENSEMAX-1));
slidersettings[sldr_mouse] = offset;
@ -3652,8 +3652,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_SNDFXVOLMAX-1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_SNDFXVOLMAX-1));
slidersettings[sldr_sndfxvolume] = offset;
gs.SoundVolume = FX_MIN + (offset * VOL_MUL);
@ -3666,8 +3666,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_MUSICVOLMAX-1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_MUSICVOLMAX-1));
slidersettings[sldr_musicvolume] = offset;
gs.MusicVolume = MUSIC_MIN + (offset * VOL_MUL);
@ -3689,8 +3689,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
////DSPRINTF(ds,"BorderNum %d",gs.BorderNum);
//MONO_PRINT(ds);
offset = max(offset, 0);
offset = min(offset, SLDR_SCRSIZEMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_SCRSIZEMAX - 1));
bnum = offset;
@ -3712,8 +3712,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_BRIGHTNESSMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_BRIGHTNESSMAX - 1));
slidersettings[sldr_brightness] = offset;
if (gs.Brightness != offset)
@ -3730,8 +3730,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_BORDERTILEMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_BORDERTILEMAX - 1));
slidersettings[sldr_bordertile] = offset;
if (gs.BorderTile != offset)
@ -3749,8 +3749,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_GAMETYPEMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_GAMETYPEMAX - 1));
slidersettings[sldr_gametype] = offset;
extra_text = gametype[offset];
@ -3767,8 +3767,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_NETLEVELMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_NETLEVELMAX - 1));
slidersettings[sldr_netlevel] = offset;
// Show the currently selected level on next line
@ -3786,8 +3786,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_MONSTERSMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_MONSTERSMAX - 1));
slidersettings[sldr_monsters] = offset;
extra_text = monsterskills[offset];
@ -3802,8 +3802,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_KILLLIMITMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_KILLLIMITMAX - 1));
slidersettings[sldr_killlimit] = offset;
if (offset == 0)
@ -3826,8 +3826,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_TIMELIMITMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_TIMELIMITMAX - 1));
slidersettings[sldr_timelimit] = offset;
if (offset == 0)
@ -3850,8 +3850,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, SLDR_PLAYERCOLORMAX - 1);
offset = max(offset, short(0));
offset = min(offset, short(SLDR_PLAYERCOLORMAX - 1));
slidersettings[sldr_playercolor] = offset;
extra_text = playercolors[offset];
@ -3913,8 +3913,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, barwidth-1);
offset = max(offset, short(0));
offset = min(offset, short(barwidth-1));
if (slidersettings[item->slider] != offset)
{
@ -3934,8 +3934,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, barwidth-1);
offset = max(offset, short(0));
offset = min(offset, short(barwidth-1));
if (slidersettings[item->slider] != offset)
{
@ -3958,8 +3958,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, barwidth-1);
offset = max(offset, short(0));
offset = min(offset, short(barwidth-1));
if (slidersettings[item->slider] != offset)
{
@ -3983,8 +3983,8 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
if (TEST(item->flags, mf_disabled))
break;
offset = max(offset, 0);
offset = min(offset, barwidth-1);
offset = max(offset, short(0));
offset = min(offset, short(barwidth-1));
if (slidersettings[item->slider] != offset)
{
@ -4024,7 +4024,7 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
knobx = x;
// Draw the in between sections
for (i = 0; i < min(barwidth,MAX_SLDR_WIDTH); i++)
for (i = 0; i < min(barwidth, short(MAX_SLDR_WIDTH)); i++)
{
rotatesprite(x << 16, y << 16, MZ, 0, pic_slidebar, shade, 0, MenuDrawFlags, 0, 0, xdim - 1, ydim - 1);
x += tilesiz[pic_slidebar].x;

View file

@ -7278,7 +7278,7 @@ pWeaponBob(PANEL_SPRITEp psp, short condition)
bobvel = FindDistance2D(pp->xvect, pp->yvect) >> 15;
bobvel = bobvel + DIV4(bobvel);
bobvel = min(bobvel, 128);
bobvel = min(bobvel, short(128));
if (condition)
{

View file

@ -162,10 +162,10 @@ WallSetup(void)
wall[i].picnum = FAF_MIRROR_PIC+1;
// get map min and max coordinates
x_min_bound = min(wp->x, x_min_bound);
y_min_bound = min(wp->y, y_min_bound);
x_max_bound = max(wp->x, x_max_bound);
y_max_bound = max(wp->y, y_max_bound);
x_min_bound = min(TrackerCast(wp->x), x_min_bound);
y_min_bound = min(TrackerCast(wp->y), y_min_bound);
x_max_bound = max(TrackerCast(wp->x), x_max_bound);
y_max_bound = max(TrackerCast(wp->y), y_max_bound);
// this overwrites the lotag so it needs to be called LAST - its down there
// SetupWallForBreak(wp);