v0.7.0: removed leftover legacy room code from pre-0.6.0

This commit is contained in:
Evan Debenham 2018-06-24 22:20:27 -04:00
parent 6563576648
commit a282833a0e
2 changed files with 4 additions and 10 deletions

View File

@ -452,7 +452,7 @@ public abstract class RegularLevel extends Level {
public int fallCell( boolean fallIntoPit ) { public int fallCell( boolean fallIntoPit ) {
if (fallIntoPit) { if (fallIntoPit) {
for (Room room : rooms) { for (Room room : rooms) {
if (room instanceof PitRoom || room.legacyType.equals("PIT")) { if (room instanceof PitRoom) {
int result; int result;
do { do {
result = pointToCell(room.random()); result = pointToCell(room.random());
@ -482,9 +482,9 @@ public abstract class RegularLevel extends Level {
rooms = new ArrayList<>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) ); rooms = new ArrayList<>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) );
for (Room r : rooms) { for (Room r : rooms) {
r.onLevelLoad( this ); r.onLevelLoad( this );
if (r instanceof EntranceRoom || r.legacyType.equals("ENTRANCE")){ if (r instanceof EntranceRoom ){
roomEntrance = r; roomEntrance = r;
} else if (r instanceof ExitRoom || r.legacyType.equals("EXIT")){ } else if (r instanceof ExitRoom ){
roomExit = r; roomExit = r;
} }
} }

View File

@ -345,16 +345,12 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable {
return edges; return edges;
} }
public String legacyType = "NULL";
@Override @Override
public void storeInBundle( Bundle bundle ) { public void storeInBundle( Bundle bundle ) {
bundle.put( "left", left ); bundle.put( "left", left );
bundle.put( "top", top ); bundle.put( "top", top );
bundle.put( "right", right ); bundle.put( "right", right );
bundle.put( "bottom", bottom ); bundle.put( "bottom", bottom );
if (!legacyType.equals("NULL"))
bundle.put( "type", legacyType );
} }
@Override @Override
@ -363,11 +359,9 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable {
top = bundle.getInt( "top" ); top = bundle.getInt( "top" );
right = bundle.getInt( "right" ); right = bundle.getInt( "right" );
bottom = bundle.getInt( "bottom" ); bottom = bundle.getInt( "bottom" );
if (bundle.contains( "type" ))
legacyType = bundle.getString( "type" );
} }
//Note that currently connections and neighbours are not preserved on load //FIXME currently connections and neighbours are not preserved on load
public void onLevelLoad( Level level ){ public void onLevelLoad( Level level ){
//does nothing by default //does nothing by default
} }