v0.3.1: heaps are now always visible after being first seen

This commit is contained in:
Evan Debenham 2015-07-19 02:20:52 -04:00 committed by Evan Debenham
parent a1e9b10358
commit d007988701
2 changed files with 8 additions and 0 deletions

View File

@ -82,6 +82,7 @@ public class Heap implements Bundlable {
public int pos = 0;
public ItemSprite sprite;
public boolean seen = false;
public LinkedList<Item> items = new LinkedList<Item>();
@ -457,6 +458,7 @@ public class Heap implements Bundlable {
}
private static final String POS = "pos";
private static final String SEEN = "seen";
private static final String TYPE = "type";
private static final String ITEMS = "items";
@ -464,6 +466,7 @@ public class Heap implements Bundlable {
@Override
public void restoreFromBundle( Bundle bundle ) {
pos = bundle.getInt( POS );
seen = bundle.getBoolean( SEEN );
type = Type.valueOf( bundle.getString( TYPE ) );
items = new LinkedList<Item>( (Collection<Item>) ((Collection<?>) bundle.getCollection( ITEMS )) );
items.removeAll(Collections.singleton(null));
@ -472,6 +475,7 @@ public class Heap implements Bundlable {
@Override
public void storeInBundle( Bundle bundle ) {
bundle.put( POS, pos );
bundle.put( SEEN, seen );
bundle.put( TYPE, type.toString() );
bundle.put( ITEMS, items );
}

View File

@ -952,6 +952,10 @@ public abstract class Level implements Bundlable {
}
}
}
for (Heap heap : heaps.values())
if (!heap.seen && fieldOfView[heap.pos])
heap.seen = true;
return fieldOfView;
}