v0.7.5d: added various safety checks
This commit is contained in:
+9
-4
@@ -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") ) {
|
||||
|
||||
Reference in New Issue
Block a user