v0.6.2c: fixed a variety of rare crash bugs
This commit is contained in:
parent
31042228ff
commit
1fbaa27f5b
|
@ -30,7 +30,7 @@ import java.util.ArrayList;
|
|||
|
||||
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 invH2;
|
||||
|
@ -66,7 +66,7 @@ public class Camera extends Gizmo {
|
|||
return reset( createFullscreen( 1 ) );
|
||||
}
|
||||
|
||||
public static Camera reset( Camera newCamera ) {
|
||||
public static synchronized Camera reset( Camera newCamera ) {
|
||||
|
||||
invW2 = 2f / Game.width;
|
||||
invH2 = 2f / Game.height;
|
||||
|
@ -80,20 +80,18 @@ public class Camera extends Gizmo {
|
|||
return main = add( newCamera );
|
||||
}
|
||||
|
||||
public static Camera add( Camera camera ) {
|
||||
public static synchronized Camera add( Camera camera ) {
|
||||
all.add( camera );
|
||||
return camera;
|
||||
}
|
||||
|
||||
public static Camera remove( Camera camera ) {
|
||||
public static synchronized Camera remove( Camera camera ) {
|
||||
all.remove( camera );
|
||||
return camera;
|
||||
}
|
||||
|
||||
public static void updateAll() {
|
||||
int length = all.size();
|
||||
for (int i=0; i < length; i++) {
|
||||
Camera c = all.get( i );
|
||||
public static synchronized void updateAll() {
|
||||
for (Camera c : all) {
|
||||
if (c.exists && c.active) {
|
||||
c.update();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ public abstract class Actor implements Bundlable {
|
|||
current = null;
|
||||
} else {
|
||||
doNext = acting.act();
|
||||
if (doNext && !Dungeon.hero.isAlive()) {
|
||||
if (doNext && (Dungeon.hero == null || !Dungeon.hero.isAlive())) {
|
||||
doNext = false;
|
||||
current = null;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class Buff extends Actor {
|
|||
}
|
||||
|
||||
public void detach() {
|
||||
fx( false );
|
||||
if (target.sprite != null) fx( false );
|
||||
target.remove( this );
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class BrokenSeal extends Item {
|
|||
private float partialShield;
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
public synchronized boolean act() {
|
||||
if (armor == null) detach();
|
||||
else if (armor.isEquipped((Hero)target)) {
|
||||
if (target.SHLD < maxShield()){
|
||||
|
@ -122,11 +122,11 @@ public class BrokenSeal extends Item {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void setArmor(Armor arm){
|
||||
public synchronized void setArmor(Armor arm){
|
||||
armor = arm;
|
||||
}
|
||||
|
||||
public int maxShield() {
|
||||
public synchronized int maxShield() {
|
||||
return 1 + armor.tier + armor.level();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
|
|||
flashTime = FLASH_INTERVAL;
|
||||
}
|
||||
|
||||
public void add( State state ) {
|
||||
public synchronized void add( State state ) {
|
||||
switch (state) {
|
||||
case BURNING:
|
||||
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) {
|
||||
case BURNING:
|
||||
if (burning != null) {
|
||||
|
@ -414,7 +414,6 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
|
|||
}
|
||||
|
||||
@Override
|
||||
//syncronized due to EmoIcon handling
|
||||
public synchronized void update() {
|
||||
|
||||
super.update();
|
||||
|
|
Loading…
Reference in New Issue
Block a user