- added Firebrand's patch to rename 'swap' due to naming conflicts in newer MSVC compilers.

SVN r2449 (trunk)
This commit is contained in:
Christoph Oelckers 2010-07-23 21:19:59 +00:00
parent 4ac64b6df7
commit 545a892faa
28 changed files with 50 additions and 50 deletions

View file

@ -2109,13 +2109,13 @@ static int PatchText (int oldSize)
// This must be done because the map is scanned using a binary search. // This must be done because the map is scanned using a binary search.
while (i > 0 && strncmp (DehSpriteMappings[i-1].Sprite, newStr, 4) > 0) while (i > 0 && strncmp (DehSpriteMappings[i-1].Sprite, newStr, 4) > 0)
{ {
swap (DehSpriteMappings[i-1], DehSpriteMappings[i]); swapvalues (DehSpriteMappings[i-1], DehSpriteMappings[i]);
--i; --i;
} }
while ((size_t)i < countof(DehSpriteMappings)-1 && while ((size_t)i < countof(DehSpriteMappings)-1 &&
strncmp (DehSpriteMappings[i+1].Sprite, newStr, 4) < 0) strncmp (DehSpriteMappings[i+1].Sprite, newStr, 4) < 0)
{ {
swap (DehSpriteMappings[i+1], DehSpriteMappings[i]); swapvalues (DehSpriteMappings[i+1], DehSpriteMappings[i]);
++i; ++i;
} }
break; break;

View file

@ -68,7 +68,7 @@ void PClass::StaticInit ()
// MinGW's linker is linking the object files backwards for me now... // MinGW's linker is linking the object files backwards for me now...
if (head > tail) if (head > tail)
{ {
swap (head, tail); swapvalues (head, tail);
} }
qsort (head + 1, tail - head - 1, sizeof(REGINFO), cregcmp); qsort (head + 1, tail - head - 1, sizeof(REGINFO), cregcmp);

View file

@ -371,7 +371,7 @@ bool FNodeBuilder::CheckSubsectorOverlappingSegs (DWORD set, node_t &node, DWORD
{ {
if (Segs[seg2].linedef == -1) if (Segs[seg2].linedef == -1)
{ // Do not put minisegs into a new subsector. { // Do not put minisegs into a new subsector.
swap (seg1, seg2); swapvalues (seg1, seg2);
} }
D(Printf(PRINT_LOG, "Need to synthesize a splitter for set %d on seg %d (ov)\n", set, seg2)); D(Printf(PRINT_LOG, "Need to synthesize a splitter for set %d on seg %d (ov)\n", set, seg2));
splitseg = DWORD_MAX; splitseg = DWORD_MAX;

View file

@ -1487,7 +1487,7 @@ void FBehavior::LoadScriptsDirectory ()
// Make the closed version the first one. // Make the closed version the first one.
if (Scripts[i+1].Type == SCRIPT_Closed) if (Scripts[i+1].Type == SCRIPT_Closed)
{ {
swap(Scripts[i], Scripts[i+1]); swapvalues(Scripts[i], Scripts[i+1]);
} }
} }
} }
@ -2051,7 +2051,7 @@ int DLevelScript::Random (int min, int max)
{ {
if (max < min) if (max < min)
{ {
swap (max, min); swapvalues (max, min);
} }
return min + pr_acs(max - min + 1); return min + pr_acs(max - min + 1);
@ -3550,7 +3550,7 @@ int DLevelScript::RunScript ()
break; break;
case PCD_SWAP: case PCD_SWAP:
swap(Stack[sp-2], Stack[sp-1]); swapvalues(Stack[sp-2], Stack[sp-1]);
break; break;
case PCD_LSPEC1: case PCD_LSPEC1:

View file

@ -679,7 +679,7 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay)
{ {
if ((pr_newchasedir() > 200 || abs(deltay) > abs(deltax))) if ((pr_newchasedir() > 200 || abs(deltay) > abs(deltax)))
{ {
swap (d[1], d[2]); swapvalues (d[1], d[2]);
} }
if (d[1] == turnaround) if (d[1] == turnaround)
@ -997,7 +997,7 @@ void P_RandomChaseDir (AActor *actor)
// try other directions // try other directions
if (pr_newchasedir() > 200 || abs(deltay) > abs(deltax)) if (pr_newchasedir() > 200 || abs(deltay) > abs(deltax))
{ {
swap (d[1], d[2]); swapvalues (d[1], d[2]);
} }
if (d[1] == turnaround) if (d[1] == turnaround)

View file

@ -2631,7 +2631,7 @@ static void P_CreateBlockMap ()
{ {
if (bx > bx2) if (bx > bx2)
{ {
swap (block, endblock); swapvalues (block, endblock);
} }
do do
{ {
@ -2643,7 +2643,7 @@ static void P_CreateBlockMap ()
{ {
if (by > by2) if (by > by2)
{ {
swap (block, endblock); swapvalues (block, endblock);
} }
do do
{ {

View file

@ -354,7 +354,7 @@ FSwitchDef *ParseSwitchDef (FScanner &sc, bool ignoreBad)
max = sc.Number & 65535; max = sc.Number & 65535;
if (min > max) if (min > max)
{ {
swap (min, max); swapvalues (min, max);
} }
thisframe.Time = ((max - min + 1) << 16) | min; thisframe.Time = ((max - min + 1) << 16) | min;
} }

View file

@ -202,7 +202,7 @@ void R_InitPicAnims (void)
// [RH] Allow for backward animations as well as forward. // [RH] Allow for backward animations as well as forward.
if (pic1 > pic2) if (pic1 > pic2)
{ {
swap (pic1, pic2); swapvalues (pic1, pic2);
animtype = FAnimDef::ANIM_Backward; animtype = FAnimDef::ANIM_Backward;
} }
@ -548,7 +548,7 @@ static void ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool m
{ {
type = FAnimDef::ANIM_Backward; type = FAnimDef::ANIM_Backward;
TexMan[framenum]->bNoDecals = TexMan[picnum]->bNoDecals; TexMan[framenum]->bNoDecals = TexMan[picnum]->bNoDecals;
swap (framenum, picnum); swapvalues (framenum, picnum);
} }
if (sc.GetString()) if (sc.GetString())
{ {

View file

@ -574,7 +574,7 @@ void R_AddLine (seg_t *line)
int t = 256-WallTX1; int t = 256-WallTX1;
WallTX1 = 256-WallTX2; WallTX1 = 256-WallTX2;
WallTX2 = t; WallTX2 = t;
swap (WallTY1, WallTY2); swapvalues (WallTY1, WallTY2);
} }
if (WallTX1 >= -WallTY1) if (WallTX1 >= -WallTY1)
@ -651,7 +651,7 @@ void R_AddLine (seg_t *line)
{ // The seg is only part of the wall. { // The seg is only part of the wall.
if (line->linedef->sidedef[0] != line->sidedef) if (line->linedef->sidedef[0] != line->sidedef)
{ {
swap (v1, v2); swapvalues (v1, v2);
} }
tx1 = v1->x - viewx; tx1 = v1->x - viewx;
tx2 = v2->x - viewx; tx2 = v2->x - viewx;
@ -901,7 +901,7 @@ static bool R_CheckBBox (fixed_t *bspcoord) // killough 1/28/98: static
int t = 256-rx1; int t = 256-rx1;
rx1 = 256-rx2; rx1 = 256-rx2;
rx2 = t; rx2 = t;
swap (ry1, ry2); swapvalues (ry1, ry2);
} }
if (rx1 >= -ry1) if (rx1 >= -ry1)

View file

@ -1131,7 +1131,7 @@ void R_DrawMaskedColumnHoriz (const BYTE *column, const FTexture::Span *span)
if (sprflipvert) if (sprflipvert)
{ {
swap (dc_yl, dc_yh); swapvalues (dc_yl, dc_yh);
} }
if (dc_yh >= mfloorclip[dc_x]) if (dc_yh >= mfloorclip[dc_x])
@ -1205,8 +1205,8 @@ nextpost:
// instead of bottom-to-top. // instead of bottom-to-top.
while (front < back) while (front < back)
{ {
swap (front[0], back[0]); swapvalues (front[0], back[0]);
swap (front[1], back[1]); swapvalues (front[1], back[1]);
front += 2; front += 2;
back -= 2; back -= 2;
} }

View file

@ -377,7 +377,7 @@ fixed_t R_PointToDist2 (fixed_t dx, fixed_t dy)
if (dy > dx) if (dy > dx)
{ {
swap (dx, dy); swapvalues (dx, dy);
} }
return FixedDiv (dx, finecosine[tantoangle[FixedDiv (dy, dx) >> DBITS] >> ANGLETOFINESHIFT]); return FixedDiv (dx, finecosine[tantoangle[FixedDiv (dy, dx) >> DBITS] >> ANGLETOFINESHIFT]);

View file

@ -1204,7 +1204,7 @@ void RP_AddLine (seg_t *line)
{ // The seg is only part of the wall. { // The seg is only part of the wall.
if (line->linedef->sidedef[0] != line->sidedef) if (line->linedef->sidedef[0] != line->sidedef)
{ {
swap (v1, v2); swapvalues (v1, v2);
} }
tx1 = v1->x - viewx; tx1 = v1->x - viewx;
tx2 = v2->x - viewx; tx2 = v2->x - viewx;

View file

@ -2302,7 +2302,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
int t = 256-WallTX1; int t = 256-WallTX1;
WallTX1 = 256-WallTX2; WallTX1 = 256-WallTX2;
WallTX2 = t; WallTX2 = t;
swap (WallTY1, WallTY2); swapvalues (WallTY1, WallTY2);
} }
if (WallTX1 >= -WallTY1) if (WallTX1 >= -WallTY1)
@ -2433,11 +2433,11 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
goto done; goto done;
} }
swap (x1, WallSX1); swapvalues (x1, WallSX1);
swap (x2, WallSX2); swapvalues (x2, WallSX2);
PrepWall (swall, lwall, WallSpriteTile->GetWidth() << FRACBITS); PrepWall (swall, lwall, WallSpriteTile->GetWidth() << FRACBITS);
swap (x1, WallSX1); swapvalues (x1, WallSX1);
swap (x2, WallSX2); swapvalues (x2, WallSX2);
if (flipx) if (flipx)
{ {

View file

@ -1020,7 +1020,7 @@ void R_DrawMaskedColumn (const BYTE *column, const FTexture::Span *span)
if (sprflipvert) if (sprflipvert)
{ {
swap (dc_yl, dc_yh); swapvalues (dc_yl, dc_yh);
} }
if (dc_yh >= mfloorclip[dc_x]) if (dc_yh >= mfloorclip[dc_x])

View file

@ -312,8 +312,8 @@ void FRemapTable::AddIndexRange(int start, int end, int pal1, int pal2)
if (start > end) if (start > end)
{ {
swap (start, end); swapvalues (start, end);
swap (pal1, pal2); swapvalues (pal1, pal2);
} }
else if (start == end) else if (start == end)
{ {
@ -354,7 +354,7 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
if (start > end) if (start > end)
{ {
swap (start, end); swapvalues (start, end);
r = r2; r = r2;
g = g2; g = g2;
b = b2; b = b2;

View file

@ -162,7 +162,7 @@ void FPlayList::Shuffle ()
for (i = 0; i < numsongs; ++i) for (i = 0; i < numsongs; ++i)
{ {
swap (Songs[i], Songs[(rand() % (numsongs - i)) + i]); swapvalues (Songs[i], Songs[(rand() % (numsongs - i)) + i]);
} }
Position = 0; Position = 0;
} }

View file

@ -195,14 +195,14 @@ T clamp (const T in, const T min, const T max)
//========================================================================== //==========================================================================
// //
// swap // swapvalues
// //
// Swaps the values of a and b. // Swaps the values of a and b.
//========================================================================== //==========================================================================
template<class T> template<class T>
inline inline
void swap (T &a, T &b) void swapvalues (T &a, T &b)
{ {
T temp = a; a = b; b = temp; T temp = a; a = b; b = temp;
} }

View file

@ -366,12 +366,12 @@ void FTexture::FlipSquareBlock (BYTE *block, int x, int y)
if (count & 1) if (count & 1)
{ {
count--; count--;
swap<BYTE> (corner[count], corner[count*x]); swapvalues<BYTE> (corner[count], corner[count*x]);
} }
for (j = 0; j < count; j += 2) for (j = 0; j < count; j += 2)
{ {
swap<BYTE> (corner[j], corner[j*x]); swapvalues<BYTE> (corner[j], corner[j*x]);
swap<BYTE> (corner[j+1], corner[(j+1)*x]); swapvalues<BYTE> (corner[j+1], corner[(j+1)*x]);
} }
} }
} }

View file

@ -1667,7 +1667,7 @@ ExpVal FxRandom::EvalExpression (AActor *self)
if (maxval < minval) if (maxval < minval)
{ {
swap (maxval, minval); swapvalues (maxval, minval);
} }
val.Int = (*rng)(maxval - minval + 1) + minval; val.Int = (*rng)(maxval - minval + 1) + minval;
@ -1714,7 +1714,7 @@ ExpVal FxFRandom::EvalExpression (AActor *self)
if (maxval < minval) if (maxval < minval)
{ {
swap (maxval, minval); swapvalues (maxval, minval);
} }
val.Float = frandom * (maxval - minval) + minval; val.Float = frandom * (maxval - minval) + minval;

View file

@ -1861,7 +1861,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, colorrange, I_I, PlayerPawn)
PROP_INT_PARM(end, 1); PROP_INT_PARM(end, 1);
if (start > end) if (start > end)
swap (start, end); swapvalues (start, end);
info->Class->Meta.SetMetaInt (APMETA_ColorRange, (start & 255) | ((end & 255) << 8)); info->Class->Meta.SetMetaInt (APMETA_ColorRange, (start & 255) | ((end & 255) << 8));
} }

View file

@ -1035,11 +1035,11 @@ void SFFile::CheckZones(int start, int stop, bool instr)
// Check for swapped ranges. (Should we fix them or ignore them?) // Check for swapped ranges. (Should we fix them or ignore them?)
if (bag[i].KeyRange.Lo > bag[i].KeyRange.Hi) if (bag[i].KeyRange.Lo > bag[i].KeyRange.Hi)
{ {
swap(bag[i].KeyRange.Lo, bag[i].KeyRange.Hi); swapvalues(bag[i].KeyRange.Lo, bag[i].KeyRange.Hi);
} }
if (bag[i].VelRange.Lo > bag[i].VelRange.Hi) if (bag[i].VelRange.Lo > bag[i].VelRange.Hi)
{ {
swap(bag[i].VelRange.Lo, bag[i].VelRange.Hi); swapvalues(bag[i].VelRange.Lo, bag[i].VelRange.Hi);
} }
} }
} }

View file

@ -919,7 +919,7 @@ void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 real
{ // horizontal line { // horizontal line
if (x0 > x1) if (x0 > x1)
{ {
swap (x0, x1); swapvalues (x0, x1);
} }
memset (GetBuffer() + y0*GetPitch() + x0, palColor, deltaX+1); memset (GetBuffer() + y0*GetPitch() + x0, palColor, deltaX+1);
} }

View file

@ -224,7 +224,7 @@ void FPalette::MakeGoodRemap ()
if (new0 > dup) if (new0 > dup)
{ {
// Make the lower-numbered entry a copy of color 0. (Just because.) // Make the lower-numbered entry a copy of color 0. (Just because.)
swap (new0, dup); swapvalues (new0, dup);
} }
Remap[0] = new0; Remap[0] = new0;
Remap[new0] = dup; Remap[new0] = dup;

View file

@ -2967,7 +2967,7 @@ void STACK_ARGS D3DFB::DrawTextureV (FTexture *img, double x, double y, uint32 t
if (parms.flipX) if (parms.flipX)
{ {
swap(u0, u1); swapvalues(u0, u1);
} }
if (parms.windowleft > 0 || parms.windowright < parms.texwidth) if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
{ {
@ -3640,7 +3640,7 @@ bool D3DFB::SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &
if (quad.Flags & BQF_InvertSource) if (quad.Flags & BQF_InvertSource)
{ {
quad.Flags &= ~BQF_InvertSource; quad.Flags &= ~BQF_InvertSource;
swap(start, end); swapvalues(start, end);
} }
quad.ShaderNum = BQS_SpecialColormap; quad.ShaderNum = BQS_SpecialColormap;
color0 = D3DCOLOR_RGBA(DWORD(start[0]/2*255), DWORD(start[1]/2*255), DWORD(start[2]/2*255), color0 >> 24); color0 = D3DCOLOR_RGBA(DWORD(start[0]/2*255), DWORD(start[1]/2*255), DWORD(start[2]/2*255), color0 >> 24);

View file

@ -231,7 +231,7 @@ void D3DFB::WipeEndScreen()
// waste time copying from TempRenderTexture to FinalWipeScreen. // waste time copying from TempRenderTexture to FinalWipeScreen.
if (FinalWipeScreen != TempRenderTexture) if (FinalWipeScreen != TempRenderTexture)
{ {
swap(RenderTexture[CurrRenderTexture], FinalWipeScreen); swapvalues(RenderTexture[CurrRenderTexture], FinalWipeScreen);
TempRenderTexture = RenderTexture[CurrRenderTexture]; TempRenderTexture = RenderTexture[CurrRenderTexture];
} }

View file

@ -774,7 +774,7 @@ void DDrawFB::RebuildColorTable ()
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
swap (syspal[i].peRed, syspal[i].peBlue); swapvalues (syspal[i].peRed, syspal[i].peBlue);
} }
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {

View file

@ -629,7 +629,7 @@ bool FDInputJoystick::ReorderAxisPair(const GUID &xid, const GUID &yid, int pos)
} }
if (x == pos + 1 && y == pos) if (x == pos + 1 && y == pos)
{ // Xbox 360 Controllers return them in this order. { // Xbox 360 Controllers return them in this order.
swap(Axes[pos], Axes[pos + 1]); swapvalues(Axes[pos], Axes[pos + 1]);
} }
else if (x != pos || y != pos + 1) else if (x != pos || y != pos + 1)
{ {

View file

@ -997,7 +997,7 @@ void I_PrintStr(const char *cp)
if (edit != NULL) if (edit != NULL)
{ {
// GDI uses BGR colors, but color is RGB, so swap the R and the B. // GDI uses BGR colors, but color is RGB, so swap the R and the B.
swap(color.r, color.b); swapvalues(color.r, color.b);
// Change the color. // Change the color.
format.cbSize = sizeof(format); format.cbSize = sizeof(format);
format.dwMask = CFM_COLOR; format.dwMask = CFM_COLOR;