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/shared/const.hh | 9 +++++++++ src/game/shared/coord.hh | 9 +++++++++ src/game/shared/entity/collision.cc | 5 +++++ src/game/shared/entity/collision.hh | 9 +++++++++ src/game/shared/entity/factory.cc | 5 +++++ src/game/shared/entity/factory.hh | 9 +++++++++ src/game/shared/entity/gravity.cc | 5 +++++ src/game/shared/entity/gravity.hh | 9 +++++++++ src/game/shared/entity/grounded.hh | 9 +++++++++ src/game/shared/entity/head.hh | 9 +++++++++ src/game/shared/entity/player.hh | 9 +++++++++ src/game/shared/entity/stasis.cc | 5 +++++ src/game/shared/entity/stasis.hh | 9 +++++++++ src/game/shared/entity/transform.cc | 5 +++++ src/game/shared/entity/transform.hh | 9 +++++++++ src/game/shared/entity/velocity.cc | 5 +++++ src/game/shared/entity/velocity.hh | 9 +++++++++ src/game/shared/game.cc | 15 ++++++++++----- src/game/shared/game.hh | 9 +++++++++ src/game/shared/game_items.cc | 5 +++++ src/game/shared/game_items.hh | 9 +++++++++ src/game/shared/game_voxels.cc | 5 +++++ src/game/shared/game_voxels.hh | 9 +++++++++ src/game/shared/globals.cc | 5 +++++ src/game/shared/globals.hh | 9 +++++++++ src/game/shared/pch.hh | 9 +++++++++ src/game/shared/protocol.cc | 5 +++++ src/game/shared/protocol.hh | 9 +++++++++ src/game/shared/splash.cc | 7 ++++++- src/game/shared/splash.hh | 9 +++++++++ src/game/shared/types.hh | 9 +++++++++ src/game/shared/world/chunk.cc | 5 +++++ src/game/shared/world/chunk.hh | 9 +++++++++ src/game/shared/world/chunk_aabb.hh | 9 +++++++++ src/game/shared/world/dimension.cc | 5 +++++ src/game/shared/world/dimension.hh | 9 +++++++++ src/game/shared/world/feature.cc | 5 +++++ src/game/shared/world/feature.hh | 9 +++++++++ src/game/shared/world/item.cc | 5 +++++ src/game/shared/world/item.hh | 9 +++++++++ src/game/shared/world/item_registry.cc | 5 +++++ src/game/shared/world/item_registry.hh | 9 +++++++++ src/game/shared/world/ray_aabb.cc | 5 +++++ src/game/shared/world/ray_aabb.hh | 9 +++++++++ src/game/shared/world/ray_dda.cc | 5 +++++ src/game/shared/world/ray_dda.hh | 9 +++++++++ src/game/shared/world/voxel.cc | 5 +++++ src/game/shared/world/voxel.hh | 9 +++++++++ src/game/shared/world/voxel_registry.cc | 5 +++++ src/game/shared/world/voxel_registry.hh | 9 +++++++++ src/game/shared/world/voxel_storage.cc | 5 +++++ src/game/shared/world/voxel_storage.hh | 9 +++++++++ 52 files changed, 386 insertions(+), 6 deletions(-) (limited to 'src/game/shared') diff --git a/src/game/shared/const.hh b/src/game/shared/const.hh index 187962a..45e1731 100644 --- a/src/game/shared/const.hh +++ b/src/game/shared/const.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: const.hh +// Description: Constants + +#ifndef SHARED_CONST_HH +#define SHARED_CONST_HH #pragma once #include "core/math/constexpr.hh" @@ -41,3 +48,5 @@ constexpr static glm::vec<2, T> ZERO_VEC2 = glm::vec<2, T>(0, 0); template constexpr static glm::vec<3, T> ZERO_VEC3 = glm::vec<3, T>(0, 0, 0); + +#endif diff --git a/src/game/shared/coord.hh b/src/game/shared/coord.hh index 9d9be18..bd66c9b 100644 --- a/src/game/shared/coord.hh +++ b/src/game/shared/coord.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: coord.hh +// Description: Coordinate domain change functions + +#ifndef SHARED_COORD_HH +#define SHARED_COORD_HH #pragma once #include "shared/const.hh" @@ -143,3 +150,5 @@ inline constexpr glm::fvec3 coord::to_fvec3(const chunk_pos& cpos, const glm::fv fpos.z + static_cast(cpos.z << CHUNK_BITSHIFT), }; } + +#endif diff --git a/src/game/shared/entity/collision.cc b/src/game/shared/entity/collision.cc index 322bb91..6878958 100644 --- a/src/game/shared/entity/collision.cc +++ b/src/game/shared/entity/collision.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: collision.cc +// Description: Collision detection + #include "shared/pch.hh" #include "shared/entity/collision.hh" diff --git a/src/game/shared/entity/collision.hh b/src/game/shared/entity/collision.hh index 34a648c..89d9756 100644 --- a/src/game/shared/entity/collision.hh +++ b/src/game/shared/entity/collision.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: collision.hh +// Description: Collision detection + +#ifndef SHARED_ENTITY_COLLISION_HH +#define SHARED_ENTITY_COLLISION_HH #pragma once #include "core/math/aabb.hh" @@ -13,3 +20,5 @@ public: // because both transform and velocity may be updated internally static void fixed_update(Dimension* dimension); }; + +#endif diff --git a/src/game/shared/entity/factory.cc b/src/game/shared/entity/factory.cc index f2031df..223e593 100644 --- a/src/game/shared/entity/factory.cc +++ b/src/game/shared/entity/factory.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: factory.cc +// Description: Boilerplate entity creation + #include "shared/pch.hh" #include "shared/entity/factory.hh" diff --git a/src/game/shared/entity/factory.hh b/src/game/shared/entity/factory.hh index 7c94136..158b187 100644 --- a/src/game/shared/entity/factory.hh +++ b/src/game/shared/entity/factory.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: factory.hh +// Description: Boilerplate entity creation + +#ifndef SHARED_ENTITY_FACTORY_HH +#define SHARED_ENTITY_FACTORY_HH #pragma once class Dimension; @@ -6,3 +13,5 @@ namespace shared { void create_player(Dimension* dimension, entt::entity entity); } // namespace shared + +#endif diff --git a/src/game/shared/entity/gravity.cc b/src/game/shared/entity/gravity.cc index 6a5145f..893e819 100644 --- a/src/game/shared/entity/gravity.cc +++ b/src/game/shared/entity/gravity.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: gravity.cc +// Description: Gravity component + #include "shared/pch.hh" #include "shared/entity/gravity.hh" diff --git a/src/game/shared/entity/gravity.hh b/src/game/shared/entity/gravity.hh index 38b3c9b..c6ad701 100644 --- a/src/game/shared/entity/gravity.hh +++ b/src/game/shared/entity/gravity.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: gravity.hh +// Description: Gravity component + +#ifndef SHARED_ENTITY_GRAVITY_HH +#define SHARED_ENTITY_GRAVITY_HH #pragma once class Dimension; @@ -6,3 +13,5 @@ struct Gravity final { public: static void fixed_update(Dimension* dimension); }; + +#endif diff --git a/src/game/shared/entity/grounded.hh b/src/game/shared/entity/grounded.hh index 7307e79..38367ec 100644 --- a/src/game/shared/entity/grounded.hh +++ b/src/game/shared/entity/grounded.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: grounded.hh +// Description: Flag components for entites that rest on the ground + +#ifndef SHARED_ENTITY_GROUNDED_HH +#define SHARED_ENTITY_GROUNDED_HH #pragma once #include "shared/world/voxel.hh" @@ -7,3 +14,5 @@ struct Grounded final { VoxelMaterial surface; }; + +#endif diff --git a/src/game/shared/entity/head.hh b/src/game/shared/entity/head.hh index 9fa71d9..cec3be4 100644 --- a/src/game/shared/entity/head.hh +++ b/src/game/shared/entity/head.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: head.hh +// Description: Head component + +#ifndef SHARED_ENTITY_HEAD_HH +#define SHARED_ENTITY_HEAD_HH #pragma once struct Head { @@ -11,3 +18,5 @@ namespace client struct HeadIntr final : public Head {}; struct HeadPrev final : public Head {}; } // namespace client + +#endif diff --git a/src/game/shared/entity/player.hh b/src/game/shared/entity/player.hh index d7cd020..8edba5e 100644 --- a/src/game/shared/entity/player.hh +++ b/src/game/shared/entity/player.hh @@ -1,3 +1,12 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: player.hh +// Description: Flag components for entites that are players + +#ifndef SHARED_ENTITY_PLAYER_HH +#define SHARED_ENTITY_PLAYER_HH #pragma once struct Player final {}; + +#endif diff --git a/src/game/shared/entity/stasis.cc b/src/game/shared/entity/stasis.cc index 0b8a0c8..72f7592 100644 --- a/src/game/shared/entity/stasis.cc +++ b/src/game/shared/entity/stasis.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: stasis.cc +// Description: Freeze entites that are in an unloaded chunk + #include "shared/pch.hh" #include "shared/entity/stasis.hh" diff --git a/src/game/shared/entity/stasis.hh b/src/game/shared/entity/stasis.hh index 5adc592..dfb97b3 100644 --- a/src/game/shared/entity/stasis.hh +++ b/src/game/shared/entity/stasis.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: stasis.hh +// Description: Freeze entites that are in an unloaded chunk + +#ifndef SHARED_ENTITY_STASIS_HH +#define SHARED_ENTITY_STASIS_HH #pragma once class Dimension; @@ -8,3 +15,5 @@ struct Stasis final { public: static void fixed_update(Dimension* dimension); }; + +#endif diff --git a/src/game/shared/entity/transform.cc b/src/game/shared/entity/transform.cc index cf09e2f..2ceee0d 100644 --- a/src/game/shared/entity/transform.cc +++ b/src/game/shared/entity/transform.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: transform.cc +// Description: Transform component + #include "shared/pch.hh" #include "shared/entity/transform.hh" diff --git a/src/game/shared/entity/transform.hh b/src/game/shared/entity/transform.hh index afbe9fa..55a00ac 100644 --- a/src/game/shared/entity/transform.hh +++ b/src/game/shared/entity/transform.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: transform.hh +// Description: Transform component + +#ifndef SHARED_ENTITY_TRANSFORM_HH +#define SHARED_ENTITY_TRANSFORM_HH #pragma once #include "shared/types.hh" @@ -22,3 +29,5 @@ namespace client struct TransformIntr final : public Transform {}; struct TransformPrev final : public Transform {}; } // namespace client + +#endif diff --git a/src/game/shared/entity/velocity.cc b/src/game/shared/entity/velocity.cc index 6fb8c80..c08b749 100644 --- a/src/game/shared/entity/velocity.cc +++ b/src/game/shared/entity/velocity.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: velocity.cc +// Description: Velocity component + #include "shared/pch.hh" #include "shared/entity/velocity.hh" diff --git a/src/game/shared/entity/velocity.hh b/src/game/shared/entity/velocity.hh index 0266bd0..8dccf09 100644 --- a/src/game/shared/entity/velocity.hh +++ b/src/game/shared/entity/velocity.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: velocity.hh +// Description: Velocity component + +#ifndef SHARED_ENTITY_VELOCITY_HH +#define SHARED_ENTITY_VELOCITY_HH #pragma once class Dimension; @@ -18,3 +25,5 @@ namespace client struct VelocityIntr final : public Velocity {}; struct VelocityPrev final : public Velocity {}; } // namespace client + +#endif diff --git a/src/game/shared/game.cc b/src/game/shared/game.cc index e839e6a..bac92fb 100644 --- a/src/game/shared/game.cc +++ b/src/game/shared/game.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: game.cc +// Description: Shared initialization logic + #include "shared/pch.hh" #include "shared/game.hh" @@ -81,7 +86,7 @@ void shared_game::init(int argc, char** argv, std::string_view logfile) logger->flush(); if(!PHYSFS_init(argv[0])) { - spdlog::critical("physfs: init failed: {}", physfs_error()); + spdlog::critical("physfs: init failed: {}", physfs::last_error()); std::terminate(); } @@ -96,17 +101,17 @@ void shared_game::init(int argc, char** argv, std::string_view logfile) std::filesystem::create_directories(userpath, ignore_error); if(!PHYSFS_mount(gamepath.string().c_str(), nullptr, false)) { - spdlog::critical("physfs: mount {} failed: {}", gamepath.string(), physfs_error()); + spdlog::critical("physfs: mount {} failed: {}", gamepath.string(), physfs::last_error()); std::terminate(); } if(!PHYSFS_mount(userpath.string().c_str(), nullptr, false)) { - spdlog::critical("physfs: mount {} failed: {}", userpath.string(), physfs_error()); + spdlog::critical("physfs: mount {} failed: {}", userpath.string(), physfs::last_error()); std::terminate(); } if(!PHYSFS_setWriteDir(userpath.string().c_str())) { - spdlog::critical("physfs: setwritedir {} failed: {}", userpath.string(), physfs_error()); + spdlog::critical("physfs: setwritedir {} failed: {}", userpath.string(), physfs::last_error()); std::terminate(); } @@ -121,7 +126,7 @@ void shared_game::shutdown(void) enet_deinitialize(); if(!PHYSFS_deinit()) { - spdlog::critical("physfs: deinit failed: {}", physfs_error()); + spdlog::critical("physfs: deinit failed: {}", physfs::last_error()); std::terminate(); } } diff --git a/src/game/shared/game.hh b/src/game/shared/game.hh index 6e89a3c..8fe3c90 100644 --- a/src/game/shared/game.hh +++ b/src/game/shared/game.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: game.hh +// Description: Shared initialization logic + +#ifndef SHARED_GAME_HH +#define SHARED_GAME_HH #pragma once namespace shared_game @@ -5,3 +12,5 @@ namespace shared_game void init(int argc, char** argv, std::string_view logfile = {}); void shutdown(void); } // namespace shared_game + +#endif diff --git a/src/game/shared/game_items.cc b/src/game/shared/game_items.cc index 73f7cef..5fe8ba3 100644 --- a/src/game/shared/game_items.cc +++ b/src/game/shared/game_items.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: game_items.cc +// Description: All the items in the game + #include "shared/pch.hh" #include "shared/game_items.hh" diff --git a/src/game/shared/game_items.hh b/src/game/shared/game_items.hh index 1170543..9901e18 100644 --- a/src/game/shared/game_items.hh +++ b/src/game/shared/game_items.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: game_items.hh +// Description: All the items in the game + +#ifndef SHARED_GAME_ITEMS_HH +#define SHARED_GAME_ITEMS_HH #pragma once class Item; @@ -19,3 +26,5 @@ namespace game_items { void populate(void); } // namespace game_items + +#endif diff --git a/src/game/shared/game_voxels.cc b/src/game/shared/game_voxels.cc index 010053a..6682dd8 100644 --- a/src/game/shared/game_voxels.cc +++ b/src/game/shared/game_voxels.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: game_voxels.cc +// Description: All the voxels in the game + #include "shared/pch.hh" #include "shared/game_voxels.hh" diff --git a/src/game/shared/game_voxels.hh b/src/game/shared/game_voxels.hh index f46385c..403ee86 100644 --- a/src/game/shared/game_voxels.hh +++ b/src/game/shared/game_voxels.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: game_voxels.hh +// Description: All the voxels in the game + +#ifndef SHARED_GAME_VOXELS_HH +#define SHARED_GAME_VOXELS_HH #pragma once class Voxel; @@ -21,3 +28,5 @@ namespace game_voxels { void populate(void); } // namespace game_voxels + +#endif diff --git a/src/game/shared/globals.cc b/src/game/shared/globals.cc index 8552214..92da492 100644 --- a/src/game/shared/globals.cc +++ b/src/game/shared/globals.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: globals.cc +// Description: Global variables + #include "shared/pch.hh" #include "shared/globals.hh" diff --git a/src/game/shared/globals.hh b/src/game/shared/globals.hh index 39a12a7..4c02f43 100644 --- a/src/game/shared/globals.hh +++ b/src/game/shared/globals.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: globals.hh +// Description: Global variables + +#ifndef SHARED_GLOBALS_HH +#define SHARED_GLOBALS_HH #pragma once namespace globals @@ -17,3 +24,5 @@ namespace globals { extern std::uint64_t curtime; } // namespace globals + +#endif diff --git a/src/game/shared/pch.hh b/src/game/shared/pch.hh index e978e0f..13afb80 100644 --- a/src/game/shared/pch.hh +++ b/src/game/shared/pch.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: pch.hh +// Description: Precompiled header + +#ifndef SHARED_PCH_HH +#define SHARED_PCH_HH #pragma once #include // inherit dependent includes from core.lib @@ -17,3 +24,5 @@ #include #include + +#endif diff --git a/src/game/shared/protocol.cc b/src/game/shared/protocol.cc index d274955..9b18f8a 100644 --- a/src/game/shared/protocol.cc +++ b/src/game/shared/protocol.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: protocol.cc +// Description: Network protocol on top of ENet + #include "shared/pch.hh" #include "shared/protocol.hh" diff --git a/src/game/shared/protocol.hh b/src/game/shared/protocol.hh index 2582406..46e0202 100644 --- a/src/game/shared/protocol.hh +++ b/src/game/shared/protocol.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: protocol.hh +// Description: Network protocol on top of ENet + +#ifndef SHARED_PROTOCOL_HH +#define SHARED_PROTOCOL_HH #pragma once #include "shared/world/chunk.hh" @@ -210,3 +217,5 @@ struct protocol::DimensionInfo final : public protocol::Base<0x0012> { std::string name; float gravity; }; + +#endif diff --git a/src/game/shared/splash.cc b/src/game/shared/splash.cc index 86ed0d0..86b71bc 100644 --- a/src/game/shared/splash.cc +++ b/src/game/shared/splash.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: splash.cc +// Description: Randomized text messages + #include "shared/pch.hh" #include "shared/splash.hh" @@ -39,7 +44,7 @@ static void splash_init_filename(std::string_view filename) splash_random.seed(std::random_device()()); } else { - splash_lines.push_back(std::format("{}: {}", filename, physfs_error())); + splash_lines.push_back(std::format("{}: {}", filename, physfs::last_error())); splash_random.seed(std::random_device()()); } } diff --git a/src/game/shared/splash.hh b/src/game/shared/splash.hh index be80cd6..0acfe3b 100644 --- a/src/game/shared/splash.hh +++ b/src/game/shared/splash.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: splash.hh +// Description: Randomized text messages + +#ifndef SHARED_SPLASH_HH +#define SHARED_SPLASH_HH #pragma once namespace splash @@ -6,3 +13,5 @@ void init_client(void); void init_server(void); std::string_view get(void); } // namespace splash + +#endif diff --git a/src/game/shared/types.hh b/src/game/shared/types.hh index 792ed0f..801206c 100644 --- a/src/game/shared/types.hh +++ b/src/game/shared/types.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: types.hh +// Description: Type definitions + +#ifndef SHARED_TYPES_HH +#define SHARED_TYPES_HH #pragma once using item_id = std::uint32_t; @@ -38,3 +45,5 @@ struct std::hash final { return value; } }; + +#endif diff --git a/src/game/shared/world/chunk.cc b/src/game/shared/world/chunk.cc index 10da80e..2840fc1 100644 --- a/src/game/shared/world/chunk.cc +++ b/src/game/shared/world/chunk.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: chunk.cc +// Description: A single chunk of voxels + #include "shared/pch.hh" #include "shared/world/chunk.hh" diff --git a/src/game/shared/world/chunk.hh b/src/game/shared/world/chunk.hh index f8e38b4..b0b0604 100644 --- a/src/game/shared/world/chunk.hh +++ b/src/game/shared/world/chunk.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: chunk.hh +// Description: A single chunk of voxels + +#ifndef SHARED_WORLD_CHUNK_HH +#define SHARED_WORLD_CHUNK_HH #pragma once #include "shared/world/voxel_storage.hh" @@ -35,3 +42,5 @@ private: VoxelStorage m_voxels; unsigned int m_biome; }; + +#endif diff --git a/src/game/shared/world/chunk_aabb.hh b/src/game/shared/world/chunk_aabb.hh index 0f8851c..7cf042c 100644 --- a/src/game/shared/world/chunk_aabb.hh +++ b/src/game/shared/world/chunk_aabb.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: chunk_aabb.hh +// Description: Axis-aligned bounding box for chunk-domain coordinates + +#ifndef SHARED_WORLD_CHUNK_AABB_HH +#define SHARED_WORLD_CHUNK_AABB_HH #pragma once #include "core/math/aabb.hh" @@ -5,3 +12,5 @@ #include "shared/types.hh" using ChunkAABB = math::AABB; + +#endif diff --git a/src/game/shared/world/dimension.cc b/src/game/shared/world/dimension.cc index 84ca539..393aa0c 100644 --- a/src/game/shared/world/dimension.cc +++ b/src/game/shared/world/dimension.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: dimension.cc +// Description: A single world + #include "shared/pch.hh" #include "shared/world/dimension.hh" diff --git a/src/game/shared/world/dimension.hh b/src/game/shared/world/dimension.hh index b57640a..9845c5a 100644 --- a/src/game/shared/world/dimension.hh +++ b/src/game/shared/world/dimension.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: dimension.hh +// Description: A single world + +#ifndef SHARED_WORLD_DIMENSION_HH +#define SHARED_WORLD_DIMENSION_HH #pragma once #include "shared/const.hh" @@ -81,3 +88,5 @@ struct VoxelSetEvent final { local_pos lpos; Chunk* chunk; }; + +#endif diff --git a/src/game/shared/world/feature.cc b/src/game/shared/world/feature.cc index 3974082..1226b1f 100644 --- a/src/game/shared/world/feature.cc +++ b/src/game/shared/world/feature.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: feature.cc +// Description: A world generation feature + #include "shared/pch.hh" #include "shared/world/feature.hh" diff --git a/src/game/shared/world/feature.hh b/src/game/shared/world/feature.hh index b80869d..820ddc7 100644 --- a/src/game/shared/world/feature.hh +++ b/src/game/shared/world/feature.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: feature.hh +// Description: A world generation feature + +#ifndef SHARED_WORLD_FEATURE_HH +#define SHARED_WORLD_FEATURE_HH #pragma once #include "shared/types.hh" @@ -17,3 +24,5 @@ public: void place(const voxel_pos& vpos, const chunk_pos& cpos, Chunk& chunk) const; void place(const voxel_pos& vpos, const chunk_pos& cpos, VoxelStorage& voxels) const; }; + +#endif diff --git a/src/game/shared/world/item.cc b/src/game/shared/world/item.cc index bc1546a..207e9da 100644 --- a/src/game/shared/world/item.cc +++ b/src/game/shared/world/item.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: item.cc +// Description: Item metadata + #include "shared/pch.hh" #include "shared/world/item.hh" diff --git a/src/game/shared/world/item.hh b/src/game/shared/world/item.hh index bcec37a..3786b19 100644 --- a/src/game/shared/world/item.hh +++ b/src/game/shared/world/item.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: item.hh +// Description: Item metadata + +#ifndef SHARED_WORLD_ITEM_HH +#define SHARED_WORLD_ITEM_HH #pragma once #include "core/resource/resource.hh" @@ -73,3 +80,5 @@ constexpr resource_ptr& Item::get_cached_texture(void) const noexcep { return m_cached_texture; } + +#endif diff --git a/src/game/shared/world/item_registry.cc b/src/game/shared/world/item_registry.cc index c7d8d9b..6f5a8a0 100644 --- a/src/game/shared/world/item_registry.cc +++ b/src/game/shared/world/item_registry.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: item_registry.cc +// Description: Registry for all the items in the game + #include "shared/pch.hh" #include "shared/world/item_registry.hh" diff --git a/src/game/shared/world/item_registry.hh b/src/game/shared/world/item_registry.hh index f8fe641..588211d 100644 --- a/src/game/shared/world/item_registry.hh +++ b/src/game/shared/world/item_registry.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: item_registry.hh +// Description: Registry for all the items in the game + +#ifndef SHARED_WORLD_ITEM_REGISTRY_HH +#define SHARED_WORLD_ITEM_REGISTRY_HH #pragma once #include "shared/world/item.hh" @@ -24,3 +31,5 @@ namespace item_registry { std::uint64_t get_checksum(void); } // namespace item_registry + +#endif diff --git a/src/game/shared/world/ray_aabb.cc b/src/game/shared/world/ray_aabb.cc index f6f2638..9bc2ee0 100644 --- a/src/game/shared/world/ray_aabb.cc +++ b/src/game/shared/world/ray_aabb.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: ray_aabb.cc +// Description: Check ray intersections against an AABB + #include "shared/pch.hh" #include "shared/world/ray_aabb.hh" diff --git a/src/game/shared/world/ray_aabb.hh b/src/game/shared/world/ray_aabb.hh index 49c0846..640a02c 100644 --- a/src/game/shared/world/ray_aabb.hh +++ b/src/game/shared/world/ray_aabb.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: ray_aabb.hh +// Description: Check ray intersections against an AABB + +#ifndef SHARED_WORLD_RAY_AABB_HH +#define SHARED_WORLD_RAY_AABB_HH #pragma once #include "core/math/aabb.hh" @@ -28,3 +35,5 @@ constexpr const glm::fvec3& RayAABB::direction(void) const noexcept { return m_direction; } + +#endif diff --git a/src/game/shared/world/ray_dda.cc b/src/game/shared/world/ray_dda.cc index 5dbf82e..45480b8 100644 --- a/src/game/shared/world/ray_dda.cc +++ b/src/game/shared/world/ray_dda.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: ray_dda.cc +// Description: Fast voxel grid traversal with an arbitrary starting position + #include "shared/pch.hh" #include "shared/world/ray_dda.hh" diff --git a/src/game/shared/world/ray_dda.hh b/src/game/shared/world/ray_dda.hh index 72f746e..c3cbb09 100644 --- a/src/game/shared/world/ray_dda.hh +++ b/src/game/shared/world/ray_dda.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: ray_dda.hh +// Description: Fast voxel grid traversal with an arbitrary starting position + +#ifndef SHARED_WORLD_RAY_DDA_HH +#define SHARED_WORLD_RAY_DDA_HH #pragma once #include "shared/types.hh" @@ -30,3 +37,5 @@ public: voxel_pos vnormal; voxel_pos vpos; }; + +#endif diff --git a/src/game/shared/world/voxel.cc b/src/game/shared/world/voxel.cc index 4f47c2d..71ef7b8 100644 --- a/src/game/shared/world/voxel.cc +++ b/src/game/shared/world/voxel.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: voxel.cc +// Description: Voxel metadata... A metavoxel! + #include "shared/pch.hh" #include "shared/world/voxel.hh" diff --git a/src/game/shared/world/voxel.hh b/src/game/shared/world/voxel.hh index 0a8c4a3..8f6e344 100644 --- a/src/game/shared/world/voxel.hh +++ b/src/game/shared/world/voxel.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: voxel.hh +// Description: Voxel metadata... A metavoxel! + +#ifndef SHARED_WORLD_VOXEL_HH +#define SHARED_WORLD_VOXEL_HH #pragma once #include "core/math/aabb.hh" @@ -269,3 +276,5 @@ constexpr bool Voxel::is_surface_material(void) const noexcept { return m_surface_material == Material; } + +#endif diff --git a/src/game/shared/world/voxel_registry.cc b/src/game/shared/world/voxel_registry.cc index f950a4d..530b100 100644 --- a/src/game/shared/world/voxel_registry.cc +++ b/src/game/shared/world/voxel_registry.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: voxel_registry.cc +// Description: Registry for all the voxels in the game + #include "shared/pch.hh" #include "shared/world/voxel_registry.hh" diff --git a/src/game/shared/world/voxel_registry.hh b/src/game/shared/world/voxel_registry.hh index 5dbaf50..4e60808 100644 --- a/src/game/shared/world/voxel_registry.hh +++ b/src/game/shared/world/voxel_registry.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: voxel_registry.hh +// Description: Registry for all the voxels in the game + +#ifndef SHARED_WORLD_VOXEL_REGISTRY_HH +#define SHARED_WORLD_VOXEL_REGISTRY_HH #pragma once #include "shared/world/voxel.hh" @@ -24,3 +31,5 @@ namespace voxel_registry { std::uint64_t get_checksum(void); } // namespace voxel_registry + +#endif diff --git a/src/game/shared/world/voxel_storage.cc b/src/game/shared/world/voxel_storage.cc index 43ca116..7890894 100644 --- a/src/game/shared/world/voxel_storage.cc +++ b/src/game/shared/world/voxel_storage.cc @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: voxel_storage.cc +// Description: Storage for voxels in a chunk + #include "shared/pch.hh" #include "shared/world/voxel_storage.hh" diff --git a/src/game/shared/world/voxel_storage.hh b/src/game/shared/world/voxel_storage.hh index ef427b3..e3d149a 100644 --- a/src/game/shared/world/voxel_storage.hh +++ b/src/game/shared/world/voxel_storage.hh @@ -1,3 +1,10 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: voxel_storage.hh +// Description: Storage for voxels in a chunk + +#ifndef SHARED_WORLD_VOXEL_STORAGE_HH +#define SHARED_WORLD_VOXEL_STORAGE_HH #pragma once #include "shared/const.hh" @@ -12,3 +19,5 @@ public: void serialize(WriteBuffer& buffer) const; void deserialize(ReadBuffer& buffer); }; + +#endif -- cgit