fix some warnings

Removed homebrew round() - now we just use the math library.
This commit is contained in:
ac-stef
2015-08-03 20:57:50 +02:00
parent 826499c12d
commit 50d1413d5c
6 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -870,7 +870,7 @@ uint randomMT()
else next = 0; else next = 0;
} }
uint y = (state[cur] & 0x80000000U) | (state[next] & 0x7FFFFFFFU); uint y = (state[cur] & 0x80000000U) | (state[next] & 0x7FFFFFFFU);
state[cur] = y = state[cur < N-M ? cur + M : cur + M-N] ^ (y >> 1) ^ (-(y & 1U) & K); state[cur] = y = state[cur < N-M ? cur + M : cur + M-N] ^ (y >> 1) ^ (-int(y & 1U) & K);
y ^= (y >> 11); y ^= (y >> 11);
y ^= (y << 7) & 0x9D2C5680U; y ^= (y << 7) & 0x9D2C5680U;
y ^= (y << 15) & 0xEFC60000U; y ^= (y << 15) & 0xEFC60000U;
+1 -1
View File
@@ -506,7 +506,7 @@ void jpegenc::write_comment(BYTE *comment)
{ {
WORD i, length; WORD i, length;
writeword(0xFFFE); writeword(0xFFFE);
length = strlen((const char *)comment); length = (WORD) strlen((const char *)comment);
writeword(length + 2); writeword(length + 2);
for (i=0; i<length; i++) for (i=0; i<length; i++)
writebyte(comment[i]); writebyte(comment[i]);
-2
View File
@@ -57,8 +57,6 @@ static inline T min(T a, T b)
template <typename T> inline T pow2(T x) { return x*x; } template <typename T> inline T pow2(T x) { return x*x; }
static inline float round(float x) { return floor(x + 0.5f); }
#define clamp(x,minval,maxval) (max(minval, min(x, maxval))) #define clamp(x,minval,maxval) (max(minval, min(x, maxval)))
#define rnd(x) ((int)(randomMT()&0xFFFFFF)%(x)) #define rnd(x) ((int)(randomMT()&0xFFFFFF)%(x))
#define rndscale(x) (float((randomMT()&0xFFFFFF)*double(x)/double(0xFFFFFF))) #define rndscale(x) (float((randomMT()&0xFFFFFF)*double(x)/double(0xFFFFFF)))
+1 -1
View File
@@ -595,7 +595,7 @@ void raydamage(vec &from, vec &to, playerent *d)
int dam = d->weaponsel->info.damage; int dam = d->weaponsel->info.damage;
int hitzone = -1; int hitzone = -1;
playerent *o = NULL; playerent *o = NULL;
float dist, hitdist; float dist, hitdist = 0.0f;
bool hitted=false; bool hitted=false;
int rayscount = 0, hitscount = 0; int rayscount = 0, hitscount = 0;
if(d->weaponsel->type==GUN_SHOTGUN) if(d->weaponsel->type==GUN_SHOTGUN)
+2 -2
View File
@@ -195,7 +195,7 @@ void rldecodecubes(ucharbuf &f, sqr *s, int len, int version, bool silent) // ru
{ {
case -1: case -1:
{ {
if(!silent) conoutf("while reading map at %ld: unexpected end of file", cubicsize - (e - s)); if(!silent) conoutf("while reading map at %d: unexpected end of file", int(cubicsize - (e - s)));
f.forceoverread(); f.forceoverread();
silent = true; silent = true;
sqrdefault(s); sqrdefault(s);
@@ -231,7 +231,7 @@ void rldecodecubes(ucharbuf &f, sqr *s, int len, int version, bool silent) // ru
{ {
if(type<0 || type>=MAXTYPE) if(type<0 || type>=MAXTYPE)
{ {
if(!silent) conoutf("while reading map at %ld: type %d out of range", cubicsize - (e - s), type); if(!silent) conoutf("while reading map at %d: type %d out of range", int(cubicsize - (e - s)), type);
f.overread(); f.overread();
continue; continue;
} }
+1 -1
View File
@@ -72,7 +72,7 @@ void computeraytable(float vx, float vy, float fov)
{ {
float dist = (float)(fabs(sx-vx)+fabs(sy-vy)); float dist = (float)(fabs(sx-vx)+fabs(sy-vy));
if(firstquarter || dist > rdist[k]) rdist[k] = dist; if(firstquarter || dist > rdist[k]) rdist[k] = dist;
if(firstquarter) ndist[k] = max(abs(sx-vx), abs(sy-vy)); if(firstquarter) ndist[k] = max(abs(int(sx-vx)), abs(int(sy-vy)));
break; break;
} }
} }