v2.0.1: added some safety checks for windows rendering on actor thread

This commit is contained in:
Evan Debenham
2023-03-20 16:27:35 -04:00
parent b57db0739a
commit 1685809d9f
2 changed files with 46 additions and 33 deletions
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
@@ -90,6 +91,9 @@ public class PotionOfDragonsBreath extends ExoticPotion {
if (cell == null && identifiedByUse){ if (cell == null && identifiedByUse){
showingWindow = true; showingWindow = true;
ShatteredPixelDungeon.runOnRenderThread(new Callback() {
@Override
public void call() {
GameScene.show( new WndOptions(new ItemSprite(PotionOfDragonsBreath.this), GameScene.show( new WndOptions(new ItemSprite(PotionOfDragonsBreath.this),
Messages.titleCase(name()), Messages.titleCase(name()),
Messages.get(ExoticPotion.class, "warning"), Messages.get(ExoticPotion.class, "warning"),
@@ -110,6 +114,8 @@ public class PotionOfDragonsBreath extends ExoticPotion {
} }
public void onBackPressed() {} public void onBackPressed() {}
} ); } );
}
});
} else if (cell == null && !anonymous){ } else if (cell == null && !anonymous){
curItem.collect( curUser.belongings.backpack ); curItem.collect( curUser.belongings.backpack );
} else if (cell != null) { } else if (cell != null) {
@@ -382,6 +382,10 @@ public class CursedWand {
//Don't bother doing this joke to none-english speakers, I doubt it would translate. //Don't bother doing this joke to none-english speakers, I doubt it would translate.
return cursedEffect(origin, user, targetPos); return cursedEffect(origin, user, targetPos);
} else { } else {
ShatteredPixelDungeon.runOnRenderThread(
new Callback() {
@Override
public void call() {
GameScene.show( GameScene.show(
new WndOptions(Icons.get(Icons.WARNING), new WndOptions(Icons.get(Icons.WARNING),
"CURSED WAND ERROR", "CURSED WAND ERROR",
@@ -401,6 +405,9 @@ public class CursedWand {
} }
} }
); );
}
}
);
return false; return false;
} }
} catch(IOException e){ } catch(IOException e){