v0.7.5d: added various safety checks
This commit is contained in:
parent
2c2cae01b5
commit
9c652273a5
|
@ -22,6 +22,7 @@
|
|||
package com.watabou.noosa.audio;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.watabou.noosa.Game;
|
||||
|
||||
public enum Music {
|
||||
|
||||
|
@ -50,10 +51,15 @@ public enum Music {
|
|||
return;
|
||||
}
|
||||
|
||||
player = Gdx.audio.newMusic(Gdx.files.internal(assetName));
|
||||
player.setLooping(looping);
|
||||
player.setVolume(volume);
|
||||
player.play();
|
||||
try {
|
||||
player = Gdx.audio.newMusic(Gdx.files.internal(assetName));
|
||||
player.setLooping(looping);
|
||||
player.setVolume(volume);
|
||||
player.play();
|
||||
} catch (Exception e){
|
||||
Game.reportException(e);
|
||||
player = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -52,10 +52,15 @@ public class Ballistica {
|
|||
public Ballistica( int from, int to, int params ){
|
||||
sourcePos = from;
|
||||
build(from, to, (params & STOP_TARGET) > 0, (params & STOP_CHARS) > 0, (params & STOP_TERRAIN) > 0);
|
||||
if (collisionPos != null)
|
||||
dist = path.indexOf( collisionPos );
|
||||
else
|
||||
collisionPos = path.get( dist=path.size()-1 );
|
||||
if (collisionPos != null) {
|
||||
dist = path.indexOf(collisionPos);
|
||||
} else if (!path.isEmpty()) {
|
||||
collisionPos = path.get(dist = path.size() - 1);
|
||||
} else {
|
||||
path.add(from);
|
||||
collisionPos = from;
|
||||
dist = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void build( int from, int to, boolean stopTarget, boolean stopChars, boolean stopTerrain ) {
|
||||
|
|
|
@ -67,7 +67,7 @@ public class WndGame extends Window {
|
|||
}
|
||||
|
||||
// Restart
|
||||
if (!Dungeon.hero.isAlive()) {
|
||||
if (Dungeon.hero == null || !Dungeon.hero.isAlive()) {
|
||||
|
||||
RedButton btnStart;
|
||||
addButton( btnStart = new RedButton( Messages.get(this, "start") ) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user