v0.8.0b: added a few safety checks to prevent rare crashes
This commit is contained in:
parent
9912c5e1ee
commit
f2d0aa959a
|
@ -54,6 +54,13 @@ public class DM201 extends DM200 {
|
|||
|
||||
@Override
|
||||
protected boolean act() {
|
||||
|
||||
//in case DM-201 hasn't been able to act yet
|
||||
if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
|
||||
fieldOfView = new boolean[Dungeon.level.length()];
|
||||
Dungeon.level.updateFieldOfView( this, fieldOfView );
|
||||
}
|
||||
|
||||
GameScene.add(Blob.seed(pos, 0, CorrosiveGas.class));
|
||||
if (state == HUNTING && enemy != null && enemySeen
|
||||
&& threatened && !Dungeon.level.adjacent(pos, enemy.pos)){
|
||||
|
|
|
@ -45,7 +45,7 @@ public class AttackIndicator extends Tag {
|
|||
|
||||
private CharSprite sprite = null;
|
||||
|
||||
private static Mob lastTarget;
|
||||
private Mob lastTarget;
|
||||
private ArrayList<Mob> candidates = new ArrayList<>();
|
||||
|
||||
public AttackIndicator() {
|
||||
|
@ -74,7 +74,7 @@ public class AttackIndicator extends Tag {
|
|||
super.layout();
|
||||
|
||||
if (sprite != null) {
|
||||
sprite.x = x + (width - sprite.width()) / 2;
|
||||
sprite.x = x + (width - sprite.width()) / 2 + 1;
|
||||
sprite.y = y + (height - sprite.height()) / 2;
|
||||
PixelScene.align(sprite);
|
||||
}
|
||||
|
@ -148,9 +148,7 @@ public class AttackIndicator extends Tag {
|
|||
sprite.paused = true;
|
||||
add( sprite );
|
||||
|
||||
sprite.x = x + (width - sprite.width()) / 2 + 1;
|
||||
sprite.y = y + (height - sprite.height()) / 2;
|
||||
PixelScene.align(sprite);
|
||||
layout();
|
||||
}
|
||||
|
||||
private boolean enabled = true;
|
||||
|
@ -178,10 +176,12 @@ public class AttackIndicator extends Tag {
|
|||
}
|
||||
|
||||
public static void target( Char target ) {
|
||||
lastTarget = (Mob)target;
|
||||
synchronized (instance) {
|
||||
instance.lastTarget = (Mob) target;
|
||||
instance.updateImage();
|
||||
|
||||
TargetHealthIndicator.instance.target( target );
|
||||
TargetHealthIndicator.instance.target(target);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateState() {
|
||||
|
|
|
@ -125,8 +125,10 @@ public class WndStartGame extends Window {
|
|||
ShatteredPixelDungeon.scene().addToFront(new WndChallenges(SPDSettings.challenges(), true) {
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
icon( Icons.get( SPDSettings.challenges() > 0 ?
|
||||
Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ) );
|
||||
if (parent != null) {
|
||||
icon(Icons.get(SPDSettings.challenges() > 0 ?
|
||||
Icons.CHALLENGE_ON : Icons.CHALLENGE_OFF));
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user