perf: 迁移肉鸽模式检查

This commit is contained in:
status102
2023-11-14 21:00:39 +08:00
parent d04855ae41
commit 3f370c1bee
2 changed files with 7 additions and 6 deletions

View File

@@ -88,12 +88,7 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
}
auto mode = static_cast<RoguelikeMode>(params.get("mode", 0));
static constexpr std::array all_modes = {
RoguelikeMode::Exp,
RoguelikeMode::Investment,
RoguelikeMode::Collectible,
};
if (ranges::find(all_modes, mode) == all_modes.end()) {
if (RoguelikeConfig::is_valid_mode(mode)) {
m_roguelike_task_ptr->set_tasks({ "Stop" });
Log.error(__FUNCTION__, "| Unknown mode", static_cast<int>(mode));
return false;

View File

@@ -31,6 +31,12 @@ namespace asst
{
return theme == RoguelikeTheme::Phantom || theme == RoguelikeTheme::Mizuki || theme == RoguelikeTheme::Sami;
}
static constexpr bool is_valid_mode(RoguelikeMode mode)
{
return mode == RoguelikeMode::Exp || mode == RoguelikeMode::Investment ||
mode == RoguelikeMode::Collectible;
}
public:
// 清理缓存的肉鸽数据
void clear();