insulators block ambient heat (when there are a lot nearby)

This commit is contained in:
jacob1 2014-01-07 00:26:18 -05:00
parent dcef255f47
commit eaf0daec43
3 changed files with 14 additions and 9 deletions

View File

@ -84,7 +84,7 @@ void Air::update_airh(void)
{ {
if (y+j>0 && y+j<YRES/CELL-2 && if (y+j>0 && y+j<YRES/CELL-2 &&
x+i>0 && x+i<XRES/CELL-2 && x+i>0 && x+i<XRES/CELL-2 &&
!bmap_blockairh[y+j][x+i]) !(bmap_blockairh[y+j][x+i]&0x8))
{ {
f = kernel[i+1+(j+1)*3]; f = kernel[i+1+(j+1)*3];
dh += hv[y+j][x+i]*f; dh += hv[y+j][x+i]*f;
@ -110,15 +110,15 @@ void Air::update_airh(void)
{ {
odh = dh; odh = dh;
dh *= 1.0f - AIR_VADV; dh *= 1.0f - AIR_VADV;
dh += AIR_VADV*(1.0f-tx)*(1.0f-ty)*(bmap_blockairh[j][i] ? odh : hv[j][i]); dh += AIR_VADV*(1.0f-tx)*(1.0f-ty)*((bmap_blockairh[j][i]&0x8) ? odh : hv[j][i]);
dh += AIR_VADV*tx*(1.0f-ty)*(bmap_blockairh[j][i+1] ? odh : hv[j][i+1]); dh += AIR_VADV*tx*(1.0f-ty)*((bmap_blockairh[j][i+1]&0x8) ? odh : hv[j][i+1]);
dh += AIR_VADV*(1.0f-tx)*ty*(bmap_blockairh[j+1][i] ? odh : hv[j+1][i]); dh += AIR_VADV*(1.0f-tx)*ty*((bmap_blockairh[j+1][i]&0x8) ? odh : hv[j+1][i]);
dh += AIR_VADV*tx*ty*(bmap_blockairh[j+1][i+1] ? odh : hv[j+1][i+1]); dh += AIR_VADV*tx*ty*((bmap_blockairh[j+1][i+1]&0x8) ? odh : hv[j+1][i+1]);
} }
if(!sim.gravityMode) if(!sim.gravityMode)
{ //Vertical gravity only for the time being { //Vertical gravity only for the time being
float airdiff = hv[y-1][x]-hv[y][x]; float airdiff = hv[y-1][x]-hv[y][x];
if(airdiff>0 && !bmap_blockairh[y-1][x]) if(airdiff>0 && !(bmap_blockairh[y-1][x]&0x8))
vy[y][x] -= airdiff/5000.0f; vy[y][x] -= airdiff/5000.0f;
} }
ohv[y][x] = dh; ohv[y][x] = dh;

View File

@ -4023,7 +4023,12 @@ void Simulation::update_particles_i(int start, int inc)
} }
} }
} }
else parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); else
{
if (!(air->bmap_blockairh[y/CELL][x/CELL]&0x8))
air->bmap_blockairh[y/CELL][x/CELL]++;
parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP);
}
} }
if (t==PT_LIFE) if (t==PT_LIFE)
@ -4739,7 +4744,7 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
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_EWALL && !emap[y][x])); air->bmap_blockair[y][x] = (bmap[y][x]==WL_WALL || bmap[y][x]==WL_WALLELEC || (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_GRAV || (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_GRAV || (bmap[y][x]==WL_EWALL && !emap[y][x])) ? 0x8:0;
} }
} }
} }

View File

@ -67,7 +67,7 @@ int Element_TTAN::update(UPDATE_FUNC_ARGS)
if(ttan>=2) { if(ttan>=2) {
sim->air->bmap_blockair[y/CELL][x/CELL] = 1; sim->air->bmap_blockair[y/CELL][x/CELL] = 1;
sim->air->bmap_blockairh[y/CELL][x/CELL] = 1; sim->air->bmap_blockairh[y/CELL][x/CELL] = 0x8;
} }
return 0; return 0;
} }