v0.6.2a: added safety and sync checks for a number of rare crashes
This commit is contained in:
parent
3a6ae784f7
commit
4a9ce5dae1
|
@ -989,7 +989,7 @@ public class Hero extends Char {
|
|||
boolean newMob = false;
|
||||
|
||||
Mob target = null;
|
||||
for (Mob m : Dungeon.level.mobs) {
|
||||
for (Mob m : Dungeon.level.mobs.toArray(new Mob[0])) {
|
||||
if (fieldOfView[ m.pos ] && m.alignment == Alignment.ENEMY) {
|
||||
visible.add(m);
|
||||
if (!visibleEnemies.contains( m )) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class WindParticle extends PixelParticle {
|
|||
@Override
|
||||
public void update() {
|
||||
|
||||
if (visible = Dungeon.level.heroFOV[pos]) {
|
||||
if (visible = (pos < Dungeon.level.heroFOV.length && Dungeon.level.heroFOV[pos])) {
|
||||
|
||||
super.update();
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public class PrisonLevel extends RegularLevel {
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
if (visible = Dungeon.level.heroFOV[pos]) {
|
||||
if (visible = (pos < Dungeon.level.heroFOV.length && Dungeon.level.heroFOV[pos])) {
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ public class SewerLevel extends RegularLevel {
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
if (visible = Dungeon.level.heroFOV[pos]) {
|
||||
if (visible = (pos < Dungeon.level.heroFOV.length && Dungeon.level.heroFOV[pos])) {
|
||||
|
||||
super.update();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
|
||||
import com.watabou.input.Touchscreen.Touch;
|
||||
|
@ -57,7 +58,7 @@ public class CellSelector extends TouchArea {
|
|||
} else {
|
||||
|
||||
PointF p = Camera.main.screenToCamera( (int)touch.current.x, (int)touch.current.y );
|
||||
for (Char mob : Dungeon.level.mobs){
|
||||
for (Char mob : Dungeon.level.mobs.toArray(new Mob[0])){
|
||||
if (mob.sprite != null && mob.sprite.overlapsPoint( p.x, p.y)){
|
||||
select( mob.pos );
|
||||
return;
|
||||
|
|
|
@ -208,7 +208,7 @@ public class ItemSprite extends MovieClip {
|
|||
}
|
||||
}
|
||||
|
||||
public void glow( Glowing glowing ){
|
||||
public synchronized void glow( Glowing glowing ){
|
||||
this.glowing = glowing;
|
||||
if (glowing == null) resetColor();
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class ItemSprite extends MovieClip {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
public synchronized void update() {
|
||||
super.update();
|
||||
|
||||
visible = (heap == null || heap.seen);
|
||||
|
|
|
@ -63,7 +63,7 @@ public class AttackIndicator extends Tag {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void layout() {
|
||||
protected synchronized void layout() {
|
||||
super.layout();
|
||||
|
||||
if (sprite != null) {
|
||||
|
@ -127,7 +127,7 @@ public class AttackIndicator extends Tag {
|
|||
enable( bg.visible );
|
||||
}
|
||||
|
||||
private void updateImage() {
|
||||
private synchronized void updateImage() {
|
||||
|
||||
if (sprite != null) {
|
||||
sprite.killAndErase();
|
||||
|
@ -151,14 +151,14 @@ public class AttackIndicator extends Tag {
|
|||
}
|
||||
|
||||
private boolean enabled = true;
|
||||
private void enable( boolean value ) {
|
||||
private synchronized void enable( boolean value ) {
|
||||
enabled = value;
|
||||
if (sprite != null) {
|
||||
sprite.alpha( value ? ENABLED : DISABLED );
|
||||
}
|
||||
}
|
||||
|
||||
private void visible( boolean value ) {
|
||||
private synchronized void visible( boolean value ) {
|
||||
bg.visible = value;
|
||||
if (sprite != null) {
|
||||
sprite.visible = value;
|
||||
|
|
|
@ -39,8 +39,9 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedHashMap;
|
||||
|
||||
public class BuffIndicator extends Component {
|
||||
|
||||
public static final int NONE = -1;
|
||||
|
||||
//transparent icon
|
||||
public static final int NONE = 63;
|
||||
|
||||
//TODO consider creating an enum to store both index, and tint. Saves making separate images for color differences.
|
||||
public static final int MIND_VISION = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user