From 5df9adcd0ecbf09ae2ba426b3eeab78296d370c4 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Tue, 4 Jul 2023 20:46:26 +1000 Subject: [PATCH] Fix input bind priority --- source/game/StarInput.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/game/StarInput.cpp b/source/game/StarInput.cpp index 7943ff5..7c50d4b 100644 --- a/source/game/StarInput.cpp +++ b/source/game/StarInput.cpp @@ -57,10 +57,16 @@ KeyMod keyModsFromJson(Json const& json, uint8_t* priority = nullptr) { if (!json.isType(Json::Type::Array)) return mod; + uint8_t modPriority = 0; for (Json const& jMod : json.toArray()) { - if (mod != (mod |= KeyModNames.getLeft(jMod.toString())) && priority) - ++*priority; + KeyMod changedMod = mod | KeyModNames.getLeft(jMod.toString()); + if (mod != changedMod) { + mod = changedMod; + ++modPriority; + } } + if (priority) + *priority = modPriority; return mod; }