From af89c52813074f27e20ba04276a7f1fc6d809303 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 17 Jul 2020 13:25:23 -0700 Subject: [PATCH] Wrap around enemy type when switching enemy types Whoops. Forgot to do this earlier when adding the Shift+F3 hotkey. Otherwise the enemy type would become invalid and just turn into the default square. --- desktop_version/src/editor.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 074301d6..ac29360f 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -1686,15 +1686,21 @@ void editorclass::switch_enemy(const bool reversed /*= false*/) } edlevelclass& room = level[roomnum]; + int enemy = room.enemytype; + if (reversed) { - room.enemytype--; + enemy--; } else { - room.enemytype++; + enemy++; } + const int modulus = 10; + enemy = (enemy % modulus + modulus) % modulus; + room.enemytype = enemy; + note = "Enemy Type Changed"; notedelay = 45; }