From b41c403deabcd49e80e243ac627c2d1ae536d50e Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 2 Jan 2021 19:38:02 -0500 Subject: [PATCH] v0.9.1b: fixed actor IDs being duplicated in rare cases --- .../shatteredpixel/shatteredpixeldungeon/actors/Actor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 8471d3917..59f1269d5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Actor.java @@ -104,7 +104,12 @@ public abstract class Actor implements Bundlable { @Override public void restoreFromBundle( Bundle bundle ) { time = bundle.getFloat( TIME ); - id = bundle.getInt( ID ); + int incomingID = bundle.getInt( ID ); + if (Actor.findById(id) == null){ + id = incomingID; + } else { + id = nextID++; + } } private static int nextID = 1;