v1.2.2: fixed cases where char sprites would persist after destroyed

This commit is contained in:
Evan Debenham 2022-04-04 15:58:32 -04:00
parent d580f0b9fe
commit 468b0e3c99
2 changed files with 10 additions and 2 deletions

View File

@ -160,7 +160,15 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
ch.updateSpriteState();
}
@Override
public void destroy() {
super.destroy();
if (ch != null && ch.sprite == this){
ch.sprite = null;
}
}
//used for just updating a sprite based on a given character, not linking them or placing in the game
public void linkVisuals( Char ch ){
//do nothin by default

View File

@ -62,7 +62,7 @@ public class GhoulSprite extends MobSprite {
@Override
public void move(int from, int to) {
if (parent == null){
//fixme this happens rarely, likely due to ghoul life link?
//TODO this should be fixed as of v1.2.2, monitor for more reports and remove if we're clear
Game.reportException(new RuntimeException("ghoul sprite tried to move with null parent! ghoul HP: " + ch.HP));
return;
}