diff options
| author | untodesu <kirill@untode.su> | 2025-12-26 23:17:56 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-12-26 23:17:56 +0500 |
| commit | 0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e (patch) | |
| tree | 90ddefa28b40b6384dd9618bb7573704de2733a9 /src/game/server | |
| parent | 6bb4233d5b2a1688e63c947542e92ec5d5a857a6 (diff) | |
| download | voxelius-0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e.tar.bz2 voxelius-0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e.zip | |
Add include guards and header comments to sources
Diffstat (limited to 'src/game/server')
27 files changed, 195 insertions, 4 deletions
diff --git a/src/game/server/chat.cc b/src/game/server/chat.cc index a0ceba8..5bb2258 100644 --- a/src/game/server/chat.cc +++ b/src/game/server/chat.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: chat.cc +// Description: Chat handling + #include "server/pch.hh" #include "server/chat.hh" diff --git a/src/game/server/chat.hh b/src/game/server/chat.hh index 1b3e11b..671fd22 100644 --- a/src/game/server/chat.hh +++ b/src/game/server/chat.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: chat.hh +// Description: Chat handling + +#ifndef SERVER_CHAT_HH +#define SERVER_CHAT_HH #pragma once struct Session; @@ -10,3 +17,5 @@ void broadcast(std::string_view message, std::string_view sender); void send(Session* session, std::string_view message); void send(Session* session, std::string_view message, std::string_view sender); } // namespace server_chat + +#endif diff --git a/src/game/server/game.cc b/src/game/server/game.cc index deb7d68..0aa976e 100644 --- a/src/game/server/game.cc +++ b/src/game/server/game.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: game.cc +// Description: Main game logic + #include "server/pch.hh" #include "server/game.hh" diff --git a/src/game/server/game.hh b/src/game/server/game.hh index 1dbe4b8..dccd2f5 100644 --- a/src/game/server/game.hh +++ b/src/game/server/game.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: game.hh +// Description: Main game logic + +#ifndef SERVER_GAME_HH +#define SERVER_GAME_HH #pragma once namespace config @@ -23,3 +30,5 @@ void shutdown(void); void fixed_update(void); void fixed_update_late(void); } // namespace server_game + +#endif diff --git a/src/game/server/globals.cc b/src/game/server/globals.cc index 12fce4a..796d9f2 100644 --- a/src/game/server/globals.cc +++ b/src/game/server/globals.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: globals.cc +// Description: Global variables + #include "server/pch.hh" #include "server/globals.hh" diff --git a/src/game/server/globals.hh b/src/game/server/globals.hh index 80e84bb..c44b03a 100644 --- a/src/game/server/globals.hh +++ b/src/game/server/globals.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: globals.hh +// Description: Global variables + +#ifndef SERVER_GLOBALS_HH +#define SERVER_GLOBALS_HH #pragma once #include "shared/globals.hh" @@ -19,3 +26,5 @@ extern std::uint64_t tickrate_dt; extern Dimension* spawn_dimension; extern std::unordered_map<std::string, Dimension*> dimensions; } // namespace globals + +#endif diff --git a/src/game/server/main.cc b/src/game/server/main.cc index 181145f..7c70ae1 100644 --- a/src/game/server/main.cc +++ b/src/game/server/main.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: main.cc +// Description: Entry point + #include "server/pch.hh" #include "core/config/number.hh" diff --git a/src/game/server/pch.hh b/src/game/server/pch.hh index 6f42c17..a7892d8 100644 --- a/src/game/server/pch.hh +++ b/src/game/server/pch.hh @@ -1,3 +1,12 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: pch.hh +// Description: Precompiled header + +#ifndef SERVER_PCH_HH +#define SERVER_PCH_HH #pragma once #include <shared/pch.hh> + +#endif diff --git a/src/game/server/receive.cc b/src/game/server/receive.cc index a3ce14b..b9a0da0 100644 --- a/src/game/server/receive.cc +++ b/src/game/server/receive.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: receive.cc +// Description: Handle incoming packets + #include "server/pch.hh" #include "server/receive.hh" diff --git a/src/game/server/receive.hh b/src/game/server/receive.hh index 4150226..99c5688 100644 --- a/src/game/server/receive.hh +++ b/src/game/server/receive.hh @@ -1,6 +1,15 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: receive.hh +// Description: Handle incoming packets + +#ifndef SERVER_RECEIVE_HH +#define SERVER_RECEIVE_HH #pragma once namespace server_recieve { void init(void); } // namespace server_recieve + +#endif diff --git a/src/game/server/sessions.cc b/src/game/server/sessions.cc index b161d55..f66dfa1 100644 --- a/src/game/server/sessions.cc +++ b/src/game/server/sessions.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: sessions.cc +// Description: Session handling + #include "server/pch.hh" #include "server/sessions.hh" diff --git a/src/game/server/sessions.hh b/src/game/server/sessions.hh index 4c64f80..7806d71 100644 --- a/src/game/server/sessions.hh +++ b/src/game/server/sessions.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: sessions.hh +// Description: Session handling + +#ifndef SERVER_SESSIONS_HH +#define SERVER_SESSIONS_HH #pragma once class Dimension; @@ -50,3 +57,5 @@ namespace sessions { void refresh_scoreboard(void); } // namespace sessions + +#endif diff --git a/src/game/server/status.cc b/src/game/server/status.cc index 9414a76..592c5ce 100644 --- a/src/game/server/status.cc +++ b/src/game/server/status.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: status.cc +// Description: Respond to client bothering + #include "server/pch.hh" #include "server/status.hh" diff --git a/src/game/server/status.hh b/src/game/server/status.hh index 35370a0..70eea40 100644 --- a/src/game/server/status.hh +++ b/src/game/server/status.hh @@ -1,6 +1,15 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: status.hh +// Description: Respond to client bothering + +#ifndef SERVER_STATUS_HH +#define SERVER_STATUS_HH #pragma once namespace status { void init(void); } // namespace status + +#endif diff --git a/src/game/server/whitelist.cc b/src/game/server/whitelist.cc index 555e5f3..2370c67 100644 --- a/src/game/server/whitelist.cc +++ b/src/game/server/whitelist.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: whitelist.cc +// Description: Player allow-list + #include "server/pch.hh" #include "server/whitelist.hh" @@ -48,7 +53,7 @@ void whitelist::init_late(void) PHYSFS_File* file = PHYSFS_openRead(whitelist::filename.c_str()); if(file == nullptr) { - spdlog::warn("whitelist: {}: {}", whitelist::filename.get(), physfs_error()); + spdlog::warn("whitelist: {}: {}", whitelist::filename.get(), physfs::last_error()); whitelist::enabled.set_value(false); return; } diff --git a/src/game/server/whitelist.hh b/src/game/server/whitelist.hh index 4695d16..e9dc3aa 100644 --- a/src/game/server/whitelist.hh +++ b/src/game/server/whitelist.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: whitelist.hh +// Description: Player allow-list + +#ifndef SERVER_WHITELIST_HH +#define SERVER_WHITELIST_HH #pragma once namespace config @@ -24,3 +31,5 @@ namespace whitelist bool contains(std::string_view username); bool matches(std::string_view username, std::uint64_t password_hash); } // namespace whitelist + +#endif diff --git a/src/game/server/world/inhabited.hh b/src/game/server/world/inhabited.hh index e4b2344..fa34eb2 100644 --- a/src/game/server/world/inhabited.hh +++ b/src/game/server/world/inhabited.hh @@ -1,3 +1,12 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: inhabited.hh +// Description: Flag component for chunks that should be saved on disk + +#ifndef SERVER_WORLD_INHABITED_HH +#define SERVER_WORLD_INHABITED_HH #pragma once struct Inhabited final {}; + +#endif diff --git a/src/game/server/world/overworld.cc b/src/game/server/world/overworld.cc index b03311d..3e9f15b 100644 --- a/src/game/server/world/overworld.cc +++ b/src/game/server/world/overworld.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: overworld.cc +// Description: Generic world dimension + #include "server/pch.hh" #include "server/world/overworld.hh" diff --git a/src/game/server/world/overworld.hh b/src/game/server/world/overworld.hh index ef4bb54..fd21089 100644 --- a/src/game/server/world/overworld.hh +++ b/src/game/server/world/overworld.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: overworld.hh +// Description: Generic world dimension + +#ifndef SERVER_WORLD_OVERWORLD_HH +#define SERVER_WORLD_OVERWORLD_HH #pragma once #include "core/config/number.hh" @@ -60,3 +67,5 @@ private: private: std::mutex m_mutex; }; + +#endif diff --git a/src/game/server/world/random_tick.cc b/src/game/server/world/random_tick.cc index 8fdcfeb..6e6c65a 100644 --- a/src/game/server/world/random_tick.cc +++ b/src/game/server/world/random_tick.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: random_tick.cc +// Description: Voxel random ticking + #include "server/pch.hh" #include "server/world/random_tick.hh" diff --git a/src/game/server/world/random_tick.hh b/src/game/server/world/random_tick.hh index 9c67dc4..0d01267 100644 --- a/src/game/server/world/random_tick.hh +++ b/src/game/server/world/random_tick.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: random_tick.hh +// Description: Voxel random ticking + +#ifndef SERVER_WORLD_RANDOM_TICK_HH +#define SERVER_WORLD_RANDOM_TICK_HH #pragma once #include "shared/types.hh" @@ -9,3 +16,5 @@ namespace random_tick void init(void); void tick(const chunk_pos& cpos, Chunk* chunk); } // namespace random_tick + +#endif diff --git a/src/game/server/world/universe.cc b/src/game/server/world/universe.cc index defefc6..0a8d956 100644 --- a/src/game/server/world/universe.cc +++ b/src/game/server/world/universe.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: universe.cc +// Description: Dimension handling + #include "server/pch.hh" #include "server/world/universe.hh" @@ -52,7 +57,7 @@ static void add_new_dimension(Dimension* dimension) auto dimension_dir = std::format("{}/{}", universe_name.get(), dimension->get_name()); if(!PHYSFS_mkdir(dimension_dir.c_str())) { - spdlog::critical("universe: {}: {}", dimension_dir, physfs_error()); + spdlog::critical("universe: {}: {}", dimension_dir, physfs::last_error()); std::terminate(); } @@ -61,7 +66,7 @@ static void add_new_dimension(Dimension* dimension) metadata->zvox_dir = std::format("{}/chunk", dimension_dir); if(!PHYSFS_mkdir(metadata->zvox_dir.c_str())) { - spdlog::critical("universe: {}: {}", metadata->zvox_dir, physfs_error()); + spdlog::critical("universe: {}: {}", metadata->zvox_dir, physfs::last_error()); std::terminate(); } @@ -109,7 +114,7 @@ void universe::init_late(void) const auto universe_dir = std::string(universe_name.get()); if(!PHYSFS_mkdir(universe_dir.c_str())) { - spdlog::critical("universe: {}: {}", universe_dir, physfs_error()); + spdlog::critical("universe: {}: {}", universe_dir, physfs::last_error()); std::terminate(); } diff --git a/src/game/server/world/universe.hh b/src/game/server/world/universe.hh index 31d3721..0901b9e 100644 --- a/src/game/server/world/universe.hh +++ b/src/game/server/world/universe.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: universe.hh +// Description: Dimension handling + +#ifndef SERVER_WORLD_UNIVERSE_HH +#define SERVER_WORLD_UNIVERSE_HH #pragma once #include "shared/types.hh" @@ -20,3 +27,5 @@ Chunk* load_chunk(Dimension* dimension, const chunk_pos& cpos); void save_chunk(Dimension* dimension, const chunk_pos& cpos); void save_all_chunks(Dimension* dimension); } // namespace universe + +#endif diff --git a/src/game/server/world/unloader.cc b/src/game/server/world/unloader.cc index 5842b14..bbb87d3 100644 --- a/src/game/server/world/unloader.cc +++ b/src/game/server/world/unloader.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: unloader.cc +// Description: Handle chunks that are out of view for all players + #include "server/pch.hh" #include "server/world/unloader.hh" diff --git a/src/game/server/world/unloader.hh b/src/game/server/world/unloader.hh index bf816bd..85e7d5e 100644 --- a/src/game/server/world/unloader.hh +++ b/src/game/server/world/unloader.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: unloader.hh +// Description: Handle chunks that are out of view for all players + +#ifndef SERVER_WORLD_UNLOADER_HH +#define SERVER_WORLD_UNLOADER_HH #pragma once class Dimension; @@ -8,3 +15,5 @@ void init(void); void init_late(void); void fixed_update_late(Dimension* dimension); } // namespace unloader + +#endif diff --git a/src/game/server/world/worldgen.cc b/src/game/server/world/worldgen.cc index c8c7ade..e543208 100644 --- a/src/game/server/world/worldgen.cc +++ b/src/game/server/world/worldgen.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: worldgen.cc +// Description: Threaded requests for dimensions to generate chunks + #include "server/pch.hh" #include "server/world/worldgen.hh" diff --git a/src/game/server/world/worldgen.hh b/src/game/server/world/worldgen.hh index f991744..ef0cc49 100644 --- a/src/game/server/world/worldgen.hh +++ b/src/game/server/world/worldgen.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: worldgen.hh +// Description: Threaded requests for dimensions to generate chunks + +#ifndef SERVER_WORLD_WORLDGEN_HH +#define SERVER_WORLD_WORLDGEN_HH #pragma once #include "shared/types.hh" @@ -16,3 +23,5 @@ namespace worldgen bool is_generating(Dimension* dimension, const chunk_pos& cpos); void request_chunk(Session* session, const chunk_pos& cpos); } // namespace worldgen + +#endif |
