mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-01 06:00:15 +02:00
turned off HSWC acts as insulator for HEAC
This commit is contained in:
@@ -50,7 +50,10 @@ Element_HEAC::Element_HEAC()
|
|||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_HEAC struct IsInsulator
|
//#TPT-Directive ElementHeader Element_HEAC struct IsInsulator
|
||||||
struct Element_HEAC::IsInsulator : public std::binary_function<Simulation*,int,bool> {
|
struct Element_HEAC::IsInsulator : public std::binary_function<Simulation*,int,bool> {
|
||||||
bool operator() (Simulation* a, int b) {return b && a->elements[b].HeatConduct == 0;}
|
bool operator() (Simulation* a, int b)
|
||||||
|
{
|
||||||
|
return b && (a->elements[b&0xFF].HeatConduct == 0 || ((b&0xFF) == PT_HSWC && a->parts[b>>8].life != 10));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
//#TPT-Directive ElementHeader Element_HEAC static IsInsulator isInsulator
|
//#TPT-Directive ElementHeader Element_HEAC static IsInsulator isInsulator
|
||||||
Element_HEAC::IsInsulator Element_HEAC::isInsulator = Element_HEAC::IsInsulator();
|
Element_HEAC::IsInsulator Element_HEAC::isInsulator = Element_HEAC::IsInsulator();
|
||||||
@@ -94,11 +97,11 @@ bool Element_HEAC::CheckLine(Simulation* sim, int x1, int y1, int x2, int y2, Bi
|
|||||||
{
|
{
|
||||||
if (reverseXY)
|
if (reverseXY)
|
||||||
{
|
{
|
||||||
if (func(sim, sim->pmap[x][y]&0xFF)) return true;
|
if (func(sim, sim->pmap[x][y])) return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (func(sim, sim->pmap[y][x]&0xFF)) return true;
|
if (func(sim, sim->pmap[y][x])) return true;
|
||||||
}
|
}
|
||||||
e += de;
|
e += de;
|
||||||
if (e >= 0.5f)
|
if (e >= 0.5f)
|
||||||
@@ -108,11 +111,11 @@ bool Element_HEAC::CheckLine(Simulation* sim, int x1, int y1, int x2, int y2, Bi
|
|||||||
{
|
{
|
||||||
if (reverseXY)
|
if (reverseXY)
|
||||||
{
|
{
|
||||||
if (func(sim, sim->pmap[x][y]&0xFF)) return true;
|
if (func(sim, sim->pmap[x][y])) return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (func(sim, sim->pmap[y][x]&0xFF)) return true;
|
if (func(sim, sim->pmap[y][x])) return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e -= 1.0f;
|
e -= 1.0f;
|
||||||
@@ -136,13 +139,13 @@ int Element_HEAC::update(UPDATE_FUNC_ARGS)
|
|||||||
if (x+rrx >= 0 && x+rrx < XRES && y+rry >= 0 && y+rry < YRES && !Element_HEAC::CheckLine<Element_HEAC::IsInsulator>(sim, x, y, x+rrx, y+rry, isInsulator))
|
if (x+rrx >= 0 && x+rrx < XRES && y+rry >= 0 && y+rry < YRES && !Element_HEAC::CheckLine<Element_HEAC::IsInsulator>(sim, x, y, x+rrx, y+rry, isInsulator))
|
||||||
{
|
{
|
||||||
r = pmap[y+rry][x+rrx];
|
r = pmap[y+rry][x+rrx];
|
||||||
if (r && sim->elements[r&0xFF].HeatConduct > 0 && (parts[r>>8].type != PT_HSWC || parts[r>>8].life == 10))
|
if (r && sim->elements[r&0xFF].HeatConduct > 0 && ((r&0xFF) != PT_HSWC || parts[r>>8].life == 10))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
tempAgg += parts[r>>8].temp;
|
tempAgg += parts[r>>8].temp;
|
||||||
}
|
}
|
||||||
r = sim->photons[y+rry][x+rrx];
|
r = sim->photons[y+rry][x+rrx];
|
||||||
if (r && sim->elements[r&0xFF].HeatConduct > 0 && (parts[r>>8].type != PT_HSWC || parts[r>>8].life == 10))
|
if (r && sim->elements[r&0xFF].HeatConduct > 0 && ((r&0xFF) != PT_HSWC || parts[r>>8].life == 10))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
tempAgg += parts[r>>8].temp;
|
tempAgg += parts[r>>8].temp;
|
||||||
@@ -164,12 +167,12 @@ int Element_HEAC::update(UPDATE_FUNC_ARGS)
|
|||||||
if (x+rrx >= 0 && x+rrx < XRES && y+rry >= 0 && y+rry < YRES && !Element_HEAC::CheckLine<Element_HEAC::IsInsulator>(sim, x, y, x+rrx, y+rry, isInsulator))
|
if (x+rrx >= 0 && x+rrx < XRES && y+rry >= 0 && y+rry < YRES && !Element_HEAC::CheckLine<Element_HEAC::IsInsulator>(sim, x, y, x+rrx, y+rry, isInsulator))
|
||||||
{
|
{
|
||||||
r = pmap[y+rry][x+rrx];
|
r = pmap[y+rry][x+rrx];
|
||||||
if (r && sim->elements[r&0xFF].HeatConduct > 0 && (parts[r>>8].type != PT_HSWC || parts[r>>8].life == 10))
|
if (r && sim->elements[r&0xFF].HeatConduct > 0 && ((r&0xFF) != PT_HSWC || parts[r>>8].life == 10))
|
||||||
{
|
{
|
||||||
parts[r>>8].temp = parts[i].temp;
|
parts[r>>8].temp = parts[i].temp;
|
||||||
}
|
}
|
||||||
r = sim->photons[y+rry][x+rrx];
|
r = sim->photons[y+rry][x+rrx];
|
||||||
if (r && sim->elements[r&0xFF].HeatConduct > 0 && (parts[r>>8].type != PT_HSWC || parts[r>>8].life == 10))
|
if (r && sim->elements[r&0xFF].HeatConduct > 0 && ((r&0xFF) != PT_HSWC || parts[r>>8].life == 10))
|
||||||
{
|
{
|
||||||
parts[r>>8].temp = parts[i].temp;
|
parts[r>>8].temp = parts[i].temp;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user