a bunch of fixes to heat/pressure digitation
add limits so that you don't get impossible temp or pressures only undigitize from FILT 1 pixel away ensure everything only works through FILT, not sometimes PHOT or BRAY HSWC with .tmp of 1 no longer conducts heat to FILT
This commit is contained in:
parent
5eb0d1bd27
commit
5a61e6a619
@ -3833,11 +3833,13 @@ void Simulation::UpdateParticles(int start, int end)
|
||||
if (!r)
|
||||
continue;
|
||||
rt = TYP(r);
|
||||
if (rt&&elements[rt].HeatConduct&&(rt!=PT_HSWC||parts[ID(r)].life==10)
|
||||
&&(t!=PT_FILT||(rt!=PT_BRAY&&rt!=PT_BIZR&&rt!=PT_BIZRG))
|
||||
&&(rt!=PT_FILT||(t!=PT_BRAY&&t!=PT_PHOT&&t!=PT_BIZR&&t!=PT_BIZRG))
|
||||
&&(t!=PT_ELEC||rt!=PT_DEUT)
|
||||
&&(t!=PT_DEUT||rt!=PT_ELEC))
|
||||
if (rt && elements[rt].HeatConduct && (rt!=PT_HSWC||parts[ID(r)].life==10)
|
||||
&& (t!=PT_FILT||(rt!=PT_BRAY&&rt!=PT_BIZR&&rt!=PT_BIZRG))
|
||||
&& (rt!=PT_FILT||(t!=PT_BRAY&&t!=PT_PHOT&&t!=PT_BIZR&&t!=PT_BIZRG))
|
||||
&& (t!=PT_ELEC||rt!=PT_DEUT)
|
||||
&& (t!=PT_DEUT||rt!=PT_ELEC)
|
||||
&& (t!=PT_HSWC || rt!=PT_FILT || parts[i].tmp != 1)
|
||||
&& (t!=PT_FILT || rt!=PT_HSWC || parts[ID(r)].tmp != 1))
|
||||
{
|
||||
surround_hconduct[j] = ID(r);
|
||||
#ifdef REALISTIC
|
||||
|
@ -56,25 +56,29 @@ int Element_HSWC::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
else
|
||||
{
|
||||
bool deserializeTemp = parts[i].tmp == 1;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (parts[i].tmp == 1 && !r)
|
||||
r = sim->photons[y + ry][x + rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (TYP(r)==PT_HSWC)
|
||||
if (TYP(r) == PT_HSWC)
|
||||
{
|
||||
if (parts[ID(r)].life<10&&parts[ID(r)].life>0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[ID(r)].life==0)
|
||||
parts[ID(r)].life = 10;
|
||||
}
|
||||
if (parts[i].tmp == 1 && (TYP(r) == PT_FILT || TYP(r) == PT_PHOT || TYP(r) == PT_BRAY))
|
||||
if (deserializeTemp && TYP(r) == PT_FILT)
|
||||
{
|
||||
parts[i].temp = parts[ID(r)].ctype - 0x10000000;
|
||||
if (rx >= -1 && rx <= 1 && ry >= -1 && ry <= 1)
|
||||
{
|
||||
int newTemp = parts[ID(r)].ctype - 0x10000000;
|
||||
if (newTemp >= MIN_TEMP && newTemp <= MAX_TEMP)
|
||||
parts[i].temp = parts[ID(r)].ctype - 0x10000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,21 +48,19 @@ Element_PSNS::Element_PSNS()
|
||||
int Element_PSNS::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt;
|
||||
float photonWl = 0.0f;
|
||||
bool setFilt = false;
|
||||
if (sim->pv[y/CELL][x/CELL] > parts[i].temp-273.15f)
|
||||
{
|
||||
parts[i].life = 0;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx = -2; rx <= 2; rx++)
|
||||
for (ry = -2; ry <= 2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
rt = TYP(r);
|
||||
if (sim->parts_avg(i,ID(r),PT_INSL) != PT_INSL)
|
||||
{
|
||||
rt = TYP(r);
|
||||
if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[ID(r)].life==0)
|
||||
{
|
||||
parts[ID(r)].life = 4;
|
||||
@ -75,13 +73,13 @@ int Element_PSNS::update(UPDATE_FUNC_ARGS)
|
||||
if (parts[i].tmp == 1)
|
||||
{
|
||||
parts[i].life = 0;
|
||||
setFilt = true;
|
||||
photonWl = sim->pv[y / CELL][x / CELL];
|
||||
bool setFilt = true;
|
||||
float photonWl = sim->pv[y / CELL][x / CELL];
|
||||
if (setFilt)
|
||||
{
|
||||
int nx, ny;
|
||||
for (rx = -1; rx < 2; rx++)
|
||||
for (ry = -1; ry < 2; ry++)
|
||||
for (rx = -1; rx <= 1; rx++)
|
||||
for (ry = -1; ry <= 1; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y + ry][x + rx];
|
||||
|
@ -49,49 +49,53 @@ Element_PUMP::Element_PUMP()
|
||||
int Element_PUMP::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
if (parts[i].life!=10)
|
||||
if (parts[i].life != 10)
|
||||
{
|
||||
if (parts[i].life>0)
|
||||
parts[i].life--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parts[i].temp>=256.0+273.15)
|
||||
parts[i].temp=256.0+273.15;
|
||||
if (parts[i].temp<= -256.0+273.15)
|
||||
if (parts[i].temp >= 256.0+273.15)
|
||||
parts[i].temp = 256.0+273.15;
|
||||
if (parts[i].temp <= -256.0+273.15)
|
||||
parts[i].temp = -256.0+273.15;
|
||||
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (parts[i].tmp != 1 && (!(rx && ry)))
|
||||
for (rx = -1; rx <= 1; rx++)
|
||||
for (ry = -1; ry <= 1; ry++)
|
||||
{
|
||||
if (parts[i].tmp != 1)
|
||||
{
|
||||
sim->pv[(y/CELL)+ry][(x/CELL)+rx] += 0.1f*((parts[i].temp-273.15)-sim->pv[(y/CELL)+ry][(x/CELL)+rx]);
|
||||
if (!(rx && ry))
|
||||
sim->pv[(y/CELL)+ry][(x/CELL)+rx] += 0.1f*((parts[i].temp-273.15)-sim->pv[(y/CELL)+ry][(x/CELL)+rx]);
|
||||
}
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
else
|
||||
{
|
||||
int r = pmap[y+ry][x+rx];
|
||||
if (TYP(r) == PT_FILT)
|
||||
{
|
||||
int newPressure = parts[ID(r)].ctype - 0x10000000;
|
||||
if (newPressure >= 0 && newPressure <= 512)
|
||||
{
|
||||
sim->pv[(y + ry) / CELL][(x + rx) / CELL] = newPressure - 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (rx = -2; rx <= 2; rx++)
|
||||
for (ry = -2; ry <= 2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (TYP(r)==PT_PUMP)
|
||||
if (TYP(r) == PT_PUMP)
|
||||
{
|
||||
if (parts[ID(r)].life<10&&parts[ID(r)].life>0)
|
||||
if (parts[ID(r)].life < 10 && parts[ID(r)].life > 0)
|
||||
parts[i].life = 9;
|
||||
else if (parts[ID(r)].life==0)
|
||||
else if (parts[ID(r)].life == 0)
|
||||
parts[ID(r)].life = 10;
|
||||
}
|
||||
if (parts[i].tmp == 1 && (TYP(r) == PT_FILT || TYP(r) == PT_PHOT || TYP(r) == PT_BRAY))
|
||||
{
|
||||
if (parts[ID(r)].ctype >= 0x10000000 && parts[ID(r)].ctype <= 0x10000000 + 512)
|
||||
{
|
||||
sim->pv[(y / CELL) + ry][(x / CELL) + rx] = (parts[ID(r)].ctype - 0x10000000) - 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
sim->pv[(y / CELL) + ry][(x / CELL) + rx] = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user