Skip to content

Commit

Permalink
Amended missing tag "ManiacHook" to Debug::kExecutionType & added som…
Browse files Browse the repository at this point in the history
…e static_asserts so it don't happen again
  • Loading branch information
florianessl committed Feb 11, 2025
1 parent 0d39709 commit b987a84
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
6 changes: 4 additions & 2 deletions src/filefinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace FileFinder {
* Type of the project. Used to differentiate between supported games (2kX or EasyRPG)
* and known but unsupported (i.e. newer RPG Makers).
*/
enum ProjectType {
enum class ProjectType {
Unknown,
// 2kX or EasyRPG
Supported,
Expand All @@ -62,7 +62,8 @@ namespace FileFinder {
WolfRpgEditor,
Encrypted2k3Maniacs,
RpgMaker95,
SimRpgMaker95
SimRpgMaker95,
LAST
};

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

/**
* Helper struct combining the project's directory and its type (used by Game Browser)
Expand Down
11 changes: 8 additions & 3 deletions src/game_interpreter_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ namespace Game_Interpreter_Shared {
None = 0,
MapEvent,
CommonEvent,
BattleEvent
BattleEvent,
LAST
};
static constexpr auto kEventType = lcf::makeEnumTags<EventType>(
"None",
"MapEvent",
"CommonEvent",
"BattleEvent"
);
static_assert(kEventType.size() == static_cast<size_t>(EventType::LAST));

enum class ExecutionType {
/*
Expand All @@ -64,7 +66,8 @@ namespace Game_Interpreter_Shared {
/* Event code was dynamically evaluated. (ManiacCallCommand) */
Eval,
DebugCall,
ManiacHook
ManiacHook,
LAST
};
static constexpr auto kExecutionType = lcf::makeEnumTags<ExecutionType>(
"Action",
Expand All @@ -79,8 +82,10 @@ namespace Game_Interpreter_Shared {
"---",
"DeathHandler",
"Eval",
"DebugCall"
"DebugCall",
"ManiacHook"
);
static_assert(kExecutionType.size() == static_cast<size_t>(ExecutionType::LAST));

/*
* Indicates how the target of an interpreter operation (lvalue) should be evaluated.
Expand Down
12 changes: 6 additions & 6 deletions src/input_buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ namespace Input {
"FAST_FORWARD_A",
"FAST_FORWARD_B",
"TOGGLE_FULLSCREEN",
"TOGGLE_ZOOM",
"BUTTON_COUNT");
"TOGGLE_ZOOM");
static_assert(kInputButtonNames.size() == static_cast<size_t>(BUTTON_COUNT));

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

/**
* Return true if the given button is a system button.
Expand Down Expand Up @@ -241,8 +241,8 @@ namespace Input {
"RIGHT",
"UPLEFT",
"UP",
"UPRIGHT",
"NUM_DIRECTIONS");
"UPRIGHT");
static_assert(kInputDirectionNames.size() == static_cast<size_t>(NUM_DIRECTIONS));
};

using ButtonMappingArray = FlatUniqueMultiMap<InputButton,Keys::InputKey>;
Expand Down
4 changes: 3 additions & 1 deletion src/rtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ namespace RTP {
RPG2003_VladRussian,
RPG2003_RpgUniverseSpanishPortuguese,
RPG2003_Korean,
RPG2003_OfficialTraditionalChinese
RPG2003_OfficialTraditionalChinese,
LAST
};

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

struct RtpHitInfo {
RTP::Type type;
Expand Down
2 changes: 1 addition & 1 deletion src/window_gamelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void Window_GameList::DrawItem(int index) {

#ifndef USE_CUSTOM_FILEBUF
auto color = Font::ColorDefault;
if (ge.type == FileFinder::Unknown) {
if (ge.type == FileFinder::ProjectType::Unknown) {
color = Font::ColorHeal;
} else if (ge.type > FileFinder::ProjectType::Supported) {
color = Font::ColorKnockout;
Expand Down

0 comments on commit b987a84

Please # to comment.