v2.2.0: added various safety checks to prevent rare crash errors
This commit is contained in:
@@ -280,6 +280,7 @@ public class Group extends Gizmo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void clear() {
|
public synchronized void clear() {
|
||||||
|
if (length == 0) return;
|
||||||
for (int i=0; i < length; i++) {
|
for (int i=0; i < length; i++) {
|
||||||
Gizmo g = members.get( i );
|
Gizmo g = members.get( i );
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
|
|||||||
@@ -79,10 +79,14 @@ public enum Sample {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (String asset : toLoad) {
|
for (String asset : toLoad) {
|
||||||
|
try {
|
||||||
Sound newSound = Gdx.audio.newSound(Gdx.files.internal(asset));
|
Sound newSound = Gdx.audio.newSound(Gdx.files.internal(asset));
|
||||||
synchronized (INSTANCE) {
|
synchronized (INSTANCE) {
|
||||||
ids.put(asset, newSound);
|
ids.put(asset, newSound);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
Game.reportException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
|||||||
@@ -448,8 +448,10 @@ public abstract class Char extends Actor {
|
|||||||
enemy.damage(-1, this);
|
enemy.damage(-1, this);
|
||||||
DeathMark.processFearTheReaper(enemy);
|
DeathMark.processFearTheReaper(enemy);
|
||||||
}
|
}
|
||||||
|
if (enemy.sprite != null) {
|
||||||
enemy.sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Preparation.class, "assassinated"));
|
enemy.sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Preparation.class, "assassinated"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Talent.CombinedLethalityTriggerTracker combinedLethality = buff(Talent.CombinedLethalityTriggerTracker.class);
|
Talent.CombinedLethalityTriggerTracker combinedLethality = buff(Talent.CombinedLethalityTriggerTracker.class);
|
||||||
if (combinedLethality != null){
|
if (combinedLethality != null){
|
||||||
@@ -464,13 +466,17 @@ public abstract class Char extends Actor {
|
|||||||
enemy.damage(-1, this);
|
enemy.damage(-1, this);
|
||||||
DeathMark.processFearTheReaper(enemy);
|
DeathMark.processFearTheReaper(enemy);
|
||||||
}
|
}
|
||||||
|
if (enemy.sprite != null) {
|
||||||
enemy.sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Talent.CombinedLethalityTriggerTracker.class, "executed"));
|
enemy.sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Talent.CombinedLethalityTriggerTracker.class, "executed"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
combinedLethality.detach();
|
combinedLethality.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enemy.sprite != null) {
|
||||||
enemy.sprite.bloodBurstA(sprite.center(), effectiveDamage);
|
enemy.sprite.bloodBurstA(sprite.center(), effectiveDamage);
|
||||||
enemy.sprite.flash();
|
enemy.sprite.flash();
|
||||||
|
}
|
||||||
|
|
||||||
if (!enemy.isAlive() && visibleFight) {
|
if (!enemy.isAlive() && visibleFight) {
|
||||||
if (enemy == Dungeon.hero) {
|
if (enemy == Dungeon.hero) {
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public class NecromancerSprite extends MobSprite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finishSummoning(){
|
public void finishSummoning(){
|
||||||
|
if (summoningBones != null) {
|
||||||
if (summoningBones.visible) {
|
if (summoningBones.visible) {
|
||||||
Sample.INSTANCE.play(Assets.Sounds.BONES);
|
Sample.INSTANCE.play(Assets.Sounds.BONES);
|
||||||
summoningBones.burst(Speck.factory(Speck.RATTLE), 5);
|
summoningBones.burst(Speck.factory(Speck.RATTLE), 5);
|
||||||
@@ -111,6 +112,7 @@ public class NecromancerSprite extends MobSprite {
|
|||||||
summoningBones.on = false;
|
summoningBones.on = false;
|
||||||
}
|
}
|
||||||
summoningBones = null;
|
summoningBones = null;
|
||||||
|
}
|
||||||
idle();
|
idle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class Toolbar extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
if (Dungeon.hero != null && Dungeon.hero.ready && !GameScene.cancel()) {
|
||||||
|
|
||||||
String[] slotNames = new String[6];
|
String[] slotNames = new String[6];
|
||||||
Image[] slotIcons = new Image[6];
|
Image[] slotIcons = new Image[6];
|
||||||
@@ -199,7 +199,7 @@ public class Toolbar extends Component {
|
|||||||
add(btnWait = new Tool(24, 0, 20, 26) {
|
add(btnWait = new Tool(24, 0, 20, 26) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
if (Dungeon.hero != null && Dungeon.hero.ready && !GameScene.cancel()) {
|
||||||
examining = false;
|
examining = false;
|
||||||
Dungeon.hero.rest(false);
|
Dungeon.hero.rest(false);
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ public class Toolbar extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onLongClick() {
|
protected boolean onLongClick() {
|
||||||
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
if (Dungeon.hero != null && Dungeon.hero.ready && !GameScene.cancel()) {
|
||||||
examining = false;
|
examining = false;
|
||||||
Dungeon.hero.rest(true);
|
Dungeon.hero.rest(true);
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ public class Toolbar extends Component {
|
|||||||
add(new Button(){
|
add(new Button(){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
if (Dungeon.hero != null && Dungeon.hero.ready && !GameScene.cancel()) {
|
||||||
examining = false;
|
examining = false;
|
||||||
Dungeon.hero.rest(true);
|
Dungeon.hero.rest(true);
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@ public class Toolbar extends Component {
|
|||||||
add(new Button(){
|
add(new Button(){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
if (Dungeon.hero != null && Dungeon.hero.ready && !GameScene.cancel()) {
|
||||||
Dungeon.hero.waitOrPickup = true;
|
Dungeon.hero.waitOrPickup = true;
|
||||||
if ((Dungeon.level.heaps.get(Dungeon.hero.pos) != null || Dungeon.hero.canSelfTrample())
|
if ((Dungeon.level.heaps.get(Dungeon.hero.pos) != null || Dungeon.hero.canSelfTrample())
|
||||||
&& Dungeon.hero.handle(Dungeon.hero.pos)){
|
&& Dungeon.hero.handle(Dungeon.hero.pos)){
|
||||||
@@ -271,7 +271,7 @@ public class Toolbar extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onLongClick() {
|
protected boolean onLongClick() {
|
||||||
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
if (Dungeon.hero != null && Dungeon.hero.ready && !GameScene.cancel()) {
|
||||||
examining = false;
|
examining = false;
|
||||||
Dungeon.hero.rest(true);
|
Dungeon.hero.rest(true);
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ public class Toolbar extends Component {
|
|||||||
add(btnSearch = new Tool(44, 0, 20, 26) {
|
add(btnSearch = new Tool(44, 0, 20, 26) {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (Dungeon.hero.ready) {
|
if (Dungeon.hero != null && Dungeon.hero.ready) {
|
||||||
if (!examining && !GameScene.cancel()) {
|
if (!examining && !GameScene.cancel()) {
|
||||||
GameScene.selectCell(informer);
|
GameScene.selectCell(informer);
|
||||||
examining = true;
|
examining = true;
|
||||||
@@ -324,7 +324,7 @@ public class Toolbar extends Component {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (Dungeon.hero.ready || !Dungeon.hero.isAlive()) {
|
if (Dungeon.hero != null && (Dungeon.hero.ready || !Dungeon.hero.isAlive())) {
|
||||||
if (SPDSettings.interfaceSize() == 2) {
|
if (SPDSettings.interfaceSize() == 2) {
|
||||||
GameScene.toggleInvPane();
|
GameScene.toggleInvPane();
|
||||||
} else {
|
} else {
|
||||||
@@ -394,7 +394,7 @@ public class Toolbar extends Component {
|
|||||||
add(new Button(){
|
add(new Button(){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
if (Dungeon.hero != null && Dungeon.hero.ready && !GameScene.cancel()) {
|
||||||
ArrayList<Bag> bags = Dungeon.hero.belongings.getBags();
|
ArrayList<Bag> bags = Dungeon.hero.belongings.getBags();
|
||||||
String[] names = new String[bags.size()];
|
String[] names = new String[bags.size()];
|
||||||
Image[] images = new Image[bags.size()];
|
Image[] images = new Image[bags.size()];
|
||||||
|
|||||||
Reference in New Issue
Block a user