v0.6.2c: fixed a variety of rare crash bugs

This commit is contained in:
Evan Debenham 2017-11-12 23:30:57 -05:00 committed by Evan Debenham
parent 31042228ff
commit 1fbaa27f5b
6 changed files with 14 additions and 17 deletions

View File

@ -30,7 +30,7 @@ import java.util.ArrayList;
public class Camera extends Gizmo { public class Camera extends Gizmo {
protected static ArrayList<Camera> all = new ArrayList<Camera>(); private static ArrayList<Camera> all = new ArrayList<Camera>();
protected static float invW2; protected static float invW2;
protected static float invH2; protected static float invH2;
@ -66,7 +66,7 @@ public class Camera extends Gizmo {
return reset( createFullscreen( 1 ) ); return reset( createFullscreen( 1 ) );
} }
public static Camera reset( Camera newCamera ) { public static synchronized Camera reset( Camera newCamera ) {
invW2 = 2f / Game.width; invW2 = 2f / Game.width;
invH2 = 2f / Game.height; invH2 = 2f / Game.height;
@ -80,20 +80,18 @@ public class Camera extends Gizmo {
return main = add( newCamera ); return main = add( newCamera );
} }
public static Camera add( Camera camera ) { public static synchronized Camera add( Camera camera ) {
all.add( camera ); all.add( camera );
return camera; return camera;
} }
public static Camera remove( Camera camera ) { public static synchronized Camera remove( Camera camera ) {
all.remove( camera ); all.remove( camera );
return camera; return camera;
} }
public static void updateAll() { public static synchronized void updateAll() {
int length = all.size(); for (Camera c : all) {
for (int i=0; i < length; i++) {
Camera c = all.get( i );
if (c.exists && c.active) { if (c.exists && c.active) {
c.update(); c.update();
} }

View File

@ -3,7 +3,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.android.tools.build:gradle:2.3.3'
} }
} }

View File

@ -220,7 +220,7 @@ public abstract class Actor implements Bundlable {
current = null; current = null;
} else { } else {
doNext = acting.act(); doNext = acting.act();
if (doNext && !Dungeon.hero.isAlive()) { if (doNext && (Dungeon.hero == null || !Dungeon.hero.isAlive())) {
doNext = false; doNext = false;
current = null; current = null;
} }

View File

@ -72,7 +72,7 @@ public class Buff extends Actor {
} }
public void detach() { public void detach() {
fx( false ); if (target.sprite != null) fx( false );
target.remove( this ); target.remove( this );
} }

View File

@ -107,7 +107,7 @@ public class BrokenSeal extends Item {
private float partialShield; private float partialShield;
@Override @Override
public boolean act() { public synchronized boolean act() {
if (armor == null) detach(); if (armor == null) detach();
else if (armor.isEquipped((Hero)target)) { else if (armor.isEquipped((Hero)target)) {
if (target.SHLD < maxShield()){ if (target.SHLD < maxShield()){
@ -122,11 +122,11 @@ public class BrokenSeal extends Item {
return true; return true;
} }
public void setArmor(Armor arm){ public synchronized void setArmor(Armor arm){
armor = arm; armor = arm;
} }
public int maxShield() { public synchronized int maxShield() {
return 1 + armor.tier + armor.level(); return 1 + armor.tier + armor.level();
} }
} }

View File

@ -300,7 +300,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
flashTime = FLASH_INTERVAL; flashTime = FLASH_INTERVAL;
} }
public void add( State state ) { public synchronized void add( State state ) {
switch (state) { switch (state) {
case BURNING: case BURNING:
burning = emitter(); burning = emitter();
@ -350,7 +350,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
} }
} }
public void remove( State state ) { public synchronized void remove( State state ) {
switch (state) { switch (state) {
case BURNING: case BURNING:
if (burning != null) { if (burning != null) {
@ -414,7 +414,6 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
} }
@Override @Override
//syncronized due to EmoIcon handling
public synchronized void update() { public synchronized void update() {
super.update(); super.update();