v0.6.3: various crash and ANR fixes

This commit is contained in:
Evan Debenham 2018-01-15 02:13:31 -05:00
parent 88215085b6
commit 079bc8c4d1
7 changed files with 18 additions and 12 deletions

View File

@ -114,7 +114,10 @@ public class Game extends Activity implements GLSurfaceView.Renderer, View.OnTou
BitmapCache.context = TextureCache.context = instance = this;
DisplayMetrics m = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics( m );
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
getWindowManager().getDefaultDisplay().getRealMetrics( m );
else
getWindowManager().getDefaultDisplay().getMetrics( m );
density = m.density;
dispHeight = m.heightPixels;
dispWidth = m.widthPixels;

View File

@ -151,7 +151,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
public Image getIcon() {
Image icon;
if (((Hero)target).belongings.weapon != null){
icon = new ItemSprite(Dungeon.hero.belongings.weapon.image, null);
icon = new ItemSprite(((Hero)target).belongings.weapon.image, null);
} else {
icon = new ItemSprite(new Item(){ {image = ItemSpriteSheet.WEAPON_HOLDER; }});
}

View File

@ -1496,6 +1496,8 @@ public class Hero extends Char {
public boolean search( boolean intentional ) {
if (!isAlive()) return false;
boolean smthFound = false;
int distance = heroClass == HeroClass.ROGUE ? 2 : 1;

View File

@ -56,9 +56,9 @@ public class BlobEmitter extends Emitter {
for (int i = blob.area.left; i < blob.area.right; i++) {
for (int j = blob.area.top; j < blob.area.bottom; j++) {
cell = i + j*Dungeon.level.width();
if (map[cell] > 0
&& cell < Dungeon.level.heroFOV.length
&& Dungeon.level.heroFOV[cell]) {
if (cell < Dungeon.level.heroFOV.length
&& Dungeon.level.heroFOV[cell]
&& map[cell] > 0) {
float x = (i + Random.Float()) * size;
float y = (j + Random.Float()) * size;
factory.emit(this, index, x, y);

View File

@ -51,10 +51,8 @@ public class VaultRoom extends SpecialRoom {
Random.shuffle(prizeClasses);
Item i1, i2;
do {
i1 = prize( level );
i2 = prize( level );
} while (i1.getClass() == i2.getClass());
i1 = prize( level );
i2 = prize( level );
level.drop( i1, c ).type = Heap.Type.CRYSTAL_CHEST;
level.drop( i2, c + PathFinder.NEIGHBOURS8[Random.Int( 8 )]).type = Heap.Type.CRYSTAL_CHEST;
level.addItemToSpawn( new CrystalKey( Dungeon.depth ) );

View File

@ -221,9 +221,7 @@ public class BuffIndicator extends Component {
public static void refreshHero() {
if (heroInstance != null) {
synchronized (heroInstance) {
heroInstance.needsRefresh = true;
}
heroInstance.needsRefresh = true;
}
}
}

View File

@ -52,6 +52,11 @@ public class Compass extends Image {
public void update() {
super.update();
if (cell < 0 || cell >= Dungeon.level.length()){
visible = false;
return;
}
if (!visible) {
visible = Dungeon.level.visited[cell] || Dungeon.level.mapped[cell];
}