v0.4.3: fixed dungeon tile map occasionaly causing crashes

This commit is contained in:
Evan Debenham 2016-10-02 16:31:47 -04:00
parent 450804e884
commit 46be732d44

View File

@ -174,9 +174,10 @@ public class DungeonTilemap extends Tilemap {
@Override
public synchronized void updateMapCell(int cell) {
//update in a 3x3 grid to accound for neighbours which might also be affected
super.updateMapCell(cell - mapWidth - 1);
super.updateMapCell(cell + mapWidth + 1);
super.updateMapCell(Math.max( 0, cell - mapWidth - 1));
super.updateMapCell(Math.min( size-1, cell + mapWidth + 1));
for (int i : PathFinder.NEIGHBOURS9)
if (cell+i >= 0 && cell+i <= 1023)
data[cell+i] = getTileVisual(cell+i, map[cell+i]);
}