diff --git a/src/simulation/Air.cpp b/src/simulation/Air.cpp index 6769346ee0..9bb04cec4f 100644 --- a/src/simulation/Air.cpp +++ b/src/simulation/Air.cpp @@ -358,20 +358,25 @@ void Air::RecalculateBlockAirMaps() for (int i = 0; i <= sim.parts_lastActiveIndex; i++) { int type = sim.parts[i].type; + if (!type) + continue; // Real TTAN would only block if there was enough TTAN // but it would be more expensive and complicated to actually check that // so just block for a frame, if it wasn't supposed to block it will continue allowing air next frame if (type == PT_TTAN) { int x = ((int)(sim.parts[i].x+0.5f))/CELL, y = ((int)(sim.parts[i].y+0.5f))/CELL; - bmap_blockair[y][x] = 1; - bmap_blockairh[y][x] = 0x8; + if (sim.InBounds(x, y)) + { + bmap_blockair[y][x] = 1; + bmap_blockairh[y][x] = 0x8; + } } // mostly accurate insulator blocking, besides checking GEL else if ((type == PT_HSWC && sim.parts[i].life != 10) || sim.elements[type].HeatConduct <= (rand()%250)) { int x = ((int)(sim.parts[i].x+0.5f))/CELL, y = ((int)(sim.parts[i].y+0.5f))/CELL; - if (!(bmap_blockairh[y][x]&0x8)) + if (sim.InBounds(x, y) && !(bmap_blockairh[y][x]&0x8)) bmap_blockairh[y][x]++; } }