diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 2578f1a60..f896e6988 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -2109,13 +2109,13 @@ static int PatchText (int oldSize) // This must be done because the map is scanned using a binary search. while (i > 0 && strncmp (DehSpriteMappings[i-1].Sprite, newStr, 4) > 0) { - swap (DehSpriteMappings[i-1], DehSpriteMappings[i]); + swapvalues (DehSpriteMappings[i-1], DehSpriteMappings[i]); --i; } while ((size_t)i < countof(DehSpriteMappings)-1 && strncmp (DehSpriteMappings[i+1].Sprite, newStr, 4) < 0) { - swap (DehSpriteMappings[i+1], DehSpriteMappings[i]); + swapvalues (DehSpriteMappings[i+1], DehSpriteMappings[i]); ++i; } break; diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index a51e8ad0c..cdac25902 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -68,7 +68,7 @@ void PClass::StaticInit () // MinGW's linker is linking the object files backwards for me now... if (head > tail) { - swap (head, tail); + swapvalues (head, tail); } qsort (head + 1, tail - head - 1, sizeof(REGINFO), cregcmp); diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index 345c42de8..bbf281b95 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -371,7 +371,7 @@ bool FNodeBuilder::CheckSubsectorOverlappingSegs (DWORD set, node_t &node, DWORD { if (Segs[seg2].linedef == -1) { // 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)); splitseg = DWORD_MAX; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index eb69c60be..03f3f9649 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1487,7 +1487,7 @@ void FBehavior::LoadScriptsDirectory () // Make the closed version the first one. 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) { - swap (max, min); + swapvalues (max, min); } return min + pr_acs(max - min + 1); @@ -3550,7 +3550,7 @@ int DLevelScript::RunScript () break; case PCD_SWAP: - swap(Stack[sp-2], Stack[sp-1]); + swapvalues(Stack[sp-2], Stack[sp-1]); break; case PCD_LSPEC1: diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index d3ddd8ddd..e982ea0d0 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -679,7 +679,7 @@ void P_DoNewChaseDir (AActor *actor, fixed_t deltax, fixed_t deltay) { if ((pr_newchasedir() > 200 || abs(deltay) > abs(deltax))) { - swap (d[1], d[2]); + swapvalues (d[1], d[2]); } if (d[1] == turnaround) @@ -997,7 +997,7 @@ void P_RandomChaseDir (AActor *actor) // try other directions if (pr_newchasedir() > 200 || abs(deltay) > abs(deltax)) { - swap (d[1], d[2]); + swapvalues (d[1], d[2]); } if (d[1] == turnaround) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 4b411fb26..8ade6cb13 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -2631,7 +2631,7 @@ static void P_CreateBlockMap () { if (bx > bx2) { - swap (block, endblock); + swapvalues (block, endblock); } do { @@ -2643,7 +2643,7 @@ static void P_CreateBlockMap () { if (by > by2) { - swap (block, endblock); + swapvalues (block, endblock); } do { diff --git a/src/p_switch.cpp b/src/p_switch.cpp index b7eeb784d..423633585 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -354,7 +354,7 @@ FSwitchDef *ParseSwitchDef (FScanner &sc, bool ignoreBad) max = sc.Number & 65535; if (min > max) { - swap (min, max); + swapvalues (min, max); } thisframe.Time = ((max - min + 1) << 16) | min; } diff --git a/src/r_anim.cpp b/src/r_anim.cpp index 7daeafd83..cac361866 100644 --- a/src/r_anim.cpp +++ b/src/r_anim.cpp @@ -202,7 +202,7 @@ void R_InitPicAnims (void) // [RH] Allow for backward animations as well as forward. if (pic1 > pic2) { - swap (pic1, pic2); + swapvalues (pic1, pic2); animtype = FAnimDef::ANIM_Backward; } @@ -548,7 +548,7 @@ static void ParseRangeAnim (FScanner &sc, FTextureID picnum, int usetype, bool m { type = FAnimDef::ANIM_Backward; TexMan[framenum]->bNoDecals = TexMan[picnum]->bNoDecals; - swap (framenum, picnum); + swapvalues (framenum, picnum); } if (sc.GetString()) { diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index da2eee749..5ba65cdd6 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -574,7 +574,7 @@ void R_AddLine (seg_t *line) int t = 256-WallTX1; WallTX1 = 256-WallTX2; WallTX2 = t; - swap (WallTY1, WallTY2); + swapvalues (WallTY1, WallTY2); } if (WallTX1 >= -WallTY1) @@ -651,7 +651,7 @@ void R_AddLine (seg_t *line) { // The seg is only part of the wall. if (line->linedef->sidedef[0] != line->sidedef) { - swap (v1, v2); + swapvalues (v1, v2); } tx1 = v1->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; rx1 = 256-rx2; rx2 = t; - swap (ry1, ry2); + swapvalues (ry1, ry2); } if (rx1 >= -ry1) diff --git a/src/r_drawt.cpp b/src/r_drawt.cpp index 671a977ec..fbfaf6307 100644 --- a/src/r_drawt.cpp +++ b/src/r_drawt.cpp @@ -1131,7 +1131,7 @@ void R_DrawMaskedColumnHoriz (const BYTE *column, const FTexture::Span *span) if (sprflipvert) { - swap (dc_yl, dc_yh); + swapvalues (dc_yl, dc_yh); } if (dc_yh >= mfloorclip[dc_x]) @@ -1205,8 +1205,8 @@ nextpost: // instead of bottom-to-top. while (front < back) { - swap (front[0], back[0]); - swap (front[1], back[1]); + swapvalues (front[0], back[0]); + swapvalues (front[1], back[1]); front += 2; back -= 2; } diff --git a/src/r_main.cpp b/src/r_main.cpp index ccc15e477..cbacb93a5 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -377,7 +377,7 @@ fixed_t R_PointToDist2 (fixed_t dx, fixed_t dy) if (dy > dx) { - swap (dx, dy); + swapvalues (dx, dy); } return FixedDiv (dx, finecosine[tantoangle[FixedDiv (dy, dx) >> DBITS] >> ANGLETOFINESHIFT]); diff --git a/src/r_polymost.cpp b/src/r_polymost.cpp index 3c9157d1b..663c8ae61 100644 --- a/src/r_polymost.cpp +++ b/src/r_polymost.cpp @@ -1204,7 +1204,7 @@ void RP_AddLine (seg_t *line) { // The seg is only part of the wall. if (line->linedef->sidedef[0] != line->sidedef) { - swap (v1, v2); + swapvalues (v1, v2); } tx1 = v1->x - viewx; tx2 = v2->x - viewx; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 88c918db2..d1983342f 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -2302,7 +2302,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, int t = 256-WallTX1; WallTX1 = 256-WallTX2; WallTX2 = t; - swap (WallTY1, WallTY2); + swapvalues (WallTY1, WallTY2); } if (WallTX1 >= -WallTY1) @@ -2433,11 +2433,11 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper, goto done; } - swap (x1, WallSX1); - swap (x2, WallSX2); + swapvalues (x1, WallSX1); + swapvalues (x2, WallSX2); PrepWall (swall, lwall, WallSpriteTile->GetWidth() << FRACBITS); - swap (x1, WallSX1); - swap (x2, WallSX2); + swapvalues (x1, WallSX1); + swapvalues (x2, WallSX2); if (flipx) { diff --git a/src/r_things.cpp b/src/r_things.cpp index 1750b3095..600354ced 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1020,7 +1020,7 @@ void R_DrawMaskedColumn (const BYTE *column, const FTexture::Span *span) if (sprflipvert) { - swap (dc_yl, dc_yh); + swapvalues (dc_yl, dc_yh); } if (dc_yh >= mfloorclip[dc_x]) diff --git a/src/r_translate.cpp b/src/r_translate.cpp index d5ef79a1f..eef8c1c1b 100644 --- a/src/r_translate.cpp +++ b/src/r_translate.cpp @@ -312,8 +312,8 @@ void FRemapTable::AddIndexRange(int start, int end, int pal1, int pal2) if (start > end) { - swap (start, end); - swap (pal1, pal2); + swapvalues (start, end); + swapvalues (pal1, pal2); } 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) { - swap (start, end); + swapvalues (start, end); r = r2; g = g2; b = b2; diff --git a/src/s_playlist.cpp b/src/s_playlist.cpp index e7170eaa8..ce82a8182 100644 --- a/src/s_playlist.cpp +++ b/src/s_playlist.cpp @@ -162,7 +162,7 @@ void FPlayList::Shuffle () for (i = 0; i < numsongs; ++i) { - swap (Songs[i], Songs[(rand() % (numsongs - i)) + i]); + swapvalues (Songs[i], Songs[(rand() % (numsongs - i)) + i]); } Position = 0; } diff --git a/src/templates.h b/src/templates.h index c3037456a..002bdeb3b 100644 --- a/src/templates.h +++ b/src/templates.h @@ -195,14 +195,14 @@ T clamp (const T in, const T min, const T max) //========================================================================== // -// swap +// swapvalues // // Swaps the values of a and b. //========================================================================== template inline -void swap (T &a, T &b) +void swapvalues (T &a, T &b) { T temp = a; a = b; b = temp; } diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 234d447c4..576c30de9 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -366,12 +366,12 @@ void FTexture::FlipSquareBlock (BYTE *block, int x, int y) if (count & 1) { count--; - swap (corner[count], corner[count*x]); + swapvalues (corner[count], corner[count*x]); } for (j = 0; j < count; j += 2) { - swap (corner[j], corner[j*x]); - swap (corner[j+1], corner[(j+1)*x]); + swapvalues (corner[j], corner[j*x]); + swapvalues (corner[j+1], corner[(j+1)*x]); } } } diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 2511b93a8..9440a05b0 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -1667,7 +1667,7 @@ ExpVal FxRandom::EvalExpression (AActor *self) if (maxval < minval) { - swap (maxval, minval); + swapvalues (maxval, minval); } val.Int = (*rng)(maxval - minval + 1) + minval; @@ -1714,7 +1714,7 @@ ExpVal FxFRandom::EvalExpression (AActor *self) if (maxval < minval) { - swap (maxval, minval); + swapvalues (maxval, minval); } val.Float = frandom * (maxval - minval) + minval; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index db620c5c7..0452cb951 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -1861,7 +1861,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, colorrange, I_I, PlayerPawn) PROP_INT_PARM(end, 1); if (start > end) - swap (start, end); + swapvalues (start, end); info->Class->Meta.SetMetaInt (APMETA_ColorRange, (start & 255) | ((end & 255) << 8)); } diff --git a/src/timidity/instrum_sf2.cpp b/src/timidity/instrum_sf2.cpp index 5064c9fe1..a455bbdee 100644 --- a/src/timidity/instrum_sf2.cpp +++ b/src/timidity/instrum_sf2.cpp @@ -1035,11 +1035,11 @@ void SFFile::CheckZones(int start, int stop, bool instr) // Check for swapped ranges. (Should we fix them or ignore them?) 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) { - swap(bag[i].VelRange.Lo, bag[i].VelRange.Hi); + swapvalues(bag[i].VelRange.Lo, bag[i].VelRange.Hi); } } } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 42b0b5145..3c2ed74d0 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -919,7 +919,7 @@ void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 real { // horizontal line if (x0 > x1) { - swap (x0, x1); + swapvalues (x0, x1); } memset (GetBuffer() + y0*GetPitch() + x0, palColor, deltaX+1); } diff --git a/src/v_palette.cpp b/src/v_palette.cpp index 231e160c0..3149f5df5 100644 --- a/src/v_palette.cpp +++ b/src/v_palette.cpp @@ -224,7 +224,7 @@ void FPalette::MakeGoodRemap () if (new0 > dup) { // Make the lower-numbered entry a copy of color 0. (Just because.) - swap (new0, dup); + swapvalues (new0, dup); } Remap[0] = new0; Remap[new0] = dup; diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 02da9910f..922c63a29 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -2967,7 +2967,7 @@ void STACK_ARGS D3DFB::DrawTextureV (FTexture *img, double x, double y, uint32 t if (parms.flipX) { - swap(u0, u1); + swapvalues(u0, u1); } 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) { quad.Flags &= ~BQF_InvertSource; - swap(start, end); + swapvalues(start, end); } quad.ShaderNum = BQS_SpecialColormap; color0 = D3DCOLOR_RGBA(DWORD(start[0]/2*255), DWORD(start[1]/2*255), DWORD(start[2]/2*255), color0 >> 24); diff --git a/src/win32/fb_d3d9_wipe.cpp b/src/win32/fb_d3d9_wipe.cpp index 9a3b34412..9024fa804 100644 --- a/src/win32/fb_d3d9_wipe.cpp +++ b/src/win32/fb_d3d9_wipe.cpp @@ -231,7 +231,7 @@ void D3DFB::WipeEndScreen() // waste time copying from TempRenderTexture to FinalWipeScreen. if (FinalWipeScreen != TempRenderTexture) { - swap(RenderTexture[CurrRenderTexture], FinalWipeScreen); + swapvalues(RenderTexture[CurrRenderTexture], FinalWipeScreen); TempRenderTexture = RenderTexture[CurrRenderTexture]; } diff --git a/src/win32/fb_ddraw.cpp b/src/win32/fb_ddraw.cpp index e440bd7f1..3a9b3d35e 100644 --- a/src/win32/fb_ddraw.cpp +++ b/src/win32/fb_ddraw.cpp @@ -774,7 +774,7 @@ void DDrawFB::RebuildColorTable () 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++) { diff --git a/src/win32/i_dijoy.cpp b/src/win32/i_dijoy.cpp index e21f77e25..89ddd1600 100644 --- a/src/win32/i_dijoy.cpp +++ b/src/win32/i_dijoy.cpp @@ -629,7 +629,7 @@ bool FDInputJoystick::ReorderAxisPair(const GUID &xid, const GUID &yid, int pos) } if (x == pos + 1 && y == pos) { // 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) { diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 04e2694d6..c8b496656 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -997,7 +997,7 @@ void I_PrintStr(const char *cp) if (edit != NULL) { // 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. format.cbSize = sizeof(format); format.dwMask = CFM_COLOR;