V0.2.0c : Added nullchecks to heaps and level heap placement on load.
This commit is contained in:
parent
a1f6065b46
commit
8febc963e5
|
@ -18,6 +18,7 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items;
|
package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||||
|
@ -340,7 +341,8 @@ public class Heap implements Bundlable {
|
||||||
public void restoreFromBundle( Bundle bundle ) {
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
pos = bundle.getInt( POS );
|
pos = bundle.getInt( POS );
|
||||||
type = Type.valueOf( bundle.getString( TYPE ) );
|
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
|
@Override
|
||||||
|
|
|
@ -253,7 +253,8 @@ public abstract class Level implements Bundlable {
|
||||||
if (resizingNeeded) {
|
if (resizingNeeded) {
|
||||||
heap.pos = adjustPos( heap.pos );
|
heap.pos = adjustPos( heap.pos );
|
||||||
}
|
}
|
||||||
heaps.put( heap.pos, heap );
|
if (!heap.isEmpty())
|
||||||
|
heaps.put( heap.pos, heap );
|
||||||
}
|
}
|
||||||
|
|
||||||
collection = bundle.getCollection( PLANTS );
|
collection = bundle.getCollection( PLANTS );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user