v0.4.3a: fixed nullpointer exceptions caused by new blob bundle restore behaviour

This commit is contained in:
Evan Debenham 2016-10-24 13:55:59 -04:00
parent 46615e0949
commit b104ad197d
5 changed files with 15 additions and 13 deletions

View File

@ -37,12 +37,13 @@ public class Alchemy extends Blob {
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle ); super.restoreFromBundle( bundle );
for (int i=0; i < cur.length; i++) { if (volume > 0)
if (cur[i] > 0) { for (int i=0; i < cur.length; i++) {
pos = i; if (cur[i] > 0) {
break; pos = i;
break;
}
} }
}
} }
@Override @Override

View File

@ -245,7 +245,7 @@ public class Blob extends Actor {
public static int volumeAt( int cell, Class<? extends Blob> type){ public static int volumeAt( int cell, Class<? extends Blob> type){
Blob gas = Dungeon.level.blobs.get( type ); Blob gas = Dungeon.level.blobs.get( type );
if (gas == null) { if (gas == null || gas.volume == 0) {
return 0; return 0;
} else { } else {
return gas.cur[cell]; return gas.cur[cell];

View File

@ -41,12 +41,13 @@ public class WellWater extends Blob {
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle ); super.restoreFromBundle( bundle );
for (int i=0; i < cur.length; i++) { if (volume > 0)
if (cur[i] > 0) { for (int i=0; i < cur.length; i++) {
pos = i; if (cur[i] > 0) {
break; pos = i;
break;
}
} }
}
} }
@Override @Override

View File

@ -66,7 +66,7 @@ public class PotionOfPurity extends Potion {
for (int j=0; j < blobs.length; j++) { for (int j=0; j < blobs.length; j++) {
Blob blob = blobs[j]; Blob blob = blobs[j];
if (blob == null) { if (blob == null || blob.volume == 0) {
continue; continue;
} }

View File

@ -89,7 +89,7 @@ public class WndInfoCell extends Window {
add(info); add(info);
for (Blob blob:Dungeon.level.blobs.values()) { for (Blob blob:Dungeon.level.blobs.values()) {
if (blob.cur[cell] > 0 && blob.tileDesc() != null) { if (blob.volume > 0 && blob.cur[cell] > 0 && blob.tileDesc() != null) {
if (desc.length() > 0) { if (desc.length() > 0) {
desc += "\n\n"; desc += "\n\n";
} }