v0.8.2c: added crash safety checks to tengu and WndBlacksmith
This commit is contained in:
parent
8e5648bbe4
commit
17ac29b190
|
@ -265,19 +265,23 @@ public class NewTengu extends Mob {
|
|||
|
||||
//otherwise, jump in a larger possible area, as the room is bigger
|
||||
} else {
|
||||
|
||||
|
||||
int tries = 100;
|
||||
do {
|
||||
newPos = Random.Int(level.length());
|
||||
} while (
|
||||
level.solid[newPos] ||
|
||||
tries--;
|
||||
} while ( tries > 0 &&
|
||||
(level.solid[newPos] ||
|
||||
level.distance(newPos, enemy.pos) < 5 ||
|
||||
level.distance(newPos, enemy.pos) > 7 ||
|
||||
level.distance(newPos, Dungeon.hero.pos) < 5 ||
|
||||
level.distance(newPos, Dungeon.hero.pos) > 7 ||
|
||||
level.distance(newPos, pos) < 5 ||
|
||||
Actor.findChar(newPos) != null ||
|
||||
Dungeon.level.heaps.get(newPos) != null);
|
||||
|
||||
Dungeon.level.heaps.get(newPos) != null));
|
||||
|
||||
if (tries <= 0) newPos = pos;
|
||||
|
||||
if (level.heroFOV[pos]) CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
|
||||
|
||||
sprite.move( pos, newPos );
|
||||
|
|
|
@ -103,7 +103,7 @@ public class WndBlacksmith extends Window {
|
|||
protected WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null) {
|
||||
if (item != null && btnPressed.parent != null) {
|
||||
btnPressed.item( item );
|
||||
|
||||
if (btnItem1.item != null && btnItem2.item != null) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user