From ab63b6cc791e6fc224fdb3b5d3785ad962535cad Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 25 Feb 2024 18:58:05 -0500 Subject: [PATCH 1/2] Fix missing Anim FFwd Responder Cmd. How long has this been broken????????? --- Sources/Tools/MaxComponent/plResponderAnim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxComponent/plResponderAnim.cpp b/Sources/Tools/MaxComponent/plResponderAnim.cpp index 3991749e4a..bb3dc4779b 100644 --- a/Sources/Tools/MaxComponent/plResponderAnim.cpp +++ b/Sources/Tools/MaxComponent/plResponderAnim.cpp @@ -118,7 +118,7 @@ enum kRespondRewindSound, kRespondFastForwardAnim, - kNumTypes = 16 + kNumTypes = 17 }; int plResponderCmdAnim::NumTypes() From 85e9f4e420777ffc36b42e32c421d521aff9bb23 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 26 Feb 2024 18:59:11 -0500 Subject: [PATCH 2/2] Add compile time check for enumeration matching. --- Sources/Tools/MaxComponent/plResponderAnim.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Tools/MaxComponent/plResponderAnim.cpp b/Sources/Tools/MaxComponent/plResponderAnim.cpp index bb3dc4779b..623b813645 100644 --- a/Sources/Tools/MaxComponent/plResponderAnim.cpp +++ b/Sources/Tools/MaxComponent/plResponderAnim.cpp @@ -126,9 +126,9 @@ int plResponderCmdAnim::NumTypes() return kNumTypes; } -static int IndexToOldType(int idx) +static constexpr int IndexToOldType(int idx) { - static int oldTypes[] = + constexpr int oldTypes[] = { kRespondPlayAnim, kRespondStopAnim, @@ -152,6 +152,7 @@ static int IndexToOldType(int idx) kRespondFastForwardAnim, }; + static_assert(std::size(oldTypes) == kNumTypes, "ResponderAnim enumerations have differing lengths!"); hsAssert(idx < kNumTypes, "Bad index"); return oldTypes[idx]; }