V0.2.0c : Added nullchecks to heaps and level heap placement on load.

This commit is contained in:
Evan Debenham 2014-09-21 22:34:06 -04:00
parent a1f6065b46
commit 8febc963e5
2 changed files with 5 additions and 2 deletions

View File

@ -18,6 +18,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
@ -340,7 +341,8 @@ public class Heap implements Bundlable {
public void restoreFromBundle( Bundle bundle ) {
pos = bundle.getInt( POS );
type = Type.valueOf( bundle.getString( TYPE ) );
items = new LinkedList<Item>( (Collection<? extends Item>) bundle.getCollection( ITEMS ) );
items = new LinkedList<Item>( (Collection<? extends Item>) bundle.getCollection( ITEMS ) );
items.removeAll(Collections.singleton(null));
}
@Override

View File

@ -253,7 +253,8 @@ public abstract class Level implements Bundlable {
if (resizingNeeded) {
heap.pos = adjustPos( heap.pos );
}
heaps.put( heap.pos, heap );
if (!heap.isEmpty())
heaps.put( heap.pos, heap );
}
collection = bundle.getCollection( PLANTS );