v0.9.1b: fixed rare cases of levelgen freezes with Cached Rations
This commit is contained in:
parent
7c1ada875f
commit
4d59fa6682
|
@ -420,9 +420,11 @@ public abstract class RegularLevel extends Level {
|
|||
Talent.CachedRationsDropped dropped = Buff.affect(Dungeon.hero, Talent.CachedRationsDropped.class);
|
||||
if (dropped.count() < 2 + 2*Dungeon.hero.pointsInTalent(Talent.CACHED_RATIONS)){
|
||||
int cell;
|
||||
int tries = 100;
|
||||
do {
|
||||
cell = randomDropCell(SpecialRoom.class);
|
||||
} while (room(cell) instanceof SecretRoom);
|
||||
} while (tries-- > 0 && room(cell) instanceof SecretRoom);
|
||||
if (!(room(cell) instanceof SecretRoom) && cell != -1) {
|
||||
if (map[cell] == Terrain.HIGH_GRASS || map[cell] == Terrain.FURROWED_GRASS) {
|
||||
map[cell] = Terrain.GRASS;
|
||||
losBlocking[cell] = false;
|
||||
|
@ -431,6 +433,7 @@ public abstract class RegularLevel extends Level {
|
|||
dropped.countUp(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//guide pages
|
||||
Collection<String> allPages = Document.ADVENTURERS_GUIDE.pages();
|
||||
|
@ -503,7 +506,10 @@ public abstract class RegularLevel extends Level {
|
|||
protected int randomDropCell( Class<?extends Room> roomType ) {
|
||||
while (true) {
|
||||
Room room = randomRoom( roomType );
|
||||
if (room != null && room != roomEntrance) {
|
||||
if (room == null){
|
||||
return -1;
|
||||
}
|
||||
if (room != roomEntrance) {
|
||||
int pos = pointToCell(room.random());
|
||||
if (passable[pos] && !solid[pos]
|
||||
&& pos != exit
|
||||
|
|
Loading…
Reference in New Issue
Block a user