Air and heat tool limits, fixes #112

This commit is contained in:
Simon Robertshaw 2012-08-14 16:29:07 +01:00
parent e13476a406
commit b06f7f5b6d
4 changed files with 16 additions and 0 deletions

View File

@ -12,6 +12,10 @@ Tool_Air::Tool_Air()
int Tool_Air::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
{
sim->air->pv[y/CELL][x/CELL] += 0.03f*strength;
if(sim->air->pv[y/CELL][x/CELL] > 256.0f)
sim->air->pv[y/CELL][x/CELL] = 256.0f;
if(sim->air->pv[y/CELL][x/CELL] < -256.0f)
sim->air->pv[y/CELL][x/CELL] = -256.0f;
return 1;
}

View File

@ -13,6 +13,10 @@ int Tool_Cool::Perform(Simulation * sim, Particle * cpart, int x, int y, float s
if(!cpart)
return 0;
cpart->temp -= strength;
if(cpart->temp > MAX_TEMP)
cpart->temp = MAX_TEMP;
if(cpart->temp < 0)
cpart->temp = 0;
return 1;
}

View File

@ -13,6 +13,10 @@ int Tool_Heat::Perform(Simulation * sim, Particle * cpart, int x, int y, float s
if(!cpart)
return 0;
cpart->temp += strength;
if(cpart->temp > MAX_TEMP)
cpart->temp = MAX_TEMP;
if(cpart->temp < 0)
cpart->temp = 0;
return 1;
}

View File

@ -12,6 +12,10 @@ Tool_Vac::Tool_Vac()
int Tool_Vac::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength)
{
sim->air->pv[y/CELL][x/CELL] -= 0.03f*strength;
if(sim->air->pv[y/CELL][x/CELL] > 256.0f)
sim->air->pv[y/CELL][x/CELL] = 256.0f;
if(sim->air->pv[y/CELL][x/CELL] < -256.0f)
sim->air->pv[y/CELL][x/CELL] = -256.0f;
return 1;
}