Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::abs() and std::fabs() instead of abs() and fabs() #189

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/engine/animmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ struct animmodel : model
{
float curpulse = lastmillis*glowpulse;
curpulse -= floor(curpulse);
curglow += glowdelta*2*fabs(curpulse - 0.5f);
curglow += glowdelta*2*std::fabs(curpulse - 0.5f);
}
if(material <= 0 || !lightmaterial) LOCALPARAMF(lightmaterial, 2, 2, 2);
if(material2 <= 0 || !lightmaterial) LOCALPARAMF(lightmaterial2, 2, 2, 2);
Expand Down
6 changes: 3 additions & 3 deletions src/engine/bih.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ struct BIH

bool outside(const ivec &bo, const ivec &br) const
{
return abs(bo.x - center.x) > br.x + radius.x ||
abs(bo.y - center.y) > br.y + radius.y ||
abs(bo.z - center.z) > br.z + radius.z;
return std::abs(bo.x - center.x) > br.x + radius.x ||
std::abs(bo.y - center.y) > br.y + radius.y ||
std::abs(bo.z - center.z) > br.z + radius.z;
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/engine/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3334,8 +3334,8 @@ ICOMMAND(0, maxf, "V", (tagval *args, int numargs),
loopi(numargs - 1) val = max(val, args[i].getfloat());
floatret(val);
});
ICOMMAND(0, abs, "i", (int *n), intret(abs(*n)));
ICOMMAND(0, absf, "f", (float *n), floatret(fabs(*n)));
ICOMMAND(0, abs, "i", (int *n), intret(std::abs(*n)));
ICOMMAND(0, absf, "f", (float *n), floatret(std::fabs(*n)));
ICOMMAND(0, precf, "fi", (float *a, int *b),
{
defformatstring(format, "%%.%df", max(*b, 0));
Expand Down
4 changes: 2 additions & 2 deletions src/engine/decal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ struct decalrenderer
#if 0
// intersect ray along decal normal with plane
float dist = n.dot(p) / facing;
if(fabs(dist) > decalradius) continue;
if(std::fabs(dist) > decalradius) continue;
vec pcenter = vec(decalnormal).mul(dist).add(decalcenter);
#else
// travel back along plane normal from the decal center
float dist = n.dot(p);
if(fabs(dist) > decalradius) continue;
if(std::fabs(dist) > decalradius) continue;
vec pcenter = vec(n).mul(dist).add(decalcenter);
#endif
vec ft, fb;
Expand Down
16 changes: 8 additions & 8 deletions src/engine/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,10 @@ static inline bool vismatcmp(const materialsurface *xm, const materialsurface *y
int c = sortorigin[dim];
if(c > xmin && c < xmax) return sortedit;
if(c > ymin && c < ymax) return !sortedit;
xmin = abs(xmin - c);
xmax = abs(xmax - c);
ymin = abs(ymin - c);
ymax = abs(ymax - c);
xmin = std::abs(xmin - c);
xmax = std::abs(xmax - c);
ymin = std::abs(ymin - c);
ymax = std::abs(ymax - c);
if(max(xmin, xmax) <= min(ymin, ymax)) return sortedit;
else if(max(ymin, ymax) <= min(xmin, xmax)) return !sortedit;
}
Expand All @@ -508,7 +508,7 @@ void sortmaterials(vector<materialsurface *> &vismats)
sortorigin = ivec(camera1->o);
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; }
loopi(3) { dir[i] = std::fabs(dir[i]); sortdim[i] = i; }
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]);
Expand Down Expand Up @@ -704,7 +704,7 @@ void rendermaterials()
glBindTexture(GL_TEXTURE_2D, mslot->sts[1].t->id);
float angle = fmod(float(lastmillis/600.0f/(2*M_PI)), 1.0f),
s = angle - int(angle) - 0.5f;
s *= 8 - fabs(s)*16;
s *= 8 - std::fabs(s)*16;
wfwave = vertwater ? WATER_AMPLITUDE*s-WATER_OFFSET : -WATER_OFFSET;
wfscroll = 16.0f*lastmillis/1000.0f;
wfxscale = TEX_SCALE/(mslot->sts[1].t->xs*mslot->scale);
Expand Down Expand Up @@ -802,7 +802,7 @@ void rendermaterials()
{
float angle = fmod(float(lastmillis/2000.0f/(2*M_PI)), 1.0f),
s = angle - int(angle) - 0.5f;
s *= 8 - fabs(s)*16;
s *= 8 - std::fabs(s)*16;
wfwave = vertwater ? WATER_AMPLITUDE*s-WATER_OFFSET : -WATER_OFFSET;
wfscroll = 16.0f*lastmillis/3000.0f;
wfxscale = TEX_SCALE/(mslot->sts[1].t->xs*mslot->scale);
Expand All @@ -814,7 +814,7 @@ void rendermaterials()
if(blended) { glDisable(GL_BLEND); blended = false; }
float t = lastmillis/2000.0f;
t -= floor(t);
t = 1.0f - 2*fabs(t-0.5f);
t = 1.0f - 2*std::fabs(t-0.5f);
extern int glare;
if(glare) t = 0.625f + 0.075f*t;
else t = 0.5f + 0.5f*t;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/mpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace mpr
{
vec n = orient.transform(wn).div(vec(ent->xradius, ent->yradius, (ent->aboveeye + ent->height)/2)),
dir = orient.transform(wdir),
an(fabs(n.x), fabs(n.y), dir.z ? fabs(n.z) : 0),
an(std::fabs(n.x), std::fabs(n.y), dir.z ? std::fabs(n.z) : 0),
fn(0, 0, 0);
if(an.x > an.y)
{
Expand Down Expand Up @@ -208,7 +208,7 @@ namespace mpr
vec contactface(const vec &wn, const vec &wdir) const
{
vec n = orient.transform(wn).div(radius), dir = orient.transform(wdir),
an(fabs(n.x), fabs(n.y), dir.z ? fabs(n.z) : 0),
an(std::fabs(n.x), std::fabs(n.y), dir.z ? std::fabs(n.z) : 0),
fn(0, 0, 0);
if(an.x > an.y)
{
Expand Down
2 changes: 1 addition & 1 deletion src/engine/normal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void addnormals(cube &c, const ivec &o, int size)
int edge = tjoints[tj].edge, e1 = edge%(MAXFACEVERTS+1), e2 = (e1+1)%numverts;
const vec &v1 = pos[e1], &v2 = pos[e2];
ivec d(vec(v2).sub(v1).mul(8));
int axis = abs(d.x) > abs(d.y) ? (abs(d.x) > abs(d.z) ? 0 : 2) : (abs(d.y) > abs(d.z) ? 1 : 2);
int axis = std::abs(d.x) > std::abs(d.y) ? (std::abs(d.x) > std::abs(d.z) ? 0 : 2) : (std::abs(d.y) > std::abs(d.z) ? 1 : 2);
if(d[axis] < 0) d.neg();
reduceslope(d);
int origin = int(min(v1[axis], v2[axis])*8)&~0x7FFF,
Expand Down
4 changes: 2 additions & 2 deletions src/engine/octa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ cube &lookupcube(const ivec &to, int tsize, ivec &ro, int &rsize)
int tx = clamp(to.x, 0, hdr.worldsize-1),
ty = clamp(to.y, 0, hdr.worldsize-1),
tz = clamp(to.z, 0, hdr.worldsize-1);
int scale = worldscale-1, csize = abs(tsize);
int scale = worldscale-1, csize = std::abs(tsize);
cube *c = &worldroot[octastep(tx, ty, tz, scale)];
if(!(csize>>scale)) do
{
Expand Down Expand Up @@ -348,7 +348,7 @@ static int midedge(const ivec &a, const ivec &b, int xd, int yd, bool &perfect)
int risex = (by-ay)*(8-ax)*256;
int s = risex/(bx-ax);
int y = s/256 + ay;
if(((abs(s)&0xFF)!=0) || // ie: rounding error
if(((std::abs(s)&0xFF)!=0) || // ie: rounding error
(crossy && y!=8) ||
(y<0 || y>16)) perfect = false;
return crossy ? 8 : min(max(y, 0), 16);
Expand Down
6 changes: 3 additions & 3 deletions src/engine/octaedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ void updateselection()
sel.o.x = min(lastcur.x, cur.x);
sel.o.y = min(lastcur.y, cur.y);
sel.o.z = min(lastcur.z, cur.z);
sel.s.x = abs(lastcur.x-cur.x)/sel.grid+1;
sel.s.y = abs(lastcur.y-cur.y)/sel.grid+1;
sel.s.z = abs(lastcur.z-cur.z)/sel.grid+1;
sel.s.x = std::abs(lastcur.x-cur.x)/sel.grid+1;
sel.s.y = std::abs(lastcur.y-cur.y)/sel.grid+1;
sel.s.z = std::abs(lastcur.z-cur.z)/sel.grid+1;
}

bool editmoveplane(const vec &o, const vec &ray, int d, float off, vec &handle, vec &dest, bool first)
Expand Down
10 changes: 5 additions & 5 deletions src/engine/octarender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ void reduceslope(ivec &n)
int mindim = -1, minval = 64;
loopi(3) if(n[i])
{
int val = abs(n[i]);
int val = std::abs(n[i]);
if(mindim < 0 || val < minval)
{
mindim = i;
Expand Down Expand Up @@ -629,7 +629,7 @@ void addtris(const sortkey &key, int orient, vertex *verts, int *index, int numv
int e1 = cedge%(MAXFACEVERTS+1), e2 = (e1+1)%numverts;
vertex &v1 = verts[e1], &v2 = verts[e2];
ivec d(vec(v2.pos).sub(v1.pos).mul(8));
int axis = abs(d.x) > abs(d.y) ? (abs(d.x) > abs(d.z) ? 0 : 2) : (abs(d.y) > abs(d.z) ? 1 : 2);
int axis = std::abs(d.x) > std::abs(d.y) ? (std::abs(d.x) > std::abs(d.z) ? 0 : 2) : (std::abs(d.y) > std::abs(d.z) ? 1 : 2);
if(d[axis] < 0) d.neg();
reduceslope(d);
int origin = int(min(v1.pos[axis], v2.pos[axis])*8)&~0x7FFF,
Expand Down Expand Up @@ -704,9 +704,9 @@ void addgrasstri(int face, vertex *verts, int numv, ushort texture, ushort lmid)
float scale;
int px, py;

if(fabs(area.x) >= fabs(area.y) && fabs(area.x) >= fabs(area.z))
if(std::fabs(area.x) >= std::fabs(area.y) && std::fabs(area.x) >= std::fabs(area.z))
scale = 1/area.x, px = 1, py = 2;
else if(fabs(area.y) >= fabs(area.x) && fabs(area.y) >= fabs(area.z))
else if(std::fabs(area.y) >= std::fabs(area.x) && std::fabs(area.y) >= std::fabs(area.z))
scale = -1/area.y, px = 0, py = 2;
else
scale = 1/area.z, px = 0, py = 1;
Expand Down Expand Up @@ -957,7 +957,7 @@ void gencubeedges(cube &c, const ivec &co, int size)
ivec d = pos[e2];
d.sub(pos[e1]);
if(d.iszero()) continue;
int axis = abs(d.x) > abs(d.y) ? (abs(d.x) > abs(d.z) ? 0 : 2) : (abs(d.y) > abs(d.z) ? 1 : 2);
int axis = std::abs(d.x) > std::abs(d.y) ? (std::abs(d.x) > std::abs(d.z) ? 0 : 2) : (std::abs(d.y) > std::abs(d.z) ? 1 : 2);
if(d[axis] < 0)
{
d.neg();
Expand Down
24 changes: 12 additions & 12 deletions src/engine/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ bool pointincube(const clipplanes &p, const vec &v)
{ \
if(ray[i]) \
{ \
float prad = fabs(p.r[i] * invray[i]), pdist = (p.o[i] - v[i]) * invray[i], pmin = pdist - prad, pmax = pdist + prad; \
float prad = std::fabs(p.r[i] * invray[i]), pdist = (p.o[i] - v[i]) * invray[i], pmin = pdist - prad, pmax = pdist + prad; \
if(pmin > enterdist) \
{ \
if(pmin > exitdist) exit; \
Expand Down Expand Up @@ -760,7 +760,7 @@ static bool fuzzycollidebox(physent *d, const vec &dir, float cutoff, const vec
mpr::ModelOBB mdlvol(o, center, radius, yaw, pitch, roll);
vec bbradius = mdlvol.orient.abstransposedtransform(radius);

if(fabs(d->o.x - mdlvol.o.x) > bbradius.x + d->radius || fabs(d->o.y - mdlvol.o.y) > bbradius.y + d->radius ||
if(std::fabs(d->o.x - mdlvol.o.x) > bbradius.x + d->radius || std::fabs(d->o.y - mdlvol.o.y) > bbradius.y + d->radius ||
d->o.z + d->aboveeye < mdlvol.o.z - bbradius.z || d->o.z - d->height > mdlvol.o.z + bbradius.z)
return false;

Expand Down Expand Up @@ -812,7 +812,7 @@ static bool fuzzycollideellipse(physent *d, const vec &dir, float cutoff, const
mpr::ModelEllipse mdlvol(o, center, radius, yaw, pitch, roll);
vec bbradius = mdlvol.orient.abstransposedtransform(radius);

if(fabs(d->o.x - mdlvol.o.x) > bbradius.x + d->radius || fabs(d->o.y - mdlvol.o.y) > bbradius.y + d->radius ||
if(std::fabs(d->o.x - mdlvol.o.x) > bbradius.x + d->radius || std::fabs(d->o.y - mdlvol.o.y) > bbradius.y + d->radius ||
d->o.z + d->aboveeye < mdlvol.o.z - bbradius.z || d->o.z - d->height > mdlvol.o.z + bbradius.z)
return false;

Expand Down Expand Up @@ -917,7 +917,7 @@ template<class E>
static bool fuzzycollidesolid(physent *d, const vec &dir, float cutoff, const cube &c, const ivec &co, int size) // collide with solid cube geometry
{
int crad = size/2;
if(fabs(d->o.x - co.x - crad) > d->radius + crad || fabs(d->o.y - co.y - crad) > d->radius + crad ||
if(std::fabs(d->o.x - co.x - crad) > d->radius + crad || std::fabs(d->o.y - co.y - crad) > d->radius + crad ||
d->o.z + d->aboveeye < co.z || d->o.z - d->height > co.z + size)
return false;

Expand Down Expand Up @@ -956,21 +956,21 @@ static bool fuzzycollidesolid(physent *d, const vec &dir, float cutoff, const cu
template<class E>
static inline bool clampcollide(const clipplanes &p, const E &entvol, const plane &w, const vec &pw)
{
if(w.x && (w.y || w.z) && fabs(pw.x - p.o.x) > p.r.x)
if(w.x && (w.y || w.z) && std::fabs(pw.x - p.o.x) > p.r.x)
{
vec c = entvol.center();
float fv = pw.x < p.o.x ? p.o.x-p.r.x : p.o.x+p.r.x, fdist = (w.x*fv + w.y*c.y + w.z*c.z + w.offset) / (w.y*w.y + w.z*w.z);
vec fdir(fv - c.x, -w.y*fdist, -w.z*fdist);
if((pw.y-c.y-fdir.y)*w.y + (pw.z-c.z-fdir.z)*w.z >= 0 && entvol.supportpoint(fdir).squaredist(c) < fdir.squaredlen()) return true;
}
if(w.y && (w.x || w.z) && fabs(pw.y - p.o.y) > p.r.y)
if(w.y && (w.x || w.z) && std::fabs(pw.y - p.o.y) > p.r.y)
{
vec c = entvol.center();
float fv = pw.y < p.o.y ? p.o.y-p.r.y : p.o.y+p.r.y, fdist = (w.x*c.x + w.y*fv + w.z*c.z + w.offset) / (w.x*w.x + w.z*w.z);
vec fdir(-w.x*fdist, fv - c.y, -w.z*fdist);
if((pw.x-c.x-fdir.x)*w.x + (pw.z-c.z-fdir.z)*w.z >= 0 && entvol.supportpoint(fdir).squaredist(c) < fdir.squaredlen()) return true;
}
if(w.z && (w.x || w.y) && fabs(pw.z - p.o.z) > p.r.z)
if(w.z && (w.x || w.y) && std::fabs(pw.z - p.o.z) > p.r.z)
{
vec c = entvol.center();
float fv = pw.z < p.o.z ? p.o.z-p.r.z : p.o.z+p.r.z, fdist = (w.x*c.x + w.y*c.y + w.z*fv + w.offset) / (w.x*w.x + w.y*w.y);
Expand All @@ -985,7 +985,7 @@ static bool fuzzycollideplanes(physent *d, const vec &dir, float cutoff, const c
{
const clipplanes &p = getclipplanes(c, co, size);

if(fabs(d->o.x - p.o.x) > p.r.x + d->radius || fabs(d->o.y - p.o.y) > p.r.y + d->radius ||
if(std::fabs(d->o.x - p.o.x) > p.r.x + d->radius || std::fabs(d->o.y - p.o.y) > p.r.y + d->radius ||
d->o.z + d->aboveeye < p.o.z - p.r.z || d->o.z - d->height > p.o.z + p.r.z)
return false;

Expand Down Expand Up @@ -1035,7 +1035,7 @@ template<class E>
static bool cubecollidesolid(physent *d, const vec &dir, float cutoff, const cube &c, const ivec &co, int size) // collide with solid cube geometry
{
int crad = size/2;
if(fabs(d->o.x - co.x - crad) > d->radius + crad || fabs(d->o.y - co.y - crad) > d->radius + crad ||
if(std::fabs(d->o.x - co.x - crad) > d->radius + crad || std::fabs(d->o.y - co.y - crad) > d->radius + crad ||
d->o.z + d->aboveeye < co.z || d->o.z - d->height > co.z + size)
return false;

Expand Down Expand Up @@ -1066,7 +1066,7 @@ static bool cubecollideplanes(physent *d, const vec &dir, float cutoff, const cu
{
const clipplanes &p = getclipplanes(c, co, size);

if(fabs(d->o.x - p.o.x) > p.r.x + d->radius || fabs(d->o.y - p.o.y) > p.r.y + d->radius ||
if(std::fabs(d->o.x - p.o.x) > p.r.x + d->radius || std::fabs(d->o.y - p.o.y) > p.r.y + d->radius ||
d->o.z + d->aboveeye < p.o.z - p.r.z || d->o.z - d->height > p.o.z + p.r.z)
return false;

Expand Down Expand Up @@ -1267,8 +1267,8 @@ bool getsight(vec &o, float yaw, float pitch, vec &q, vec &v, float mdist, float

if(dist <= mdist)
{
float x = fmod(fabs(asin((q.z-o.z)/dist)/RAD-pitch), 360);
float y = fmod(fabs(-atan2(q.x-o.x, q.y-o.y)/RAD-yaw), 360);
float x = fmod(std::fabs(asin((q.z-o.z)/dist)/RAD-pitch), 360);
float y = fmod(std::fabs(-atan2(q.x-o.x, q.y-o.y)/RAD-yaw), 360);
if(min(x, 360-x) <= fovx && min(y, 360-y) <= fovy) return raycubelos(o, q, v);
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/ragdoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void ragdolldata::constrainrot()
vec axis;
float angle;
if(!rot.calcangleaxis(angle, axis)) continue;
angle = r.maxangle - fabs(angle);
angle = r.maxangle - std::fabs(angle);
if(angle >= 0) continue;
angle += 1e-3f;

Expand Down Expand Up @@ -366,7 +366,7 @@ void ragdolldata::applyrotfriction(float ts)
float angle;
if(rot.calcangleaxis(angle, axis))
{
angle *= -(fabs(angle) >= stopangle ? rotfric : 1.0f);
angle *= -(std::fabs(angle) >= stopangle ? rotfric : 1.0f);
applyrotlimit(skel->tris[r.tri[0]], skel->tris[r.tri[1]], angle, axis);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/engine/rendergl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ static LocalShaderParam screentexcoord[2] = { LocalShaderParam("screentexcoord0"

static inline void setscreentexcoord(int i, float w, float h, float x = 0, float y = 0)
{
screentexcoord[i].setf(w*0.5f, h*0.5f, x + w*0.5f, y + fabs(h)*0.5f);
screentexcoord[i].setf(w*0.5f, h*0.5f, x + w*0.5f, y + std::fabs(h)*0.5f);
}

void screenquad(float sw, float sh)
Expand Down Expand Up @@ -1354,7 +1354,7 @@ void drawreflection(float z, bool refract, int fogdepth, const bvec &col)

if(fading)
{
float scale = fogging ? -0.25f : 0.25f, offset = 2*fabs(scale) - scale*z;
float scale = fogging ? -0.25f : 0.25f, offset = 2*std::fabs(scale) - scale*z;
GLOBALPARAMF(waterfadeparams, scale, offset, -scale, offset + camera1->o.z*scale);
}

Expand Down
10 changes: 5 additions & 5 deletions src/engine/rendermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,9 @@ static inline void enablecullmodelquery()

static inline void rendercullmodelquery(model *m, dynent *d, const vec &center, float radius)
{
if(fabs(camera1->o.x-center.x) < radius+1 &&
fabs(camera1->o.y-center.y) < radius+1 &&
fabs(camera1->o.z-center.z) < radius+1)
if(std::fabs(camera1->o.x-center.x) < radius+1 &&
std::fabs(camera1->o.y-center.y) < radius+1 &&
std::fabs(camera1->o.z-center.z) < radius+1)
{
d->query = NULL;
return;
Expand Down Expand Up @@ -1111,8 +1111,8 @@ void setbbfrommodel(dynent *d, const char *mdl, float size)
m->collisionbox(center, radius);
if(d->type==ENT_INANIMATE && !m->ellipsecollide)
d->collidetype = COLLIDE_OBB;
d->xradius = (radius.x + fabs(center.x))*size;
d->yradius = (radius.y + fabs(center.y))*size;
d->xradius = (radius.x + std::fabs(center.x))*size;
d->yradius = (radius.y + std::fabs(center.y))*size;
d->radius = d->collidetype==COLLIDE_OBB ? sqrtf(d->xradius*d->xradius + d->yradius*d->yradius) : max(d->xradius, d->yradius);
d->height = (d->zradius = (center.z-radius.z) + radius.z*2*m->height)*size;
d->aboveeye = radius.z*2*(1.0f-m->height);
Expand Down
2 changes: 1 addition & 1 deletion src/engine/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ uint getclientip(int n) { int o = server::peerowner(n); return clients.i

void sendpacket(int n, int chan, ENetPacket *packet, int exclude)
{
if(n < 0 || chan < 0) server::recordpacket(abs(chan), packet->data, packet->dataLength);
if(n < 0 || chan < 0) server::recordpacket(std::abs(chan), packet->data, packet->dataLength);
if(chan < 0) return; // was just a record packet
if(n < 0)
{
Expand Down
Loading