summaryrefslogtreecommitdiffstats
path: root/game/server/whitelist.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-06-25 00:44:36 +0500
committeruntodesu <kirill@untode.su>2025-06-25 00:44:36 +0500
commit88c01588aa0830e219eaa62588839e4d1e2883ce (patch)
tree602bb27dd3399aab4aae8c19630e3b7a8dac824b /game/server/whitelist.cc
parent99cf6cca8dbbc1e563c10cf0167432d3d8af9783 (diff)
downloadvoxelius-88c01588aa0830e219eaa62588839e4d1e2883ce.tar.bz2
voxelius-88c01588aa0830e219eaa62588839e4d1e2883ce.zip
Clang-format the entire source code
Diffstat (limited to 'game/server/whitelist.cc')
-rw-r--r--game/server/whitelist.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/game/server/whitelist.cc b/game/server/whitelist.cc
index 4d9d394..6635122 100644
--- a/game/server/whitelist.cc
+++ b/game/server/whitelist.cc
@@ -1,4 +1,5 @@
#include "server/pch.hh"
+
#include "server/whitelist.hh"
#include "core/config.hh"
@@ -8,7 +9,7 @@
#include "server/game.hh"
#include "server/globals.hh"
-constexpr static const char *DEFAULT_FILENAME = "whitelist.txt";
+constexpr static const char* DEFAULT_FILENAME = "whitelist.txt";
constexpr static char SEPARATOR_CHAR = ':';
ConfigBoolean whitelist::enabled(false);
@@ -38,7 +39,7 @@ void whitelist::init_late(void)
whitelist::filename.set(DEFAULT_FILENAME);
}
- PHYSFS_File *file = PHYSFS_openRead(whitelist::filename.get());
+ PHYSFS_File* file = PHYSFS_openRead(whitelist::filename.get());
if(file == nullptr) {
spdlog::warn("whitelist: {}: {}", whitelist::filename.get(), PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
@@ -61,8 +62,7 @@ void whitelist::init_late(void)
// to the global server password; this allows easier adding
// of guest accounts which can later be edited to use a better password
whitelist_map[line] = server_game::password_hash;
- }
- else {
+ } else {
const auto username = line.substr(0, location);
const auto password = line.substr(location + 1);
whitelist_map[username] = crc64::get(password);
@@ -77,12 +77,12 @@ void whitelist::deinit(void)
// UNDONE: implement saving
}
-bool whitelist::contains(const char *username)
+bool whitelist::contains(const char* username)
{
return whitelist_map.contains(username);
}
-bool whitelist::matches(const char *username, std::uint64_t password_hash)
+bool whitelist::matches(const char* username, std::uint64_t password_hash)
{
const auto it = whitelist_map.find(username);
@@ -91,7 +91,5 @@ bool whitelist::matches(const char *username, std::uint64_t password_hash)
return false;
}
- if(it->second == password_hash)
- return true;
- return false;
+ return it->second == password_hash;
}