Fix gravmap memset, and restrict_flt for temperatures

This commit is contained in:
jacksonmj 2011-12-25 03:07:24 +08:00 committed by Simon Robertshaw
parent ad2b000a8a
commit 23d6823bc3
3 changed files with 5 additions and 5 deletions

View File

@ -45,12 +45,12 @@ int update_BANG(UPDATE_FUNC_ARGS) {
if(!(rand()%2)) if(!(rand()%2))
{ {
create_part(i, x, y, PT_FIRE); create_part(i, x, y, PT_FIRE);
parts[i].temp = (MAX_TEMP/4)+otemp; parts[i].temp = restrict_flt((MAX_TEMP/4)+otemp, MIN_TEMP, MAX_TEMP);
} }
else else
{ {
create_part(i, x, y, PT_SMKE); create_part(i, x, y, PT_SMKE);
parts[i].temp = (MAX_TEMP/4)+otemp; parts[i].temp = restrict_flt((MAX_TEMP/4)+otemp, MIN_TEMP, MAX_TEMP);
} }
} }
else else
@ -60,7 +60,7 @@ int update_BANG(UPDATE_FUNC_ARGS) {
create_part(i, x, y, PT_BOMB); create_part(i, x, y, PT_BOMB);
parts[i].tmp = 1; parts[i].tmp = 1;
parts[i].life = 50; parts[i].life = 50;
parts[i].temp = (MAX_TEMP/3)+otemp; parts[i].temp = restrict_flt((MAX_TEMP/3)+otemp, MIN_TEMP, MAX_TEMP);
parts[i].vx = rand()%20-10; parts[i].vx = rand()%20-10;
parts[i].vy = rand()%20-10; parts[i].vy = rand()%20-10;
} }

View File

@ -31,7 +31,7 @@ int update_IGNT(UPDATE_FUNC_ARGS) {
parts[nb].life = 30; parts[nb].life = 30;
parts[nb].vx = rand()%20-10; parts[nb].vx = rand()%20-10;
parts[nb].vy = rand()%20-10; parts[nb].vy = rand()%20-10;
parts[nb].temp = 400.0f+parts[i].temp-273.15; parts[nb].temp = restrict_flt(400.0f+parts[i].temp-273.15, MIN_TEMP, MAX_TEMP);
} }
} }
else else

View File

@ -1865,7 +1865,7 @@ int main(int argc, char *argv[])
gravity_update_async(); //Check for updated velocity maps from gravity thread gravity_update_async(); //Check for updated velocity maps from gravity thread
if (!sys_pause||framerender) //Only update if not paused if (!sys_pause||framerender) //Only update if not paused
memset(gravmap, 0, sizeof(gravmap)); //Clear the old gravmap memset(gravmap, 0, (XRES/CELL)*(YRES/CELL)*sizeof(float)); //Clear the old gravmap
if (framerender) { if (framerender) {
framerender = 0; framerender = 0;