v0.6.0: code cleanup relating to weak floor rooms

This commit is contained in:
Evan Debenham 2017-04-16 14:49:29 -04:00 committed by Evan Debenham
parent 3a78b0e978
commit ac04546efe
4 changed files with 7 additions and 19 deletions

View File

@ -156,10 +156,6 @@ public abstract class Level implements Bundlable {
public int color1 = 0x004400;
public int color2 = 0x88CC44;
//FIXME this is sloppy. Should be able to keep track of this without static variables
public static boolean pitRoomNeeded = false;
public static boolean weakFloorCreated = false;
private static final String VERSION = "version";
private static final String MAP = "map";
private static final String VISITED = "visited";
@ -242,11 +238,7 @@ public abstract class Level implements Bundlable {
}
}
boolean pitNeeded = Dungeon.depth > 1 && weakFloorCreated;
do {
pitRoomNeeded = pitNeeded;
weakFloorCreated = false;
width = height = length = 0;
mobs = new HashSet<>();
@ -321,7 +313,6 @@ public abstract class Level implements Bundlable {
setSize( bundle.getInt("width"), bundle.getInt("height"));
} else
setSize( 32, 32); //default sizes
PathFinder.setMapSize(width(), height());
mobs = new HashSet<>();
heaps = new SparseArray<>();
@ -340,8 +331,6 @@ public abstract class Level implements Bundlable {
exit = bundle.getInt( EXIT );
locked = bundle.getBoolean( LOCKED );
weakFloorCreated = false;
//for pre-0.4.3 saves
if (version <= ShatteredPixelDungeon.v0_4_2b){

View File

@ -397,10 +397,6 @@ public abstract class RegularLevel extends Level {
rooms = new ArrayList<>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) );
for (Room r : rooms) {
if (r instanceof WeakFloorRoom || r.legacyType.equals("WEAK_FLOOR")) {
weakFloorCreated = true;
break;
}
if (r instanceof EntranceRoom || r.legacyType.equals("ENTRANCE")){
roomEntrance = r;
} else if (r instanceof ExitRoom || r.legacyType.equals("EXIT")){

View File

@ -31,7 +31,6 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public class SpecialRoom extends Room {
@ -98,6 +97,10 @@ public class SpecialRoom extends Room {
runSpecials.add( type );
}
}
public static void resetPitRoom(int depth){
if (pitNeededDepth == depth) pitNeededDepth = Integer.MAX_VALUE;
}
public static void disableGaranteedWell(){
guaranteedWellDepth = Integer.MAX_VALUE;

View File

@ -28,7 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndError;
@ -290,10 +290,10 @@ public class InterlevelScene extends PixelScene {
Actor.fixTime();
SpecialRoom.resetPitRoom(Dungeon.depth+1);
Dungeon.depth--;
Level level = Dungeon.newLevel();
//FIXME this only partially addresses issues regarding weak floors.
RegularLevel.weakFloorCreated = false;
Dungeon.switchLevel( level, level.entrance );
}