diff --git a/core/src/main/assets/messages/scenes/scenes.properties b/core/src/main/assets/messages/scenes/scenes.properties index 2fe2aa34f..275b0dee7 100644 --- a/core/src/main/assets/messages/scenes/scenes.properties +++ b/core/src/main/assets/messages/scenes/scenes.properties @@ -49,6 +49,7 @@ scenes.gamescene.examine=Examine scenes.heroselectscene.title=Choose Your Hero scenes.heroselectscene.custom_seed_title=Enter a Custom Seed scenes.heroselectscene.custom_seed_desc=The same seed and game version always generate the same dungeon! Seeds are nine uppercase letters (e.g. ABC-DEF-GHI), but you can enter anything you want and the game will convert it. _Games with a custom seed cannot earn badges or appear in rankings._ +scenes.heroselectscene.custom_seed_duplicate=You already have a regular game in progress with that seed. You must end that game before using that custom seed. scenes.heroselectscene.custom_seed_set=Set scenes.heroselectscene.custom_seed_clear=Clear diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java index 241fb21ed..01374c73c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java @@ -211,7 +211,18 @@ public class HeroSelectScene extends PixelScene { public void onSelect(boolean positive, String text) { text = DungeonSeed.formatText(text); long seed = DungeonSeed.convertFromText(text); + if (positive && seed != -1){ + + for (GamesInProgress.Info info : GamesInProgress.checkAll()){ + if (info.customSeed.isEmpty() && info.seed == seed){ + SPDSettings.customSeed(""); + icon.resetColor(); + ShatteredPixelDungeon.scene().addToFront(new WndMessage(Messages.get(HeroSelectScene.class, "custom_seed_duplicate"))); + return; + } + } + SPDSettings.customSeed(text); icon.hardlight(1f, 1.5f, 0.67f); } else {