diff --git a/src/engine/bih.cpp b/src/engine/bih.cpp index 8b8ebc1fd..9acc79ce4 100644 --- a/src/engine/bih.cpp +++ b/src/engine/bih.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include #include "engine.h" @@ -205,7 +202,7 @@ void BIH::build(mesh &m, ushort *indices, int numindices, const ivec &vmin, cons else { --right; - swap(indices[left], indices[right]); + std::swap(indices[left], indices[right]); splitright = min(splitright, amin); rightmin.min(trimin); rightmax.max(trimax); diff --git a/src/engine/blend.cpp b/src/engine/blend.cpp index 09b90fee9..691325ee5 100644 --- a/src/engine/blend.cpp +++ b/src/engine/blend.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include #include "engine.h" @@ -520,7 +517,7 @@ struct BlendBrush } dst += stridey; } - if(swapxy) swap(w, h); + if(swapxy) std::swap(w, h); delete[] data; data = rdata; if(tex) gentex(); diff --git a/src/engine/blob.cpp b/src/engine/blob.cpp index 0c967907b..49dfec003 100644 --- a/src/engine/blob.cpp +++ b/src/engine/blob.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" extern int intel_mapbufferrange_bug; diff --git a/src/engine/client.cpp b/src/engine/client.cpp index f48c1af21..9923bca24 100644 --- a/src/engine/client.cpp +++ b/src/engine/client.cpp @@ -1,7 +1,4 @@ // client.cpp, mostly network related client game code -#include -using std::swap; - #include "engine.h" ENetHost *clienthost = NULL; diff --git a/src/engine/command.cpp b/src/engine/command.cpp index c7894961e..705e9577c 100644 --- a/src/engine/command.cpp +++ b/src/engine/command.cpp @@ -2,9 +2,7 @@ // is largely backwards compatible with the quake console language. #include -#include #include -using std::swap; #include "engine.h" bool interactive = false; diff --git a/src/engine/console.cpp b/src/engine/console.cpp index 8866cba0d..5cabee887 100644 --- a/src/engine/console.cpp +++ b/src/engine/console.cpp @@ -1,7 +1,5 @@ // console.cpp: the console buffer, its display, and command line control -#include #include -using std::swap; #include "engine.h" #include "game.h" diff --git a/src/engine/decal.cpp b/src/engine/decal.cpp index 6adf3aa9d..1a296118d 100644 --- a/src/engine/decal.cpp +++ b/src/engine/decal.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" struct decalvert diff --git a/src/engine/dynlight.cpp b/src/engine/dynlight.cpp index c6796cee4..40595408f 100644 --- a/src/engine/dynlight.cpp +++ b/src/engine/dynlight.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" VAR(IDF_PERSIST, maxdynlights, 0, min(3, MAXDYNLIGHTS), MAXDYNLIGHTS); diff --git a/src/engine/genkey.cpp b/src/engine/genkey.cpp index f833f89d6..fe21ca187 100644 --- a/src/engine/genkey.cpp +++ b/src/engine/genkey.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include #include #include diff --git a/src/engine/glare.cpp b/src/engine/glare.cpp index 657839a34..23ffdaa26 100644 --- a/src/engine/glare.cpp +++ b/src/engine/glare.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" #include "rendertarget.h" diff --git a/src/engine/grass.cpp b/src/engine/grass.cpp index af7d34588..3eb4861fa 100644 --- a/src/engine/grass.cpp +++ b/src/engine/grass.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" VAR(IDF_PERSIST, grass, 0, 0, 1); diff --git a/src/engine/irc.cpp b/src/engine/irc.cpp index 8bfed7298..e06927f1c 100644 --- a/src/engine/irc.cpp +++ b/src/engine/irc.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" VAR(0, ircfilter, 0, 2, 2); diff --git a/src/engine/lightmap.cpp b/src/engine/lightmap.cpp index bfcc5961a..a575e74bc 100644 --- a/src/engine/lightmap.cpp +++ b/src/engine/lightmap.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" #define MAXLIGHTMAPTASKS 4096 @@ -695,7 +692,7 @@ static inline void generatealpha(lightmapworker *w, float tolerance, const vec & float k = 8.0f/w->vslot->scale, s = (pos[sdim[dim]] * k - w->vslot->offset.x) / w->slot->layermaskscale, t = (pos[tdim[dim]] * (dim <= 1 ? -k : k) - w->vslot->offset.y) / w->slot->layermaskscale; - if((w->rotate&5)==1) swap(s, t); + if((w->rotate&5)==1) std::swap(s, t); if(w->rotate>=2 && w->rotate<=4) s = -s; if((w->rotate>=1 && w->rotate<=2) || w->rotate==5) t = -t; const ImageData &mask = *w->slot->layermask; @@ -863,7 +860,7 @@ static int finishlightmap(lightmapworker *w) if((hasskylight() || sunlights.length()) && blurskylight && (w->w>1 || w->h>1)) { blurtexture(blurskylight, w->bpp, w->w, w->h, w->blur, w->ambient); - swap(w->blur, w->ambient); + std::swap(w->blur, w->ambient); } vec *sample = w->colordata; int aasample = min(1 << lmaa, 4), stride = aasample*(w->w+1); @@ -2300,7 +2297,7 @@ static void rotatenormals(LightMap &lmlv, int x, int y, int w, int h, int rotate { if(flipx) lv[0] = 255 - lv[0]; if(flipy) lv[1] = 255 - lv[1]; - if(swapxy) swap(lv[0], lv[1]); + if(swapxy) std::swap(lv[0], lv[1]); lv += 3; } lv += stride; diff --git a/src/engine/main.cpp b/src/engine/main.cpp index e29f6a57c..f59f07213 100644 --- a/src/engine/main.cpp +++ b/src/engine/main.cpp @@ -1,7 +1,4 @@ // main.cpp: initialisation & main loop -#include -using std::swap; - #include "engine.h" #include diff --git a/src/engine/master.cpp b/src/engine/master.cpp index 1dc6e7227..a00fe407b 100644 --- a/src/engine/master.cpp +++ b/src/engine/master.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #ifdef WIN32 #define FD_SETSIZE 4096 #else diff --git a/src/engine/material.cpp b/src/engine/material.cpp index 2b645e40a..3a857c6b8 100644 --- a/src/engine/material.cpp +++ b/src/engine/material.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" struct QuadNode @@ -512,9 +509,9 @@ void sortmaterials(vector &vismats) if(reflecting) sortorigin.z = int(reflectz - (camera1->o.z - reflectz)); vec dir(camera1->yaw*RAD, reflecting ? -camera1->pitch : camera1->pitch); loopi(3) { dir[i] = fabs(dir[i]); sortdim[i] = i; } - if(dir[sortdim[2]] > dir[sortdim[1]]) swap(sortdim[2], sortdim[1]); - if(dir[sortdim[1]] > dir[sortdim[0]]) swap(sortdim[1], sortdim[0]); - if(dir[sortdim[2]] > dir[sortdim[1]]) swap(sortdim[2], sortdim[1]); + if(dir[sortdim[2]] > dir[sortdim[1]]) std::swap(sortdim[2], sortdim[1]); + if(dir[sortdim[1]] > dir[sortdim[0]]) std::swap(sortdim[1], sortdim[0]); + if(dir[sortdim[2]] > dir[sortdim[1]]) std::swap(sortdim[2], sortdim[1]); for(vtxarray *va = reflecting ? reflectedva : visibleva; va; va = reflecting ? va->rnext : va->next) { diff --git a/src/engine/menus.cpp b/src/engine/menus.cpp index da4cac2ad..faa3f08e9 100644 --- a/src/engine/menus.cpp +++ b/src/engine/menus.cpp @@ -1,7 +1,4 @@ // menus.cpp: ingame menu system (also used for scores and serverlist) -#include -using std::swap; - #include "engine.h" VAR(0, guipasses, 1, -1, -1); diff --git a/src/engine/mpr.h b/src/engine/mpr.h index 380ac5b88..6c7577920 100644 --- a/src/engine/mpr.h +++ b/src/engine/mpr.h @@ -295,7 +295,7 @@ namespace mpr // If the origin is on the - side of the plane, reverse the direction of the plane if(n.dot(v0) > 0) { - swap(v1, v2); + std::swap(v1, v2); n.neg(); } @@ -415,9 +415,9 @@ namespace mpr // If the origin is on the - side of the plane, reverse the direction of the plane if(n.dot(v0) > 0) { - swap(v1, v2); - swap(v11, v21); - swap(v12, v22); + std::swap(v1, v2); + std::swap(v11, v21); + std::swap(v12, v22); n.neg(); } diff --git a/src/engine/normal.cpp b/src/engine/normal.cpp index b29e29f26..c5328ce02 100644 --- a/src/engine/normal.cpp +++ b/src/engine/normal.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "engine.h" struct normalgroup diff --git a/src/engine/octa.cpp b/src/engine/octa.cpp index 953b392de..4b80c1e7e 100644 --- a/src/engine/octa.cpp +++ b/src/engine/octa.cpp @@ -1,7 +1,4 @@ // core world management routines -#include -using std::swap; - #include "engine.h" cube *worldroot = newcubes(F_SOLID); @@ -1645,7 +1642,7 @@ bool mergepolys(int orient, hashset &links, vector &queue, int o { pedge e(p.verts[prev], p.verts[j]); int order = e.from.x > e.to.x || (e.from.x == e.to.x && e.from.y > e.to.y) ? 1 : 0; - if(order) swap(e.from, e.to); + if(order) std::swap(e.from, e.to); plink &l = links.access(e, e); bool shouldqueue = l.polys[order] < 0 && l.polys[order^1] >= 0; l.polys[order] = owner; @@ -1733,7 +1730,7 @@ void mergepolys(int orient, const ivec &co, const ivec &n, int offset, vector e.to.x || (e.from.x == e.to.x && e.from.y > e.to.y) ? 1 : 0; - if(order) swap(e.from, e.to); + if(order) std::swap(e.from, e.to); plink &l = links.access(e, e); l.polys[order] = i; if(l.polys[0] >= 0 && l.polys[1] >= 0) queue.add(&l); diff --git a/src/engine/octaedit.cpp b/src/engine/octaedit.cpp index 19c0ad6d5..e084818ad 100644 --- a/src/engine/octaedit.cpp +++ b/src/engine/octaedit.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include #include "engine.h" @@ -223,7 +221,7 @@ COMMAND(0, selextend, ""); ICOMMAND(0, selmoved, "", (), { if(noedit(true)) return; intret(sel.o != savedsel.o ? 1 : 0); }); ICOMMAND(0, selsave, "", (), { if(noedit(true)) return; savedsel = sel; }); ICOMMAND(0, selrestore, "", (), { if(noedit(true)) return; sel = savedsel; }); -ICOMMAND(0, selswap, "", (), { if(noedit(true)) return; swap(sel, savedsel); }); +ICOMMAND(0, selswap, "", (), { if(noedit(true)) return; std::swap(sel, savedsel); }); ///////// selection support ///////////// @@ -2613,13 +2611,13 @@ uint mflip(uint face) { return (face&0xFF0000FF) | ((face&0x00FF0000)>>8) | ((fa void flipcube(cube &c, int d) { - swap(c.texture[d*2], c.texture[d*2+1]); + std::swap(c.texture[d*2], c.texture[d*2+1]); c.faces[D[d]] = dflip(c.faces[D[d]]); c.faces[C[d]] = cflip(c.faces[C[d]]); c.faces[R[d]] = rflip(c.faces[R[d]]); if(c.children) { - loopi(8) if(i&octadim(d)) swap(c.children[i], c.children[i-octadim(d)]); + loopi(8) if(i&octadim(d)) std::swap(c.children[i], c.children[i-octadim(d)]); loopi(8) flipcube(c.children[i], d); } } @@ -2634,11 +2632,11 @@ void rotatecube(cube &c, int d) // rotates cube clockwise. see pics in cvs for h c.faces[D[d]] = cflip (mflip(c.faces[D[d]])); c.faces[C[d]] = dflip (mflip(c.faces[C[d]])); c.faces[R[d]] = rflip (mflip(c.faces[R[d]])); - swap(c.faces[R[d]], c.faces[C[d]]); + std::swap(c.faces[R[d]], c.faces[C[d]]); - swap(c.texture[2*R[d]], c.texture[2*C[d]+1]); - swap(c.texture[2*C[d]], c.texture[2*R[d]+1]); - swap(c.texture[2*C[d]], c.texture[2*C[d]+1]); + std::swap(c.texture[2*R[d]], c.texture[2*C[d]+1]); + std::swap(c.texture[2*C[d]], c.texture[2*R[d]+1]); + std::swap(c.texture[2*C[d]], c.texture[2*C[d]+1]); if(c.children) { @@ -2670,7 +2668,7 @@ void mpflip(selinfo &sel, bool local) { cube &a = selcube(x, y, z); cube &b = selcube(x, y, zs-z-1); - swap(a, b); + std::swap(a, b); } } changed(sel); @@ -3003,7 +3001,7 @@ void rendertexturepanel(int w, int h) float xoff = vslot.offset.x, yoff = vslot.offset.y; if(vslot.rotation) { - if((vslot.rotation&5) == 1) { swap(xoff, yoff); loopk(4) swap(tc[k].x, tc[k].y); } + if((vslot.rotation&5) == 1) { std::swap(xoff, yoff); loopk(4) std::swap(tc[k].x, tc[k].y); } if(vslot.rotation >= 2 && vslot.rotation <= 4) { xoff *= -1; loopk(4) tc[k].x *= -1; } if(vslot.rotation <= 2 || vslot.rotation == 5) { yoff *= -1; loopk(4) tc[k].y *= -1; } } diff --git a/src/engine/octarender.cpp b/src/engine/octarender.cpp index 317690049..adc18e346 100644 --- a/src/engine/octarender.cpp +++ b/src/engine/octarender.cpp @@ -1,7 +1,4 @@ // octarender.cpp: fill vertex arrays with different cube surfaces. -#include -using std::swap; - #include "engine.h" struct vboinfo @@ -964,7 +961,7 @@ void gencubeedges(cube &c, const ivec &co, int size) if(d[axis] < 0) { d.neg(); - swap(e1, e2); + std::swap(e1, e2); } reduceslope(d); diff --git a/src/engine/physics.cpp b/src/engine/physics.cpp index 13d36993a..6ececcd66 100644 --- a/src/engine/physics.cpp +++ b/src/engine/physics.cpp @@ -2,9 +2,6 @@ // All physics computations and constants were invented on the fly and simply tweaked until // they "felt right", and have no basis in reality. Collision detection is simplistic but // very robust (uses discrete steps at fixed fps). -#include -using std::swap; - #include "engine.h" #include "mpr.h" diff --git a/src/engine/pvs.cpp b/src/engine/pvs.cpp index 2101be7eb..43d644b5c 100644 --- a/src/engine/pvs.cpp +++ b/src/engine/pvs.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "engine.h" #include "SDL_thread.h" @@ -440,9 +438,9 @@ struct pvsworker order[1] = cullorder(1, diff.x); order[2] = cullorder(2, diff.y); order[3] = cullorder(4, diff.z); - if(order[2].dist < order[1].dist) swap(order[1], order[2]); - if(order[3].dist < order[2].dist) swap(order[2], order[3]); - if(order[2].dist < order[1].dist) swap(order[1], order[2]); + if(order[2].dist < order[1].dist) std::swap(order[1], order[2]); + if(order[3].dist < order[2].dist) std::swap(order[2], order[3]); + if(order[2].dist < order[1].dist) std::swap(order[1], order[2]); cullorder dxy(order[1].index|order[2].index, order[1].dist+order[2].dist), dxz(order[1].index|order[3].index, order[1].dist+order[3].dist), dyz(order[2].index|order[3].index, order[2].dist+order[3].dist); @@ -466,9 +464,9 @@ struct pvsworker shaftbb geom(co, size, edges); ivec diff = ivec(geom.max).sub(ivec(viewcellbb.min)).abs(); cullorder order[3] = { cullorder(0, diff.x), cullorder(1, diff.y), cullorder(2, diff.z) }; - if(order[1].dist > order[0].dist) swap(order[0], order[1]); - if(order[2].dist > order[1].dist) swap(order[1], order[2]); - if(order[1].dist > order[0].dist) swap(order[0], order[1]); + if(order[1].dist > order[0].dist) std::swap(order[0], order[1]); + if(order[2].dist > order[1].dist) std::swap(order[1], order[2]); + if(order[1].dist > order[0].dist) std::swap(order[0], order[1]); loopi(6) { int dim = order[i >= 3 ? i-3 : i].index, dc = (i >= 3) != (geom.max[dim] <= viewcellbb.min[dim]) ? 1 : 0, r = R[dim], c = C[dim]; diff --git a/src/engine/rendergl.cpp b/src/engine/rendergl.cpp index f9848a952..61a48e9c6 100644 --- a/src/engine/rendergl.cpp +++ b/src/engine/rendergl.cpp @@ -1,7 +1,4 @@ // rendergl.cpp: core opengl rendering stuff -#include -using std::swap; - #include "engine.h" bool hasVAO = false, hasFBO = false, hasAFBO = false, hasDS = false, hasTF = false, hasTRG = false, hasTSW = false, hasS3TC = false, hasFXT1 = false, hasLATC = false, hasRGTC = false, hasAF = false, hasFBB = false, hasUBO = false, hasMBR = false; @@ -1487,10 +1484,10 @@ void drawcubemap(int level, const vec &o, float yaw, float pitch, bool flipx, bo if(flipx || flipy) projmatrix.scalexy(flipx ? -1 : 1, flipy ? -1 : 1); if(swapxy) { - swap(projmatrix.a.x, projmatrix.a.y); - swap(projmatrix.b.x, projmatrix.b.y); - swap(projmatrix.c.x, projmatrix.c.y); - swap(projmatrix.d.x, projmatrix.d.y); + std::swap(projmatrix.a.x, projmatrix.a.y); + std::swap(projmatrix.b.x, projmatrix.b.y); + std::swap(projmatrix.c.x, projmatrix.c.y); + std::swap(projmatrix.d.x, projmatrix.d.y); } setcamprojmatrix(); diff --git a/src/engine/rendermodel.cpp b/src/engine/rendermodel.cpp index 99ee220ad..ca4828862 100644 --- a/src/engine/rendermodel.cpp +++ b/src/engine/rendermodel.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "engine.h" VAR(0, oqdynent, 0, 1, 1); diff --git a/src/engine/renderparticles.cpp b/src/engine/renderparticles.cpp index b634c7590..c62927f40 100644 --- a/src/engine/renderparticles.cpp +++ b/src/engine/renderparticles.cpp @@ -1,7 +1,4 @@ // renderparticles.cpp -#include -using std::swap; - #include "engine.h" #include "rendertarget.h" @@ -660,8 +657,8 @@ struct varenderer : partrenderer #define SETTEXCOORDS(u1c, u2c, v1c, v2c) \ { \ float u1 = u1c, u2 = u2c, v1 = v1c, v2 = v2c; \ - if(p->flags&0x01) swap(u1, u2); \ - if(p->flags&0x02) swap(v1, v2); \ + if(p->flags&0x01) std::swap(u1, u2); \ + if(p->flags&0x02) std::swap(v1, v2); \ vs[0].tc = vec2(u1, v1); \ vs[1].tc = vec2(u2, v1); \ vs[2].tc = vec2(u2, v2); \ @@ -1563,7 +1560,7 @@ static inline vec offsetvec(vec o, int dir, int dist) } else from = to = p; - if(inv) swap(from, to); + if(inv) std::swap(from, to); if(taper) { diff --git a/src/engine/rendersky.cpp b/src/engine/rendersky.cpp index 5366acf4b..b2a53637a 100644 --- a/src/engine/rendersky.cpp +++ b/src/engine/rendersky.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "engine.h" Texture *sky[6] = { 0, 0, 0, 0, 0, 0 }, *clouds[6] = { 0, 0, 0, 0, 0, 0 }; diff --git a/src/engine/rendertarget.h b/src/engine/rendertarget.h index dc7428c29..90c734353 100644 --- a/src/engine/rendertarget.h +++ b/src/engine/rendertarget.h @@ -339,11 +339,11 @@ struct rendertarget if(blursize && !blurtex) setupblur(); if(swaptexs() && blursize) { - swap(rendertex, blurtex); + std::swap(rendertex, blurtex); if(!rtsharefb) { - swap(renderfb, blurfb); - swap(renderdb, blurdb); + std::swap(renderfb, blurfb); + std::swap(renderdb, blurdb); } } glBindFramebuffer_(GL_FRAMEBUFFER, renderfb); @@ -457,7 +457,7 @@ struct rendertarget gle::colorf(1, 1, 1); glBindTexture(GL_TEXTURE_2D, rendertex); float tx1 = 0, tx2 = 1, ty1 = 0, ty2 = 1; - if(flipdebug()) swap(ty1, ty2); + if(flipdebug()) std::swap(ty1, ty2); hudquad(0, 0, w, h, tx1, ty1, tx2-tx1, ty2-ty1); hudnotextureshader->set(); dodebug(w, h); diff --git a/src/engine/rendertext.cpp b/src/engine/rendertext.cpp index 94f2e22d9..678961f9e 100644 --- a/src/engine/rendertext.cpp +++ b/src/engine/rendertext.cpp @@ -1,7 +1,5 @@ #include #include -#include -using std::swap; #include "engine.h" VAR(IDF_PERSIST, textblinking, 0, 250, VAR_MAX); diff --git a/src/engine/renderva.cpp b/src/engine/renderva.cpp index fd6175b4a..a2bb531cc 100644 --- a/src/engine/renderva.cpp +++ b/src/engine/renderva.cpp @@ -1,7 +1,4 @@ // renderva.cpp: handles the occlusion and rendering of vertex arrays -#include -using std::swap; - #include "engine.h" static inline void drawtris(GLsizei numindices, const GLvoid *indices, ushort minvert, ushort maxvert) @@ -1226,7 +1223,7 @@ static void changetexgen(renderstate &cur, int dim, Slot &slot, VSlot &vslot) float xs = vslot.rotation>=2 && vslot.rotation<=4 ? -tex->xs : tex->xs, ys = (vslot.rotation>=1 && vslot.rotation<=2) || vslot.rotation==5 ? -tex->ys : tex->ys; vec2 scroll(vslot.scroll); - if((vslot.rotation&5)==1) swap(scroll.x, scroll.y); + if((vslot.rotation&5)==1) std::swap(scroll.x, scroll.y); scroll.x *= lastmillis*tex->xs/xs; scroll.y *= lastmillis*tex->ys/ys; if(cur.texgenscroll != scroll) diff --git a/src/engine/server.cpp b/src/engine/server.cpp index 9c22723b5..0af751cdf 100644 --- a/src/engine/server.cpp +++ b/src/engine/server.cpp @@ -1,9 +1,6 @@ // server.cpp: little more than enhanced multicaster // runs dedicated or as client coroutine -#include -using std::swap; - #include "engine.h" #include diff --git a/src/engine/serverbrowser.cpp b/src/engine/serverbrowser.cpp index e4a0d9c05..4e9bcfd85 100755 --- a/src/engine/serverbrowser.cpp +++ b/src/engine/serverbrowser.cpp @@ -1,7 +1,4 @@ // serverbrowser.cpp: eihrul's concurrent resolver, and server browser window management -#include -using std::swap; - #include "engine.h" #include "SDL_thread.h" diff --git a/src/engine/shader.cpp b/src/engine/shader.cpp index 4aaf91e20..d49ef7a4c 100644 --- a/src/engine/shader.cpp +++ b/src/engine/shader.cpp @@ -1,7 +1,4 @@ // shader.cpp: OpenGL GLSL shader management -#include -using std::swap; - #include "engine.h" Shader *Shader::lastshader = NULL; diff --git a/src/engine/shadowmap.cpp b/src/engine/shadowmap.cpp index d2804fba3..684c12ef1 100644 --- a/src/engine/shadowmap.cpp +++ b/src/engine/shadowmap.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include #include "engine.h" #include "rendertarget.h" diff --git a/src/engine/sound.cpp b/src/engine/sound.cpp index 6b8a0d924..acf17bf4c 100644 --- a/src/engine/sound.cpp +++ b/src/engine/sound.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "engine.h" #include "SDL_mixer.h" diff --git a/src/engine/textedit.h b/src/engine/textedit.h index 59a728e4f..3a133ea4f 100755 --- a/src/engine/textedit.h +++ b/src/engine/textedit.h @@ -259,8 +259,8 @@ struct editor sy = (mx >= 0) ? my : cy; ex = cx; ey = cy; - if(sy > ey) { swap(sy, ey); swap(sx, ex); } - else if(sy == ey && sx > ex) swap(sx, ex); + if(sy > ey) { std::swap(sy, ey); std::swap(sx, ex); } + else if(sy == ey && sx > ex) std::swap(sx, ex); return (sx != ex) || (sy != ey); } diff --git a/src/engine/texture.cpp b/src/engine/texture.cpp index 4ab058364..aa900143b 100644 --- a/src/engine/texture.cpp +++ b/src/engine/texture.cpp @@ -1,7 +1,5 @@ // texture.cpp: texture slot management -#include -using std::swap; #include "engine.h" #include "SDL_image.h" @@ -85,7 +83,7 @@ static void reorientnormals(uchar * RESTRICT src, int sw, int sh, int bpp, int s uchar nx = *src++, ny = *src++; if(flipx) nx = 255-nx; if(flipy) ny = 255-ny; - if(swapxy) swap(nx, ny); + if(swapxy) std::swap(nx, ny); curdst[0] = nx; curdst[1] = ny; curdst[2] = *src++; @@ -142,7 +140,7 @@ static void reorients3tc(GLenum format, int blocksize, int w, int h, uchar *src, { ullong salpha = lilswap(*(const ullong *)src), dalpha = 0; uint xmask = flipx ? 15 : 0, ymask = flipy ? 15 : 0, xshift = 2, yshift = 4; - if(swapxy) swap(xshift, yshift); + if(swapxy) std::swap(xshift, yshift); for(int y = by1; y < by2; y++) for(int x = bx1; x < bx2; x++) { dalpha |= ((salpha&15) << (((xmask^x)<index >= 0 && vslots[i]->index != i) - swap(vslots[i], vslots[vslots[i]->index]); + std::swap(vslots[i], vslots[vslots[i]->index]); } for(int i = compactedvslots; i < vslots.length(); i++) delete vslots[i]; vslots.setsize(compactedvslots); @@ -1721,7 +1719,7 @@ static void clampvslotoffset(VSlot &dst, Slot *slot = NULL) Texture *t = slot->sts[0].t; int xs = t->xs, ys = t->ys; if(t->type & Texture::MIRROR) { xs *= 2; ys *= 2; } - if((dst.rotation&5)==1) swap(xs, ys); + if((dst.rotation&5)==1) std::swap(xs, ys); dst.offset.x %= xs; if(dst.offset.x < 0) dst.offset.x += xs; dst.offset.y %= ys; if(dst.offset.y < 0) dst.offset.y += ys; } @@ -2780,12 +2778,12 @@ GLuint genenvmap(const vec &o, int envmapsize, int blur) if(rendersize > texsize) { scaletexture(src, rendersize, rendersize, 3, 3*rendersize, dst, texsize, texsize); - swap(src, dst); + std::swap(src, dst); } if(blur > 0) { blurtexture(blur, 3, texsize, texsize, dst, src); - swap(src, dst); + std::swap(src, dst); } createtexture(tex, texsize, texsize, src, 3, 2, GL_RGB5, side.target); } diff --git a/src/engine/ui.cpp b/src/engine/ui.cpp index 9f3879d54..03408ea62 100644 --- a/src/engine/ui.cpp +++ b/src/engine/ui.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include #include "engine.h" @@ -980,7 +978,7 @@ struct gui : guient int xoff = vslot.offset.x, yoff = vslot.offset.y; if(vslot.rotation) { - if((vslot.rotation&5) == 1) { swap(xoff, yoff); loopk(4) swap(tc[k].x, tc[k].y); } + if((vslot.rotation&5) == 1) { std::swap(xoff, yoff); loopk(4) std::swap(tc[k].x, tc[k].y); } if(vslot.rotation >= 2 && vslot.rotation <= 4) { xoff *= -1; loopk(4) tc[k].x *= -1; } if(vslot.rotation <= 2 || vslot.rotation == 5) { yoff *= -1; loopk(4) tc[k].y *= -1; } } diff --git a/src/engine/water.cpp b/src/engine/water.cpp index 2d2f8aa02..0e34e401d 100644 --- a/src/engine/water.cpp +++ b/src/engine/water.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include #include "engine.h" diff --git a/src/engine/world.cpp b/src/engine/world.cpp index 40f4c2d6e..59b26e175 100644 --- a/src/engine/world.cpp +++ b/src/engine/world.cpp @@ -1,12 +1,9 @@ // world.cpp: core map management stuff -#include #include -using std::swap; +#include #include "engine.h" -#include - mapz hdr; int worldscale; @@ -427,7 +424,7 @@ void entrotate(int *cw) groupeditundo( e.o[dd] -= (e.o[dd]-mid)*2; e.o.sub(s); - swap(e.o[R[d]], e.o[C[d]]); + std::swap(e.o[R[d]], e.o[C[d]]); e.o.add(s); ); } diff --git a/src/engine/worldio.cpp b/src/engine/worldio.cpp index 767823706..b89a93af9 100644 --- a/src/engine/worldio.cpp +++ b/src/engine/worldio.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include // worldio.cpp: loading & saving of maps @@ -445,13 +443,13 @@ void loadc(stream *f, cube &c, const ivec &co, int size, bool &failed) if(hdr.version <= 8) edgespan2vectorcube(c); if(hdr.version <= 11) { - swap(c.faces[0], c.faces[2]); - swap(c.texture[0], c.texture[4]); - swap(c.texture[1], c.texture[5]); + std::swap(c.faces[0], c.faces[2]); + std::swap(c.texture[0], c.texture[4]); + std::swap(c.texture[1], c.texture[5]); if(hassurfs&0x33) { - swap(surfaces[0], surfaces[4]); - swap(surfaces[1], surfaces[5]); + std::swap(surfaces[0], surfaces[4]); + std::swap(surfaces[1], surfaces[5]); hassurfs = (hassurfs&~0x33) | ((hassurfs&0x30)>>4) | ((hassurfs&0x03)<<4); } } diff --git a/src/game/ai.cpp b/src/game/ai.cpp index 139eadd7f..a6b0c2ebc 100644 --- a/src/game/ai.cpp +++ b/src/game/ai.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" namespace ai { diff --git a/src/game/bomber.cpp b/src/game/bomber.cpp index 7acbeb236..6f897e148 100644 --- a/src/game/bomber.cpp +++ b/src/game/bomber.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" namespace bomber { diff --git a/src/game/capture.cpp b/src/game/capture.cpp index 640b4725b..65b26ebae 100644 --- a/src/game/capture.cpp +++ b/src/game/capture.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" namespace capture { diff --git a/src/game/client.cpp b/src/game/client.cpp index 9ae236e66..27c07d1dc 100644 --- a/src/game/client.cpp +++ b/src/game/client.cpp @@ -1,7 +1,5 @@ #include #include -#include -using std::swap; #include "game.h" namespace client diff --git a/src/game/defend.cpp b/src/game/defend.cpp index 3cb53073a..97dc5cf3e 100644 --- a/src/game/defend.cpp +++ b/src/game/defend.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" namespace defend { diff --git a/src/game/entities.cpp b/src/game/entities.cpp index 13dffb73f..d08285993 100644 --- a/src/game/entities.cpp +++ b/src/game/entities.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" namespace entities { diff --git a/src/game/game.cpp b/src/game/game.cpp index 503cbb50c..76de5854d 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1,7 +1,5 @@ -#include #include #include -using std::swap; #include #define GAMEWORLD 1 #include "game.h" @@ -3123,7 +3121,7 @@ namespace game case ANIM_RIFLE: case ANIM_GRENADE: case ANIM_MINE: case ANIM_ROCKET: { anim = (anim>>ANIM_SECONDARY) | ((anim&((1< -using std::swap; #include #include "game.h" @@ -818,8 +816,8 @@ namespace hud void drawquad(float x, float y, float w, float h, float tx1, float ty1, float tx2, float ty2, bool flipx, bool flipy) { - if(flipx) swap(tx1, tx2); - if(flipy) swap(ty1, ty2); + if(flipx) std::swap(tx1, tx2); + if(flipy) std::swap(ty1, ty2); gle::defvertex(2); gle::deftexcoord0(); gle::begin(GL_TRIANGLE_STRIP); diff --git a/src/game/physics.cpp b/src/game/physics.cpp index f701c6e83..4a48c4e53 100644 --- a/src/game/physics.cpp +++ b/src/game/physics.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" namespace physics { diff --git a/src/game/projs.cpp b/src/game/projs.cpp index 21d81e170..2d72c1eff 100644 --- a/src/game/projs.cpp +++ b/src/game/projs.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" namespace projs { diff --git a/src/game/scoreboard.cpp b/src/game/scoreboard.cpp index d47a86ded..a9fbbbd5b 100755 --- a/src/game/scoreboard.cpp +++ b/src/game/scoreboard.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" namespace hud diff --git a/src/game/server.cpp b/src/game/server.cpp index f823361d7..30fedfd3c 100644 --- a/src/game/server.cpp +++ b/src/game/server.cpp @@ -23,10 +23,8 @@ // for use on the master server should first seek permission from the Blue Nebula Team, // each modification must be approved and will be done on a case-by-case basis. -#include #include #include -using std::swap; #define GAMESERVER 1 #include "game.h" diff --git a/src/game/waypoint.cpp b/src/game/waypoint.cpp index fbc158f72..de67dca06 100644 --- a/src/game/waypoint.cpp +++ b/src/game/waypoint.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "game.h" extern selinfo sel; @@ -111,7 +109,7 @@ namespace ai else { --right; - swap(indices[left], indices[right]); + std::swap(indices[left], indices[right]); splitright = min(splitright, w.o[axis]-radius); rightmin.min(vec(w.o).sub(radius)); rightmax.max(vec(w.o).add(radius)); diff --git a/src/game/weapons.cpp b/src/game/weapons.cpp index e9f8db82d..a17740d83 100644 --- a/src/game/weapons.cpp +++ b/src/game/weapons.cpp @@ -1,7 +1,5 @@ #include #include -#include -using std::swap; #include "game.h" namespace weapons { diff --git a/src/shared/crypto.cpp b/src/shared/crypto.cpp index 375c0610d..8aaa07a0d 100644 --- a/src/shared/crypto.cpp +++ b/src/shared/crypto.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "cube.h" ///////////////////////// cryptography ///////////////////////////////// @@ -154,7 +151,7 @@ namespace tiger loopk(3) { uchar *c = &val.bytes[k*sizeof(chunk)]; - loopl(sizeof(chunk)/2) swap(c[l], c[sizeof(chunk)-1-l]); + loopl(sizeof(chunk)/2) std::swap(c[l], c[sizeof(chunk)-1-l]); } } } diff --git a/src/shared/geom.cpp b/src/shared/geom.cpp index 2ea1cc902..41afa7d18 100644 --- a/src/shared/geom.cpp +++ b/src/shared/geom.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "cube.h" void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m) diff --git a/src/shared/geom.h b/src/shared/geom.h index 706d5a91f..2183664f2 100644 --- a/src/shared/geom.h +++ b/src/shared/geom.h @@ -619,8 +619,8 @@ struct matrix3 void transpose() { - swap(a.y, b.x); swap(a.z, c.x); - swap(b.z, c.y); + std::swap(a.y, b.x); std::swap(a.z, c.x); + std::swap(b.z, c.y); } template @@ -906,8 +906,8 @@ struct matrix4x3 void transpose() { d = vec(a.dot(d), b.dot(d), c.dot(d)).neg(); - swap(a.y, b.x); swap(a.z, c.x); - swap(b.z, c.y); + std::swap(a.y, b.x); std::swap(a.z, c.x); + std::swap(b.z, c.y); } void transpose(const matrix4x3 &o) @@ -1647,9 +1647,9 @@ struct matrix4 void transpose() { - swap(a.y, b.x); swap(a.z, c.x); swap(a.w, d.x); - swap(b.z, c.y); swap(b.w, d.y); - swap(c.w, d.z); + std::swap(a.y, b.x); std::swap(a.z, c.x); std::swap(a.w, d.x); + std::swap(b.z, c.y); std::swap(b.w, d.y); + std::swap(c.w, d.z); } void transpose(const matrix4 &m) diff --git a/src/shared/glemu.cpp b/src/shared/glemu.cpp index 4fb008d5b..e4c4ffa7e 100644 --- a/src/shared/glemu.cpp +++ b/src/shared/glemu.cpp @@ -1,5 +1,3 @@ -#include -using std::swap; #include "cube.h" extern int glversion; diff --git a/src/shared/stream.cpp b/src/shared/stream.cpp index 23403ef91..d2d8199b3 100644 --- a/src/shared/stream.cpp +++ b/src/shared/stream.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "cube.h" ///////////////////////// character conversion /////////////// diff --git a/src/shared/tools.cpp b/src/shared/tools.cpp index 857d920d8..d52f8ed70 100644 --- a/src/shared/tools.cpp +++ b/src/shared/tools.cpp @@ -1,8 +1,5 @@ // implementation of generic tools -#include -using std::swap; - #include "cube.h" ////////////////////////// rnd numbers //////////////////////////////////////// diff --git a/src/shared/tools.h b/src/shared/tools.h index 436e8cd69..afe66ad22 100644 --- a/src/shared/tools.h +++ b/src/shared/tools.h @@ -469,13 +469,13 @@ static inline void quicksort(T *start, T *end, F fun) } else if(fun(*start, end[-1])) { pivot = *start; *start = *mid; } /*mid <= start < end */ else if(fun(*mid, end[-1])) { pivot = end[-1]; end[-1] = *start; *start = *mid; } /* mid < end <= start */ - else { pivot = *mid; swap(*start, end[-1]); } /* end <= mid <= start */ + else { pivot = *mid; std::swap(*start, end[-1]); } /* end <= mid <= start */ *mid = end[-2]; do { while(fun(*i, pivot)) if(++i >= j) goto partitioned; while(fun(pivot, *--j)) if(i >= j) goto partitioned; - swap(*i, *j); + std::swap(*i, *j); } while(++i < j); partitioned: @@ -739,9 +739,9 @@ template struct vector { if(!ulen) { - swap(buf, v.buf); - swap(ulen, v.ulen); - swap(alen, v.alen); + std::swap(buf, v.buf); + std::swap(ulen, v.ulen); + std::swap(alen, v.alen); } else { @@ -909,7 +909,7 @@ template struct vector void reverse() { - loopi(ulen/2) swap(buf[i], buf[ulen-1-i]); + loopi(ulen/2) std::swap(buf[i], buf[ulen-1-i]); } static int heapparent(int i) { return (i - 1) >> 1; } @@ -927,7 +927,7 @@ template struct vector { int pi = heapparent(i); if(score >= heapscore(buf[pi])) break; - swap(buf[i], buf[pi]); + std::swap(buf[i], buf[pi]); i = pi; } return i; @@ -949,10 +949,10 @@ template struct vector float cscore = heapscore(buf[ci]); if(score > cscore) { - if(ci+1 < ulen && heapscore(buf[ci+1]) < cscore) { swap(buf[ci+1], buf[i]); i = ci+1; } - else { swap(buf[ci], buf[i]); i = ci; } + if(ci+1 < ulen && heapscore(buf[ci+1]) < cscore) { std::swap(buf[ci+1], buf[i]); i = ci+1; } + else { std::swap(buf[ci], buf[i]); i = ci; } } - else if(ci+1 < ulen && heapscore(buf[ci+1]) < score) { swap(buf[ci+1], buf[i]); i = ci+1; } + else if(ci+1 < ulen && heapscore(buf[ci+1]) < score) { std::swap(buf[ci+1], buf[i]); i = ci+1; } else break; } return i; diff --git a/src/shared/zip.cpp b/src/shared/zip.cpp index 2b40c4462..178e3b7ae 100644 --- a/src/shared/zip.cpp +++ b/src/shared/zip.cpp @@ -1,6 +1,3 @@ -#include -using std::swap; - #include "cube.h" extern size_t fixdir(char *dir);