mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-12 11:24:04 +02:00
Fix "far away" air heat and velocity code working correctly only in one direction.
This commit is contained in:
@@ -92,7 +92,7 @@ void Air::update_airh(void)
|
|||||||
// The code is almost identical to the "far away" velocity code from update_air
|
// The code is almost identical to the "far away" velocity code from update_air
|
||||||
auto tx = x - dx*advDistanceMult;
|
auto tx = x - dx*advDistanceMult;
|
||||||
auto ty = y - dy*advDistanceMult;
|
auto ty = y - dy*advDistanceMult;
|
||||||
if ((dx*advDistanceMult>1.0f || dy*advDistanceMult>1.0f) && (tx>=2 && tx<XCELLS-2 && ty>=2 && ty<YCELLS-2))
|
if ((std::abs(dx*advDistanceMult)>1.0f || std::abs(dy*advDistanceMult)>1.0f) && (tx>=2 && tx<XCELLS-2 && ty>=2 && ty<YCELLS-2))
|
||||||
{
|
{
|
||||||
float stepX, stepY;
|
float stepX, stepY;
|
||||||
int stepLimit;
|
int stepLimit;
|
||||||
@@ -290,7 +290,7 @@ void Air::update_air(void)
|
|||||||
|
|
||||||
auto tx = x - dx*advDistanceMult;
|
auto tx = x - dx*advDistanceMult;
|
||||||
auto ty = y - dy*advDistanceMult;
|
auto ty = y - dy*advDistanceMult;
|
||||||
if ((dx*advDistanceMult>1.0f || dy*advDistanceMult>1.0f) && (tx>=2 && tx<XCELLS-2 && ty>=2 && ty<YCELLS-2))
|
if ((std::abs(dx*advDistanceMult)>1.0f || std::abs(dy*advDistanceMult)>1.0f) && (tx>=2 && tx<XCELLS-2 && ty>=2 && ty<YCELLS-2))
|
||||||
{
|
{
|
||||||
// Trying to take velocity from far away, check whether there is an intervening wall.
|
// Trying to take velocity from far away, check whether there is an intervening wall.
|
||||||
// Step from current position to desired source location, looking for walls, with either the x or y step size being 1 cell
|
// Step from current position to desired source location, looking for walls, with either the x or y step size being 1 cell
|
||||||
|
@@ -3621,15 +3621,14 @@ void Simulation::BeforeSim()
|
|||||||
if (!sys_pause || framerender)
|
if (!sys_pause || framerender)
|
||||||
{
|
{
|
||||||
// decrease wall conduction, make walls block air and ambient heat
|
// decrease wall conduction, make walls block air and ambient heat
|
||||||
int x, y;
|
for (int y = 0; y < YCELLS; y++)
|
||||||
for (y = 0; y < YCELLS; y++)
|
|
||||||
{
|
{
|
||||||
for (x = 0; x < XCELLS; x++)
|
for (int x = 0; x < XCELLS; x++)
|
||||||
{
|
{
|
||||||
if (emap[y][x])
|
if (emap[y][x])
|
||||||
emap[y][x] --;
|
emap[y][x] --;
|
||||||
air->bmap_blockair[y][x] = (bmap[y][x]==WL_WALL || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_BLOCKAIR || (bmap[y][x]==WL_EWALL && !emap[y][x]));
|
air->bmap_blockair[y][x] = (bmap[y][x]==WL_WALL || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_BLOCKAIR || (bmap[y][x]==WL_EWALL && !emap[y][x]));
|
||||||
air->bmap_blockairh[y][x] = (bmap[y][x]==WL_WALL || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_BLOCKAIR || bmap[y][x]==WL_GRAV || (bmap[y][x]==WL_EWALL && !emap[y][x])) ? 0x8:0;
|
air->bmap_blockairh[y][x] = (air->bmap_blockair[y][x] || bmap[y][x]==WL_GRAV) ? 0x8 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user