Skip to content

Commit b987a84

Browse files
committed
Amended missing tag "ManiacHook" to Debug::kExecutionType & added some static_asserts so it don't happen again
1 parent 0d39709 commit b987a84

5 files changed

+22
-13
lines changed

src/filefinder.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace FileFinder {
5050
* Type of the project. Used to differentiate between supported games (2kX or EasyRPG)
5151
* and known but unsupported (i.e. newer RPG Makers).
5252
*/
53-
enum ProjectType {
53+
enum class ProjectType {
5454
Unknown,
5555
// 2kX or EasyRPG
5656
Supported,
@@ -62,7 +62,8 @@ namespace FileFinder {
6262
WolfRpgEditor,
6363
Encrypted2k3Maniacs,
6464
RpgMaker95,
65-
SimRpgMaker95
65+
SimRpgMaker95,
66+
LAST
6667
};
6768

6869
constexpr auto kProjectType = lcf::makeEnumTags<ProjectType>(
@@ -77,6 +78,7 @@ namespace FileFinder {
7778
"RPG Maker 95",
7879
"Sim RPG Maker 95"
7980
);
81+
static_assert(kProjectType.size() == static_cast<size_t>(ProjectType::LAST));
8082

8183
/**
8284
* Helper struct combining the project's directory and its type (used by Game Browser)

src/game_interpreter_shared.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ namespace Game_Interpreter_Shared {
3333
None = 0,
3434
MapEvent,
3535
CommonEvent,
36-
BattleEvent
36+
BattleEvent,
37+
LAST
3738
};
3839
static constexpr auto kEventType = lcf::makeEnumTags<EventType>(
3940
"None",
4041
"MapEvent",
4142
"CommonEvent",
4243
"BattleEvent"
4344
);
45+
static_assert(kEventType.size() == static_cast<size_t>(EventType::LAST));
4446

4547
enum class ExecutionType {
4648
/*
@@ -64,7 +66,8 @@ namespace Game_Interpreter_Shared {
6466
/* Event code was dynamically evaluated. (ManiacCallCommand) */
6567
Eval,
6668
DebugCall,
67-
ManiacHook
69+
ManiacHook,
70+
LAST
6871
};
6972
static constexpr auto kExecutionType = lcf::makeEnumTags<ExecutionType>(
7073
"Action",
@@ -79,8 +82,10 @@ namespace Game_Interpreter_Shared {
7982
"---",
8083
"DeathHandler",
8184
"Eval",
82-
"DebugCall"
85+
"DebugCall",
86+
"ManiacHook"
8387
);
88+
static_assert(kExecutionType.size() == static_cast<size_t>(ExecutionType::LAST));
8489

8590
/*
8691
* Indicates how the target of an interpreter operation (lvalue) should be evaluated.

src/input_buttons.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ namespace Input {
130130
"FAST_FORWARD_A",
131131
"FAST_FORWARD_B",
132132
"TOGGLE_FULLSCREEN",
133-
"TOGGLE_ZOOM",
134-
"BUTTON_COUNT");
133+
"TOGGLE_ZOOM");
134+
static_assert(kInputButtonNames.size() == static_cast<size_t>(BUTTON_COUNT));
135135

136136
constexpr auto kInputButtonHelp = lcf::makeEnumTags<InputButton>(
137137
"Up Direction",
@@ -175,8 +175,8 @@ namespace Input {
175175
"Run the game at x{} speed",
176176
"Run the game at x{} speed",
177177
"Toggle Fullscreen mode",
178-
"Toggle Window Zoom level",
179-
"Total Button Count");
178+
"Toggle Window Zoom level");
179+
static_assert(kInputButtonHelp.size() == static_cast<size_t>(BUTTON_COUNT));
180180

181181
/**
182182
* Return true if the given button is a system button.
@@ -241,8 +241,8 @@ namespace Input {
241241
"RIGHT",
242242
"UPLEFT",
243243
"UP",
244-
"UPRIGHT",
245-
"NUM_DIRECTIONS");
244+
"UPRIGHT");
245+
static_assert(kInputDirectionNames.size() == static_cast<size_t>(NUM_DIRECTIONS));
246246
};
247247

248248
using ButtonMappingArray = FlatUniqueMultiMap<InputButton,Keys::InputKey>;

src/rtp.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ namespace RTP {
5050
RPG2003_VladRussian,
5151
RPG2003_RpgUniverseSpanishPortuguese,
5252
RPG2003_Korean,
53-
RPG2003_OfficialTraditionalChinese
53+
RPG2003_OfficialTraditionalChinese,
54+
LAST
5455
};
5556

5657
constexpr auto kTypes = lcf::makeEnumTags<Type>(
@@ -66,6 +67,7 @@ namespace RTP {
6667
"Korean Translation",
6768
"Official Traditional Chinese"
6869
);
70+
static_assert(kTypes.size() == static_cast<size_t>(Type::LAST));
6971

7072
struct RtpHitInfo {
7173
RTP::Type type;

src/window_gamelist.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void Window_GameList::DrawItem(int index) {
118118

119119
#ifndef USE_CUSTOM_FILEBUF
120120
auto color = Font::ColorDefault;
121-
if (ge.type == FileFinder::Unknown) {
121+
if (ge.type == FileFinder::ProjectType::Unknown) {
122122
color = Font::ColorHeal;
123123
} else if (ge.type > FileFinder::ProjectType::Supported) {
124124
color = Font::ColorKnockout;

0 commit comments

Comments
 (0)