Prevent crashes in the event of ridiculous temperatures

This commit is contained in:
jacksonmj 2011-02-07 20:29:11 +00:00
parent cb74b0bacf
commit b85c29dee4
4 changed files with 11 additions and 4 deletions

View File

@ -767,10 +767,11 @@ static int lolzrule[9][9] =
{0,1,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0},
};
int portal[(int)(MAX_TEMP-73.15f)/100+2][8][80];
float portaltemp[(int)(MAX_TEMP-73.15f)/100+2][8][80];
int portalctype[(int)(MAX_TEMP-73.15f)/100+2][8][80];
int wireless[(int)(MAX_TEMP-73.15f)/100+2][2];
#define CHANNELS ((int)(MAX_TEMP-73.15f)/100+2)
int portal[CHANNELS][8][80];
float portaltemp[CHANNELS][8][80];
int portalctype[CHANNELS][8][80];
int wireless[CHANNELS][2];
extern int isplayer;
extern float player[27];

View File

@ -4,6 +4,8 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
int r, nnx, rx, ry;
int count =0;
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
else if (parts[i].tmp<0) parts[i].tmp = 0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))

View File

@ -4,6 +4,8 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
int r, nnx, rx, ry, np;
int count = 0;
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
else if (parts[i].tmp<0) parts[i].tmp = 0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))

View File

@ -3,6 +3,8 @@
int update_WIFI(UPDATE_FUNC_ARGS) {
int r, rx, ry;
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
else if (parts[i].tmp<0) parts[i].tmp = 0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))