From 17929740513bdd932836d26d2fb30b3b58ce19fd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 28 Apr 2021 20:36:59 -0400 Subject: [PATCH] v0.9.3: fixed further issues with actor IDs caused by saving/loading --- .../java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java | 1 + .../com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index b7f198fc9..186c67084 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -559,6 +559,7 @@ public class Dungeon { seed = bundle.contains( SEED ) ? bundle.getLong( SEED ) : DungeonSeed.randomSeed(); + Actor.clear(); Actor.restoreNextID( bundle ); quickslot.reset(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java index acd1fcfce..5047ddde8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java @@ -111,7 +111,6 @@ public abstract class Actor implements Bundlable { } } - private static int nextID = 1; public int id() { if (id > 0) { return id; @@ -129,6 +128,7 @@ public abstract class Actor implements Bundlable { private static volatile Actor current; private static SparseArray ids = new SparseArray<>(); + private static int nextID = 1; private static float now = 0;