clang-format

This commit is contained in:
2026-03-23 08:58:31 +01:00
parent 302b86ddb4
commit 3ca744ee46
88 changed files with 7147 additions and 7090 deletions

View File

@@ -4,35 +4,35 @@
namespace Difficulty {
static std::vector<Info> difficulties_list;
static std::vector<Info> difficulties_list;
void init() {
difficulties_list = {
{.code = Code::EASY, .name = "Easy"},
{.code = Code::NORMAL, .name = "Normal"},
{.code = Code::HARD, .name = "Hard"}};
}
auto getDifficulties() -> std::vector<Info>& {
return difficulties_list;
}
auto getNameFromCode(Code code) -> std::string {
for (const auto& difficulty : difficulties_list) {
if (difficulty.code == code) {
return difficulty.name;
}
void init() {
difficulties_list = {
{.code = Code::EASY, .name = "Easy"},
{.code = Code::NORMAL, .name = "Normal"},
{.code = Code::HARD, .name = "Hard"}};
}
return !difficulties_list.empty() ? difficulties_list.front().name : "Unknown";
}
auto getCodeFromName(const std::string& name) -> Code {
for (const auto& difficulty : difficulties_list) {
if (difficulty.name == name) {
return difficulty.code;
}
auto getDifficulties() -> std::vector<Info>& {
return difficulties_list;
}
auto getNameFromCode(Code code) -> std::string {
for (const auto& difficulty : difficulties_list) {
if (difficulty.code == code) {
return difficulty.name;
}
}
return !difficulties_list.empty() ? difficulties_list.front().name : "Unknown";
}
auto getCodeFromName(const std::string& name) -> Code {
for (const auto& difficulty : difficulties_list) {
if (difficulty.name == name) {
return difficulty.code;
}
}
return !difficulties_list.empty() ? difficulties_list.front().code : Code::NORMAL;
}
return !difficulties_list.empty() ? difficulties_list.front().code : Code::NORMAL;
}
} // namespace Difficulty