v0.4.2a: fixed additional map bounds errors relating to blobs
This commit is contained in:
parent
184993936e
commit
cb1f63890b
|
@ -149,6 +149,7 @@ public class Blob extends Actor {
|
||||||
for (int i=area.top-1; i <= area.bottom; i++) {
|
for (int i=area.top-1; i <= area.bottom; i++) {
|
||||||
for (int j = area.left-1; j <= area.right; j++) {
|
for (int j = area.left-1; j <= area.right; j++) {
|
||||||
cell = j + i*Dungeon.level.width();
|
cell = j + i*Dungeon.level.width();
|
||||||
|
if (Dungeon.level.insideMap(cell)) {
|
||||||
if (!blocking[cell]) {
|
if (!blocking[cell]) {
|
||||||
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
|
@ -192,6 +193,7 @@ public class Blob extends Actor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void seed( Level level, int cell, int amount ) {
|
public void seed( Level level, int cell, int amount ) {
|
||||||
if (cur == null) cur = new int[level.length()];
|
if (cur == null) cur = new int[level.length()];
|
||||||
|
|
|
@ -1001,12 +1001,10 @@ public abstract class Level implements Bundlable {
|
||||||
|
|
||||||
//returns true if the input is a valid tile within the level
|
//returns true if the input is a valid tile within the level
|
||||||
public boolean insideMap( int tile ){
|
public boolean insideMap( int tile ){
|
||||||
//outside map array
|
//top and bottom row and beyond
|
||||||
return !((tile < 0 || tile >= length()) ||
|
return !((tile < width || tile >= length - width) ||
|
||||||
//top and bottom row
|
|
||||||
(tile < width() || tile >= length() - width()) ||
|
|
||||||
//left and right column
|
//left and right column
|
||||||
(tile % width() == 0 || tile % width() == width()-1));
|
(tile % width == 0 || tile % width == width-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point cellToPoint( int cell ){
|
public Point cellToPoint( int cell ){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user