From 0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e Mon Sep 17 00:00:00 2001 From: untodesu Date: Fri, 26 Dec 2025 23:17:56 +0500 Subject: Add include guards and header comments to sources --- src/game/server/world/inhabited.hh | 9 +++++++++ src/game/server/world/overworld.cc | 5 +++++ src/game/server/world/overworld.hh | 9 +++++++++ src/game/server/world/random_tick.cc | 5 +++++ src/game/server/world/random_tick.hh | 9 +++++++++ src/game/server/world/universe.cc | 11 ++++++++--- src/game/server/world/universe.hh | 9 +++++++++ src/game/server/world/unloader.cc | 5 +++++ src/game/server/world/unloader.hh | 9 +++++++++ src/game/server/world/worldgen.cc | 5 +++++ src/game/server/world/worldgen.hh | 9 +++++++++ 11 files changed, 82 insertions(+), 3 deletions(-) (limited to 'src/game/server/world') 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 -- cgit