Air and heat tool limits, fixes #112
This commit is contained in:
parent
e13476a406
commit
b06f7f5b6d
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user