v0.6.5b: added a variety of safety checks
This commit is contained in:
parent
8733556462
commit
05028ebc2a
|
@ -99,8 +99,12 @@ public enum Music {
|
|||
|
||||
public void stop() {
|
||||
if (player != null) {
|
||||
player.stop();
|
||||
player.release();
|
||||
try {
|
||||
player.stop();
|
||||
player.release();
|
||||
} catch ( Exception e ){
|
||||
Game.reportException(e);
|
||||
}
|
||||
player = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,10 +42,12 @@ public class ShockingDart extends TippedDart {
|
|||
defender.damage(Random.NormalIntRange(8, 12), this);
|
||||
|
||||
CharSprite s = defender.sprite;
|
||||
ArrayList<Lightning.Arc> arcs = new ArrayList<>();
|
||||
arcs.add(new Lightning.Arc(new PointF(s.x, s.y + s.height/2), new PointF(s.x + s.width, s.y + s.height/2)));
|
||||
arcs.add(new Lightning.Arc(new PointF(s.x + s.width/2, s.y), new PointF(s.x + s.width/2, s.y + s.height)));
|
||||
defender.sprite.parent.add( new Lightning( arcs, null ) );
|
||||
if (s != null && s.parent != null) {
|
||||
ArrayList<Lightning.Arc> arcs = new ArrayList<>();
|
||||
arcs.add(new Lightning.Arc(new PointF(s.x, s.y + s.height / 2), new PointF(s.x + s.width, s.y + s.height / 2)));
|
||||
arcs.add(new Lightning.Arc(new PointF(s.x + s.width / 2, s.y), new PointF(s.x + s.width / 2, s.y + s.height)));
|
||||
s.parent.add(new Lightning(arcs, null));
|
||||
}
|
||||
|
||||
return super.proc(attacker, defender, damage);
|
||||
}
|
||||
|
|
|
@ -273,10 +273,15 @@ public abstract class RegularLevel extends Level {
|
|||
@Override
|
||||
public int randomDestination() {
|
||||
|
||||
int count = 0;
|
||||
int cell = -1;
|
||||
|
||||
while (true) {
|
||||
|
||||
if (++count > 30) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Room room = Random.element( rooms );
|
||||
if (room == null) {
|
||||
continue;
|
||||
|
|
|
@ -159,6 +159,11 @@ public class GameScene extends PixelScene {
|
|||
@Override
|
||||
public void create() {
|
||||
|
||||
if (Dungeon.hero == null){
|
||||
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
|
||||
return;
|
||||
}
|
||||
|
||||
Music.INSTANCE.play( Assets.TUNE, true );
|
||||
|
||||
SPDSettings.lastClass(Dungeon.hero.heroClass.ordinal());
|
||||
|
|
|
@ -91,7 +91,11 @@ public class WndRanking extends WndTabbed {
|
|||
thread = null;
|
||||
if (error == null) {
|
||||
remove( busy );
|
||||
createControls();
|
||||
if (Dungeon.hero != null) {
|
||||
createControls();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
} else {
|
||||
hide();
|
||||
Game.scene().add( new WndError( error ) );
|
||||
|
|
Loading…
Reference in New Issue
Block a user