v0.7.4c: fixed various rare crash bugs
This commit is contained in:
parent
f3909c0b2e
commit
8b4b241f8a
|
@ -189,8 +189,8 @@ public class Tilemap extends Visual {
|
|||
|
||||
}
|
||||
|
||||
private int camX, camY, camW, camH;
|
||||
private int topLeft, bottomRight, length;
|
||||
//private int camX, camY, camW, camH;
|
||||
//private int topLeft, bottomRight, length;
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
|
@ -214,8 +214,9 @@ public class Tilemap extends Visual {
|
|||
topLeftUpdating = -1;
|
||||
updating.setEmpty();
|
||||
}
|
||||
|
||||
Camera c = Camera.main;
|
||||
|
||||
//FIXME temporarily disabled this optimization as it is suspected to cause crashes
|
||||
/*Camera c = Camera.main;
|
||||
//we treat the position of the tilemap as (0,0) here
|
||||
camX = (int)(c.scroll.x/cellW - x/cellW);
|
||||
camY = (int)(c.scroll.y/cellH - y/cellH);
|
||||
|
@ -242,7 +243,7 @@ public class Tilemap extends Visual {
|
|||
length = bottomRight - topLeft + 1;
|
||||
|
||||
if (length <= 0)
|
||||
return;
|
||||
return;*/
|
||||
|
||||
NoosaScript script = NoosaScriptNoLighting.get();
|
||||
|
||||
|
@ -252,7 +253,7 @@ public class Tilemap extends Visual {
|
|||
|
||||
script.camera( camera );
|
||||
|
||||
script.drawQuadSet( buffer, length, topLeft );
|
||||
script.drawQuadSet( buffer, size, 0 );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public enum Music {
|
|||
private boolean enabled = true;
|
||||
private float volume = 1f;
|
||||
|
||||
public void play( String assetName, boolean looping ) {
|
||||
public synchronized void play( String assetName, boolean looping ) {
|
||||
|
||||
if (isPlaying() && lastPlayed != null && lastPlayed.equals( assetName )) {
|
||||
return;
|
||||
|
@ -57,25 +57,25 @@ public enum Music {
|
|||
|
||||
}
|
||||
|
||||
public void mute() {
|
||||
public synchronized void mute() {
|
||||
lastPlayed = null;
|
||||
stop();
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
public synchronized void pause() {
|
||||
if (player != null) {
|
||||
player.pause();
|
||||
}
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
public synchronized void resume() {
|
||||
if (player != null) {
|
||||
player.play();
|
||||
player.setLooping(looping);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
public synchronized void stop() {
|
||||
if (player != null) {
|
||||
player.stop();
|
||||
player.dispose();
|
||||
|
@ -83,18 +83,18 @@ public enum Music {
|
|||
}
|
||||
}
|
||||
|
||||
public void volume( float value ) {
|
||||
public synchronized void volume( float value ) {
|
||||
volume = value;
|
||||
if (player != null) {
|
||||
player.setVolume( value );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPlaying() {
|
||||
public synchronized boolean isPlaying() {
|
||||
return player != null && player.isPlaying();
|
||||
}
|
||||
|
||||
public void enable( boolean value ) {
|
||||
public synchronized void enable( boolean value ) {
|
||||
enabled = value;
|
||||
if (isPlaying() && !value) {
|
||||
stop();
|
||||
|
@ -104,7 +104,7 @@ public enum Music {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
public synchronized boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,9 @@ public class Bundle {
|
|||
} catch (JSONException e) {
|
||||
Game.reportException(e);
|
||||
return enumClass.getEnumConstants()[0];
|
||||
} catch (IllegalArgumentException e) {
|
||||
Game.reportException(e);
|
||||
return enumClass.getEnumConstants()[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -217,10 +217,15 @@ public class DriedRose extends Artifact {
|
|||
@Override
|
||||
public String status() {
|
||||
if (ghost == null && ghostID != 0){
|
||||
Actor a = Actor.findById(ghostID);
|
||||
if (a != null){
|
||||
ghost = (GhostHero)a;
|
||||
} else {
|
||||
try {
|
||||
Actor a = Actor.findById(ghostID);
|
||||
if (a != null) {
|
||||
ghost = (GhostHero) a;
|
||||
} else {
|
||||
ghostID = 0;
|
||||
}
|
||||
} catch ( ClassCastException e ){
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
ghostID = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,10 +93,10 @@ public class WndRanking extends WndTabbed {
|
|||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (thread != null && !thread.isAlive()) {
|
||||
thread = null;
|
||||
if (thread != null && !thread.isAlive() && busy != null) {
|
||||
if (error == null) {
|
||||
remove( busy );
|
||||
busy = null;
|
||||
if (Dungeon.hero != null) {
|
||||
createControls();
|
||||
} else {
|
||||
|
@ -109,6 +109,12 @@ public class WndRanking extends WndTabbed {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
thread = null;
|
||||
}
|
||||
|
||||
private void createControls() {
|
||||
|
||||
String[] labels =
|
||||
|
|
Loading…
Reference in New Issue
Block a user