summaryrefslogtreecommitdiffstats
path: root/game/server
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-06-28 01:59:49 +0500
committeruntodesu <kirill@untode.su>2025-06-28 01:59:49 +0500
commit61e5bcef2629e2d68b805a956a96fff264d4f74d (patch)
treebca3a94bac79d34e3c0db57c77604f5a823ecbda /game/server
parent88c01588aa0830e219eaa62588839e4d1e2883ce (diff)
downloadvoxelius-61e5bcef2629e2d68b805a956a96fff264d4f74d.tar.bz2
voxelius-61e5bcef2629e2d68b805a956a96fff264d4f74d.zip
Restructure dependencies and update to C++20
- Nuked static_assert from almost everywhere in the project - Nuked binary dependency support. Might add one later though - Separated dependency headers into a separate include subdirectory - Grafted a thirdpartylegalnotices.txt generator from RITEG - Pushed development snapshot version to 2126 (26th week of 2025)
Diffstat (limited to 'game/server')
-rw-r--r--game/server/CMakeLists.txt2
-rw-r--r--game/server/main.cc2
-rw-r--r--game/server/overworld.cc8
-rw-r--r--game/server/sessions.cc7
-rw-r--r--game/server/universe.cc10
5 files changed, 13 insertions, 16 deletions
diff --git a/game/server/CMakeLists.txt b/game/server/CMakeLists.txt
index c2b6c06..a9c5cc9 100644
--- a/game/server/CMakeLists.txt
+++ b/game/server/CMakeLists.txt
@@ -24,7 +24,7 @@ add_executable(vserver
"${CMAKE_CURRENT_LIST_DIR}/whitelist.hh"
"${CMAKE_CURRENT_LIST_DIR}/worldgen.cc"
"${CMAKE_CURRENT_LIST_DIR}/worldgen.hh")
-target_compile_features(vserver PUBLIC cxx_std_17)
+target_compile_features(vserver PUBLIC cxx_std_20)
target_include_directories(vserver PUBLIC "${DEPS_INCLUDE_DIR}")
target_include_directories(vserver PRIVATE "${PROJECT_SOURCE_DIR}")
target_include_directories(vserver PRIVATE "${PROJECT_SOURCE_DIR}/game")
diff --git a/game/server/main.cc b/game/server/main.cc
index 42e76f4..734ae6a 100644
--- a/game/server/main.cc
+++ b/game/server/main.cc
@@ -30,7 +30,7 @@ int main(int argc, char** argv)
shared_game::init(argc, argv);
- spdlog::info("Voxelius Server {}", PROJECT_VERSION_STRING);
+ spdlog::info("Voxelius Server {}", project_version_string);
globals::fixed_frametime = 0.0f;
globals::fixed_frametime_avg = 0.0f;
diff --git a/game/server/overworld.cc b/game/server/overworld.cc
index 7021717..a280e06 100644
--- a/game/server/overworld.cc
+++ b/game/server/overworld.cc
@@ -12,7 +12,7 @@
static void compute_tree_feature(unsigned int height, Feature& feature, voxel_id log_voxel, voxel_id leaves_voxel)
{
// Ensure the tree height is too small
- height = cxpr::max<unsigned int>(height, 4U);
+ height = vx::max<unsigned int>(height, 4U);
// Put down a single piece of dirt
feature.push_back({ voxel_pos(0, -1, 0), game_voxels::dirt, true });
@@ -214,14 +214,14 @@ const Overworld_Metadata& Overworld::get_or_create_metadata(const chunk_pos_xz&
}
auto nvdi_value = 0.5f + 0.5f * fnlGetNoise2D(&m_fnl_nvdi, cpos.x, cpos.y);
- auto tree_density = (nvdi_value >= 0.33f) ? cxpr::floor<unsigned int>(nvdi_value * 4.0f) : 0U;
+ auto tree_density = (nvdi_value >= 0.33f) ? vx::floor<unsigned int>(nvdi_value * 4.0f) : 0U;
for(unsigned int i = 0U; i < tree_density; ++i) {
auto lpos = local_pos((twister() % CHUNK_SIZE), (twister() % OW_NUM_TREES), (twister() % CHUNK_SIZE));
auto is_unique = true;
for(const auto& check_lpos : metadata.trees) {
- if(cxvectors::distance2(check_lpos, lpos) <= 9) {
+ if(vx::distance2(check_lpos, lpos) <= 9) {
is_unique = false;
break;
}
@@ -350,7 +350,7 @@ void Overworld::generate_features(const chunk_pos& cpos, VoxelStorage& voxels)
chunk_pos_xz(cpos.x + 1, cpos.z + 1),
};
- for(unsigned int i = 0U; i < cxpr::array_size(tree_chunks); ++i) {
+ for(unsigned int i = 0U; i < vx::array_size(tree_chunks); ++i) {
const auto& cpos_xz = tree_chunks[i];
const auto& metadata = get_or_create_metadata(cpos_xz);
diff --git a/game/server/sessions.cc b/game/server/sessions.cc
index a8745cb..43abbb7 100644
--- a/game/server/sessions.cc
+++ b/game/server/sessions.cc
@@ -115,11 +115,8 @@ static void on_login_request_packet(const protocol::LoginRequest& packet)
dim_info.gravity = globals::spawn_dimension->get_gravity();
protocol::send(packet.peer, protocol::encode(dim_info));
- spdlog::info("sessions: {} [{}] logged in with client_index={} in {}",
- session->client_username,
- session->client_identity,
- session->client_index,
- globals::spawn_dimension->get_name());
+ spdlog::info("sessions: {} [{}] logged in with client_index={} in {}", session->client_username, session->client_identity,
+ session->client_index, globals::spawn_dimension->get_name());
// FIXME: only send entities that are present within the current
// player's view bounding box; this also would mean we're not sending
diff --git a/game/server/universe.cc b/game/server/universe.cc
index e7b8b0f..96884cf 100644
--- a/game/server/universe.cc
+++ b/game/server/universe.cc
@@ -33,7 +33,7 @@ static std::string make_chunk_filename(const DimensionMetadata* metadata, const
const auto unsigned_x = static_cast<std::uint32_t>(cpos.x);
const auto unsigned_y = static_cast<std::uint32_t>(cpos.y);
const auto unsigned_z = static_cast<std::uint32_t>(cpos.z);
- return fmt::format("{}/{:08X}-{:08X}-{:08X}.zvox", metadata->zvox_dir, unsigned_x, unsigned_y, unsigned_z);
+ return std::format("{}/{:08X}-{:08X}-{:08X}.zvox", metadata->zvox_dir, unsigned_x, unsigned_y, unsigned_z);
}
static void add_new_dimension(Dimension* dimension)
@@ -43,7 +43,7 @@ static void add_new_dimension(Dimension* dimension)
std::terminate();
}
- auto dimension_dir = fmt::format("{}/{}", universe_name.get(), dimension->get_name());
+ auto dimension_dir = std::format("{}/{}", universe_name.get(), dimension->get_name());
if(!PHYSFS_mkdir(dimension_dir.c_str())) {
spdlog::critical("universe: {}: {}", dimension_dir, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
@@ -51,8 +51,8 @@ static void add_new_dimension(Dimension* dimension)
}
auto metadata = new DimensionMetadata;
- metadata->config_path = fmt::format("{}/dimension.conf", dimension_dir);
- metadata->zvox_dir = fmt::format("{}/chunk", dimension_dir);
+ metadata->config_path = std::format("{}/dimension.conf", dimension_dir);
+ metadata->zvox_dir = std::format("{}/chunk", dimension_dir);
if(!PHYSFS_mkdir(metadata->zvox_dir.c_str())) {
spdlog::critical("universe: {}: {}", metadata->zvox_dir, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
@@ -107,7 +107,7 @@ void universe::init_late(void)
std::terminate();
}
- universe_config_path = fmt::format("{}/universe.conf", universe_dir);
+ universe_config_path = std::format("{}/universe.conf", universe_dir);
universe_config.load_file(universe_config_path.c_str());
add_new_dimension(new Overworld("world"));