aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
commite4483eca01b48b943cd0461e24a74ae1a3139ed4 (patch)
treeed58c3c246e3af1af337697695d780aa31f6ad9a /src
parent1cc08c51eb4b0f95c30c0a98ad1fc5ad3459b2df (diff)
Update to most recent version (old initial commit)
Diffstat (limited to 'src')
-rw-r--r--src/client/CMakeLists.txt60
-rw-r--r--src/client/client.cc690
-rw-r--r--src/client/client.hh21
-rw-r--r--src/client/draw.hh59
-rw-r--r--src/client/entity/animate.cc158
-rw-r--r--src/client/entity/animate.hh71
-rw-r--r--src/client/entity/entity.cc6
-rw-r--r--src/client/entity/entity.hh27
-rw-r--r--src/client/entity/moveable.cc86
-rw-r--r--src/client/entity/moveable.hh29
-rw-r--r--src/client/entity/player.cc54
-rw-r--r--src/client/entity/player.hh73
-rw-r--r--src/client/item/block.cc91
-rw-r--r--src/client/item/block.hh58
-rw-r--r--src/client/item/item.cc1
-rw-r--r--src/client/item/item.hh30
-rw-r--r--src/client/item/items.cc16
-rw-r--r--src/client/item/items.hh17
-rw-r--r--src/client/main.cc90
-rw-r--r--src/client/main.hh (renamed from src/main.hh)12
-rw-r--r--src/client/movement.hh23
-rw-r--r--src/client/movement/movement.cc (renamed from src/client/movement.cc)95
-rw-r--r--src/client/movement/movement.hh27
-rw-r--r--src/client/player.cc58
-rw-r--r--src/client/player.hh64
-rw-r--r--src/client/render/draw.cc (renamed from src/client/draw.cc)250
-rw-r--r--src/client/render/draw.hh30
-rw-r--r--src/client/render/render.cc147
-rw-r--r--src/client/render/render.hh24
-rw-r--r--src/client/render/struct.cc1
-rw-r--r--src/client/render/struct.hh29
-rw-r--r--src/client/settings.cc36
-rw-r--r--src/client/settings.hh23
-rw-r--r--src/client/shared.cc17
-rw-r--r--src/client/shared.hh24
-rw-r--r--src/client/state/chunks.cc1
-rw-r--r--src/client/state/chunks.hh18
-rw-r--r--src/client/state/entities.cc1
-rw-r--r--src/client/state/entities.hh21
-rw-r--r--src/client/state/state.cc15
-rw-r--r--src/client/state/state.hh41
-rw-r--r--src/client/window.cc449
-rw-r--r--src/client/window/basic_window.cc33
-rw-r--r--src/client/window/basic_window.hh52
-rw-r--r--src/client/window/button_window.cc71
-rw-r--r--src/client/window/button_window.hh40
-rw-r--r--src/client/window/hud_window.cc88
-rw-r--r--src/client/window/hud_window.hh32
-rw-r--r--src/client/window/inventory_window.cc196
-rw-r--r--src/client/window/inventory_window.hh40
-rw-r--r--src/client/window/text_input_window.cc81
-rw-r--r--src/client/window/text_input_window.hh43
-rw-r--r--src/client/window/window.cc318
-rw-r--r--src/client/window/window.hh (renamed from src/client/window.hh)16
-rw-r--r--src/client/world.cc429
-rw-r--r--src/client/world/block.cc117
-rw-r--r--src/client/world/block.hh53
-rw-r--r--src/client/world/chunk.cc255
-rw-r--r--src/client/world/chunk.hh (renamed from src/client/world.hh)44
-rw-r--r--src/client/world/world.datbin0 -> 20480 bytes
-rw-r--r--src/dedicated/CMakeLists.txt60
-rw-r--r--src/dedicated/main.cc39
-rw-r--r--src/dedicated/main.hh16
-rw-r--r--src/main.cc193
-rw-r--r--src/server/CMakeLists.txt50
-rw-r--r--src/server/chunk_data.hh6
-rw-r--r--src/server/client.cc14
-rw-r--r--src/server/client.hh15
-rw-r--r--src/server/database.cc77
-rw-r--r--src/server/database.hh2
-rw-r--r--src/server/init.cc45
-rw-r--r--src/server/init.hh15
-rw-r--r--src/server/movement.cc87
-rw-r--r--src/server/movement/movement.cc98
-rw-r--r--src/server/movement/movement.hh (renamed from src/server/movement.hh)8
-rw-r--r--src/server/resources.cc1
-rw-r--r--src/server/resources.hh5
-rw-r--r--src/server/server.cc470
-rw-r--r--src/server/server.hh6
-rw-r--r--src/server/shared.hh2
-rw-r--r--src/server/world.cc53
-rw-r--r--src/server/world.hh59
-rw-r--r--src/server/world/chunk.cc26
-rw-r--r--src/server/world/chunk.hh46
-rw-r--r--src/shared/CMakeLists.txt55
-rw-r--r--src/shared/entity/animate.cc5
-rw-r--r--src/shared/entity/animate.hh89
-rw-r--r--src/shared/entity/entity.cc1
-rw-r--r--src/shared/entity/entity.hh69
-rw-r--r--src/shared/entity/moveable.cc3
-rw-r--r--src/shared/entity/moveable.hh17
-rw-r--r--src/shared/entity/player.cc1
-rw-r--r--src/shared/entity/player.hh63
-rw-r--r--src/shared/init.cc182
-rw-r--r--src/shared/init.hh38
-rw-r--r--src/shared/item/block.cc16
-rw-r--r--src/shared/item/block.hh41
-rw-r--r--src/shared/item/item.cc14
-rw-r--r--src/shared/item/item.hh49
-rw-r--r--src/shared/item/items.cc164
-rw-r--r--src/shared/item/items.hh54
-rw-r--r--src/shared/math.cc23
-rw-r--r--src/shared/math.hh53
-rw-r--r--src/shared/math/angles.cc57
-rw-r--r--src/shared/math/angles.hh44
-rw-r--r--src/shared/math/coords.cc30
-rw-r--r--src/shared/math/coords.hh31
-rw-r--r--src/shared/math/math.cc5
-rw-r--r--src/shared/math/math.hh22
-rw-r--r--src/shared/movement.cc490
-rw-r--r--src/shared/movement.hh67
-rw-r--r--src/shared/movement/movement.cc580
-rw-r--r--src/shared/movement/movement.hh75
-rw-r--r--src/shared/movement/struct.cc1
-rw-r--r--src/shared/movement/struct.hh20
-rw-r--r--src/shared/net/connection.cc219
-rw-r--r--src/shared/net/connection.hh211
-rw-r--r--src/shared/net/lib/protobuf/net.pb.cc5482
-rw-r--r--src/shared/net/lib/protobuf/net.pb.h4434
-rw-r--r--src/shared/net/lib/protobuf/net.proto68
-rw-r--r--src/shared/net/packet.cc29
-rw-r--r--src/shared/net/packet.hh42
-rw-r--r--src/shared/net/proto.cc64
-rw-r--r--src/shared/net/proto.hh22
-rw-r--r--src/shared/player.cc1
-rw-r--r--src/shared/player.hh46
-rw-r--r--src/shared/shared.cc33
-rw-r--r--src/shared/shared.hh123
-rw-r--r--src/shared/world.hh224
-rw-r--r--src/shared/world/block.cc85
-rw-r--r--src/shared/world/block.hh54
-rw-r--r--src/shared/world/chunk.cc (renamed from src/shared/world.cc)441
-rw-r--r--src/shared/world/chunk.hh89
133 files changed, 14208 insertions, 6162 deletions
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
new file mode 100644
index 0000000..e6994ab
--- /dev/null
+++ b/src/client/CMakeLists.txt
@@ -0,0 +1,60 @@
+cmake_minimum_required(VERSION 3.18)
+
+project(blockgame_linux)
+
+file (GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
+ "*.cc"
+)
+file (GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS
+ "*.hh"
+ "../server/*.hh"
+ "../shared/*.hh"
+)
+add_executable(${PROJECT_NAME}
+ ${SOURCE_FILES}
+)
+
+find_library(LIB_SDL2 sdl2 SDL2 REQUIRED)
+find_library(LIB_EPOXY epoxy epoxy EPOXY libepoxy REQUIRED)
+find_library(LIB_SQLITE3 sqlite3 SQLITE3 REQUIRED)
+find_library(LIB_FREETYPE freetype libfreetype REQUIRED)
+find_library(LIB_ASSIMP assimp libassimp REQUIRED)
+find_library(LIB_PROTOBUF protobuf libprotobuf REQUIRED)
+find_package(Boost COMPONENTS iostreams REQUIRED)
+find_package(Threads REQUIRED)
+find_package(Backtrace REQUIRED)
+find_package(Freetype REQUIRED)
+
+target_compile_options(${PROJECT_NAME} PRIVATE
+ -Wall -Wextra -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common
+ -Wconversion -Wpedantic -std=c++20 -O2
+ -Wno-exceptions
+ -Wno-missing-field-initializers -Wno-unknown-pragmas
+)
+target_compile_options(${PROJECT_NAME} PRIVATE
+ -fstack-protector-strong -fno-omit-frame-pointer #-fsanitize=undefined -fsanitize-trap=undefined
+)
+target_link_options(${PROJECT_NAME} PRIVATE
+ -fstack-protector-strong #-fsanitize=undefined -fsanitize-trap=undefined
+)
+target_include_directories(${PROJECT_NAME} PRIVATE
+ "../../src"
+ ${FREETYPE_INCLUDE_DIRS}
+)
+target_link_libraries(${PROJECT_NAME} PRIVATE
+ ${LIB_SDL2}
+ ${LIB_EPOXY}
+ ${LIB_FREETYPE}
+ ${LIB_ASSIMP}
+ ${LIB_PROTOBUF}
+ ${LIB_SQLITE3}
+ ${Backtrace_LIBRARIES}
+ ${Threads_LIBRARIES}
+ ${Boost_LIBRARIES}
+ ${FREETYPE_LIBRARIES}
+ shared
+ server
+)
+target_precompile_headers(${PROJECT_NAME} PRIVATE
+ ${HEADER_FILES}
+)
diff --git a/src/client/client.cc b/src/client/client.cc
index b4cacdc..28b3163 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -1,29 +1,29 @@
#include "client.hh"
namespace {
-bool should_send_move = false; // Ratelimit move packets by player packets.
+std::queue<proto::chunk> received_chunks;
-shared::world::block last_block = shared::world::block::type::dirt;
-
-client::world::chunk::map chunks{4096, shared::world::chunk::hash,
- shared::world::chunk::equal};
-
-client::players players;
} // namespace
namespace client {
-static auto get_player_it(const std::uint32_t index) {
- return std::ranges::find_if(
- ::players, [&](const auto& player) { return player.index == index; });
+static shared::net::connection make_connection(const std::string_view address,
+ const std::string_view port) {
+ constexpr addrinfo hints = {.ai_flags = AI_PASSIVE,
+ .ai_family = AF_INET,
+ .ai_socktype = SOCK_STREAM};
+ const auto info = shared::net::get_addr_info(address, port, &hints);
+ const auto sock = shared::net::make_socket(info.get());
+ shared::net::connect_socket(sock, info.get());
+ return shared::net::connection(sock);
}
static proto::packet
-make_get_chunk_packet(const shared::math::coords& coords) noexcept {
+make_request_chunk_packet(const shared::math::coords& coords) noexcept {
proto::packet packet;
const auto chunk_packet = packet.mutable_request_chunk_packet();
- shared::net::set_coords(*chunk_packet->mutable_chunk_pos(), coords);
+ shared::net::set_coords(chunk_packet->mutable_chunk_pos(), coords);
return packet;
}
@@ -39,14 +39,16 @@ static proto::packet make_auth_packet(const std::string& username,
return packet;
}
-static proto::packet make_add_block_packet(const shared::math::coords& coords,
- const glm::ivec3& pos) noexcept {
+static proto::packet
+make_add_block_packet(const shared::math::coords& coords, const glm::ivec3& pos,
+ const std::uint32_t& active) noexcept {
proto::packet packet;
- const auto interact_packet = packet.mutable_add_block_packet();
- shared::net::set_coords(*interact_packet->mutable_chunk_pos(), coords);
- shared::net::set_ivec3(*interact_packet->mutable_block_pos(), pos);
- interact_packet->set_block(static_cast<std::uint32_t>(::last_block.type));
+ const auto add_block_packet = packet.mutable_add_block_packet();
+ shared::net::set_coords(add_block_packet->mutable_chunk_pos(), coords);
+ shared::net::set_ivec3(add_block_packet->mutable_block_pos(), pos);
+
+ add_block_packet->set_active_item(active);
return packet;
}
@@ -56,9 +58,9 @@ make_remove_block_packet(const shared::math::coords& coords,
const glm::ivec3& pos) noexcept {
proto::packet packet;
- const auto interact_packet = packet.mutable_remove_block_packet();
- shared::net::set_coords(*interact_packet->mutable_chunk_pos(), coords);
- shared::net::set_ivec3(*interact_packet->mutable_block_pos(), pos);
+ const auto remove_block_packet = packet.mutable_remove_block_packet();
+ shared::net::set_coords(remove_block_packet->mutable_chunk_pos(), coords);
+ shared::net::set_ivec3(remove_block_packet->mutable_block_pos(), pos);
return packet;
}
@@ -69,93 +71,113 @@ make_remove_chunk_packet(const shared::math::coords& coords) noexcept {
proto::packet packet;
const auto remove_chunk_packet = packet.mutable_remove_chunk_packet();
- shared::net::set_coords(*remove_chunk_packet->mutable_chunk_pos(), coords);
+ shared::net::set_coords(remove_chunk_packet->mutable_chunk_pos(), coords);
+
+ return packet;
+}
+
+static proto::packet
+make_move_packet(const client::moveable& localplayer) noexcept {
+ proto::packet packet;
+
+ const auto move_packet = packet.mutable_move_packet();
+ move_packet->set_commands(localplayer.get_commands());
+ shared::net::set_angles(move_packet->mutable_viewangles(),
+ localplayer.get_angles());
+ move_packet->set_active_item(localplayer.get_active_item());
+ move_packet->set_sequence(localplayer.get_latest_sequence());
return packet;
}
static void handle_init_packet(const proto::init& packet) noexcept {
- client::state.seed = packet.seed();
- client::state.draw_distance =
- std::min(packet.draw_distance(),
- client::settings::get({"video", "draw_distance"}, 32));
- auto& localplayer = packet.localplayer();
- client::state.localplayer = localplayer.index();
+ // Draw distance is the std::min, but we make it more verbose.
+ if (const auto& wanted = state::draw_distance =
+ settings::get({"video", "draw_distance"}, 32);
+ wanted != packet.draw_distance()) {
+
+ if (wanted < packet.draw_distance()) {
+ state::draw_distance = wanted;
+ } else {
+ shared::print::warn << shared::print::time
+ << "client: server supported draw_distance ("
+ << packet.draw_distance()
+ << ") less than requested (" << wanted << ")\n";
+ state::draw_distance = packet.draw_distance();
+ }
+ }
+
+ state::seed = packet.seed();
+ state::tickrate = packet.tickrate();
+ state::tick = packet.tick();
+ state::delta_ticks = 0.0f; // amount of time passed (in ticks)
- ::players.emplace_back(shared::net::get_player(localplayer));
+ const auto& localplayer = packet.localplayer();
+ const auto& index = localplayer.animate().entity().index();
+
+ state::localplayer_index = index;
+ state::entities.emplace(index, std::make_unique<player>(localplayer));
}
-static void handle_player_packet(const proto::player& packet) noexcept {
- if (std::size(::players) <= 0) {
+static void
+handle_animate_update_packet(const proto::animate_update& packet) noexcept {
+ const auto& animate = packet.animate();
+ const auto& index = animate.entity().index();
+
+ const auto entity_it = get_entity_it(index);
+ if (entity_it == std::end(state::entities)) {
+ state::entities.emplace(index, std::make_unique<player>(animate));
return;
}
- const auto player_it = get_player_it(packet.index());
+ const auto animate_ptr = dynamic_cast<class animate*>(&*entity_it->second);
+ if (animate_ptr == nullptr) {
+ return;
+ }
- shared::player player = shared::net::get_player(packet);
+ const shared::tick_t tick = packet.tick();
- if (player_it == std::end(::players)) {
- ::players.emplace_back(player);
+ // Localplayer updates time factor and is update is called with the sequence
+ // number instead of the tick.
+ if (packet.has_sequence()) {
+ const shared::tick_t sequence = packet.sequence();
+ animate_ptr->update_time_factor(sequence, tick);
+ animate_ptr->notify(animate, sequence, true);
return;
}
- // If the player packet refers to us, we do not override our localplayer's
- // commands or viewangles. Also, we should send a new move packet.
- if (auto& lp = get_localplayer(::players); lp.index == packet.index()) {
- player.viewangles = lp.viewangles;
- player.commands = 0u;
- ::should_send_move = true;
- }
- player_it->update(player);
+ animate_ptr->notify(animate, tick, true);
}
// Remove the client whose element is equal to pkt.index.
-static void handle_remove_packet(const proto::remove_player& packet) noexcept {
- const auto player_it = get_player_it(packet.index());
- if (player_it == std::end(::players)) {
+static void
+handle_remove_entity_packet(const proto::remove_entity& packet) noexcept {
+ const auto entity_it = get_entity_it(packet.index());
+ if (entity_it == std::end(state::entities)) {
return;
}
- ::players.erase(player_it);
+
+ state::entities.erase(entity_it);
}
static void handle_hear_packet(const proto::hear_player& packet) noexcept {
- const auto player_it = get_player_it(packet.index());
- if (player_it == std::end(::players)) {
+ const auto entity_it = get_entity_it(packet.index());
+ if (entity_it == std::end(state::entities)) {
return;
}
- player_it->message.emplace(packet.text());
-}
-static void handle_chunk_packet(const proto::chunk& packet) noexcept {
- const shared::math::coords pos{.x = packet.chunk_pos().x(),
- .z = packet.chunk_pos().z()};
- const auto find_it = ::chunks.find(pos);
- if (find_it == std::end(::chunks)) {
+ const auto player_ptr = dynamic_cast<player*>(&*entity_it->second);
+ if (player_ptr == nullptr) {
return;
}
- find_it->second.emplace(
- client::state.seed, pos,
- shared::world::chunk::make_blocks_from_chunk(packet));
- // Force the surrounding chunks to regenerate their vbos.
- // It's possible we could only generate the ones that we actually need to
- // generate, but that's not really a priority atm.
- for (auto x = -1; x <= 1; ++x) {
- for (auto z = -1; z <= 1; ++z) {
- if (std::abs(x) == 1 && std::abs(z) == 1) {
- continue;
- }
- const auto find_update_it =
- ::chunks.find(pos + shared::math::coords{x, z});
- if (find_update_it == std::end(::chunks)) {
- continue;
- }
- if (!find_update_it->second.has_value()) {
- continue;
- }
- find_update_it->second->should_regenerate_vbo = true;
- }
- }
+
+ player_ptr->message.emplace(packet.text());
+}
+
+static void handle_chunk_packet(proto::chunk& packet) noexcept {
+ // Ratelimited parsing, moved into a vector.
+ ::received_chunks.push(std::move(packet));
}
static void
@@ -165,81 +187,111 @@ handle_server_message_packet(const proto::server_message& packet) noexcept {
"client: received " + std::string{fatal ? "fatal" : ""} +
" message from the server \"" + packet.message() + "\"\n";
if (!fatal) {
- shared::print::notify(message);
+ shared::print::notify << shared::print::time << message;
return;
}
- shared::print::warn(message);
+ shared::print::warn << shared::print::time << message;
shared::should_exit = true;
}
-static void parse_packet(const proto::packet& packet) noexcept {
-
+static void parse_packet(proto::packet&& packet) noexcept {
if (packet.has_init_packet()) {
handle_init_packet(packet.init_packet());
- } else if (packet.has_player_packet()) {
- handle_player_packet(packet.player_packet());
- } else if (packet.has_remove_player_packet()) {
- handle_remove_packet(packet.remove_player_packet());
+ } else if (packet.has_animate_update_packet()) {
+ handle_animate_update_packet(packet.animate_update_packet());
+ } else if (packet.has_remove_entity_packet()) {
+ handle_remove_entity_packet(packet.remove_entity_packet());
} else if (packet.has_hear_player_packet()) {
handle_hear_packet(packet.hear_player_packet());
} else if (packet.has_chunk_packet()) {
- handle_chunk_packet(packet.chunk_packet());
+ handle_chunk_packet(*packet.mutable_chunk_packet());
} else if (packet.has_server_message_packet()) {
handle_server_message_packet(packet.server_message_packet());
}
#ifndef NDEBUG
else {
- shared::print::warn("client: unhandled packet type\n");
+ shared::print::warn << shared::print::time
+ << "client: unhandled packet type\n";
}
#endif
}
-static shared::net::connection make_connection(const std::string_view address,
- const std::string_view port) {
- constexpr addrinfo hints = {.ai_flags = AI_PASSIVE,
- .ai_family = AF_INET,
- .ai_socktype = SOCK_STREAM};
- const auto info = shared::net::get_addr_info(address, port, &hints);
- const auto sock = shared::net::make_socket(info.get());
- shared::net::connect_socket(sock, info.get());
- return shared::net::connection(sock);
+static void regenerate_surrounding_chunks(const shared::math::coords& pos) {
+ // Force the surrounding chunks to regenerate their vbos.
+ // It's possible we could only generate the ones that we actually need
+ // to generate, but that's not really a priority atm.
+ for (auto x = -1; x <= 1; ++x) {
+ for (auto z = -1; z <= 1; ++z) {
+ if (std::abs(x) == 1 && std::abs(z) == 1) {
+ continue;
+ }
+ const auto find_update_it =
+ state::chunks.find(pos + shared::math::coords{x, z});
+ if (find_update_it == std::end(state::chunks)) {
+ continue;
+ }
+ if (!find_update_it->second.has_value()) {
+ continue;
+ }
+ find_update_it->second->should_regenerate_vbo = true;
+ }
+ }
}
-static void update_chunks(shared::net::connection& connection) noexcept {
+static void parse_new_chunks() {
+ // Add new chunks. We have to ratelimit these because the server responds
+ // so quickly that our frametime dives as it parses these new chunk packets.
+ constexpr int CHUNKS_PER_FRAME = 1;
+ for (int i = 0; i < CHUNKS_PER_FRAME && !::received_chunks.empty();
+ ++i, ::received_chunks.pop()) {
- const auto draw_distance = client::state.draw_distance;
- const shared::math::coords& lp_pos = get_localplayer(::players).chunk_pos;
+ const proto::chunk& packet = ::received_chunks.front();
+ const shared::math::coords pos{packet.chunk_pos().x(),
+ packet.chunk_pos().z()};
- // Remove bad chunks.
- std::erase_if(::chunks, [&](const auto& chunk) {
- const bool should_erase =
- !shared::math::is_inside_draw(chunk.first, lp_pos, draw_distance);
+ const auto find_it = state::chunks.find(pos);
+ if (find_it == std::end(state::chunks)) {
+ continue;
+ }
+ find_it->second.emplace(state::seed, packet);
+ regenerate_surrounding_chunks(pos);
+ }
+}
+
+static void erase_bad_chunks(const shared::math::coords& lp_pos) {
+ const auto draw_distance = state::draw_distance;
+ std::erase_if(state::chunks, [&](const auto& chunk) {
+ const bool should_erase = !shared::math::coords::is_inside_draw(
+ chunk.first, lp_pos, draw_distance);
if (should_erase) {
- connection.rsend_packet(make_remove_chunk_packet(chunk.first));
+ state::connection->rsend_packet(
+ make_remove_chunk_packet(chunk.first));
}
return should_erase;
});
+}
- for (int dist = 0; dist <= client::state.draw_distance; ++dist) {
+static void request_new_chunks(const shared::math::coords& lp_pos) {
+ for (int dist = 0; dist <= state::draw_distance; ++dist) {
+ const auto draw_distance = state::draw_distance;
const auto maybe_add_chunk = [&](const int x, const int z) -> bool {
const auto pos = shared::math::coords{x + lp_pos.x, z + lp_pos.z};
- if (!is_inside_draw(pos, lp_pos, draw_distance)) {
+ if (!shared::math::coords::is_inside_draw(pos, lp_pos,
+ draw_distance)) {
return false;
}
- if (::chunks.contains(pos)) {
+ if (state::chunks.contains(pos)) {
return false;
}
- connection.rsend_packet(make_get_chunk_packet(pos));
- ::chunks.emplace(pos, std::nullopt);
+ state::connection->rsend_packet(make_request_chunk_packet(pos));
+ state::chunks.emplace(pos, std::nullopt);
return true;
};
int x = -dist;
int z = dist;
-
- // Does a spiral pattern, but it's basically unnoticable :(
for (int i = 0; i < dist * 2 + 1; ++i) {
if (maybe_add_chunk(x, z)) {
return;
@@ -267,125 +319,162 @@ static void update_chunks(shared::net::connection& connection) noexcept {
}
}
-static void update_state() noexcept {
- client::state.player_count = ::players.size();
- client::state.requested_chunk_count =
- static_cast<std::uint32_t>(std::ranges::count_if(
- ::chunks, [](const auto& c) { return !c.second.has_value(); }));
- client::state.networked_chunk_count =
- std::size(::chunks) - client::state.requested_chunk_count;
-}
-
-static proto::packet make_say_packet(const std::string& text) noexcept {
- proto::packet packet;
-
- const auto sub_say_packet = packet.mutable_say_packet();
- sub_say_packet->set_text(text);
+static void update_chunks() {
+ parse_new_chunks();
- return packet;
-}
-
-// unfortunate non-static :(
-void send_say_packet(const std::string& text) noexcept {
- client::state.connection->rsend_packet(make_say_packet(text));
+ const shared::math::coords& lp_pos = get_localplayer().get_chunk_pos();
+ erase_bad_chunks(lp_pos);
+ request_new_chunks(lp_pos);
}
static void handle_button_input() noexcept {
- if (input::is_key_pressed(SDLK_z)) {
- client::render::camera::get_xfov() = 30.0f;
- } else {
- client::render::camera::get_xfov() =
- client::settings::get({"gameplay", "fov"}, 100.0f);
- }
// Don't build our movement commands if we're inputting text.
if (input::state.typing) {
return;
}
- auto& lp = get_localplayer(::players);
-
using spm = shared::player::mask;
- lp.commands |= spm::forward * input::is_key_pressed(SDLK_w);
- lp.commands |= spm::left * input::is_key_pressed(SDLK_a);
- lp.commands |= spm::backward * input::is_key_pressed(SDLK_s);
- lp.commands |= spm::right * input::is_key_pressed(SDLK_d);
- lp.commands |= spm::jump * input::is_key_pressed(SDLK_SPACE);
- lp.commands |= spm::crouch * input::is_key_pressed(SDLK_LCTRL);
- lp.commands |= spm::sprint * input::is_key_pressed(SDLK_LSHIFT);
- lp.commands |= spm::attack * input::is_key_pressed(SDL_BUTTON_LEFT);
+ auto& commands = get_localplayer().get_mutable_commands();
+ commands |= spm::forward * input::is_key_pressed(SDLK_w);
+ commands |= spm::left * input::is_key_pressed(SDLK_a);
+ commands |= spm::backward * input::is_key_pressed(SDLK_s);
+ commands |= spm::right * input::is_key_pressed(SDLK_d);
+ commands |= spm::jump * input::is_key_pressed(SDLK_SPACE);
+ commands |= spm::crouch * input::is_key_pressed(SDLK_LCTRL);
+ commands |= spm::sprint * input::is_key_pressed(SDLK_LSHIFT);
+ commands |= spm::attack * input::is_key_pressed(SDL_BUTTON_LEFT);
}
static void update_input() noexcept {
- client::input::update();
+ input::update();
+
+ if (input::is_key_pressed(SDLK_z)) {
+ render::camera::get_xfov() = 30.0f;
+ } else {
+ render::camera::get_xfov() = settings::get({"gameplay", "fov"}, 100.0f);
+ }
- if (!client::window::is_open()) {
+ if (!window::is_open()) {
handle_button_input();
}
- if (client::input::state.quit) {
+ if (input::state.quit) {
shared::should_exit = true;
}
}
-static proto::packet
-make_move_packet(const shared::player& localplayer) noexcept {
- proto::packet packet;
+static void update_delta_ticks() noexcept {
+ static shared::time_point_t last = std::chrono::steady_clock::now();
- const auto move_packet = packet.mutable_move_packet();
- move_packet->set_commands(localplayer.commands);
- shared::net::set_angles(*move_packet->mutable_viewangles(),
- localplayer.viewangles);
+ const auto now = std::chrono::steady_clock::now();
+ const auto delta_ticks =
+ shared::get_duration_seconds(now - last) /
+ shared::get_duration_seconds(state::get_time_per_tick());
- return packet;
+ state::delta_ticks += state::time_factor * delta_ticks;
+
+ last = now;
}
-static void send_move_packet(shared::net::connection& connection) noexcept {
- const auto& localplayer = get_localplayer(::players);
- connection.usend_packet(make_move_packet(localplayer));
+static void update_pre_move() {
+ state::player_count = state::entities.size();
+ state::requested_chunk_count = static_cast<std::uint32_t>(
+ std::ranges::count_if(state::chunks, [](const auto& c) {
+ return !c.second.has_value();
+ }));
+ state::networked_chunk_count =
+ std::size(state::chunks) - state::requested_chunk_count;
+ update_delta_ticks();
+ update_input();
+ update_chunks();
}
-static void update_players() noexcept {
- const auto lp_index = get_localplayer(::players).index;
+static void interp_entities() {
+ for (auto& [index, entity] : state::entities) {
+ const auto animate_ptr = dynamic_cast<animate*>(&*entity);
+ if (animate_ptr == nullptr) {
+ continue;
+ }
+ animate_ptr->interpolate();
+ }
+}
+
+static void remove_bad_entities() {
+ const auto lp_index = *state::localplayer_index;
// pvs, remove clients outside of chunks we own
- std::erase_if(::players, [&](const auto& player) {
- if (player.index == lp_index) {
+ std::erase_if(state::entities, [&](const auto& pair) {
+ const auto& [idx, entity] = pair;
+
+ const auto player_ptr = dynamic_cast<const player*>(&*entity);
+ if (player_ptr == nullptr) {
+ return false;
+ }
+
+ if (player_ptr->get_index() == lp_index) {
return false;
}
// Players should be removed if the chunk can't draw.
- const auto chunk_it = ::chunks.find(player.chunk_pos);
- if (chunk_it == std::end(::chunks)) {
+ const auto chunk_it = state::chunks.find(player_ptr->get_chunk_pos());
+ if (chunk_it == std::end(state::chunks)) {
return true;
}
const auto& chunk = chunk_it->second;
- if (!chunk.has_value()) {
- return false;
- }
-
- if (!chunk->can_draw()) {
+ if (chunk.has_value() && !chunk->can_draw()) {
return true;
}
return false;
});
}
+static void update_entities() noexcept {
+ interp_entities();
+ remove_bad_entities();
+}
+
+static void update_post_move() { update_entities(); }
+
+static void maybe_send_move() noexcept {
+
+ // An unknown amount of time has passed since we last rendered and this may
+ // be more than one tick. We do nothing if it's less than one tick.
+ const auto num_ticks_passed = static_cast<unsigned>(state::delta_ticks);
+
+ if (num_ticks_passed <= 0) {
+ return;
+ }
+
+ // Extrapolate for the number of ticks passed.
+ auto& localplayer = get_localplayer();
+ for (auto i = 0u; i < num_ticks_passed; ++i) {
+ ++state::tick; // possibly after?
+ state::delta_ticks -= 1.0f;
+ localplayer.extrapolate();
+ ++localplayer.get_mutable_latest_sequence();
+ state::connection->usend_packet(make_move_packet(localplayer));
+ }
+
+ // reset all commands except for flying, more later probably
+ const auto retained = shared::animate::flying;
+ localplayer.get_mutable_commands() &= retained;
+}
+
// requires SDL_MOUSEMOTION
static void handle_mousemotion(const SDL_Event& event) noexcept {
const float sens =
settings::get<float>({"gameplay", "mouse_sensitivity"}, 0.0235f);
- auto& lp = get_localplayer(::players);
- auto& angles = lp.viewangles;
+ auto& lp = get_localplayer();
+ auto& angles = lp.get_mutable_angles();
const float pitch_offset = static_cast<float>(event.motion.yrel) * sens;
const float yaw_offset = static_cast<float>(event.motion.xrel) * sens;
- angles.pitch = std::clamp(angles.pitch - glm::radians(pitch_offset),
- glm::radians(-89.0f), glm::radians(89.0f));
- angles.yaw =
- std::fmod(angles.yaw + glm::radians(yaw_offset), glm::radians(360.0f)) +
- (angles.yaw < 0.0f) * glm::radians(360.0f);
+ angles.pitch -= glm::radians(pitch_offset);
+ angles.yaw += glm::radians(yaw_offset);
+ angles.normalise();
+ angles.clamp();
}
// requires SDL_MOUSEBUTTONDOWN
@@ -395,37 +484,93 @@ static void handle_mousebuttons(const SDL_Event& event) noexcept {
return;
}
+ auto& lp = get_localplayer();
const auto mode = event.button.button == SDL_BUTTON_LEFT
- ? client::movement::interact_mode::remove
- : client::movement::interact_mode::add;
-
- const auto position =
- client::movement::interact(get_localplayer(::players), mode, ::chunks);
-
+ ? movement::interact_mode::remove
+ : movement::interact_mode::add;
+ const auto position = movement::interact(lp, mode, state::chunks);
if (!position.has_value()) {
return;
}
const auto& [chunk_pos, block_pos] = *position;
+ auto& block = state::chunks.find(chunk_pos)->second->get_block(block_pos);
+
+ if (mode == movement::interact_mode::remove) {
+ lp.inventory.maybe_add(shared::item::block::get_type(block.type), 1,
+ client::item::make_item);
+ block.type = shared::world::block::type::air;
+
+ state::connection->rsend_packet(
+ make_remove_block_packet(chunk_pos, block_pos));
+ } else {
+ // Adding is more complicated, needs the active item.
+ const auto& active = lp.get_active_item();
+ auto& item = lp.inventory.contents[active];
+ if (item == nullptr) {
+ return;
+ }
+
+ const auto block_ptr = dynamic_cast<const shared::item::block*>(&*item);
+ if (block_ptr == nullptr) {
+ return;
+ }
+ lp.inventory.decrement(active);
+ block.type = block_ptr->type;
+
+ state::connection->rsend_packet(
+ make_add_block_packet(chunk_pos, block_pos, active));
+ }
+
+ regenerate_surrounding_chunks(chunk_pos);
+}
- auto& connection = *client::state.connection;
- switch (mode) {
- case client::movement::interact_mode::add:
- connection.usend_packet(make_add_block_packet(chunk_pos, block_pos));
+static void handle_space(const SDL_Event& event) noexcept {
+ if (event.type == SDL_KEYUP) {
+ return;
+ }
+ auto& commands = get_localplayer().get_mutable_commands();
+ commands |= shared::animate::mask::jump;
+
+ if (event.key.repeat) {
+ return;
+ }
+ constexpr auto JUMP_FLY_DELAY = std::chrono::milliseconds(250);
+
+ static std::optional<shared::time_point_t> prev = std::nullopt;
+ const auto now = std::chrono::steady_clock::now();
+ if (prev.has_value() && now < *prev + JUMP_FLY_DELAY) {
+ commands ^= shared::animate::mask::flying;
+ prev.reset();
+ return;
+ }
+
+ prev.emplace(now);
+}
+
+static void handle_keys(const SDL_Event& event) noexcept {
+ switch (event.key.keysym.sym) {
+ case SDLK_SPACE:
+ handle_space(event);
break;
- case client::movement::interact_mode::remove:
- connection.usend_packet(make_remove_block_packet(chunk_pos, block_pos));
- ::last_block = ::chunks[chunk_pos]->get_block(block_pos);
+ default:
break;
}
}
static void handle_events(const SDL_Event& event) noexcept {
- if (client::window::is_open()) {
+ if (window::is_open()) {
+ return;
+ }
+ if (!state::localplayer_index.has_value()) {
return;
}
switch (event.type) {
+ case SDL_KEYDOWN:
+ case SDL_KEYUP:
+ handle_keys(event);
+ break;
case SDL_MOUSEBUTTONDOWN:
handle_mousebuttons(event);
break;
@@ -437,79 +582,124 @@ static void handle_events(const SDL_Event& event) noexcept {
}
}
-static void authenticate_client(shared::net::connection& connection) noexcept {
- const auto rand_alphanum_string = [](const int size) -> std::string {
- static const std::string allowed = "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "1234567890";
- std::string ret;
- for (int i = 0; i < size; ++i) {
- std::ranges::sample(allowed, std::back_inserter(ret), 1,
- std::random_device{});
- }
+static std::string get_username() {
+ const settings::setting_pair_t loc = {"gameplay", "username"};
+ if (const auto username = settings::maybe_get_setting_str(loc);
+ username.has_value()) {
+ return *username;
+ }
- return ret;
- };
+ shared::print::notify << shared::print::time
+ << "first launch detected, username required\n";
+ std::string ret;
+ while (ret.empty() || !std::ranges::all_of(ret, isalnum)) {
+ std::cin.clear();
+ std::cout << "enter a valid username: ";
+ std::getline(std::cin, ret);
+ }
+ settings::set_setting_str(loc, ret);
+ return ret;
+}
- const std::string username = settings::get<std::string>(
- {"auth", "username"},
- rand_alphanum_string(shared::MAX_USER_PASS_LENGTH));
- const std::string password = settings::get<std::string>(
- {"auth", "password"},
- rand_alphanum_string(shared::MAX_USER_PASS_LENGTH));
+static std::string get_password(const std::string_view& address) {
+ const settings::setting_pair_t loc = {
+ "auth", std::string{address == "0.0.0.0" ? "localhost" : address}};
+ if (const auto password = settings::maybe_get_setting_str(loc);
+ password.has_value()) {
+ return *password;
+ }
- connection.rsend_packet(make_auth_packet(username, password));
+ // We generate a random string as our password. Our password has decent
+ // complexitity but considering we don't use any encryption it is worthless
+ // to any real attacker and just basic authentication.
+ std::string ret;
+ std::random_device rand{};
+ std::uniform_int_distribution<char> uniform{'a', 'z'};
+ for (int i = 0; i < 256; ++i) {
+ const char random_char = uniform(rand);
+ ret.push_back(random_char);
+ }
+ settings::set_setting_str(loc, ret);
+ return ret;
}
-void main(const std::string_view address, const std::string_view port) {
- client::state.address = address;
- client::state.port = port;
+static void send_auth_packet(const std::string_view& address,
+ shared::net::connection& connection) {
+ const std::string username = get_username();
+ const std::string password = get_password(address);
- shared::net::connection connection = make_connection(address, port);
- shared::print::notify("client: connected to " + std::string{address} + ':' +
- std::string{port} + '\n');
- client::state.connection = &connection;
+ connection.rsend_packet(make_auth_packet(username, password));
+}
+
+static bool should_do_loop(shared::net::connection& connection) noexcept {
+ if (shared::should_exit) {
+ return false;
+ }
- client::render::init();
- client::input::register_event_handler(&handle_events);
+ if (!connection.good()) {
+ shared::print::notify << shared::print::time
+ << "client: disconnected for \""
+ << connection.get_bad_reason() << "\"\n";
+ shared::should_exit = true; // cleanup server if necessary
+ return false;
+ }
- authenticate_client(connection);
+ return true;
+}
- while (!shared::should_exit) {
- // Parse all new packets.
- while (const auto packet = connection.recv_packet()) {
- parse_packet(packet.value());
+static void do_client_loop(shared::net::connection& connection) {
+ while (should_do_loop(connection)) {
+ connection.poll();
+ while (auto packet = connection.recv_packet()) {
+ parse_packet(std::move(*packet));
}
- // Wait for localplayer to be constructed before doing anything.
- if (::players.empty()) {
+ if (!state::has_initialised()) {
continue;
}
- // Handle input, which may prime text input -> send it to the
- // server.
- update_input();
- // Send our localplayer to the server.
- if (::should_send_move) {
- send_move_packet(connection);
- ::should_send_move = false;
- }
- update_chunks(connection);
- update_state();
- update_players();
-
- client::draw::draw(::players, ::chunks);
+ update_pre_move();
+ maybe_send_move();
+ update_post_move();
- if (!connection.good()) {
- shared::print::notify("client: disconnected for \"" +
- connection.get_bad_reason() + "\"\n");
- shared::should_exit = true;
- }
+ render::draw(state::entities, state::chunks);
}
- shared::print::notify("client: disconnecting from server\n");
+}
+
+static void init_client(const std::string_view& address,
+ const std::string_view& port,
+ shared::net::connection& connection) {
+ // Setup client state, some vars should be cleaned up later (raii lol).
+ state::address = address;
+ state::port = port;
+ state::connection = &connection;
+
+ input::register_event_handler(&handle_events);
+ send_auth_packet(address, connection);
+
+ render::init();
+}
+
+static void cleanup_client() {
+ state::connection = nullptr;
+ state::localplayer_index.reset();
+ state::chunks.clear();
+ state::entities.clear();
+ render::quit();
+ settings::save();
+}
+
+void main(const std::string_view address, const std::string_view port) {
+ shared::net::connection connection = make_connection(address, port);
+ init_client(address, port, connection);
+ shared::print::notify << shared::print::time << "client: connected to "
+ << address << ':' << port << '\n';
+
+ do_client_loop(connection);
- client::render::quit();
- client::settings::save();
+ shared::print::notify << shared::print::time
+ << "client: disconnecting from server\n";
+ cleanup_client();
}
} // namespace client
diff --git a/src/client/client.hh b/src/client/client.hh
index 6dbabc1..0eadfe4 100644
--- a/src/client/client.hh
+++ b/src/client/client.hh
@@ -3,25 +3,30 @@
#include <algorithm>
#include <cmath>
+#include <queue>
+#include <random>
#include <string_view>
#include <unordered_map>
-#include "client/draw.hh"
+#include "client/entity/player.hh"
#include "client/input.hh"
-#include "client/movement.hh"
-#include "client/player.hh"
+#include "client/item/items.hh"
+#include "client/movement/movement.hh"
#include "client/render/camera.hh"
+#include "client/render/draw.hh"
#include "client/settings.hh"
#include "client/shared.hh"
-#include "client/window.hh"
-#include "client/world.hh"
-#include "shared/math.hh"
+#include "client/state/chunks.hh"
+#include "client/state/entities.hh"
+#include "client/state/state.hh"
+#include "client/window/window.hh"
+#include "client/world/chunk.hh"
+#include "shared/math/math.hh"
+#include "shared/net/connection.hh"
#include "shared/net/net.hh"
#include "shared/net/proto.hh"
namespace client {
-void send_say_packet(const std::string& text) noexcept;
-
void main(const std::string_view address, const std::string_view port);
} // namespace client
diff --git a/src/client/draw.hh b/src/client/draw.hh
deleted file mode 100644
index 821d67b..0000000
--- a/src/client/draw.hh
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef CLIENT_DRAW_HH_
-#define CLIENT_DRAW_HH_
-
-#include <string_view>
-
-#include <glm/glm.hpp>
-
-#include "client/movement.hh"
-#include "client/player.hh"
-#include "client/render/camera.hh"
-#include "client/render/render.hh"
-#include "client/render/program.hh"
-#include "client/shared.hh"
-#include "client/window.hh"
-#include "client/world.hh"
-
-namespace client {
-namespace draw {
-
-// Scale takes the range [0, 1] and represents an amount of the screen.
-// Offset is any value that is added after scale.
-struct relative_arg {
- glm::vec2 extent;
- glm::vec2 offset;
-
- glm::vec2 to_vec2() const noexcept {
- const glm::vec2& window = render::get_window_size();
- const float x = this->extent.x * window.x + this->offset.x;
- const float y = this->extent.y * window.y + this->offset.y;
- return {x, y};
- }
-};
-
-struct rectangle_args {
- relative_arg pos;
- relative_arg size;
- glm::vec4 colour;
-};
-
-struct text_args {
- relative_arg pos;
- float extent_height; // we don't get width here,
- float offset_height;
- glm::vec4 colour;
- bool has_backing;
- bool is_centered;
- bool is_vcentered;
-};
-
-void draw_rectangle(const rectangle_args& args) noexcept;
-void draw_colour(const glm::vec4& colour) noexcept;
-void draw_text(const std::string_view text, const text_args& args) noexcept;
-
-void draw(client::players& players, client::world::chunk::map& chunks) noexcept;
-
-} // namespace draw
-} // namespace client
-
-#endif
diff --git a/src/client/entity/animate.cc b/src/client/entity/animate.cc
new file mode 100644
index 0000000..9142b55
--- /dev/null
+++ b/src/client/entity/animate.cc
@@ -0,0 +1,158 @@
+#include "player.hh"
+
+namespace client {
+
+// We might start receiving data slower or faster. We compensate by adjusting
+// how fast time progresses on our client.;
+void animate::update_time_factor(const shared::tick_t& sequence,
+ const shared::tick_t& tick) noexcept {
+
+ // Check if we're older than the latest, don't update if so.
+ if (std::ranges::any_of(this->updates, [&](const auto& update) {
+ return update.from_server && update.tick_sequence >= sequence;
+ })) {
+ return;
+ }
+
+ // How many ticks in the future we prefer to be at. If the server is
+ // jittery, we would want this value to be greater, but this should be OK
+ // for most cases. A larger value decreases the max ping we can handle.
+ constexpr float TARGET_TICKS_AHEAD = 1.341519f;
+
+ if (const auto tick_dist = static_cast<std::int64_t>(tick) -
+ static_cast<std::int64_t>(state::tick);
+ tick_dist > 0) {
+
+ // We're behind, jump ahead. We only touch delta_ticks so extrapolate
+ // is called the correct number of times in client.cc.
+#ifndef NDEBUG
+ shared::print::debug << shared::print::time
+ << "client: time_factor jumped ahead, got tick "
+ << tick << ", was " << state::tick << " + "
+ << state::delta_ticks
+ << ", time_factor: " << state::time_factor << '\n';
+#endif
+ state::delta_ticks = static_cast<float>(tick_dist) + TARGET_TICKS_AHEAD;
+ state::time_factor = 1.0f;
+
+ return;
+ }
+
+ // Otherwise we try to move towards the value by adjusting how fast time
+ // progresses. This shouldn't be possible to notice, our constants should
+ // be adjusted if it is.
+ const float time_diff =
+ (static_cast<float>(tick) + TARGET_TICKS_AHEAD) -
+ (static_cast<float>(state::tick) + state::delta_ticks);
+
+ constexpr float MAX_TIME_FACTOR_DIFF = 0.1f;
+ constexpr float TIME_FACTOR_AGGRESSIVENESS = 0.25f;
+ state::time_factor =
+ std::clamp(1.0f + (time_diff * TIME_FACTOR_AGGRESSIVENESS),
+ 1.0f - MAX_TIME_FACTOR_DIFF, 1.0f + MAX_TIME_FACTOR_DIFF);
+}
+
+void animate::notify(const shared::animate& animate,
+ const shared::tick_t& tick_sequence,
+ const bool from_server) noexcept {
+ // If it's from the server we want to update previously emplaced predicted
+ // (and potentially predicted) values.
+ if (const auto it = std::ranges::find_if(this->updates,
+ [&](const auto& update) {
+ return update.tick_sequence ==
+ tick_sequence;
+ });
+ it != std::end(this->updates)) {
+
+ if (from_server) {
+ *it = animate_update{.tick_sequence = tick_sequence,
+ .animate = animate,
+ .from_server = from_server};
+ }
+
+ return;
+ }
+
+ this->updates.push_back({.tick_sequence = tick_sequence,
+ .animate = animate,
+ .from_server = from_server});
+
+ std::ranges::sort(this->updates, [](const auto& a, const auto& b) {
+ return a.tick_sequence < b.tick_sequence;
+ });
+}
+
+float animate::get_target_ticks_back() noexcept {
+ // The localplayer is interpolated via the latest tick.
+ const unsigned base_ticks_back = [&]() -> unsigned {
+ if (this->index == *state::localplayer_index) {
+ return 0u;
+ }
+ const float base = settings::get<float>({"engine", "interp"}, 0.25f);
+ const float ret = base * static_cast<float>(state::tickrate);
+ return std::clamp(static_cast<unsigned>(ret), 0u, state::tickrate);
+ }();
+
+ return state::delta_ticks + static_cast<float>(base_ticks_back);
+}
+
+void animate::interpolate() noexcept {
+ const float target_ticks_back = this->get_target_ticks_back();
+
+ const bool is_localplayer = this->index == *state::localplayer_index;
+ const auto b_it = [&, this]() {
+ if (is_localplayer) {
+ return std::rbegin(this->updates);
+ }
+ return std::ranges::find_if(
+ std::rbegin(this->updates), std::rend(this->updates),
+ [&](const auto& update) {
+ const unsigned target =
+ state::tick - static_cast<unsigned>(target_ticks_back);
+ return update.tick_sequence <= target;
+ });
+ }();
+ if (b_it == std::rend(this->updates)) {
+ return;
+ }
+
+ const auto a_it = std::next(b_it);
+ if (a_it == std::rend(this->updates)) {
+ return;
+ }
+
+ const glm::vec3 a_pos = a_it->animate.get_local_pos();
+ const glm::vec3 b_pos = shared::movement::make_relative(
+ a_it->animate.get_chunk_pos(), b_it->animate.get_local_pos(),
+ b_it->animate.get_chunk_pos());
+
+ const float b_interp = [&]() {
+ const float diff =
+ is_localplayer
+ ? 1.0f
+ : static_cast<float>(b_it->tick_sequence - a_it->tick_sequence);
+ const float base = std::fmod(target_ticks_back, 1.0f);
+ const float a_dist = diff - (1.0f - base);
+ return a_dist / diff;
+ }();
+ const float a_interp = (1.0f - b_interp);
+
+ const auto& a = a_it->animate;
+ const auto& b = b_it->animate;
+ this->local_pos = a_pos * a_interp + b_pos * b_interp;
+ this->chunk_pos = a.get_chunk_pos();
+ this->velocity = a.get_velocity() * a_interp + b.get_velocity() * b_interp;
+ // Update viewangles if we're not the localplayer, yaw requires special care
+ // because it should snap to the closest difference angle.
+ if (!is_localplayer) {
+ this->viewangles.pitch =
+ a.get_angles().pitch * a_interp + b.get_angles().pitch * b_interp;
+ const float yaw_delta = shared::math::angles::get_yaw_delta(
+ a.get_angles().yaw, b.get_angles().yaw);
+ this->viewangles.yaw = a.get_angles().yaw + yaw_delta * b_interp;
+ this->viewangles.normalise();
+ }
+ shared::movement::normalise_position(this->local_pos, this->chunk_pos);
+}
+
+} // namespace client
diff --git a/src/client/entity/animate.hh b/src/client/entity/animate.hh
new file mode 100644
index 0000000..79016ea
--- /dev/null
+++ b/src/client/entity/animate.hh
@@ -0,0 +1,71 @@
+#ifndef CLIENT_ENTITY_ANIMATE_HH_
+#define CLIENT_ENTITY_ANIMATE_HH_
+
+#include <algorithm>
+#include <chrono>
+#include <cmath>
+#include <ranges>
+#include <utility>
+#include <vector>
+
+#include <boost/circular_buffer.hpp>
+
+#include "client/entity/entity.hh"
+#include "client/movement/movement.hh"
+#include "client/settings.hh"
+#include "client/state/state.hh"
+#include "shared/entity/animate.hh"
+#include "shared/entity/entity.hh"
+#include "shared/movement/movement.hh"
+#include "shared/net/proto.hh"
+#include "shared/shared.hh"
+
+namespace client {
+
+class animate : virtual public shared::animate, virtual public client::entity {
+protected:
+ struct animate_update {
+ shared::tick_t tick_sequence; // tick or sequence, if LP then sequence.
+ shared::animate animate;
+ bool from_server;
+ };
+
+ // We have 1 second of potential player interpolation to use here when we
+ // initialise this with the server's tickrate.
+ boost::circular_buffer<animate_update> updates{state::tickrate};
+ shared::tick_t latest_sequence = 0;
+
+private:
+ float get_target_ticks_back() noexcept;
+
+public:
+ animate(shared::player&& p) noexcept
+ : shared::entity(p), shared::animate(p), client::entity(p) {}
+
+ animate(const proto::animate& proto) noexcept
+ : shared::entity(proto.entity()), shared::animate(proto),
+ client::entity(proto.entity()) {}
+
+public:
+ // Call when localplayer gets tick to update state timers.
+ void update_time_factor(const shared::tick_t& sequence,
+ const shared::tick_t& tick) noexcept;
+
+ virtual void notify(const shared::animate& animate,
+ const shared::tick_t& tick_sequence,
+ const bool from_server) noexcept;
+
+ shared::tick_t& get_mutable_latest_sequence() noexcept {
+ return this->latest_sequence;
+ }
+ shared::tick_t get_latest_sequence() const noexcept {
+ return this->latest_sequence;
+ }
+ // An animate may be interpolated, however it's the moveable class that is
+ // required for extrapolation and other prediction.
+ void interpolate() noexcept;
+};
+
+} // namespace client
+
+#endif
diff --git a/src/client/entity/entity.cc b/src/client/entity/entity.cc
new file mode 100644
index 0000000..c305a66
--- /dev/null
+++ b/src/client/entity/entity.cc
@@ -0,0 +1,6 @@
+#include "client/entity/entity.hh"
+
+namespace client {
+
+
+} // namespace client
diff --git a/src/client/entity/entity.hh b/src/client/entity/entity.hh
new file mode 100644
index 0000000..e8d6cc6
--- /dev/null
+++ b/src/client/entity/entity.hh
@@ -0,0 +1,27 @@
+#ifndef CLIENT_ENTITY_ENTITY_HH_
+#define CLIENT_ENTITY_ENTITY_HH_
+
+#include "shared/entity/entity.hh"
+#include "shared/entity/player.hh"
+
+namespace client {
+
+class player; // forward declaration
+
+// A client::entity is a renderable shared::entity.
+class entity : virtual public shared::entity {
+public:
+ entity(shared::entity& e) noexcept
+ : shared::entity(std::forward<shared::entity>(e)) {}
+ entity(const proto::entity& e) noexcept : shared::entity(e) {}
+
+ virtual ~entity() noexcept {}
+
+public:
+ virtual void draw(const client::player& localplayer) noexcept = 0;
+ virtual void draw_wts(const client::player& localplayer) noexcept = 0;
+};
+
+} // namespace client
+
+#endif
diff --git a/src/client/entity/moveable.cc b/src/client/entity/moveable.cc
new file mode 100644
index 0000000..480e6db
--- /dev/null
+++ b/src/client/entity/moveable.cc
@@ -0,0 +1,86 @@
+#include "client/entity/moveable.hh"
+
+namespace client {
+
+static auto find_sequence_it(auto& updates,
+ const shared::tick_t& sequence) noexcept {
+ return std::ranges::find_if(updates, [&sequence](const auto& update) {
+ return update.tick_sequence == sequence;
+ });
+}
+
+void moveable::repredict_from(const shared::tick_t& sequence) noexcept {
+ // find the animate update we want to repredict starting from
+ const auto find_it = find_sequence_it(this->updates, sequence);
+ if (find_it == std::end(this->updates)) {
+ return;
+ }
+
+ // backup current animate
+ const shared::animate before_move = *this;
+
+ // predict the next ticks starting from find_it until we run
+ // out of prediction history
+ for (auto it = find_it; it != std::end(this->updates); ++it) {
+ const auto next_it = std::next(it);
+ if (next_it == std::end(this->updates)) {
+ break;
+ }
+
+ const auto viewangles = next_it->animate.get_angles();
+ const auto commands = next_it->animate.get_commands();
+
+ this->shared::animate::operator=(it->animate);
+ this->commands = commands;
+ this->viewangles = viewangles;
+ const auto predicted = movement::move(*this, state::chunks);
+ if (!predicted.has_value()) {
+ break;
+ }
+ next_it->animate = *predicted;
+ next_it->animate.get_mutable_angles() = viewangles;
+ next_it->animate.get_mutable_commands() = commands;
+ }
+ // restore current animate
+ this->shared::animate::operator=(before_move);
+}
+
+void moveable::notify(const shared::animate& animate,
+ const shared::tick_t& sequence,
+ const bool from_server) noexcept {
+ this->animate::notify(animate, sequence, from_server);
+
+ if (!from_server) { // Only repredict if we're from the server.
+ return;
+ }
+ this->repredict_from(sequence);
+}
+
+void moveable::extrapolate() noexcept {
+ // can't extrapolate if no data
+ if (this->updates.empty()) {
+ return;
+ }
+
+ const auto& latest_it = std::rbegin(this->updates);
+ if (latest_it == std::rend(this->updates)) {
+ return;
+ }
+
+ // backup current animate, load latest animate
+ const shared::animate before_extrapolate = *this;
+ this->shared::animate::operator=(latest_it->animate);
+
+ // FIXED: we were writing our commands with the old commands, so we were
+ // always predicting the first commands, which were always for not moving!
+ this->commands = before_extrapolate.get_commands();
+ this->viewangles = before_extrapolate.get_angles();
+
+ const auto predicted = movement::move(*this, state::chunks);
+ if (predicted.has_value()) {
+ this->notify(*predicted, this->get_latest_sequence() + 1, false);
+ }
+ this->shared::animate::operator=(before_extrapolate);
+}
+
+} // namespace client
diff --git a/src/client/entity/moveable.hh b/src/client/entity/moveable.hh
new file mode 100644
index 0000000..fa08d22
--- /dev/null
+++ b/src/client/entity/moveable.hh
@@ -0,0 +1,29 @@
+#ifndef CLIENT_ENTITY_MOVEABLE_HH_
+#define CLIENT_ENTITY_MOVEABLE_HH_
+
+#include "client/entity/animate.hh"
+#include "client/state/chunks.hh"
+#include "client/state/state.hh"
+#include "client/world/chunk.hh"
+#include "shared/entity/moveable.hh"
+
+namespace client {
+
+class moveable : virtual public client::animate,
+ virtual public shared::moveable,
+ virtual public shared::animate {
+private:
+ void repredict_from(const shared::tick_t& sequence) noexcept;
+
+public:
+ // Notify repredicts if necessary.
+ virtual void notify(const shared::animate& animate,
+ const shared::tick_t& sequence,
+ const bool from_server) noexcept override;
+
+ void extrapolate() noexcept;
+};
+
+} // namespace client
+
+#endif
diff --git a/src/client/entity/player.cc b/src/client/entity/player.cc
new file mode 100644
index 0000000..550968f
--- /dev/null
+++ b/src/client/entity/player.cc
@@ -0,0 +1,54 @@
+#include "player.hh"
+namespace client {
+
+glm::vec3 player::get_world_pos(const client::player& lp) noexcept {
+ const auto& lp_cp = lp.get_chunk_pos();
+
+ // clang-format off
+ const float world_x = static_cast<float>(this->get_chunk_pos().x - lp_cp.x) * shared::world::chunk::WIDTH + this->local_pos.x;
+ const float world_y = static_cast<float>(this->get_local_pos().y) + shared::player::HEIGHT / 2.0f;
+ const float world_z = static_cast<float>(this->get_chunk_pos().z - lp_cp.z) * shared::world::chunk::WIDTH + this->local_pos.z;
+ // clang-format on
+ return {world_x, world_y, world_z};
+}
+
+void player::draw(const client::player& localplayer) noexcept {
+
+ static render::model playermodel{"res/models/player/player.obj"};
+ static render::program program{"res/shaders/model.vs",
+ "res/shaders/model.fs"};
+
+ const glm::vec3 world_pos = this->get_world_pos(localplayer);
+ const glm::mat4 rotate = glm::rotate(glm::mat4(1.0f), -this->viewangles.yaw,
+ glm::vec3(0.0f, 1.0f, 0.0f));
+ const glm::mat4 translate = glm::translate(glm::mat4(1.0f), world_pos);
+ const glm::mat4& view = render::camera::get_view();
+ const glm::mat4& proj = render::camera::get_proj();
+
+ playermodel.draw(program, proj * view * translate * rotate);
+}
+
+void player::draw_wts(const client::player& localplayer) noexcept {
+ const auto& msg = this->get_message();
+ if (!msg.has_value()) {
+ return;
+ }
+
+ const glm::vec3 world_pos = this->get_world_pos(localplayer);
+ const auto pos = math::world_to_screen(world_pos);
+
+ if (!pos.has_value()) {
+ return;
+ }
+
+ const glm::vec2& window = render::get_window_size();
+ const glm::mat4 proj = glm::ortho(0.0f, window.x, 0.0f, window.y);
+ const glm::mat4 tran =
+ glm::translate(glm::mat4(1.0f),
+ glm::vec3{std::floor(pos->x), std::floor(pos->y), 0.0f});
+
+ constexpr glm::vec4 white{1.0f, 1.0f, 1.0f, 1.0f};
+ render::render_text(msg->text, 30.0f, true, true, white, proj * tran);
+}
+
+} // namespace client
diff --git a/src/client/entity/player.hh b/src/client/entity/player.hh
new file mode 100644
index 0000000..d9bdc18
--- /dev/null
+++ b/src/client/entity/player.hh
@@ -0,0 +1,73 @@
+#ifndef CLIENT_ENTITY_PLAYER_HH_
+#define CLIENT_ENTITY_PLAYER_HH_
+
+#include <chrono>
+#include <optional>
+#include <string>
+#include <utility>
+
+#include "client/entity/moveable.hh"
+#include "client/entity/entity.hh"
+#include "client/item/block.hh"
+#include "client/item/items.hh"
+#include "client/math.hh"
+#include "client/render/camera.hh"
+#include "client/render/model.hh"
+#include "client/render/program.hh"
+
+namespace client {
+
+// Renderable player, similar to client::chunk. We also store the message the
+// player wants to say.
+class player : virtual public shared::player, public client::moveable {
+public:
+ static constexpr auto MSG_SHOW_TIME = std::chrono::seconds{15};
+ struct message {
+ std::string text;
+ std::chrono::time_point<std::chrono::steady_clock> receive_time;
+ message(const std::string& message) noexcept {
+ this->text = message;
+ this->receive_time = std::chrono::steady_clock::now();
+ }
+ };
+ std::optional<message> message;
+
+private:
+ glm::vec3 get_world_pos(const client::player& lp) noexcept;
+
+public:
+ player(shared::player&& p) noexcept
+ : shared::entity(p), shared::animate(p), shared::player(p),
+ client::entity(p), client::animate(std::move(p)) {
+
+ // upgrade our inventory contents to client::item::item
+ for (auto& item : this->inventory.contents) {
+ if (item == nullptr) {
+ continue;
+ }
+
+ item = client::item::make_item(item->get_type(), item->quantity);
+ }
+ }
+ player(const proto::animate& proto) noexcept
+ : shared::entity(proto.entity()), shared::animate(proto),
+ shared::player(proto), client::entity(proto.entity()),
+ client::animate(proto) {}
+
+ virtual void draw(const client::player& localplayer) noexcept override;
+ virtual void draw_wts(const client::player& localplayer) noexcept override;
+
+ const std::optional<struct message>& get_message() noexcept {
+ if (this->message.has_value()) {
+ const auto now = std::chrono::steady_clock::now();
+ if (now > this->message->receive_time + player::MSG_SHOW_TIME) {
+ this->message.reset();
+ }
+ }
+ return this->message;
+ }
+};
+
+} // namespace client
+
+#endif
diff --git a/src/client/item/block.cc b/src/client/item/block.cc
new file mode 100644
index 0000000..08f072b
--- /dev/null
+++ b/src/client/item/block.cc
@@ -0,0 +1,91 @@
+#include "client/item/block.hh"
+
+namespace client {
+namespace item {
+
+void block::regenerate_glo() noexcept {
+ const auto make_vbo = [](const auto& data) -> GLuint {
+ GLuint vbo = 0;
+ glGenBuffers(1, &vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ glBufferData(GL_ARRAY_BUFFER,
+ std::size(data) * sizeof(client::world::block::glvert),
+ std::data(data), GL_STATIC_DRAW);
+ return vbo;
+ };
+ const auto make_vao = []() -> GLuint {
+ GLuint vao = 0;
+ glGenVertexArrays(1, &vao);
+ glBindVertexArray(vao);
+ // posiiton
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(0, sizeof(glm::vec3) / sizeof(float), GL_FLOAT,
+ GL_FALSE, sizeof(client::world::block::glvert),
+ nullptr);
+ // texture
+ glEnableVertexAttribArray(1);
+ glVertexAttribPointer(1, sizeof(glm::vec3) / sizeof(float), GL_FLOAT,
+ GL_FALSE, sizeof(client::world::block::glvert),
+ reinterpret_cast<void*>(sizeof(glm::vec3)));
+ return vao;
+ };
+ std::vector<client::world::block::glvert> data;
+
+ const float tex_yoff = static_cast<float>(this->type) - 1.0f;
+ for (const auto& face :
+ client::world::block::get_glfaces(this->shared::item::block::type)) {
+
+ std::ranges::transform(face, std::back_inserter(data), [&](auto vert) {
+ vert.texture.z += tex_yoff * 6.0f;
+ return vert;
+ });
+ }
+
+ const auto vbo = make_vbo(data);
+ const auto vao = make_vao();
+ this->glo.emplace(vbo, vao, std::size(data));
+}
+
+void block::draw(const glm::vec2& pos, const glm::vec2& size) noexcept {
+ const auto make_matrix = [&]() -> glm::mat4 {
+ const glm::vec2 window = client::render::get_window_size();
+
+ constexpr auto identity = glm::mat4{1.0f};
+ const auto proj = glm::ortho(0.0f, window.x, 0.0f, window.y);
+ const auto scal =
+ glm::scale(identity, glm::vec3{size.x * 0.5f, size.y * 0.5f, 0.0f});
+ const auto tran =
+ glm::translate(identity, glm::vec3{pos.x + size.x / 2.0f,
+ pos.y + size.y / 2.0f, 0.0f});
+
+ // hack for shurbs, which are already offset and look bad when rotated
+ const auto rotey = client::world::block::get_draw_type(this->type) ==
+ client::world::block::draw_type::block
+ ? glm::rotate(identity, glm::radians(45.0f),
+ glm::vec3(0.0f, 1.0f, 0.0f))
+ : identity;
+ const auto rotex = glm::rotate(identity, glm::radians(30.0f),
+ glm::vec3(1.0f, 0.0f, 0.0f));
+ return proj * tran * scal * rotex * rotey;
+ };
+
+ static const client::render::program program{"res/shaders/face.vs",
+ "res/shaders/face.fs"};
+ static const GLint u_matrix = glGetUniformLocation(program, "_u_matrix");
+
+ if (!this->glo.has_value()) {
+ this->regenerate_glo();
+ }
+
+ glDisable(GL_BLEND);
+ glDisable(GL_DEPTH_TEST);
+ glUseProgram(program);
+ glBindVertexArray(this->glo->vao);
+
+ glUniformMatrix4fv(u_matrix, 1, GL_FALSE, glm::value_ptr(make_matrix()));
+
+ glDrawArrays(GL_TRIANGLES, 0, this->glo->elements);
+}
+
+} // namespace item
+} // namespace client
diff --git a/src/client/item/block.hh b/src/client/item/block.hh
new file mode 100644
index 0000000..f259aad
--- /dev/null
+++ b/src/client/item/block.hh
@@ -0,0 +1,58 @@
+#ifndef CLIENT_ITEM_BLOCK_HH_
+#define CLIENT_ITEM_BLOCK_HH_
+
+#include <algorithm>
+#include <optional>
+
+#include "client/item/item.hh"
+#include "client/render/render.hh"
+#include "client/world/block.hh"
+#include "shared/item/block.hh"
+#include "shared/item/item.hh"
+
+namespace client {
+namespace item {
+
+class block : virtual public shared::item::block, public client::item::item {
+private:
+ struct gl_object {
+ GLuint vbo;
+ GLuint vao;
+ unsigned long elements;
+
+ gl_object(const GLuint& vbo, const GLuint& vao,
+ const unsigned long& elements) noexcept
+ : vbo(vbo), vao(vao), elements(elements) {}
+ gl_object(const gl_object&) = delete;
+ gl_object(gl_object&&) = delete;
+ ~gl_object() noexcept {
+ glDeleteBuffers(1, &vbo);
+ glDeleteVertexArrays(1, &vao);
+ }
+ };
+
+private:
+ std::optional<gl_object> glo = std::nullopt;
+ void regenerate_glo() noexcept;
+
+public:
+ template <typename... Args>
+ block(const enum shared::world::block::type& type, Args&&... args) noexcept
+ : shared::item::block(type, args...), client::item::item(
+ std::forward<Args>(args)...) {
+ }
+ template <typename... Args>
+ block(const shared::item::item::type_t& type, Args&&... args) noexcept
+ : shared::item::item(type, args...), shared::item::block(type, args...),
+ client::item::item(type, std::forward<Args>(args)...) {}
+ virtual ~block() noexcept {}
+
+public:
+ virtual void draw(const glm::vec2& pos,
+ const glm::vec2& size) noexcept override;
+};
+
+} // namespace item
+} // namespace client
+
+#endif
diff --git a/src/client/item/item.cc b/src/client/item/item.cc
new file mode 100644
index 0000000..64cc1f5
--- /dev/null
+++ b/src/client/item/item.cc
@@ -0,0 +1 @@
+#include "client/item/item.hh"
diff --git a/src/client/item/item.hh b/src/client/item/item.hh
new file mode 100644
index 0000000..ff80369
--- /dev/null
+++ b/src/client/item/item.hh
@@ -0,0 +1,30 @@
+#ifndef CLIENT_ITEM_ITEM_HH_
+#define CLIENT_ITEM_ITEM_HH_
+
+#include <algorithm>
+
+#include <glm/glm.hpp>
+
+#include "shared/item/item.hh"
+
+namespace client {
+namespace item {
+
+// client::item is a renderiable shared::item
+class item : virtual public shared::item::item {
+public:
+public:
+ template <typename... Args>
+ item(Args&&... args) noexcept
+ : shared::item::item(std::forward<Args>(args)...) {}
+ virtual ~item() noexcept {}
+
+public:
+ // 2d drawing of items
+ virtual void draw(const glm::vec2& pos, const glm::vec2& size) noexcept = 0;
+};
+
+} // namespace item
+} // namespace client
+
+#endif
diff --git a/src/client/item/items.cc b/src/client/item/items.cc
new file mode 100644
index 0000000..9ff25fe
--- /dev/null
+++ b/src/client/item/items.cc
@@ -0,0 +1,16 @@
+#include "client/item/items.hh"
+
+namespace client {
+namespace item {
+
+shared::item::item_t make_item(const shared::item::item::type_t& type,
+ const std::uint32_t& quantity) noexcept {
+ if (type >= shared::item::block::type_offset) {
+ return std::make_shared<client::item::block>(type, quantity);
+ }
+ // TODO non-block items
+ return std::make_shared<client::item::block>(type, quantity);
+}
+
+} // namespace item
+} // namespace client
diff --git a/src/client/item/items.hh b/src/client/item/items.hh
new file mode 100644
index 0000000..53cebfa
--- /dev/null
+++ b/src/client/item/items.hh
@@ -0,0 +1,17 @@
+#ifndef CLIENT_ITEM_ITEMS_HH_
+#define CLIENT_ITEM_ITEMS_HH_
+
+#include "client/item/block.hh"
+#include "shared/item/item.hh"
+#include "shared/item/items.hh"
+
+namespace client {
+namespace item {
+
+shared::item::item_t make_item(const shared::item::item::type_t& type,
+ const std::uint32_t& quantity) noexcept;
+
+} // namespace item
+} // namespace client
+
+#endif
diff --git a/src/client/main.cc b/src/client/main.cc
new file mode 100644
index 0000000..858c6df
--- /dev/null
+++ b/src/client/main.cc
@@ -0,0 +1,90 @@
+#include "client/main.hh"
+
+static bool& get_has_address() noexcept {
+ static bool ret = false;
+ return ret;
+}
+
+static bool& get_has_port() noexcept {
+ static bool ret = false;
+ return ret;
+}
+
+static std::string& get_address() noexcept {
+ static std::string address{shared::DEFAULT_ADDRESS};
+ return address;
+}
+
+static std::string& get_port() noexcept {
+ static std::string port{shared::DEFAULT_PORT};
+ return port;
+}
+
+static bool& get_is_headless() noexcept {
+ static bool is_headless = false;
+ return is_headless;
+}
+
+static bool parse_arg(const int& c, const char* const arg) {
+ switch (c) {
+ case 'a':
+ get_address() = boost::lexical_cast<std::string>(arg);
+ get_has_address() = true;
+ break;
+ case 'p':
+ get_port() = boost::lexical_cast<std::string>(arg);
+ get_has_port() = true;
+ break;
+ case 'H':
+ get_is_headless() = true;
+ break;
+ case 's':
+ get_address() = "localhost";
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+static const shared::args_t& get_options() {
+ static shared::args_t ret = []() -> shared::args_t {
+ shared::args_t ret{
+ {.name = "address", .desc = "connect elsewhere", .val = "a:"},
+ {.name = "port", .desc = "override the default port", .val = "p:"},
+ {.name = "headless", .desc = "run without a client ", .val = "H"},
+ {.name = "singleplayer",
+ .desc = "avoid hosting a lan server",
+ .val = "s"}};
+ std::ranges::copy(shared::get_options(), std::back_inserter(ret));
+ std::ranges::copy(server::get_options(), std::back_inserter(ret));
+ return ret;
+ }();
+
+ return ret;
+}
+
+int main(const int argc, char* const* argv) {
+ shared::init();
+
+ shared::parse_args(argc, argv, get_options(),
+ {&parse_arg, &shared::parse_arg, &server::parse_arg});
+
+ if (get_has_address()) {
+ shared::try_main(client::main, get_address(), get_port());
+ return EXIT_SUCCESS;
+ }
+
+ if (get_is_headless()) {
+ shared::try_main(server::main, get_address(), get_port());
+ return EXIT_SUCCESS;
+ }
+
+ const std::jthread server_thread{shared::try_main, server::main,
+ get_address(), get_port()};
+ while (!server::has_initialised) {
+ continue;
+ }
+ shared::try_main(client::main, get_address(), get_port());
+ return EXIT_SUCCESS;
+}
diff --git a/src/main.hh b/src/client/main.hh
index 28e7b0c..8610763 100644
--- a/src/main.hh
+++ b/src/client/main.hh
@@ -1,14 +1,10 @@
-#ifndef MAIN_HH_
-#define MAIN_HH_
-
-// -DCMAKE_BUILD_TYPE=Release disables the following (=Debug for enable):
-// shared::world::chunk::get_block bounds checking
-// collision debug information
-// unknown packet printing
+#ifndef CLIENT_MAIN_HH_
+#define CLIENT_MAIN_HH_
#include <algorithm>
#include <exception>
#include <execinfo.h>
+#include <getopt.h>
#include <iostream>
#include <iterator>
#include <signal.h>
@@ -21,5 +17,7 @@
#include "client/client.hh"
#include "server/server.hh"
#include "server/shared.hh"
+#include "shared/init.hh"
+#include "shared/shared.hh"
#endif
diff --git a/src/client/movement.hh b/src/client/movement.hh
deleted file mode 100644
index 82b56b1..0000000
--- a/src/client/movement.hh
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef CLIENT_MOVEMENT_HH_
-#define CLIENT_MOVEMENT_HH_
-
-#include "client/world.hh"
-#include "shared/movement.hh"
-#include "shared/net/net.hh"
-#include "shared/player.hh"
-
-namespace client {
-namespace movement {
-
-void move(shared::player& player, client::world::chunk::map& chunks,
- const float deltatime) noexcept;
-
-enum class interact_mode { add, remove };
-std::optional<std::pair<shared::math::coords, glm::ivec3>>
-interact(const shared::player& player, const interact_mode& mode,
- const client::world::chunk::map& chunks) noexcept;
-
-} // namespace movement
-} // namespace client
-
-#endif
diff --git a/src/client/movement.cc b/src/client/movement/movement.cc
index e5898eb..8712f89 100644
--- a/src/client/movement.cc
+++ b/src/client/movement/movement.cc
@@ -1,11 +1,11 @@
-#include "client/movement.hh"
+#include "client/movement/movement.hh"
namespace client {
namespace movement {
static std::optional<shared::world::block>
maybe_get_block(const shared::math::coords& pos,
- const client::world::chunk::map& chunks,
+ const client::world::chunks_t& chunks,
const glm::ivec3& block_pos) noexcept {
const auto find_it = chunks.find(pos);
@@ -20,19 +20,20 @@ maybe_get_block(const shared::math::coords& pos,
return find_it->second->get_block(block_pos);
}
-static std::optional<std::vector<shared::movement::blockinfo>>
-make_blockinfos(const shared::player& player,
- const client::world::chunk::map& chunks, const int width,
- const int height) noexcept {
+static std::optional<shared::movement::blocks>
+maybe_make_blocks(const glm::vec3& local_pos,
+ const shared::math::coords& chunk_pos,
+ const client::world::chunks_t& chunks, const int width,
+ const int height) noexcept {
- std::vector<shared::movement::blockinfo> blockinfos;
+ shared::movement::blocks blocks;
for (int x = -width; x <= width; ++x) {
for (int y = -height; y <= height; ++y) {
for (int z = -width; z <= width; ++z) {
const glm::ivec3 rel_pos =
- glm::ivec3{x, y, z} + glm::ivec3{player.local_pos};
+ glm::ivec3{x, y, z} + glm::ivec3{local_pos};
if (rel_pos.y < 0 ||
rel_pos.y >= shared::world::chunk::HEIGHT) {
@@ -41,7 +42,7 @@ make_blockinfos(const shared::player& player,
const shared::math::coords norm_chunk_pos =
shared::world::chunk::get_normalised_chunk(
- player.chunk_pos, rel_pos.x, rel_pos.z);
+ chunk_pos, rel_pos.x, rel_pos.z);
const glm::ivec3 norm_pos =
shared::world::chunk::get_normalised_coords(rel_pos);
@@ -52,72 +53,68 @@ make_blockinfos(const shared::player& player,
return std::nullopt;
}
- const glm::vec3 pos = glm::vec3{rel_pos} - player.local_pos;
+ const glm::vec3 pos = glm::vec3{rel_pos} - local_pos;
const shared::movement::aabb aabb = {
.min = glm::vec3{0.0f, 0.0f, 0.0f} + pos,
.max = glm::vec3{1.0f, 1.0f, 1.0f} + pos};
- blockinfos.push_back(
- shared::movement::blockinfo{.block = block.value(),
- .aabb = aabb,
- .chunk_pos = norm_chunk_pos,
- .pos = norm_pos});
+ blocks.push_back(
+ shared::movement::block{.block = *block,
+ .aabb = aabb,
+ .chunk_pos = norm_chunk_pos,
+ .pos = norm_pos});
}
}
}
- return blockinfos;
+ return blocks;
}
-void move(shared::player& player, client::world::chunk::map& chunks,
- const float deltatime) noexcept {
- const auto blockinfos =
- make_blockinfos(player, chunks, shared::movement::move_width,
- shared::movement::move_height);
- if (!blockinfos.has_value()) {
- return;
+std::optional<shared::animate> move(const shared::moveable& moveable,
+ const world::chunks_t& chunks) noexcept {
+
+ const auto xy = shared::movement::get_move_xy(state::tickrate, moveable);
+ const auto blocks = maybe_make_blocks(
+ moveable.get_local_pos(), moveable.get_chunk_pos(), chunks, xy.x, xy.y);
+ if (!blocks.has_value()) {
+ return std::nullopt;
}
- shared::movement::move(player, blockinfos.value(), deltatime);
+ return shared::movement::move(moveable, *blocks, state::tickrate);
}
std::optional<std::pair<shared::math::coords, glm::ivec3>>
-interact(const shared::player& player, const interact_mode& mode,
- const client::world::chunk::map& chunks) noexcept {
- const auto blockinfos = make_blockinfos(player, chunks, 5, 5);
- if (!blockinfos.has_value()) {
+interact(const shared::moveable& moveable, const interact_mode& mode,
+ const client::world::chunks_t& chunks) noexcept {
+ const auto blocks = maybe_make_blocks(
+ moveable.get_local_pos(), moveable.get_chunk_pos(), chunks, 5, 5);
+ if (!blocks.has_value()) {
return std::nullopt;
}
constexpr float epsilon = 0.001f;
- constexpr shared::movement::aabb player_aabb = {
- .min = {-shared::player::HALFWIDTH + epsilon, 0.0f + epsilon,
- -shared::player::HALFWIDTH + epsilon},
- .max = {shared::player::HALFWIDTH - epsilon,
- shared::player::HEIGHT - epsilon,
- shared::player::HALFWIDTH - epsilon}};
+ const auto& aabb = moveable.get_aabb();
constexpr shared::movement::aabb ray_aabb = {
.min = {-epsilon, shared::player::EYE_HEIGHT - epsilon, -epsilon},
.max = {epsilon, shared::player::EYE_HEIGHT + epsilon, epsilon}};
const shared::movement::moving_aabb ray_moving_aabb{
- .aabb = ray_aabb,
- .velocity = shared::math::angle_to_dir(player.viewangles)};
+ .aabb = ray_aabb, .velocity = moveable.get_angles().to_dir()};
- std::optional<std::pair<shared::movement::moving_aabb_ret,
- shared::movement::blockinfo>>
+ std::optional<
+ std::pair<shared::movement::moving_aabb_ret, shared::movement::block>>
best;
- for (const auto& blockinfo : *blockinfos) {
- if (blockinfo.block == shared::world::block::type::air) {
+ for (const auto& block : *blocks) {
+ if (block.block == shared::world::block::type::air) {
continue;
}
- if (!shared::world::block::is_removable(blockinfo.block)) {
+ if (!shared::world::block::is_removable(block.block)) {
continue;
}
const auto intersect = shared::movement::intersect_moving_aabbs(
ray_moving_aabb,
- shared::movement::moving_aabb{.aabb = blockinfo.aabb,
+ shared::movement::moving_aabb{.aabb = block.aabb,
.velocity = {0.0f, 0.0f, 0.0f}});
constexpr float MAX_REACH = 3.8f;
@@ -128,18 +125,18 @@ interact(const shared::player& player, const interact_mode& mode,
continue;
}
- best = std::make_pair(*intersect, blockinfo);
+ best = std::make_pair(*intersect, block);
}
if (!best.has_value()) {
return std::nullopt;
}
- const auto& [intersect, blockinfo] = *best;
+ const auto& [intersect, block] = *best;
- const glm::ivec3 position = blockinfo.pos;
+ const glm::ivec3 position = block.pos;
if (mode == interact_mode::remove) {
- return std::make_pair(blockinfo.chunk_pos, position);
+ return std::make_pair(block.chunk_pos, position);
}
const glm::ivec3 normal_i = -intersect.normal;
@@ -147,15 +144,15 @@ interact(const shared::player& player, const interact_mode& mode,
shared::world::chunk::get_normalised_coords(normal_i + position);
const auto find_it =
- std::find_if(std::begin(*blockinfos), std::end(*blockinfos),
+ std::find_if(std::begin(*blocks), std::end(*blocks),
[&](const auto b) { return b.pos == normalised_pos; });
- if (find_it == std::end(*blockinfos)) {
+ if (find_it == std::end(*blocks)) {
return std::nullopt;
}
if (!shared::world::block::is_replaceable(find_it->block)) {
return std::nullopt;
}
- if (shared::movement::intersect_aabbs(player_aabb, find_it->aabb)) {
+ if (shared::movement::intersect_aabbs(aabb, find_it->aabb)) {
return std::nullopt;
}
return std::make_pair(find_it->chunk_pos, normalised_pos);
diff --git a/src/client/movement/movement.hh b/src/client/movement/movement.hh
new file mode 100644
index 0000000..19144ba
--- /dev/null
+++ b/src/client/movement/movement.hh
@@ -0,0 +1,27 @@
+#ifndef CLIENT_MOVEMENT_MOVEMENT_HH_
+#define CLIENT_MOVEMENT_MOVEMENT_HH_
+
+#include <cstdint>
+#include <optional>
+
+#include "client/state/state.hh"
+#include "client/world/chunk.hh"
+#include "shared/entity/moveable.hh"
+#include "shared/movement/movement.hh"
+#include "shared/net/net.hh"
+
+namespace client {
+namespace movement {
+
+std::optional<shared::animate> move(const shared::moveable& moveable,
+ const world::chunks_t& chunks) noexcept;
+
+enum class interact_mode { add, remove };
+std::optional<std::pair<shared::math::coords, glm::ivec3>>
+interact(const shared::moveable& player, const interact_mode& mode,
+ const world::chunks_t& chunks) noexcept;
+
+} // namespace movement
+} // namespace client
+
+#endif
diff --git a/src/client/player.cc b/src/client/player.cc
deleted file mode 100644
index 5ff4118..0000000
--- a/src/client/player.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "player.hh"
-
-glm::vec3 client::player::get_world_pos(const shared::player& lp) noexcept {
- // clang-format off
- const float world_x = static_cast<float>(this->chunk_pos.x - lp.chunk_pos.x) * shared::world::chunk::WIDTH + this->local_pos.x;
- const float world_y = static_cast<float>(this->local_pos.y) + shared::player::HEIGHT / 2.0f;
- const float world_z = static_cast<float>(this->chunk_pos.z - lp.chunk_pos.z) * shared::world::chunk::WIDTH + this->local_pos.z;
- // clang-format on
- return {world_x, world_y, world_z};
-}
-
-void client::player::draw_playermodel(
- const shared::player& localplayer) noexcept {
-
- static client::render::model playermodel{"res/models/player/player.obj"};
- static client::render::program program{"res/shaders/model.vs",
- "res/shaders/model.fs"};
-
- const glm::vec3 world_pos = this->get_world_pos(localplayer);
- const glm::mat4 rotate = glm::rotate(glm::mat4(1.0f), -this->viewangles.yaw,
- glm::vec3(0.0f, 1.0f, 0.0f));
- const glm::mat4 translate = glm::translate(glm::mat4(1.0f), world_pos);
- const glm::mat4& view = client::render::camera::get_view();
- const glm::mat4& proj = client::render::camera::get_proj();
-
- playermodel.draw(program, proj * view * translate * rotate);
-}
-
-void client::player::draw_message(const shared::player& localplayer) noexcept {
- // Clear the message if it's too old.
- if (this->message.has_value()) {
- const auto now = std::chrono::steady_clock::now();
- if (now > this->message->receive_time + player::MSG_SHOW_TIME) {
- this->message.reset();
- }
- }
-
- if (!this->message.has_value()) {
- return;
- }
-
- const glm::vec3 world_pos = this->get_world_pos(localplayer);
- const auto pos = client::math::world_to_screen(world_pos);
-
- if (!pos.has_value()) {
- return;
- }
-
- const glm::vec2& window = client::render::get_window_size();
- const glm::mat4 proj = glm::ortho(0.0f, window.x, 0.0f, window.y);
- const glm::mat4 tran =
- glm::translate(glm::mat4(1.0f),
- glm::vec3{std::floor(pos->x), std::floor(pos->y), 0.0f});
-
- constexpr glm::vec4 white{1.0f, 1.0f, 1.0f, 1.0f};
- client::render::render_text(this->message->text, 30.0f, true, true, white,
- proj * tran);
-}
diff --git a/src/client/player.hh b/src/client/player.hh
deleted file mode 100644
index c41ba23..0000000
--- a/src/client/player.hh
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef CLIENT_PLAYER_HH_
-#define CLIENT_PLAYER_HH_
-
-#include <chrono>
-#include <optional>
-#include <string>
-#include <utility>
-
-#include "client/math.hh"
-#include "client/render/camera.hh"
-#include "client/render/model.hh"
-#include "client/render/program.hh"
-#include "shared/player.hh"
-
-namespace client {
-
-// Renderable player, similar to client::chunk. We also store the message the
-// player wants to say.
-class player : public shared::player {
-public:
- static constexpr auto MSG_SHOW_TIME = std::chrono::seconds(15);
- struct message {
- std::string text;
- std::chrono::time_point<std::chrono::steady_clock> receive_time;
- message(const std::string& message) noexcept {
- this->text = message;
- this->receive_time = std::chrono::steady_clock::now();
- }
- };
- std::optional<message> message;
-
-private:
- glm::vec3 get_world_pos(const shared::player& lp) noexcept;
-
-public:
- player(shared::player&& p) noexcept
- : shared::player(std::forward<shared::player>(p)) {}
- player(const shared::player& p) noexcept : shared::player(p) {}
-
- void update(const shared::player& p) noexcept {
- this->index = p.index; // there is no syntax for doing this in one line
- this->commands = p.commands;
- this->chunk_pos = p.chunk_pos;
- this->local_pos = p.local_pos;
- this->viewangles = p.viewangles;
- this->velocity = p.velocity;
- }
-
- void draw_playermodel(const shared::player& localplayer) noexcept;
- void draw_message(const shared::player& localplayer) noexcept;
-
- const std::optional<struct message>& get_message() const noexcept {
- return this->message;
- }
-};
-
-using players = std::vector<player>;
-static inline client::player& get_localplayer(players& players) noexcept {
- return players[0];
-}
-
-} // namespace client
-
-#endif
diff --git a/src/client/draw.cc b/src/client/render/draw.cc
index c549ffe..d9ea9c3 100644
--- a/src/client/draw.cc
+++ b/src/client/render/draw.cc
@@ -1,53 +1,7 @@
-#include "draw.hh"
+#include "client/render/draw.hh"
namespace client {
-namespace draw {
-
-void draw_rectangle(const rectangle_args& ra) noexcept {
- const glm::vec2 pos = ra.pos.to_vec2();
- const glm::vec2 size = ra.size.to_vec2();
-
- // We want to render from the bottom left corner.
- render::render_rectangle(pos + (size / 2.0f), size, ra.colour);
-}
-
-void draw_colour(const glm::vec4& colour) noexcept {
- const rectangle_args args = {
- .pos = {.extent = {0.0f, 0.0f}},
- .size = {.extent = {1.0f, 1.0f}},
- .colour = colour,
- };
- draw_rectangle(args);
-}
-
-void draw_text(const std::string_view text, const text_args& args) noexcept {
- const glm::vec2& window = render::get_window_size();
- const float x = floorf(window.x * args.pos.extent.x + args.pos.offset.x);
- const float y = floorf(window.y * args.pos.extent.y + args.pos.offset.y);
- const unsigned height = static_cast<unsigned>(
- args.extent_height * window.y + args.offset_height);
-
- const auto make_matrix = [&](const float xo, const float yo) -> glm::mat4 {
- constexpr auto identity = glm::mat4(1.0f);
- const auto proj = glm::ortho(0.f, window.x, 0.f, window.y);
- const auto tran =
- glm::translate(identity, glm::vec3{x + xo, y + yo, 0.0f});
- return proj * tran;
- };
-
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_BLEND);
- if (args.has_backing) {
- constexpr glm::vec4 black{0.0f, 0.0f, 0.0f, 1.0f};
- render::render_text(text, height, args.is_centered, args.is_vcentered,
- black, make_matrix(1.0f, -2.0f));
- }
- glEnable(GL_BLEND);
-
- render::render_text(text, height, args.is_centered, args.is_vcentered,
- args.colour, make_matrix(0, 0));
- glEnable(GL_DEPTH_TEST);
-}
+namespace render {
static void draw_state_info(const shared::player& lp) noexcept {
@@ -58,14 +12,16 @@ static void draw_state_info(const shared::player& lp) noexcept {
};
const auto make_position = [&]() -> std::string {
- const auto chunk_x = lp.chunk_pos.x;
- const auto chunk_z = lp.chunk_pos.z;
- const auto x = static_cast<double>(lp.local_pos.x);
- const auto y = static_cast<double>(lp.local_pos.y);
- const auto z = static_cast<double>(lp.local_pos.z);
+ const auto chunk_x = lp.get_chunk_pos().x;
+ const auto chunk_z = lp.get_chunk_pos().z;
+ const auto x = static_cast<double>(lp.get_local_pos().x);
+ const auto y = static_cast<double>(lp.get_local_pos().y);
+ const auto z = static_cast<double>(lp.get_local_pos().z);
constexpr auto WIDTH = shared::world::chunk::WIDTH;
- const auto abs_x = static_cast<double>(lp.chunk_pos.x) * WIDTH + x;
- const auto abs_z = static_cast<double>(lp.chunk_pos.z) * WIDTH + z;
+ const auto abs_x =
+ static_cast<double>(lp.get_chunk_pos().x) * WIDTH + x;
+ const auto abs_z =
+ static_cast<double>(lp.get_chunk_pos().z) * WIDTH + z;
constexpr auto nstr = [](const double d) -> std::string {
auto str = std::to_string(d);
@@ -80,16 +36,16 @@ static void draw_state_info(const shared::player& lp) noexcept {
};
const auto make_direction = [&]() -> std::string {
- const float yaw = glm::degrees(lp.viewangles.yaw);
- const float pitch = glm::degrees(lp.viewangles.pitch);
+ const float yaw = glm::degrees(lp.get_angles().yaw);
+ const float pitch = glm::degrees(lp.get_angles().pitch);
const std::string bearing = [&]() -> std::string {
- if (yaw >= 315.0f || yaw < 45.0f) {
- return "North";
- } else if (yaw >= 45.0f && yaw < 135.0f) {
- return "East";
- } else if (yaw >= 135.0f && yaw < 225.0f) {
+ if (yaw > 135.0f || yaw < -135.0f) {
return "South";
+ } else if (yaw > 45.0f) {
+ return "East";
+ } else if (yaw > -45.0f) {
+ return "North";
} else {
return "West";
}
@@ -100,34 +56,65 @@ static void draw_state_info(const shared::player& lp) noexcept {
};
const auto make_address = []() -> std::string {
- const std::string address = std::string(client::state.address);
- const std::string port = std::string(client::state.port);
+ const std::string address = std::string(client::state::address);
+ const std::string port = std::string(client::state::port);
return "address: " + address + ":" + port;
};
+ const auto make_tickrate = [&]() -> std::string {
+ return "tickrate: " + std::to_string(state::tickrate);
+ };
+
const auto make_seed = []() -> std::string {
- return "seed: " + std::to_string(client::state.seed);
+ return "seed: " + std::to_string(client::state::seed);
};
- const auto make_players = []() -> std::string {
- const auto index = std::to_string(client::state.localplayer);
+ const auto make_entities = []() -> std::string {
+ const auto index = std::to_string(*client::state::localplayer_index);
return "index: " + index;
};
const auto make_chunks = []() -> std::string {
- return "chunks [req, rcv]: " +
- std::to_string(client::state.requested_chunk_count) + ", " +
- std::to_string(client::state.networked_chunk_count) + " @ " +
- std::to_string(client::state.draw_distance) + " draw distance";
+ return "chunks: " +
+ std::to_string(client::state::requested_chunk_count) + ", " +
+ std::to_string(client::state::networked_chunk_count) + " @ " +
+ std::to_string(client::state::draw_distance) + " draw distance";
};
const auto make_speed = [&]() -> std::string {
- return "speed: " + nstr(glm::length(lp.velocity)) + " b/s";
+ return "speed: " + nstr(glm::length(lp.get_velocity())) + " b/s";
};
const auto make_velocity = [&]() -> std::string {
- return "velocity: (" + nstr(lp.velocity.x) + ", " +
- nstr(lp.velocity.y) + ", " + nstr(lp.velocity.z) + ")";
+ return "velocity: (" + nstr(lp.get_velocity().x) + ", " +
+ nstr(lp.get_velocity().y) + ", " + nstr(lp.get_velocity().z) +
+ ")";
+ };
+
+ const auto make_msg = [&]() -> std::string {
+ const auto& message = get_localplayer().get_message();
+ return "message: " + (message.has_value() ? message->text : "");
+ };
+
+ const auto make_biome = [&]() -> std::string {
+ const int x = static_cast<int>(lp.get_local_pos().x);
+ const int z = static_cast<int>(lp.get_local_pos().z);
+ const auto is_inside = [](const int val) {
+ return std::clamp(val, 0, shared::world::chunk::WIDTH) == val;
+ };
+ if (!is_inside(x) || !is_inside(z)) {
+ return "?";
+ }
+
+ const auto find_it = client::state::chunks.find(lp.get_chunk_pos());
+ if (find_it == std::end(client::state::chunks)) {
+ return "?";
+ }
+ const auto& chunk = find_it->second;
+ if (!chunk.has_value()) {
+ return "?";
+ }
+ return std::string{"biome: "} + chunk->get_biome(x, z);
};
// Draws all of our strings and works its way down the top of the screen.
@@ -139,15 +126,18 @@ static void draw_state_info(const shared::player& lp) noexcept {
draw_text(str, args);
args.pos.extent.y -= 0.02f;
};
- draw_str_trail("blockgame_linux v0.20");
+ draw_str_trail("blockgame_linux v0.22");
draw_str_trail(make_address());
+ draw_str_trail(make_tickrate());
draw_str_trail(make_seed());
- draw_str_trail(make_players());
+ draw_str_trail(make_entities());
draw_str_trail(make_chunks());
draw_str_trail(make_position());
draw_str_trail(make_direction());
draw_str_trail(make_speed());
draw_str_trail(make_velocity());
+ draw_str_trail(make_biome());
+ draw_str_trail(make_msg());
}
static void draw_fps() noexcept {
@@ -180,26 +170,38 @@ static void draw_overlay(const shared::player& lp) noexcept {
draw_fps();
}
-static void draw_main_pass(const shared::player& localplayer,
- client::players& players,
- client::world::chunk::map& chunks) noexcept {
- for (auto& chunk : chunks) {
- if (!chunk.second.has_value()) {
- continue;
+static void draw_main_pass(const client::player& localplayer,
+ client::entities_t& entities,
+ client::world::chunks_t& chunks) noexcept {
+
+ {
+ // zero means no limit
+ const unsigned chunks_per_frame =
+ client::settings::get<unsigned>({"video", "chunks_per_frame"}, 0u);
+ unsigned chunks_regenerated = 0u;
+ for (auto& chunk : chunks) {
+ if (!chunk.second.has_value()) {
+ continue;
+ }
+
+ const bool skip = chunks_per_frame == 0
+ ? false
+ : chunks_regenerated >= chunks_per_frame;
+ chunks_regenerated += chunk.second->draw(
+ chunks, localplayer, world::chunk::pass::solid, skip);
}
- chunk.second->draw(chunks, localplayer,
- client::world::chunk::pass::solid);
}
- // Draw players while ignoring the localplayer, which is always 0'th!
- // This also handles drawing messages.
- for (auto i = 1u; i < std::size(players); ++i) {
- players[i].draw_playermodel(localplayer);
+ for (const auto& [index, entity_ptr] : entities) {
+ if (index == localplayer.get_index()) {
+ continue;
+ }
+ entity_ptr->draw(localplayer);
}
}
-static void draw_water_pass(const shared::player& localplayer,
- client::world::chunk::map& chunks) noexcept {
+static void draw_water_pass(const client::player& localplayer,
+ client::world::chunks_t& chunks) noexcept {
for (auto& chunk : chunks) {
if (!chunk.second.has_value()) {
continue;
@@ -209,37 +211,33 @@ static void draw_water_pass(const shared::player& localplayer,
}
}
-static void draw_wts_text(const shared::player& localplayer,
- client::players& players) noexcept {
- for (auto i = 1u; i < std::size(players); ++i) {
- players[i].draw_message(localplayer);
+static void draw_wts_text(const client::player& localplayer,
+ client::entities_t& entities) noexcept {
+ for (const auto& [index, entity_ptr] : entities) {
+ if (index == localplayer.get_index()) {
+ continue;
+ }
+ entity_ptr->draw_wts(localplayer);
}
}
static void draw_hud(const client::player& localplayer,
- const client::world::chunk::map& chunks) noexcept {
- if (client::input::is_key_toggled(SDLK_F3)) {
+ const client::world::chunks_t& chunks) noexcept {
+ const auto should_draw_hud = !client::input::is_key_toggled(SDLK_F1);
+ if (client::input::is_key_toggled(SDLK_F3) && should_draw_hud) {
draw_overlay(localplayer);
}
- if (const auto& msg = localplayer.get_message(); msg.has_value()) {
- if (msg->receive_time + player::MSG_SHOW_TIME >=
- std::chrono::steady_clock::now()) {
- draw_text(msg->text, {.pos = relative_arg{.extent = {0.5f, 0.0f},
- .offset = {0.0f, 2.0f}},
- .extent_height = 0.0165f,
- .colour = {1.0f, 1.0f, 1.0f, 1.0f},
- .has_backing = true,
- .is_centered = true});
- }
+ if (client::window::is_open()) {
+ return;
}
- if (client::window::is_open()) {
+ if (!should_draw_hud) {
return;
}
// crosshair
- client::draw::draw_rectangle(
+ client::render::draw_rectangle(
{.pos = {.extent = {0.5f, 0.5f}, .offset = {-3.0f, -3.0f}},
.size = {.offset = {6.0f, 6.0f}},
.colour = {1.0f, 1.0f, 1.0f, 1.0f}});
@@ -250,10 +248,10 @@ static void draw_hud(const client::player& localplayer,
interact.has_value()) {
const auto [world_x, world_z] = [&]() -> std::pair<float, float> {
- const float offset_x =
- static_cast<float>(interact->first.x - localplayer.chunk_pos.x);
- const float offset_z =
- static_cast<float>(interact->first.z - localplayer.chunk_pos.z);
+ const float offset_x = static_cast<float>(
+ interact->first.x - localplayer.get_chunk_pos().x);
+ const float offset_z = static_cast<float>(
+ interact->first.z - localplayer.get_chunk_pos().z);
return {offset_x * shared::world::chunk::WIDTH,
offset_z * shared::world::chunk::WIDTH};
}();
@@ -275,20 +273,19 @@ static void update_camera(const shared::player& localplayer) noexcept {
// bit of maths for calculating the max distance we could can see
client::render::camera::get_zfar() = std::hypot(
static_cast<float>(world::chunk::HEIGHT),
- float(client::state.draw_distance) * std::hypot(16.0f, 16.0f));
+ float(client::state::draw_distance) * std::hypot(16.0f, 16.0f));
client::render::camera::get_pos() =
- localplayer.local_pos +
+ localplayer.get_local_pos() +
glm::vec3{0.0f, shared::player::EYE_HEIGHT, 0.0f};
- client::render::camera::get_front() =
- shared::math::angle_to_dir(localplayer.viewangles);
+ client::render::camera::get_front() = localplayer.get_angles().to_dir();
client::render::camera::update();
}
// We create framebuffer here to enable postprocessing and solve some
// rendering problems.
-static void draw_buffers(const shared::player& localplayer,
- client::players& players,
- client::world::chunk::map& chunks) noexcept {
+static void draw_buffers(const client::player& localplayer,
+ client::entities_t& entities,
+ client::world::chunks_t& chunks) noexcept {
const auto make_vbo = [](const auto& vertices) -> GLuint {
GLuint vbo = 0;
glGenBuffers(1, &vbo);
@@ -367,7 +364,7 @@ static void draw_buffers(const shared::player& localplayer,
// We render our main scene on the main framebuffer.
glBindFramebuffer(GL_FRAMEBUFFER, fbo_main);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- draw_main_pass(localplayer, players, chunks);
+ draw_main_pass(localplayer, entities, chunks);
// We render our water scene on the water framebuffer.
glBindFramebuffer(GL_FRAMEBUFFER, fbo_water);
@@ -375,7 +372,7 @@ static void draw_buffers(const shared::player& localplayer,
const bool is_underwater = [&]() -> bool {
const glm::ivec3 pos{client::render::camera::get_pos()};
- const auto find_it = chunks.find(localplayer.chunk_pos);
+ const auto find_it = chunks.find(localplayer.get_chunk_pos());
if (find_it == std::end(chunks) || !find_it->second.has_value()) {
return false;
}
@@ -412,21 +409,20 @@ static void draw_buffers(const shared::player& localplayer,
glEnable(GL_DEPTH_TEST);
}
-void draw(client::players& players,
- client::world::chunk::map& chunks) noexcept {
- const auto& localplayer = client::get_localplayer(players);
+void draw(entities_t& entities, world::chunks_t& chunks) noexcept {
+ const auto& localplayer = get_localplayer();
update_camera(localplayer);
client::render::update_uniforms();
- draw_buffers(localplayer, players, chunks);
+ draw_buffers(localplayer, entities, chunks);
draw_hud(localplayer, chunks);
- draw_wts_text(localplayer, players);
+ draw_wts_text(localplayer, entities);
client::window::draw();
client::render::swap_window();
}
-} // namespace draw
+} // namespace render
} // namespace client
diff --git a/src/client/render/draw.hh b/src/client/render/draw.hh
new file mode 100644
index 0000000..bf43224
--- /dev/null
+++ b/src/client/render/draw.hh
@@ -0,0 +1,30 @@
+#ifndef CLIENT_RENDER_DRAW_HH_
+#define CLIENT_RENDER_DRAW_HH_
+
+#include <string_view>
+
+#include <glm/glm.hpp>
+
+#include "client/entity/player.hh"
+#include "client/input.hh"
+#include "client/movement/movement.hh"
+#include "client/render/camera.hh"
+#include "client/render/program.hh"
+#include "client/render/render.hh"
+#include "client/render/struct.hh"
+#include "client/settings.hh"
+#include "client/shared.hh"
+#include "client/window/hud_window.hh"
+#include "client/window/window.hh"
+#include "client/world/chunk.hh"
+
+namespace client {
+namespace render {
+
+void draw(client::entities_t& players,
+ client::world::chunks_t& chunks) noexcept;
+
+} // namespace render
+} // namespace client
+
+#endif
diff --git a/src/client/render/render.cc b/src/client/render/render.cc
index 18aa32a..941988d 100644
--- a/src/client/render/render.cc
+++ b/src/client/render/render.cc
@@ -27,7 +27,7 @@ SDL_Window* const& get_sdl_window() noexcept {
std::bind(SDL_GL_SetAttribute, SDL_GL_CONTEXT_MINOR_VERSION, 2));
SDL_Window* const ret =
- SDL_CreateWindow("blockgame_linux", 0, 0, 0, 0,
+ SDL_CreateWindow("blockgame_linux", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0,
SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN_DESKTOP |
SDL_WINDOW_BORDERLESS);
check_sdl_pointer(ret);
@@ -124,6 +124,71 @@ void swap_window() noexcept {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
+// Additional sanity checks for our atlas.
+static void check_atlas(const client::render::texture& texture) {
+ if (texture.width % 6) {
+ throw std::runtime_error("invalid atlas; WIDTH is not divisible by 6");
+ }
+ if (texture.height % (texture.width / 6)) {
+ throw std::runtime_error(
+ "invalid atlas, HEIGHT is not divisible by (WIDTH / 6)");
+ }
+}
+
+GLuint get_texture_atlas() noexcept {
+ static const auto atlas = []() -> GLuint {
+ GLuint texture = 0;
+ glActiveTexture(GL_TEXTURE1);
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D_ARRAY, texture);
+
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S,
+ GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T,
+ GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_ANISOTROPY, 16.0f);
+
+ const client::render::texture stbi{"res/textures/atlas.png"};
+ check_atlas(stbi);
+ const int face_size = stbi.width / 6;
+
+ // 2D texture array, where our depth is our block face.
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, face_size, face_size,
+ 6 * (stbi.height / face_size), 0,
+ stbi.channels == 3 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE,
+ nullptr);
+
+ // Fill the 2D texture array.
+ // Because our image has multiple images on the x-axis and opengl
+ // expects a single image per axis, we must fill it in row by row.
+ const auto get_pixel_xy = [&stbi](const int x, const int y) {
+ return stbi.image + 4 * (y * stbi.width + x);
+ };
+ for (int x = 0; x < 6; ++x) {
+ const int x_pixel = x * face_size;
+
+ for (int y = 0; y < stbi.height / face_size; ++y) {
+ const int y_pixel = y * face_size;
+
+ for (auto row = 0; row < face_size; ++row) {
+ glTexSubImage3D(
+ GL_TEXTURE_2D_ARRAY, 0, 0, row, x + y * 6, face_size, 1,
+ 1, GL_RGBA, GL_UNSIGNED_BYTE,
+ get_pixel_xy(x_pixel, row + y_pixel)); // pixel
+ }
+ }
+ }
+
+ glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
+
+ return texture;
+ }();
+ return atlas;
+}
+
void render_cube_outline(const glm::vec3& pos,
const glm::vec4& colour) noexcept {
const auto generate_vbo = [](const auto& vertices) -> GLuint {
@@ -427,6 +492,8 @@ public:
font_atlas(const unsigned size) noexcept
: font_size(size), texture(make_texture_info(size)) {}
~font_atlas() noexcept { glDeleteTextures(1, &this->texture.texture); }
+ font_atlas(font_atlas&&) = delete;
+ font_atlas(const font_atlas&) = delete;
GLint get_height() const noexcept { return this->texture.height; }
GLint get_width() const noexcept { return this->texture.width; }
@@ -578,25 +645,71 @@ void update_uniforms() noexcept {
};
static const GLuint ubo = make_ubo();
- ubo_data upload = {.proj = camera::get_proj(),
- .view = camera::get_view(),
- .frustum = camera::get_frustum(),
- .znear = camera::get_znear(),
- .zfar = camera::get_zfar(),
- .xfov = glm::radians(camera::get_xfov()),
- .yfov = glm::radians(camera::get_yfov()),
- .time = []() -> unsigned {
- static const auto start =
- std::chrono::steady_clock::now();
- const auto now = std::chrono::steady_clock::now();
- return static_cast<unsigned>(
- (now - start) / std::chrono::milliseconds(1));
- }(),
- .xwindow = static_cast<float>(get_window_size().x),
- .ywindow = static_cast<float>(get_window_size().y)};
+ const ubo_data upload = {
+ .proj = camera::get_proj(),
+ .view = camera::get_view(),
+ .frustum = camera::get_frustum(),
+ .znear = camera::get_znear(),
+ .zfar = camera::get_zfar(),
+ .xfov = glm::radians(camera::get_xfov()),
+ .yfov = glm::radians(camera::get_yfov()),
+ .time = []() -> unsigned {
+ static const auto start = std::chrono::steady_clock::now();
+ const auto now = std::chrono::steady_clock::now();
+ return static_cast<unsigned>((now - start) /
+ std::chrono::milliseconds(1));
+ }(),
+ .xwindow = static_cast<float>(get_window_size().x),
+ .ywindow = static_cast<float>(get_window_size().y)};
glBindBuffer(GL_UNIFORM_BUFFER, ubo);
glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(upload), &upload);
}
+void draw_rectangle(const rectangle_args& ra) noexcept {
+ const glm::vec2 pos = ra.pos.to_vec2();
+ const glm::vec2 size = ra.size.to_vec2();
+
+ // We want to render from the bottom left corner.
+ render::render_rectangle(pos + (size / 2.0f), size, ra.colour);
+}
+
+void draw_colour(const glm::vec4& colour) noexcept {
+ const rectangle_args args = {
+ .pos = {.extent = {0.0f, 0.0f}},
+ .size = {.extent = {1.0f, 1.0f}},
+ .colour = colour,
+ };
+ draw_rectangle(args);
+}
+
+void draw_text(const std::string_view text, const text_args& args) noexcept {
+ const glm::vec2& window = render::get_window_size();
+ const float x = floorf(window.x * args.pos.extent.x + args.pos.offset.x);
+ const float y = floorf(window.y * args.pos.extent.y + args.pos.offset.y);
+ const unsigned height = static_cast<unsigned>(
+ args.extent_height * window.y + args.offset_height);
+
+ const auto make_matrix = [&](const float xo, const float yo) -> glm::mat4 {
+ constexpr auto identity = glm::mat4(1.0f);
+ const auto proj = glm::ortho(0.f, window.x, 0.f, window.y);
+ const auto tran =
+ glm::translate(identity, glm::vec3{x + xo, y + yo, 0.0f});
+ return proj * tran;
+ };
+
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_BLEND);
+ if (args.has_backing) {
+ constexpr glm::vec4 black{0.0f, 0.0f, 0.0f, 1.0f};
+ render_text(text, height, args.is_centered, args.is_vcentered, black,
+ make_matrix(2.0f, -2.0f));
+ }
+ glEnable(GL_BLEND);
+
+ render_text(text, height, args.is_centered, args.is_vcentered, args.colour,
+ make_matrix(0, 0));
+ glEnable(GL_DEPTH_TEST);
+}
+
} // namespace render
} // namespace client
diff --git a/src/client/render/render.hh b/src/client/render/render.hh
index ca98e6f..c98043a 100644
--- a/src/client/render/render.hh
+++ b/src/client/render/render.hh
@@ -27,8 +27,10 @@
#include "client/render/camera.hh"
#include "client/render/program.hh"
+#include "client/render/struct.hh"
+#include "client/render/texture.hh"
#include "shared/shared.hh"
-#include "shared/world.hh"
+#include "shared/world/chunk.hh"
namespace client {
namespace render {
@@ -40,6 +42,7 @@ void quit() noexcept;
int get_fps() noexcept;
SDL_Window* const& get_sdl_window() noexcept;
const glm::ivec2& get_window_size() noexcept;
+GLuint get_texture_atlas() noexcept;
// Update
void update_uniforms() noexcept;
@@ -54,7 +57,26 @@ void render_text(const std::string_view text, const unsigned int size,
void render_cube_outline(const glm::vec3& pos,
const glm::vec4& colour) noexcept;
+// Draw is similar to render but more abstracted.
+void draw_colour(const glm::vec4& colour) noexcept;
+struct rectangle_args {
+ relative_arg pos;
+ relative_arg size;
+ glm::vec4 colour;
+};
+void draw_rectangle(const rectangle_args& args) noexcept;
+
+struct text_args {
+ relative_arg pos;
+ float extent_height; // we don't get width here,
+ float offset_height;
+ glm::vec4 colour;
+ bool has_backing;
+ bool is_centered;
+ bool is_vcentered;
+};
+void draw_text(const std::string_view text, const text_args& args) noexcept;
} // namespace render
} // namespace client
diff --git a/src/client/render/struct.cc b/src/client/render/struct.cc
new file mode 100644
index 0000000..a7a1b5d
--- /dev/null
+++ b/src/client/render/struct.cc
@@ -0,0 +1 @@
+#include "client/render/struct.hh"
diff --git a/src/client/render/struct.hh b/src/client/render/struct.hh
new file mode 100644
index 0000000..fd00ffd
--- /dev/null
+++ b/src/client/render/struct.hh
@@ -0,0 +1,29 @@
+#ifndef CLIENT_RENDER_STRUCT_HH_
+#define CLIENT_RENDER_STRUCT_HH_
+
+//#include <client/render/render.hh>
+#include <glm/glm.hpp>
+
+namespace client {
+namespace render {
+
+const glm::ivec2& get_window_size() noexcept; // forward declaration
+
+// Scale takes the range [0, 1] and represents an amount of the screen.
+// Offset is any value that is added after scale.
+struct relative_arg {
+ glm::vec2 extent;
+ glm::vec2 offset;
+
+ glm::vec2 to_vec2() const noexcept {
+ const glm::vec2& window = render::get_window_size();
+ const float x = this->extent.x * window.x + this->offset.x;
+ const float y = this->extent.y * window.y + this->offset.y;
+ return {x, y};
+ }
+};
+
+} // namespace render
+} // namespace client
+
+#endif
diff --git a/src/client/settings.cc b/src/client/settings.cc
index 8e2d0c9..3253f60 100644
--- a/src/client/settings.cc
+++ b/src/client/settings.cc
@@ -9,7 +9,7 @@ const char* const config_name = "blockgame_linux.conf";
namespace client {
namespace settings {
-static std::string get_settings_file() noexcept {
+static std::string get_settings_file() {
std::filesystem::create_directories(home_dir + ::config_dir);
std::ifstream in{home_dir + ::config_dir + config_name,
std::fstream::in | std::fstream::app};
@@ -20,7 +20,7 @@ static std::string get_settings_file() noexcept {
return file.ends_with('\n') ? file : file + '\n';
}
-static void set_settings_file(const std::string_view contents) noexcept {
+static void set_settings_file(const std::string_view contents) {
std::filesystem::create_directories(home_dir + ::config_dir);
std::ofstream out{home_dir + ::config_dir + ::config_name,
std::fstream::out | std::fstream::trunc};
@@ -31,7 +31,7 @@ static void set_settings_file(const std::string_view contents) noexcept {
// Heading maps setting to headings (ie, "camera -> {map with fov, 100.0f}).
using value_map = std::unordered_map<std::string, std::string>;
using setting_map = std::unordered_map<std::string, value_map>;
-static setting_map& get_settings() noexcept {
+static setting_map& get_settings() {
static setting_map ret = []() -> setting_map {
setting_map settings{};
@@ -50,8 +50,9 @@ static setting_map& get_settings() noexcept {
const size_t split_pos = line.find_first_of(':');
if (split_pos == std::string::npos) {
- shared::print::warn("client: failed to parse line in settings "
- "file, consider manual intervention\n");
+ shared::print::warn
+ << "client: failed to parse line in settings file, "
+ "consider manual intervention\n";
continue;
}
@@ -72,10 +73,21 @@ static setting_map& get_settings() noexcept {
return ret;
}
-// TODO fix this bit of code duplication
-std::string
-get_setting_str(const std::pair<const std::string&, const std::string&> loc,
- const std::string default_value) noexcept {
+std::optional<std::string> maybe_get_setting_str(const setting_pair_t& loc) {
+ const auto& [heading, name] = loc;
+
+ setting_map& settings = get_settings();
+ value_map& values = settings[heading];
+
+ const auto it = values.find(name);
+ if (it == std::end(values)) {
+ return std::nullopt;
+ }
+ return it->second;
+}
+
+std::string get_setting_str(const setting_pair_t& loc,
+ const std::string default_value) {
const auto& [heading, name] = loc;
setting_map& settings = get_settings();
@@ -89,9 +101,7 @@ get_setting_str(const std::pair<const std::string&, const std::string&> loc,
return find_it->second;
}
-void set_setting_str(
- const std::pair<const std::string&, const std::string&> loc,
- const std::string& value) noexcept {
+void set_setting_str(const setting_pair_t& loc, const std::string& value) {
const auto& [heading, name] = loc;
setting_map& settings = get_settings();
@@ -105,7 +115,7 @@ void set_setting_str(
find_it->second = value;
}
-void save() noexcept {
+void save() {
std::string contents;
const setting_map& settings = get_settings();
diff --git a/src/client/settings.hh b/src/client/settings.hh
index d65022b..11b785c 100644
--- a/src/client/settings.hh
+++ b/src/client/settings.hh
@@ -9,7 +9,7 @@
#include <boost/lexical_cast.hpp>
-#include "client/shared.hh"
+//#include "client/shared.hh"
#include "shared/shared.hh"
// This settings file just provides functionality for persistent variables,
@@ -18,20 +18,20 @@
namespace client {
namespace settings {
-void set_setting_str(
- const std::pair<const std::string&, const std::string&> loc,
- const std::string& value) noexcept;
+using setting_pair_t = std::pair<std::string, std::string>;
-std::string
-get_setting_str(const std::pair<const std::string&, const std::string&> loc,
- const std::string default_value) noexcept;
+std::optional<std::string> maybe_get_setting_str(const setting_pair_t&);
+
+void set_setting_str(const setting_pair_t& loc, const std::string& value);
+
+std::string get_setting_str(const setting_pair_t& loc,
+ const std::string default_value);
// Attempts to read the setting in the file, returning it if it exists.
// If either name or category does not exist, writes the default value in
// the file under the expected headings.
template <typename T>
-T get(const std::pair<const std::string, const std::string>& loc,
- const T& default_value) noexcept {
+T get(const setting_pair_t& loc, const T& default_value) {
const std::string value =
get_setting_str(loc, boost::lexical_cast<std::string>(default_value));
return boost::lexical_cast<T>(value);
@@ -40,12 +40,11 @@ T get(const std::pair<const std::string, const std::string>& loc,
// Attempts to set the setting in the file, overwriting the pre-existing
// value or writing a new entry.
template <typename T>
-void set(const std::pair<const std::string, const std::string>& loc,
- const T& value) noexcept {
+void set(const setting_pair_t& loc, const T& value) {
set_setting_str(loc, boost::lexical_cast<std::string>(value));
}
-void save() noexcept;
+void save();
} // namespace settings
} // namespace client
diff --git a/src/client/shared.cc b/src/client/shared.cc
index 3c6a2ec..0346e3d 100644
--- a/src/client/shared.cc
+++ b/src/client/shared.cc
@@ -1 +1,18 @@
#include "shared.hh"
+
+namespace client {
+
+entities_t::iterator get_entity_it(const std::uint32_t& index) noexcept {
+ return client::state::entities.find(index);
+}
+
+shared::entity& get_entity(const std::uint32_t index) noexcept {
+ return *get_entity_it(index)->second;
+}
+
+client::player& get_localplayer() noexcept {
+ return dynamic_cast<client::player&>(
+ get_entity(*client::state::localplayer_index));
+}
+
+} // namespace client
diff --git a/src/client/shared.hh b/src/client/shared.hh
index 557d13a..31c0ded 100644
--- a/src/client/shared.hh
+++ b/src/client/shared.hh
@@ -1,28 +1,14 @@
#ifndef CLIENT_SHARED_HH_
#define CLIENT_SHARED_HH_
-#include <cstdint>
-#include <string_view>
-
-#include "shared/net/connection.hh"
+#include "client/entity/player.hh"
+#include "client/state/entities.hh"
namespace client {
-struct state {
- std::string_view address;
- std::string_view port;
- std::uint64_t seed;
- std::uint32_t localplayer;
- std::size_t player_count;
- std::size_t requested_chunk_count;
- std::size_t networked_chunk_count;
- std::int32_t draw_distance;
- std::uint16_t latency;
-
- shared::net::connection* connection = nullptr;
-};
-
-inline state state;
+entities_t::iterator get_entity_it(const std::uint32_t& index) noexcept;
+shared::entity& get_entity(const std::uint32_t index) noexcept;
+client::player& get_localplayer() noexcept;
}; // namespace client
diff --git a/src/client/state/chunks.cc b/src/client/state/chunks.cc
new file mode 100644
index 0000000..470c552
--- /dev/null
+++ b/src/client/state/chunks.cc
@@ -0,0 +1 @@
+#include "client/state/chunks.hh"
diff --git a/src/client/state/chunks.hh b/src/client/state/chunks.hh
new file mode 100644
index 0000000..e0d4d82
--- /dev/null
+++ b/src/client/state/chunks.hh
@@ -0,0 +1,18 @@
+#ifndef CLIENT_STATE_CHUNKS_HH_
+#define CLIENT_STATE_CHUNKS_HH_
+
+#include <memory>
+#include <unordered_map>
+
+#include "client/world/chunk.hh"
+
+namespace client {
+namespace state {
+
+inline client::world::chunks_t chunks{4096, shared::world::chunk::hash,
+ shared::world::chunk::equal};
+
+} // namespace state
+} // namespace client
+
+#endif
diff --git a/src/client/state/entities.cc b/src/client/state/entities.cc
new file mode 100644
index 0000000..efb3533
--- /dev/null
+++ b/src/client/state/entities.cc
@@ -0,0 +1 @@
+#include "client/state/entities.hh"
diff --git a/src/client/state/entities.hh b/src/client/state/entities.hh
new file mode 100644
index 0000000..3c807b9
--- /dev/null
+++ b/src/client/state/entities.hh
@@ -0,0 +1,21 @@
+#ifndef CLIENT_STATE_ENTITIES_HH_
+#define CLIENT_STATE_ENTITIES_HH_
+
+#include <memory>
+#include <unordered_map>
+
+#include "client/entity/entity.hh"
+
+namespace client {
+
+using entities_t = std::unordered_map<shared::entity::index_t,
+ std::unique_ptr<client::entity>>;
+
+namespace state {
+
+inline entities_t entities;
+
+} // namespace state
+} // namespace client
+
+#endif
diff --git a/src/client/state/state.cc b/src/client/state/state.cc
new file mode 100644
index 0000000..2423c9a
--- /dev/null
+++ b/src/client/state/state.cc
@@ -0,0 +1,15 @@
+#include "client/state/state.hh"
+
+namespace client {
+namespace state {
+
+shared::time_duration_t get_time_per_tick() noexcept {
+ return std::chrono::microseconds(1'000'000) / tickrate;
+}
+
+bool has_initialised() noexcept {
+ return state::localplayer_index.has_value();
+}
+
+} // namespace state
+} // namespace client
diff --git a/src/client/state/state.hh b/src/client/state/state.hh
new file mode 100644
index 0000000..cfbb440
--- /dev/null
+++ b/src/client/state/state.hh
@@ -0,0 +1,41 @@
+#ifndef CLIENT_STATE_STATE_HH_
+#define CLIENT_STATE_STATE_HH_
+
+#include <optional>
+
+#include "shared/entity/entity.hh"
+#include "shared/net/connection.hh"
+#include "shared/shared.hh"
+
+namespace client {
+namespace state {
+
+inline std::string_view address;
+inline std::string_view port;
+inline std::uint64_t seed;
+inline std::size_t player_count;
+inline std::size_t requested_chunk_count;
+inline std::size_t networked_chunk_count;
+inline std::int32_t draw_distance;
+inline std::int32_t chunks_per_frame;
+inline std::uint32_t tickrate;
+
+inline shared::tick_t tick;
+inline float delta_ticks; // num ticks since the last tick, [0, inf)
+shared::time_duration_t get_time_per_tick() noexcept;
+
+// Speed of the client's move ticks should be 1.0f but if we're too slow (or the
+// server lags and we're too fast) this value should move to speed up the client
+// somewhat gracefully.
+inline float time_factor = 1.0f;
+
+inline shared::net::connection* connection = nullptr;
+
+// non-opt after init
+inline std::optional<shared::entity::index_t> localplayer_index;
+bool has_initialised() noexcept;
+
+} // namespace state
+} // namespace client
+
+#endif
diff --git a/src/client/window.cc b/src/client/window.cc
deleted file mode 100644
index 6a11252..0000000
--- a/src/client/window.cc
+++ /dev/null
@@ -1,449 +0,0 @@
-#include "window.hh"
-
-namespace client {
-namespace window {
-
-// All window objects should derive from basic_window, and make use of multiple
-// inheritance for specific behaviours.
-class basic_window {
-protected:
- // Colours borrowed from arc-dark(er).
- static constexpr glm::vec3 primary_clr{0.21f, 0.23f, 0.29f}; // dark
- static constexpr glm::vec3 secondary_clr{0.29f, 0.32f, 0.38f}; // less dark
- static constexpr glm::vec3 tertiary_clr{0.48, 0.50, 0.54}; // less dark ^2
- static constexpr glm::vec3 highlight_clr{0.32, 0.58, 0.88}; // light blue
- static constexpr glm::vec3 font_colour{0.88, 0.88, 0.88}; // light grey
-
-protected:
- glm::vec2 pos;
- glm::vec2 size;
-
-public:
- bool is_inside(const glm::vec2& v) const noexcept {
- if (v.x < this->pos.x || v.x > this->pos.x + this->size.x) {
- return false;
- }
- if (v.y < this->pos.y || v.y > this->pos.y + this->size.y) {
- return false;
- }
- return true;
- }
-
-public:
- basic_window(const client::draw::relative_arg& p,
- const client::draw::relative_arg& s) noexcept
- : pos(p.to_vec2()), size(s.to_vec2()) {}
- virtual ~basic_window() noexcept {}
-
- virtual bool maybe_handle_event(const SDL_Event&) noexcept { return false; }
- virtual void draw() noexcept {
- client::draw::draw_rectangle({.pos = {.offset = this->pos + 6.0f},
- .size = {.offset = this->size},
- .colour = {this->tertiary_clr, 0.9f}});
- client::draw::draw_rectangle({.pos = {.offset = this->pos},
- .size = {.offset = this->size},
- .colour = {this->primary_clr, 1.0f}});
- }
-};
-
-static void remove_top_layer() noexcept;
-class text_input_window : public basic_window {
-private:
- // text restricted to a size of 32.
- static const std::string& get_send_text() noexcept {
- auto& text = client::input::state.text_input;
- text = std::string{std::begin(text),
- std::begin(text) +
- static_cast<long>(std::min(
- std::size(text), shared::MAX_SAY_LENGTH))};
- return text;
- }
- static bool maybe_handle_keydown(const SDL_Event& event) noexcept {
- if (event.key.keysym.sym == SDLK_BACKSPACE) {
- if (!client::input::state.text_input.empty()) {
- client::input::state.text_input.pop_back();
- }
- return true;
- }
-
- if (event.key.keysym.sym != SDLK_RETURN || event.key.repeat) {
- return false;
- }
-
- if (!client::input::state.text_input.empty()) {
- client::send_say_packet(get_send_text());
- }
-
- remove_top_layer(); // DELETE ME
- return true;
- }
- static const glm::vec3& get_draw_colour() noexcept {
- if (client::input::state.text_input.length() >=
- shared::MAX_SAY_LENGTH) {
- return basic_window::highlight_clr;
- }
- return basic_window::primary_clr;
- }
-
-public:
- template <typename... Args>
- text_input_window(Args&&... args) noexcept
- : basic_window(std::forward<Args>(args)...) {
- client::input::set_text_input(true);
- }
- virtual ~text_input_window() noexcept {
- client::input::set_text_input(false);
- }
- virtual bool maybe_handle_event(const SDL_Event& event) noexcept override {
- switch (event.type) {
- case SDL_KEYDOWN:
- return this->maybe_handle_keydown(event);
- }
-
- return basic_window::maybe_handle_event(event);
- }
-
- virtual void draw() noexcept override {
- basic_window::draw();
-
- client::draw::draw_rectangle(
- {.pos = {.offset = this->pos},
- .size = {.offset = this->size},
- .colour = {this->get_draw_colour(), 1.0f}});
-
- client::draw::draw_text(
- this->get_send_text(),
- {.pos = {.extent = {0.0f, 0.0f},
- .offset = this->pos + (this->size / 2.0f)},
- .offset_height = this->size.y / 2.0f,
- .colour = {this->font_colour, 1.0f},
- .has_backing = false,
- .is_centered = true,
- .is_vcentered = true});
- };
-};
-
-class button_window : public basic_window {
-protected:
- std::string name;
- std::function<void()> callback;
- bool is_pressed;
-
-private:
- void handle_mousebuttondown(const SDL_Event& event) noexcept {
- if (event.button.button != SDL_BUTTON_LEFT) {
- return;
- }
- this->is_pressed = true;
- }
- void handle_mousebuttonup(const SDL_Event& event) noexcept {
- if (event.button.button != SDL_BUTTON_LEFT) {
- return;
- }
- if (!this->is_pressed) {
- return;
- }
- this->is_pressed = false;
- std::invoke(this->callback); // edge
- }
- const glm::vec3& get_draw_colour() noexcept {
- if (!this->is_inside(client::input::state.mouse_pos)) {
- this->is_pressed = false;
- return this->primary_clr;
- }
-
- if (!this->is_pressed) {
- return this->secondary_clr;
- }
-
- return this->highlight_clr;
- }
-
-public:
- template <typename... Args>
- button_window(const std::string_view n, const decltype(callback)& c,
- Args&&... args) noexcept
- : basic_window(std::forward<Args>(args)...), name(n), callback(c) {}
-
- virtual bool maybe_handle_event(const SDL_Event& event) noexcept override {
- if (this->is_inside(client::input::state.mouse_pos)) {
- switch (event.type) {
- case SDL_MOUSEBUTTONDOWN:
- this->handle_mousebuttondown(event);
- return true;
- case SDL_MOUSEBUTTONUP:
- this->handle_mousebuttonup(event);
- return true;
- }
- }
-
- return basic_window::maybe_handle_event(event);
- }
- virtual void draw() noexcept override {
- basic_window::draw();
-
- client::draw::draw_rectangle(
- {.pos = {.offset = this->pos},
- .size = {.offset = this->size},
- .colour = {this->get_draw_colour(), 1.0f}});
- client::draw::draw_text(
- this->name, {.pos = {.extent = {0.0f, 0.0f},
- .offset = this->pos + (this->size / 2.0f)},
- .offset_height = this->size.y / 2.0f,
- .colour = {this->font_colour, 1.0f},
- .has_backing = false,
- .is_centered = true,
- .is_vcentered = true});
- };
-};
-
-// Sliders are for numerical values of some type T.
-// TODO
-/*
-template <typename T>
-class slider_window : public basic_window {
-protected:
- std::string name;
- T min;
- T cur;
- T max;
- T& var;
-
-private:
- void handle_mousebuttondown(const SDL_Event& event) noexcept {}
- void handle_mousebuttonup(const SDL_Event& event) noexcept {}
-
-public:
- template <typename... Args>
- slider_window(const std::string_view name, const T& min, const T& cur,
- const T& max, T& var, Args&&... args) noexcept
- : basic_window(std::forward<Args>(args)...), name(name), min(min),
- cur(cur), max(max), var(var) {}
-
- // slider_window(
- virtual bool maybe_handle_event(const SDL_Event& event) noexcept
-override { switch (event.type) { case SDL_MOUSEBUTTONDOWN:
- this->handle_mousebuttondown(event);
- return true;
- case SDL_MOUSEBUTTONUP:
- this->handle_mousebuttonup(event);
- return true;
- }
- return basic_window::maybe_handle_event(event);
- }
- virtual void draw() noexcept override { basic_window::draw(); }
-};
-*/
-
-static void handle_event(const SDL_Event& event) noexcept; // ignore
-
-// All windows go in this list!
-using layer = std::forward_list<std::unique_ptr<basic_window>>;
-using layers = std::forward_list<layer>;
-static layers& get_layers() noexcept {
- // We callbacks for our window manager are initialised here too.
- static layers ret = []() -> layers {
- client::input::register_event_handler(&handle_event);
- client::input::set_text_input(false);
- client::input::set_mouse_relative(true);
- return {};
- }();
- return ret;
-}
-
-static void remove_top_layer() noexcept {
- if (!get_layers().empty()) {
- get_layers().pop_front();
- }
- // Our windows might be empty here, so set our mouse mode accordingly.
- if (!client::window::is_open()) {
- client::input::set_mouse_relative(true);
- }
-}
-
-// Constants used for uniform ui sizes.
-constexpr glm::vec2 lsize_extent{0.4, 0.075};
-constexpr glm::vec2 ssize_extent{0.15, 0.075};
-
-static void center_mouse_position() noexcept {
- const glm::vec2& window = client::render::get_window_size();
- client::input::set_mouse_position({window.x / 2.0f, window.y / 2.0f});
-}
-
-template <typename T, typename... Args>
-void push_window(Args&&... args) noexcept {
- get_layers().front().push_front(
- std::make_unique<T>(std::forward<Args>(args)...));
-}
-
-constexpr glm::vec2 center_extent(const glm::vec2 pos,
- const glm::vec2 size) noexcept {
- return {pos.x, pos.y - size.y / 2.0f};
-}
-
-static void make_options_menu() noexcept {
- get_layers().push_front({});
-
- /*
- push_window<::slider_window<float>>(
- "Field of Vision", 0.0f,
- settings::get(std::make_pair("gameplay", "fov"), 100.0f), 145.0f,
- remove_top_layer,
- client::draw::relative_arg{.extent =
- center_extent({0.3, 0.7},
- lsize_extent)}, client::draw::relative_arg{.extent = lsize_extent});
- */
-
- push_window<button_window>(
- "Back", remove_top_layer,
- client::draw::relative_arg{.extent =
- center_extent({0.3, 0.3}, ssize_extent)},
- client::draw::relative_arg{.extent = ssize_extent});
-}
-
-static void make_main_menu() noexcept {
- get_layers().push_front({});
-
- push_window<button_window>(
- "Return to Game", remove_top_layer,
- client::draw::relative_arg{.extent =
- center_extent({0.3, 0.7}, lsize_extent)},
- client::draw::relative_arg{.extent = lsize_extent});
-
- push_window<button_window>(
- "Options", make_options_menu,
- client::draw::relative_arg{
- .extent = center_extent({0.55, 0.6}, ssize_extent)},
- client::draw::relative_arg{.extent = ssize_extent});
-
- push_window<button_window>(
- "?", remove_top_layer,
- client::draw::relative_arg{
- .extent = center_extent({0.55, 0.5}, ssize_extent)},
- client::draw::relative_arg{.extent = ssize_extent});
-
- push_window<button_window>(
- "?", remove_top_layer,
- client::draw::relative_arg{
- .extent = center_extent({0.55, 0.4}, ssize_extent)},
- client::draw::relative_arg{.extent = ssize_extent});
-
- push_window<button_window>(
- "Exit Game", [] { shared::should_exit = true; },
- client::draw::relative_arg{.extent =
- center_extent({0.3, 0.3}, lsize_extent)},
- client::draw::relative_arg{.extent = lsize_extent});
-
- client::input::set_mouse_relative(false);
- center_mouse_position();
-}
-
-static void make_chat_window() noexcept {
- get_layers().push_front({});
-
- push_window<text_input_window>(
- client::draw::relative_arg{.extent =
- center_extent({0.3, 0.3}, lsize_extent)},
- client::draw::relative_arg{.extent = lsize_extent});
-
- client::input::set_mouse_relative(false);
- center_mouse_position();
-}
-
-static void handle_meta_return() noexcept {
- if (!is_open()) {
- make_chat_window();
- return;
- }
-}
-
-static void handle_meta_escape() noexcept {
- if (!is_open()) {
- make_main_menu();
- return;
- }
-
- remove_top_layer();
-}
-
-static void handle_meta_keydown(const SDL_Event& event) noexcept {
- if (event.key.repeat) { // only handle keypresses
- return;
- }
-
- switch (event.key.keysym.sym) {
- case SDLK_ESCAPE:
- handle_meta_escape();
- break;
- case SDLK_RETURN:
- handle_meta_return();
- break;
- }
-}
-
-static void handle_meta_mousemotion(const SDL_Event& event) noexcept {
- // We convert SDL's weird coordinates into useful ones (0,0 = bottom
- // left).
- client::input::state.mouse_pos = {
- event.motion.x,
- static_cast<int>(client::render::get_window_size().y) - event.motion.y};
-}
-
-static void handle_meta_windowevent(const SDL_Event& event) noexcept {
- if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
- if (!is_open()) {
- make_main_menu();
- return;
- }
- }
-}
-
-static void handle_meta_event(const SDL_Event& event) noexcept {
- switch (event.type) {
- case SDL_KEYDOWN:
- handle_meta_keydown(event);
- break;
- case SDL_MOUSEMOTION:
- handle_meta_mousemotion(event);
- break;
- case SDL_WINDOWEVENT:
- handle_meta_windowevent(event);
- break;
- }
-}
-
-static void handle_event(const SDL_Event& event) noexcept {
- // We ALWAYS update our mouse position.
- if (event.type == SDL_MOUSEMOTION) {
- handle_meta_mousemotion(event);
- }
-
- // Either a window consumes our event, or no window does - so we send
- // the event to our "meta handler" which does things like closing
- // windows etc.
- if (is_open()) {
- for (const auto& window : get_layers().front()) {
- if (window->maybe_handle_event(event)) {
- return;
- }
- }
- }
-
- handle_meta_event(event);
-}
-
-void draw() noexcept {
- if (!is_open()) {
- return;
- }
-
- client::draw::draw_colour({0.0f, 0.0f, 0.0f, 0.10f}); // very light shade
- for (const auto& window : get_layers().front()) {
- window->draw();
- }
-}
-
-bool is_open() noexcept { return !get_layers().empty(); }
-
-} // namespace window
-} // namespace client
diff --git a/src/client/window/basic_window.cc b/src/client/window/basic_window.cc
new file mode 100644
index 0000000..c96f94a
--- /dev/null
+++ b/src/client/window/basic_window.cc
@@ -0,0 +1,33 @@
+#include "client/window/basic_window.hh"
+
+namespace client {
+namespace window {
+
+using bw = basic_window;
+
+bool bw::is_inside(const glm::vec2& v, const glm::vec2& p,
+ const glm::vec2& s) noexcept {
+ if (v.x < p.x || v.x > p.x + s.x) {
+ return false;
+ }
+ if (v.y < p.y || v.y > p.y + s.y) {
+ return false;
+ }
+ return true;
+}
+
+bool bw::is_inside(const glm::vec2& v) const noexcept {
+ return is_inside(v, this->pos, this->size);
+}
+
+void bw::draw() noexcept {
+ client::render::draw_rectangle({.pos = {.offset = this->pos + 6.0f},
+ .size = {.offset = this->size},
+ .colour = {this->tertiary_clr, 0.9f}});
+ client::render::draw_rectangle({.pos = {.offset = this->pos},
+ .size = {.offset = this->size},
+ .colour = {this->primary_clr, 1.0f}});
+}
+
+} // namespace window
+} // namespace client
diff --git a/src/client/window/basic_window.hh b/src/client/window/basic_window.hh
new file mode 100644
index 0000000..292cc64
--- /dev/null
+++ b/src/client/window/basic_window.hh
@@ -0,0 +1,52 @@
+#ifndef CLIENT_WINDOW_BASIC_WINDOW_HH_
+#define CLIENT_WINDOW_BASIC_WINDOW_HH_
+
+#include <glm/glm.hpp>
+
+#include "client/entity/player.hh"
+#include "client/render/render.hh"
+#include "client/render/struct.hh"
+
+namespace client {
+namespace window {
+
+// All window objects should derive from basic_window, and make use of multiple
+// inheritance for specific behaviours.
+class basic_window {
+protected:
+ // Colours borrowed from arc-dark(er).
+ static constexpr glm::vec3 primary_clr{0.21f, 0.23f, 0.29f}; // dark
+ static constexpr glm::vec3 secondary_clr{0.29f, 0.32f, 0.38f}; // less dark
+ static constexpr glm::vec3 tertiary_clr{0.48, 0.50, 0.54}; // less dark ^2
+ static constexpr glm::vec3 highlight_clr{0.32, 0.58, 0.88}; // light blue
+ static constexpr glm::vec3 font_colour{0.88, 0.88, 0.88}; // light grey
+
+protected:
+ static constexpr float OUTLINE_WIDTH = 2.0f;
+ float get_item_size() const noexcept { return this->size.x / 10.0f; }
+
+protected:
+ glm::vec2 pos;
+ glm::vec2 size;
+
+public:
+ // Test if a vec2 v is inside a square starting at position p with size s.
+ static bool is_inside(const glm::vec2& v, const glm::vec2& p,
+ const glm::vec2& s) noexcept;
+ // Test if v is inside this->pos, this->size
+ bool is_inside(const glm::vec2& v) const noexcept;
+
+public:
+ basic_window(const client::render::relative_arg& pos,
+ const client::render::relative_arg& size) noexcept
+ : pos(pos.to_vec2()), size(size.to_vec2()) {}
+ virtual ~basic_window() noexcept {}
+
+ virtual bool maybe_handle_event(const SDL_Event&) noexcept { return false; }
+ virtual void draw() noexcept;
+};
+
+} // namespace window
+} // namespace client
+
+#endif
diff --git a/src/client/window/button_window.cc b/src/client/window/button_window.cc
new file mode 100644
index 0000000..4743c0a
--- /dev/null
+++ b/src/client/window/button_window.cc
@@ -0,0 +1,71 @@
+#include "client/window/button_window.hh"
+
+namespace client {
+namespace window {
+
+using bw = class button_window;
+
+void bw::handle_mousebuttondown(const SDL_Event& event) noexcept {
+ if (event.button.button != SDL_BUTTON_LEFT) {
+ return;
+ }
+ this->is_pressed = true;
+}
+
+void bw::handle_mousebuttonup(const SDL_Event& event) noexcept {
+ if (event.button.button != SDL_BUTTON_LEFT) {
+ return;
+ }
+ if (!this->is_pressed) {
+ return;
+ }
+ this->is_pressed = false;
+ std::invoke(this->callback); // edge
+}
+
+const glm::vec3& bw::get_draw_colour() noexcept {
+ if (!this->is_inside(client::input::state.mouse_pos)) {
+ this->is_pressed = false;
+ return this->primary_clr;
+ }
+
+ if (!this->is_pressed) {
+ return this->secondary_clr;
+ }
+
+ return this->highlight_clr;
+}
+
+bool bw::maybe_handle_event(const SDL_Event& event) noexcept {
+ if (this->is_inside(client::input::state.mouse_pos)) {
+ switch (event.type) {
+ case SDL_MOUSEBUTTONDOWN:
+ this->handle_mousebuttondown(event);
+ return true;
+ case SDL_MOUSEBUTTONUP:
+ this->handle_mousebuttonup(event);
+ return true;
+ }
+ }
+
+ return basic_window::maybe_handle_event(event);
+}
+
+void bw::draw() noexcept {
+ basic_window::draw();
+
+ client::render::draw_rectangle({.pos = {.offset = this->pos},
+ .size = {.offset = this->size},
+ .colour = {this->get_draw_colour(), 1.0f}});
+ client::render::draw_text(
+ this->name, {.pos = {.extent = {0.0f, 0.0f},
+ .offset = this->pos + (this->size / 2.0f)},
+ .offset_height = this->size.y / 2.0f,
+ .colour = {this->font_colour, 1.0f},
+ .has_backing = false,
+ .is_centered = true,
+ .is_vcentered = true});
+};
+
+} // namespace window
+} // namespace client
diff --git a/src/client/window/button_window.hh b/src/client/window/button_window.hh
new file mode 100644
index 0000000..6847696
--- /dev/null
+++ b/src/client/window/button_window.hh
@@ -0,0 +1,40 @@
+#ifndef CLIENT_WINDOW_BUTTON_WINDOW_HH_
+#define CLIENT_WINDOW_BUTTON_WINDOW_HH_
+
+#include <functional>
+#include <string>
+
+#include "client/input.hh"
+#include "client/render/render.hh"
+#include "client/window/basic_window.hh"
+
+namespace client {
+namespace window {
+
+class button_window : public basic_window {
+protected:
+ std::string name;
+ std::function<void()> callback;
+ bool is_pressed;
+
+private:
+ void handle_mousebuttondown(const SDL_Event& event) noexcept;
+ void handle_mousebuttonup(const SDL_Event& event) noexcept;
+ const glm::vec3& get_draw_colour() noexcept;
+
+public:
+ template <typename... Args>
+ button_window(const std::string_view n, const decltype(callback)& c,
+ Args&&... args) noexcept
+ : basic_window(std::forward<Args>(args)...), name(n), callback(c),
+ is_pressed(false) {}
+ virtual ~button_window() noexcept {}
+
+ virtual bool maybe_handle_event(const SDL_Event& event) noexcept override;
+ virtual void draw() noexcept override;
+};
+
+} // namespace window
+} // namespace client
+
+#endif
diff --git a/src/client/window/hud_window.cc b/src/client/window/hud_window.cc
new file mode 100644
index 0000000..52995ca
--- /dev/null
+++ b/src/client/window/hud_window.cc
@@ -0,0 +1,88 @@
+#include "client/window/hud_window.hh"
+
+namespace client {
+namespace window {
+
+using hw = class hud_window;
+bool hw::maybe_handle_keydown(const SDL_Event& event) noexcept {
+ const auto& sym = event.key.keysym.sym;
+ const auto index = static_cast<int>(sym);
+
+ const auto min = static_cast<int>(SDLK_0);
+ const auto max = static_cast<int>(SDLK_9);
+ if (index < min || index > max) {
+ return false;
+ }
+
+ const auto active =
+ static_cast<std::uint32_t>((((sym - min) - 1) + 10) % 10);
+ client::get_localplayer().get_mutable_active_item() = active;
+ return true;
+}
+
+bool hw::maybe_handle_event(const SDL_Event& event) noexcept {
+ if (is_open()) {
+ return false;
+ }
+
+ switch (event.type) {
+ case SDL_KEYDOWN:
+ return this->maybe_handle_keydown(event);
+ default:
+ break;
+ }
+ return false;
+}
+
+void hw::draw() noexcept {
+ this->basic_window::draw();
+
+ const float item_size = this->get_item_size();
+
+ const auto& localplayer = client::get_localplayer();
+ client::render::draw_rectangle(
+ {.pos = {.offset = {this->pos.x + static_cast<float>(
+ localplayer.get_active_item()) *
+ item_size,
+ this->pos.y}},
+ .size = {.offset = {item_size, item_size}},
+ .colour = {this->secondary_clr, 1.0f}});
+
+ for (int i = 1; i < shared::player::INVENTORY_COLS; ++i) {
+ const float off = item_size * static_cast<float>(i);
+ client::render::draw_rectangle(
+ {.pos = {.offset = {this->pos.x + off,
+ this->pos.y + OUTLINE_WIDTH}},
+ .size = {.offset = {OUTLINE_WIDTH,
+ item_size - 2.0f * OUTLINE_WIDTH}},
+ .colour = {this->tertiary_clr, 1.0f}});
+ }
+
+ const auto& inventory = localplayer.inventory;
+ for (int x = 0; x < shared::player::INVENTORY_COLS; ++x) {
+ const auto& item = inventory.contents[static_cast<unsigned long>(x)];
+ if (item == nullptr) {
+ continue;
+ }
+
+ const glm::vec2 off{glm::vec2{x, 0} * item_size};
+ const auto item_ptr = dynamic_cast<client::item::item*>(&*item);
+ if (item_ptr == nullptr) {
+ continue;
+ }
+ item_ptr->draw(this->pos + off, glm::vec2{item_size, item_size});
+
+ client::render::draw_text(
+ std::to_string(item->quantity),
+ {.pos = {.offset = this->pos + off +
+ glm::vec2{item_size * 0.75f, item_size * 0.2f}},
+ .offset_height = item_size * 0.40f,
+ .colour = {this->font_colour, 1.0f},
+ .has_backing = false,
+ .is_centered = true,
+ .is_vcentered = true});
+ }
+}
+
+} // namespace window
+} // namespace client
diff --git a/src/client/window/hud_window.hh b/src/client/window/hud_window.hh
new file mode 100644
index 0000000..7c03e0e
--- /dev/null
+++ b/src/client/window/hud_window.hh
@@ -0,0 +1,32 @@
+#ifndef CLIENT_WINDOW_HUD_WINDOW_HH_
+#define CLIENT_WINDOW_HUD_WINDOW_HH_
+
+#include "client/render/struct.hh"
+#include "client/window/basic_window.hh"
+#include "client/window/window.hh"
+#include "shared/entity/player.hh"
+
+namespace client {
+namespace window {
+
+class hud_window : public basic_window {
+
+private:
+ bool maybe_handle_keydown(const SDL_Event& event) noexcept;
+
+public:
+ template <typename... Args>
+ hud_window(const float size) noexcept
+ : basic_window(
+ client::render::relative_arg{.extent = {0.5f, 0.0f},
+ .offset = {-size / 2.0f, 0.0f}},
+ client::render::relative_arg{.offset = {size, size / 10.0f}}) {}
+
+ virtual void draw() noexcept override;
+ virtual bool maybe_handle_event(const SDL_Event& event) noexcept override;
+};
+
+} // namespace window
+} // namespace client
+
+#endif
diff --git a/src/client/window/inventory_window.cc b/src/client/window/inventory_window.cc
new file mode 100644
index 0000000..5023f1d
--- /dev/null
+++ b/src/client/window/inventory_window.cc
@@ -0,0 +1,196 @@
+#include "client/window/inventory_window.hh"
+
+namespace client {
+namespace window {
+
+using iw = class inventory_window;
+
+bool iw::maybe_handle_mousebuttondown(const SDL_Event& event) noexcept {
+
+ if (event.button.button != SDL_BUTTON_LEFT) {
+ return false;
+ }
+ if (!this->is_inside(client::input::state.mouse_pos)) {
+ return false;
+ }
+
+ const auto index =
+ this->maybe_get_inventory_index(client::input::state.mouse_pos);
+ if (!index.has_value()) {
+ return false;
+ }
+
+ const auto& inventory = client::get_localplayer().inventory;
+ if (inventory.contents[*index] != nullptr) {
+ this->grabbed.emplace(*index);
+ }
+ return true;
+}
+
+static proto::packet make_swap_packet(const std::uint32_t& a,
+ const std::uint32_t& b) noexcept {
+ proto::packet ret;
+ const auto packet = ret.mutable_item_swap_packet();
+ packet->set_index_a(a);
+ packet->set_index_b(b);
+ return ret;
+}
+
+bool iw::maybe_handle_mousebuttonup(const SDL_Event& event) noexcept {
+
+ if (event.button.button != SDL_BUTTON_LEFT) {
+ return false;
+ }
+ if (!this->grabbed.has_value()) {
+ return false;
+ }
+
+ if (const auto index =
+ this->maybe_get_inventory_index(input::state.mouse_pos);
+ index.has_value() && index != *grabbed) {
+
+ auto& inventory = client::get_localplayer().inventory;
+ std::swap(inventory.contents[*grabbed], inventory.contents[*index]);
+
+ // replicate on server
+ state::connection->rsend_packet(
+ make_swap_packet(static_cast<std::uint32_t>(*grabbed),
+ static_cast<std::uint32_t>(*index)));
+ }
+
+ this->grabbed.reset();
+ return true;
+}
+
+std::optional<unsigned long>
+iw::maybe_get_inventory_index(const glm::vec2& pos) const noexcept {
+
+ const float item_size = this->get_item_size();
+ for (int x = 0; x < shared::player::INVENTORY_COLS; ++x) {
+ for (int y = 0; y < shared::player::INVENTORY_ROWS; ++y) {
+ const glm::vec2 off{this->pos +
+ glm::vec2{OUTLINE_WIDTH, OUTLINE_WIDTH} +
+ glm::vec2{x, y} * item_size};
+ if (!basic_window::is_inside(pos, off,
+ glm::vec2{item_size, item_size})) {
+ continue;
+ }
+ return x + y * shared::player::INVENTORY_COLS;
+ }
+ }
+ return std::nullopt;
+}
+
+bool iw::maybe_handle_event(const SDL_Event& event) noexcept {
+ switch (event.type) {
+ case SDL_MOUSEBUTTONDOWN:
+ return this->maybe_handle_mousebuttondown(event);
+ case SDL_MOUSEBUTTONUP:
+ return this->maybe_handle_mousebuttonup(event);
+ }
+
+ return basic_window::maybe_handle_event(event);
+}
+
+void iw::draw() noexcept {
+ basic_window::draw();
+
+ const float item_size = this->get_item_size();
+
+ const auto& localplayer = client::get_localplayer();
+ client::render::draw_rectangle(
+ {.pos = {.offset = {this->pos.x + static_cast<float>(
+ localplayer.get_active_item()) *
+ item_size,
+ this->pos.y}},
+ .size = {.offset = {item_size, item_size}},
+ .colour = {this->secondary_clr, 1.0f}});
+ for (int i = 1; i < shared::player::INVENTORY_COLS; ++i) {
+ const float off = item_size * static_cast<float>(i);
+ client::render::draw_rectangle(
+ {.pos = {.offset = {this->pos.x + off,
+ this->pos.y + OUTLINE_WIDTH}},
+ .size = {.offset = {OUTLINE_WIDTH,
+ item_size * shared::player::INVENTORY_ROWS -
+ OUTLINE_WIDTH}},
+ .colour = {this->tertiary_clr, 1.0f}});
+
+ if (i <= shared::player::INVENTORY_ROWS) {
+ client::render::draw_rectangle(
+ {.pos = {.offset = {pos.x + OUTLINE_WIDTH, pos.y + off}},
+ .size = {.offset = {this->size.x - 2.0f * OUTLINE_WIDTH,
+ OUTLINE_WIDTH}},
+ .colour = {this->tertiary_clr, 1.0f}});
+ }
+ }
+
+ const auto& inventory = localplayer.inventory;
+ if (const auto index =
+ this->maybe_get_inventory_index(client::input::state.mouse_pos);
+ index.has_value()) {
+ const glm::vec2 off{glm::vec2{*index % shared::player::INVENTORY_COLS,
+ *index / shared::player::INVENTORY_COLS} *
+ item_size};
+ client::render::draw_rectangle(
+ {.pos = {.offset = this->pos + off +
+ glm::vec2{OUTLINE_WIDTH, OUTLINE_WIDTH}},
+ .size = {.offset = glm::vec2{item_size, item_size} -
+ glm::vec2{OUTLINE_WIDTH, OUTLINE_WIDTH}},
+ .colour = {this->secondary_clr, 1.0f}});
+ }
+
+ for (int x = 0; x < shared::player::INVENTORY_COLS; ++x) {
+ for (int y = 0; y < shared::player::INVENTORY_ROWS; ++y) {
+ const auto index = static_cast<unsigned long>(
+ x + y * shared::player::INVENTORY_COLS);
+ const auto& item = inventory.contents[index];
+ if (item == nullptr) {
+ continue;
+ }
+ if (this->grabbed.has_value() && *this->grabbed == index) {
+ continue;
+ }
+
+ const glm::vec2 off{glm::vec2{x, y} * item_size};
+ const auto item_ptr = dynamic_cast<client::item::item*>(&*item);
+ if (item_ptr == nullptr) {
+ continue;
+ }
+ item_ptr->draw(this->pos + off, glm::vec2{item_size, item_size});
+
+ client::render::draw_text(
+ std::to_string(item->quantity),
+ {.pos = {.offset =
+ this->pos + off +
+ glm::vec2{item_size * 0.75f, item_size * 0.2f}},
+ .offset_height = item_size * 0.40f,
+ .colour = {this->font_colour, 1.0f},
+ .has_backing = false,
+ .is_centered = true,
+ .is_vcentered = true});
+ }
+ }
+
+ if (this->grabbed.has_value()) {
+ const auto item_ptr =
+ dynamic_cast<client::item::item*>(&*inventory.contents[*grabbed]);
+ if (item_ptr != nullptr) {
+ item_ptr->draw(client::input::state.mouse_pos -
+ glm::vec2{item_size, item_size} * 0.5f,
+ glm::vec2{item_size, item_size});
+ client::render::draw_text(
+ std::to_string(item_ptr->quantity),
+ {.pos = {.offset =
+ client::input::state.mouse_pos +
+ glm::vec2{item_size * 0.25f, item_size * -0.3f}},
+ .offset_height = item_size * 0.40f,
+ .colour = {this->font_colour, 1.0f},
+ .has_backing = false,
+ .is_centered = true,
+ .is_vcentered = true});
+ }
+ }
+}
+
+} // namespace window
+} // namespace client
diff --git a/src/client/window/inventory_window.hh b/src/client/window/inventory_window.hh
new file mode 100644
index 0000000..a77ae2f
--- /dev/null
+++ b/src/client/window/inventory_window.hh
@@ -0,0 +1,40 @@
+#ifndef CLIENT_WINDOW_INVENTORY_WINDOW_HH_
+#define CLIENT_WINDOW_INVENTORY_WINDOW_HH_
+
+#include <cstdint>
+#include <optional>
+
+#include "client/item/item.hh"
+#include "client/render/draw.hh"
+#include "client/state/state.hh"
+#include "client/window/basic_window.hh"
+
+namespace client {
+namespace window {
+
+class inventory_window : public basic_window {
+private:
+ std::optional<unsigned long> grabbed;
+
+private:
+ std::optional<unsigned long>
+ maybe_get_inventory_index(const glm::vec2& pos) const noexcept;
+
+private:
+ bool maybe_handle_mousebuttondown(const SDL_Event& event) noexcept;
+ bool maybe_handle_mousebuttonup(const SDL_Event& event) noexcept;
+
+public:
+ template <typename... Args>
+ inventory_window(Args&&... args) noexcept
+ : basic_window(std::forward<Args>(args)...) {}
+ virtual ~inventory_window() noexcept {}
+
+ virtual bool maybe_handle_event(const SDL_Event& event) noexcept override;
+ virtual void draw() noexcept override;
+};
+
+} // namespace window
+} // namespace client
+
+#endif
diff --git a/src/client/window/text_input_window.cc b/src/client/window/text_input_window.cc
new file mode 100644
index 0000000..0d556a4
--- /dev/null
+++ b/src/client/window/text_input_window.cc
@@ -0,0 +1,81 @@
+#include "client/window/text_input_window.hh"
+
+namespace client {
+namespace window {
+
+using tiw = class text_input_window;
+
+const std::string& tiw::get_send_text() noexcept {
+ auto& text = client::input::state.text_input;
+ text = std::string{std::begin(text),
+ std::begin(text) +
+ static_cast<long>(std::min(std::size(text),
+ shared::MAX_SAY_LENGTH))};
+ return text;
+}
+
+proto::packet tiw::make_say_packet() noexcept {
+ proto::packet packet;
+
+ const auto sub_say_packet = packet.mutable_say_packet();
+ sub_say_packet->set_text(get_send_text());
+
+ return packet;
+}
+
+bool tiw::maybe_handle_keydown(const SDL_Event& event) noexcept {
+ if (event.key.keysym.sym == SDLK_BACKSPACE) {
+ if (!client::input::state.text_input.empty()) {
+ client::input::state.text_input.pop_back();
+ }
+ return true;
+ }
+
+ if (event.key.keysym.sym != SDLK_RETURN || event.key.repeat) {
+ return false;
+ }
+
+ if (!client::input::state.text_input.empty()) {
+ client::state::connection->rsend_packet(make_say_packet());
+ }
+
+ pop_window();
+ return true;
+}
+
+const glm::vec3& tiw::get_draw_colour() noexcept {
+ if (client::input::state.text_input.length() >= shared::MAX_SAY_LENGTH) {
+ return basic_window::highlight_clr;
+ }
+ return basic_window::primary_clr;
+}
+
+bool tiw::maybe_handle_event(const SDL_Event& event) noexcept {
+ switch (event.type) {
+ case SDL_KEYDOWN:
+ return this->maybe_handle_keydown(event);
+ }
+
+ return basic_window::maybe_handle_event(event);
+}
+
+void tiw::draw() noexcept {
+ basic_window::draw();
+
+ client::render::draw_rectangle({.pos = {.offset = this->pos},
+ .size = {.offset = this->size},
+ .colour = {this->get_draw_colour(), 1.0f}});
+
+ client::render::draw_text(
+ this->get_send_text(),
+ {.pos = {.extent = {0.0f, 0.0f},
+ .offset = this->pos + (this->size / 2.0f)},
+ .offset_height = this->size.y / 2.0f,
+ .colour = {this->font_colour, 1.0f},
+ .has_backing = false,
+ .is_centered = true,
+ .is_vcentered = true});
+};
+
+} // namespace window
+} // namespace client
diff --git a/src/client/window/text_input_window.hh b/src/client/window/text_input_window.hh
new file mode 100644
index 0000000..edff672
--- /dev/null
+++ b/src/client/window/text_input_window.hh
@@ -0,0 +1,43 @@
+#ifndef CLIENT_WINDOW_TEXT_INPUT_WINDOW_HH_
+#define CLIENT_WINDOW_TEXT_INPUT_WINDOW_HH_
+
+#include <string>
+
+#include "client/input.hh"
+#include "client/shared.hh"
+#include "client/state/state.hh"
+#include "client/window/basic_window.hh"
+#include "shared/net/proto.hh"
+
+namespace client {
+namespace window {
+
+void pop_window() noexcept; // forward declaration
+
+class text_input_window : public basic_window {
+private:
+ // text restricted to a size of 32.
+ static const std::string& get_send_text() noexcept;
+ static proto::packet make_say_packet() noexcept;
+
+ static bool maybe_handle_keydown(const SDL_Event& event) noexcept;
+ static const glm::vec3& get_draw_colour() noexcept;
+
+public:
+ template <typename... Args>
+ text_input_window(Args&&... args) noexcept
+ : basic_window(std::forward<Args>(args)...) {
+ client::input::set_text_input(true);
+ }
+ virtual ~text_input_window() noexcept {
+ client::input::set_text_input(false);
+ }
+ virtual bool maybe_handle_event(const SDL_Event& event) noexcept override;
+
+ virtual void draw() noexcept override;
+};
+
+} // namespace window
+} // namespace client
+
+#endif
diff --git a/src/client/window/window.cc b/src/client/window/window.cc
new file mode 100644
index 0000000..648997f
--- /dev/null
+++ b/src/client/window/window.cc
@@ -0,0 +1,318 @@
+#include "window.hh"
+
+namespace client {
+namespace window {
+
+// TODO
+
+// Sliders are for numerical values of some type T.
+// TODO
+/*
+template <typename T>
+class slider_window : public basic_window {
+protected:
+ std::string name;
+ T min;
+ T cur;
+ T max;
+ T& var;
+
+private:
+ void handle_mousebuttondown(const SDL_Event& event) noexcept {}
+ void handle_mousebuttonup(const SDL_Event& event) noexcept {}
+
+public:
+ template <typename... Args>
+ slider_window(const std::string_view name, const T& min, const T& cur,
+ const T& max, T& var, Args&&... args) noexcept
+ : basic_window(std::forward<Args>(args)...), name(name), min(min),
+ cur(cur), max(max), var(var) {}
+
+ // slider_window(
+ virtual bool maybe_handle_event(const SDL_Event& event) noexcept
+override { switch (event.type) { case SDL_MOUSEBUTTONDOWN:
+ this->handle_mousebuttondown(event);
+ return true;
+ case SDL_MOUSEBUTTONUP:
+ this->handle_mousebuttonup(event);
+ return true;
+ }
+ return basic_window::maybe_handle_event(event);
+ }
+ virtual void draw() noexcept override { basic_window::draw(); }
+};
+*/
+
+static void handle_event(const SDL_Event& event) noexcept; // ignore
+
+static hud_window& get_hud_window() noexcept {
+ static hud_window ret = []() {
+ const auto& window = client::render::get_window_size();
+ const float size = std::min(static_cast<float>(window.x) / 2.0f,
+ static_cast<float>(window.y) / 2.0f);
+ client::window::hud_window ret{size};
+ return ret;
+ }();
+ return ret;
+}
+
+// All dynamic windows go in this list!
+using layer = std::forward_list<std::unique_ptr<basic_window>>;
+using layers = std::forward_list<layer>;
+static layers& get_layers() noexcept {
+ // We callbacks for our window manager are initialised here too.
+ static layers ret = []() -> layers {
+ client::input::register_event_handler(&handle_event);
+ client::input::set_text_input(false);
+ client::input::set_mouse_relative(true);
+ return {};
+ }();
+ return ret;
+}
+
+void pop_window() noexcept {
+ if (!get_layers().empty()) {
+ get_layers().pop_front();
+ }
+ // Our windows might be empty here, so set our mouse mode accordingly.
+ if (!client::window::is_open()) {
+ client::input::set_mouse_relative(true);
+ }
+}
+
+// Constants used for uniform ui sizes.
+constexpr glm::vec2 lsize_extent{0.4, 0.075};
+constexpr glm::vec2 ssize_extent{0.15, 0.075};
+
+static void center_mouse_position() noexcept {
+ const glm::vec2& window = client::render::get_window_size();
+ client::input::set_mouse_position({window.x / 2.0f, window.y / 2.0f});
+}
+
+template <typename T, typename... Args>
+void push_window(Args&&... args) noexcept {
+ get_layers().front().push_front(
+ std::make_unique<T>(std::forward<Args>(args)...));
+}
+
+constexpr glm::vec2 center_extent(const glm::vec2 pos,
+ const glm::vec2 size) noexcept {
+ return {pos.x, pos.y - size.y / 2.0f};
+}
+
+static void make_options_menu() noexcept {
+ get_layers().push_front({});
+
+ /*
+ push_window<::slider_window<float>>(
+ "Field of Vision", 0.0f,
+ settings::get(std::make_pair("gameplay", "fov"), 100.0f), 145.0f,
+ pop_window,
+ client::draw::relative_arg{.extent =
+ center_extent({0.3, 0.7},
+ lsize_extent)}, client::draw::relative_arg{.extent = lsize_extent});
+ */
+
+ push_window<button_window>(
+ "Back", pop_window,
+ client::render::relative_arg{
+ .extent = center_extent({0.3, 0.3}, ssize_extent)},
+ client::render::relative_arg{.extent = ssize_extent});
+}
+
+static void make_main_menu() noexcept {
+ get_layers().push_front({});
+
+ push_window<button_window>(
+ "Return to Game", pop_window,
+ client::render::relative_arg{
+ .extent = center_extent({0.3, 0.7}, lsize_extent)},
+ client::render::relative_arg{.extent = lsize_extent});
+
+ push_window<button_window>(
+ "Options", make_options_menu,
+ client::render::relative_arg{
+ .extent = center_extent({0.55, 0.6}, ssize_extent)},
+ client::render::relative_arg{.extent = ssize_extent});
+
+ push_window<button_window>(
+ "?", pop_window,
+ client::render::relative_arg{
+ .extent = center_extent({0.55, 0.5}, ssize_extent)},
+ client::render::relative_arg{.extent = ssize_extent});
+
+ push_window<button_window>(
+ "?", pop_window,
+ client::render::relative_arg{
+ .extent = center_extent({0.55, 0.4}, ssize_extent)},
+ client::render::relative_arg{.extent = ssize_extent});
+
+ push_window<button_window>(
+ "Exit Game", [] { shared::should_exit = true; },
+ client::render::relative_arg{
+ .extent = center_extent({0.3, 0.3}, lsize_extent)},
+ client::render::relative_arg{.extent = lsize_extent});
+
+ client::input::set_mouse_relative(false);
+ center_mouse_position();
+}
+
+static void make_chat_window() noexcept {
+ get_layers().push_front({});
+
+ push_window<text_input_window>(
+ client::render::relative_arg{
+ .extent = center_extent({0.3, 0.3}, lsize_extent)},
+ client::render::relative_arg{.extent = lsize_extent});
+
+ client::input::set_mouse_relative(false);
+ center_mouse_position();
+}
+
+static void make_inventory_window() noexcept {
+ get_layers().push_front({});
+
+ const glm::vec2& window = client::render::get_window_size();
+
+ const float size = std::min(window.x / 2.0f, window.y / 2.0f);
+ const glm::vec2 pos{(window - size) / 2.0f};
+
+ push_window<inventory_window>(
+ client::render::relative_arg{.offset = pos},
+ client::render::relative_arg{.offset = glm::vec2{size, size}});
+ client::input::set_mouse_relative(false);
+ center_mouse_position();
+}
+
+static void handle_meta_return() noexcept {
+ if (!is_open()) {
+ make_chat_window();
+ return;
+ }
+}
+
+static void handle_meta_escape() noexcept {
+ if (!is_open()) {
+ make_main_menu();
+ return;
+ }
+
+ pop_window();
+}
+
+static void handle_meta_e() noexcept {
+ if (!is_open()) {
+ make_inventory_window();
+ return;
+ }
+
+ // The inventory window must be open.
+ if (!dynamic_cast<inventory_window*>(&*get_layers().front().front())) {
+ return;
+ }
+
+ pop_window();
+}
+
+static void handle_meta_keydown(const SDL_Event& event) noexcept {
+ if (event.key.repeat) { // only handle keypresses
+ return;
+ }
+
+ switch (event.key.keysym.sym) {
+ case SDLK_ESCAPE:
+ handle_meta_escape();
+ break;
+ case SDLK_RETURN:
+ handle_meta_return();
+ break;
+ case SDLK_e:
+ handle_meta_e();
+ break;
+ case SDLK_0:
+ case SDLK_1:
+ case SDLK_2:
+ case SDLK_3:
+ case SDLK_4:
+ case SDLK_5:
+ case SDLK_6:
+ case SDLK_7:
+ case SDLK_8:
+ case SDLK_9:
+ get_hud_window().maybe_handle_event(event);
+ default:
+ break;
+ }
+}
+
+static void handle_meta_mousemotion(const SDL_Event& event) noexcept {
+ // We convert SDL's weird coordinates into useful ones (0,0 = bottom
+ // left).
+ client::input::state.mouse_pos = {
+ event.motion.x,
+ static_cast<int>(client::render::get_window_size().y) - event.motion.y};
+}
+
+static void handle_meta_windowevent(const SDL_Event& event) noexcept {
+ if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
+ if (!is_open()) {
+ make_main_menu();
+ return;
+ }
+ }
+}
+
+static void handle_meta_event(const SDL_Event& event) noexcept {
+ switch (event.type) {
+ case SDL_KEYDOWN:
+ handle_meta_keydown(event);
+ break;
+ case SDL_MOUSEMOTION:
+ handle_meta_mousemotion(event);
+ break;
+ case SDL_WINDOWEVENT:
+ handle_meta_windowevent(event);
+ break;
+ }
+}
+
+static void handle_event(const SDL_Event& event) noexcept {
+ // We ALWAYS update our mouse position.
+ if (event.type == SDL_MOUSEMOTION) {
+ handle_meta_mousemotion(event);
+ }
+
+ // Either a window consumes our event, or no window does - so we send
+ // the event to our "meta handler" which does things like closing
+ // windows etc.
+ if (is_open()) {
+ for (const auto& window : get_layers().front()) {
+ if (window->maybe_handle_event(event)) {
+ return;
+ }
+ }
+ }
+
+ handle_meta_event(event);
+}
+
+void draw() noexcept {
+ if (!is_open()) {
+
+ if (!client::input::is_key_toggled(SDLK_F1)) {
+ get_hud_window().draw();
+ }
+
+ return;
+ }
+
+ client::render::draw_colour({0.0f, 0.0f, 0.0f, 0.10f}); // very light shade
+ for (const auto& window : get_layers().front()) {
+ window->draw();
+ }
+}
+
+bool is_open() noexcept { return !get_layers().empty(); }
+
+} // namespace window
+} // namespace client
diff --git a/src/client/window.hh b/src/client/window/window.hh
index 094c4ca..d112d18 100644
--- a/src/client/window.hh
+++ b/src/client/window/window.hh
@@ -1,5 +1,5 @@
-#ifndef CLIENT_WINDOW_HH_
-#define CLIENT_WINDOW_HH_
+#ifndef CLIENT_WINDOW_WINDOW_HH_
+#define CLIENT_WINDOW_WINDOW_HH_
#include <algorithm>
#include <forward_list>
@@ -13,17 +13,25 @@
#include <glm/glm.hpp>
#include "client/client.hh"
-#include "client/draw.hh"
#include "client/input.hh"
+#include "client/render/render.hh"
#include "client/settings.hh"
+#include "client/window/basic_window.hh"
+#include "client/window/button_window.hh"
+#include "client/window/hud_window.hh"
+#include "client/window/inventory_window.hh"
+#include "client/window/text_input_window.hh"
#include "shared/shared.hh"
namespace client {
namespace window {
-void draw() noexcept;
+// removes the topmost window
+void pop_window() noexcept;
bool is_open() noexcept;
+void draw() noexcept;
+
} // namespace window
} // namespace client
diff --git a/src/client/world.cc b/src/client/world.cc
deleted file mode 100644
index 1ceb9fb..0000000
--- a/src/client/world.cc
+++ /dev/null
@@ -1,429 +0,0 @@
-#include "world.hh"
-
-namespace client {
-namespace world {
-
-// Additional sanity checks for our atlas.
-static void check_atlas(const client::render::texture& texture) {
- if (texture.width % 6) {
- throw std::runtime_error("invalid atlas; WIDTH is not divisible by 6");
- }
- if (texture.height % (texture.width / 6)) {
- throw std::runtime_error(
- "invalid atlas, HEIGHT is not divisible by (WIDTH / 6)");
- }
-}
-
-void chunk::render(const float world_x, const float world_z,
- const pass& pass) noexcept {
- const auto make_texture = []() -> GLuint {
- GLuint texture = 0;
- glActiveTexture(GL_TEXTURE1);
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D_ARRAY, texture);
-
- glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S,
- GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T,
- GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_ANISOTROPY, 16.0f);
-
- const client::render::texture stbi{"res/textures/atlas.png"};
- check_atlas(stbi);
- const int face_size = stbi.width / 6;
-
- // 2D texture array, where our depth is our block face.
- glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, face_size, face_size,
- 6 * (stbi.height / face_size), 0,
- stbi.channels == 3 ? GL_RGB : GL_RGBA, GL_UNSIGNED_BYTE,
- nullptr);
-
- // Fill the 2D texture array.
- // Because our image has multiple images on the x-axis and opengl
- // expects a single image per axis, we must fill it in row by row.
- const auto get_pixel_xy = [&stbi](const int x, const int y) {
- return stbi.image + 4 * (y * stbi.width + x);
- };
- for (int x = 0; x < 6; ++x) {
- const int x_pixel = x * face_size;
-
- for (int y = 0; y < stbi.height / face_size; ++y) {
- const int y_pixel = y * face_size;
-
- for (auto row = 0; row < face_size; ++row) {
- glTexSubImage3D(
- GL_TEXTURE_2D_ARRAY, 0, 0, row, x + y * 6, face_size, 1,
- 1, GL_RGBA, GL_UNSIGNED_BYTE,
- get_pixel_xy(x_pixel, row + y_pixel)); // pixel
- }
- }
- }
-
- glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
-
- return texture;
- };
- const auto make_matrix = [&]() -> glm::mat4 {
- const auto& proj = client::render::camera::get_proj();
- const auto& view = client::render::camera::get_view();
- return glm::translate(proj * view, glm::vec3{world_x, 0, world_z});
- };
- static client::render::program program{"res/shaders/face.vs",
- "res/shaders/face.fs"};
- static const GLuint texture [[maybe_unused]] = make_texture();
- static const GLint u_matrix = glGetUniformLocation(program, "_u_matrix");
-
- glDisable(GL_BLEND);
- glEnable(GL_DEPTH_TEST);
- glUseProgram(program);
- // Our choice of vao depends on which pass we're doing.
- const auto [vao, elements] = [&pass, this]() -> std::pair<GLuint, GLuint> {
- if (pass == pass::solid) {
- return {this->glo->solid_vao, this->glo->solid_elements};
- }
- return {this->glo->water_vao, this->glo->water_elements};
- }();
- glBindVertexArray(vao);
-
- glUniformMatrix4fv(u_matrix, 1, GL_FALSE, glm::value_ptr(make_matrix()));
-
- glDrawArrays(GL_TRIANGLES, 0, elements);
-}
-
-// This function translates and rotates a set of vertices that describes a
-// neutral face and also adds a vector to the texture coords.
-std::array<chunk::glface, 6>
-chunk::make_glfaces(const glface_args& args) noexcept {
-
- static constexpr std::array<glface, 6> glfaces = {
- glface{{-0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}},
- glface{{0.5f, -0.5f, 0.0f}, {1.0f, 1.0f, 0.0f}},
- glface{{0.5f, 0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}},
- glface{{0.5f, 0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}},
- glface{{-0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 0.0f}},
- glface{{-0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}}};
-
- // We have to be careful here not to rotate/translate a zero vector.
- const glm::mat4 mtranslate =
- args.translate == glm::vec3{}
- ? glm::mat4{1.0f}
- : glm::translate(glm::mat4{1.0f}, args.translate);
- const glm::mat4 mrotate =
- args.rotate_axis == glm::vec3{}
- ? glm::mat4{1.0f}
- : glm::rotate(glm::mat4{1.0f}, glm::radians(args.rotate_degrees),
- args.rotate_axis);
-
- std::array<glface, 6> ret;
-
- std::ranges::transform(glfaces, std::begin(ret), [&](const auto f) {
- auto face = f; // unfortunate copy
- face.vertice =
- glm::vec3(mtranslate * mrotate * glm::vec4{face.vertice, 1.0f});
- face.texture += args.texture_offset;
- return face;
- });
-
- return ret;
-}
-
-const chunk* chunk::get_neighbour(const chunk::map& chunks,
- shared::math::coords offset) const noexcept {
- const auto find_it = chunks.find(this->pos + offset);
- if (find_it == std::end(chunks) || !find_it->second.has_value()) {
- return nullptr;
- }
- return &((*find_it).second.value());
-}
-
-bool chunk::maybe_regenerate_glo(const chunk::map& chunks) noexcept {
- // We need all surrounding chunks to make our vbo, this is why it's called
- // "maybe" regenerate vbo.
- const auto chunk_forward = this->get_neighbour(chunks, {0, 1});
- const auto chunk_backward = this->get_neighbour(chunks, {0, -1});
- const auto chunk_right = this->get_neighbour(chunks, {1, 0});
- const auto chunk_left = this->get_neighbour(chunks, {-1, 0});
- if (!chunk_forward || !chunk_left || !chunk_backward || !chunk_right) {
- return false;
- }
-
- static const auto [atlas_width,
- atlas_height] = []() -> std::pair<int, int> {
- const client::render::texture texture{"res/textures/atlas.png"};
- check_atlas(texture);
- return {texture.width, texture.height};
- }();
-
- // Single-axis-outside-chunk-bounds-allowed block access.
- const auto get_outside_block = [&](const int x, const int y,
- const int z) -> shared::world::block {
- if (y < 0 || y >= shared::world::chunk::HEIGHT) {
- return shared::world::block::type::air;
- } else if (x >= shared::world::chunk::WIDTH) {
- return chunk_right->get_block({x - WIDTH, y, z});
- } else if (x < 0) {
- return chunk_left->get_block({x + WIDTH, y, z});
- } else if (z >= shared::world::chunk::WIDTH) {
- return chunk_forward->get_block({x, y, z - WIDTH});
- } else if (z < 0) {
- return chunk_backward->get_block({x, y, z + WIDTH});
- }
- return this->get_block({x, y, z});
- };
-
- // We fill up two vbos, one for each possible rendering pass.
- std::vector<glface> solid_data;
- std::vector<glface> water_data;
-
- // For all blocks in the chunk, check if its neighbours are air. If they
- // are, it's possible that we can see the block, so add it to vertices.
- // We need to read into the neighbours chunk occasionally.
- for (auto x = 0; x < WIDTH; ++x) {
- for (auto y = 0; y < HEIGHT; ++y) {
- for (auto z = 0; z < WIDTH; ++z) {
- const auto& block = this->get_block({x, y, z});
- const auto bv = shared::world::block::get_visibility(block);
-
- if (bv == shared::world::block::visibility::invisible) {
- continue;
- }
-
- const auto& front{get_outside_block(x, y, z + 1)};
- const auto& back{get_outside_block(x, y, z - 1)};
- const auto& right{get_outside_block(x + 1, y, z)};
- const auto& left{get_outside_block(x - 1, y, z)};
- const auto& up{get_outside_block(x, y + 1, z)};
- const auto& down{get_outside_block(x, y - 1, z)};
-
- std::vector<glface> glfaces;
- glfaces.reserve(6 * 6);
-
- const auto should_draw_face = [&bv](const auto& other) -> bool {
- const auto ov = shared::world::block::get_visibility(other);
- if (bv == shared::world::block::visibility::translucent &&
- ov == shared::world::block::visibility::translucent) {
- return false;
- }
- return ov != shared::world::block::visibility::solid;
- };
- // Special shrub block case, ugly I know.
- if (block.type == shared::world::block::type::shrub ||
- block.type == shared::world::block::type::dead_shrub ||
- block.type == shared::world::block::type::snowy_shrub) {
- static const auto front_shrub =
- make_glfaces({.translate = {0.0f, 0.0f, 0.0f},
- .rotate_degrees = 45.0f,
- .rotate_axis = {0.0f, 1.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 0.0f}});
- static const auto right_shrub =
- make_glfaces({.translate = {0.0f, 0.0f, 0.0f},
- .rotate_degrees = 135.0f,
- .rotate_axis = {0.0f, 1.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 0.0f}});
- static const auto back_shrub =
- make_glfaces({.translate = {0.0f, 0.0f, 0.0f},
- .rotate_degrees = 225.0f,
- .rotate_axis = {0.0f, 1.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 0.0f}});
- static const auto left_shrub =
- make_glfaces({.translate = {0.0f, 0.0f, 0.0f},
- .rotate_degrees = 315.0f,
- .rotate_axis = {0.0f, 1.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 0.0f}});
-
- std::ranges::copy(front_shrub, std::back_inserter(glfaces));
- std::ranges::copy(right_shrub, std::back_inserter(glfaces));
- std::ranges::copy(back_shrub, std::back_inserter(glfaces));
- std::ranges::copy(left_shrub, std::back_inserter(glfaces));
-
- } else {
- if (should_draw_face(front)) {
- static const auto front_faces = make_glfaces(
- {.translate = {0.0f, 0.0f, 0.5f},
- .rotate_degrees = 0.0f,
- .rotate_axis = {0.0f, 0.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 0.0f}});
- std::ranges::copy(front_faces,
- std::back_inserter(glfaces));
- }
- if (should_draw_face(right)) {
- static const auto right_faces = make_glfaces(
- {.translate = {0.5f, 0.0f, 0.0f},
- .rotate_degrees = 90.0f,
- .rotate_axis = {0.0f, 1.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 1.0f}});
- std::ranges::copy(right_faces,
- std::back_inserter(glfaces));
- }
- if (should_draw_face(back)) {
- static const auto back_faces = make_glfaces(
- {.translate = {0.0f, 0.0f, -0.5f},
- .rotate_degrees = 180.0f,
- .rotate_axis = {0.0f, 1.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 2.0f}});
- std::ranges::copy(back_faces,
- std::back_inserter(glfaces));
- }
- if (should_draw_face(left)) {
- static const auto left_faces = make_glfaces(
- {.translate = {-0.5f, 0.0f, 0.0f},
- .rotate_degrees = 270.0f,
- .rotate_axis = {0.0f, 1.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 3.0f}});
- std::ranges::copy(left_faces,
- std::back_inserter(glfaces));
- }
- if (should_draw_face(up)) {
- static const auto up_faces = make_glfaces(
- {.translate = {0.0f, 0.5f, 0.0f},
- .rotate_degrees = -90.0f,
- .rotate_axis = {1.0f, 0.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 4.0f}});
- std::ranges::copy(up_faces,
- std::back_inserter(glfaces));
- }
- if (should_draw_face(down)) {
- static const auto down_faces = make_glfaces(
- {.translate = {0.0f, -0.5f, 0.0f},
- .rotate_degrees = 90.0f,
- .rotate_axis = {1.0f, 0.0f, 0.0f},
- .texture_offset = {0.0f, 0.0f, 5.0f}});
- std::ranges::copy(down_faces,
- std::back_inserter(glfaces));
- }
- }
-
- // Move the block pos verts to its intended position.
- // Move the block texture verts to fit in the atlas.
- const glm::vec3 offset_vec3{x, y, z};
- const float tex_yoff = static_cast<float>(block.type) - 1.0f;
-
- const auto fix_face = [&, atlas_width = std::ref(atlas_width),
- atlas_height =
- std::ref(atlas_height)](auto& face) {
- face.vertice += offset_vec3 + 0.5f; // move to origin too
- face.texture.z += tex_yoff * 6.0f;
- return face;
- };
-
- auto& vbo_dest = block.type == shared::world::block::type::water
- ? water_data
- : solid_data;
- std::ranges::transform(glfaces, std::back_inserter(vbo_dest),
- fix_face);
- }
- }
- }
-
- const auto generate_vbo = [](const auto& data) -> GLuint {
- GLuint vbo = 0;
- glGenBuffers(1, &vbo);
- glBindBuffer(GL_ARRAY_BUFFER, vbo);
- glBufferData(GL_ARRAY_BUFFER, std::size(data) * sizeof(glface),
- std::data(data), GL_STATIC_DRAW);
- return vbo;
- };
- const auto generate_vao = []() -> GLuint {
- GLuint vao = 0;
- glGenVertexArrays(1, &vao);
- glBindVertexArray(vao);
- // position
- glEnableVertexAttribArray(0);
- glVertexAttribPointer(0, sizeof(glm::vec3) / sizeof(float), GL_FLOAT,
- GL_FALSE, sizeof(glface), nullptr);
- // texture
- glEnableVertexAttribArray(1);
- glVertexAttribPointer(1, sizeof(glm::vec3) / sizeof(float), GL_FLOAT,
- GL_FALSE, sizeof(glface),
- reinterpret_cast<void*>(sizeof(glm::vec3)));
- return vao;
- };
- // If we were to emplace glo with these there is no guarantee that each
- // function will be called in order (at least, for g++ it isn't). Therefore
- // we need to call them in order first.
- const auto solid_vbo = generate_vbo(solid_data);
- const auto solid_vao = generate_vao();
- const auto water_vbo = generate_vbo(water_data);
- const auto water_vao = generate_vao();
- this->glo.emplace(std::size(solid_data), solid_vbo, solid_vao,
- std::size(water_data), water_vbo, water_vao);
- return true;
-}
-
-// http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes/
-static bool box_in_frustum(const std::array<glm::vec3, 8>& points) noexcept {
- const auto& frustum = client::render::camera::get_frustum();
-
- for (const auto& plane : frustum) {
- bool inside = false;
- bool outside = false;
-
- for (const auto& point : points) {
- const float distance = plane.x * point.x + plane.y * point.y +
- plane.z * point.z + plane.w;
- if (distance < 0.0f) {
- outside = true;
- } else {
- inside = true;
- }
-
- if (inside && outside) {
- break;
- }
- }
-
- if (!inside) {
- return false;
- }
- }
-
- return true;
-};
-
-static bool is_chunk_visible(const float world_x,
- const float world_z) noexcept {
- const std::array<glm::vec3, 8> box_vertices =
- [&world_x, &world_z]() -> std::array<glm::vec3, 8> {
- const float max_world_x = world_x + shared::world::chunk::WIDTH;
- const float max_world_z = world_z + shared::world::chunk::WIDTH;
-
- return {glm::vec3{world_x, 0.0f, world_z},
- {max_world_x, 0.0f, world_z},
- {world_x, 0.0f, max_world_z},
- {max_world_x, 0.0f, max_world_z},
- {world_x, shared::world::chunk::HEIGHT, world_z},
- {max_world_x, shared::world::chunk::HEIGHT, world_z},
- {world_x, shared::world::chunk::HEIGHT, max_world_z},
- {max_world_x, shared::world::chunk::HEIGHT, max_world_z}};
- }();
-
- return box_in_frustum(box_vertices);
-}
-
-void chunk::draw(const chunk::map& chunks, const shared::player& lp,
- const pass& pass) noexcept {
- if (!this->glo.has_value() || this->should_regenerate_vbo) {
- if (!maybe_regenerate_glo(chunks)) {
- return;
- }
- this->should_regenerate_vbo = false;
- }
-
- const auto [world_x, world_z] = [&lp, this]() -> std::pair<float, float> {
- const float offset_x = static_cast<float>(this->pos.x - lp.chunk_pos.x);
- const float offset_z = static_cast<float>(this->pos.z - lp.chunk_pos.z);
- return {offset_x * chunk::WIDTH, offset_z * chunk::WIDTH};
- }();
-
- if (!is_chunk_visible(world_x, world_z)) {
- return;
- }
-
- render(world_x, world_z, pass);
-}
-
-} // namespace world
-} // namespace client
diff --git a/src/client/world/block.cc b/src/client/world/block.cc
new file mode 100644
index 0000000..df3ddcd
--- /dev/null
+++ b/src/client/world/block.cc
@@ -0,0 +1,117 @@
+#include "client/world/block.hh"
+
+namespace client {
+namespace world {
+
+struct glvert_args {
+ glm::vec3 translate;
+ float rotate_degrees;
+ glm::vec3 rotate_axis;
+ glm::vec3 texture_offset;
+};
+static block::glface_t make_glface(const glvert_args& args) noexcept {
+ static constexpr block::glface_t glverts = {
+ block::glvert{{-0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}},
+ block::glvert{{0.5f, -0.5f, 0.0f}, {1.0f, 1.0f, 0.0f}},
+ block::glvert{{0.5f, 0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}},
+ block::glvert{{0.5f, 0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}},
+ block::glvert{{-0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 0.0f}},
+ block::glvert{{-0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}}};
+
+ // We have to be careful here not to rotate/translate a zero vector.
+ constexpr auto zero = glm::vec3{};
+ const glm::mat4 mtranslate =
+ args.translate == zero
+ ? glm::mat4{1.0f}
+ : glm::translate(glm::mat4{1.0f}, args.translate);
+ const glm::mat4 mrotate =
+ args.rotate_axis == zero
+ ? glm::mat4{1.0f}
+ : glm::rotate(glm::mat4{1.0f}, glm::radians(args.rotate_degrees),
+ args.rotate_axis);
+
+ block::glface_t ret;
+ std::ranges::transform(glverts, std::begin(ret), [&](auto f) {
+ f.vertice =
+ glm::vec3(mtranslate * mrotate * glm::vec4{f.vertice, 1.0f});
+ f.texture += args.texture_offset;
+ return f;
+ });
+ return ret;
+}
+
+static const block::glfaces_t& get_shrub_faces() noexcept {
+ static block::glfaces_t faces{
+ make_glface({.translate = {0.0f, 0.0f, 0.0f},
+ .rotate_degrees = 45.0f,
+ .rotate_axis = {0.0f, 1.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 0.0f}}),
+ make_glface({.translate = {0.0f, 0.0f, 0.0f},
+ .rotate_degrees = 135.0f,
+ .rotate_axis = {0.0f, 1.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 0.0f}}),
+ make_glface({.translate = {0.0f, 0.0f, 0.0f},
+ .rotate_degrees = 225.0f,
+ .rotate_axis = {0.0f, 1.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 0.0f}}),
+ make_glface({.translate = {0.0f, 0.0f, 0.0f},
+ .rotate_degrees = 315.0f,
+ .rotate_axis = {0.0f, 1.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 0.0f}})};
+ return faces;
+}
+
+static const block::glfaces_t& get_cube_faces() noexcept {
+ static block::glfaces_t faces{
+ make_glface({.translate = {0.0f, 0.0f, 0.5f},
+ .rotate_degrees = 0.0f,
+ .rotate_axis = {0.0f, 0.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 0.0f}}),
+ make_glface({.translate = {0.5f, 0.0f, 0.0f},
+ .rotate_degrees = 90.0f,
+ .rotate_axis = {0.0f, 1.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 1.0f}}),
+ make_glface({.translate = {0.0f, 0.0f, -0.5f},
+ .rotate_degrees = 180.0f,
+ .rotate_axis = {0.0f, 1.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 2.0f}}),
+ make_glface({.translate = {-0.5f, 0.0f, 0.0f},
+ .rotate_degrees = 270.0f,
+ .rotate_axis = {0.0f, 1.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 3.0f}}),
+ make_glface({.translate = {0.0f, 0.5f, 0.0f},
+ .rotate_degrees = -90.0f,
+ .rotate_axis = {1.0f, 0.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 4.0f}}),
+ make_glface({.translate = {0.0f, -0.5f, 0.0f},
+ .rotate_degrees = 90.0f,
+ .rotate_axis = {1.0f, 0.0f, 0.0f},
+ .texture_offset = {0.0f, 0.0f, 5.0f}}),
+ };
+ return faces;
+}
+
+enum block::draw_type
+block::get_draw_type(const enum block::type& type) noexcept {
+ using t = enum shared::world::block::type;
+ switch (type) {
+ case t::dead_shrub:
+ case t::shrub:
+ case t::snowy_shrub:
+ return draw_type::custom;
+ default:
+ return draw_type::block;
+ }
+}
+
+const block::glfaces_t&
+block::get_glfaces(const enum block::type& type) noexcept {
+ const auto draw_type = get_draw_type(type);
+ if (draw_type == block::draw_type::custom) {
+ return get_shrub_faces();
+ }
+ return get_cube_faces();
+}
+
+} // namespace world
+} // namespace client
diff --git a/src/client/world/block.hh b/src/client/world/block.hh
new file mode 100644
index 0000000..9dfe303
--- /dev/null
+++ b/src/client/world/block.hh
@@ -0,0 +1,53 @@
+#ifndef CLIENT_WORLD_BLOCK_HH_
+#define CLIENT_WORLD_BLOCK_HH_
+
+#include <algorithm>
+#include <array>
+#include <vector>
+
+#include <glm/glm.hpp>
+#include <glm/gtc/matrix_access.hpp>
+#include <glm/gtc/matrix_transform.hpp>
+
+#include "shared/world/block.hh"
+
+namespace client {
+namespace world {
+
+// Doesn't add any data, just information for rendering.
+class block : public shared::world::block {
+public:
+ struct glvert {
+ glm::vec3 vertice;
+ glm::vec3 texture;
+ };
+ using glface_t = std::array<glvert, 6>; // array of verts (a face)
+ using glfaces_t = std::vector<glface_t>; // vector of faces (a block)
+
+ // Render types refer to how the block should be culled when making the vbo.
+ enum class draw_type {
+ block, // face testing
+ custom, // no testing
+ };
+
+public:
+ static enum draw_type get_draw_type(const enum block::type& type) noexcept;
+ static const glfaces_t& get_glfaces(const enum block::type& type) noexcept;
+
+public:
+ template <typename... Args>
+ block(Args&&... args) noexcept : block(std::forward<Args>(args)...) {}
+
+public:
+ enum draw_type get_draw_type() const noexcept {
+ return get_draw_type(this->type);
+ }
+ const glfaces_t& get_glfaces() const noexcept {
+ return get_glfaces(this->type);
+ }
+};
+
+} // namespace world
+} // namespace client
+
+#endif
diff --git a/src/client/world/chunk.cc b/src/client/world/chunk.cc
new file mode 100644
index 0000000..99720cb
--- /dev/null
+++ b/src/client/world/chunk.cc
@@ -0,0 +1,255 @@
+#include "client/world/chunk.hh"
+
+namespace client {
+namespace world {
+
+void chunk::render(const float world_x, const float world_z,
+ const pass& pass) noexcept {
+ const auto make_matrix = [&]() -> glm::mat4 {
+ const auto& proj = client::render::camera::get_proj();
+ const auto& view = client::render::camera::get_view();
+ return glm::translate(proj * view, glm::vec3{world_x, 0, world_z});
+ };
+ static client::render::program program{"res/shaders/face.vs",
+ "res/shaders/face.fs"};
+ static const GLint u_matrix = glGetUniformLocation(program, "_u_matrix");
+
+ const GLuint texture [[maybe_unused]] = client::render::get_texture_atlas();
+ glDisable(GL_BLEND);
+ glEnable(GL_DEPTH_TEST);
+ glUseProgram(program);
+ // Our choice of vao depends on which pass we're doing.
+ const auto [vao, elements] = [&pass, this]() -> std::pair<GLuint, GLuint> {
+ if (pass == pass::solid) {
+ return {this->glo->solid_vao, this->glo->solid_elements};
+ }
+ return {this->glo->water_vao, this->glo->water_elements};
+ }();
+ glBindVertexArray(vao);
+
+ glUniformMatrix4fv(u_matrix, 1, GL_FALSE, glm::value_ptr(make_matrix()));
+
+ glDrawArrays(GL_TRIANGLES, 0, elements);
+}
+
+const chunk* chunk::get_neighbour(const chunks_t& chunks,
+ shared::math::coords offset) const noexcept {
+ const auto find_it = chunks.find(this->pos + offset);
+ if (find_it == std::end(chunks) || !find_it->second.has_value()) {
+ return nullptr;
+ }
+ return &((*find_it).second.value());
+}
+
+bool chunk::maybe_regenerate_glo(const chunks_t& chunks) noexcept {
+ // We need all surrounding chunks to make our vbo, so early out with false
+ // if we can't do that yet.
+ const auto chunk_forward = this->get_neighbour(chunks, {0, 1});
+ const auto chunk_backward = this->get_neighbour(chunks, {0, -1});
+ const auto chunk_right = this->get_neighbour(chunks, {1, 0});
+ const auto chunk_left = this->get_neighbour(chunks, {-1, 0});
+ if (!chunk_forward || !chunk_left || !chunk_backward || !chunk_right) {
+ return false;
+ }
+
+ // Single-axis-outside-chunk-bounds-allowed block access.
+ const auto get_outside_block = [&](const int x, const int y,
+ const int z) -> shared::world::block {
+ if (y < 0 || y >= shared::world::chunk::HEIGHT) {
+ return shared::world::block::type::air;
+ } else if (x >= shared::world::chunk::WIDTH) {
+ return chunk_right->get_block({x - WIDTH, y, z});
+ } else if (x < 0) {
+ return chunk_left->get_block({x + WIDTH, y, z});
+ } else if (z >= shared::world::chunk::WIDTH) {
+ return chunk_forward->get_block({x, y, z - WIDTH});
+ } else if (z < 0) {
+ return chunk_backward->get_block({x, y, z + WIDTH});
+ }
+ return this->get_block({x, y, z});
+ };
+
+ // We fill up two vbos, one for each possible rendering pass.
+ std::vector<block::glvert> solid_data;
+ std::vector<block::glvert> water_data;
+
+ // For all blocks in the chunk, check if its neighbours are air. If they
+ // are, it's possible that we can see the block, so add it to vertices.
+ // We need to read into the neighbours chunk occasionally.
+ for (auto x = 0; x < WIDTH; ++x) {
+ for (auto y = 0; y < HEIGHT; ++y) {
+ for (auto z = 0; z < WIDTH; ++z) {
+ const auto& block = this->get_block({x, y, z});
+ const auto bv = shared::world::block::get_visibility(block);
+
+ if (bv == shared::world::block::visibility::invisible) {
+ continue;
+ }
+
+ std::vector<block::glvert> glverts;
+ glverts.reserve(6 * 6);
+
+ const auto draw_type = block::get_draw_type(block.type);
+
+ const block::glfaces_t& faces = block::get_glfaces(block.type);
+ if (draw_type == block::draw_type::block) {
+ const std::array<shared::world::block, 6> around{
+ get_outside_block(x, y, z + 1),
+ get_outside_block(x + 1, y, z),
+ get_outside_block(x, y, z - 1),
+ get_outside_block(x - 1, y, z),
+ get_outside_block(x, y + 1, z),
+ get_outside_block(x, y - 1, z),
+ };
+
+ for (auto i = 0ul; i < std::size(faces); ++i) {
+ const auto ov = block::get_visibility(around[i]);
+ if (bv == block::visibility::translucent &&
+ ov == block::visibility::translucent) {
+ continue;
+ }
+ if (ov == block::visibility::solid) {
+ continue;
+ }
+
+ std::ranges::copy(faces[i],
+ std::back_inserter(glverts));
+ }
+ } else if (draw_type == block::draw_type::custom) {
+ for (const auto& face : faces) {
+ std::ranges::copy(face, std::back_inserter(glverts));
+ }
+ }
+
+ // Move the block pos verts to its intended position.
+ // Move the block texture verts to fit in the atlas.
+ const glm::vec3 offset_vec3{x, y, z};
+ const float tex_yoff = static_cast<float>(block.type) - 1.0f;
+ const auto fix_face = [&](auto& face) {
+ face.vertice += offset_vec3 + 0.5f; // move to origin too
+ face.texture.z += tex_yoff * 6.0f;
+ return face;
+ };
+
+ auto& vbo_dest = block.type == shared::world::block::type::water
+ ? water_data
+ : solid_data;
+ std::ranges::transform(glverts, std::back_inserter(vbo_dest),
+ fix_face);
+ }
+ }
+ }
+
+ const auto generate_vbo = [](const auto& data) -> GLuint {
+ GLuint vbo = 0;
+ glGenBuffers(1, &vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ glBufferData(GL_ARRAY_BUFFER, std::size(data) * sizeof(block::glvert),
+ std::data(data), GL_STATIC_DRAW);
+ return vbo;
+ };
+ const auto generate_vao = []() -> GLuint {
+ GLuint vao = 0;
+ glGenVertexArrays(1, &vao);
+ glBindVertexArray(vao);
+ // position
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(0, sizeof(glm::vec3) / sizeof(float), GL_FLOAT,
+ GL_FALSE, sizeof(block::glvert), nullptr);
+ // texture
+ glEnableVertexAttribArray(1);
+ glVertexAttribPointer(1, sizeof(glm::vec3) / sizeof(float), GL_FLOAT,
+ GL_FALSE, sizeof(block::glvert),
+ reinterpret_cast<void*>(sizeof(glm::vec3)));
+ return vao;
+ };
+ // If we were to emplace glo with these there is no guarantee that each
+ // function will be called in order (at least, for g++ it isn't). Therefore
+ // we need to call them in order first.
+ const auto solid_vbo = generate_vbo(solid_data);
+ const auto solid_vao = generate_vao();
+ const auto water_vbo = generate_vbo(water_data);
+ const auto water_vao = generate_vao();
+ this->glo.emplace(std::size(solid_data), solid_vbo, solid_vao,
+ std::size(water_data), water_vbo, water_vao);
+ return true;
+}
+
+// http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes/
+static bool box_in_frustum(const std::array<glm::vec3, 8>& points) noexcept {
+ const auto& frustum = client::render::camera::get_frustum();
+
+ for (const auto& plane : frustum) {
+ bool inside = false;
+ bool outside = false;
+
+ for (const auto& point : points) {
+ const float distance = plane.x * point.x + plane.y * point.y +
+ plane.z * point.z + plane.w;
+ if (distance < 0.0f) {
+ outside = true;
+ } else {
+ inside = true;
+ }
+
+ if (inside && outside) {
+ break;
+ }
+ }
+
+ if (!inside) {
+ return false;
+ }
+ }
+
+ return true;
+};
+
+static bool is_chunk_visible(const float world_x,
+ const float world_z) noexcept {
+ const std::array<glm::vec3, 8> box_vertices =
+ [&world_x, &world_z]() -> std::array<glm::vec3, 8> {
+ const float max_world_x = world_x + shared::world::chunk::WIDTH;
+ const float max_world_z = world_z + shared::world::chunk::WIDTH;
+
+ return {glm::vec3{world_x, 0.0f, world_z},
+ {max_world_x, 0.0f, world_z},
+ {world_x, 0.0f, max_world_z},
+ {max_world_x, 0.0f, max_world_z},
+ {world_x, shared::world::chunk::HEIGHT, world_z},
+ {max_world_x, shared::world::chunk::HEIGHT, world_z},
+ {world_x, shared::world::chunk::HEIGHT, max_world_z},
+ {max_world_x, shared::world::chunk::HEIGHT, max_world_z}};
+ }();
+
+ return box_in_frustum(box_vertices);
+}
+
+bool chunk::draw(const chunks_t& chunks, const shared::player& lp,
+ const pass& pass, const bool skip_regen) noexcept {
+ bool did_regen = false;
+ if (!this->glo.has_value() || this->should_regenerate_vbo) {
+ if (skip_regen || !maybe_regenerate_glo(chunks)) {
+ return false;
+ }
+ this->should_regenerate_vbo = false;
+ did_regen = true;
+ }
+
+ const auto [world_x, world_z] = [&lp, this]() -> std::pair<float, float> {
+ const float offset_x =
+ static_cast<float>(this->pos.x - lp.get_chunk_pos().x);
+ const float offset_z =
+ static_cast<float>(this->pos.z - lp.get_chunk_pos().z);
+ return {offset_x * chunk::WIDTH, offset_z * chunk::WIDTH};
+ }();
+
+ if (is_chunk_visible(world_x, world_z)) {
+ render(world_x, world_z, pass);
+ }
+
+ return did_regen;
+}
+
+} // namespace world
+} // namespace client
diff --git a/src/client/world.hh b/src/client/world/chunk.hh
index 067f74c..5436525 100644
--- a/src/client/world.hh
+++ b/src/client/world/chunk.hh
@@ -1,5 +1,5 @@
-#ifndef CLIENT_WORLD_HH_
-#define CLIENT_WORLD_HH_
+#ifndef CLIENT_WORLD_CHUNK_HH_
+#define CLIENT_WORLD_CHUNK_HH_
#include <algorithm>
#include <optional>
@@ -9,19 +9,22 @@
#include "client/render/render.hh"
#include "client/render/texture.hh"
-#include "shared/player.hh"
-#include "shared/world.hh"
+#include "client/world/block.hh"
+#include "shared/entity/player.hh"
+#include "shared/world/chunk.hh"
namespace client {
namespace world {
+class chunk;
+using chunks_t = std::unordered_map<shared::math::coords,
+ std::optional<client::world::chunk>,
+ decltype(&shared::world::chunk::hash),
+ decltype(&shared::world::chunk::equal)>;
+
// client::world::chunk is a renderable shared::world::chunk.
class chunk : public shared::world::chunk {
public:
- using map = std::unordered_map<shared::math::coords,
- std::optional<client::world::chunk>,
- decltype(&shared::world::chunk::hash),
- decltype(&shared::world::chunk::equal)>;
// Which part to draw when we call draw.
enum class pass { solid, water };
@@ -53,35 +56,24 @@ private:
std::optional<gl_objects> glo;
private:
- const chunk* get_neighbour(const chunk::map& chunks,
+ const chunk* get_neighbour(const chunks_t& chunks,
shared::math::coords offset) const noexcept;
- struct glface {
- glm::vec3 vertice;
- glm::vec3 texture;
- };
- struct glface_args {
- glm::vec3 translate;
- float rotate_degrees;
- glm::vec3 rotate_axis;
- glm::vec3 texture_offset;
- };
- static std::array<glface, 6> make_glfaces(const glface_args& args) noexcept;
void render(const float x_offset, const float z_offset,
const pass& pass) noexcept;
- bool maybe_regenerate_glo(const chunk::map& chunks) noexcept;
+ bool maybe_regenerate_glo(const chunks_t& chunks) noexcept;
public:
template <typename... Args>
chunk(Args&&... args) noexcept
: shared::world::chunk(std::forward<Args>(args)...) {}
+ virtual ~chunk() noexcept = default;
- void draw(const map& chunks, const shared::player& lp,
- const pass& pass) noexcept;
+ // true if we regen'd, false otherwise
+ bool draw(const chunks_t& chunks, const shared::player& lp,
+ const pass& pass, const bool skip_regen = false) noexcept;
- bool can_draw() const noexcept {
- return this->glo.has_value();
- }
+ bool can_draw() const noexcept { return this->glo.has_value(); }
};
} // namespace world
diff --git a/src/client/world/world.dat b/src/client/world/world.dat
new file mode 100644
index 0000000..e210d11
--- /dev/null
+++ b/src/client/world/world.dat
Binary files differ
diff --git a/src/dedicated/CMakeLists.txt b/src/dedicated/CMakeLists.txt
new file mode 100644
index 0000000..e2245ef
--- /dev/null
+++ b/src/dedicated/CMakeLists.txt
@@ -0,0 +1,60 @@
+cmake_minimum_required(VERSION 3.18)
+
+project(dedicated)
+
+#if (NOT TARGET shared)
+# add_subdirectory(../shared shared)
+#endif()
+#if (NOT TARGET server)
+# add_subdirectory(../server server)
+#endif()
+#add_subdirectory(../shared)
+#add_subdirectory(../server)
+
+file (GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
+ "*.cc"
+)
+file (GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS
+ "*.hh"
+ "../server/*.hh"
+ "../shared/*.hh"
+)
+add_executable(${PROJECT_NAME}
+ ${SOURCE_FILES}
+)
+
+find_library(LIB_SQLITE3 sqlite3 SQLITE3 REQUIRED)
+find_library(LIB_PROTOBUF protobuf libprotobuf REQUIRED)
+find_package(Boost COMPONENTS iostreams REQUIRED)
+find_package(Threads REQUIRED)
+find_package(Backtrace REQUIRED)
+
+target_compile_options(${PROJECT_NAME} PRIVATE
+ -Wall -Wextra -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common
+ -Wconversion -Wpedantic -std=c++20 -O2
+ -Wno-exceptions
+ -Wno-missing-field-initializers -Wno-unknown-pragmas
+)
+if (${IS_DEBUG})
+ target_compile_options(${PROJECT_NAME} PRIVATE
+ ¦ -fstack-protector-strong -fno-omit-frame-pointer -fsanitize=undefined
+ )
+ target_link_options(${PROJECT_NAME} PRIVATE
+ ¦ -fstack-protector-strong -fsanitize=undefined
+ )
+endif()
+target_include_directories(${PROJECT_NAME} PRIVATE
+ "../../src"
+)
+target_link_libraries(${PROJECT_NAME} PRIVATE
+ ${LIB_PROTOBUF}
+ ${LIB_SQLITE3}
+ ${Backtrace_LIBRARIES}
+ ${Threads_LIBRARIES}
+ ${Boost_LIBRARIES}
+ shared
+ server
+)
+target_precompile_headers(${PROJECT_NAME} PRIVATE
+ ${HEADER_FILES}
+)
diff --git a/src/dedicated/main.cc b/src/dedicated/main.cc
new file mode 100644
index 0000000..d9c5bb4
--- /dev/null
+++ b/src/dedicated/main.cc
@@ -0,0 +1,39 @@
+#include "main.hh"
+
+static std::string& get_port() noexcept {
+ static std::string port{shared::DEFAULT_PORT};
+ return port;
+}
+
+static bool parse_arg(const int& c, const char* const arg) {
+ switch (c) {
+ case 'p':
+ get_port() = boost::lexical_cast<std::string>(arg);
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+static const shared::args_t& get_options() {
+ static shared::args_t ret = []() -> shared::args_t {
+ shared::args_t ret{
+ {.name = "port", .desc = "override the default port", .val = "p:"}};
+ std::ranges::copy(shared::get_options(), std::back_inserter(ret));
+ std::ranges::copy(server::get_options(), std::back_inserter(ret));
+ return ret;
+ }();
+
+ return ret;
+}
+
+int main(const int argc, char* const argv[]) {
+ shared::init();
+
+ shared::parse_args(argc, argv, get_options(),
+ {&parse_arg, &shared::parse_arg, &server::parse_arg});
+
+ shared::try_main(server::main, shared::DEFAULT_ADDRESS, get_port());
+ return EXIT_SUCCESS;
+}
diff --git a/src/dedicated/main.hh b/src/dedicated/main.hh
new file mode 100644
index 0000000..fe9d0c1
--- /dev/null
+++ b/src/dedicated/main.hh
@@ -0,0 +1,16 @@
+#ifndef DEDICATED_MAIN_HH_
+#define DEDICATED_MAIN_HH_
+
+#include <ranges>
+#include <string>
+
+#include <boost/lexical_cast.hpp>
+
+#include "server/init.hh"
+#include "server/server.hh"
+#include "shared/init.hh"
+
+namespace dedicated {}
+
+#endif
+
diff --git a/src/main.cc b/src/main.cc
deleted file mode 100644
index 56efb55..0000000
--- a/src/main.cc
+++ /dev/null
@@ -1,193 +0,0 @@
-#include "main.hh"
-
-static void set_signal(const decltype(SIGINT) signal,
- void (*const callback)(int)) {
- struct sigaction sa {};
- sa.sa_handler = callback;
- sa.sa_flags = 0;
- if (sigaction(signal, &sa, nullptr) == -1) {
- throw std::runtime_error("failed to set signal handler for signal " +
- std::to_string(signal));
- }
-}
-
-// Parse arg, store result in dest after casting with boost::lexical_cast.
-template <typename T>
-static bool maybe_parse_arg(std::vector<std::string_view>& args,
- const std::initializer_list<std::string_view>& keys,
- T& dest) noexcept {
- const auto find_it = std::ranges::find_if(args, [&keys](const auto& arg) {
- return std::ranges::find(keys, arg) != std::end(keys);
- });
-
- if (find_it == std::end(args)) {
- return false;
- }
-
- try {
- const auto i = static_cast<unsigned int>(find_it - std::begin(args));
- dest = boost::lexical_cast<T>(args.at(i + 1u));
- } catch (const boost::bad_lexical_cast& e) {
- shared::print::fault("bad type conversion for \"" +
- std::string{*find_it} + "\" arg\n");
- std::exit(EXIT_FAILURE);
- } catch (const std::out_of_range& e) {
- shared::print::fault("missing \"" + std::string{*find_it} + "\" arg\n");
- std::exit(EXIT_FAILURE);
- }
-
- args.erase(find_it, std::next(find_it, 2));
-
- return true;
-}
-
-// Parse arg, return true or false if arg exists.
-static bool
-maybe_parse_arg(std::vector<std::string_view>& args,
- const std::initializer_list<std::string_view>& keys) noexcept {
-
- const auto find_it = std::ranges::find_if(args, [&keys](const auto& arg) {
- return std::ranges::find(keys, arg) != std::end(keys);
- });
-
- if (find_it == std::end(args)) {
- return false;
- }
-
- args.erase(find_it);
- return true;
-}
-
-static void do_server(const std::string_view address,
- const std::string_view port) noexcept {
- try {
- server::main(address, port);
- } catch (const std::exception& e) {
- shared::print::fault(std::string{"exception in server!\n"} +
- " what: " + e.what() + '\n');
- std::exit(EXIT_FAILURE);
- }
-}
-
-static void do_client(const std::string_view address,
- const std::string_view port) noexcept {
- try {
- client::main(address, port);
- } catch (const std::exception& e) {
- shared::print::fault(std::string{"exception in client!\n"} +
- " what: " + e.what() + '\n');
- std::exit(EXIT_FAILURE);
- }
-}
-
-static void init() noexcept {
- // Because we use noexcept liberally, exceptions are often not unwound.
- std::set_terminate([]() {
- try {
- throw;
- } catch (const std::exception& e) {
- shared::print::fault(std::string{"unhandled exception!\n"} +
- " what: " + e.what() + '\n');
-
- constexpr std::size_t BACKTRACE_BUF_SIZE = 64;
- std::array<void*, BACKTRACE_BUF_SIZE> bt_buffer{};
- const int nptrs =
- backtrace(std::data(bt_buffer), std::size(bt_buffer));
- char** strings = backtrace_symbols(std::data(bt_buffer), nptrs);
-
- shared::print::message("\n backtrace:\n", false);
- for (int i = 0; i < nptrs; ++i) {
- shared::print::message(" " + std::string{strings[i]} + '\n',
- false);
- }
- free(strings); // controversial
-
- } catch (...) {
- }
- std::exit(EXIT_FAILURE);
- });
-
- set_signal(SIGPIPE, SIG_IGN);
- set_signal(SIGINT, []([[maybe_unused]] const int signum) {
- shared::print::warn(" interrupt signal received\n", false);
- shared::should_exit = true; // graceful cleanup
- });
-
-#ifndef NDEBUG
- shared::print::debug(
- "This binary is a debug build and should not be used in production.\n",
- false);
-#endif
-}
-
-int main(const int argc, const char* const argv[]) {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- // Default argument values, which starts a multiplayer server with a client.
- std::string address = "0.0.0.0";
- std::string port = "8191";
- bool has_address = false;
- bool has_headless = false;
- {
- std::vector<std::string_view> args;
- for (auto i = 1; i < argc; ++i) {
- args.emplace_back(argv[i]);
- }
-
- if (maybe_parse_arg(args, {"--help", "-h"})) {
- // clang-format off
- std::cout << " --help -h : display this, quit\n"
- " --address -a <string> : connect elsewhere\n"
- " --port -p <int> : override the default port\n"
- " --headless -H : run without a client\n"
- " --singleplayer -s : avoid hosting a lan server\n"
- " --seed -S <int> : manually set the worldseed\n"
- " --directory -d <string> : manually set the directory\n"
- " --tickrate -t <int> : override the default tickrate\n"
- " --distance -D <int> : set the max chunk distance the server provides\n";
- // clang-format on
- std::exit(EXIT_SUCCESS);
- }
-
- has_address = maybe_parse_arg(args, {"--address", "-a"}, address);
- has_headless = maybe_parse_arg(args, {"--headless", "-H"});
-
- maybe_parse_arg(args, {"--port", "-p"}, port);
- maybe_parse_arg(args, {"--seed", "-S"}, server::state.seed);
- maybe_parse_arg(args, {"--directory", "-d"}, server::state.directory);
- maybe_parse_arg(args, {"--tickrate", "-t"}, server::state.tickrate);
- maybe_parse_arg(args, {"--distance", "-D"},
- server::state.draw_distance);
-
- if (maybe_parse_arg(args, {"--singleplayer", "-s"})) {
- if (has_address) {
- shared::print::warn("singleplayer argument ignored due "
- "to conflicting address argument\n");
- }
- address = "localhost";
- }
-
- std::ranges::for_each(args, [](const auto& arg) {
- shared::print::warn("unused argument \"" + std::string{arg} +
- "\"\n");
- });
- }
-
- init();
-
- // Split server/client execution, while waiting for server to boot before
- // running the client.
- std::jthread server_thread;
- if (!has_address) {
- if (has_headless) {
- do_server(address, port);
- std::exit(EXIT_SUCCESS);
- }
- server_thread = std::jthread{do_server, address, port};
- while (!server::has_initialised) {
- continue;
- }
- }
-
- do_client(address, port);
-}
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
new file mode 100644
index 0000000..7ac16c2
--- /dev/null
+++ b/src/server/CMakeLists.txt
@@ -0,0 +1,50 @@
+cmake_minimum_required(VERSION 3.18)
+
+project(server)
+
+file (GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
+ "*.cc"
+)
+file (GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS
+ "*.hh"
+ "../shared/*.hh"
+)
+add_library(${PROJECT_NAME} STATIC
+ ${SOURCE_FILES}
+)
+
+find_library(LIB_SQLITE3 sqlite3 SQLITE3 REQUIRED)
+find_library(LIB_PROTOBUF protobuf libprotobuf REQUIRED)
+find_package(Boost COMPONENTS iostreams REQUIRED)
+find_package(Threads REQUIRED)
+find_package(Backtrace REQUIRED)
+
+target_compile_options(${PROJECT_NAME} PRIVATE
+ -Wall -Wextra -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common
+ -Wconversion -Wpedantic -std=c++20 -O2
+ -Wno-exceptions
+ -Wno-missing-field-initializers -Wno-unknown-pragmas
+)
+if (${IS_DEBUG})
+ target_compile_options(${PROJECT_NAME} PRIVATE
+ ¦ -fstack-protector-strong -fno-omit-frame-pointer -fsanitize=undefined
+ )
+ target_link_options(${PROJECT_NAME} PRIVATE
+ ¦ -fstack-protector-strong -fsanitize=undefined
+ )
+endif()
+target_include_directories(${PROJECT_NAME} PRIVATE
+ "${PROJECT_SOURCE_DIR}/../../src"
+)
+target_link_libraries(${PROJECT_NAME} PRIVATE
+ ${LIB_SQLITE3}
+ ${LIB_PROTOBUF}
+ ${Backtrace_LIBRARIES}
+ ${Threads_LIBRARIES}
+ ${Boost_LIBRARIES}
+ ${FREETYPE_LIBRARIES}
+ shared
+)
+target_precompile_headers(${PROJECT_NAME} PRIVATE
+ ${HEADER_FILES}
+)
diff --git a/src/server/chunk_data.hh b/src/server/chunk_data.hh
index eea5cef..349d4dc 100644
--- a/src/server/chunk_data.hh
+++ b/src/server/chunk_data.hh
@@ -5,8 +5,8 @@
#include <optional>
#include <unordered_set>
-#include "server/world.hh"
-#include "shared/player.hh"
+#include "server/world/chunk.hh"
+#include "shared/entity/player.hh"
namespace server {
@@ -15,7 +15,7 @@ public:
// nullopt = constructing/destructing via future operations in thread pool
// we use shared_ptr here to avoid complex moves in boost::asio::post.
// There is no good reason to use shared_ptr over unique_ptr, other than
- // boost::asio::post requiring copy_constructable args in std::bind.
+ // boost::asio::post requiring copy_constructable args in std::bind.
std::optional<std::shared_ptr<server::world::chunk>> chunk;
// players associated with the chunk
std::unordered_set<shared::player::index_t> players;
diff --git a/src/server/client.cc b/src/server/client.cc
index 0197f90..6d3b5b0 100644
--- a/src/server/client.cc
+++ b/src/server/client.cc
@@ -1 +1,15 @@
#include "server/client.hh"
+
+namespace server {
+
+bool client::is_in_pvs(const client& other) const noexcept {
+ if (!other.has_initialised()) {
+ return false;
+ }
+ if (!this->chunks.contains(other.get_player().get_chunk_pos())) {
+ return false;
+ }
+ return true;
+}
+
+} // namespace server
diff --git a/src/server/client.hh b/src/server/client.hh
index 5866035..4a2c1fd 100644
--- a/src/server/client.hh
+++ b/src/server/client.hh
@@ -9,10 +9,10 @@
#include <unordered_set>
#include "server/chunk_data.hh"
-#include "server/world.hh"
+#include "server/world/chunk.hh"
+#include "shared/entity/player.hh"
#include "shared/net/connection.hh"
-#include "shared/player.hh"
-#include "shared/world.hh"
+#include "shared/world/chunk.hh"
namespace server {
@@ -44,14 +44,21 @@ public:
decltype(&shared::world::chunk::equal)>
chunks{4096, shared::world::chunk::hash, shared::world::chunk::equal};
+ // sequence of the client's last commands, used for prediction
+ shared::tick_t sequence = 0u;
+
public:
client(shared::net::connection&& con, const shared::player::index_t& index)
: connection(std::move(con)), index(index) {}
+ bool is_in_pvs(const client& other) const noexcept;
+
+ // Not safe to use getter functions without checking has_initalised.
bool has_initialised() const noexcept {
return this->player_info.has_value();
}
- shared::player& get_player() noexcept {
+
+ shared::player& get_player() const noexcept {
return (*this->player_info)->player;
}
const std::string& get_username() const noexcept {
diff --git a/src/server/database.cc b/src/server/database.cc
index 077c86c..37f5757 100644
--- a/src/server/database.cc
+++ b/src/server/database.cc
@@ -3,14 +3,25 @@
namespace server {
namespace database {
+// because of all the things not to work, bit cast doesn't
+template <typename T, typename U>
+static T bit_cast(const U& src) noexcept {
+ static_assert(sizeof(T) == sizeof(U));
+
+ T dest;
+ std::memcpy(&dest, &src, sizeof(U));
+ return dest;
+}
+
sqlite3* get_database() noexcept {
static sqlite3* const database = []() -> sqlite3* {
std::filesystem::create_directory(server::state.directory);
const std::string path = server::state.directory + "world.dat";
if (!std::filesystem::exists(path)) {
- shared::print::warn(
- "server: regenerating non-existent world data\n");
+ shared::print::warn
+ << shared::print::time
+ << "server: regenerating non-existent world data\n";
}
sqlite3* database = nullptr;
@@ -59,8 +70,8 @@ static void finalise(sqlite3_stmt*& statement) noexcept {
static void bind_int64(sqlite3_stmt*& statement, const int index,
const std::uint64_t& key) noexcept {
- if (const int status = sqlite3_bind_int64(statement, index,
- std::bit_cast<std::int64_t>(key));
+ if (const int status =
+ sqlite3_bind_int64(statement, index, bit_cast<std::int64_t>(key));
status != SQLITE_OK) {
throw std::runtime_error(std::string{"sqlite bind int error \""} +
sqlite3_errstr(status) + '\"');
@@ -121,8 +132,7 @@ void quit() noexcept {
// We have to store our key in network byte order!
static std::uint64_t make_key(const shared::math::coords& coords) noexcept {
const auto to_64 = [](const std::int32_t& val, const int lshift) {
- return static_cast<std::uint64_t>(
- htonl(std::bit_cast<std::uint32_t>(val)))
+ return static_cast<std::uint64_t>(htonl(bit_cast<std::uint32_t>(val)))
<< lshift;
};
@@ -145,14 +155,21 @@ maybe_read_chunk(const shared::math::coords& pos) noexcept {
std::string blocks{addr, addr + sqlite3_column_bytes(statement, 0)};
finalise(statement);
- shared::decompress_string(blocks);
- proto::chunk chunk;
- if (!chunk.ParseFromString(blocks)) {
+ std::optional<proto::chunk> chunk = [&]() -> std::optional<proto::chunk> {
+ const auto decompress = shared::maybe_decompress_string(blocks);
+ if (!decompress.has_value()) {
+ return std::nullopt;
+ }
- shared::print::fault("server: chunk [" + std::to_string(pos.x) + ", " +
- std::to_string(pos.z) +
- "] failed to parse and was evicted\n");
+ proto::chunk ret;
+ ret.ParseFromString(*decompress);
+ return ret;
+ }();
+ if (!chunk.has_value()) {
+ shared::print::fault << shared::print::time << "server: chunk ["
+ << pos.x << ", " << pos.z
+ << "] failed to parse and was evicted\n";
statement = nullptr;
prepare(statement, "DELETE FROM Chunks WHERE Chunks.coords = ?;");
bind_int64(statement, 1, make_key(pos));
@@ -160,14 +177,14 @@ maybe_read_chunk(const shared::math::coords& pos) noexcept {
finalise(statement);
return std::nullopt;
}
- return chunk;
+ return *chunk;
}
void write_chunk(const shared::math::coords& pos,
const proto::chunk& chunk) noexcept {
std::string blocks;
chunk.SerializeToString(&blocks);
- shared::compress_string(blocks);
+ blocks = shared::compress_string(blocks);
sqlite3_stmt* statement = nullptr;
@@ -195,17 +212,30 @@ maybe_read_player(const std::string& username) noexcept {
const char* plr_adr =
static_cast<const char*>(sqlite3_column_blob(statement, 0));
- std::string player_bytes{plr_adr, plr_adr + sqlite3_column_bytes(statement, 0)};
+ std::string player_bytes{plr_adr,
+ plr_adr + sqlite3_column_bytes(statement, 0)};
const unsigned char* pass_adr = sqlite3_column_text(statement, 1);
- std::string pass_bytes{pass_adr, pass_adr + sqlite3_column_bytes(statement, 1)};
+ std::string pass_bytes{pass_adr,
+ pass_adr + sqlite3_column_bytes(statement, 1)};
finalise(statement);
- shared::decompress_string(player_bytes);
- proto::player player;
- if (!player.ParseFromString(player_bytes)) {
- shared::print::fault("server: player \"" + username +
- "\" failed to parse and was evicted\n");
+ const std::optional<proto::player> player =
+ [&]() -> std::optional<proto::player> {
+ const auto decompress = shared::maybe_decompress_string(player_bytes);
+ if (!decompress.has_value()) {
+ return std::nullopt;
+ }
+
+ proto::player ret;
+ ret.ParseFromString(*decompress);
+ return ret;
+ }();
+
+ if (!player.has_value()) {
+ shared::print::fault << shared::print::time << "server: player \""
+ << username
+ << "\" failed to parse and was evicted\n";
statement = nullptr;
prepare(statement, "DELETE FROM Players WHERE Players.username = ?;");
@@ -214,14 +244,15 @@ maybe_read_player(const std::string& username) noexcept {
finalise(statement);
return std::nullopt;
}
- return std::make_pair(player, pass_bytes);
+
+ return std::make_pair(*player, pass_bytes);
}
void write_player(const std::string& username, const std::string& password,
const proto::player& player) noexcept {
std::string player_bytes;
player.SerializeToString(&player_bytes);
- shared::compress_string(player_bytes);
+ player_bytes = shared::compress_string(player_bytes);
sqlite3_stmt* statement = nullptr;
prepare(statement, "INSERT OR REPLACE INTO Players VALUES(?, ?, ?);");
diff --git a/src/server/database.hh b/src/server/database.hh
index 154cdf2..13798a1 100644
--- a/src/server/database.hh
+++ b/src/server/database.hh
@@ -13,7 +13,7 @@
#include "server/shared.hh"
#include "shared/net/net.hh"
#include "shared/shared.hh"
-#include "shared/world.hh"
+#include "shared/world/chunk.hh"
namespace server {
namespace database {
diff --git a/src/server/init.cc b/src/server/init.cc
new file mode 100644
index 0000000..31dca46
--- /dev/null
+++ b/src/server/init.cc
@@ -0,0 +1,45 @@
+#include "server/init.hh"
+
+namespace server {
+
+const shared::args_t& get_options() {
+ static shared::args_t ret{
+ {.name = "seed", .desc = "manually set the worldseed", .val = "S:"},
+ {.name = "directory",
+ .desc = "manually set the directory",
+ .val = "d:"},
+ {.name = "tickrate",
+ .desc = "override the default tickrate",
+ .val = "t:"},
+ {.name = "distance",
+ .desc = "limit the max chunk distance the server provides",
+ .val = "D:"},
+ };
+ return ret;
+}
+
+bool parse_arg(const int& c, const char* const arg) {
+ switch (c) {
+ case 'S':
+ server::state.seed =
+ boost::lexical_cast<decltype(server::state.seed)>(arg);
+ break;
+ case 'd':
+ server::state.directory =
+ boost::lexical_cast<decltype(server::state.directory)>(arg);
+ break;
+ case 't':
+ server::state.tickrate =
+ boost::lexical_cast<decltype(server::state.tickrate)>(arg);
+ break;
+ case 'D':
+ server::state.draw_distance =
+ boost::lexical_cast<decltype(server::state.draw_distance)>(arg);
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+} // namespace server
diff --git a/src/server/init.hh b/src/server/init.hh
new file mode 100644
index 0000000..2dcd2b0
--- /dev/null
+++ b/src/server/init.hh
@@ -0,0 +1,15 @@
+#ifndef SERVER_INIT_HH_
+#define SERVER_INIT_HH_
+
+#include "server/shared.hh"
+#include "shared/init.hh"
+
+namespace server {
+
+const shared::args_t& get_options();
+
+bool parse_arg(const int& c, const char* const arg);
+
+} // namespace server
+
+#endif
diff --git a/src/server/movement.cc b/src/server/movement.cc
deleted file mode 100644
index 42b17f1..0000000
--- a/src/server/movement.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "server/movement.hh"
-
-// Gets blocks from chunks, returning nullopt if it doesn't exist.
-static std::optional<shared::world::block>
-get_block(const shared::math::coords& pos, server::resources::chunk_map& chunks,
- const glm::ivec3& block_pos) noexcept {
-
- const auto find_it = chunks.find(pos);
- if (find_it == std::end(chunks)) {
- return std::nullopt;
- }
- auto& chunk_data = find_it->second;
- if (!chunk_data->has_initialised()) {
- return std::nullopt;
- }
-
- return chunk_data->get_chunk().get_block(block_pos);
-}
-
-static std::optional<std::vector<shared::movement::blockinfo>>
-make_blockinfos(server::client& client,
- server::resources::chunk_map& chunks) noexcept {
-
- std::vector<shared::movement::blockinfo> blockinfos;
-
- constexpr int width = shared::movement::move_width;
- constexpr int height = shared::movement::move_height;
- for (int x = -width; x <= width; ++x) {
- for (int y = -height; y <= height; ++y) {
- for (int z = -width; z <= width; ++z) {
-
- const glm::ivec3 rel_pos =
- glm::ivec3{x, y, z} +
- glm::ivec3{client.get_player().local_pos};
-
- if (rel_pos.y < 0 ||
- rel_pos.y >= shared::world::chunk::HEIGHT) {
- continue;
- }
-
- const shared::math::coords norm_chunk_pos =
- shared::world::chunk::get_normalised_chunk(
- client.get_player().chunk_pos, rel_pos.x, rel_pos.z);
- const glm::ivec3 norm_pos =
- shared::world::chunk::get_normalised_coords(rel_pos);
-
- const auto block = get_block(norm_chunk_pos, chunks, norm_pos);
-
- if (!block.has_value()) {
- return std::nullopt;
- }
-
- const glm::vec3 pos =
- glm::vec3{rel_pos} - client.get_player().local_pos;
-
- const shared::movement::aabb aabb = {
- .min = glm::vec3{0.0f, 0.0f, 0.0f} + pos,
- .max = glm::vec3{1.0f, 1.0f, 1.0f} + pos};
- blockinfos.push_back(
- shared::movement::blockinfo{.block = *block,
- .aabb = aabb,
- .chunk_pos = norm_chunk_pos,
- .pos = norm_pos});
- }
- }
- }
-
- return blockinfos;
-}
-
-void server::movement::move(server::client& client,
- server::resources::chunk_map& chunks) noexcept {
-
- if (!client.has_initialised()) {
- return;
- }
-
- const auto blockinfos = make_blockinfos(client, chunks);
-
- if (!blockinfos.has_value()) {
- return;
- }
-
- const float deltatime = 1.0f / static_cast<float>(server::state.tickrate);
-
- shared::movement::move(client.get_player(), *blockinfos, deltatime);
-}
diff --git a/src/server/movement/movement.cc b/src/server/movement/movement.cc
new file mode 100644
index 0000000..0dd3f28
--- /dev/null
+++ b/src/server/movement/movement.cc
@@ -0,0 +1,98 @@
+#include "server/movement/movement.hh"
+
+namespace server {
+namespace movement {
+
+// Gets blocks from chunks, returning nullopt if it doesn't exist.
+static std::optional<shared::world::block>
+maybe_get_block(const shared::math::coords& pos,
+ server::resources::chunk_map& chunks,
+ const glm::ivec3& block_pos) noexcept {
+
+ const auto find_it = chunks.find(pos);
+ if (find_it == std::end(chunks)) {
+ return std::nullopt;
+ }
+ auto& chunk_data = find_it->second;
+ if (!chunk_data->has_initialised()) {
+ return std::nullopt;
+ }
+
+ return chunk_data->get_chunk().get_block(block_pos);
+}
+
+static std::optional<shared::movement::blocks>
+maybe_make_blocks(server::client& client,
+ server::resources::chunk_map& chunks) noexcept {
+
+ shared::movement::blocks blocks;
+
+ const auto xy = shared::movement::get_move_xy(server::state.tickrate,
+ client.get_player());
+ for (int x = -xy.x; x <= xy.x; ++x) {
+ for (int y = -xy.y; y <= xy.y; ++y) {
+ for (int z = -xy.x; z <= xy.x; ++z) {
+
+ const glm::ivec3 rel_pos =
+ glm::ivec3{x, y, z} +
+ glm::ivec3{client.get_player().get_local_pos()};
+
+ if (rel_pos.y < 0 ||
+ rel_pos.y >= shared::world::chunk::HEIGHT) {
+ continue;
+ }
+
+ const shared::math::coords norm_chunk_pos =
+ shared::world::chunk::get_normalised_chunk(
+ client.get_player().get_chunk_pos(), rel_pos.x,
+ rel_pos.z);
+ const glm::ivec3 norm_pos =
+ shared::world::chunk::get_normalised_coords(rel_pos);
+
+ const auto block =
+ maybe_get_block(norm_chunk_pos, chunks, norm_pos);
+ if (!block.has_value()) {
+ return std::nullopt;
+ }
+
+ const glm::vec3 pos =
+ glm::vec3{rel_pos} - client.get_player().get_local_pos();
+
+ const shared::movement::aabb aabb = {
+ .min = glm::vec3{0.0f, 0.0f, 0.0f} + pos,
+ .max = glm::vec3{1.0f, 1.0f, 1.0f} + pos};
+ blocks.push_back(
+ shared::movement::block{.block = *block,
+ .aabb = aabb,
+ .chunk_pos = norm_chunk_pos,
+ .pos = norm_pos});
+ }
+ }
+ }
+
+ return blocks;
+}
+
+void move(client& client, resources::chunk_map& chunks) noexcept {
+
+ if (!client.has_initialised()) {
+ return;
+ }
+
+ const auto blocks = maybe_make_blocks(client, chunks);
+ if (!blocks.has_value()) {
+ return;
+ }
+
+ auto& player = client.get_player();
+
+ const shared::animate result =
+ shared::movement::move(player, *blocks, state.tickrate);
+
+ player.get_mutable_velocity() = result.get_velocity();
+ player.get_mutable_local_pos() = result.get_local_pos();
+ player.get_mutable_chunk_pos() = result.get_chunk_pos();
+}
+
+} // namespace movement
+} // namespace server
diff --git a/src/server/movement.hh b/src/server/movement/movement.hh
index 2c647b3..0b09a24 100644
--- a/src/server/movement.hh
+++ b/src/server/movement/movement.hh
@@ -1,10 +1,10 @@
-#ifndef SERVER_MOVEMENT_HH_
-#define SERVER_MOVEMENT_HH_
+#ifndef SERVER_MOVEMENT_MOVEMENT_HH_
+#define SERVER_MOVEMENT_MOVEMENT_HH_
#include "server/client.hh"
#include "server/resources.hh"
-#include "server/world.hh"
-#include "shared/movement.hh"
+#include "server/world/chunk.hh"
+#include "shared/movement/movement.hh"
namespace server {
diff --git a/src/server/resources.cc b/src/server/resources.cc
index 7eb3d8b..9b4a1b8 100644
--- a/src/server/resources.cc
+++ b/src/server/resources.cc
@@ -46,6 +46,7 @@ void quit() noexcept {
sleep();
continue;
}
+
while (!get_resources_lock()->chunks.empty()) {
sleep();
continue;
diff --git a/src/server/resources.hh b/src/server/resources.hh
index 578a248..a7d2faf 100644
--- a/src/server/resources.hh
+++ b/src/server/resources.hh
@@ -12,9 +12,8 @@
#include "server/chunk_data.hh"
#include "server/client.hh"
#include "server/database.hh"
-#include "server/world.hh"
-#include "shared/player.hh"
-#include "shared/world.hh"
+#include "shared/entity/player.hh"
+#include "shared/world/chunk.hh"
namespace server {
namespace resources {
diff --git a/src/server/server.cc b/src/server/server.cc
index 72faa03..4592334 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -2,25 +2,39 @@
namespace server {
-static proto::packet
-make_init_packet(const resources::client_map_value& client) noexcept {
- proto::packet packet;
-
- const auto init_packet = packet.mutable_init_packet();
- init_packet->set_seed(state.seed);
- init_packet->set_draw_distance(state.draw_distance);
- shared::net::set_player(*init_packet->mutable_localplayer(),
- client->get_player());
+static std::uint32_t& get_tick() noexcept {
+ static std::uint32_t ret = 0;
+ return ret;
+}
+static proto::player make_player_packet(const shared::player& player) noexcept {
+ proto::player packet;
+ player.pack(&packet);
return packet;
}
-static proto::packet make_player_packet(const shared::player& player) noexcept {
+static proto::packet
+make_animate_update_packet(const shared::animate& animate, const std::optional<shared::tick_t>& sequence) noexcept {
proto::packet packet;
+ const auto animate_update = packet.mutable_animate_update_packet();
+ animate.pack(animate_update->mutable_animate());
+ animate_update->set_tick(get_tick());
+ if (sequence.has_value()) {
+ animate_update->set_sequence(*sequence);
+ }
+ return packet;
+}
- const auto player_packet = packet.mutable_player_packet();
- shared::net::set_player(*player_packet, player);
+static proto::packet
+make_init_packet(const resources::client_map_value& client) noexcept {
+ proto::packet packet;
+ const auto init_packet = packet.mutable_init_packet();
+ init_packet->set_seed(state.seed);
+ init_packet->set_draw_distance(state.draw_distance);
+ init_packet->set_tickrate(state.tickrate);
+ init_packet->set_tick(get_tick());
+ (*client->player_info)->player.pack(init_packet->mutable_localplayer());
return packet;
}
@@ -39,7 +53,7 @@ static proto::packet
make_remove_packet(const resources::client_map_value& client) noexcept {
proto::packet packet;
- const auto remove_packet = packet.mutable_remove_player_packet();
+ const auto remove_packet = packet.mutable_remove_entity_packet();
remove_packet->set_index(client->index);
return packet;
@@ -62,12 +76,11 @@ static proto::packet make_chunk_packet(const world::chunk& chunk) noexcept {
static void block_by_tickrate() noexcept {
const auto tickrate = server::state.tickrate;
- static const auto ratetime = std::chrono::milliseconds(
- static_cast<int>((1.0 / static_cast<double>(tickrate)) * 1000.0));
- static auto prev = std::chrono::steady_clock::now();
- const auto now = std::chrono::steady_clock::now();
- std::this_thread::sleep_for(ratetime - (now - prev));
- prev = std::chrono::steady_clock::now();
+ static const auto ratetime = std::chrono::microseconds(
+ static_cast<int>((1.0 / static_cast<double>(tickrate)) * 1'000'000));
+ static auto wanted = std::chrono::steady_clock::now();
+ std::this_thread::sleep_until(wanted);
+ wanted += ratetime;
}
// Creates, binds, listens on new nonblocking socket.
@@ -89,14 +102,52 @@ static std::optional<shared::net::connection> make_connection(const int sock) {
if (!accept.has_value()) {
return std::nullopt;
}
- return shared::net::connection(accept->socket);
+
+ try {
+ return shared::net::connection(accept->socket);
+ } catch (const std::runtime_error& e) {
+#ifndef NDEBUG
+ shared::print::debug
+ << shared::print::time
+ << "server: constructor for client connection failed; what(): "
+ << e.what() << '\n';
+#endif
+ }
+
+ return std::nullopt;
+}
+
+static void move_client(resources::client_map_value& client,
+ resources::chunk_map& chunks) noexcept {
+ movement::move(*client, chunks);
}
static void handle_move_packet(const proto::move& packet,
- resources::client_map_value& client) noexcept {
- client->get_player().viewangles = {.pitch = packet.viewangles().pitch(),
- .yaw = packet.viewangles().yaw()};
- client->get_player().commands = packet.commands();
+ resources::client_map_value& client,
+ resources::chunk_map& chunks) noexcept {
+ if (!client->has_initialised()) {
+ return;
+ }
+
+ const shared::tick_t sequence = packet.sequence();
+ if (sequence <= client->sequence) { // Packet is late, drop it.
+#ifndef NDEBUG
+ shared::print::debug << shared::print::time
+ << "server: client sent late tick " << sequence
+ << " <= " << client->sequence << '\n';
+#endif
+ return;
+ }
+ client->sequence = sequence;
+
+ auto& player = client->get_player();
+ player.get_mutable_angles() = {.pitch = packet.viewangles().pitch(),
+ .yaw = packet.viewangles().yaw()};
+ player.get_mutable_angles().clamp();
+ player.get_mutable_commands() = packet.commands();
+ player.get_mutable_active_item() = packet.active_item();
+
+ move_client(client, chunks);
}
static void handle_say_packet(const proto::say& packet,
@@ -104,18 +155,24 @@ static void handle_say_packet(const proto::say& packet,
server::resources::client_map& clients) noexcept {
if (std::size(packet.text()) > shared::MAX_SAY_LENGTH) {
#ifndef NDEBUG
- shared::print::warn(
- "server: client tried to say a message that was too long, size: " +
- std::to_string(std::size(packet.text())) + '\n');
+ shared::print::debug
+ << shared::print::time
+ << "server: client tried to say a message that was too long, size: "
+ << std::size(packet.text()) << '\n';
#endif
return;
}
- shared::print::message("server: player " + std::to_string(client->index) +
- " said \"" + packet.text() + "\"\n");
- const auto hear_packet = make_hear_packet(packet.text(), client->index);
+ shared::print::message << shared::print::time << "server: player "
+ << client->index << " said \"" << packet.text()
+ << "\"\n";
+ const auto hear_packet = std::make_shared<shared::net::rpacket>(
+ make_hear_packet(packet.text(), client->index));
for (auto& [index, client_ptr] : clients) {
+ if (!client_ptr->is_in_pvs(*client)) {
+ continue;
+ }
client_ptr->connection.rsend_packet(hear_packet);
}
}
@@ -145,9 +202,9 @@ static void send_chunk_associated(resources::chunk_map_value& chunk_data,
// correctly.
if (find_it == std::end(clients)) {
#ifndef NDEBUG
- shared::print::debug(
- "client index " + std::to_string(client_index) +
- " was associated with a chunk, but not found\n");
+ shared::print::debug
+ << shared::print::time << "client index " << client_index
+ << " was associated with a chunk, but not found\n";
#endif
continue;
}
@@ -209,33 +266,45 @@ static void handle_request_chunk_packet(const proto::request_chunk& packet,
resources::client_map_value& client,
resources::chunk_map& chunks,
resources::pool_t& pool) noexcept {
+ if (!client->has_initialised()) {
+ return;
+ }
const shared::math::coords coords{packet.chunk_pos().x(),
packet.chunk_pos().z()};
if (const auto find_it = chunks.find(coords); find_it != std::end(chunks)) {
auto& chunk_data = find_it->second;
+
+ // Associate client, then post sending of chunk to client.
resources::associate_client_chunk(coords, client, chunk_data);
boost::asio::post(
- pool,
- std::bind(
- [](const shared::math::coords coords,
- const shared::player::index_t index) {
- auto res_lock = resources::get_resources_lock();
- auto& chunk_data = res_lock->chunks.find(coords)->second;
-
- if (!chunk_data->has_initialised()) {
- return; // will be sent on construction
- }
-
- const auto& client_it = res_lock->clients.find(index);
- if (client_it == std::end(res_lock->clients)) {
- return;
- }
- auto& client = client_it->second;
- send_chunk(chunk_data->get_chunk(), client);
- maybe_post_chunk_rm(coords, chunk_data, res_lock->pool);
- },
- coords, client->index));
+ pool, std::bind(
+ [](const shared::math::coords coords,
+ const shared::player::index_t index) {
+ auto res_lock = resources::get_resources_lock();
+
+ // Client has requested a chunk removed before
+ // receiving it?
+ const auto find_it = res_lock->chunks.find(coords);
+ if (find_it == std::end(res_lock->chunks)) {
+ return;
+ }
+ auto& chunk_data = find_it->second;
+
+ if (!chunk_data->has_initialised()) {
+ return; // will be sent on construction
+ }
+
+ const auto& client_it = res_lock->clients.find(index);
+ if (client_it == std::end(res_lock->clients)) {
+ return;
+ }
+ auto& client = client_it->second;
+ send_chunk(chunk_data->get_chunk(), client);
+ maybe_post_chunk_rm(coords, chunk_data,
+ res_lock->pool);
+ },
+ coords, client->index));
return;
}
@@ -247,19 +316,26 @@ static void handle_request_chunk_packet(const proto::request_chunk& packet,
resources::associate_client_chunk(coords, client, data);
boost::asio::post(
- pool,
- std::bind(
- [](const shared::math::coords coords) {
- server::world::chunk chunk{server::state.seed, coords};
+ pool, std::bind(
+ [](const shared::math::coords coords) {
+ auto chunk =
+ [&coords]() -> std::shared_ptr<server::world::chunk> {
+ auto maybe_chunk = database::maybe_read_chunk(coords);
+ if (maybe_chunk.has_value()) {
+ return std::make_shared<server::world::chunk>(
+ server::state.seed, *maybe_chunk);
+ }
+ return std::make_shared<server::world::chunk>(
+ server::state.seed, coords);
+ }();
- auto res_lock = resources::get_resources_lock();
- auto& chunk_data = res_lock->chunks.find(coords)->second;
- chunk_data->chunk.emplace(
- std::make_unique<server::world::chunk>(std::move(chunk)));
- send_chunk_associated(chunk_data, res_lock->clients);
- maybe_post_chunk_rm(coords, chunk_data, res_lock->pool);
- },
- coords));
+ auto res_lock = resources::get_resources_lock();
+ auto& chunk_data = res_lock->chunks.find(coords)->second;
+ chunk_data->chunk.emplace(std::move(chunk));
+ send_chunk_associated(chunk_data, res_lock->clients);
+ maybe_post_chunk_rm(coords, chunk_data, res_lock->pool);
+ },
+ coords));
}
// Disassociates a client with a chunk, while performing necessary cleanups.
@@ -310,17 +386,21 @@ static void post_chunk_update(const shared::math::coords& coords,
coords));
}
-static void modify_block(const enum shared::world::block::type block_type,
- const glm::ivec3& block_pos,
- const shared::math::coords& coords,
- resources::chunk_map& chunks) noexcept {
+static void
+handle_add_block_packet(const proto::add_block& packet,
+ [[maybe_unused]] resources::client_map_value& client,
+ server::resources::chunk_map& chunks,
+ resources::pool_t& pool) noexcept {
+
+ const auto coords = shared::net::get_coords(packet.chunk_pos());
+ const auto pos = shared::net::get_ivec3(packet.block_pos());
+ const auto active_item = packet.active_item();
const auto find_it = chunks.find(coords);
if (find_it == std::end(chunks)) {
return;
}
-
- if (shared::world::chunk::is_outside_chunk(block_pos)) {
+ if (shared::world::chunk::is_outside_chunk(pos)) {
return;
}
@@ -329,22 +409,24 @@ static void modify_block(const enum shared::world::block::type block_type,
return;
}
- chunk_data->get_chunk().get_block(block_pos) = block_type;
- chunk_data->get_chunk().arm_should_update();
-}
+ auto& inventory = client->get_player().inventory;
+ if (active_item < 0 || active_item >= std::size(inventory.contents)) {
+ return;
+ }
-static void
-handle_add_block_packet(const proto::add_block& packet,
- [[maybe_unused]] resources::client_map_value& client,
- server::resources::chunk_map& chunks,
- resources::pool_t& pool) noexcept {
- const shared::math::coords coords{packet.chunk_pos().x(),
- packet.chunk_pos().z()};
- const glm::ivec3 block_pos{packet.block_pos().x(), packet.block_pos().y(),
- packet.block_pos().z()};
- const auto block =
- static_cast<enum shared::world::block::type>(packet.block());
- modify_block(block, block_pos, coords, chunks);
+ const auto& item = inventory.contents[active_item];
+ if (item == nullptr) {
+ return;
+ }
+ const auto block_ptr = dynamic_cast<shared::item::block*>(&*item);
+ if (block_ptr == nullptr) {
+ return;
+ }
+
+ chunk_data->get_chunk().get_block(pos) = block_ptr->type;
+ inventory.decrement(active_item);
+
+ chunk_data->get_chunk().arm_should_update();
post_chunk_update(coords, pool);
}
@@ -353,11 +435,30 @@ handle_remove_block_packet(const proto::remove_block& packet,
[[maybe_unused]] resources::client_map_value& client,
resources::chunk_map& chunks,
resources::pool_t& pool) noexcept {
- const shared::math::coords coords{packet.chunk_pos().x(),
- packet.chunk_pos().z()};
- const glm::ivec3 block_pos{packet.block_pos().x(), packet.block_pos().y(),
- packet.block_pos().z()};
- modify_block(shared::world::block::type::air, block_pos, coords, chunks);
+ const auto coords = shared::net::get_coords(packet.chunk_pos());
+ const auto pos = shared::net::get_ivec3(packet.block_pos());
+
+ const auto find_it = chunks.find(coords);
+ if (find_it == std::end(chunks)) {
+ return;
+ }
+ if (shared::world::chunk::is_outside_chunk(pos)) {
+ return;
+ }
+
+ auto& chunk_data = find_it->second;
+ if (!chunk_data->has_initialised()) {
+ return;
+ }
+
+ auto& block = chunk_data->get_chunk().get_block(pos);
+
+ auto& inventory = client->get_player().inventory;
+ inventory.maybe_add(shared::item::block::get_type(block.type), 1);
+
+ block = shared::world::block::type::air;
+
+ chunk_data->get_chunk().arm_should_update();
post_chunk_update(coords, pool);
}
@@ -379,47 +480,58 @@ static void handle_auth_packet(const proto::auth& packet,
auto& client = find_it->second;
// find if we're already associated, eventually kick our client
- // it would be nice if this wasn't a find_if
- if (std::find_if(std::begin(res_lock->clients),
- std::end(res_lock->clients),
- [&](const auto& it) {
- auto& client = it.second;
- if (!client->has_initialised()) {
- return false;
- }
- return client->index != client_index &&
- client->get_username() == user;
- }) != std::end(res_lock->clients)) {
-
+ if (std::ranges::any_of(res_lock->clients,
+ [&client_index, &user](const auto& it) {
+ const auto& [idx, c] = it;
+ if (idx == client_index) {
+ return false;
+ }
+ if (!c->has_initialised()) {
+ return false;
+ }
+ if (c->get_username() != user) {
+ return false;
+ }
+ return true;
+ })) {
client->disconnect_reason.emplace("user already in server");
return;
}
- struct client::player_info player_info {
- .username = user, .password = pass
- };
- if (db_plr.has_value()) {
- auto& [player, db_password] = *db_plr;
+ const auto in_db = db_plr.has_value();
+ if (in_db && db_plr->second != pass) {
+ client->disconnect_reason.emplace("bad password");
+ return;
+ }
- if (db_password != pass) {
- client->disconnect_reason.emplace("bad password");
- return;
+ shared::player player = [&]() -> shared::player {
+ if (in_db) {
+ // update to new client_index before returning
+ shared::player player{db_plr->first};
+ player.get_mutable_index() = client_index;
+ return player;
}
-
- player_info.player = shared::net::get_player(player);
- player_info.player.index = client_index;
- } else {
// TODO: Find a random spawn chunk and put the player
// on the highest block. Because we don't want to gen chunks
// while blocking, we can't do this here. For now, we'll
// just put the player at a high spot.
- player_info.player =
- shared::player{.index = client_index,
- .local_pos = {0.0f, 140.0f, 0.0f}};
- }
+ return shared::player{
+ shared::item::items{},
+ 0u,
+ shared::math::angles{0.0f, 0.0f},
+ glm::vec3{0.0f, 0.0f, 0.0f},
+ 0u,
+ client_index,
+ shared::math::coords{0, 0},
+ glm::vec3{0.0f, 120.0f, 0.0f},
+ };
+ }();
+
+ using pi = struct client::player_info;
client->player_info.emplace(
- std::make_shared<struct client::player_info>(
- std::move(player_info)));
+ std::make_shared<pi>(pi{.username = user,
+ .password = pass,
+ .player = std::move(player)}));
client->connection.rsend_packet(make_init_packet(client));
},
@@ -427,6 +539,30 @@ static void handle_auth_packet(const proto::auth& packet,
std::move(packet.password())));
}
+static void
+handle_item_swap_packet(const proto::item_swap& proto,
+ const resources::client_map_value& client) noexcept {
+ auto& inventory = client->get_player().inventory;
+
+ const auto a = proto.index_a();
+ const auto b = proto.index_b();
+
+ if (a == b) {
+ return;
+ }
+ const auto in_range = [&](const auto val) {
+ const auto MAX_SIZE =
+ static_cast<std::uint32_t>(std::size(inventory.contents));
+ return std::clamp(val, 0u, MAX_SIZE) == val;
+ };
+
+ if (!in_range(a) || !in_range(b)) {
+ return;
+ }
+
+ std::swap(inventory.contents[a], inventory.contents[b]);
+}
+
// Get new packets from clients, this will change client data and worldata.
static void parse_client_packets(resources::client_map_value& client,
resources::resources& res) noexcept {
@@ -434,7 +570,7 @@ static void parse_client_packets(resources::client_map_value& client,
if (packet->has_auth_packet()) {
handle_auth_packet(packet->auth_packet(), client, res.pool);
} else if (packet->has_move_packet()) {
- handle_move_packet(packet->move_packet(), client);
+ handle_move_packet(packet->move_packet(), client, res.chunks);
} else if (packet->has_say_packet()) {
handle_say_packet(packet->say_packet(), client, res.clients);
} else if (packet->has_request_chunk_packet()) {
@@ -449,10 +585,13 @@ static void parse_client_packets(resources::client_map_value& client,
} else if (packet->has_remove_block_packet()) {
handle_remove_block_packet(packet->remove_block_packet(), client,
res.chunks, res.pool);
+ } else if (packet->has_item_swap_packet()) {
+ handle_item_swap_packet(packet->item_swap_packet(), client);
}
#ifndef NDEBUG
else {
- shared::print::warn("server: unhandled packet type\n");
+ shared::print::debug << shared::print::time
+ << "server: unhandled packet type\n";
}
#endif
}
@@ -462,7 +601,8 @@ static void parse_client_packets(resources::client_map_value& client,
static void
send_remove_packets(server::resources::client_map_value& remove_client,
server::resources::client_map& clients) noexcept {
- const auto remove_packet = make_remove_packet(remove_client);
+ const auto remove_packet = std::make_shared<shared::net::rpacket>(
+ make_remove_packet(remove_client));
for (auto& [index, client_ptr] : clients) {
client_ptr->connection.rsend_packet(remove_packet);
}
@@ -470,8 +610,9 @@ send_remove_packets(server::resources::client_map_value& remove_client,
static void handle_new_connections(shared::net::connection& connection,
resources::resources& res) noexcept {
- shared::print::message("server: got connection from " +
- connection.get_address() + '\n');
+ shared::print::message << shared::print::time
+ << "server: got connection from "
+ << connection.get_address() << '\n';
// Add the client, waiting for an auth packet.
static uint32_t index = 0;
@@ -481,25 +622,25 @@ static void handle_new_connections(shared::net::connection& connection,
++index;
}
-static void move_client(resources::client_map_value& client,
- resources::chunk_map& chunks) noexcept {
- // shared::movement::fly(client.player, client.commands);
- movement::move(*client, chunks);
-}
-
static void send_client_packets(resources::client_map_value& client,
resources::resources& res) noexcept {
- // TODO PVS, as simple as checking if a client has our chunk pos in their
- // associated chunks list
+
+ if (!client->has_initialised()) {
+ return;
+ }
+ const auto non_local_packet = std::make_shared<shared::net::upacket>(
+ make_animate_update_packet(client->get_player(), std::nullopt));
for (auto& [index, c] : res.clients) {
- if (!c->has_initialised()) {
- continue;
- }
- if (!client->chunks.contains(c->get_player().chunk_pos)) {
+ if (!c->is_in_pvs(*client)) {
continue;
}
- client->connection.usend_packet(make_player_packet(c->get_player()));
+ // only network the last received sequence if sending an animate packet for the client's local player
+ if (c->index == client->index) {
+ c->connection.usend_packet( make_animate_update_packet(client->get_player(), client->sequence) );
+ } else {
+ c->connection.usend_packet(non_local_packet);
+ }
}
}
@@ -510,15 +651,17 @@ get_sent_disconnect_reason(const resources::client_map_value& client) noexcept {
return client->connection.get_bad_reason();
}
- if (client->chunks.size() >
- unsigned(state.draw_distance * state.draw_distance * 4)) {
+ if (static const unsigned max = static_cast<unsigned>(
+ state.draw_distance * state.draw_distance * 4);
+ client->chunks.size() > max) {
return "too many chunks associated with client";
}
return client->disconnect_reason;
}
-static void remove_bad_clients(resources::resources& res) noexcept {
+static void remove_bad_clients(resources::resources& res,
+ const bool send_remove = true) noexcept {
for (auto& [index, client] : res.clients) {
const auto reason = get_sent_disconnect_reason(client);
if (reason == std::nullopt) {
@@ -530,11 +673,18 @@ static void remove_bad_clients(resources::resources& res) noexcept {
}
client->disconnecting = true;
- shared::print::message("server: dropped " +
- client->connection.get_address() + " for \"" +
- *reason + "\"\n");
- send_message("disconnected for " + *reason, client, true);
- send_remove_packets(client, res.clients);
+ shared::print::message << shared::print::time << "server: dropped "
+ << client->connection.get_address() << " for \""
+ << *reason << "\"\n";
+ send_message(*reason, client, true);
+ if (send_remove) {
+ send_remove_packets(client, res.clients);
+ }
+
+ // Close early so the client may reconnect and receive a better message
+ // than a generic errno error if they connect too fast later.
+ client->connection.poll();
+ client->connection.close();
boost::asio::post(
res.pool,
@@ -546,8 +696,7 @@ static void remove_bad_clients(resources::resources& res) noexcept {
if (plr_info.has_value()) {
database::write_player(
(*plr_info)->username, (*plr_info)->password,
- make_player_packet((*plr_info)->player)
- .player_packet());
+ make_player_packet((*plr_info)->player));
}
// cleanup associated chunks
@@ -583,9 +732,10 @@ static void process_resources(resources::resources& res) noexcept {
}
// Move clients via their (hopefully updated) command.
- for (auto& [index, client] : res.clients) {
+ // CHANGED: we now do this when we get move packets
+ /*for (auto& [index, client] : res.clients) {
move_client(client, res.chunks);
- }
+ }*/
// Send packets which are sent once per tick, as of now the player
// struct of other clients.
@@ -593,9 +743,15 @@ static void process_resources(resources::resources& res) noexcept {
send_client_packets(client, res);
}
+ // Send queued packets.
+ for (auto& [index, client] : res.clients) {
+ client->connection.poll();
+ }
+
// Delete bad connections, print if it happens. Also sends a remove
// to all clients per client removed.
remove_bad_clients(res);
+ ++get_tick();
}
void main(const std::string_view address, const std::string_view port) {
@@ -603,8 +759,8 @@ void main(const std::string_view address, const std::string_view port) {
server::resources::init();
has_initialised = true;
- shared::print::notify("server: started at " + std::string{address} + ':' +
- std::string{port} + '\n');
+ shared::print::notify << shared::print::time << "server: started at "
+ << address << ':' << port << '\n';
// Server has a tickrate, we will use non-blocking polling at this
// tickrate.
@@ -629,12 +785,14 @@ void main(const std::string_view address, const std::string_view port) {
const auto& client = it.second;
client->disconnect_reason.emplace("server shutting down");
});
- remove_bad_clients(*res_lock);
+ remove_bad_clients(*res_lock, false);
}
- shared::print::notify("server: writing world data\n");
+ shared::print::notify << shared::print::time
+ << "server: writing world data\n";
server::resources::quit();
- shared::print::notify("server: gracefully exited\n");
+ shared::print::notify << shared::print::time
+ << "server: gracefully exited\n";
}
} // namespace server
diff --git a/src/server/server.hh b/src/server/server.hh
index bd2d5fd..d40827e 100644
--- a/src/server/server.hh
+++ b/src/server/server.hh
@@ -20,12 +20,12 @@
#include "server/client.hh"
#include "server/database.hh"
-#include "server/movement.hh"
+#include "server/movement/movement.hh"
#include "server/resources.hh"
-#include "server/world.hh"
+#include "server/world/chunk.hh"
+#include "shared/entity/player.hh"
#include "shared/net/net.hh"
#include "shared/net/proto.hh"
-#include "shared/player.hh"
#include "shared/shared.hh"
namespace server {
diff --git a/src/server/shared.hh b/src/server/shared.hh
index ffbf0f9..608e25e 100644
--- a/src/server/shared.hh
+++ b/src/server/shared.hh
@@ -10,7 +10,7 @@ struct state {
int draw_distance = 32;
std::uint64_t seed = 123456789;
std::string directory = "world/";
- std::uint32_t tickrate = 144;
+ std::uint32_t tickrate = 20;
};
inline state state;
diff --git a/src/server/world.cc b/src/server/world.cc
deleted file mode 100644
index 6527d6c..0000000
--- a/src/server/world.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "server/world.hh"
-
-namespace server {
-namespace world {
-
-proto::packet chunk::make_chunk_packet() const noexcept {
-
- proto::packet ret_packet;
-
- auto chunk_packet = ret_packet.mutable_chunk_packet();
-
- auto chunk_pos = chunk_packet->mutable_chunk_pos();
- const shared::math::coords this_chunk_pos = this->get_pos();
- chunk_pos->set_x(this_chunk_pos.x);
- chunk_pos->set_z(this_chunk_pos.z);
-
- // Since protobuf can store at minimum uint32, we mash four of our
- // uint_8 chunk blocks into a single uint32.
- static_assert(shared::world::chunk::VOLUME % 4 == 0);
- for (unsigned i = 0u; i < shared::world::chunk::VOLUME / 4u; ++i) {
- std::uint32_t packed_blocks = 0u;
-
- for (unsigned j = 0; j < 4; ++j) {
- const auto block =
- static_cast<std::uint8_t>(this->blocks[i * 4 + j].type);
- packed_blocks |= static_cast<unsigned>(block << j * 8);
- }
-
- chunk_packet->add_blocks(packed_blocks);
- }
-
- return ret_packet;
-}
-
-static std::optional<shared::world::chunk::block_array>
-maybe_get_blocks(const shared::math::coords& coords) {
- const auto chunk = database::maybe_read_chunk(coords);
- if (!chunk.has_value()) {
- return std::nullopt;
- }
- return shared::world::chunk::make_blocks_from_chunk(chunk.value());
-}
-
-chunk::chunk(const std::uint64_t& seed,
- const shared::math::coords& coords) noexcept
- : shared::world::chunk(seed, coords, maybe_get_blocks(coords)) {
- this->update();
-}
-
-chunk::~chunk() noexcept { this->write(); }
-
-} // namespace world
-} // namespace server
diff --git a/src/server/world.hh b/src/server/world.hh
deleted file mode 100644
index 134f63b..0000000
--- a/src/server/world.hh
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef SERVER_WORLD_HH_
-#define SERVER_WORLD_HH_
-
-#include <cstdint>
-
-#include "server/database.hh"
-#include "server/shared.hh"
-#include "shared/math.hh"
-#include "shared/net/net.hh"
-#include "shared/net/proto.hh"
-#include "shared/player.hh"
-#include "shared/world.hh"
-
-namespace server {
-namespace world {
-
-class chunk : public shared::world::chunk {
-private:
- bool should_write = false;
- bool should_update = true;
-
-public:
- proto::packet packet; // Packet ready for sending, updated in update().
- void arm_should_update() noexcept {
- this->should_update = this->should_write = true;
- }
- bool get_should_update() noexcept { return this->should_update; }
-
-private:
- proto::packet make_chunk_packet() const noexcept;
-
-public:
- // Attempt to read the file using protobuf, otherwise create a new chunk.
- // chunk(const chunk&) = delete;
- chunk(const uint64_t& seed, const shared::math::coords& coords) noexcept;
- ~chunk() noexcept;
-
- // Update the chunk_packet associated with the chunk if necessary.
- void update() noexcept {
- if (!this->should_update) {
- return;
- }
- this->packet = make_chunk_packet();
- this->should_update = false;
- }
- // calling .write before the destrutor will not result in a double write
- void write() noexcept {
- if (!this->should_write) {
- return;
- }
- server::database::write_chunk(this->pos, this->packet.chunk_packet());
- this->should_write = false;
- }
-};
-
-} // namespace world
-} // namespace server
-
-#endif
diff --git a/src/server/world/chunk.cc b/src/server/world/chunk.cc
new file mode 100644
index 0000000..80a3da9
--- /dev/null
+++ b/src/server/world/chunk.cc
@@ -0,0 +1,26 @@
+#include "server/world/chunk.hh"
+
+namespace server {
+namespace world {
+
+void chunk::update() noexcept {
+ if (!this->should_update) {
+ return;
+ }
+ this->packet.clear_chunk_packet();
+ this->pack(packet.mutable_chunk_packet());
+ this->should_update = false;
+}
+
+void chunk::write() noexcept {
+ if (!this->should_write) {
+ return;
+ }
+ server::database::write_chunk(this->pos, this->packet.chunk_packet());
+ this->should_write = false;
+}
+
+chunk::~chunk() noexcept { this->write(); }
+
+} // namespace world
+} // namespace server
diff --git a/src/server/world/chunk.hh b/src/server/world/chunk.hh
new file mode 100644
index 0000000..b8fc73c
--- /dev/null
+++ b/src/server/world/chunk.hh
@@ -0,0 +1,46 @@
+#ifndef SERVER_WORLD_CHUNK_HH_
+#define SERVER_WORLD_CHUNK_HH_
+
+#include <cstdint>
+
+#include "server/database.hh"
+#include "server/shared.hh"
+#include "shared/entity/player.hh"
+#include "shared/math/math.hh"
+#include "shared/net/net.hh"
+#include "shared/net/proto.hh"
+#include "shared/world/chunk.hh"
+
+namespace server {
+namespace world {
+
+class chunk : public shared::world::chunk {
+private:
+ bool should_write = false;
+ bool should_update = true;
+
+public:
+ proto::packet packet; // Packet ready for sending, updated in update().
+ void arm_should_update() noexcept {
+ this->should_update = this->should_write = true;
+ }
+
+public:
+ template <typename... Args>
+ chunk(Args&&... args) noexcept
+ : shared::world::chunk(std::forward<Args>(args)...) {
+ this->pack(packet.mutable_chunk_packet());
+ }
+ virtual ~chunk() noexcept;
+
+public:
+ // Update the chunk_packet associated with the chunk if necessary.
+ void update() noexcept;
+ // calling .write before the destrutor will not result in a double write
+ void write() noexcept;
+};
+
+} // namespace world
+} // namespace server
+
+#endif
diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt
new file mode 100644
index 0000000..3a0e21c
--- /dev/null
+++ b/src/shared/CMakeLists.txt
@@ -0,0 +1,55 @@
+cmake_minimum_required(VERSION 3.18)
+
+project(shared)
+
+message (STATUS "Running protobuf precompiler")
+execute_process (
+ COMMAND protoc --proto_path=./net/lib/protobuf
+ --cpp_out=./net/lib/protobuf/
+ ./net/lib/protobuf/net.proto
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+file (GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
+ "*.cc"
+)
+file (GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS
+ "*.hh"
+)
+add_library(${PROJECT_NAME} STATIC
+ ${SOURCE_FILES}
+)
+
+find_library(LIB_PROTOBUF protobuf libprotobuf REQUIRED)
+set(PROTOBUF_LIBRARY "protobuf::libprotobuf")
+find_package(Boost COMPONENTS iostreams REQUIRED)
+find_package(Threads REQUIRED)
+find_package(Backtrace REQUIRED)
+
+target_compile_options(${PROJECT_NAME} PRIVATE
+ -Wall -Wextra -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common
+ -Wconversion -Wpedantic -std=c++20 -O2
+ -Wno-exceptions
+ -Wno-missing-field-initializers -Wno-unknown-pragmas
+)
+if (${IS_DEBUG})
+ target_compile_options(${PROJECT_NAME} PRIVATE
+ ¦ -fstack-protector-strong -fno-omit-frame-pointer -fsanitize=undefined
+ )
+ target_link_options(${PROJECT_NAME} PRIVATE
+ ¦ -fstack-protector-strong -fsanitize=undefined
+ )
+endif()
+target_include_directories(${PROJECT_NAME} PRIVATE
+ "${PROJECT_SOURCE_DIR}/../../src"
+)
+target_link_libraries(${PROJECT_NAME} PRIVATE
+ ${LIB_PROTOBUF}
+ ${Backtrace_LIBRARIES}
+ ${Threads_LIBRARIES}
+ ${Boost_LIBRARIES}
+ ${FREETYPE_LIBRARIES}
+)
+target_precompile_headers(${PROJECT_NAME} PRIVATE
+ ${HEADER_FILES}
+)
diff --git a/src/shared/entity/animate.cc b/src/shared/entity/animate.cc
new file mode 100644
index 0000000..4e6f891
--- /dev/null
+++ b/src/shared/entity/animate.cc
@@ -0,0 +1,5 @@
+#include "shared/entity/animate.hh"
+
+namespace shared {
+
+} // namespace shared
diff --git a/src/shared/entity/animate.hh b/src/shared/entity/animate.hh
new file mode 100644
index 0000000..9a5c910
--- /dev/null
+++ b/src/shared/entity/animate.hh
@@ -0,0 +1,89 @@
+#ifndef SHARED_ENTITY_ANIMATE_HH_
+#define SHARED_ENTITY_ANIMATE_HH_
+
+#include "shared/entity/entity.hh"
+
+namespace shared {
+
+// An animate is a thing with viewangles, commands and velocity, ie mobs,
+// players etc.
+class animate : virtual public entity {
+public:
+ using commands_t = std::uint32_t;
+ enum mask : commands_t {
+ forward = 1 << 0,
+ left = 1 << 1,
+ backward = 1 << 2,
+ right = 1 << 3,
+ jump = 1 << 4,
+ crouch = 1 << 5,
+ sprint = 1 << 6,
+ attack = 1 << 7,
+
+ flying = 1 << 30
+ };
+
+protected:
+ commands_t commands;
+ shared::math::angles viewangles;
+ glm::vec3 velocity;
+ std::uint32_t active_item;
+
+public:
+ template <typename... Args>
+ animate(const commands_t& commands, const shared::math::angles& viewangles,
+ const glm::vec3& velocity, const std::uint32_t& active_item,
+ Args&&... args) noexcept
+ : entity(std::forward<Args>(args)...), commands(commands),
+ viewangles(viewangles), velocity(velocity), active_item(active_item) {
+ }
+
+ animate(const proto::animate& proto) noexcept
+ : entity(proto.entity()), commands(proto.commands()),
+ viewangles(shared::net::get_angles(proto.viewangles())),
+ velocity(shared::net::get_vec3(proto.velocity())),
+ active_item(proto.active_item()) {}
+
+public:
+ void pack(proto::animate* const proto) const noexcept {
+ this->entity::pack(proto->mutable_entity());
+
+ proto->set_active_item(this->active_item);
+ proto->set_commands(this->commands);
+ shared::net::set_angles(proto->mutable_viewangles(), this->viewangles);
+ shared::net::set_vec3(proto->mutable_velocity(), this->velocity);
+ }
+
+public:
+ const decltype(commands)& get_commands() const noexcept {
+ return this->commands;
+ }
+ decltype(commands)& get_mutable_commands() noexcept {
+ return this->commands;
+ }
+ const decltype(viewangles)& get_angles() const noexcept {
+ return this->viewangles;
+ }
+ decltype(viewangles)& get_mutable_angles() noexcept {
+ return this->viewangles;
+ }
+ const decltype(velocity)& get_velocity() const noexcept {
+ return this->velocity;
+ }
+ decltype(velocity)& get_mutable_velocity() noexcept {
+ return this->velocity;
+ }
+ const decltype(active_item)& get_active_item() const noexcept {
+ return this->active_item;
+ }
+ decltype(active_item)& get_mutable_active_item() noexcept {
+ return this->active_item;
+ }
+
+public:
+ bool operator==(const animate&) const noexcept = default;
+};
+
+} // namespace shared
+
+#endif
diff --git a/src/shared/entity/entity.cc b/src/shared/entity/entity.cc
new file mode 100644
index 0000000..8cc618b
--- /dev/null
+++ b/src/shared/entity/entity.cc
@@ -0,0 +1 @@
+#include "shared/entity/entity.hh"
diff --git a/src/shared/entity/entity.hh b/src/shared/entity/entity.hh
new file mode 100644
index 0000000..2031fbf
--- /dev/null
+++ b/src/shared/entity/entity.hh
@@ -0,0 +1,69 @@
+#ifndef SHARED_ENTITY_ENTITY_HH_
+#define SHARED_ENTITY_ENTITY_HH_
+
+#include <cstdint>
+
+#include "shared/math/math.hh"
+#include "shared/movement/struct.hh"
+#include "shared/net/proto.hh"
+
+namespace shared {
+
+// Abstract base class all entities derive from.
+
+// A protobuf object may be provided as a constructor, and this functionality
+// should be implemented for all derived classes. Call pack with the correct
+// mutable_class* for storage as a protobuf object.
+class entity {
+public:
+ using index_t = std::uint32_t;
+
+protected:
+ index_t index;
+ math::coords chunk_pos;
+ glm::vec3 local_pos;
+
+public:
+ entity(const index_t& index, const shared::math::coords& chunk_pos,
+ const glm::vec3& local_pos) noexcept
+ : index(index), chunk_pos(chunk_pos), local_pos(local_pos) {}
+ entity(const proto::entity& proto) noexcept
+ : index(proto.index()),
+ chunk_pos(shared::net::get_coords(proto.chunk_pos())),
+ local_pos(shared::net::get_vec3(proto.local_pos())) {}
+ virtual ~entity() noexcept {}
+
+public:
+ const decltype(index)& get_index() const noexcept {
+ return this->index;
+ }
+ decltype(index)& get_mutable_index() noexcept {
+ return this->index;
+ }
+ const decltype(chunk_pos)& get_chunk_pos() const noexcept {
+ return this->chunk_pos;
+ }
+ decltype(chunk_pos)& get_mutable_chunk_pos() noexcept {
+ return this->chunk_pos;
+ }
+ const decltype(local_pos)& get_local_pos() const noexcept {
+ return this->local_pos;
+ }
+ decltype(local_pos)& get_mutable_local_pos() noexcept {
+ return this->local_pos;
+ }
+
+protected:
+ void pack(proto::entity* const proto) const noexcept {
+ proto->set_index(index);
+ shared::net::set_coords(proto->mutable_chunk_pos(), this->chunk_pos);
+ shared::net::set_vec3(proto->mutable_local_pos(), this->local_pos);
+ }
+
+public:
+ bool operator==(const entity&) const noexcept = default;
+};
+
+} // namespace shared
+
+#endif
diff --git a/src/shared/entity/moveable.cc b/src/shared/entity/moveable.cc
new file mode 100644
index 0000000..8d9261a
--- /dev/null
+++ b/src/shared/entity/moveable.cc
@@ -0,0 +1,3 @@
+#include "shared/entity/moveable.hh"
+
+namespace shared {}
diff --git a/src/shared/entity/moveable.hh b/src/shared/entity/moveable.hh
new file mode 100644
index 0000000..502bb39
--- /dev/null
+++ b/src/shared/entity/moveable.hh
@@ -0,0 +1,17 @@
+#ifndef SHARED_ENTITY_MOVEABLE_HH_
+#define SHARED_ENTITY_MOVEABLE_HH_
+
+#include "shared/entity/animate.hh"
+#include "shared/movement/struct.hh"
+
+namespace shared {
+
+// Moveable is an animate that provides an AABB.
+class moveable : virtual public shared::animate {
+public:
+ virtual const movement::aabb& get_aabb() const noexcept = 0;
+};
+
+} // namespace shared
+
+#endif
diff --git a/src/shared/entity/player.cc b/src/shared/entity/player.cc
new file mode 100644
index 0000000..c78a7ae
--- /dev/null
+++ b/src/shared/entity/player.cc
@@ -0,0 +1 @@
+#include "shared/entity/player.hh"
diff --git a/src/shared/entity/player.hh b/src/shared/entity/player.hh
new file mode 100644
index 0000000..a2fcd81
--- /dev/null
+++ b/src/shared/entity/player.hh
@@ -0,0 +1,63 @@
+#ifndef SHARED_ENTITY_PLAYER_HH_
+#define SHARED_ENTITY_PLAYER_HH_
+
+#include <algorithm>
+
+#include "shared/entity/moveable.hh"
+#include "shared/entity/animate.hh"
+#include "shared/item/items.hh"
+#include "shared/movement/struct.hh"
+
+namespace shared {
+
+class player : virtual public shared::moveable {
+public:
+ static constexpr float HEIGHT = 1.9f;
+ static constexpr float EYE_HEIGHT = HEIGHT * 0.8f;
+ static constexpr float HALFWIDTH = 0.25f;
+
+ static constexpr int INVENTORY_COLS = 10;
+ static constexpr int INVENTORY_ROWS = 5;
+
+public:
+ shared::item::items inventory;
+
+public:
+ template <typename... Args>
+ player(shared::item::items&& inventory, const commands_t& commands,
+ const shared::math::angles& viewangles, const glm::vec3& velocity,
+ const std::uint32_t& active_item, Args&&... args) noexcept
+ : shared::entity(args...), shared::animate(commands, viewangles,
+ velocity, active_item,
+ args...),
+ inventory(std::forward<shared::item::items>(inventory)) {}
+
+ player(const proto::player& proto) noexcept
+ : entity(proto.animate().entity()), animate(proto.animate()),
+ inventory(proto.inventory()) {}
+
+ // constructor for no inventory
+ player(const proto::animate& proto) noexcept
+ : entity(proto.entity()), animate(proto), inventory() {}
+
+ virtual ~player() noexcept {}
+
+public:
+ void pack(proto::player* const proto) const noexcept {
+ this->animate::pack(proto->mutable_animate());
+ this->inventory.pack(proto->mutable_inventory());
+ }
+
+ virtual const movement::aabb& get_aabb() const noexcept override {
+ static constexpr movement::aabb aabb = {
+ .min = {-HALFWIDTH + movement::EPSILON, 0.0f + movement::EPSILON,
+ -HALFWIDTH + movement::EPSILON},
+ .max = {HALFWIDTH - movement::EPSILON, HEIGHT - movement::EPSILON,
+ HALFWIDTH - movement::EPSILON}};
+ return aabb;
+ }
+};
+
+} // namespace shared
+
+#endif
diff --git a/src/shared/init.cc b/src/shared/init.cc
new file mode 100644
index 0000000..3415abb
--- /dev/null
+++ b/src/shared/init.cc
@@ -0,0 +1,182 @@
+#include "shared/init.hh"
+
+namespace shared {
+
+static void set_signal(const decltype(SIGINT) signal,
+ void (*const callback)(int)) {
+ struct sigaction sa {};
+ sa.sa_handler = callback;
+ sa.sa_flags = 0;
+ if (sigaction(signal, &sa, nullptr) == -1) {
+ throw std::runtime_error("failed to set signal handler for signal " +
+ std::to_string(signal));
+ }
+}
+
+static void set_terminate_backtrace() {
+ std::set_terminate([]() {
+ try {
+ throw;
+ } catch (const std::exception& e) {
+ shared::print::fault << shared::print::time
+ << "unhandled exception!\n"
+ << " what: " << e.what() << '\n';
+
+ constexpr std::size_t BACKTRACE_BUF_SIZE = 64;
+ std::array<void*, BACKTRACE_BUF_SIZE> bt_buffer{};
+ const int nptrs =
+ backtrace(std::data(bt_buffer), std::size(bt_buffer));
+ char** strings = backtrace_symbols(std::data(bt_buffer), nptrs);
+
+ shared::print::message << "\n backtrace:\n";
+ for (int i = 0; i < nptrs; ++i) {
+ shared::print::message << " " << strings[i] << '\n';
+ }
+ free(strings); // controversial
+
+ } catch (...) {
+ }
+ std::exit(EXIT_FAILURE);
+ });
+}
+
+void init() {
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+ set_terminate_backtrace();
+ set_signal(SIGPIPE, SIG_IGN);
+ set_signal(SIGINT, []([[maybe_unused]] const int signum) {
+ shared::print::warn << " interrupt signal received\n";
+ shared::should_exit = true; // graceful cleanup
+ });
+#ifndef NDEBUG
+ shared::print::debug << "This binary is a debug build and will be slower "
+ "and more verbose than usual\n";
+#endif
+}
+
+void try_main(const main_func_t& func, const std::string_view address,
+ const std::string_view port) {
+ try {
+ func(address, port);
+ } catch (const std::exception& e) {
+ shared::print::fault << shared::print::time << "caught exception!\n"
+ << " what: " << e.what() << '\n';
+ }
+}
+
+const args_t& get_options() {
+ static args_t ret{
+ {.name = "help", .desc = "display this, quit", .val = "h"}};
+ return ret;
+}
+
+bool parse_arg(const int&, const char* const) { return false; }
+
+static std::vector<struct option> make_long_options(const args_t& args) {
+ std::vector<struct option> options{
+ option{"help", no_argument, nullptr, 'h'}};
+ std::transform(std::begin(args), std::end(args),
+ std::back_inserter(options), [](const auto& arg) {
+ const auto req = std::string{arg.val}.ends_with(':')
+ ? required_argument
+ : no_argument;
+ return option{arg.name, req, nullptr, *arg.val};
+ });
+ return options;
+}
+
+static std::string make_long_vals(const args_t& args) {
+ std::string ret{"h"}; // always include help
+ for (const auto& arg : args) {
+ ret.append(arg.val);
+ }
+ return ret;
+}
+
+static auto get_option_it(const auto& options, const decltype(optopt)& c) {
+ return std::ranges::find_if(options,
+ [&](const auto& opt) { return c == opt.val; });
+}
+
+static void print_help(const args_t& args, const auto& options) {
+ const auto print_table = [](const auto& val, const int padding) {
+ std::cout << std::left << std::setw(padding) << std::setfill(' ')
+ << val;
+ };
+
+ const int max = static_cast<int>(std::strlen(
+ std::ranges::max_element(args, [](const auto& a, const auto& b) {
+ return std::strlen(a.name) < std::strlen(b.name);
+ })->name));
+ for (const auto& arg : args) {
+ const auto it = get_option_it(options, *arg.val);
+ if (it == std::end(options)) {
+ continue;
+ }
+ std::cout << " ";
+ print_table(std::string{"--"} + arg.name, 3 + max);
+ print_table(std::string{"-"} + static_cast<char>(it->val), 3);
+ std::cout << (it->has_arg == required_argument ? "<arg> " : " ");
+ std::cout << ": ";
+ print_table(arg.desc, 10);
+ std::cout << '\n';
+ }
+}
+
+void parse_args(const int argc, char* const argv[], const args_t& args,
+ const args_callbacks_t& callbacks) {
+ const auto long_options = make_long_options(args);
+ const auto long_vals = make_long_vals(args);
+
+ for (int option_index = opterr = 0;;) {
+ const auto c = getopt_long(argc, argv, long_vals.c_str(),
+ std::data(long_options), &option_index);
+ if (c == -1) {
+ break;
+ } else if (c == '?') { // parsing error
+ const auto it = get_option_it(long_options, optopt);
+ if (it != std::end(long_options)) {
+ shared::print::fault
+ << " bad argument: \"" << it->name << "\" required "
+ << (it->has_arg == required_argument ? "an" : "no")
+ << " argument\n";
+ } else {
+ shared::print::fault << " unknown argument: \""
+ << /*TODO get arg <<*/ "\"\n";
+ }
+ std::exit(EXIT_FAILURE);
+ }
+
+ if (c == 'h') {
+ print_help(args, long_options);
+ std::exit(EXIT_SUCCESS);
+ }
+
+ try {
+ const char* const arg = optarg + (optarg && optarg[0] == '=');
+ for (const auto& callback : callbacks) {
+ if (!callback(c, arg)) {
+ continue;
+ }
+ break;
+ }
+ } catch (const boost::bad_lexical_cast& e) {
+ const auto find_it = get_option_it(long_options, c);
+ shared::print::fault
+ << " bad argument: \""
+ << (find_it == std::end(long_options) ? "" : find_it->name)
+ << "\" failed type conversion\n";
+ std::exit(EXIT_FAILURE);
+ }
+ }
+ if (optind < argc) {
+ shared::print::fault << " unrecognised argument(s):";
+ for (int i = optind; i < argc; ++i) {
+ shared::print::fault << std::string{" "} << argv[i];
+ }
+ shared::print::fault << '\n';
+ std::exit(EXIT_FAILURE);
+ }
+}
+
+} // namespace shared
diff --git a/src/shared/init.hh b/src/shared/init.hh
new file mode 100644
index 0000000..735730d
--- /dev/null
+++ b/src/shared/init.hh
@@ -0,0 +1,38 @@
+#ifndef SHARED_INIT_HH_
+#define SHARED_INIT_HH_
+
+#include <string>
+#include <vector>
+
+#include <boost/lexical_cast.hpp>
+
+namespace shared {
+
+constexpr auto DEFAULT_ADDRESS = "0.0.0.0";
+constexpr auto SINGLEPLAYER_ADDRESS = "localhost";
+constexpr auto DEFAULT_PORT = "8191";
+
+void init();
+using main_func_t = void (*)(const std::string_view, const std::string_view);
+void try_main(const main_func_t& func, const std::string_view address,
+ const std::string_view port);
+
+// We use our own arg struct to parse args.
+struct arg {
+ const char* name; // "address"
+ const char* desc; // "change the address"
+ const char* val; // "a:"
+};
+using args_t = std::vector<arg>;
+const args_t& get_options();
+
+using args_callback_t = bool (*)(const int& c, const char* const arg);
+bool parse_arg(const int& c, const char* const arg);
+
+using args_callbacks_t = std::vector<args_callback_t>;
+void parse_args(const int argc, char* const argv[], const args_t& args,
+ const args_callbacks_t& callback);
+
+} // namespace shared
+
+#endif
diff --git a/src/shared/item/block.cc b/src/shared/item/block.cc
new file mode 100644
index 0000000..e85bea9
--- /dev/null
+++ b/src/shared/item/block.cc
@@ -0,0 +1,16 @@
+#include "shared/item/block.hh"
+
+namespace shared {
+namespace item {
+
+item::type_t
+block::get_type(const enum shared::world::block::type& type) noexcept {
+ return static_cast<std::uint32_t>(type) + type_offset;
+}
+
+item::type_t block::get_type() const noexcept {
+ return this->get_type(this->type);
+}
+
+} // namespace item
+} // namespace shared
diff --git a/src/shared/item/block.hh b/src/shared/item/block.hh
new file mode 100644
index 0000000..2aa7cef
--- /dev/null
+++ b/src/shared/item/block.hh
@@ -0,0 +1,41 @@
+#ifndef SHARED_ITEM_BLOCK_HH_
+#define SHARED_ITEM_BLOCK_HH_
+
+#include "shared/item/item.hh"
+#include "shared/world/block.hh"
+
+namespace shared {
+namespace item {
+
+class block : virtual public shared::item::item {
+public:
+ // Blocks are offset by 256 in their type so they do not collide with tools
+ // I'd prefer it was the other way around so TODO
+ static constexpr auto type_offset{std::numeric_limits<std::uint8_t>::max()};
+
+public:
+ enum shared::world::block::type type;
+
+public:
+ static type_t get_type(const enum shared::world::block::type&) noexcept;
+
+public:
+ virtual type_t get_type() const noexcept;
+
+public:
+ template <typename... Args>
+ block(const enum shared::world::block::type& type, Args&&... args) noexcept
+ : item(get_type(type), std::forward<Args>(args)...), type(type) {}
+
+ template <typename... Args>
+ block(const shared::item::item::type_t& type, Args&&... args) noexcept
+ : item(type, std::forward<Args>(args)...),
+ type(static_cast<enum shared::world::block::type>(type -
+ type_offset)) {}
+ virtual ~block() noexcept {}
+};
+
+} // namespace item
+} // namespace shared
+
+#endif
diff --git a/src/shared/item/item.cc b/src/shared/item/item.cc
new file mode 100644
index 0000000..f711523
--- /dev/null
+++ b/src/shared/item/item.cc
@@ -0,0 +1,14 @@
+#include "shared/item/item.hh"
+
+namespace shared {
+namespace item {
+
+std::uint32_t item::get_max_stack(const item::type_t& type) noexcept {
+ switch (type) {
+ default:
+ return 64;
+ }
+}
+
+} // namespace item
+} // namespace shared
diff --git a/src/shared/item/item.hh b/src/shared/item/item.hh
new file mode 100644
index 0000000..3774189
--- /dev/null
+++ b/src/shared/item/item.hh
@@ -0,0 +1,49 @@
+#ifndef SHARED_ITEM_ITEM_HH_
+#define SHARED_ITEM_ITEM_HH_
+
+#include <cstdint>
+
+#include "shared/net/proto.hh"
+#include "shared/world/block.hh"
+#include "shared/world/chunk.hh"
+
+namespace shared {
+namespace item {
+
+// ABC for items that exist in a player's inventory. (TODO abc lol)
+class item {
+public:
+ using type_t = std::uint32_t;
+
+public:
+ type_t type;
+ std::uint32_t quantity;
+
+public:
+ item(const type_t& type, const std::uint32_t& quantity) noexcept
+ : type(type), quantity(quantity) {}
+ item(const proto::item& item) noexcept
+ : type(item.type()), quantity(item.quantity()) {}
+ virtual ~item() noexcept {}
+
+public:
+ static std::uint32_t get_max_stack(const type_t& type) noexcept;
+
+public:
+ virtual type_t get_type() const noexcept {
+ return this->type;
+ }
+
+public: // protobuf stuff
+ void pack(proto::item* const proto,
+ const std::uint32_t inventory_index) const noexcept {
+ proto->set_type(this->type);
+ proto->set_quantity(this->quantity);
+ proto->set_index(inventory_index);
+ }
+};
+
+} // namespace item
+} // namespace shared
+
+#endif
diff --git a/src/shared/item/items.cc b/src/shared/item/items.cc
new file mode 100644
index 0000000..a5540fb
--- /dev/null
+++ b/src/shared/item/items.cc
@@ -0,0 +1,164 @@
+#include "shared/item/items.hh"
+
+namespace shared {
+namespace item {
+
+item_t make_item(const item::type_t& type,
+ const std::uint32_t& quantity) noexcept {
+ if (type >= block::type_offset) {
+ return std::make_shared<block>(type, quantity);
+ }
+ // TODO others
+ return std::make_shared<block>(type, quantity);
+}
+
+item_t make_item(const enum shared::world::block::type& type,
+ const std::uint32_t& quantity) noexcept {
+ return std::make_shared<block>(type, quantity);
+}
+
+item_t make_item(const proto::item& item) noexcept {
+ const auto type = item.type();
+
+ constexpr auto offset = shared::item::block::type_offset;
+ if (type >= offset) {
+ const auto block =
+ static_cast<enum shared::world::block::type>(type - offset);
+ return make_item(block, item.quantity());
+ }
+ return make_item(static_cast<item::type_t>(item.type()), item.quantity());
+}
+
+items::items(const proto::item_array& proto) noexcept {
+ const auto length = static_cast<unsigned long>(proto.items_size());
+ for (auto i = 0ul; i < length; ++i) {
+
+ const auto& item = proto.items().at(static_cast<int>(i));
+
+ const auto index = item.index();
+ this->contents[index] = make_item(item);
+ }
+}
+
+// Annoying logic because we have to add into existing first, then start
+// adding new stacks after.
+bool items::maybe_add(const item::type_t& type, const std::uint32_t& quantity,
+ const make_item_func_t& func) noexcept {
+
+ const auto stack_size = item::get_max_stack(type);
+
+ std::uint32_t added = 0;
+ const auto get_existing =
+ std::ranges::find_if(this->contents, [&](const auto& item) {
+ if (item == nullptr) {
+ return false;
+ }
+ if (item->type != type) {
+ return false;
+ }
+ if (item->quantity >= stack_size) {
+ return false;
+ }
+ return true;
+ });
+ for (auto it = get_existing; get_existing != std::end(this->contents);
+ it = get_existing) {
+
+ const auto addition =
+ std::min(quantity - added, stack_size - (*it)->quantity);
+ (*it)->quantity += addition;
+ added += addition;
+ if (added != quantity) {
+ continue;
+ }
+
+ return true;
+ }
+
+ for (auto& item : this->contents) {
+ if (item != nullptr) {
+ continue;
+ }
+
+ const auto addition = std::min(quantity - added, stack_size);
+ item = func(type, addition);
+ added += addition;
+ if (added != quantity) {
+ continue;
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+bool items::maybe_remove(const item::type_t& type,
+ const std::uint32_t& quantity) noexcept {
+ const auto existing_it =
+ std::ranges::find_if(this->contents, [&type](const auto& i) {
+ if (i == nullptr) {
+ return false;
+ }
+ return type == i->get_type();
+ });
+ if (existing_it == std::end(this->contents)) {
+ return false;
+ }
+
+ auto& existing = (*existing_it)->quantity;
+ if (existing > quantity) {
+ existing -= quantity;
+ return true;
+ }
+
+ if (existing == quantity) {
+ (*existing_it) = nullptr;
+ return true;
+ }
+
+ const auto diff = quantity - existing;
+ (*existing_it) = nullptr;
+ return this->maybe_remove(type, diff);
+}
+
+void items::pack(proto::item_array* const proto) const noexcept {
+ const auto items = proto->mutable_items();
+ for (auto i = 0ul; i < std::size(this->contents); ++i) {
+ const auto& item = contents[i];
+ if (item == nullptr) {
+ continue;
+ }
+
+ proto::item proto_item;
+ item->pack(&proto_item, static_cast<std::uint32_t>(i));
+ items->Add(std::move(proto_item));
+ }
+}
+
+void items::increment(const std::uint32_t& index,
+ const make_item_func_t& func) noexcept {
+ auto& item = this->contents[index];
+ if (item == nullptr) {
+ return;
+ }
+ if (item->quantity < shared::item::item::get_max_stack(item->type)) {
+ ++item->quantity;
+ return;
+ }
+ this->maybe_add(item->type, 1, func);
+}
+
+void items::decrement(const std::uint32_t& index) noexcept {
+ auto& item = this->contents[index];
+ if (item == nullptr) {
+ return;
+ }
+ item->quantity -= 1;
+ if (item->quantity == 0) {
+ item = nullptr;
+ }
+}
+
+} // namespace item
+} // namespace shared
diff --git a/src/shared/item/items.hh b/src/shared/item/items.hh
new file mode 100644
index 0000000..ba718c5
--- /dev/null
+++ b/src/shared/item/items.hh
@@ -0,0 +1,54 @@
+#ifndef SHARED_ITEM_ITEMS_HH_
+#define SHARED_ITEM_ITEMS_HH_
+
+#include <memory>
+
+#include "shared/item/block.hh"
+#include "shared/item/item.hh"
+#include "shared/net/proto.hh"
+#include "shared/world/block.hh"
+
+namespace shared {
+namespace item {
+
+// Use this function over constructor to create a derived item.
+
+using item_t = std::shared_ptr<item>;
+using items_t = std::array<item_t, 50>;
+
+using make_item_func_t = item_t (*)(const item::type_t&, const std::uint32_t&);
+item_t make_item(const item::type_t& type,
+ const std::uint32_t& quantity) noexcept;
+item_t make_item(const proto::item& item) noexcept;
+
+// Class for an inventory (or possibly a chest in the future, etc).
+class items {
+public:
+ items_t contents = {0};
+
+public:
+ items() noexcept {}
+ items(const proto::item_array& proto) noexcept;
+
+public:
+ // Adds or removes an arbitrary amount of items to the player.
+ // Returns true of false based on whether the operation completed fully.
+ bool maybe_add(const item::type_t& type, const std::uint32_t& quantity,
+ const make_item_func_t& = make_item) noexcept;
+ bool maybe_remove(const item::type_t& type,
+ const std::uint32_t& quantity) noexcept;
+
+ // Adds a single existing item, puts in new slot if necessary.
+ void increment(const std::uint32_t& index,
+ const make_item_func_t& = make_item) noexcept;
+ // Removes a single existing item from an index, clears if needed.
+ void decrement(const std::uint32_t& index) noexcept;
+
+public:
+ void pack(proto::item_array* const proto) const noexcept;
+};
+
+} // namespace item
+} // namespace shared
+
+#endif
diff --git a/src/shared/math.cc b/src/shared/math.cc
deleted file mode 100644
index 80eba81..0000000
--- a/src/shared/math.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "shared/math.hh"
-
-namespace shared {
-namespace math {
-
-glm::vec3 angle_to_dir(const angles& ang) noexcept {
- const float x = std::cos(ang.pitch) * std::cos(ang.yaw);
- const float y = std::sin(ang.pitch);
- const float z = std::cos(ang.pitch) * std::sin(ang.yaw);
- return {x, y, z};
-}
-
-bool is_inside_draw(const coords& a, const coords& b,
- const std::int32_t draw_distance) noexcept {
- const auto x2 = (a.x - b.x) * (a.x - b.x);
- const auto z2 = (a.z - b.z) * (a.z - b.z);
- const auto dd2 = draw_distance * draw_distance;
-
- return (x2 < dd2 - z2) && (z2 < dd2 - x2);
-}
-
-} // namespace math
-} // namespace shared
diff --git a/src/shared/math.hh b/src/shared/math.hh
deleted file mode 100644
index 5f03ab4..0000000
--- a/src/shared/math.hh
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef SHARED_MATH_HH_
-#define SHARED_MATH_HH_
-
-#include <compare>
-
-#include <glm/glm.hpp>
-#include <glm/gtc/matrix_transform.hpp>
-#include <glm/gtc/type_ptr.hpp>
-
-namespace shared {
-namespace math {
-
-// 2D coordinates.
-struct coords {
- std::int32_t x;
- std::int32_t z;
- coords operator+(const coords& c) const noexcept {
- auto ret = *this;
- ret.x += c.x;
- ret.z += c.z;
- return ret;
- }
- coords operator-(const coords& c) const noexcept {
- auto ret = *this;
- ret.x -= c.x;
- ret.z -= c.z;
- return ret;
- }
- auto operator<=>(const coords& c) const noexcept = default;
-};
-
-struct angles {
- float pitch;
- float yaw;
- angles operator+(const angles& a) const noexcept {
- auto ret = *this;
- ret.pitch += a.pitch;
- ret.yaw += a.yaw;
- return ret;
- }
-};
-
-// Returns a vector pointing in the direction of pitch + yaw.
-glm::vec3 angle_to_dir(const angles& ang) noexcept;
-
-bool is_inside_draw(const shared::math::coords& a,
- const shared::math::coords& b,
- const std::int32_t draw_distance) noexcept;
-
-} // namespace math
-} // namespace shared
-
-#endif
diff --git a/src/shared/math/angles.cc b/src/shared/math/angles.cc
new file mode 100644
index 0000000..9343dc3
--- /dev/null
+++ b/src/shared/math/angles.cc
@@ -0,0 +1,57 @@
+#include "shared/math/angles.hh"
+
+namespace shared {
+namespace math {
+
+float angles::get_yaw_delta(const float& a, const float& b) noexcept {
+ const float inner = glm::distance(a, b);
+ const float outer = glm::radians(360.0f) - inner;
+
+ const bool less = a < b;
+ return inner <= outer ? (less ? inner : -inner) : (less ? -outer : outer);
+}
+
+glm::vec3 angles::to_dir() const noexcept {
+ const float x = std::cos(this->pitch) * std::cos(this->yaw);
+ const float y = std::sin(this->pitch);
+ const float z = std::cos(this->pitch) * std::sin(this->yaw);
+ return {x, y, z};
+}
+
+angles& angles::clamp() noexcept {
+ this->pitch =
+ std::clamp(this->pitch, glm::radians(-89.0f), glm::radians(89.0f));
+ this->yaw =
+ std::clamp(this->yaw, glm::radians(-180.0f), glm::radians(180.0f));
+ return *this;
+}
+
+angles& angles::normalise() noexcept {
+ this->yaw = std::fmod(this->yaw, glm::radians(360.0f));
+
+ if (const auto fmod = std::fmod(this->yaw, glm::radians(180.0f));
+ fmod != this->yaw) {
+
+ this->yaw = fmod + (std::signbit(this->yaw) ? glm::radians(180.0f)
+ : glm::radians(-180.0f));
+ }
+
+ return *this;
+}
+
+angles angles::operator+(const angles& a) const noexcept {
+ auto ret = *this;
+ ret.pitch += a.pitch;
+ ret.yaw += a.yaw;
+ return ret;
+}
+
+angles angles::operator*(const float& f) const noexcept {
+ auto ret = *this;
+ ret.pitch *= f;
+ ret.yaw *= f;
+ return ret;
+}
+
+} // namespace math
+} // namespace shared
diff --git a/src/shared/math/angles.hh b/src/shared/math/angles.hh
new file mode 100644
index 0000000..aec388f
--- /dev/null
+++ b/src/shared/math/angles.hh
@@ -0,0 +1,44 @@
+#ifndef SHARED_MATH_ANGLES_HH_
+#define SHARED_MATH_ANGLES_HH_
+
+#include <algorithm>
+#include <compare>
+
+#include <glm/glm.hpp>
+
+namespace shared {
+namespace math {
+
+struct angles {
+public:
+ float pitch;
+ float yaw;
+
+public:
+ // Returns the closest yaw from this to other, assumes they are normalised.
+ static float get_yaw_delta(const float& a, const float& b) noexcept;
+
+public:
+ glm::vec3 to_dir() const noexcept;
+
+public:
+ // Removes bad floating point values!
+ // Clamps pitch to its max positions of += glm::radians(89).
+ // Clamps yaw to its max positions of += glm::radians(180).
+ angles& clamp() noexcept;
+
+ // Returns yaw angles to [glm::radians(-180), glm::radians(180)].
+ angles& normalise() noexcept;
+
+public:
+ angles operator+(const angles& a) const noexcept;
+ angles operator*(const float& f) const noexcept;
+
+public:
+ auto operator<=>(const angles&) const noexcept = default;
+};
+
+} // namespace math
+} // namespace shared
+
+#endif
diff --git a/src/shared/math/coords.cc b/src/shared/math/coords.cc
new file mode 100644
index 0000000..37fb19a
--- /dev/null
+++ b/src/shared/math/coords.cc
@@ -0,0 +1,30 @@
+#include "shared/math/coords.hh"
+
+namespace shared {
+namespace math {
+
+bool coords::is_inside_draw(const coords& a, const coords& b,
+ const std::int32_t draw_distance) noexcept {
+ const auto x2 = (a.x - b.x) * (a.x - b.x);
+ const auto z2 = (a.z - b.z) * (a.z - b.z);
+ const auto dd2 = draw_distance * draw_distance;
+
+ return (x2 < dd2 - z2) && (z2 < dd2 - x2);
+}
+
+coords coords::operator+(const coords& c) const noexcept {
+ auto ret = *this;
+ ret.x += c.x;
+ ret.z += c.z;
+ return ret;
+}
+
+coords coords::operator-(const coords& c) const noexcept {
+ auto ret = *this;
+ ret.x -= c.x;
+ ret.z -= c.z;
+ return ret;
+}
+
+} // namespace math
+} // namespace shared
diff --git a/src/shared/math/coords.hh b/src/shared/math/coords.hh
new file mode 100644
index 0000000..7a21bf9
--- /dev/null
+++ b/src/shared/math/coords.hh
@@ -0,0 +1,31 @@
+#ifndef SHARED_MATH_COORDS_HH_
+#define SHARED_MATH_COORDS_HH_
+
+#include <compare>
+#include <cstdint>
+
+namespace shared {
+namespace math {
+
+// 2D coordinates.
+struct coords {
+public:
+ std::int32_t x;
+ std::int32_t z;
+
+public:
+ static bool is_inside_draw(const coords& a, const coords& b,
+ const std::int32_t draw_distance) noexcept;
+
+public:
+ coords operator+(const coords& c) const noexcept;
+ coords operator-(const coords& c) const noexcept;
+
+public:
+ auto operator<=>(const coords&) const noexcept = default;
+};
+
+} // namespace math
+} // namespace shared
+
+#endif
diff --git a/src/shared/math/math.cc b/src/shared/math/math.cc
new file mode 100644
index 0000000..407e202
--- /dev/null
+++ b/src/shared/math/math.cc
@@ -0,0 +1,5 @@
+#include "shared/math/math.hh"
+
+namespace shared {
+namespace math {} // namespace math
+} // namespace shared
diff --git a/src/shared/math/math.hh b/src/shared/math/math.hh
new file mode 100644
index 0000000..9eef88c
--- /dev/null
+++ b/src/shared/math/math.hh
@@ -0,0 +1,22 @@
+#ifndef SHARED_MATH_MATH_HH_
+#define SHARED_MATH_MATH_HH_
+
+#include <algorithm>
+#include <cmath>
+
+#include <glm/glm.hpp>
+#include <glm/gtc/matrix_transform.hpp>
+#include <glm/gtc/type_ptr.hpp>
+
+#include "shared/math/angles.hh"
+#include "shared/math/coords.hh"
+
+namespace shared {
+namespace math {
+
+// Convenience include, might include others later too.
+
+} // namespace math
+} // namespace shared
+
+#endif
diff --git a/src/shared/movement.cc b/src/shared/movement.cc
deleted file mode 100644
index 985062c..0000000
--- a/src/shared/movement.cc
+++ /dev/null
@@ -1,490 +0,0 @@
-#include "shared/movement.hh"
-
-namespace shared {
-namespace movement {
-
-// Move a player into the correct neighbour chunk if they go over a border.
-static void shift_chunk(shared::player& player) noexcept {
- const bool g_x = (player.local_pos.x >= shared::world::chunk::WIDTH);
- const bool l_x = (player.local_pos.x < 0.0f);
- const bool g_z = (player.local_pos.z >= shared::world::chunk::WIDTH);
- const bool l_z = (player.local_pos.z < 0.0f);
-
- player.chunk_pos.x += g_x - l_x;
- player.local_pos.x += shared::world::chunk::WIDTH * (l_x - g_x);
- player.chunk_pos.z += g_z - l_z;
- player.local_pos.z += shared::world::chunk::WIDTH * (l_z - g_z);
-}
-
-constexpr float epsilon = 0.001f; // counteract arithmetic errors
-constexpr float epsilon2 = epsilon + 2 * epsilon * epsilon;
-
-bool intersect_aabbs(const aabb& a, const aabb& b) noexcept {
- if (a.max.x < b.min.x || a.min.x > b.max.x) {
- return false;
- }
- if (a.max.y < b.min.y || a.min.y > b.max.y) {
- return false;
- }
- if (a.max.z < b.min.z || a.min.z > b.max.z) {
- return false;
- }
- return true;
-}
-
-static glm::vec3 plane_to_normal(const int plane) {
- glm::vec3 normal{0.0f, 0.0f, 0.0f};
- normal[std::abs(plane) - 1] = std::signbit(plane) ? -1.0f : 1.0f;
- return normal;
-}
-
-std::optional<ray_aabb_ret> intersect_ray_aabb(const line& line,
- const aabb& aabb) noexcept {
- float tmin = -std::numeric_limits<float>::max();
- float tmax = std::numeric_limits<float>::max();
-
- int p = 0;
- for (int i = 0; i < 3; ++i) {
- if (std::abs(line.dir[i]) < epsilon) {
-
- // Ray is parallel to slab, no hit if origin not within slab.
- if (line.origin[i] < aabb.min[i] || line.origin[i] > aabb.max[i]) {
- return std::nullopt;
- }
-
- } else {
- // Intersection t value of ray with near and far plane of slab.
- const float ood = 1.0f / line.dir[i];
- float t1 = (aabb.min[i] - line.origin[i]) * ood;
- float t2 = (aabb.max[i] - line.origin[i]) * ood;
-
- if (t1 > t2) {
- std::swap(t1, t2);
- }
- auto old = tmin;
- tmin = std::max(tmin, t1);
- if (tmin != old) {
- p = (i + 1);
- }
- tmax = std::min(tmax, t2);
- if (tmin > tmax) {
- return std::nullopt;
- }
- }
- }
-
- if (tmin <= 0.0f) {
- return std::nullopt;
- }
-
- return ray_aabb_ret{.position = line.origin + line.dir * tmin,
- .time = tmin,
- .normal = plane_to_normal(p)};
-}
-
-std::optional<moving_aabb_ret>
-intersect_moving_aabbs(const moving_aabb& a, const moving_aabb& b) noexcept {
-
- if (intersect_aabbs(a.aabb, b.aabb)) {
- return std::nullopt;
- }
-
- const glm::vec3 velocity = b.velocity - a.velocity;
- float tfirst = 0.0f;
- float tlast = 10.0f;
- int p = 0;
-
- for (int i = 0; i < 3; ++i) {
- if (velocity[i] < 0.0f) {
- if (b.aabb.max[i] < a.aabb.min[i]) {
- return std::nullopt;
- }
- if (a.aabb.max[i] < b.aabb.min[i]) {
- const auto old = tfirst;
- tfirst = std::max((a.aabb.max[i] - b.aabb.min[i]) / velocity[i],
- tfirst);
- if (tfirst != old) {
- p = (i + 1);
- }
- }
- if (b.aabb.max[i] > a.aabb.min[i]) {
- tlast = std::min((a.aabb.min[i] - b.aabb.max[i]) / velocity[i],
- tlast);
- }
- } else if (velocity[i] > 0.0f) {
- if (b.aabb.min[i] > a.aabb.max[i]) {
- return std::nullopt;
- }
- if (b.aabb.max[i] < a.aabb.min[i]) {
- const auto old = tfirst;
- tfirst = std::max((a.aabb.min[i] - b.aabb.max[i]) / velocity[i],
- tfirst);
- if (tfirst != old) {
- p = -(i + 1);
- }
- }
- if (a.aabb.max[i] > b.aabb.min[i]) {
- tlast = std::min((a.aabb.max[i] - b.aabb.min[i]) / velocity[i],
- tlast);
- }
- } else {
- if (b.aabb.max[i] < a.aabb.min[i] ||
- b.aabb.min[i] > a.aabb.max[i]) {
- return std::nullopt;
- }
- }
- if (tfirst > tlast) {
- return std::nullopt;
- }
- }
- /*
- if (tfirst < 0.0f || tfirst > 1.0f) {
- return std::nullopt;
- }
- */
-
- return moving_aabb_ret{.time = tfirst, .normal = plane_to_normal(p)};
-}
-
-static std::optional<shared::world::block>
-get_ground(const aabb& player_aabb, const std::vector<blockinfo> blockinfos,
- bool (*delimit)(const enum shared::world::block::type) =
- shared::world::block::is_tangible) noexcept {
-
- const moving_aabb player_moving_aabb{.aabb = player_aabb,
- .velocity = {0.0f, -1.0f, 0.0f}};
- for (const auto& block_aabb : blockinfos) {
-
- if (!delimit(block_aabb.block)) {
- continue;
- }
-
- const struct moving_aabb block_moving_aabb {
- .aabb = block_aabb.aabb, .velocity = { 0.0f, 0.0f, 0.0f }
- };
-
- if (const auto intersect =
- intersect_moving_aabbs(player_moving_aabb, block_moving_aabb);
- intersect.has_value()) {
-
- if (intersect->time >= 1.0f) {
- continue;
- }
-
- if (intersect->time <= epsilon2) {
- return block_aabb.block;
- }
- }
- }
- return std::nullopt;
-}
-
-// Only returns ground if we can collide with it.
-static std::optional<shared::world::block>
-get_collidable_ground(const aabb& player_aabb,
- const std::vector<blockinfo> blockinfo) noexcept {
-
- return get_ground(player_aabb, blockinfo,
- shared::world::block::is_collidable);
-}
-
-// Recursively resolve collisions against blocks, up to n times.
-static void resolve_collisions(shared::player& player, aabb player_aabb,
- const std::vector<blockinfo>& blockinfos,
- const float deltatime,
- const int n = 3) noexcept {
-
- const moving_aabb player_moving_aabb{
- .aabb = player_aabb, .velocity = player.velocity * deltatime};
-
- std::optional<std::pair<moving_aabb_ret, shared::world::block>> collision;
- for (const auto& block_aabb : blockinfos) {
- if (!shared::world::block::is_collidable(block_aabb.block)) {
- continue;
- }
-
- const struct moving_aabb block_moving_aabb {
- .aabb = block_aabb.aabb, .velocity = { 0.0f, 0.0f, 0.0f }
- };
- const auto intersect =
- intersect_moving_aabbs(player_moving_aabb, block_moving_aabb);
-
- if (!intersect.has_value() || intersect->time > 1.0f) {
- continue;
- }
-
- // Update collision if it doesn't exist or if this one is closer.
- if (!collision.has_value() || intersect->time < collision->first.time) {
-
- collision = std::make_pair(intersect.value(), block_aabb.block);
- }
- }
-
- // No more collisions :)
- if (!collision.has_value()) {
- player.local_pos += player.velocity * deltatime;
- return;
- }
-
- const glm::vec3 collision_pos =
- collision->first.time * player.velocity * deltatime;
- const glm::vec3 offset = collision->first.normal * epsilon;
- const float backoff = glm::dot(player.velocity, collision->first.normal);
-
-#ifndef NDEBUG
- // clang-format off
- shared::print::debug("Collision with n = " + std::to_string(n) + "\n");
- shared::print::message(" Unresolved player position: {" + std::to_string(player.local_pos.x) + ", " + std::to_string(player.local_pos.y) + ", " + std::to_string(player.local_pos.z) + "}\n", false);
- shared::print::message(" Unresolved player velocity: {" + std::to_string(player.velocity.x) + ", " + std::to_string(player.velocity.y) + ", " + std::to_string(player.velocity.z) + "}\n", false);
- shared::print::message(" Collision delta vector: {" + std::to_string(collision_pos.x) + ", " + std::to_string(collision_pos.y) + ", " + std::to_string(collision_pos.z) + "}\n", false);
- shared::print::message(" Backoff: " + std::to_string(backoff) + "\n", false);
- shared::print::message(" On ground before collision: " + std::to_string(get_collidable_ground(player_aabb, blockinfos).has_value()) + "\n", false);
- shared::print::message(" Collision normal: {" + std::to_string(collision->first.normal.x) + ", " + std::to_string(collision->first.normal.y) + ", " + std::to_string(collision->first.normal.z) + "}\n", false);
- // clang-format on
-#endif
-
- // Quake engine's reflect velocity.
- for (int i = 0; i < 3; ++i) {
- player.velocity[i] -= collision->first.normal[i] * backoff;
- if (std::abs(player.velocity[i]) <= epsilon) {
- player.velocity[i] = 0.0f;
- }
- if (std::abs(collision_pos[i]) <= epsilon2) {
-
-#ifndef NDEBUG
- shared::print::message(
- " Ignored axis: " + std::to_string(i) + "\n", false);
-#endif
-
- continue;
- }
- player.local_pos[i] += collision_pos[i] - offset[i];
- player_aabb.min[i] += collision_pos[i] - offset[i];
- player_aabb.max[i] += collision_pos[i] - offset[i];
- }
-
-#ifndef NDEBUG
- // clang-format off
- shared::print::message(" Resolved player position: {" + std::to_string(player.local_pos.x) + ", " + std::to_string(player.local_pos.y) + ", " + std::to_string(player.local_pos.z) + "}\n", false);
- shared::print::message(" Resolved player velocity: {" + std::to_string(player.velocity.x) + ", " + std::to_string(player.velocity.y) + ", " + std::to_string(player.velocity.z) + "}\n", false);
- shared::print::message(" On ground after collision: " + std::to_string(get_collidable_ground(player_aabb, blockinfos).has_value()) + "\n", false);
- // clang-format on
-#endif
-
- if (n <= 0) {
- return;
- }
- resolve_collisions(player, player_aabb, blockinfos,
- deltatime - collision->first.time * deltatime, n - 1);
-}
-
-// Returns the highest friction value of a block that intersects an aabb.
-static std::optional<float>
-get_intersect_friction(const aabb& aabb,
- const std::vector<blockinfo>& blockinfos) noexcept {
- std::optional<float> greatest_friction;
- for (const auto& block_aabb : blockinfos) {
- if (!intersect_aabbs(aabb, block_aabb.aabb)) {
- continue;
- }
- const float friction =
- shared::world::block::get_friction(block_aabb.block);
-
- if (!greatest_friction.has_value() ||
- friction > greatest_friction.value()) {
-
- greatest_friction = friction;
- }
- }
-
- return greatest_friction;
-}
-
-// In air is slightly more complicated becase of edge cases involving water.
-static bool is_in_air(
- const aabb& aabb, const std::vector<blockinfo>& blockinfos,
- const std::optional<shared::world::block>& collidable_ground) noexcept {
- if (!std::all_of(std::begin(blockinfos), std::end(blockinfos),
- [&aabb](const auto& ba) {
- if (!intersect_aabbs(aabb, ba.aabb)) {
- return true;
- }
- return !shared::world::block::is_tangible(ba.block);
- })) {
- return false;
- }
- if (collidable_ground.has_value()) {
- return false;
- }
- return true;
-}
-
-static bool is_in_liquid(const aabb& aabb,
- const std::vector<blockinfo>& blockinfos) noexcept {
- return std::any_of(std::begin(blockinfos), std::end(blockinfos),
- [&aabb](const auto& ba) {
- if (!intersect_aabbs(aabb, ba.aabb)) {
- return false;
- }
- return shared::world::block::is_liquid(ba.block);
- });
-}
-
-static bool
-can_jump(const std::optional<shared::world::block>& collidable_ground,
- const bool in_liquid) noexcept {
- if (collidable_ground.has_value()) {
- return true;
- }
- if (in_liquid) {
- return true;
- }
- return false;
-}
-
-// Move state is a cache of expensive operations that we use more than once.
-struct move_state {
- std::optional<shared::world::block> ground;
- std::optional<shared::world::block> collidable_ground;
- bool is_in_air;
- bool is_in_liquid;
- bool can_jump;
-};
-static move_state
-make_move_state(const aabb& player_aabb,
- const std::vector<blockinfo>& blockinfos) noexcept {
-
- const auto get_ground_ret = get_ground(player_aabb, blockinfos);
- const auto get_collidable_ground_ret =
- get_collidable_ground(player_aabb, blockinfos);
- const bool is_in_air_ret =
- is_in_air(player_aabb, blockinfos, get_collidable_ground_ret);
- const bool is_in_liquid_ret = is_in_liquid(player_aabb, blockinfos);
- const bool can_jump_ret =
- can_jump(get_collidable_ground_ret, is_in_liquid_ret);
-
- return {.ground = get_ground_ret,
- .collidable_ground = get_collidable_ground_ret,
- .is_in_air = is_in_air_ret,
- .is_in_liquid = is_in_liquid_ret,
- .can_jump = can_jump_ret};
-}
-
-static float get_jump_magnitude(const shared::player& player, const aabb& aabb,
- const std::vector<blockinfo>& blockinfos,
- const struct move_state& move_state) noexcept {
- if (!move_state.can_jump) {
- return 0.0f;
- }
- if (move_state.is_in_liquid) {
- const struct aabb jump_aabb = {
- .min = glm::vec3{0.0f, aabb.min.y + aabb.max.y / 5.0f, 0.0f},
- .max = aabb.max};
- if (player.velocity.y > 0.0f &&
- is_in_air(jump_aabb, blockinfos,
- get_collidable_ground(jump_aabb, blockinfos))) {
- return 1.0f;
- }
- return 0.5f;
- }
- if (player.velocity.y < 0.0f) {
- return 0.0f;
- }
- return 8.0f;
-}
-
-void move(shared::player& player, const std::vector<blockinfo>& blockinfos,
- const float deltatime) noexcept {
-
- constexpr glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f);
- const glm::vec3 front = shared::math::angle_to_dir(player.viewangles);
- const glm::vec3 right = glm::normalize(glm::cross(front, up));
-
- constexpr aabb player_aabb = {.min = {-shared::player::HALFWIDTH + epsilon,
- 0.0f + epsilon,
- -shared::player::HALFWIDTH + epsilon},
- .max = {shared::player::HALFWIDTH - epsilon,
- shared::player::HEIGHT - epsilon,
- shared::player::HALFWIDTH - epsilon}};
-
- const auto move_state = make_move_state(player_aabb, blockinfos);
-
- // Some of velocity we want to add or remove should be scaled by our
- // tickrate (eg, walking), while others such as jumping should not.
-
- const glm::vec3 scaled_acceleration = [&]() -> glm::vec3 {
- glm::vec3 acceleration = {0.0f, 0.0f, 0.0f};
- if (player.commands & shared::player::mask::forward) {
- acceleration += front;
- }
- if (player.commands & shared::player::mask::left) {
- acceleration -= right;
- }
- if (player.commands & shared::player::mask::backward) {
- acceleration -= front;
- }
- if (player.commands & shared::player::mask::right) {
- acceleration += right;
- }
- acceleration.y = 0.0f;
- if (acceleration != glm::vec3{}) {
- acceleration = glm::normalize(acceleration);
- }
- acceleration *= 1.75f;
- if (player.commands & shared::player::mask::sprint) {
- acceleration *= 1.25f;
- }
-
- // Increase movement when on the ground - heavily reduced with friction.
- if (!move_state.is_in_air) {
- acceleration *= 30.0f;
- }
-
- // Gravity.
- if (!move_state.collidable_ground.has_value()) {
- acceleration -= 25.0f * up;
- }
-
- return acceleration;
- }();
-
- const glm::vec3 constant_acceleration = [&]() -> glm::vec3 {
- glm::vec3 acceleration = {0.0f, 0.0f, 0.0f};
- // Jumping - we have to adjust our magnitude based on our environment.
- // Technically swimming is just lots of small jumps.
- if (player.commands & shared::player::mask::jump) {
- acceleration += get_jump_magnitude(player, player_aabb, blockinfos,
- move_state) *
- up;
- }
- return acceleration;
- }();
-
- // Our deceleration is the max friction of what we're in and what we're on.
- const glm::vec3 scaled_deceleration = [&]() -> glm::vec3 {
- const auto drag = get_intersect_friction(player_aabb, blockinfos);
-
- float max_friction = 0.0f;
- if (move_state.collidable_ground.has_value()) {
- const float friction = shared::world::block::get_friction(
- move_state.collidable_ground.value());
- if (drag.has_value()) {
- max_friction = std::max(friction, drag.value());
- }
- } else if (drag.has_value()) {
- max_friction = drag.value();
- }
-
- return player.velocity * max_friction;
- }();
-
- player.velocity += (scaled_acceleration - scaled_deceleration) * deltatime;
- player.velocity += constant_acceleration;
-
- resolve_collisions(player, player_aabb, blockinfos, deltatime);
-
- shift_chunk(player);
-}
-
-} // namespace movement
-} // namespace shared
diff --git a/src/shared/movement.hh b/src/shared/movement.hh
deleted file mode 100644
index 375c030..0000000
--- a/src/shared/movement.hh
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef SHARED_MOVEMENT_HH_
-#define SHARED_MOVEMENT_HH_
-
-#include "shared/math.hh"
-#include "shared/player.hh"
-#include "shared/shared.hh"
-#include "shared/world.hh"
-
-#include <algorithm>
-#include <array>
-
-#include <glm/glm.hpp>
-#include <glm/gtx/norm.hpp>
-
-namespace shared {
-namespace movement {
-
-struct aabb {
- glm::vec3 min;
- glm::vec3 max;
-};
-bool intersect_aabbs(const aabb& a, const aabb& b) noexcept;
-
-struct line {
- glm::vec3 origin;
- glm::vec3 dir;
-};
-struct ray_aabb_ret {
- glm::vec3 position;
- float time;
- glm::vec3 normal;
-};
-std::optional<ray_aabb_ret> intersect_ray_aabb(const line& line,
- const aabb& aabb) noexcept;
-struct moving_aabb {
- struct aabb aabb;
- glm::vec3 velocity;
-};
-struct moving_aabb_ret {
- float time;
- glm::vec3 normal;
-};
-std::optional<moving_aabb_ret>
-intersect_moving_aabbs(const moving_aabb& a, const moving_aabb& b) noexcept;
-
-// A block with a bit more info.
-struct blockinfo {
- shared::world::block block;
- struct aabb aabb;
- shared::math::coords chunk_pos;
- glm::ivec3 pos;
-};
-// /WE/ should use this function to generate our blockdatas.
-constexpr int move_width =
- static_cast<int>(1.0f + 2 * shared::player::HALFWIDTH + 1.0f);
-constexpr int move_height = static_cast<int>(1.0f + shared::player::HEIGHT);
-
-// Walking a player is fairly complicated, and requires a std::vector of
-// blockdata that represents all the blocks near a player.
-// TODO provide an additional deltatime arugment to enable prediction.
-void move(shared::player& player, const std::vector<blockinfo>& blockinfos,
- const float deltatime) noexcept;
-
-} // namespace movement
-} // namespace shared
-
-#endif
diff --git a/src/shared/movement/movement.cc b/src/shared/movement/movement.cc
new file mode 100644
index 0000000..53d7a23
--- /dev/null
+++ b/src/shared/movement/movement.cc
@@ -0,0 +1,580 @@
+#include "shared/movement/movement.hh"
+
+namespace shared {
+namespace movement {
+
+constexpr float MAX_SPEED_XZ = 5.0f; // max speed before sprinting
+constexpr float MAX_SPEED_XZ_LIQUID = 2.8f; // max water speed before sprinting
+constexpr float MAX_SPEED_XZ_FLYING = 11.0f; // max water speed before sprinting
+constexpr float MAX_SPEED_Y = 80.0f;
+constexpr float MAX_SPEED_Y_LIQUID = 3.0f;
+constexpr float MAX_SPEED_Y_FLYING = 8.0f;
+constexpr float MOVE_ACCEL = 75.0f; // base acceleration in m*s^-2
+constexpr float AIR_MULT = 0.125f; // multiplier to acceleration if in air
+constexpr float SPRINT_MULT = 1.20f; // multiplier to acceleration if sprinting
+constexpr float SWIM_ACCEL = 50.0f; // y-axis accel when swimming in m*s^-2
+constexpr float JUMP_ACCEL = 7.85f; // y-axis accel when jumping in m*s^-2
+constexpr float FLY_ACCEL = 75.0f; // y-axis accel when swimming in m*s^-2
+
+constexpr float GRAVITY = 28.0f;
+constexpr float DRAG = 0.1f;
+constexpr float FRICTION = 15.0f;
+constexpr float FLY_DRAG = FRICTION;
+constexpr float VISCOSITY = 25.0f;
+
+glm::vec3 make_relative(const shared::math::coords& base_chunk_pos,
+ const glm::vec3& other_local_pos,
+ const shared::math::coords& other_chunk_pos) noexcept {
+ const auto diff_x = static_cast<std::int64_t>(other_chunk_pos.x) -
+ static_cast<std::int64_t>(base_chunk_pos.x);
+ const auto diff_z = static_cast<std::int64_t>(other_chunk_pos.z) -
+ static_cast<std::int64_t>(base_chunk_pos.z);
+ return {
+ other_local_pos.x + static_cast<float>(world::chunk::WIDTH * diff_x),
+ other_local_pos.y,
+ other_local_pos.z + static_cast<float>(world::chunk::WIDTH * diff_z)};
+}
+
+void normalise_position(glm::vec3& local_pos,
+ shared::math::coords& chunk_pos) noexcept {
+ const bool g_x = (local_pos.x >= world::chunk::WIDTH);
+ const bool l_x = (local_pos.x < 0.0f);
+ const bool g_z = (local_pos.z >= world::chunk::WIDTH);
+ const bool l_z = (local_pos.z < 0.0f);
+
+ chunk_pos.x += g_x - l_x;
+ local_pos.x += shared::world::chunk::WIDTH * (l_x - g_x);
+ chunk_pos.z += g_z - l_z;
+ local_pos.z += shared::world::chunk::WIDTH * (l_z - g_z);
+}
+
+glm::ivec2 get_move_xy(const std::uint32_t& tickrate,
+ const shared::moveable& moveable) noexcept {
+ const float max_x = std::max(
+ MAX_SPEED_XZ, std::max(MAX_SPEED_XZ_LIQUID, MAX_SPEED_XZ_FLYING));
+ const float max_y =
+ std::max(MAX_SPEED_Y, std::max(MAX_SPEED_Y_LIQUID, MAX_SPEED_Y_FLYING));
+ const float mult = 1.0f / static_cast<float>(tickrate);
+ const auto& aabb = moveable.get_aabb();
+ return {max_x * mult + aabb.max.x + 1.0f, max_y * mult + aabb.max.y + 1.0f};
+}
+
+static float get_block_friction(const enum world::block::type block) noexcept {
+ if (world::block::is_liquid(block)) {
+ return VISCOSITY;
+ }
+ if (world::block::is_collidable(block)) {
+ return FRICTION;
+ }
+ return DRAG;
+}
+
+bool intersect_aabbs(const aabb& a, const aabb& b) noexcept {
+ if (a.max.x < b.min.x || a.min.x > b.max.x) {
+ return false;
+ }
+ if (a.max.y < b.min.y || a.min.y > b.max.y) {
+ return false;
+ }
+ if (a.max.z < b.min.z || a.min.z > b.max.z) {
+ return false;
+ }
+ return true;
+}
+
+static glm::vec3 plane_to_normal(const int plane) noexcept {
+ glm::vec3 normal{0.0f, 0.0f, 0.0f};
+ normal[std::abs(plane) - 1] = std::signbit(plane) ? -1.0f : 1.0f;
+ return normal;
+}
+
+std::optional<ray_aabb_ret> intersect_ray_aabb(const line& line,
+ const aabb& aabb) noexcept {
+ float tmin = -std::numeric_limits<float>::max();
+ float tmax = std::numeric_limits<float>::max();
+
+ int p = 0;
+ for (int i = 0; i < 3; ++i) {
+ if (std::abs(line.dir[i]) < EPSILON) {
+
+ // Ray is parallel to slab, no hit if origin not within slab.
+ if (line.origin[i] < aabb.min[i] || line.origin[i] > aabb.max[i]) {
+ return std::nullopt;
+ }
+
+ } else {
+ // Intersection t value of ray with near and far plane of slab.
+ const float ood = 1.0f / line.dir[i];
+ float t1 = (aabb.min[i] - line.origin[i]) * ood;
+ float t2 = (aabb.max[i] - line.origin[i]) * ood;
+
+ if (t1 > t2) {
+ std::swap(t1, t2);
+ }
+ auto old = tmin;
+ tmin = std::max(tmin, t1);
+ if (tmin != old) {
+ p = (i + 1);
+ }
+ tmax = std::min(tmax, t2);
+ if (tmin > tmax) {
+ return std::nullopt;
+ }
+ }
+ }
+
+ if (tmin <= 0.0f) {
+ return std::nullopt;
+ }
+
+ return ray_aabb_ret{.position = line.origin + line.dir * tmin,
+ .time = tmin,
+ .normal = plane_to_normal(p)};
+}
+
+std::optional<moving_aabb_ret>
+intersect_moving_aabbs(const moving_aabb& a, const moving_aabb& b) noexcept {
+
+ if (intersect_aabbs(a.aabb, b.aabb)) {
+ return std::nullopt;
+ }
+
+ const glm::vec3 velocity = b.velocity - a.velocity;
+ float tfirst = 0.0f;
+ float tlast = 10.0f;
+ int p = 0;
+
+ for (int i = 0; i < 3; ++i) {
+ if (velocity[i] < 0.0f) {
+ if (b.aabb.max[i] < a.aabb.min[i]) {
+ return std::nullopt;
+ }
+ if (a.aabb.max[i] < b.aabb.min[i]) {
+ const auto old = tfirst;
+ tfirst = std::max((a.aabb.max[i] - b.aabb.min[i]) / velocity[i],
+ tfirst);
+ if (tfirst != old) {
+ p = (i + 1);
+ }
+ }
+ if (b.aabb.max[i] > a.aabb.min[i]) {
+ tlast = std::min((a.aabb.min[i] - b.aabb.max[i]) / velocity[i],
+ tlast);
+ }
+ } else if (velocity[i] > 0.0f) {
+ if (b.aabb.min[i] > a.aabb.max[i]) {
+ return std::nullopt;
+ }
+ if (b.aabb.max[i] < a.aabb.min[i]) {
+ const auto old = tfirst;
+ tfirst = std::max((a.aabb.min[i] - b.aabb.max[i]) / velocity[i],
+ tfirst);
+ if (tfirst != old) {
+ p = -(i + 1);
+ }
+ }
+ if (a.aabb.max[i] > b.aabb.min[i]) {
+ tlast = std::min((a.aabb.max[i] - b.aabb.min[i]) / velocity[i],
+ tlast);
+ }
+ } else {
+ if (b.aabb.max[i] < a.aabb.min[i] ||
+ b.aabb.min[i] > a.aabb.max[i]) {
+ return std::nullopt;
+ }
+ }
+ if (tfirst > tlast) {
+ return std::nullopt;
+ }
+ }
+
+ return moving_aabb_ret{.time = tfirst, .normal = plane_to_normal(p)};
+}
+
+// Gets the closest collision of an entity to a block.
+struct collide_ret {
+ moving_aabb_ret collision;
+ shared::world::block block;
+};
+static std::optional<collide_ret> collide(const aabb& aabb,
+ const blocks& blocks,
+ const glm::vec3& move) noexcept {
+
+ const moving_aabb moving_aabb{.aabb = aabb, .velocity = move};
+
+ // TODO: It's possible we collide at the same time, but on a different block
+ // If this occurs, we will phase through it as we ignore the other
+ // collision. So fix it by doing some maths.
+ std::optional<collide_ret> collision;
+ for (const auto& block_aabb : blocks) {
+ if (!shared::world::block::is_collidable(block_aabb.block)) {
+ continue;
+ }
+
+ const struct moving_aabb block_moving_aabb {
+ .aabb = block_aabb.aabb, .velocity = { 0.0f, 0.0f, 0.0f }
+ };
+ const auto intersect =
+ intersect_moving_aabbs(moving_aabb, block_moving_aabb);
+
+ if (!intersect.has_value() || intersect->time >= 1.0f) {
+ continue;
+ }
+
+ // Update collision if it doesn't exist or if this one is closer.
+ if (!collision.has_value() ||
+ intersect->time < collision->collision.time) {
+
+ collision =
+ collide_ret{.collision = *intersect, .block = block_aabb.block};
+ }
+ }
+
+ return collision;
+}
+
+// Returns the closest ground object if such an object exists.
+static std::optional<shared::world::block>
+maybe_get_ground(const blocks& blocks, const aabb& aabb,
+ bool (*filter)(const enum shared::world::block::type) =
+ world::block::is_tangible) noexcept {
+ const moving_aabb moving_aabb{.aabb = aabb,
+ .velocity = {0.0f, -1.0f, 0.0f}};
+
+ // blockinfo, cur max distance
+ std::optional<std::pair<block, float>> ground;
+ for (const auto& block : blocks) {
+
+ if (!filter(block.block)) {
+ continue;
+ }
+
+ const struct moving_aabb block_moving_aabb {
+ .aabb = block.aabb, .velocity = { 0.0f, 0.0f, 0.0f }
+ };
+
+ if (const auto intersect =
+ intersect_moving_aabbs(moving_aabb, block_moving_aabb);
+ intersect.has_value()) {
+
+ if (intersect->time > EPSILON2) {
+ continue;
+ }
+
+ const float distance =
+ glm::distance(aabb.min, block.aabb.min); // cool hack
+
+ if (!ground.has_value()) {
+ ground.emplace(std::make_pair(block, distance));
+ continue;
+ }
+
+ const auto& [cur_max_block, cur_max_distance] = *ground;
+ if (distance >= cur_max_distance) {
+ continue;
+ }
+
+ ground.emplace(std::make_pair(block, distance));
+ }
+ }
+ if (ground.has_value()) {
+ return ground->first.block;
+ }
+ return std::nullopt;
+}
+
+static bool is_intersecting(
+ const blocks& blocks, const aabb& aabb,
+ bool (*filter)(const enum shared::world::block::type)) noexcept {
+ for (const auto& block_aabb : blocks) {
+ if (!filter(block_aabb.block)) {
+ continue;
+ }
+ if (!intersect_aabbs(block_aabb.aabb, aabb)) {
+ continue;
+ }
+ return true;
+ }
+ return false;
+}
+
+struct vectors {
+ glm::vec3 up;
+ glm::vec3 front;
+ glm::vec3 right;
+};
+
+static glm::vec3 get_accel(const blocks& blocks, const aabb& aabb,
+ const vectors& vectors,
+ const entity::index_t& commands) noexcept {
+ glm::vec3 acceleration{};
+
+ const auto add_input = [&](const auto& mask, const glm::vec3& dir) {
+ if (commands & mask) {
+ acceleration += dir;
+ }
+ };
+ add_input(animate::mask::forward, vectors.front);
+ add_input(animate::mask::left, -vectors.right);
+ add_input(animate::mask::backward, -vectors.front);
+ add_input(animate::mask::right, vectors.right);
+
+ acceleration.y = 0.0f; // so we don't move faster when facing up/down
+ if (acceleration != glm::vec3{}) {
+ acceleration = glm::normalize(acceleration);
+ }
+ acceleration *= MOVE_ACCEL; // 7.25 blocks/sec^2 by default
+ if (commands & animate::mask::sprint) {
+ acceleration *= SPRINT_MULT;
+ }
+
+ const bool in_water =
+ is_intersecting(blocks, aabb, world::block::is_liquid);
+
+ if ((commands & animate::mask::jump) && in_water) {
+ acceleration += SWIM_ACCEL * vectors.up;
+ }
+
+ // flying up/down
+ if (commands & animate::mask::flying) {
+ if (commands & animate::mask::jump) {
+ acceleration += FLY_ACCEL * vectors.up;
+ }
+ if (commands & animate::mask::crouch) {
+ acceleration -= FLY_ACCEL * vectors.up;
+ }
+ }
+
+ const bool on_ground =
+ maybe_get_ground(blocks, aabb, world::block::is_collidable).has_value();
+ // Move slower in the air, also our hitbox must be outside non-tangible.
+ if (!on_ground && !in_water && !(commands & animate::mask::flying)) {
+ acceleration *= AIR_MULT;
+ }
+
+ // gravity - only applied if there isn't a collidable block beneath us.
+ // or if we're not flying
+ if (!on_ground && !(commands & animate::mask::flying)) {
+ acceleration -= GRAVITY * vectors.up;
+ }
+
+ return acceleration;
+}
+
+static float get_decel_factor(const blocks& blocks, const aabb& aabb,
+ const entity::index_t& commands) noexcept {
+
+ const float drag = [&]() -> float { // max drag of all intersecting blocks
+ float max = 0.0f;
+ for (const auto& block : blocks) {
+ if (!intersect_aabbs(aabb, block.aabb)) {
+ continue;
+ }
+ max = std::max(max, get_block_friction(block.block));
+ }
+
+ if (commands & animate::flying) {
+ return std::max(max, FLY_DRAG);
+ }
+
+ return max;
+ }();
+
+ const float friction = [&]() -> float {
+ const auto ground =
+ maybe_get_ground(blocks, aabb, world::block::is_collidable);
+ return ground.has_value() ? get_block_friction(*ground) : 0.0f;
+ }();
+
+ // Our deceleration is simply the max of what we're in and what we're on
+ return std::max(drag, friction);
+}
+
+static void decelerate(glm::vec3& velocity, const blocks& blocks,
+ const aabb& aabb, const entity::index_t& commands,
+ const float max_time) noexcept {
+ const float decel =
+ get_decel_factor(blocks, aabb, commands) * max_time * 2.0f;
+
+ if (const float xy_speed = glm::length(glm::vec2{velocity.x, velocity.z});
+ xy_speed > 0.0f) {
+
+ const float new_speed = std::max(0.0f, xy_speed - decel);
+ velocity.x *= new_speed / xy_speed;
+ velocity.z *= new_speed / xy_speed;
+ }
+
+ // we decelerate on y, but only if we're flying
+ if (const float y_speed = std::abs(velocity.y);
+ y_speed > 0.0f && (commands & shared::animate::flying)) {
+
+ velocity.y *= std::max(0.0f, y_speed - decel) / y_speed;
+ }
+}
+
+static void clamp_move_xy(float& x, float& z, const entity::index_t& commands,
+ const bool in_liquid,
+ const float mult = 1.0f) noexcept {
+
+ const float max_speed_xy = [&]() {
+ const float base = [&]() { // lol
+ if (commands & animate::mask::flying) {
+ return MAX_SPEED_XZ_FLYING;
+ }
+ if (in_liquid) {
+ return MAX_SPEED_XZ_LIQUID;
+ }
+ return MAX_SPEED_XZ;
+ }();
+ if (commands & animate::mask::sprint) {
+ return base * SPRINT_MULT;
+ }
+ return base;
+ }() * mult;
+
+ if (const float speed_xz = std::hypot(x, z); speed_xz > max_speed_xy) {
+ const float ratio = max_speed_xy / speed_xz;
+ x *= ratio;
+ z *= ratio;
+ }
+}
+
+static void clamp_move_y(float& y, const entity::index_t& commands,
+ const bool in_liquid,
+ const float mult = 1.0f) noexcept {
+ const float max_speed_y = [&]() {
+ if (commands & animate::mask::flying) {
+ return MAX_SPEED_Y_FLYING;
+ }
+ return in_liquid ? MAX_SPEED_Y_LIQUID : MAX_SPEED_Y;
+ }() * mult;
+
+ if (const float speed_y = std::abs(y); speed_y > max_speed_y) {
+ const float ratio = max_speed_y / speed_y;
+ y *= ratio;
+ }
+}
+
+static void clamp_move(glm::vec3& move, const entity::index_t& commands,
+ const bool in_liquid, const float mult = 1.0f) noexcept {
+
+ clamp_move_xy(move.x, move.z, commands, in_liquid, mult);
+ clamp_move_y(move.y, commands, in_liquid, mult);
+}
+
+static void handle_jumps(glm::vec3& velocity, const blocks& blocks,
+ const aabb& aabb, const entity::index_t& commands,
+ const bool in_liquid) noexcept {
+ if (!(commands & animate::mask::jump)) {
+ return;
+ }
+ if (!(velocity.y >= 0 && velocity.y <= EPSILON)) {
+ return;
+ }
+ if (in_liquid) {
+ return;
+ }
+ if (!maybe_get_ground(blocks, aabb, world::block::is_collidable)) {
+ return;
+ }
+ // TODO: the jump will only occur in the next movement tick
+ // fix this by modifying both our velocity and our move vector
+ velocity.y += JUMP_ACCEL;
+}
+
+static void handle_collisions(glm::vec3& velocity, glm::vec3& local_pos,
+ glm::vec3 move, const blocks& blocks, aabb aabb,
+ const entity::index_t& commands,
+ const float max_time) noexcept {
+ constexpr int MAX_COLLISIONS = 100;
+ for (int collisions = 0; collisions < MAX_COLLISIONS; ++collisions) {
+
+ {
+ const bool in_liquid =
+ is_intersecting(blocks, aabb, world::block::is_liquid);
+
+ handle_jumps(velocity, blocks, aabb, commands, in_liquid);
+ clamp_move(velocity, commands, in_liquid);
+ clamp_move(move, commands, in_liquid, max_time);
+ }
+
+ const auto collision = collide(aabb, blocks, move);
+
+ if (!collision.has_value()) {
+ local_pos += move;
+ return;
+ }
+
+ const glm::vec3 pos = move * collision->collision.time;
+ const glm::vec3 off = collision->collision.normal * EPSILON;
+
+ for (int i = 0; i < 3; ++i) {
+
+ float& move_axis = move[i];
+ float& vel_axis = velocity[i];
+
+ const float diff = pos[i] - off[i];
+ move_axis -= diff;
+
+ vel_axis -= collision->collision.normal[i] *
+ glm::dot(velocity, collision->collision.normal);
+ move_axis -= collision->collision.normal[i] *
+ glm::dot(move, collision->collision.normal);
+
+ vel_axis = std::abs(vel_axis) <= EPSILON ? 0.0f : vel_axis;
+ move_axis = std::abs(move_axis) <= EPSILON ? 0.0f : move_axis;
+
+ if (abs(pos[i]) <= EPSILON2) {
+ continue;
+ }
+
+ local_pos[i] += diff; // add movement to current position
+ aabb.min[i] += diff;
+ aabb.max[i] += diff;
+ }
+ }
+}
+
+static void handle_movement(shared::animate& animate, const blocks& blocks,
+ const aabb& aabb, const vectors& vectors,
+ const entity::index_t& commands,
+ const float max_time) noexcept {
+
+ auto& velocity = animate.get_mutable_velocity();
+ auto& position = animate.get_mutable_local_pos();
+
+ decelerate(velocity, blocks, aabb, commands, max_time);
+
+ const glm::vec3 accel = get_accel(blocks, aabb, vectors, commands);
+ const glm::vec3 move = animate.get_velocity() * max_time +
+ 0.5f * accel * std::pow(max_time, 2.0f);
+
+ animate.get_mutable_velocity() += accel * max_time;
+
+ handle_collisions(velocity, position, move, blocks, aabb, commands,
+ max_time);
+}
+
+shared::animate move(const shared::moveable& moveable, const blocks& blocks,
+ const std::uint32_t& tickrate) noexcept {
+
+ const movement::aabb& aabb = moveable.get_aabb();
+
+ const auto vectors = [&]() -> struct vectors {
+ const auto up = glm::vec3{0.0f, 1.0f, 0.0f};
+ const auto front = moveable.get_angles().to_dir();
+ const auto right = glm::normalize(glm::cross(front, up));
+ return {.up = up, .front = front, .right = right};
+ }();
+ const float max_time = 1.0f / static_cast<float>(tickrate);
+
+ shared::animate ret = moveable;
+ handle_movement(ret, blocks, aabb, vectors, moveable.get_commands(),
+ max_time);
+ normalise_position(ret.get_mutable_local_pos(),
+ ret.get_mutable_chunk_pos());
+ return ret;
+}
+
+} // namespace movement
+} // namespace shared
diff --git a/src/shared/movement/movement.hh b/src/shared/movement/movement.hh
new file mode 100644
index 0000000..9c6e17d
--- /dev/null
+++ b/src/shared/movement/movement.hh
@@ -0,0 +1,75 @@
+#ifndef SHARED_MOVEMENT_MOVEMENT_HH_
+#define SHARED_MOVEMENT_MOVEMENT_HH_
+
+#include "shared/entity/animate.hh"
+#include "shared/entity/moveable.hh"
+#include "shared/math/math.hh"
+#include "shared/movement/struct.hh"
+#include "shared/shared.hh"
+#include "shared/world/chunk.hh"
+
+#include <algorithm>
+#include <array>
+#include <cstdint>
+
+#define GLM_ENABLE_EXPERIMENTAL
+#include <glm/glm.hpp>
+#include <glm/gtx/norm.hpp>
+
+namespace shared {
+namespace movement {
+
+// Returns a local pos relative to the base chunk pos, which can be negative,
+// or over 16.0f.
+glm::vec3 make_relative(const shared::math::coords& base_chunk_pos,
+ const glm::vec3& other_local_pos,
+ const shared::math::coords& other_chunk_pos) noexcept;
+
+void normalise_position(glm::vec3& local_pos,
+ shared::math::coords& chunk_pos) noexcept;
+bool intersect_aabbs(const aabb& a, const aabb& b) noexcept;
+
+struct line {
+ glm::vec3 origin;
+ glm::vec3 dir;
+};
+struct ray_aabb_ret {
+ glm::vec3 position;
+ float time;
+ glm::vec3 normal;
+};
+std::optional<ray_aabb_ret> intersect_ray_aabb(const line& line,
+ const aabb& aabb) noexcept;
+struct moving_aabb {
+ struct aabb aabb;
+ glm::vec3 velocity;
+};
+struct moving_aabb_ret {
+ float time;
+ glm::vec3 normal;
+};
+std::optional<moving_aabb_ret>
+intersect_moving_aabbs(const moving_aabb& a, const moving_aabb& b) noexcept;
+
+// We need more information about the block during movement code.
+struct block {
+ shared::world::block block;
+ struct aabb aabb;
+ shared::math::coords chunk_pos;
+ glm::ivec3 pos;
+};
+using blocks = std::vector<block>;
+
+// Returns a vec2 describing how wide and tall the array of blocks should be (to
+// ensure you never fall through anything at variable tickrates).
+glm::ivec2 get_move_xy(const std::uint32_t& tickrate,
+ const moveable& moveable) noexcept;
+
+[[nodiscard]] shared::animate move(const shared::moveable& moveable,
+ const blocks& blocks,
+ const std::uint32_t& tickrate) noexcept;
+
+} // namespace movement
+} // namespace shared
+
+#endif
diff --git a/src/shared/movement/struct.cc b/src/shared/movement/struct.cc
new file mode 100644
index 0000000..dd079eb
--- /dev/null
+++ b/src/shared/movement/struct.cc
@@ -0,0 +1 @@
+#include "shared/movement/struct.hh"
diff --git a/src/shared/movement/struct.hh b/src/shared/movement/struct.hh
new file mode 100644
index 0000000..7cfcc0f
--- /dev/null
+++ b/src/shared/movement/struct.hh
@@ -0,0 +1,20 @@
+#ifndef SHARED_MOVEMENT_STRUCT_HH_
+#define SHARED_MOVEMENT_STRUCT_HH_
+
+#include "glm/glm.hpp"
+
+namespace shared {
+namespace movement {
+
+constexpr float EPSILON = 0.0001f; // counteract arithmetic errors
+constexpr float EPSILON2 = EPSILON + 2 * EPSILON * EPSILON;
+
+struct aabb {
+ glm::vec3 min;
+ glm::vec3 max;
+};
+
+} // namespace movement
+} // namespace shared
+
+#endif
diff --git a/src/shared/net/connection.cc b/src/shared/net/connection.cc
index 79a83f5..b368735 100644
--- a/src/shared/net/connection.cc
+++ b/src/shared/net/connection.cc
@@ -1 +1,220 @@
#include "shared/net/connection.hh"
+
+namespace shared {
+namespace net {
+
+connection::connection(const socket_t& rsock) {
+ const std::string peer_address = get_socket_peer_address(rsock);
+ const std::string peer_port = get_socket_peer_port(rsock);
+
+ // Open up a connected usock based on the state of the connected rsock.
+ const socket_t usock = [&]() -> socket_t {
+ constexpr addrinfo hints = {.ai_flags = AI_PASSIVE,
+ .ai_family = AF_INET,
+ .ai_socktype = SOCK_DGRAM};
+ const std::string host_address = get_socket_host_address(rsock);
+ const std::string host_port = get_socket_host_port(rsock);
+ const auto host_info = get_addr_info(host_address, host_port, &hints);
+ const socket_t usock = make_socket(host_info.get());
+ bind_socket(usock, host_info.get());
+
+ const auto peer_info = get_addr_info(peer_address, peer_port, &hints);
+ connect_socket(usock, peer_info.get());
+
+ return usock;
+ }();
+
+ nonblock_socket(usock);
+ nonblock_socket(rsock);
+
+ this->socks.emplace(sockets{.rsock = rsock,
+ .usock = usock,
+ .address = peer_address,
+ .port = peer_port});
+}
+
+connection::connection(connection&& other) noexcept {
+ std::swap(this->socks, other.socks);
+ std::swap(this->bad_reason, other.bad_reason);
+ other.socks.reset();
+}
+
+connection& connection::operator=(connection&& other) noexcept {
+ std::swap(this->socks, other.socks);
+ std::swap(this->bad_reason, other.bad_reason);
+ other.socks.reset();
+ return *this;
+}
+
+connection::~connection() noexcept { this->close(); }
+
+void connection::rsend_packet(const rpacket_t& packet) noexcept {
+ this->rpackets.push_back(packet);
+}
+
+void connection::usend_packet(const upacket_t& packet) noexcept {
+ this->upackets.push_back(packet);
+}
+
+void connection::rsend_packet(rpacket&& packet) noexcept {
+ this->rsend_packet(std::make_shared<rpacket>(std::move(packet)));
+}
+
+void connection::usend_packet(upacket&& packet) noexcept {
+ this->usend_packet(std::make_shared<upacket>(std::move(packet)));
+}
+
+std::optional<proto::packet> connection::rrecv_packet() noexcept {
+ if (!this->good()) {
+ return std::nullopt;
+ }
+
+ const socket_t sock = this->socks->rsock;
+
+ // Get the size of the backlog, early out of there's nothing there yet.
+ const auto backlog_size = shared::net::get_backlog_size(sock);
+ if (backlog_size < sizeof(packet_header_t)) {
+ return std::nullopt;
+ }
+
+ const packet_header_t read_packet_size = [&]() {
+ packet_header_t ret;
+ recv(sock, &ret, sizeof(packet_header_t), MSG_PEEK);
+ return ntohl(ret);
+ }();
+ if (backlog_size < read_packet_size) { // data not there yet
+ return std::nullopt;
+ }
+ if (read_packet_size < sizeof(packet_header_t)) {
+ this->bad_reason.emplace("received packet too small");
+ return std::nullopt;
+ }
+ if (read_packet_size >= MAX_PACKET_SIZE) {
+ this->bad_reason.emplace("received packet size exceeded limit");
+ return std::nullopt;
+ }
+
+ // Read the actual packet now, based on our claimed size.
+ std::string data(read_packet_size, '\0');
+ if (const auto result = read(sock, std::data(data), read_packet_size);
+ result == -1) {
+ this->bad_reason = shared::net::get_errno_error();
+ return std::nullopt;
+ } else if (result != read_packet_size) {
+ return std::nullopt; // this shouldn't happen?
+ }
+ data = {std::begin(data) + sizeof(packet_header_t), std::end(data)};
+
+ // possible compression bomb :)
+ if (const auto decompress = shared::maybe_decompress_string(data);
+ decompress.has_value()) {
+ data = *decompress;
+ } else {
+ return std::nullopt;
+ }
+
+ // Parse the packet, ignoring the header.
+ proto::packet packet;
+ if (!packet.ParseFromString(data)) {
+ return std::nullopt;
+ }
+
+ return packet;
+}
+
+std::optional<proto::packet> connection::urecv_packet() noexcept {
+ const socket_t sock = this->socks->usock;
+
+restart:
+ if (!this->good()) {
+ return std::nullopt;
+ }
+
+ const auto packet_size = shared::net::get_backlog_size(sock);
+ if (packet_size == 0) {
+ return std::nullopt;
+ }
+
+ std::string data(packet_size, '\0');
+ if (const auto result = read(sock, std::data(data), packet_size);
+ result == -1) {
+
+ if (errno == ECONNREFUSED) { // icmp, ignore it
+ goto restart;
+ }
+
+ this->bad_reason = shared::net::get_errno_error();
+ return std::nullopt;
+ } else if (static_cast<decltype(packet_size)>(result) != packet_size) {
+ return std::nullopt; // shouldn't happen
+ }
+
+ if (const auto decompress = shared::maybe_decompress_string(data);
+ decompress.has_value()) {
+ data = *decompress;
+ } else {
+ goto restart;
+ }
+
+ proto::packet packet;
+ if (!packet.ParseFromString(data)) {
+ goto restart;
+ }
+
+ return packet;
+}
+
+std::optional<proto::packet> connection::recv_packet() noexcept {
+ if (const auto ret = urecv_packet(); ret.has_value()) {
+ return ret;
+ }
+ return rrecv_packet();
+}
+
+bool connection::maybe_send(const packet& packet,
+ const socket_t& sock) noexcept {
+ if (!this->good()) {
+ return false;
+ }
+
+ const auto& data = packet.data;
+ if (const auto result = write(sock, std::data(data), std::size(data));
+ result == -1) {
+
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ return false;
+ }
+
+ this->bad_reason.emplace(get_errno_error());
+ return false;
+ } else if (static_cast<std::size_t>(result) != std::size(data)) {
+ return false;
+ }
+
+ return true;
+}
+
+void connection::poll() {
+ const auto erase_send = [this](auto& packets, const socket_t& sock) {
+ const auto it =
+ std::find_if(std::begin(packets), std::end(packets),
+ [&, this](const auto& packet) {
+ return !this->maybe_send(*packet, sock);
+ });
+ packets.erase(std::begin(packets), it);
+ };
+
+ erase_send(this->upackets, this->socks->usock);
+ erase_send(this->rpackets, this->socks->rsock);
+}
+
+void connection::close() {
+ if (this->socks.has_value()) {
+ shared::net::close_socket(socks->rsock);
+ shared::net::close_socket(socks->usock);
+ }
+ this->socks.reset();
+}
+
+} // namespace net
+} // namespace shared
diff --git a/src/shared/net/connection.hh b/src/shared/net/connection.hh
index 79146af..70ed6e4 100644
--- a/src/shared/net/connection.hh
+++ b/src/shared/net/connection.hh
@@ -2,208 +2,73 @@
#define SHARED_NET_CONNECTION_HH_
#include <algorithm>
+#include <ctype.h>
#include <optional>
#include <string>
+#include <type_traits>
+#include <list>
#include "shared/net/net.hh"
+#include "shared/net/packet.hh"
#include "shared/net/proto.hh"
namespace shared {
namespace net {
+using socket_t = int;
+
class connection {
+public:
+ using upacket_t = std::shared_ptr<upacket>;
+ using rpacket_t = std::shared_ptr<rpacket>;
+
private:
+ static constexpr std::size_t MAX_PACKET_SIZE = 65536;
+
struct sockets {
- int rsock;
- int usock; // connected in constructor, no need to use sendto or revfrom
+ socket_t rsock;
+ socket_t usock; // connected in constructor
std::string address;
std::string port;
-
- sockets(const int r, const int u, const std::string& a,
- const std::string& p)
- : rsock(r), usock(u), address(a), port(p) {}
};
std::optional<sockets> socks;
std::optional<std::string> bad_reason;
+ std::list<upacket_t> upackets;
+ std::list<rpacket_t> rpackets;
private:
- struct packet_header {
- std::uint32_t size;
- };
-
- // Data has a non-serialised header, and variable length serialised
- // protobuf content.
- static std::string packet_to_data(const proto::packet& packet) {
-
- std::string data;
- packet.SerializeToString(&data);
- shared::compress_string(data);
-
- packet_header header{.size = htonl(static_cast<std::uint32_t>(
- std::size(data) + sizeof(packet_header)))};
-
- return std::string{reinterpret_cast<char*>(&header),
- reinterpret_cast<char*>(&header) + sizeof(header)} +
- std::move(data);
- }
-
- void send_sock_packet(const int sock, const proto::packet& packet) {
- if (!this->good()) {
- return;
- }
-
- const std::string data = packet_to_data(packet);
-
- if (send(sock, std::data(data), std::size(data), 0) == -1) {
- this->bad_reason = shared::net::get_errno_error();
- }
- }
+ bool maybe_send(const packet& packet, const socket_t& sock) noexcept;
public:
- connection(const int rsock) {
- using namespace shared::net;
-
- const std::string peer_address = get_socket_peer_address(rsock);
- const std::string peer_port = get_socket_peer_port(rsock);
-
- // Open up a connected usock based on the state of the connected rsock.
- const int usock = [&peer_address, &peer_port, &rsock]() -> int {
- constexpr addrinfo hints = {.ai_flags = AI_PASSIVE,
- .ai_family = AF_INET,
- .ai_socktype = SOCK_DGRAM};
- const std::string host_address = get_socket_host_address(rsock);
- const std::string host_port = get_socket_host_port(rsock);
- const auto host_info =
- get_addr_info(host_address, host_port, &hints);
- const int usock = make_socket(host_info.get());
- bind_socket(usock, host_info.get());
-
- const auto peer_info =
- get_addr_info(peer_address, peer_port, &hints);
- connect_socket(usock, peer_info.get());
-
- return usock;
- }();
-
- nonblock_socket(usock);
- nonblock_socket(rsock);
-
- this->socks.emplace(rsock, usock, peer_address, peer_port);
- }
-
- // We do not want to copy this object!
- // We use std::nullopt to determine if this object has been moved and if we
- // should close its sockets.
+ connection(const socket_t& rsock); // requires connected rsocket
connection(const connection&) = delete;
- connection(connection&& other) noexcept {
- std::swap(this->socks, other.socks);
- std::swap(this->bad_reason, other.bad_reason);
- other.socks.reset();
- }
- connection& operator=(connection&& other) noexcept {
- std::swap(this->socks, other.socks);
- std::swap(this->bad_reason, other.bad_reason);
- other.socks.reset();
- return *this;
- }
- ~connection() noexcept {
- if (this->socks.has_value()) {
- shared::net::close_socket(socks->rsock);
- shared::net::close_socket(socks->usock);
- }
- }
+ connection(connection&& other) noexcept;
+ connection& operator=(connection&& other) noexcept;
+ ~connection() noexcept;
- // Getters.
- bool good() const noexcept { return !bad_reason.has_value(); }
- std::string get_bad_reason() const noexcept {
- return this->bad_reason.value();
+public:
+ bool good() const noexcept {
+ return !bad_reason.has_value() && this->socks.has_value();
}
+ std::string get_bad_reason() const noexcept { return *this->bad_reason; }
std::string get_address() const noexcept { return this->socks->address; }
public:
- // Send does nothing if good() returns false!
- // Returns whether or not we were able to send our packet.
- void rsend_packet(const proto::packet& packet) noexcept {
- return send_sock_packet(this->socks->rsock, packet);
- }
- void usend_packet(const proto::packet& packet) noexcept {
- return send_sock_packet(this->socks->usock, packet);
- }
- std::optional<proto::packet> rrecv_packet() noexcept {
- const int sock = this->socks->rsock;
-
- // Get the size of the backlog, early out of there's nothing there yet.
- const auto backlog_size = shared::net::get_backlog_size(sock);
- if (backlog_size < sizeof(packet_header)) {
- return std::nullopt;
- }
-
- // Read for the packet headers and get the claimed size. Early out if
- // our stream isn't big enough for that yet.
- packet_header header = {};
- recv(sock, &header, sizeof(header), MSG_PEEK);
- const std::uint32_t read_packet_size = ntohl(header.size);
- if (backlog_size < read_packet_size) {
- return std::nullopt;
- }
-
- // Read the actual packet now, based on our claimed size.
- std::string data;
- data.reserve(read_packet_size);
- if (read(sock, std::data(data), read_packet_size) == -1) {
- this->bad_reason = shared::net::get_errno_error();
- return std::nullopt;
- }
-
- data = std::string{
- reinterpret_cast<char*>(std::data(data)) + sizeof(packet_header),
- reinterpret_cast<char*>(std::data(data)) + read_packet_size};
- shared::decompress_string(data);
+ // When an identical packet is sent to multiple people, the functions using
+ // rpacket_t should be used to avoid unnecessary compression.
+ void rsend_packet(const rpacket_t& packet) noexcept;
+ void usend_packet(const upacket_t& packet) noexcept;
+ void rsend_packet(rpacket&& packet) noexcept;
+ void usend_packet(upacket&& packet) noexcept;
- // Parse the packet, ignoring the header.
- proto::packet packet;
- if (!packet.ParseFromString(data)) {
- return std::nullopt;
- }
-
- return packet;
- }
- std::optional<proto::packet> urecv_packet() noexcept {
- const int sock = this->socks->usock;
-
- restart:
- const auto packet_size = shared::net::get_backlog_size(sock);
-
- if (packet_size == 0) {
- return std::nullopt;
- }
-
- std::string data;
- data.reserve(packet_size);
- if (recv(sock, std::data(data), packet_size, 0) == -1) {
- this->bad_reason = shared::net::get_errno_error();
- return std::nullopt;
- }
-
- data = std::string{
- reinterpret_cast<char*>(std::data(data)) + sizeof(packet_header),
- reinterpret_cast<char*>(std::data(data)) + packet_size};
- shared::decompress_string(data);
-
- proto::packet packet;
- if (!packet.ParseFromString(data)) {
- goto restart;
- }
+public:
+ std::optional<proto::packet> rrecv_packet() noexcept;
+ std::optional<proto::packet> urecv_packet() noexcept;
+ std::optional<proto::packet> recv_packet() noexcept; // from either
- return packet;
- }
- // Gets packets from r/u streams, doesn't care which.
- std::optional<proto::packet> recv_packet() noexcept {
- if (const auto ret = urecv_packet(); ret.has_value()) {
- return ret;
- }
- return rrecv_packet();
- }
+public:
+ void poll(); // call to send potentially queued packets
+ void close(); // call to close sockets
};
} // namespace net
diff --git a/src/shared/net/lib/protobuf/net.pb.cc b/src/shared/net/lib/protobuf/net.pb.cc
index a938799..b86af02 100644
--- a/src/shared/net/lib/protobuf/net.pb.cc
+++ b/src/shared/net/lib/protobuf/net.pb.cc
@@ -16,249 +16,388 @@
#include <google/protobuf/port_def.inc>
PROTOBUF_PRAGMA_INIT_SEG
+
+namespace _pb = ::PROTOBUF_NAMESPACE_ID;
+namespace _pbi = _pb::internal;
+
namespace proto {
-constexpr angles::angles(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : pitch_(0)
- , yaw_(0){}
+PROTOBUF_CONSTEXPR angles::angles(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.pitch_)*/0
+ , /*decltype(_impl_.yaw_)*/0
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct anglesDefaultTypeInternal {
- constexpr anglesDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR anglesDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~anglesDefaultTypeInternal() {}
union {
angles _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT anglesDefaultTypeInternal _angles_default_instance_;
-constexpr coords::coords(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : x_(0)
- , z_(0){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 anglesDefaultTypeInternal _angles_default_instance_;
+PROTOBUF_CONSTEXPR coords::coords(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.x_)*/0
+ , /*decltype(_impl_.z_)*/0
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct coordsDefaultTypeInternal {
- constexpr coordsDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR coordsDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~coordsDefaultTypeInternal() {}
union {
coords _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT coordsDefaultTypeInternal _coords_default_instance_;
-constexpr vec3::vec3(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : x_(0)
- , y_(0)
- , z_(0){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 coordsDefaultTypeInternal _coords_default_instance_;
+PROTOBUF_CONSTEXPR vec3::vec3(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.x_)*/0
+ , /*decltype(_impl_.y_)*/0
+ , /*decltype(_impl_.z_)*/0
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct vec3DefaultTypeInternal {
- constexpr vec3DefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR vec3DefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~vec3DefaultTypeInternal() {}
union {
vec3 _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT vec3DefaultTypeInternal _vec3_default_instance_;
-constexpr ivec3::ivec3(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : x_(0)
- , y_(0)
- , z_(0){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 vec3DefaultTypeInternal _vec3_default_instance_;
+PROTOBUF_CONSTEXPR ivec3::ivec3(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.x_)*/0
+ , /*decltype(_impl_.y_)*/0
+ , /*decltype(_impl_.z_)*/0
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct ivec3DefaultTypeInternal {
- constexpr ivec3DefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR ivec3DefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~ivec3DefaultTypeInternal() {}
union {
ivec3 _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ivec3DefaultTypeInternal _ivec3_default_instance_;
-constexpr player::player(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : chunk_pos_(nullptr)
- , local_pos_(nullptr)
- , viewangles_(nullptr)
- , velocity_(nullptr)
- , index_(0u)
- , commands_(0u){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ivec3DefaultTypeInternal _ivec3_default_instance_;
+PROTOBUF_CONSTEXPR entity::entity(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.chunk_pos_)*/nullptr
+ , /*decltype(_impl_.local_pos_)*/nullptr
+ , /*decltype(_impl_.index_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
+struct entityDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR entityDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~entityDefaultTypeInternal() {}
+ union {
+ entity _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 entityDefaultTypeInternal _entity_default_instance_;
+PROTOBUF_CONSTEXPR animate::animate(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.entity_)*/nullptr
+ , /*decltype(_impl_.viewangles_)*/nullptr
+ , /*decltype(_impl_.velocity_)*/nullptr
+ , /*decltype(_impl_.commands_)*/0u
+ , /*decltype(_impl_.active_item_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
+struct animateDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR animateDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~animateDefaultTypeInternal() {}
+ union {
+ animate _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 animateDefaultTypeInternal _animate_default_instance_;
+PROTOBUF_CONSTEXPR item::item(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.index_)*/0u
+ , /*decltype(_impl_.type_)*/0u
+ , /*decltype(_impl_.quantity_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
+struct itemDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR itemDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~itemDefaultTypeInternal() {}
+ union {
+ item _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 itemDefaultTypeInternal _item_default_instance_;
+PROTOBUF_CONSTEXPR item_array::item_array(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.items_)*/{}
+ , /*decltype(_impl_._cached_size_)*/{}} {}
+struct item_arrayDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR item_arrayDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~item_arrayDefaultTypeInternal() {}
+ union {
+ item_array _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 item_arrayDefaultTypeInternal _item_array_default_instance_;
+PROTOBUF_CONSTEXPR player::player(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.animate_)*/nullptr
+ , /*decltype(_impl_.inventory_)*/nullptr
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct playerDefaultTypeInternal {
- constexpr playerDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR playerDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~playerDefaultTypeInternal() {}
union {
player _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT playerDefaultTypeInternal _player_default_instance_;
-constexpr auth::auth(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : username_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
- , password_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 playerDefaultTypeInternal _player_default_instance_;
+PROTOBUF_CONSTEXPR auth::auth(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.username_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
+ , /*decltype(_impl_.password_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct authDefaultTypeInternal {
- constexpr authDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR authDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~authDefaultTypeInternal() {}
union {
auth _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT authDefaultTypeInternal _auth_default_instance_;
-constexpr init::init(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : localplayer_(nullptr)
- , seed_(uint64_t{0u})
- , draw_distance_(0){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 authDefaultTypeInternal _auth_default_instance_;
+PROTOBUF_CONSTEXPR init::init(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.localplayer_)*/nullptr
+ , /*decltype(_impl_.seed_)*/uint64_t{0u}
+ , /*decltype(_impl_.draw_distance_)*/0
+ , /*decltype(_impl_.tickrate_)*/0u
+ , /*decltype(_impl_.tick_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct initDefaultTypeInternal {
- constexpr initDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR initDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~initDefaultTypeInternal() {}
union {
init _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT initDefaultTypeInternal _init_default_instance_;
-constexpr move::move(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : viewangles_(nullptr)
- , commands_(0u){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 initDefaultTypeInternal _init_default_instance_;
+PROTOBUF_CONSTEXPR move::move(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.viewangles_)*/nullptr
+ , /*decltype(_impl_.commands_)*/0u
+ , /*decltype(_impl_.active_item_)*/0u
+ , /*decltype(_impl_.sequence_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct moveDefaultTypeInternal {
- constexpr moveDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR moveDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~moveDefaultTypeInternal() {}
union {
move _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT moveDefaultTypeInternal _move_default_instance_;
-constexpr remove_player::remove_player(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : index_(0u){}
-struct remove_playerDefaultTypeInternal {
- constexpr remove_playerDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
- ~remove_playerDefaultTypeInternal() {}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 moveDefaultTypeInternal _move_default_instance_;
+PROTOBUF_CONSTEXPR remove_entity::remove_entity(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.index_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
+struct remove_entityDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR remove_entityDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~remove_entityDefaultTypeInternal() {}
union {
- remove_player _instance;
+ remove_entity _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT remove_playerDefaultTypeInternal _remove_player_default_instance_;
-constexpr say::say(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : text_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 remove_entityDefaultTypeInternal _remove_entity_default_instance_;
+PROTOBUF_CONSTEXPR say::say(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.text_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct sayDefaultTypeInternal {
- constexpr sayDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR sayDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~sayDefaultTypeInternal() {}
union {
say _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT sayDefaultTypeInternal _say_default_instance_;
-constexpr hear_player::hear_player(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : text_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
- , index_(0u){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 sayDefaultTypeInternal _say_default_instance_;
+PROTOBUF_CONSTEXPR hear_player::hear_player(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.text_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
+ , /*decltype(_impl_.index_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct hear_playerDefaultTypeInternal {
- constexpr hear_playerDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR hear_playerDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~hear_playerDefaultTypeInternal() {}
union {
hear_player _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT hear_playerDefaultTypeInternal _hear_player_default_instance_;
-constexpr request_chunk::request_chunk(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : chunk_pos_(nullptr){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 hear_playerDefaultTypeInternal _hear_player_default_instance_;
+PROTOBUF_CONSTEXPR request_chunk::request_chunk(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.chunk_pos_)*/nullptr
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct request_chunkDefaultTypeInternal {
- constexpr request_chunkDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR request_chunkDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~request_chunkDefaultTypeInternal() {}
union {
request_chunk _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT request_chunkDefaultTypeInternal _request_chunk_default_instance_;
-constexpr remove_chunk::remove_chunk(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : chunk_pos_(nullptr){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 request_chunkDefaultTypeInternal _request_chunk_default_instance_;
+PROTOBUF_CONSTEXPR remove_chunk::remove_chunk(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.chunk_pos_)*/nullptr
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct remove_chunkDefaultTypeInternal {
- constexpr remove_chunkDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR remove_chunkDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~remove_chunkDefaultTypeInternal() {}
union {
remove_chunk _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT remove_chunkDefaultTypeInternal _remove_chunk_default_instance_;
-constexpr chunk::chunk(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : blocks_()
- , _blocks_cached_byte_size_(0)
- , chunk_pos_(nullptr){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 remove_chunkDefaultTypeInternal _remove_chunk_default_instance_;
+PROTOBUF_CONSTEXPR chunk::chunk(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.blocks_)*/{}
+ , /*decltype(_impl_._blocks_cached_byte_size_)*/{0}
+ , /*decltype(_impl_.chunk_pos_)*/nullptr
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct chunkDefaultTypeInternal {
- constexpr chunkDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR chunkDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~chunkDefaultTypeInternal() {}
union {
chunk _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT chunkDefaultTypeInternal _chunk_default_instance_;
-constexpr add_block::add_block(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : chunk_pos_(nullptr)
- , block_pos_(nullptr)
- , block_(0u){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 chunkDefaultTypeInternal _chunk_default_instance_;
+PROTOBUF_CONSTEXPR add_block::add_block(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.chunk_pos_)*/nullptr
+ , /*decltype(_impl_.block_pos_)*/nullptr
+ , /*decltype(_impl_.active_item_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct add_blockDefaultTypeInternal {
- constexpr add_blockDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR add_blockDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~add_blockDefaultTypeInternal() {}
union {
add_block _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT add_blockDefaultTypeInternal _add_block_default_instance_;
-constexpr remove_block::remove_block(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : chunk_pos_(nullptr)
- , block_pos_(nullptr){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 add_blockDefaultTypeInternal _add_block_default_instance_;
+PROTOBUF_CONSTEXPR remove_block::remove_block(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.chunk_pos_)*/nullptr
+ , /*decltype(_impl_.block_pos_)*/nullptr
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct remove_blockDefaultTypeInternal {
- constexpr remove_blockDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR remove_blockDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~remove_blockDefaultTypeInternal() {}
union {
remove_block _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT remove_blockDefaultTypeInternal _remove_block_default_instance_;
-constexpr server_message::server_message(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : message_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
- , fatal_(false){}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 remove_blockDefaultTypeInternal _remove_block_default_instance_;
+PROTOBUF_CONSTEXPR server_message::server_message(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.message_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
+ , /*decltype(_impl_.fatal_)*/false
+ , /*decltype(_impl_._cached_size_)*/{}} {}
struct server_messageDefaultTypeInternal {
- constexpr server_messageDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR server_messageDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~server_messageDefaultTypeInternal() {}
union {
server_message _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT server_messageDefaultTypeInternal _server_message_default_instance_;
-constexpr packet::packet(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : _oneof_case_{}{}
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 server_messageDefaultTypeInternal _server_message_default_instance_;
+PROTOBUF_CONSTEXPR item_swap::item_swap(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.index_a_)*/0u
+ , /*decltype(_impl_.index_b_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
+struct item_swapDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR item_swapDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~item_swapDefaultTypeInternal() {}
+ union {
+ item_swap _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 item_swapDefaultTypeInternal _item_swap_default_instance_;
+PROTOBUF_CONSTEXPR item_use::item_use(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.index_)*/0u
+ , /*decltype(_impl_._cached_size_)*/{}} {}
+struct item_useDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR item_useDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~item_useDefaultTypeInternal() {}
+ union {
+ item_use _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 item_useDefaultTypeInternal _item_use_default_instance_;
+PROTOBUF_CONSTEXPR item_update::item_update(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.items_)*/{}
+ , /*decltype(_impl_._cached_size_)*/{}} {}
+struct item_updateDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR item_updateDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~item_updateDefaultTypeInternal() {}
+ union {
+ item_update _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 item_updateDefaultTypeInternal _item_update_default_instance_;
+PROTOBUF_CONSTEXPR animate_update::animate_update(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_._has_bits_)*/{}
+ , /*decltype(_impl_._cached_size_)*/{}
+ , /*decltype(_impl_.animate_)*/nullptr
+ , /*decltype(_impl_.tick_)*/0u
+ , /*decltype(_impl_.sequence_)*/0u} {}
+struct animate_updateDefaultTypeInternal {
+ PROTOBUF_CONSTEXPR animate_updateDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
+ ~animate_updateDefaultTypeInternal() {}
+ union {
+ animate_update _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 animate_updateDefaultTypeInternal _animate_update_default_instance_;
+PROTOBUF_CONSTEXPR packet::packet(
+ ::_pbi::ConstantInitialized): _impl_{
+ /*decltype(_impl_.contents_)*/{}
+ , /*decltype(_impl_._cached_size_)*/{}
+ , /*decltype(_impl_._oneof_case_)*/{}} {}
struct packetDefaultTypeInternal {
- constexpr packetDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ PROTOBUF_CONSTEXPR packetDefaultTypeInternal()
+ : _instance(::_pbi::ConstantInitialized{}) {}
~packetDefaultTypeInternal() {}
union {
packet _instance;
};
};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT packetDefaultTypeInternal _packet_default_instance_;
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 packetDefaultTypeInternal _packet_default_instance_;
} // namespace proto
-static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_net_2eproto[18];
-static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_net_2eproto = nullptr;
-static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_net_2eproto = nullptr;
+static ::_pb::Metadata file_level_metadata_net_2eproto[26];
+static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_net_2eproto = nullptr;
+static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_net_2eproto = nullptr;
const uint32_t TableStruct_net_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
@@ -267,201 +406,290 @@ const uint32_t TableStruct_net_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(prot
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::angles, pitch_),
- PROTOBUF_FIELD_OFFSET(::proto::angles, yaw_),
+ PROTOBUF_FIELD_OFFSET(::proto::angles, _impl_.pitch_),
+ PROTOBUF_FIELD_OFFSET(::proto::angles, _impl_.yaw_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::coords, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::coords, x_),
- PROTOBUF_FIELD_OFFSET(::proto::coords, z_),
+ PROTOBUF_FIELD_OFFSET(::proto::coords, _impl_.x_),
+ PROTOBUF_FIELD_OFFSET(::proto::coords, _impl_.z_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::vec3, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::vec3, x_),
- PROTOBUF_FIELD_OFFSET(::proto::vec3, y_),
- PROTOBUF_FIELD_OFFSET(::proto::vec3, z_),
+ PROTOBUF_FIELD_OFFSET(::proto::vec3, _impl_.x_),
+ PROTOBUF_FIELD_OFFSET(::proto::vec3, _impl_.y_),
+ PROTOBUF_FIELD_OFFSET(::proto::vec3, _impl_.z_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::ivec3, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::ivec3, x_),
- PROTOBUF_FIELD_OFFSET(::proto::ivec3, y_),
- PROTOBUF_FIELD_OFFSET(::proto::ivec3, z_),
+ PROTOBUF_FIELD_OFFSET(::proto::ivec3, _impl_.x_),
+ PROTOBUF_FIELD_OFFSET(::proto::ivec3, _impl_.y_),
+ PROTOBUF_FIELD_OFFSET(::proto::ivec3, _impl_.z_),
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::proto::entity, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ ~0u, // no _inlined_string_donated_
+ PROTOBUF_FIELD_OFFSET(::proto::entity, _impl_.index_),
+ PROTOBUF_FIELD_OFFSET(::proto::entity, _impl_.chunk_pos_),
+ PROTOBUF_FIELD_OFFSET(::proto::entity, _impl_.local_pos_),
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::proto::animate, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ ~0u, // no _inlined_string_donated_
+ PROTOBUF_FIELD_OFFSET(::proto::animate, _impl_.entity_),
+ PROTOBUF_FIELD_OFFSET(::proto::animate, _impl_.commands_),
+ PROTOBUF_FIELD_OFFSET(::proto::animate, _impl_.viewangles_),
+ PROTOBUF_FIELD_OFFSET(::proto::animate, _impl_.velocity_),
+ PROTOBUF_FIELD_OFFSET(::proto::animate, _impl_.active_item_),
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::proto::item, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ ~0u, // no _inlined_string_donated_
+ PROTOBUF_FIELD_OFFSET(::proto::item, _impl_.index_),
+ PROTOBUF_FIELD_OFFSET(::proto::item, _impl_.type_),
+ PROTOBUF_FIELD_OFFSET(::proto::item, _impl_.quantity_),
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::proto::item_array, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ ~0u, // no _inlined_string_donated_
+ PROTOBUF_FIELD_OFFSET(::proto::item_array, _impl_.items_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::player, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::player, index_),
- PROTOBUF_FIELD_OFFSET(::proto::player, commands_),
- PROTOBUF_FIELD_OFFSET(::proto::player, chunk_pos_),
- PROTOBUF_FIELD_OFFSET(::proto::player, local_pos_),
- PROTOBUF_FIELD_OFFSET(::proto::player, viewangles_),
- PROTOBUF_FIELD_OFFSET(::proto::player, velocity_),
+ PROTOBUF_FIELD_OFFSET(::proto::player, _impl_.animate_),
+ PROTOBUF_FIELD_OFFSET(::proto::player, _impl_.inventory_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::auth, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::auth, username_),
- PROTOBUF_FIELD_OFFSET(::proto::auth, password_),
+ PROTOBUF_FIELD_OFFSET(::proto::auth, _impl_.username_),
+ PROTOBUF_FIELD_OFFSET(::proto::auth, _impl_.password_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::init, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::init, seed_),
- PROTOBUF_FIELD_OFFSET(::proto::init, draw_distance_),
- PROTOBUF_FIELD_OFFSET(::proto::init, localplayer_),
+ PROTOBUF_FIELD_OFFSET(::proto::init, _impl_.seed_),
+ PROTOBUF_FIELD_OFFSET(::proto::init, _impl_.draw_distance_),
+ PROTOBUF_FIELD_OFFSET(::proto::init, _impl_.localplayer_),
+ PROTOBUF_FIELD_OFFSET(::proto::init, _impl_.tickrate_),
+ PROTOBUF_FIELD_OFFSET(::proto::init, _impl_.tick_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::move, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::move, commands_),
- PROTOBUF_FIELD_OFFSET(::proto::move, viewangles_),
+ PROTOBUF_FIELD_OFFSET(::proto::move, _impl_.commands_),
+ PROTOBUF_FIELD_OFFSET(::proto::move, _impl_.viewangles_),
+ PROTOBUF_FIELD_OFFSET(::proto::move, _impl_.active_item_),
+ PROTOBUF_FIELD_OFFSET(::proto::move, _impl_.sequence_),
~0u, // no _has_bits_
- PROTOBUF_FIELD_OFFSET(::proto::remove_player, _internal_metadata_),
+ PROTOBUF_FIELD_OFFSET(::proto::remove_entity, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::remove_player, index_),
+ PROTOBUF_FIELD_OFFSET(::proto::remove_entity, _impl_.index_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::say, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::say, text_),
+ PROTOBUF_FIELD_OFFSET(::proto::say, _impl_.text_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::hear_player, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::hear_player, index_),
- PROTOBUF_FIELD_OFFSET(::proto::hear_player, text_),
+ PROTOBUF_FIELD_OFFSET(::proto::hear_player, _impl_.index_),
+ PROTOBUF_FIELD_OFFSET(::proto::hear_player, _impl_.text_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::request_chunk, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::request_chunk, chunk_pos_),
+ PROTOBUF_FIELD_OFFSET(::proto::request_chunk, _impl_.chunk_pos_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::remove_chunk, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::remove_chunk, chunk_pos_),
+ PROTOBUF_FIELD_OFFSET(::proto::remove_chunk, _impl_.chunk_pos_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::chunk, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::chunk, chunk_pos_),
- PROTOBUF_FIELD_OFFSET(::proto::chunk, blocks_),
+ PROTOBUF_FIELD_OFFSET(::proto::chunk, _impl_.chunk_pos_),
+ PROTOBUF_FIELD_OFFSET(::proto::chunk, _impl_.blocks_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::add_block, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::add_block, chunk_pos_),
- PROTOBUF_FIELD_OFFSET(::proto::add_block, block_pos_),
- PROTOBUF_FIELD_OFFSET(::proto::add_block, block_),
+ PROTOBUF_FIELD_OFFSET(::proto::add_block, _impl_.chunk_pos_),
+ PROTOBUF_FIELD_OFFSET(::proto::add_block, _impl_.block_pos_),
+ PROTOBUF_FIELD_OFFSET(::proto::add_block, _impl_.active_item_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::remove_block, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::remove_block, chunk_pos_),
- PROTOBUF_FIELD_OFFSET(::proto::remove_block, block_pos_),
+ PROTOBUF_FIELD_OFFSET(::proto::remove_block, _impl_.chunk_pos_),
+ PROTOBUF_FIELD_OFFSET(::proto::remove_block, _impl_.block_pos_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::server_message, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- PROTOBUF_FIELD_OFFSET(::proto::server_message, message_),
- PROTOBUF_FIELD_OFFSET(::proto::server_message, fatal_),
+ PROTOBUF_FIELD_OFFSET(::proto::server_message, _impl_.message_),
+ PROTOBUF_FIELD_OFFSET(::proto::server_message, _impl_.fatal_),
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::proto::item_swap, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ ~0u, // no _inlined_string_donated_
+ PROTOBUF_FIELD_OFFSET(::proto::item_swap, _impl_.index_a_),
+ PROTOBUF_FIELD_OFFSET(::proto::item_swap, _impl_.index_b_),
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::proto::item_use, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ ~0u, // no _inlined_string_donated_
+ PROTOBUF_FIELD_OFFSET(::proto::item_use, _impl_.index_),
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::proto::item_update, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ ~0u, // no _inlined_string_donated_
+ PROTOBUF_FIELD_OFFSET(::proto::item_update, _impl_.items_),
+ PROTOBUF_FIELD_OFFSET(::proto::animate_update, _impl_._has_bits_),
+ PROTOBUF_FIELD_OFFSET(::proto::animate_update, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ ~0u, // no _inlined_string_donated_
+ PROTOBUF_FIELD_OFFSET(::proto::animate_update, _impl_.animate_),
+ PROTOBUF_FIELD_OFFSET(::proto::animate_update, _impl_.tick_),
+ PROTOBUF_FIELD_OFFSET(::proto::animate_update, _impl_.sequence_),
+ ~0u,
+ ~0u,
+ 0,
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::proto::packet, _internal_metadata_),
~0u, // no _extensions_
- PROTOBUF_FIELD_OFFSET(::proto::packet, _oneof_case_[0]),
+ PROTOBUF_FIELD_OFFSET(::proto::packet, _impl_._oneof_case_[0]),
~0u, // no _weak_field_map_
~0u, // no _inlined_string_donated_
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag,
- PROTOBUF_FIELD_OFFSET(::proto::packet, contents_),
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ ::_pbi::kInvalidFieldOffsetTag,
+ PROTOBUF_FIELD_OFFSET(::proto::packet, _impl_.contents_),
};
-static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{ 0, -1, -1, sizeof(::proto::angles)},
{ 8, -1, -1, sizeof(::proto::coords)},
{ 16, -1, -1, sizeof(::proto::vec3)},
{ 25, -1, -1, sizeof(::proto::ivec3)},
- { 34, -1, -1, sizeof(::proto::player)},
- { 46, -1, -1, sizeof(::proto::auth)},
- { 54, -1, -1, sizeof(::proto::init)},
- { 63, -1, -1, sizeof(::proto::move)},
- { 71, -1, -1, sizeof(::proto::remove_player)},
- { 78, -1, -1, sizeof(::proto::say)},
- { 85, -1, -1, sizeof(::proto::hear_player)},
- { 93, -1, -1, sizeof(::proto::request_chunk)},
- { 100, -1, -1, sizeof(::proto::remove_chunk)},
- { 107, -1, -1, sizeof(::proto::chunk)},
- { 115, -1, -1, sizeof(::proto::add_block)},
- { 124, -1, -1, sizeof(::proto::remove_block)},
- { 132, -1, -1, sizeof(::proto::server_message)},
- { 140, -1, -1, sizeof(::proto::packet)},
+ { 34, -1, -1, sizeof(::proto::entity)},
+ { 43, -1, -1, sizeof(::proto::animate)},
+ { 54, -1, -1, sizeof(::proto::item)},
+ { 63, -1, -1, sizeof(::proto::item_array)},
+ { 70, -1, -1, sizeof(::proto::player)},
+ { 78, -1, -1, sizeof(::proto::auth)},
+ { 86, -1, -1, sizeof(::proto::init)},
+ { 97, -1, -1, sizeof(::proto::move)},
+ { 107, -1, -1, sizeof(::proto::remove_entity)},
+ { 114, -1, -1, sizeof(::proto::say)},
+ { 121, -1, -1, sizeof(::proto::hear_player)},
+ { 129, -1, -1, sizeof(::proto::request_chunk)},
+ { 136, -1, -1, sizeof(::proto::remove_chunk)},
+ { 143, -1, -1, sizeof(::proto::chunk)},
+ { 151, -1, -1, sizeof(::proto::add_block)},
+ { 160, -1, -1, sizeof(::proto::remove_block)},
+ { 168, -1, -1, sizeof(::proto::server_message)},
+ { 176, -1, -1, sizeof(::proto::item_swap)},
+ { 184, -1, -1, sizeof(::proto::item_use)},
+ { 191, -1, -1, sizeof(::proto::item_update)},
+ { 198, 207, -1, sizeof(::proto::animate_update)},
+ { 210, -1, -1, sizeof(::proto::packet)},
};
-static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_angles_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_coords_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_vec3_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_ivec3_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_player_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_auth_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_init_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_move_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_remove_player_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_say_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_hear_player_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_request_chunk_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_remove_chunk_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_chunk_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_add_block_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_remove_block_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_server_message_default_instance_),
- reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::proto::_packet_default_instance_),
+static const ::_pb::Message* const file_default_instances[] = {
+ &::proto::_angles_default_instance_._instance,
+ &::proto::_coords_default_instance_._instance,
+ &::proto::_vec3_default_instance_._instance,
+ &::proto::_ivec3_default_instance_._instance,
+ &::proto::_entity_default_instance_._instance,
+ &::proto::_animate_default_instance_._instance,
+ &::proto::_item_default_instance_._instance,
+ &::proto::_item_array_default_instance_._instance,
+ &::proto::_player_default_instance_._instance,
+ &::proto::_auth_default_instance_._instance,
+ &::proto::_init_default_instance_._instance,
+ &::proto::_move_default_instance_._instance,
+ &::proto::_remove_entity_default_instance_._instance,
+ &::proto::_say_default_instance_._instance,
+ &::proto::_hear_player_default_instance_._instance,
+ &::proto::_request_chunk_default_instance_._instance,
+ &::proto::_remove_chunk_default_instance_._instance,
+ &::proto::_chunk_default_instance_._instance,
+ &::proto::_add_block_default_instance_._instance,
+ &::proto::_remove_block_default_instance_._instance,
+ &::proto::_server_message_default_instance_._instance,
+ &::proto::_item_swap_default_instance_._instance,
+ &::proto::_item_use_default_instance_._instance,
+ &::proto::_item_update_default_instance_._instance,
+ &::proto::_animate_update_default_instance_._instance,
+ &::proto::_packet_default_instance_._instance,
};
const char descriptor_table_protodef_net_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
@@ -469,57 +697,77 @@ const char descriptor_table_protodef_net_2eproto[] PROTOBUF_SECTION_VARIABLE(pro
"\001(\002\022\013\n\003yaw\030\002 \001(\002\"\036\n\006coords\022\t\n\001x\030\001 \001(\005\022\t\n"
"\001z\030\002 \001(\005\"\'\n\004vec3\022\t\n\001x\030\001 \001(\002\022\t\n\001y\030\002 \001(\002\022\t"
"\n\001z\030\003 \001(\002\"(\n\005ivec3\022\t\n\001x\030\001 \001(\005\022\t\n\001y\030\002 \001(\005"
- "\022\t\n\001z\030\003 \001(\005\"\255\001\n\006player\022\r\n\005index\030\001 \001(\r\022\020\n"
- "\010commands\030\002 \001(\r\022 \n\tchunk_pos\030\003 \001(\0132\r.pro"
- "to.coords\022\036\n\tlocal_pos\030\004 \001(\0132\013.proto.vec"
- "3\022!\n\nviewangles\030\005 \001(\0132\r.proto.angles\022\035\n\010"
- "velocity\030\006 \001(\0132\013.proto.vec3\"*\n\004auth\022\020\n\010u"
- "sername\030\001 \001(\t\022\020\n\010password\030\002 \001(\t\"O\n\004init\022"
- "\014\n\004seed\030\001 \001(\004\022\025\n\rdraw_distance\030\002 \001(\005\022\"\n\013"
- "localplayer\030\003 \001(\0132\r.proto.player\";\n\004move"
- "\022\020\n\010commands\030\001 \001(\r\022!\n\nviewangles\030\002 \001(\0132\r"
- ".proto.angles\"\036\n\rremove_player\022\r\n\005index\030"
- "\001 \001(\r\"\023\n\003say\022\014\n\004text\030\001 \001(\t\"*\n\013hear_playe"
- "r\022\r\n\005index\030\001 \001(\r\022\014\n\004text\030\002 \001(\t\"1\n\rreques"
- "t_chunk\022 \n\tchunk_pos\030\001 \001(\0132\r.proto.coord"
- "s\"0\n\014remove_chunk\022 \n\tchunk_pos\030\001 \001(\0132\r.p"
- "roto.coords\"=\n\005chunk\022 \n\tchunk_pos\030\001 \001(\0132"
- "\r.proto.coords\022\022\n\006blocks\030\002 \003(\rB\002\020\001\"]\n\tad"
- "d_block\022 \n\tchunk_pos\030\001 \001(\0132\r.proto.coord"
- "s\022\037\n\tblock_pos\030\002 \001(\0132\014.proto.ivec3\022\r\n\005bl"
- "ock\030\003 \001(\r\"Q\n\014remove_block\022 \n\tchunk_pos\030\001"
- " \001(\0132\r.proto.coords\022\037\n\tblock_pos\030\002 \001(\0132\014"
- ".proto.ivec3\"0\n\016server_message\022\017\n\007messag"
- "e\030\001 \001(\t\022\r\n\005fatal\030\002 \001(\010\"\334\004\n\006packet\022\"\n\013aut"
- "h_packet\030\001 \001(\0132\013.proto.authH\000\022\"\n\013init_pa"
- "cket\030\002 \001(\0132\013.proto.initH\000\022\"\n\013move_packet"
- "\030\003 \001(\0132\013.proto.moveH\000\022&\n\rplayer_packet\030\004"
- " \001(\0132\r.proto.playerH\000\0224\n\024remove_player_p"
- "acket\030\005 \001(\0132\024.proto.remove_playerH\000\022 \n\ns"
- "ay_packet\030\006 \001(\0132\n.proto.sayH\000\0220\n\022hear_pl"
- "ayer_packet\030\007 \001(\0132\022.proto.hear_playerH\000\022"
- "4\n\024request_chunk_packet\030\010 \001(\0132\024.proto.re"
- "quest_chunkH\000\022$\n\014chunk_packet\030\t \001(\0132\014.pr"
- "oto.chunkH\000\0222\n\023remove_chunk_packet\030\n \001(\013"
- "2\023.proto.remove_chunkH\000\022,\n\020add_block_pac"
- "ket\030\013 \001(\0132\020.proto.add_blockH\000\0222\n\023remove_"
- "block_packet\030\014 \001(\0132\023.proto.remove_blockH"
- "\000\0226\n\025server_message_packet\030\r \001(\0132\025.proto"
- ".server_messageH\000B\n\n\010contentsb\006proto3"
+ "\022\t\n\001z\030\003 \001(\005\"Y\n\006entity\022\r\n\005index\030\001 \001(\r\022 \n\t"
+ "chunk_pos\030\002 \001(\0132\r.proto.coords\022\036\n\tlocal_"
+ "pos\030\003 \001(\0132\013.proto.vec3\"\221\001\n\007animate\022\035\n\006en"
+ "tity\030\001 \001(\0132\r.proto.entity\022\020\n\010commands\030\002 "
+ "\001(\r\022!\n\nviewangles\030\003 \001(\0132\r.proto.angles\022\035"
+ "\n\010velocity\030\004 \001(\0132\013.proto.vec3\022\023\n\013active_"
+ "item\030\005 \001(\r\"5\n\004item\022\r\n\005index\030\001 \001(\r\022\014\n\004typ"
+ "e\030\002 \001(\r\022\020\n\010quantity\030\003 \001(\r\"(\n\nitem_array\022"
+ "\032\n\005items\030\001 \003(\0132\013.proto.item\"O\n\006player\022\037\n"
+ "\007animate\030\001 \001(\0132\016.proto.animate\022$\n\tinvent"
+ "ory\030\002 \001(\0132\021.proto.item_array\"*\n\004auth\022\020\n\010"
+ "username\030\001 \001(\t\022\020\n\010password\030\002 \001(\t\"o\n\004init"
+ "\022\014\n\004seed\030\001 \001(\004\022\025\n\rdraw_distance\030\002 \001(\005\022\"\n"
+ "\013localplayer\030\003 \001(\0132\r.proto.player\022\020\n\010tic"
+ "krate\030\004 \001(\r\022\014\n\004tick\030\005 \001(\r\"b\n\004move\022\020\n\010com"
+ "mands\030\001 \001(\r\022!\n\nviewangles\030\002 \001(\0132\r.proto."
+ "angles\022\023\n\013active_item\030\003 \001(\r\022\020\n\010sequence\030"
+ "\004 \001(\r\"\036\n\rremove_entity\022\r\n\005index\030\001 \001(\r\"\023\n"
+ "\003say\022\014\n\004text\030\001 \001(\t\"*\n\013hear_player\022\r\n\005ind"
+ "ex\030\001 \001(\r\022\014\n\004text\030\002 \001(\t\"1\n\rrequest_chunk\022"
+ " \n\tchunk_pos\030\001 \001(\0132\r.proto.coords\"0\n\014rem"
+ "ove_chunk\022 \n\tchunk_pos\030\001 \001(\0132\r.proto.coo"
+ "rds\"=\n\005chunk\022 \n\tchunk_pos\030\001 \001(\0132\r.proto."
+ "coords\022\022\n\006blocks\030\002 \003(\rB\002\020\001\"c\n\tadd_block\022"
+ " \n\tchunk_pos\030\001 \001(\0132\r.proto.coords\022\037\n\tblo"
+ "ck_pos\030\002 \001(\0132\014.proto.ivec3\022\023\n\013active_ite"
+ "m\030\003 \001(\r\"Q\n\014remove_block\022 \n\tchunk_pos\030\001 \001"
+ "(\0132\r.proto.coords\022\037\n\tblock_pos\030\002 \001(\0132\014.p"
+ "roto.ivec3\"0\n\016server_message\022\017\n\007message\030"
+ "\001 \001(\t\022\r\n\005fatal\030\002 \001(\010\"-\n\titem_swap\022\017\n\007ind"
+ "ex_a\030\001 \001(\r\022\017\n\007index_b\030\002 \001(\r\"\031\n\010item_use\022"
+ "\r\n\005index\030\001 \001(\r\")\n\013item_update\022\032\n\005items\030\001"
+ " \003(\0132\013.proto.item\"c\n\016animate_update\022\037\n\007a"
+ "nimate\030\001 \001(\0132\016.proto.animate\022\014\n\004tick\030\002 \001"
+ "(\r\022\025\n\010sequence\030\003 \001(\rH\000\210\001\001B\013\n\t_sequence\"\370"
+ "\005\n\006packet\022\"\n\013auth_packet\030\001 \001(\0132\013.proto.a"
+ "uthH\000\022\"\n\013init_packet\030\002 \001(\0132\013.proto.initH"
+ "\000\022\"\n\013move_packet\030\003 \001(\0132\013.proto.moveH\000\0226\n"
+ "\025animate_update_packet\030\004 \001(\0132\025.proto.ani"
+ "mate_updateH\000\0224\n\024remove_entity_packet\030\005 "
+ "\001(\0132\024.proto.remove_entityH\000\022 \n\nsay_packe"
+ "t\030\006 \001(\0132\n.proto.sayH\000\0220\n\022hear_player_pac"
+ "ket\030\007 \001(\0132\022.proto.hear_playerH\000\0224\n\024reque"
+ "st_chunk_packet\030\010 \001(\0132\024.proto.request_ch"
+ "unkH\000\022$\n\014chunk_packet\030\t \001(\0132\014.proto.chun"
+ "kH\000\0222\n\023remove_chunk_packet\030\n \001(\0132\023.proto"
+ ".remove_chunkH\000\022,\n\020add_block_packet\030\013 \001("
+ "\0132\020.proto.add_blockH\000\0222\n\023remove_block_pa"
+ "cket\030\014 \001(\0132\023.proto.remove_blockH\000\0226\n\025ser"
+ "ver_message_packet\030\r \001(\0132\025.proto.server_"
+ "messageH\000\022,\n\020item_swap_packet\030\016 \001(\0132\020.pr"
+ "oto.item_swapH\000\022*\n\017item_use_packet\030\020 \001(\013"
+ "2\017.proto.item_useH\000\0220\n\022item_update_packe"
+ "t\030\017 \001(\0132\022.proto.item_updateH\000B\n\n\010content"
+ "sb\006proto3"
;
-static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_net_2eproto_once;
-const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_net_2eproto = {
- false, false, 1637, descriptor_table_protodef_net_2eproto, "net.proto",
- &descriptor_table_net_2eproto_once, nullptr, 0, 18,
- schemas, file_default_instances, TableStruct_net_2eproto::offsets,
- file_level_metadata_net_2eproto, file_level_enum_descriptors_net_2eproto, file_level_service_descriptors_net_2eproto,
+static ::_pbi::once_flag descriptor_table_net_2eproto_once;
+const ::_pbi::DescriptorTable descriptor_table_net_2eproto = {
+ false, false, 2329, descriptor_table_protodef_net_2eproto,
+ "net.proto",
+ &descriptor_table_net_2eproto_once, nullptr, 0, 26,
+ schemas, file_default_instances, TableStruct_net_2eproto::offsets,
+ file_level_metadata_net_2eproto, file_level_enum_descriptors_net_2eproto,
+ file_level_service_descriptors_net_2eproto,
};
-PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_net_2eproto_getter() {
+PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_net_2eproto_getter() {
return &descriptor_table_net_2eproto;
}
// Force running AddDescriptors() at dynamic initialization time.
-PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_net_2eproto(&descriptor_table_net_2eproto);
+PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_net_2eproto(&descriptor_table_net_2eproto);
namespace proto {
// ===================================================================
@@ -531,47 +779,50 @@ class angles::_Internal {
angles::angles(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.angles)
}
angles::angles(const angles& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ angles* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.pitch_){}
+ , decltype(_impl_.yaw_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- ::memcpy(&pitch_, &from.pitch_,
- static_cast<size_t>(reinterpret_cast<char*>(&yaw_) -
- reinterpret_cast<char*>(&pitch_)) + sizeof(yaw_));
+ ::memcpy(&_impl_.pitch_, &from._impl_.pitch_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.yaw_) -
+ reinterpret_cast<char*>(&_impl_.pitch_)) + sizeof(_impl_.yaw_));
// @@protoc_insertion_point(copy_constructor:proto.angles)
}
-inline void angles::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&pitch_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&yaw_) -
- reinterpret_cast<char*>(&pitch_)) + sizeof(yaw_));
+inline void angles::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.pitch_){0}
+ , decltype(_impl_.yaw_){0}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
angles::~angles() {
// @@protoc_insertion_point(destructor:proto.angles)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void angles::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
-void angles::ArenaDtor(void* object) {
- angles* _this = reinterpret_cast< angles* >(object);
- (void)_this;
-}
-void angles::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void angles::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void angles::Clear() {
@@ -580,22 +831,22 @@ void angles::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- ::memset(&pitch_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&yaw_) -
- reinterpret_cast<char*>(&pitch_)) + sizeof(yaw_));
+ ::memset(&_impl_.pitch_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.yaw_) -
+ reinterpret_cast<char*>(&_impl_.pitch_)) + sizeof(_impl_.yaw_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* angles::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* angles::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// float pitch = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 13)) {
- pitch_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
+ _impl_.pitch_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else
goto handle_unusual;
@@ -603,7 +854,7 @@ const char* angles::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
// float yaw = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 21)) {
- yaw_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
+ _impl_.yaw_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else
goto handle_unusual;
@@ -644,7 +895,7 @@ uint8_t* angles::_InternalSerialize(
memcpy(&raw_pitch, &tmp_pitch, sizeof(tmp_pitch));
if (raw_pitch != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_pitch(), target);
+ target = ::_pbi::WireFormatLite::WriteFloatToArray(1, this->_internal_pitch(), target);
}
// float yaw = 2;
@@ -654,11 +905,11 @@ uint8_t* angles::_InternalSerialize(
memcpy(&raw_yaw, &tmp_yaw, sizeof(tmp_yaw));
if (raw_yaw != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(2, this->_internal_yaw(), target);
+ target = ::_pbi::WireFormatLite::WriteFloatToArray(2, this->_internal_yaw(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.angles)
@@ -691,25 +942,21 @@ size_t angles::ByteSizeLong() const {
total_size += 1 + 4;
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData angles::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
angles::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*angles::GetClassData() const { return &_class_data_; }
-void angles::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<angles *>(to)->MergeFrom(
- static_cast<const angles &>(from));
-}
-
-void angles::MergeFrom(const angles& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.angles)
- GOOGLE_DCHECK_NE(&from, this);
+void angles::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<angles*>(&to_msg);
+ auto& from = static_cast<const angles&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.angles)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
@@ -718,16 +965,16 @@ void angles::MergeFrom(const angles& from) {
uint32_t raw_pitch;
memcpy(&raw_pitch, &tmp_pitch, sizeof(tmp_pitch));
if (raw_pitch != 0) {
- _internal_set_pitch(from._internal_pitch());
+ _this->_internal_set_pitch(from._internal_pitch());
}
static_assert(sizeof(uint32_t) == sizeof(float), "Code assumes uint32_t and float are the same size.");
float tmp_yaw = from._internal_yaw();
uint32_t raw_yaw;
memcpy(&raw_yaw, &tmp_yaw, sizeof(tmp_yaw));
if (raw_yaw != 0) {
- _internal_set_yaw(from._internal_yaw());
+ _this->_internal_set_yaw(from._internal_yaw());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void angles::CopyFrom(const angles& from) {
@@ -745,15 +992,15 @@ void angles::InternalSwap(angles* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(angles, yaw_)
- + sizeof(angles::yaw_)
- - PROTOBUF_FIELD_OFFSET(angles, pitch_)>(
- reinterpret_cast<char*>(&pitch_),
- reinterpret_cast<char*>(&other->pitch_));
+ PROTOBUF_FIELD_OFFSET(angles, _impl_.yaw_)
+ + sizeof(angles::_impl_.yaw_)
+ - PROTOBUF_FIELD_OFFSET(angles, _impl_.pitch_)>(
+ reinterpret_cast<char*>(&_impl_.pitch_),
+ reinterpret_cast<char*>(&other->_impl_.pitch_));
}
::PROTOBUF_NAMESPACE_ID::Metadata angles::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
file_level_metadata_net_2eproto[0]);
}
@@ -767,47 +1014,50 @@ class coords::_Internal {
coords::coords(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.coords)
}
coords::coords(const coords& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ coords* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.x_){}
+ , decltype(_impl_.z_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- ::memcpy(&x_, &from.x_,
- static_cast<size_t>(reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+ ::memcpy(&_impl_.x_, &from._impl_.x_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.z_) -
+ reinterpret_cast<char*>(&_impl_.x_)) + sizeof(_impl_.z_));
// @@protoc_insertion_point(copy_constructor:proto.coords)
}
-inline void coords::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&x_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+inline void coords::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.x_){0}
+ , decltype(_impl_.z_){0}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
coords::~coords() {
// @@protoc_insertion_point(destructor:proto.coords)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void coords::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
-void coords::ArenaDtor(void* object) {
- coords* _this = reinterpret_cast< coords* >(object);
- (void)_this;
-}
-void coords::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void coords::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void coords::Clear() {
@@ -816,22 +1066,22 @@ void coords::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- ::memset(&x_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+ ::memset(&_impl_.x_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.z_) -
+ reinterpret_cast<char*>(&_impl_.x_)) + sizeof(_impl_.z_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* coords::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* coords::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// int32 x = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
- x_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.x_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -839,7 +1089,7 @@ const char* coords::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
// int32 z = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
- z_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.z_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -876,17 +1126,17 @@ uint8_t* coords::_InternalSerialize(
// int32 x = 1;
if (this->_internal_x() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_x(), target);
+ target = ::_pbi::WireFormatLite::WriteInt32ToArray(1, this->_internal_x(), target);
}
// int32 z = 2;
if (this->_internal_z() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_z(), target);
+ target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_z(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.coords)
@@ -903,43 +1153,39 @@ size_t coords::ByteSizeLong() const {
// int32 x = 1;
if (this->_internal_x() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_x());
+ total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_x());
}
// int32 z = 2;
if (this->_internal_z() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_z());
+ total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_z());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData coords::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
coords::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*coords::GetClassData() const { return &_class_data_; }
-void coords::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<coords *>(to)->MergeFrom(
- static_cast<const coords &>(from));
-}
-
-void coords::MergeFrom(const coords& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.coords)
- GOOGLE_DCHECK_NE(&from, this);
+void coords::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<coords*>(&to_msg);
+ auto& from = static_cast<const coords&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.coords)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_x() != 0) {
- _internal_set_x(from._internal_x());
+ _this->_internal_set_x(from._internal_x());
}
if (from._internal_z() != 0) {
- _internal_set_z(from._internal_z());
+ _this->_internal_set_z(from._internal_z());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void coords::CopyFrom(const coords& from) {
@@ -957,15 +1203,15 @@ void coords::InternalSwap(coords* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(coords, z_)
- + sizeof(coords::z_)
- - PROTOBUF_FIELD_OFFSET(coords, x_)>(
- reinterpret_cast<char*>(&x_),
- reinterpret_cast<char*>(&other->x_));
+ PROTOBUF_FIELD_OFFSET(coords, _impl_.z_)
+ + sizeof(coords::_impl_.z_)
+ - PROTOBUF_FIELD_OFFSET(coords, _impl_.x_)>(
+ reinterpret_cast<char*>(&_impl_.x_),
+ reinterpret_cast<char*>(&other->_impl_.x_));
}
::PROTOBUF_NAMESPACE_ID::Metadata coords::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
file_level_metadata_net_2eproto[1]);
}
@@ -979,47 +1225,52 @@ class vec3::_Internal {
vec3::vec3(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.vec3)
}
vec3::vec3(const vec3& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ vec3* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.x_){}
+ , decltype(_impl_.y_){}
+ , decltype(_impl_.z_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- ::memcpy(&x_, &from.x_,
- static_cast<size_t>(reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+ ::memcpy(&_impl_.x_, &from._impl_.x_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.z_) -
+ reinterpret_cast<char*>(&_impl_.x_)) + sizeof(_impl_.z_));
// @@protoc_insertion_point(copy_constructor:proto.vec3)
}
-inline void vec3::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&x_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+inline void vec3::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.x_){0}
+ , decltype(_impl_.y_){0}
+ , decltype(_impl_.z_){0}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
vec3::~vec3() {
// @@protoc_insertion_point(destructor:proto.vec3)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void vec3::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
-void vec3::ArenaDtor(void* object) {
- vec3* _this = reinterpret_cast< vec3* >(object);
- (void)_this;
-}
-void vec3::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void vec3::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void vec3::Clear() {
@@ -1028,22 +1279,22 @@ void vec3::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- ::memset(&x_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+ ::memset(&_impl_.x_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.z_) -
+ reinterpret_cast<char*>(&_impl_.x_)) + sizeof(_impl_.z_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* vec3::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* vec3::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// float x = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 13)) {
- x_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
+ _impl_.x_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else
goto handle_unusual;
@@ -1051,7 +1302,7 @@ const char* vec3::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
// float y = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 21)) {
- y_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
+ _impl_.y_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else
goto handle_unusual;
@@ -1059,7 +1310,7 @@ const char* vec3::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
// float z = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 29)) {
- z_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
+ _impl_.z_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else
goto handle_unusual;
@@ -1100,7 +1351,7 @@ uint8_t* vec3::_InternalSerialize(
memcpy(&raw_x, &tmp_x, sizeof(tmp_x));
if (raw_x != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_x(), target);
+ target = ::_pbi::WireFormatLite::WriteFloatToArray(1, this->_internal_x(), target);
}
// float y = 2;
@@ -1110,7 +1361,7 @@ uint8_t* vec3::_InternalSerialize(
memcpy(&raw_y, &tmp_y, sizeof(tmp_y));
if (raw_y != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(2, this->_internal_y(), target);
+ target = ::_pbi::WireFormatLite::WriteFloatToArray(2, this->_internal_y(), target);
}
// float z = 3;
@@ -1120,11 +1371,11 @@ uint8_t* vec3::_InternalSerialize(
memcpy(&raw_z, &tmp_z, sizeof(tmp_z));
if (raw_z != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(3, this->_internal_z(), target);
+ target = ::_pbi::WireFormatLite::WriteFloatToArray(3, this->_internal_z(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.vec3)
@@ -1166,25 +1417,21 @@ size_t vec3::ByteSizeLong() const {
total_size += 1 + 4;
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData vec3::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
vec3::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*vec3::GetClassData() const { return &_class_data_; }
-void vec3::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<vec3 *>(to)->MergeFrom(
- static_cast<const vec3 &>(from));
-}
-
-void vec3::MergeFrom(const vec3& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.vec3)
- GOOGLE_DCHECK_NE(&from, this);
+void vec3::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<vec3*>(&to_msg);
+ auto& from = static_cast<const vec3&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.vec3)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
@@ -1193,23 +1440,23 @@ void vec3::MergeFrom(const vec3& from) {
uint32_t raw_x;
memcpy(&raw_x, &tmp_x, sizeof(tmp_x));
if (raw_x != 0) {
- _internal_set_x(from._internal_x());
+ _this->_internal_set_x(from._internal_x());
}
static_assert(sizeof(uint32_t) == sizeof(float), "Code assumes uint32_t and float are the same size.");
float tmp_y = from._internal_y();
uint32_t raw_y;
memcpy(&raw_y, &tmp_y, sizeof(tmp_y));
if (raw_y != 0) {
- _internal_set_y(from._internal_y());
+ _this->_internal_set_y(from._internal_y());
}
static_assert(sizeof(uint32_t) == sizeof(float), "Code assumes uint32_t and float are the same size.");
float tmp_z = from._internal_z();
uint32_t raw_z;
memcpy(&raw_z, &tmp_z, sizeof(tmp_z));
if (raw_z != 0) {
- _internal_set_z(from._internal_z());
+ _this->_internal_set_z(from._internal_z());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void vec3::CopyFrom(const vec3& from) {
@@ -1227,15 +1474,15 @@ void vec3::InternalSwap(vec3* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(vec3, z_)
- + sizeof(vec3::z_)
- - PROTOBUF_FIELD_OFFSET(vec3, x_)>(
- reinterpret_cast<char*>(&x_),
- reinterpret_cast<char*>(&other->x_));
+ PROTOBUF_FIELD_OFFSET(vec3, _impl_.z_)
+ + sizeof(vec3::_impl_.z_)
+ - PROTOBUF_FIELD_OFFSET(vec3, _impl_.x_)>(
+ reinterpret_cast<char*>(&_impl_.x_),
+ reinterpret_cast<char*>(&other->_impl_.x_));
}
::PROTOBUF_NAMESPACE_ID::Metadata vec3::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
file_level_metadata_net_2eproto[2]);
}
@@ -1249,47 +1496,52 @@ class ivec3::_Internal {
ivec3::ivec3(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.ivec3)
}
ivec3::ivec3(const ivec3& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ ivec3* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.x_){}
+ , decltype(_impl_.y_){}
+ , decltype(_impl_.z_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- ::memcpy(&x_, &from.x_,
- static_cast<size_t>(reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+ ::memcpy(&_impl_.x_, &from._impl_.x_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.z_) -
+ reinterpret_cast<char*>(&_impl_.x_)) + sizeof(_impl_.z_));
// @@protoc_insertion_point(copy_constructor:proto.ivec3)
}
-inline void ivec3::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&x_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+inline void ivec3::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.x_){0}
+ , decltype(_impl_.y_){0}
+ , decltype(_impl_.z_){0}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
ivec3::~ivec3() {
// @@protoc_insertion_point(destructor:proto.ivec3)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void ivec3::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
-void ivec3::ArenaDtor(void* object) {
- ivec3* _this = reinterpret_cast< ivec3* >(object);
- (void)_this;
-}
-void ivec3::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void ivec3::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void ivec3::Clear() {
@@ -1298,22 +1550,22 @@ void ivec3::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- ::memset(&x_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&z_) -
- reinterpret_cast<char*>(&x_)) + sizeof(z_));
+ ::memset(&_impl_.x_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.z_) -
+ reinterpret_cast<char*>(&_impl_.x_)) + sizeof(_impl_.z_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* ivec3::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* ivec3::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// int32 x = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
- x_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.x_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -1321,7 +1573,7 @@ const char* ivec3::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
// int32 y = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
- y_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.y_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -1329,7 +1581,7 @@ const char* ivec3::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte
// int32 z = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
- z_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.z_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -1366,23 +1618,23 @@ uint8_t* ivec3::_InternalSerialize(
// int32 x = 1;
if (this->_internal_x() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_x(), target);
+ target = ::_pbi::WireFormatLite::WriteInt32ToArray(1, this->_internal_x(), target);
}
// int32 y = 2;
if (this->_internal_y() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_y(), target);
+ target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_y(), target);
}
// int32 z = 3;
if (this->_internal_z() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_z(), target);
+ target = ::_pbi::WireFormatLite::WriteInt32ToArray(3, this->_internal_z(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.ivec3)
@@ -1399,51 +1651,47 @@ size_t ivec3::ByteSizeLong() const {
// int32 x = 1;
if (this->_internal_x() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_x());
+ total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_x());
}
// int32 y = 2;
if (this->_internal_y() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_y());
+ total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_y());
}
// int32 z = 3;
if (this->_internal_z() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_z());
+ total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_z());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ivec3::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
ivec3::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ivec3::GetClassData() const { return &_class_data_; }
-void ivec3::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<ivec3 *>(to)->MergeFrom(
- static_cast<const ivec3 &>(from));
-}
-
-void ivec3::MergeFrom(const ivec3& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.ivec3)
- GOOGLE_DCHECK_NE(&from, this);
+void ivec3::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<ivec3*>(&to_msg);
+ auto& from = static_cast<const ivec3&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.ivec3)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_x() != 0) {
- _internal_set_x(from._internal_x());
+ _this->_internal_set_x(from._internal_x());
}
if (from._internal_y() != 0) {
- _internal_set_y(from._internal_y());
+ _this->_internal_set_y(from._internal_y());
}
if (from._internal_z() != 0) {
- _internal_set_z(from._internal_z());
+ _this->_internal_set_z(from._internal_z());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void ivec3::CopyFrom(const ivec3& from) {
@@ -1461,153 +1709,406 @@ void ivec3::InternalSwap(ivec3* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(ivec3, z_)
- + sizeof(ivec3::z_)
- - PROTOBUF_FIELD_OFFSET(ivec3, x_)>(
- reinterpret_cast<char*>(&x_),
- reinterpret_cast<char*>(&other->x_));
+ PROTOBUF_FIELD_OFFSET(ivec3, _impl_.z_)
+ + sizeof(ivec3::_impl_.z_)
+ - PROTOBUF_FIELD_OFFSET(ivec3, _impl_.x_)>(
+ reinterpret_cast<char*>(&_impl_.x_),
+ reinterpret_cast<char*>(&other->_impl_.x_));
}
::PROTOBUF_NAMESPACE_ID::Metadata ivec3::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
file_level_metadata_net_2eproto[3]);
}
// ===================================================================
-class player::_Internal {
+class entity::_Internal {
public:
- static const ::proto::coords& chunk_pos(const player* msg);
- static const ::proto::vec3& local_pos(const player* msg);
- static const ::proto::angles& viewangles(const player* msg);
- static const ::proto::vec3& velocity(const player* msg);
+ static const ::proto::coords& chunk_pos(const entity* msg);
+ static const ::proto::vec3& local_pos(const entity* msg);
};
const ::proto::coords&
-player::_Internal::chunk_pos(const player* msg) {
- return *msg->chunk_pos_;
+entity::_Internal::chunk_pos(const entity* msg) {
+ return *msg->_impl_.chunk_pos_;
}
const ::proto::vec3&
-player::_Internal::local_pos(const player* msg) {
- return *msg->local_pos_;
-}
-const ::proto::angles&
-player::_Internal::viewangles(const player* msg) {
- return *msg->viewangles_;
+entity::_Internal::local_pos(const entity* msg) {
+ return *msg->_impl_.local_pos_;
}
-const ::proto::vec3&
-player::_Internal::velocity(const player* msg) {
- return *msg->velocity_;
-}
-player::player(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+entity::entity(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
- // @@protoc_insertion_point(arena_constructor:proto.player)
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.entity)
}
-player::player(const player& from)
+entity::entity(const entity& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ entity* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , decltype(_impl_.local_pos_){nullptr}
+ , decltype(_impl_.index_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_chunk_pos()) {
- chunk_pos_ = new ::proto::coords(*from.chunk_pos_);
- } else {
- chunk_pos_ = nullptr;
+ _this->_impl_.chunk_pos_ = new ::proto::coords(*from._impl_.chunk_pos_);
}
if (from._internal_has_local_pos()) {
- local_pos_ = new ::proto::vec3(*from.local_pos_);
- } else {
- local_pos_ = nullptr;
- }
- if (from._internal_has_viewangles()) {
- viewangles_ = new ::proto::angles(*from.viewangles_);
- } else {
- viewangles_ = nullptr;
+ _this->_impl_.local_pos_ = new ::proto::vec3(*from._impl_.local_pos_);
}
- if (from._internal_has_velocity()) {
- velocity_ = new ::proto::vec3(*from.velocity_);
- } else {
- velocity_ = nullptr;
- }
- ::memcpy(&index_, &from.index_,
- static_cast<size_t>(reinterpret_cast<char*>(&commands_) -
- reinterpret_cast<char*>(&index_)) + sizeof(commands_));
- // @@protoc_insertion_point(copy_constructor:proto.player)
+ _this->_impl_.index_ = from._impl_.index_;
+ // @@protoc_insertion_point(copy_constructor:proto.entity)
}
-inline void player::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&chunk_pos_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&commands_) -
- reinterpret_cast<char*>(&chunk_pos_)) + sizeof(commands_));
+inline void entity::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , decltype(_impl_.local_pos_){nullptr}
+ , decltype(_impl_.index_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
-player::~player() {
- // @@protoc_insertion_point(destructor:proto.player)
- if (GetArenaForAllocation() != nullptr) return;
+entity::~entity() {
+ // @@protoc_insertion_point(destructor:proto.entity)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-inline void player::SharedDtor() {
+inline void entity::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- if (this != internal_default_instance()) delete chunk_pos_;
- if (this != internal_default_instance()) delete local_pos_;
- if (this != internal_default_instance()) delete viewangles_;
- if (this != internal_default_instance()) delete velocity_;
+ if (this != internal_default_instance()) delete _impl_.chunk_pos_;
+ if (this != internal_default_instance()) delete _impl_.local_pos_;
}
-void player::ArenaDtor(void* object) {
- player* _this = reinterpret_cast< player* >(object);
- (void)_this;
+void entity::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
}
-void player::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
+
+void entity::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.entity)
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
+ }
+ _impl_.chunk_pos_ = nullptr;
+ if (GetArenaForAllocation() == nullptr && _impl_.local_pos_ != nullptr) {
+ delete _impl_.local_pos_;
+ }
+ _impl_.local_pos_ = nullptr;
+ _impl_.index_ = 0u;
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-void player::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+
+const char* entity::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ uint32_t tag;
+ ptr = ::_pbi::ReadTag(ptr, &tag);
+ switch (tag >> 3) {
+ // uint32 index = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
+ _impl_.index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // .proto.coords chunk_pos = 2;
+ case 2:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
+ ptr = ctx->ParseMessage(_internal_mutable_chunk_pos(), ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // .proto.vec3 local_pos = 3;
+ case 3:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
+ ptr = ctx->ParseMessage(_internal_mutable_local_pos(), ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ default:
+ goto handle_unusual;
+ } // switch
+ handle_unusual:
+ if ((tag == 0) || ((tag & 7) == 4)) {
+ CHK_(ptr);
+ ctx->SetLastTag(tag);
+ goto message_done;
+ }
+ ptr = UnknownFieldParse(
+ tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ } // while
+message_done:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto message_done;
+#undef CHK_
}
-void player::Clear() {
-// @@protoc_insertion_point(message_clear_start:proto.player)
+uint8_t* entity::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:proto.entity)
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // uint32 index = 1;
+ if (this->_internal_index() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index(), target);
+ }
+
+ // .proto.coords chunk_pos = 2;
+ if (this->_internal_has_chunk_pos()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(2, _Internal::chunk_pos(this),
+ _Internal::chunk_pos(this).GetCachedSize(), target, stream);
+ }
+
+ // .proto.vec3 local_pos = 3;
+ if (this->_internal_has_local_pos()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(3, _Internal::local_pos(this),
+ _Internal::local_pos(this).GetCachedSize(), target, stream);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:proto.entity)
+ return target;
+}
+
+size_t entity::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.entity)
+ size_t total_size = 0;
+
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ // .proto.coords chunk_pos = 2;
+ if (this->_internal_has_chunk_pos()) {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
+ *_impl_.chunk_pos_);
}
- chunk_pos_ = nullptr;
- if (GetArenaForAllocation() == nullptr && local_pos_ != nullptr) {
- delete local_pos_;
+
+ // .proto.vec3 local_pos = 3;
+ if (this->_internal_has_local_pos()) {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
+ *_impl_.local_pos_);
}
- local_pos_ = nullptr;
- if (GetArenaForAllocation() == nullptr && viewangles_ != nullptr) {
- delete viewangles_;
+
+ // uint32 index = 1;
+ if (this->_internal_index() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_index());
}
- viewangles_ = nullptr;
- if (GetArenaForAllocation() == nullptr && velocity_ != nullptr) {
- delete velocity_;
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
+}
+
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData entity::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ entity::MergeImpl
+};
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*entity::GetClassData() const { return &_class_data_; }
+
+
+void entity::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<entity*>(&to_msg);
+ auto& from = static_cast<const entity&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.entity)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ if (from._internal_has_chunk_pos()) {
+ _this->_internal_mutable_chunk_pos()->::proto::coords::MergeFrom(
+ from._internal_chunk_pos());
+ }
+ if (from._internal_has_local_pos()) {
+ _this->_internal_mutable_local_pos()->::proto::vec3::MergeFrom(
+ from._internal_local_pos());
+ }
+ if (from._internal_index() != 0) {
+ _this->_internal_set_index(from._internal_index());
}
- velocity_ = nullptr;
- ::memset(&index_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&commands_) -
- reinterpret_cast<char*>(&index_)) + sizeof(commands_));
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+}
+
+void entity::CopyFrom(const entity& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.entity)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool entity::IsInitialized() const {
+ return true;
+}
+
+void entity::InternalSwap(entity* other) {
+ using std::swap;
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::memswap<
+ PROTOBUF_FIELD_OFFSET(entity, _impl_.index_)
+ + sizeof(entity::_impl_.index_)
+ - PROTOBUF_FIELD_OFFSET(entity, _impl_.chunk_pos_)>(
+ reinterpret_cast<char*>(&_impl_.chunk_pos_),
+ reinterpret_cast<char*>(&other->_impl_.chunk_pos_));
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata entity::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
+ &descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
+ file_level_metadata_net_2eproto[4]);
+}
+
+// ===================================================================
+
+class animate::_Internal {
+ public:
+ static const ::proto::entity& entity(const animate* msg);
+ static const ::proto::angles& viewangles(const animate* msg);
+ static const ::proto::vec3& velocity(const animate* msg);
+};
+
+const ::proto::entity&
+animate::_Internal::entity(const animate* msg) {
+ return *msg->_impl_.entity_;
+}
+const ::proto::angles&
+animate::_Internal::viewangles(const animate* msg) {
+ return *msg->_impl_.viewangles_;
+}
+const ::proto::vec3&
+animate::_Internal::velocity(const animate* msg) {
+ return *msg->_impl_.velocity_;
+}
+animate::animate(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.animate)
+}
+animate::animate(const animate& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ animate* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.entity_){nullptr}
+ , decltype(_impl_.viewangles_){nullptr}
+ , decltype(_impl_.velocity_){nullptr}
+ , decltype(_impl_.commands_){}
+ , decltype(_impl_.active_item_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ if (from._internal_has_entity()) {
+ _this->_impl_.entity_ = new ::proto::entity(*from._impl_.entity_);
+ }
+ if (from._internal_has_viewangles()) {
+ _this->_impl_.viewangles_ = new ::proto::angles(*from._impl_.viewangles_);
+ }
+ if (from._internal_has_velocity()) {
+ _this->_impl_.velocity_ = new ::proto::vec3(*from._impl_.velocity_);
+ }
+ ::memcpy(&_impl_.commands_, &from._impl_.commands_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.active_item_) -
+ reinterpret_cast<char*>(&_impl_.commands_)) + sizeof(_impl_.active_item_));
+ // @@protoc_insertion_point(copy_constructor:proto.animate)
+}
+
+inline void animate::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.entity_){nullptr}
+ , decltype(_impl_.viewangles_){nullptr}
+ , decltype(_impl_.velocity_){nullptr}
+ , decltype(_impl_.commands_){0u}
+ , decltype(_impl_.active_item_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+}
+
+animate::~animate() {
+ // @@protoc_insertion_point(destructor:proto.animate)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
+ SharedDtor();
+}
+
+inline void animate::SharedDtor() {
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
+ if (this != internal_default_instance()) delete _impl_.entity_;
+ if (this != internal_default_instance()) delete _impl_.viewangles_;
+ if (this != internal_default_instance()) delete _impl_.velocity_;
+}
+
+void animate::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
+}
+
+void animate::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.animate)
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ if (GetArenaForAllocation() == nullptr && _impl_.entity_ != nullptr) {
+ delete _impl_.entity_;
+ }
+ _impl_.entity_ = nullptr;
+ if (GetArenaForAllocation() == nullptr && _impl_.viewangles_ != nullptr) {
+ delete _impl_.viewangles_;
+ }
+ _impl_.viewangles_ = nullptr;
+ if (GetArenaForAllocation() == nullptr && _impl_.velocity_ != nullptr) {
+ delete _impl_.velocity_;
+ }
+ _impl_.velocity_ = nullptr;
+ ::memset(&_impl_.commands_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.active_item_) -
+ reinterpret_cast<char*>(&_impl_.commands_)) + sizeof(_impl_.active_item_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* player::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* animate::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
- // uint32 index = 1;
+ // .proto.entity entity = 1;
case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
- index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
+ ptr = ctx->ParseMessage(_internal_mutable_entity(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -1615,39 +2116,31 @@ const char* player::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
// uint32 commands = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
- commands_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.commands_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
- // .proto.coords chunk_pos = 3;
+ // .proto.angles viewangles = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
- ptr = ctx->ParseMessage(_internal_mutable_chunk_pos(), ptr);
+ ptr = ctx->ParseMessage(_internal_mutable_viewangles(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
- // .proto.vec3 local_pos = 4;
+ // .proto.vec3 velocity = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
- ptr = ctx->ParseMessage(_internal_mutable_local_pos(), ptr);
+ ptr = ctx->ParseMessage(_internal_mutable_velocity(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
- // .proto.angles viewangles = 5;
+ // uint32 active_item = 5;
case 5:
- if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
- ptr = ctx->ParseMessage(_internal_mutable_viewangles(), ptr);
- CHK_(ptr);
- } else
- goto handle_unusual;
- continue;
- // .proto.vec3 velocity = 6;
- case 6:
- if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
- ptr = ctx->ParseMessage(_internal_mutable_velocity(), ptr);
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
+ _impl_.active_item_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -1675,151 +2168,788 @@ failure:
#undef CHK_
}
-uint8_t* player::_InternalSerialize(
+uint8_t* animate::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
- // @@protoc_insertion_point(serialize_to_array_start:proto.player)
+ // @@protoc_insertion_point(serialize_to_array_start:proto.animate)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
- // uint32 index = 1;
- if (this->_internal_index() != 0) {
- target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index(), target);
+ // .proto.entity entity = 1;
+ if (this->_internal_has_entity()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(1, _Internal::entity(this),
+ _Internal::entity(this).GetCachedSize(), target, stream);
}
// uint32 commands = 2;
if (this->_internal_commands() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(2, this->_internal_commands(), target);
- }
-
- // .proto.coords chunk_pos = 3;
- if (this->_internal_has_chunk_pos()) {
- target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 3, _Internal::chunk_pos(this), target, stream);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_commands(), target);
}
- // .proto.vec3 local_pos = 4;
- if (this->_internal_has_local_pos()) {
- target = stream->EnsureSpace(target);
+ // .proto.angles viewangles = 3;
+ if (this->_internal_has_viewangles()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 4, _Internal::local_pos(this), target, stream);
+ InternalWriteMessage(3, _Internal::viewangles(this),
+ _Internal::viewangles(this).GetCachedSize(), target, stream);
}
- // .proto.angles viewangles = 5;
- if (this->_internal_has_viewangles()) {
- target = stream->EnsureSpace(target);
+ // .proto.vec3 velocity = 4;
+ if (this->_internal_has_velocity()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 5, _Internal::viewangles(this), target, stream);
+ InternalWriteMessage(4, _Internal::velocity(this),
+ _Internal::velocity(this).GetCachedSize(), target, stream);
}
- // .proto.vec3 velocity = 6;
- if (this->_internal_has_velocity()) {
+ // uint32 active_item = 5;
+ if (this->_internal_active_item() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 6, _Internal::velocity(this), target, stream);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(5, this->_internal_active_item(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
- // @@protoc_insertion_point(serialize_to_array_end:proto.player)
+ // @@protoc_insertion_point(serialize_to_array_end:proto.animate)
return target;
}
-size_t player::ByteSizeLong() const {
-// @@protoc_insertion_point(message_byte_size_start:proto.player)
+size_t animate::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.animate)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- // .proto.coords chunk_pos = 3;
- if (this->_internal_has_chunk_pos()) {
- total_size += 1 +
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *chunk_pos_);
- }
-
- // .proto.vec3 local_pos = 4;
- if (this->_internal_has_local_pos()) {
+ // .proto.entity entity = 1;
+ if (this->_internal_has_entity()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *local_pos_);
+ *_impl_.entity_);
}
- // .proto.angles viewangles = 5;
+ // .proto.angles viewangles = 3;
if (this->_internal_has_viewangles()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *viewangles_);
+ *_impl_.viewangles_);
}
- // .proto.vec3 velocity = 6;
+ // .proto.vec3 velocity = 4;
if (this->_internal_has_velocity()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *velocity_);
- }
-
- // uint32 index = 1;
- if (this->_internal_index() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_index());
+ *_impl_.velocity_);
}
// uint32 commands = 2;
if (this->_internal_commands() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_commands());
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_commands());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ // uint32 active_item = 5;
+ if (this->_internal_active_item() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_active_item());
+ }
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
-const ::PROTOBUF_NAMESPACE_ID::Message::ClassData player::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
- player::MergeImpl
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData animate::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ animate::MergeImpl
};
-const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*player::GetClassData() const { return &_class_data_; }
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*animate::GetClassData() const { return &_class_data_; }
+
+
+void animate::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<animate*>(&to_msg);
+ auto& from = static_cast<const animate&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.animate)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ if (from._internal_has_entity()) {
+ _this->_internal_mutable_entity()->::proto::entity::MergeFrom(
+ from._internal_entity());
+ }
+ if (from._internal_has_viewangles()) {
+ _this->_internal_mutable_viewangles()->::proto::angles::MergeFrom(
+ from._internal_viewangles());
+ }
+ if (from._internal_has_velocity()) {
+ _this->_internal_mutable_velocity()->::proto::vec3::MergeFrom(
+ from._internal_velocity());
+ }
+ if (from._internal_commands() != 0) {
+ _this->_internal_set_commands(from._internal_commands());
+ }
+ if (from._internal_active_item() != 0) {
+ _this->_internal_set_active_item(from._internal_active_item());
+ }
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+}
+
+void animate::CopyFrom(const animate& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.animate)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool animate::IsInitialized() const {
+ return true;
+}
+
+void animate::InternalSwap(animate* other) {
+ using std::swap;
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::memswap<
+ PROTOBUF_FIELD_OFFSET(animate, _impl_.active_item_)
+ + sizeof(animate::_impl_.active_item_)
+ - PROTOBUF_FIELD_OFFSET(animate, _impl_.entity_)>(
+ reinterpret_cast<char*>(&_impl_.entity_),
+ reinterpret_cast<char*>(&other->_impl_.entity_));
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata animate::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
+ &descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
+ file_level_metadata_net_2eproto[5]);
+}
+
+// ===================================================================
+
+class item::_Internal {
+ public:
+};
+
+item::item(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.item)
+}
+item::item(const item& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ item* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.index_){}
+ , decltype(_impl_.type_){}
+ , decltype(_impl_.quantity_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ ::memcpy(&_impl_.index_, &from._impl_.index_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.quantity_) -
+ reinterpret_cast<char*>(&_impl_.index_)) + sizeof(_impl_.quantity_));
+ // @@protoc_insertion_point(copy_constructor:proto.item)
+}
+
+inline void item::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.index_){0u}
+ , decltype(_impl_.type_){0u}
+ , decltype(_impl_.quantity_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+}
+
+item::~item() {
+ // @@protoc_insertion_point(destructor:proto.item)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
+ SharedDtor();
+}
-void player::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<player *>(to)->MergeFrom(
- static_cast<const player &>(from));
+inline void item::SharedDtor() {
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
+void item::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
+}
-void player::MergeFrom(const player& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.player)
- GOOGLE_DCHECK_NE(&from, this);
+void item::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.item)
uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- if (from._internal_has_chunk_pos()) {
- _internal_mutable_chunk_pos()->::proto::coords::MergeFrom(from._internal_chunk_pos());
+ ::memset(&_impl_.index_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.quantity_) -
+ reinterpret_cast<char*>(&_impl_.index_)) + sizeof(_impl_.quantity_));
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* item::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ uint32_t tag;
+ ptr = ::_pbi::ReadTag(ptr, &tag);
+ switch (tag >> 3) {
+ // uint32 index = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
+ _impl_.index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // uint32 type = 2;
+ case 2:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
+ _impl_.type_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // uint32 quantity = 3;
+ case 3:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
+ _impl_.quantity_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ default:
+ goto handle_unusual;
+ } // switch
+ handle_unusual:
+ if ((tag == 0) || ((tag & 7) == 4)) {
+ CHK_(ptr);
+ ctx->SetLastTag(tag);
+ goto message_done;
+ }
+ ptr = UnknownFieldParse(
+ tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ } // while
+message_done:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto message_done;
+#undef CHK_
+}
+
+uint8_t* item::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:proto.item)
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // uint32 index = 1;
+ if (this->_internal_index() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index(), target);
}
- if (from._internal_has_local_pos()) {
- _internal_mutable_local_pos()->::proto::vec3::MergeFrom(from._internal_local_pos());
+
+ // uint32 type = 2;
+ if (this->_internal_type() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_type(), target);
}
- if (from._internal_has_viewangles()) {
- _internal_mutable_viewangles()->::proto::angles::MergeFrom(from._internal_viewangles());
+
+ // uint32 quantity = 3;
+ if (this->_internal_quantity() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_quantity(), target);
}
- if (from._internal_has_velocity()) {
- _internal_mutable_velocity()->::proto::vec3::MergeFrom(from._internal_velocity());
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:proto.item)
+ return target;
+}
+
+size_t item::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.item)
+ size_t total_size = 0;
+
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // uint32 index = 1;
+ if (this->_internal_index() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_index());
+ }
+
+ // uint32 type = 2;
+ if (this->_internal_type() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_type());
+ }
+
+ // uint32 quantity = 3;
+ if (this->_internal_quantity() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_quantity());
}
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
+}
+
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData item::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ item::MergeImpl
+};
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*item::GetClassData() const { return &_class_data_; }
+
+
+void item::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<item*>(&to_msg);
+ auto& from = static_cast<const item&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.item)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
if (from._internal_index() != 0) {
- _internal_set_index(from._internal_index());
+ _this->_internal_set_index(from._internal_index());
}
- if (from._internal_commands() != 0) {
- _internal_set_commands(from._internal_commands());
+ if (from._internal_type() != 0) {
+ _this->_internal_set_type(from._internal_type());
+ }
+ if (from._internal_quantity() != 0) {
+ _this->_internal_set_quantity(from._internal_quantity());
+ }
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+}
+
+void item::CopyFrom(const item& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.item)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool item::IsInitialized() const {
+ return true;
+}
+
+void item::InternalSwap(item* other) {
+ using std::swap;
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::memswap<
+ PROTOBUF_FIELD_OFFSET(item, _impl_.quantity_)
+ + sizeof(item::_impl_.quantity_)
+ - PROTOBUF_FIELD_OFFSET(item, _impl_.index_)>(
+ reinterpret_cast<char*>(&_impl_.index_),
+ reinterpret_cast<char*>(&other->_impl_.index_));
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata item::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
+ &descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
+ file_level_metadata_net_2eproto[6]);
+}
+
+// ===================================================================
+
+class item_array::_Internal {
+ public:
+};
+
+item_array::item_array(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.item_array)
+}
+item_array::item_array(const item_array& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ item_array* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.items_){from._impl_.items_}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ // @@protoc_insertion_point(copy_constructor:proto.item_array)
+}
+
+inline void item_array::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.items_){arena}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+}
+
+item_array::~item_array() {
+ // @@protoc_insertion_point(destructor:proto.item_array)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
+ SharedDtor();
+}
+
+inline void item_array::SharedDtor() {
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
+ _impl_.items_.~RepeatedPtrField();
+}
+
+void item_array::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
+}
+
+void item_array::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.item_array)
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ _impl_.items_.Clear();
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* item_array::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ uint32_t tag;
+ ptr = ::_pbi::ReadTag(ptr, &tag);
+ switch (tag >> 3) {
+ // repeated .proto.item items = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
+ ptr -= 1;
+ do {
+ ptr += 1;
+ ptr = ctx->ParseMessage(_internal_add_items(), ptr);
+ CHK_(ptr);
+ if (!ctx->DataAvailable(ptr)) break;
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
+ } else
+ goto handle_unusual;
+ continue;
+ default:
+ goto handle_unusual;
+ } // switch
+ handle_unusual:
+ if ((tag == 0) || ((tag & 7) == 4)) {
+ CHK_(ptr);
+ ctx->SetLastTag(tag);
+ goto message_done;
+ }
+ ptr = UnknownFieldParse(
+ tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ } // while
+message_done:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto message_done;
+#undef CHK_
+}
+
+uint8_t* item_array::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:proto.item_array)
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // repeated .proto.item items = 1;
+ for (unsigned i = 0,
+ n = static_cast<unsigned>(this->_internal_items_size()); i < n; i++) {
+ const auto& repfield = this->_internal_items(i);
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:proto.item_array)
+ return target;
+}
+
+size_t item_array::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.item_array)
+ size_t total_size = 0;
+
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // repeated .proto.item items = 1;
+ total_size += 1UL * this->_internal_items_size();
+ for (const auto& msg : this->_impl_.items_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
+}
+
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData item_array::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ item_array::MergeImpl
+};
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*item_array::GetClassData() const { return &_class_data_; }
+
+
+void item_array::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<item_array*>(&to_msg);
+ auto& from = static_cast<const item_array&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.item_array)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ _this->_impl_.items_.MergeFrom(from._impl_.items_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+}
+
+void item_array::CopyFrom(const item_array& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.item_array)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool item_array::IsInitialized() const {
+ return true;
+}
+
+void item_array::InternalSwap(item_array* other) {
+ using std::swap;
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ _impl_.items_.InternalSwap(&other->_impl_.items_);
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata item_array::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
+ &descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
+ file_level_metadata_net_2eproto[7]);
+}
+
+// ===================================================================
+
+class player::_Internal {
+ public:
+ static const ::proto::animate& animate(const player* msg);
+ static const ::proto::item_array& inventory(const player* msg);
+};
+
+const ::proto::animate&
+player::_Internal::animate(const player* msg) {
+ return *msg->_impl_.animate_;
+}
+const ::proto::item_array&
+player::_Internal::inventory(const player* msg) {
+ return *msg->_impl_.inventory_;
+}
+player::player(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.player)
+}
+player::player(const player& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ player* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.animate_){nullptr}
+ , decltype(_impl_.inventory_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ if (from._internal_has_animate()) {
+ _this->_impl_.animate_ = new ::proto::animate(*from._impl_.animate_);
+ }
+ if (from._internal_has_inventory()) {
+ _this->_impl_.inventory_ = new ::proto::item_array(*from._impl_.inventory_);
+ }
+ // @@protoc_insertion_point(copy_constructor:proto.player)
+}
+
+inline void player::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.animate_){nullptr}
+ , decltype(_impl_.inventory_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+}
+
+player::~player() {
+ // @@protoc_insertion_point(destructor:proto.player)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
+ SharedDtor();
+}
+
+inline void player::SharedDtor() {
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
+ if (this != internal_default_instance()) delete _impl_.animate_;
+ if (this != internal_default_instance()) delete _impl_.inventory_;
+}
+
+void player::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
+}
+
+void player::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.player)
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ if (GetArenaForAllocation() == nullptr && _impl_.animate_ != nullptr) {
+ delete _impl_.animate_;
+ }
+ _impl_.animate_ = nullptr;
+ if (GetArenaForAllocation() == nullptr && _impl_.inventory_ != nullptr) {
+ delete _impl_.inventory_;
+ }
+ _impl_.inventory_ = nullptr;
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* player::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ uint32_t tag;
+ ptr = ::_pbi::ReadTag(ptr, &tag);
+ switch (tag >> 3) {
+ // .proto.animate animate = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
+ ptr = ctx->ParseMessage(_internal_mutable_animate(), ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // .proto.item_array inventory = 2;
+ case 2:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
+ ptr = ctx->ParseMessage(_internal_mutable_inventory(), ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ default:
+ goto handle_unusual;
+ } // switch
+ handle_unusual:
+ if ((tag == 0) || ((tag & 7) == 4)) {
+ CHK_(ptr);
+ ctx->SetLastTag(tag);
+ goto message_done;
+ }
+ ptr = UnknownFieldParse(
+ tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ } // while
+message_done:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto message_done;
+#undef CHK_
+}
+
+uint8_t* player::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:proto.player)
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // .proto.animate animate = 1;
+ if (this->_internal_has_animate()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(1, _Internal::animate(this),
+ _Internal::animate(this).GetCachedSize(), target, stream);
+ }
+
+ // .proto.item_array inventory = 2;
+ if (this->_internal_has_inventory()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(2, _Internal::inventory(this),
+ _Internal::inventory(this).GetCachedSize(), target, stream);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:proto.player)
+ return target;
+}
+
+size_t player::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.player)
+ size_t total_size = 0;
+
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // .proto.animate animate = 1;
+ if (this->_internal_has_animate()) {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
+ *_impl_.animate_);
+ }
+
+ // .proto.item_array inventory = 2;
+ if (this->_internal_has_inventory()) {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
+ *_impl_.inventory_);
+ }
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
+}
+
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData player::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ player::MergeImpl
+};
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*player::GetClassData() const { return &_class_data_; }
+
+
+void player::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<player*>(&to_msg);
+ auto& from = static_cast<const player&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.player)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ if (from._internal_has_animate()) {
+ _this->_internal_mutable_animate()->::proto::animate::MergeFrom(
+ from._internal_animate());
+ }
+ if (from._internal_has_inventory()) {
+ _this->_internal_mutable_inventory()->::proto::item_array::MergeFrom(
+ from._internal_inventory());
+ }
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void player::CopyFrom(const player& from) {
@@ -1837,17 +2967,17 @@ void player::InternalSwap(player* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(player, commands_)
- + sizeof(player::commands_)
- - PROTOBUF_FIELD_OFFSET(player, chunk_pos_)>(
- reinterpret_cast<char*>(&chunk_pos_),
- reinterpret_cast<char*>(&other->chunk_pos_));
+ PROTOBUF_FIELD_OFFSET(player, _impl_.inventory_)
+ + sizeof(player::_impl_.inventory_)
+ - PROTOBUF_FIELD_OFFSET(player, _impl_.animate_)>(
+ reinterpret_cast<char*>(&_impl_.animate_),
+ reinterpret_cast<char*>(&other->_impl_.animate_));
}
::PROTOBUF_NAMESPACE_ID::Metadata player::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[4]);
+ file_level_metadata_net_2eproto[8]);
}
// ===================================================================
@@ -1859,66 +2989,73 @@ class auth::_Internal {
auth::auth(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.auth)
}
auth::auth(const auth& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ auth* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.username_){}
+ , decltype(_impl_.password_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- username_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.username_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- username_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ _impl_.username_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_username().empty()) {
- username_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_username(),
- GetArenaForAllocation());
+ _this->_impl_.username_.Set(from._internal_username(),
+ _this->GetArenaForAllocation());
}
- password_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.password_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- password_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ _impl_.password_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_password().empty()) {
- password_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_password(),
- GetArenaForAllocation());
+ _this->_impl_.password_.Set(from._internal_password(),
+ _this->GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:proto.auth)
}
-inline void auth::SharedCtor() {
-username_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
-#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- username_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
-#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
-password_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
-#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- password_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
-#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+inline void auth::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.username_){}
+ , decltype(_impl_.password_){}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+ _impl_.username_.InitDefault();
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ _impl_.username_.Set("", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ _impl_.password_.InitDefault();
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ _impl_.password_.Set("", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
auth::~auth() {
// @@protoc_insertion_point(destructor:proto.auth)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void auth::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- username_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- password_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.username_.Destroy();
+ _impl_.password_.Destroy();
}
-void auth::ArenaDtor(void* object) {
- auth* _this = reinterpret_cast< auth* >(object);
- (void)_this;
-}
-void auth::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void auth::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void auth::Clear() {
@@ -1927,24 +3064,24 @@ void auth::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- username_.ClearToEmpty();
- password_.ClearToEmpty();
+ _impl_.username_.ClearToEmpty();
+ _impl_.password_.ClearToEmpty();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* auth::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* auth::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string username = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_username();
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
- CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "proto.auth.username"));
+ ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
+ CHK_(::_pbi::VerifyUTF8(str, "proto.auth.username"));
} else
goto handle_unusual;
continue;
@@ -1952,9 +3089,9 @@ const char* auth::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_password();
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
- CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "proto.auth.password"));
+ ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
+ CHK_(::_pbi::VerifyUTF8(str, "proto.auth.password"));
} else
goto handle_unusual;
continue;
@@ -2008,7 +3145,7 @@ uint8_t* auth::_InternalSerialize(
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.auth)
@@ -2037,35 +3174,31 @@ size_t auth::ByteSizeLong() const {
this->_internal_password());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData auth::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
auth::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*auth::GetClassData() const { return &_class_data_; }
-void auth::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<auth *>(to)->MergeFrom(
- static_cast<const auth &>(from));
-}
-
-void auth::MergeFrom(const auth& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.auth)
- GOOGLE_DCHECK_NE(&from, this);
+void auth::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<auth*>(&to_msg);
+ auto& from = static_cast<const auth&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.auth)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_username().empty()) {
- _internal_set_username(from._internal_username());
+ _this->_internal_set_username(from._internal_username());
}
if (!from._internal_password().empty()) {
- _internal_set_password(from._internal_password());
+ _this->_internal_set_password(from._internal_password());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void auth::CopyFrom(const auth& from) {
@@ -2085,21 +3218,19 @@ void auth::InternalSwap(auth* other) {
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- &username_, lhs_arena,
- &other->username_, rhs_arena
+ &_impl_.username_, lhs_arena,
+ &other->_impl_.username_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- &password_, lhs_arena,
- &other->password_, rhs_arena
+ &_impl_.password_, lhs_arena,
+ &other->_impl_.password_, rhs_arena
);
}
::PROTOBUF_NAMESPACE_ID::Metadata auth::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[5]);
+ file_level_metadata_net_2eproto[9]);
}
// ===================================================================
@@ -2111,58 +3242,65 @@ class init::_Internal {
const ::proto::player&
init::_Internal::localplayer(const init* msg) {
- return *msg->localplayer_;
+ return *msg->_impl_.localplayer_;
}
init::init(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.init)
}
init::init(const init& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ init* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.localplayer_){nullptr}
+ , decltype(_impl_.seed_){}
+ , decltype(_impl_.draw_distance_){}
+ , decltype(_impl_.tickrate_){}
+ , decltype(_impl_.tick_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_localplayer()) {
- localplayer_ = new ::proto::player(*from.localplayer_);
- } else {
- localplayer_ = nullptr;
+ _this->_impl_.localplayer_ = new ::proto::player(*from._impl_.localplayer_);
}
- ::memcpy(&seed_, &from.seed_,
- static_cast<size_t>(reinterpret_cast<char*>(&draw_distance_) -
- reinterpret_cast<char*>(&seed_)) + sizeof(draw_distance_));
+ ::memcpy(&_impl_.seed_, &from._impl_.seed_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.tick_) -
+ reinterpret_cast<char*>(&_impl_.seed_)) + sizeof(_impl_.tick_));
// @@protoc_insertion_point(copy_constructor:proto.init)
}
-inline void init::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&localplayer_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&draw_distance_) -
- reinterpret_cast<char*>(&localplayer_)) + sizeof(draw_distance_));
+inline void init::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.localplayer_){nullptr}
+ , decltype(_impl_.seed_){uint64_t{0u}}
+ , decltype(_impl_.draw_distance_){0}
+ , decltype(_impl_.tickrate_){0u}
+ , decltype(_impl_.tick_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
init::~init() {
// @@protoc_insertion_point(destructor:proto.init)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void init::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- if (this != internal_default_instance()) delete localplayer_;
+ if (this != internal_default_instance()) delete _impl_.localplayer_;
}
-void init::ArenaDtor(void* object) {
- init* _this = reinterpret_cast< init* >(object);
- (void)_this;
-}
-void init::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void init::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void init::Clear() {
@@ -2171,26 +3309,26 @@ void init::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- if (GetArenaForAllocation() == nullptr && localplayer_ != nullptr) {
- delete localplayer_;
+ if (GetArenaForAllocation() == nullptr && _impl_.localplayer_ != nullptr) {
+ delete _impl_.localplayer_;
}
- localplayer_ = nullptr;
- ::memset(&seed_, 0, static_cast<size_t>(
- reinterpret_cast<char*>(&draw_distance_) -
- reinterpret_cast<char*>(&seed_)) + sizeof(draw_distance_));
+ _impl_.localplayer_ = nullptr;
+ ::memset(&_impl_.seed_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.tick_) -
+ reinterpret_cast<char*>(&_impl_.seed_)) + sizeof(_impl_.tick_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* init::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* init::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// uint64 seed = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
- seed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ _impl_.seed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -2198,7 +3336,7 @@ const char* init::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
// int32 draw_distance = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
- draw_distance_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.draw_distance_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -2211,6 +3349,22 @@ const char* init::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
} else
goto handle_unusual;
continue;
+ // uint32 tickrate = 4;
+ case 4:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
+ _impl_.tickrate_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // uint32 tick = 5;
+ case 5:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
+ _impl_.tick_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
default:
goto handle_unusual;
} // switch
@@ -2243,25 +3397,36 @@ uint8_t* init::_InternalSerialize(
// uint64 seed = 1;
if (this->_internal_seed() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(1, this->_internal_seed(), target);
+ target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_seed(), target);
}
// int32 draw_distance = 2;
if (this->_internal_draw_distance() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_draw_distance(), target);
+ target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_draw_distance(), target);
}
// .proto.player localplayer = 3;
if (this->_internal_has_localplayer()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 3, _Internal::localplayer(this), target, stream);
+ InternalWriteMessage(3, _Internal::localplayer(this),
+ _Internal::localplayer(this).GetCachedSize(), target, stream);
+ }
+
+ // uint32 tickrate = 4;
+ if (this->_internal_tickrate() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_tickrate(), target);
+ }
+
+ // uint32 tick = 5;
+ if (this->_internal_tick() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(5, this->_internal_tick(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.init)
@@ -2280,51 +3445,64 @@ size_t init::ByteSizeLong() const {
if (this->_internal_has_localplayer()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *localplayer_);
+ *_impl_.localplayer_);
}
// uint64 seed = 1;
if (this->_internal_seed() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64SizePlusOne(this->_internal_seed());
+ total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_seed());
}
// int32 draw_distance = 2;
if (this->_internal_draw_distance() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_draw_distance());
+ total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_draw_distance());
+ }
+
+ // uint32 tickrate = 4;
+ if (this->_internal_tickrate() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_tickrate());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ // uint32 tick = 5;
+ if (this->_internal_tick() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_tick());
+ }
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData init::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
init::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*init::GetClassData() const { return &_class_data_; }
-void init::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<init *>(to)->MergeFrom(
- static_cast<const init &>(from));
-}
-
-void init::MergeFrom(const init& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.init)
- GOOGLE_DCHECK_NE(&from, this);
+void init::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<init*>(&to_msg);
+ auto& from = static_cast<const init&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.init)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_localplayer()) {
- _internal_mutable_localplayer()->::proto::player::MergeFrom(from._internal_localplayer());
+ _this->_internal_mutable_localplayer()->::proto::player::MergeFrom(
+ from._internal_localplayer());
}
if (from._internal_seed() != 0) {
- _internal_set_seed(from._internal_seed());
+ _this->_internal_set_seed(from._internal_seed());
}
if (from._internal_draw_distance() != 0) {
- _internal_set_draw_distance(from._internal_draw_distance());
+ _this->_internal_set_draw_distance(from._internal_draw_distance());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ if (from._internal_tickrate() != 0) {
+ _this->_internal_set_tickrate(from._internal_tickrate());
+ }
+ if (from._internal_tick() != 0) {
+ _this->_internal_set_tick(from._internal_tick());
+ }
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void init::CopyFrom(const init& from) {
@@ -2342,17 +3520,17 @@ void init::InternalSwap(init* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(init, draw_distance_)
- + sizeof(init::draw_distance_)
- - PROTOBUF_FIELD_OFFSET(init, localplayer_)>(
- reinterpret_cast<char*>(&localplayer_),
- reinterpret_cast<char*>(&other->localplayer_));
+ PROTOBUF_FIELD_OFFSET(init, _impl_.tick_)
+ + sizeof(init::_impl_.tick_)
+ - PROTOBUF_FIELD_OFFSET(init, _impl_.localplayer_)>(
+ reinterpret_cast<char*>(&_impl_.localplayer_),
+ reinterpret_cast<char*>(&other->_impl_.localplayer_));
}
::PROTOBUF_NAMESPACE_ID::Metadata init::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[6]);
+ file_level_metadata_net_2eproto[10]);
}
// ===================================================================
@@ -2364,56 +3542,63 @@ class move::_Internal {
const ::proto::angles&
move::_Internal::viewangles(const move* msg) {
- return *msg->viewangles_;
+ return *msg->_impl_.viewangles_;
}
move::move(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.move)
}
move::move(const move& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ move* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.viewangles_){nullptr}
+ , decltype(_impl_.commands_){}
+ , decltype(_impl_.active_item_){}
+ , decltype(_impl_.sequence_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_viewangles()) {
- viewangles_ = new ::proto::angles(*from.viewangles_);
- } else {
- viewangles_ = nullptr;
+ _this->_impl_.viewangles_ = new ::proto::angles(*from._impl_.viewangles_);
}
- commands_ = from.commands_;
+ ::memcpy(&_impl_.commands_, &from._impl_.commands_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.sequence_) -
+ reinterpret_cast<char*>(&_impl_.commands_)) + sizeof(_impl_.sequence_));
// @@protoc_insertion_point(copy_constructor:proto.move)
}
-inline void move::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&viewangles_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&commands_) -
- reinterpret_cast<char*>(&viewangles_)) + sizeof(commands_));
+inline void move::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.viewangles_){nullptr}
+ , decltype(_impl_.commands_){0u}
+ , decltype(_impl_.active_item_){0u}
+ , decltype(_impl_.sequence_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
move::~move() {
// @@protoc_insertion_point(destructor:proto.move)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void move::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- if (this != internal_default_instance()) delete viewangles_;
+ if (this != internal_default_instance()) delete _impl_.viewangles_;
}
-void move::ArenaDtor(void* object) {
- move* _this = reinterpret_cast< move* >(object);
- (void)_this;
-}
-void move::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void move::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void move::Clear() {
@@ -2422,24 +3607,26 @@ void move::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- if (GetArenaForAllocation() == nullptr && viewangles_ != nullptr) {
- delete viewangles_;
+ if (GetArenaForAllocation() == nullptr && _impl_.viewangles_ != nullptr) {
+ delete _impl_.viewangles_;
}
- viewangles_ = nullptr;
- commands_ = 0u;
+ _impl_.viewangles_ = nullptr;
+ ::memset(&_impl_.commands_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.sequence_) -
+ reinterpret_cast<char*>(&_impl_.commands_)) + sizeof(_impl_.sequence_));
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* move::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* move::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// uint32 commands = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
- commands_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.commands_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -2452,6 +3639,22 @@ const char* move::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter
} else
goto handle_unusual;
continue;
+ // uint32 active_item = 3;
+ case 3:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
+ _impl_.active_item_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // uint32 sequence = 4;
+ case 4:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
+ _impl_.sequence_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
default:
goto handle_unusual;
} // switch
@@ -2484,19 +3687,30 @@ uint8_t* move::_InternalSerialize(
// uint32 commands = 1;
if (this->_internal_commands() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_commands(), target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_commands(), target);
}
// .proto.angles viewangles = 2;
if (this->_internal_has_viewangles()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 2, _Internal::viewangles(this), target, stream);
+ InternalWriteMessage(2, _Internal::viewangles(this),
+ _Internal::viewangles(this).GetCachedSize(), target, stream);
+ }
+
+ // uint32 active_item = 3;
+ if (this->_internal_active_item() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_active_item(), target);
+ }
+
+ // uint32 sequence = 4;
+ if (this->_internal_sequence() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_sequence(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.move)
@@ -2515,43 +3729,56 @@ size_t move::ByteSizeLong() const {
if (this->_internal_has_viewangles()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *viewangles_);
+ *_impl_.viewangles_);
}
// uint32 commands = 1;
if (this->_internal_commands() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_commands());
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_commands());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ // uint32 active_item = 3;
+ if (this->_internal_active_item() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_active_item());
+ }
+
+ // uint32 sequence = 4;
+ if (this->_internal_sequence() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_sequence());
+ }
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData move::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
move::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*move::GetClassData() const { return &_class_data_; }
-void move::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<move *>(to)->MergeFrom(
- static_cast<const move &>(from));
-}
-
-void move::MergeFrom(const move& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.move)
- GOOGLE_DCHECK_NE(&from, this);
+void move::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<move*>(&to_msg);
+ auto& from = static_cast<const move&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.move)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_viewangles()) {
- _internal_mutable_viewangles()->::proto::angles::MergeFrom(from._internal_viewangles());
+ _this->_internal_mutable_viewangles()->::proto::angles::MergeFrom(
+ from._internal_viewangles());
}
if (from._internal_commands() != 0) {
- _internal_set_commands(from._internal_commands());
+ _this->_internal_set_commands(from._internal_commands());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ if (from._internal_active_item() != 0) {
+ _this->_internal_set_active_item(from._internal_active_item());
+ }
+ if (from._internal_sequence() != 0) {
+ _this->_internal_set_sequence(from._internal_sequence());
+ }
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void move::CopyFrom(const move& from) {
@@ -2569,86 +3796,90 @@ void move::InternalSwap(move* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(move, commands_)
- + sizeof(move::commands_)
- - PROTOBUF_FIELD_OFFSET(move, viewangles_)>(
- reinterpret_cast<char*>(&viewangles_),
- reinterpret_cast<char*>(&other->viewangles_));
+ PROTOBUF_FIELD_OFFSET(move, _impl_.sequence_)
+ + sizeof(move::_impl_.sequence_)
+ - PROTOBUF_FIELD_OFFSET(move, _impl_.viewangles_)>(
+ reinterpret_cast<char*>(&_impl_.viewangles_),
+ reinterpret_cast<char*>(&other->_impl_.viewangles_));
}
::PROTOBUF_NAMESPACE_ID::Metadata move::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[7]);
+ file_level_metadata_net_2eproto[11]);
}
// ===================================================================
-class remove_player::_Internal {
+class remove_entity::_Internal {
public:
};
-remove_player::remove_player(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+remove_entity::remove_entity(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
- // @@protoc_insertion_point(arena_constructor:proto.remove_player)
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.remove_entity)
}
-remove_player::remove_player(const remove_player& from)
+remove_entity::remove_entity(const remove_entity& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ remove_entity* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.index_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- index_ = from.index_;
- // @@protoc_insertion_point(copy_constructor:proto.remove_player)
+ _this->_impl_.index_ = from._impl_.index_;
+ // @@protoc_insertion_point(copy_constructor:proto.remove_entity)
}
-inline void remove_player::SharedCtor() {
-index_ = 0u;
+inline void remove_entity::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.index_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
-remove_player::~remove_player() {
- // @@protoc_insertion_point(destructor:proto.remove_player)
- if (GetArenaForAllocation() != nullptr) return;
+remove_entity::~remove_entity() {
+ // @@protoc_insertion_point(destructor:proto.remove_entity)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-inline void remove_player::SharedDtor() {
+inline void remove_entity::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
-void remove_player::ArenaDtor(void* object) {
- remove_player* _this = reinterpret_cast< remove_player* >(object);
- (void)_this;
-}
-void remove_player::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
-void remove_player::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+void remove_entity::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
}
-void remove_player::Clear() {
-// @@protoc_insertion_point(message_clear_start:proto.remove_player)
+void remove_entity::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.remove_entity)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- index_ = 0u;
+ _impl_.index_ = 0u;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* remove_player::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* remove_entity::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// uint32 index = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
- index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -2676,28 +3907,28 @@ failure:
#undef CHK_
}
-uint8_t* remove_player::_InternalSerialize(
+uint8_t* remove_entity::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
- // @@protoc_insertion_point(serialize_to_array_start:proto.remove_player)
+ // @@protoc_insertion_point(serialize_to_array_start:proto.remove_entity)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// uint32 index = 1;
if (this->_internal_index() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index(), target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
- // @@protoc_insertion_point(serialize_to_array_end:proto.remove_player)
+ // @@protoc_insertion_point(serialize_to_array_end:proto.remove_entity)
return target;
}
-size_t remove_player::ByteSizeLong() const {
-// @@protoc_insertion_point(message_byte_size_start:proto.remove_player)
+size_t remove_entity::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.remove_entity)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
@@ -2706,58 +3937,54 @@ size_t remove_player::ByteSizeLong() const {
// uint32 index = 1;
if (this->_internal_index() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_index());
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_index());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
-const ::PROTOBUF_NAMESPACE_ID::Message::ClassData remove_player::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
- remove_player::MergeImpl
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData remove_entity::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ remove_entity::MergeImpl
};
-const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*remove_player::GetClassData() const { return &_class_data_; }
-
-void remove_player::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<remove_player *>(to)->MergeFrom(
- static_cast<const remove_player &>(from));
-}
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*remove_entity::GetClassData() const { return &_class_data_; }
-void remove_player::MergeFrom(const remove_player& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.remove_player)
- GOOGLE_DCHECK_NE(&from, this);
+void remove_entity::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<remove_entity*>(&to_msg);
+ auto& from = static_cast<const remove_entity&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.remove_entity)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_index() != 0) {
- _internal_set_index(from._internal_index());
+ _this->_internal_set_index(from._internal_index());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
-void remove_player::CopyFrom(const remove_player& from) {
-// @@protoc_insertion_point(class_specific_copy_from_start:proto.remove_player)
+void remove_entity::CopyFrom(const remove_entity& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.remove_entity)
if (&from == this) return;
Clear();
MergeFrom(from);
}
-bool remove_player::IsInitialized() const {
+bool remove_entity::IsInitialized() const {
return true;
}
-void remove_player::InternalSwap(remove_player* other) {
+void remove_entity::InternalSwap(remove_entity* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
- swap(index_, other->index_);
+ swap(_impl_.index_, other->_impl_.index_);
}
-::PROTOBUF_NAMESPACE_ID::Metadata remove_player::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+::PROTOBUF_NAMESPACE_ID::Metadata remove_entity::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[8]);
+ file_level_metadata_net_2eproto[12]);
}
// ===================================================================
@@ -2769,53 +3996,58 @@ class say::_Internal {
say::say(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.say)
}
say::say(const say& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ say* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.text_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- text_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.text_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- text_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ _impl_.text_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_text().empty()) {
- text_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_text(),
- GetArenaForAllocation());
+ _this->_impl_.text_.Set(from._internal_text(),
+ _this->GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:proto.say)
}
-inline void say::SharedCtor() {
-text_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
-#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- text_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
-#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+inline void say::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.text_){}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+ _impl_.text_.InitDefault();
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ _impl_.text_.Set("", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
say::~say() {
// @@protoc_insertion_point(destructor:proto.say)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void say::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- text_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.text_.Destroy();
}
-void say::ArenaDtor(void* object) {
- say* _this = reinterpret_cast< say* >(object);
- (void)_this;
-}
-void say::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void say::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void say::Clear() {
@@ -2824,23 +4056,23 @@ void say::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- text_.ClearToEmpty();
+ _impl_.text_.ClearToEmpty();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* say::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* say::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string text = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_text();
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
- CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "proto.say.text"));
+ ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
+ CHK_(::_pbi::VerifyUTF8(str, "proto.say.text"));
} else
goto handle_unusual;
continue;
@@ -2884,7 +4116,7 @@ uint8_t* say::_InternalSerialize(
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.say)
@@ -2906,32 +4138,28 @@ size_t say::ByteSizeLong() const {
this->_internal_text());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData say::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
say::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*say::GetClassData() const { return &_class_data_; }
-void say::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<say *>(to)->MergeFrom(
- static_cast<const say &>(from));
-}
-
-void say::MergeFrom(const say& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.say)
- GOOGLE_DCHECK_NE(&from, this);
+void say::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<say*>(&to_msg);
+ auto& from = static_cast<const say&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.say)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_text().empty()) {
- _internal_set_text(from._internal_text());
+ _this->_internal_set_text(from._internal_text());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void say::CopyFrom(const say& from) {
@@ -2951,16 +4179,15 @@ void say::InternalSwap(say* other) {
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- &text_, lhs_arena,
- &other->text_, rhs_arena
+ &_impl_.text_, lhs_arena,
+ &other->_impl_.text_, rhs_arena
);
}
::PROTOBUF_NAMESPACE_ID::Metadata say::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[9]);
+ file_level_metadata_net_2eproto[13]);
}
// ===================================================================
@@ -2972,55 +4199,61 @@ class hear_player::_Internal {
hear_player::hear_player(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.hear_player)
}
hear_player::hear_player(const hear_player& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ hear_player* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.text_){}
+ , decltype(_impl_.index_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- text_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.text_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- text_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ _impl_.text_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_text().empty()) {
- text_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_text(),
- GetArenaForAllocation());
+ _this->_impl_.text_.Set(from._internal_text(),
+ _this->GetArenaForAllocation());
}
- index_ = from.index_;
+ _this->_impl_.index_ = from._impl_.index_;
// @@protoc_insertion_point(copy_constructor:proto.hear_player)
}
-inline void hear_player::SharedCtor() {
-text_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
-#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- text_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
-#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
-index_ = 0u;
+inline void hear_player::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.text_){}
+ , decltype(_impl_.index_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+ _impl_.text_.InitDefault();
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ _impl_.text_.Set("", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
hear_player::~hear_player() {
// @@protoc_insertion_point(destructor:proto.hear_player)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void hear_player::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- text_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.text_.Destroy();
}
-void hear_player::ArenaDtor(void* object) {
- hear_player* _this = reinterpret_cast< hear_player* >(object);
- (void)_this;
-}
-void hear_player::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void hear_player::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void hear_player::Clear() {
@@ -3029,21 +4262,21 @@ void hear_player::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- text_.ClearToEmpty();
- index_ = 0u;
+ _impl_.text_.ClearToEmpty();
+ _impl_.index_ = 0u;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* hear_player::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* hear_player::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// uint32 index = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
- index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -3052,9 +4285,9 @@ const char* hear_player::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_text();
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
- CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "proto.hear_player.text"));
+ ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
+ CHK_(::_pbi::VerifyUTF8(str, "proto.hear_player.text"));
} else
goto handle_unusual;
continue;
@@ -3090,7 +4323,7 @@ uint8_t* hear_player::_InternalSerialize(
// uint32 index = 1;
if (this->_internal_index() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index(), target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index(), target);
}
// string text = 2;
@@ -3104,7 +4337,7 @@ uint8_t* hear_player::_InternalSerialize(
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.hear_player)
@@ -3128,38 +4361,34 @@ size_t hear_player::ByteSizeLong() const {
// uint32 index = 1;
if (this->_internal_index() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_index());
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_index());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData hear_player::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
hear_player::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*hear_player::GetClassData() const { return &_class_data_; }
-void hear_player::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<hear_player *>(to)->MergeFrom(
- static_cast<const hear_player &>(from));
-}
-
-void hear_player::MergeFrom(const hear_player& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.hear_player)
- GOOGLE_DCHECK_NE(&from, this);
+void hear_player::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<hear_player*>(&to_msg);
+ auto& from = static_cast<const hear_player&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.hear_player)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_text().empty()) {
- _internal_set_text(from._internal_text());
+ _this->_internal_set_text(from._internal_text());
}
if (from._internal_index() != 0) {
- _internal_set_index(from._internal_index());
+ _this->_internal_set_index(from._internal_index());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void hear_player::CopyFrom(const hear_player& from) {
@@ -3179,17 +4408,16 @@ void hear_player::InternalSwap(hear_player* other) {
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- &text_, lhs_arena,
- &other->text_, rhs_arena
+ &_impl_.text_, lhs_arena,
+ &other->_impl_.text_, rhs_arena
);
- swap(index_, other->index_);
+ swap(_impl_.index_, other->_impl_.index_);
}
::PROTOBUF_NAMESPACE_ID::Metadata hear_player::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[10]);
+ file_level_metadata_net_2eproto[14]);
}
// ===================================================================
@@ -3201,52 +4429,54 @@ class request_chunk::_Internal {
const ::proto::coords&
request_chunk::_Internal::chunk_pos(const request_chunk* msg) {
- return *msg->chunk_pos_;
+ return *msg->_impl_.chunk_pos_;
}
request_chunk::request_chunk(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.request_chunk)
}
request_chunk::request_chunk(const request_chunk& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ request_chunk* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_chunk_pos()) {
- chunk_pos_ = new ::proto::coords(*from.chunk_pos_);
- } else {
- chunk_pos_ = nullptr;
+ _this->_impl_.chunk_pos_ = new ::proto::coords(*from._impl_.chunk_pos_);
}
// @@protoc_insertion_point(copy_constructor:proto.request_chunk)
}
-inline void request_chunk::SharedCtor() {
-chunk_pos_ = nullptr;
+inline void request_chunk::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
request_chunk::~request_chunk() {
// @@protoc_insertion_point(destructor:proto.request_chunk)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void request_chunk::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- if (this != internal_default_instance()) delete chunk_pos_;
+ if (this != internal_default_instance()) delete _impl_.chunk_pos_;
}
-void request_chunk::ArenaDtor(void* object) {
- request_chunk* _this = reinterpret_cast< request_chunk* >(object);
- (void)_this;
-}
-void request_chunk::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void request_chunk::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void request_chunk::Clear() {
@@ -3255,18 +4485,18 @@ void request_chunk::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* request_chunk::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* request_chunk::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .proto.coords chunk_pos = 1;
case 1:
@@ -3307,14 +4537,13 @@ uint8_t* request_chunk::_InternalSerialize(
// .proto.coords chunk_pos = 1;
if (this->_internal_has_chunk_pos()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 1, _Internal::chunk_pos(this), target, stream);
+ InternalWriteMessage(1, _Internal::chunk_pos(this),
+ _Internal::chunk_pos(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.request_chunk)
@@ -3333,35 +4562,32 @@ size_t request_chunk::ByteSizeLong() const {
if (this->_internal_has_chunk_pos()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *chunk_pos_);
+ *_impl_.chunk_pos_);
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData request_chunk::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
request_chunk::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*request_chunk::GetClassData() const { return &_class_data_; }
-void request_chunk::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<request_chunk *>(to)->MergeFrom(
- static_cast<const request_chunk &>(from));
-}
-
-void request_chunk::MergeFrom(const request_chunk& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.request_chunk)
- GOOGLE_DCHECK_NE(&from, this);
+void request_chunk::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<request_chunk*>(&to_msg);
+ auto& from = static_cast<const request_chunk&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.request_chunk)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_chunk_pos()) {
- _internal_mutable_chunk_pos()->::proto::coords::MergeFrom(from._internal_chunk_pos());
+ _this->_internal_mutable_chunk_pos()->::proto::coords::MergeFrom(
+ from._internal_chunk_pos());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void request_chunk::CopyFrom(const request_chunk& from) {
@@ -3378,13 +4604,13 @@ bool request_chunk::IsInitialized() const {
void request_chunk::InternalSwap(request_chunk* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
- swap(chunk_pos_, other->chunk_pos_);
+ swap(_impl_.chunk_pos_, other->_impl_.chunk_pos_);
}
::PROTOBUF_NAMESPACE_ID::Metadata request_chunk::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[11]);
+ file_level_metadata_net_2eproto[15]);
}
// ===================================================================
@@ -3396,52 +4622,54 @@ class remove_chunk::_Internal {
const ::proto::coords&
remove_chunk::_Internal::chunk_pos(const remove_chunk* msg) {
- return *msg->chunk_pos_;
+ return *msg->_impl_.chunk_pos_;
}
remove_chunk::remove_chunk(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.remove_chunk)
}
remove_chunk::remove_chunk(const remove_chunk& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ remove_chunk* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_chunk_pos()) {
- chunk_pos_ = new ::proto::coords(*from.chunk_pos_);
- } else {
- chunk_pos_ = nullptr;
+ _this->_impl_.chunk_pos_ = new ::proto::coords(*from._impl_.chunk_pos_);
}
// @@protoc_insertion_point(copy_constructor:proto.remove_chunk)
}
-inline void remove_chunk::SharedCtor() {
-chunk_pos_ = nullptr;
+inline void remove_chunk::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
remove_chunk::~remove_chunk() {
// @@protoc_insertion_point(destructor:proto.remove_chunk)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void remove_chunk::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- if (this != internal_default_instance()) delete chunk_pos_;
+ if (this != internal_default_instance()) delete _impl_.chunk_pos_;
}
-void remove_chunk::ArenaDtor(void* object) {
- remove_chunk* _this = reinterpret_cast< remove_chunk* >(object);
- (void)_this;
-}
-void remove_chunk::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void remove_chunk::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void remove_chunk::Clear() {
@@ -3450,18 +4678,18 @@ void remove_chunk::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* remove_chunk::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* remove_chunk::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .proto.coords chunk_pos = 1;
case 1:
@@ -3502,14 +4730,13 @@ uint8_t* remove_chunk::_InternalSerialize(
// .proto.coords chunk_pos = 1;
if (this->_internal_has_chunk_pos()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 1, _Internal::chunk_pos(this), target, stream);
+ InternalWriteMessage(1, _Internal::chunk_pos(this),
+ _Internal::chunk_pos(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.remove_chunk)
@@ -3528,35 +4755,32 @@ size_t remove_chunk::ByteSizeLong() const {
if (this->_internal_has_chunk_pos()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *chunk_pos_);
+ *_impl_.chunk_pos_);
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData remove_chunk::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
remove_chunk::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*remove_chunk::GetClassData() const { return &_class_data_; }
-void remove_chunk::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<remove_chunk *>(to)->MergeFrom(
- static_cast<const remove_chunk &>(from));
-}
-
-void remove_chunk::MergeFrom(const remove_chunk& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.remove_chunk)
- GOOGLE_DCHECK_NE(&from, this);
+void remove_chunk::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<remove_chunk*>(&to_msg);
+ auto& from = static_cast<const remove_chunk&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.remove_chunk)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_chunk_pos()) {
- _internal_mutable_chunk_pos()->::proto::coords::MergeFrom(from._internal_chunk_pos());
+ _this->_internal_mutable_chunk_pos()->::proto::coords::MergeFrom(
+ from._internal_chunk_pos());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void remove_chunk::CopyFrom(const remove_chunk& from) {
@@ -3573,13 +4797,13 @@ bool remove_chunk::IsInitialized() const {
void remove_chunk::InternalSwap(remove_chunk* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
- swap(chunk_pos_, other->chunk_pos_);
+ swap(_impl_.chunk_pos_, other->_impl_.chunk_pos_);
}
::PROTOBUF_NAMESPACE_ID::Metadata remove_chunk::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[12]);
+ file_level_metadata_net_2eproto[16]);
}
// ===================================================================
@@ -3591,54 +4815,59 @@ class chunk::_Internal {
const ::proto::coords&
chunk::_Internal::chunk_pos(const chunk* msg) {
- return *msg->chunk_pos_;
+ return *msg->_impl_.chunk_pos_;
}
chunk::chunk(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
- : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned),
- blocks_(arena) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.chunk)
}
chunk::chunk(const chunk& from)
- : ::PROTOBUF_NAMESPACE_ID::Message(),
- blocks_(from.blocks_) {
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ chunk* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.blocks_){from._impl_.blocks_}
+ , /*decltype(_impl_._blocks_cached_byte_size_)*/{0}
+ , decltype(_impl_.chunk_pos_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_chunk_pos()) {
- chunk_pos_ = new ::proto::coords(*from.chunk_pos_);
- } else {
- chunk_pos_ = nullptr;
+ _this->_impl_.chunk_pos_ = new ::proto::coords(*from._impl_.chunk_pos_);
}
// @@protoc_insertion_point(copy_constructor:proto.chunk)
}
-inline void chunk::SharedCtor() {
-chunk_pos_ = nullptr;
+inline void chunk::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.blocks_){arena}
+ , /*decltype(_impl_._blocks_cached_byte_size_)*/{0}
+ , decltype(_impl_.chunk_pos_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
chunk::~chunk() {
// @@protoc_insertion_point(destructor:proto.chunk)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void chunk::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- if (this != internal_default_instance()) delete chunk_pos_;
+ _impl_.blocks_.~RepeatedField();
+ if (this != internal_default_instance()) delete _impl_.chunk_pos_;
}
-void chunk::ArenaDtor(void* object) {
- chunk* _this = reinterpret_cast< chunk* >(object);
- (void)_this;
-}
-void chunk::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void chunk::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void chunk::Clear() {
@@ -3647,19 +4876,19 @@ void chunk::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- blocks_.Clear();
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ _impl_.blocks_.Clear();
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* chunk::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* chunk::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .proto.coords chunk_pos = 1;
case 1:
@@ -3711,15 +4940,14 @@ uint8_t* chunk::_InternalSerialize(
// .proto.coords chunk_pos = 1;
if (this->_internal_has_chunk_pos()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 1, _Internal::chunk_pos(this), target, stream);
+ InternalWriteMessage(1, _Internal::chunk_pos(this),
+ _Internal::chunk_pos(this).GetCachedSize(), target, stream);
}
// repeated uint32 blocks = 2 [packed = true];
{
- int byte_size = _blocks_cached_byte_size_.load(std::memory_order_relaxed);
+ int byte_size = _impl_._blocks_cached_byte_size_.load(std::memory_order_relaxed);
if (byte_size > 0) {
target = stream->WriteUInt32Packed(
2, _internal_blocks(), byte_size, target);
@@ -3727,7 +4955,7 @@ uint8_t* chunk::_InternalSerialize(
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.chunk)
@@ -3744,15 +4972,14 @@ size_t chunk::ByteSizeLong() const {
// repeated uint32 blocks = 2 [packed = true];
{
- size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- UInt32Size(this->blocks_);
+ size_t data_size = ::_pbi::WireFormatLite::
+ UInt32Size(this->_impl_.blocks_);
if (data_size > 0) {
total_size += 1 +
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
- static_cast<int32_t>(data_size));
+ ::_pbi::WireFormatLite::Int32Size(static_cast<int32_t>(data_size));
}
- int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
- _blocks_cached_byte_size_.store(cached_size,
+ int cached_size = ::_pbi::ToCachedSize(data_size);
+ _impl_._blocks_cached_byte_size_.store(cached_size,
std::memory_order_relaxed);
total_size += data_size;
}
@@ -3761,36 +4988,33 @@ size_t chunk::ByteSizeLong() const {
if (this->_internal_has_chunk_pos()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *chunk_pos_);
+ *_impl_.chunk_pos_);
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData chunk::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
chunk::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*chunk::GetClassData() const { return &_class_data_; }
-void chunk::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<chunk *>(to)->MergeFrom(
- static_cast<const chunk &>(from));
-}
-
-void chunk::MergeFrom(const chunk& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.chunk)
- GOOGLE_DCHECK_NE(&from, this);
+void chunk::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<chunk*>(&to_msg);
+ auto& from = static_cast<const chunk&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.chunk)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
- blocks_.MergeFrom(from.blocks_);
+ _this->_impl_.blocks_.MergeFrom(from._impl_.blocks_);
if (from._internal_has_chunk_pos()) {
- _internal_mutable_chunk_pos()->::proto::coords::MergeFrom(from._internal_chunk_pos());
+ _this->_internal_mutable_chunk_pos()->::proto::coords::MergeFrom(
+ from._internal_chunk_pos());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void chunk::CopyFrom(const chunk& from) {
@@ -3807,14 +5031,14 @@ bool chunk::IsInitialized() const {
void chunk::InternalSwap(chunk* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
- blocks_.InternalSwap(&other->blocks_);
- swap(chunk_pos_, other->chunk_pos_);
+ _impl_.blocks_.InternalSwap(&other->_impl_.blocks_);
+ swap(_impl_.chunk_pos_, other->_impl_.chunk_pos_);
}
::PROTOBUF_NAMESPACE_ID::Metadata chunk::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[13]);
+ file_level_metadata_net_2eproto[17]);
}
// ===================================================================
@@ -3827,66 +5051,67 @@ class add_block::_Internal {
const ::proto::coords&
add_block::_Internal::chunk_pos(const add_block* msg) {
- return *msg->chunk_pos_;
+ return *msg->_impl_.chunk_pos_;
}
const ::proto::ivec3&
add_block::_Internal::block_pos(const add_block* msg) {
- return *msg->block_pos_;
+ return *msg->_impl_.block_pos_;
}
add_block::add_block(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.add_block)
}
add_block::add_block(const add_block& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ add_block* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , decltype(_impl_.block_pos_){nullptr}
+ , decltype(_impl_.active_item_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_chunk_pos()) {
- chunk_pos_ = new ::proto::coords(*from.chunk_pos_);
- } else {
- chunk_pos_ = nullptr;
+ _this->_impl_.chunk_pos_ = new ::proto::coords(*from._impl_.chunk_pos_);
}
if (from._internal_has_block_pos()) {
- block_pos_ = new ::proto::ivec3(*from.block_pos_);
- } else {
- block_pos_ = nullptr;
+ _this->_impl_.block_pos_ = new ::proto::ivec3(*from._impl_.block_pos_);
}
- block_ = from.block_;
+ _this->_impl_.active_item_ = from._impl_.active_item_;
// @@protoc_insertion_point(copy_constructor:proto.add_block)
}
-inline void add_block::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&chunk_pos_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&block_) -
- reinterpret_cast<char*>(&chunk_pos_)) + sizeof(block_));
+inline void add_block::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , decltype(_impl_.block_pos_){nullptr}
+ , decltype(_impl_.active_item_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
add_block::~add_block() {
// @@protoc_insertion_point(destructor:proto.add_block)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void add_block::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- if (this != internal_default_instance()) delete chunk_pos_;
- if (this != internal_default_instance()) delete block_pos_;
+ if (this != internal_default_instance()) delete _impl_.chunk_pos_;
+ if (this != internal_default_instance()) delete _impl_.block_pos_;
}
-void add_block::ArenaDtor(void* object) {
- add_block* _this = reinterpret_cast< add_block* >(object);
- (void)_this;
-}
-void add_block::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void add_block::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void add_block::Clear() {
@@ -3895,23 +5120,23 @@ void add_block::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
- if (GetArenaForAllocation() == nullptr && block_pos_ != nullptr) {
- delete block_pos_;
+ _impl_.chunk_pos_ = nullptr;
+ if (GetArenaForAllocation() == nullptr && _impl_.block_pos_ != nullptr) {
+ delete _impl_.block_pos_;
}
- block_pos_ = nullptr;
- block_ = 0u;
+ _impl_.block_pos_ = nullptr;
+ _impl_.active_item_ = 0u;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* add_block::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* add_block::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .proto.coords chunk_pos = 1;
case 1:
@@ -3929,10 +5154,10 @@ const char* add_block::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::
} else
goto handle_unusual;
continue;
- // uint32 block = 3;
+ // uint32 active_item = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
- block_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ _impl_.active_item_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -3968,28 +5193,26 @@ uint8_t* add_block::_InternalSerialize(
// .proto.coords chunk_pos = 1;
if (this->_internal_has_chunk_pos()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 1, _Internal::chunk_pos(this), target, stream);
+ InternalWriteMessage(1, _Internal::chunk_pos(this),
+ _Internal::chunk_pos(this).GetCachedSize(), target, stream);
}
// .proto.ivec3 block_pos = 2;
if (this->_internal_has_block_pos()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 2, _Internal::block_pos(this), target, stream);
+ InternalWriteMessage(2, _Internal::block_pos(this),
+ _Internal::block_pos(this).GetCachedSize(), target, stream);
}
- // uint32 block = 3;
- if (this->_internal_block() != 0) {
+ // uint32 active_item = 3;
+ if (this->_internal_active_item() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(3, this->_internal_block(), target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_active_item(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.add_block)
@@ -4008,53 +5231,51 @@ size_t add_block::ByteSizeLong() const {
if (this->_internal_has_chunk_pos()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *chunk_pos_);
+ *_impl_.chunk_pos_);
}
// .proto.ivec3 block_pos = 2;
if (this->_internal_has_block_pos()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *block_pos_);
+ *_impl_.block_pos_);
}
- // uint32 block = 3;
- if (this->_internal_block() != 0) {
- total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_block());
+ // uint32 active_item = 3;
+ if (this->_internal_active_item() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_active_item());
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData add_block::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
add_block::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*add_block::GetClassData() const { return &_class_data_; }
-void add_block::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<add_block *>(to)->MergeFrom(
- static_cast<const add_block &>(from));
-}
-
-void add_block::MergeFrom(const add_block& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.add_block)
- GOOGLE_DCHECK_NE(&from, this);
+void add_block::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<add_block*>(&to_msg);
+ auto& from = static_cast<const add_block&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.add_block)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_chunk_pos()) {
- _internal_mutable_chunk_pos()->::proto::coords::MergeFrom(from._internal_chunk_pos());
+ _this->_internal_mutable_chunk_pos()->::proto::coords::MergeFrom(
+ from._internal_chunk_pos());
}
if (from._internal_has_block_pos()) {
- _internal_mutable_block_pos()->::proto::ivec3::MergeFrom(from._internal_block_pos());
+ _this->_internal_mutable_block_pos()->::proto::ivec3::MergeFrom(
+ from._internal_block_pos());
}
- if (from._internal_block() != 0) {
- _internal_set_block(from._internal_block());
+ if (from._internal_active_item() != 0) {
+ _this->_internal_set_active_item(from._internal_active_item());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void add_block::CopyFrom(const add_block& from) {
@@ -4072,17 +5293,17 @@ void add_block::InternalSwap(add_block* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(add_block, block_)
- + sizeof(add_block::block_)
- - PROTOBUF_FIELD_OFFSET(add_block, chunk_pos_)>(
- reinterpret_cast<char*>(&chunk_pos_),
- reinterpret_cast<char*>(&other->chunk_pos_));
+ PROTOBUF_FIELD_OFFSET(add_block, _impl_.active_item_)
+ + sizeof(add_block::_impl_.active_item_)
+ - PROTOBUF_FIELD_OFFSET(add_block, _impl_.chunk_pos_)>(
+ reinterpret_cast<char*>(&_impl_.chunk_pos_),
+ reinterpret_cast<char*>(&other->_impl_.chunk_pos_));
}
::PROTOBUF_NAMESPACE_ID::Metadata add_block::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[14]);
+ file_level_metadata_net_2eproto[18]);
}
// ===================================================================
@@ -4095,65 +5316,64 @@ class remove_block::_Internal {
const ::proto::coords&
remove_block::_Internal::chunk_pos(const remove_block* msg) {
- return *msg->chunk_pos_;
+ return *msg->_impl_.chunk_pos_;
}
const ::proto::ivec3&
remove_block::_Internal::block_pos(const remove_block* msg) {
- return *msg->block_pos_;
+ return *msg->_impl_.block_pos_;
}
remove_block::remove_block(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.remove_block)
}
remove_block::remove_block(const remove_block& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ remove_block* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , decltype(_impl_.block_pos_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_chunk_pos()) {
- chunk_pos_ = new ::proto::coords(*from.chunk_pos_);
- } else {
- chunk_pos_ = nullptr;
+ _this->_impl_.chunk_pos_ = new ::proto::coords(*from._impl_.chunk_pos_);
}
if (from._internal_has_block_pos()) {
- block_pos_ = new ::proto::ivec3(*from.block_pos_);
- } else {
- block_pos_ = nullptr;
+ _this->_impl_.block_pos_ = new ::proto::ivec3(*from._impl_.block_pos_);
}
// @@protoc_insertion_point(copy_constructor:proto.remove_block)
}
-inline void remove_block::SharedCtor() {
-::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
- reinterpret_cast<char*>(&chunk_pos_) - reinterpret_cast<char*>(this)),
- 0, static_cast<size_t>(reinterpret_cast<char*>(&block_pos_) -
- reinterpret_cast<char*>(&chunk_pos_)) + sizeof(block_pos_));
+inline void remove_block::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.chunk_pos_){nullptr}
+ , decltype(_impl_.block_pos_){nullptr}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
}
remove_block::~remove_block() {
// @@protoc_insertion_point(destructor:proto.remove_block)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void remove_block::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- if (this != internal_default_instance()) delete chunk_pos_;
- if (this != internal_default_instance()) delete block_pos_;
+ if (this != internal_default_instance()) delete _impl_.chunk_pos_;
+ if (this != internal_default_instance()) delete _impl_.block_pos_;
}
-void remove_block::ArenaDtor(void* object) {
- remove_block* _this = reinterpret_cast< remove_block* >(object);
- (void)_this;
-}
-void remove_block::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void remove_block::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void remove_block::Clear() {
@@ -4162,22 +5382,22 @@ void remove_block::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
- if (GetArenaForAllocation() == nullptr && block_pos_ != nullptr) {
- delete block_pos_;
+ _impl_.chunk_pos_ = nullptr;
+ if (GetArenaForAllocation() == nullptr && _impl_.block_pos_ != nullptr) {
+ delete _impl_.block_pos_;
}
- block_pos_ = nullptr;
+ _impl_.block_pos_ = nullptr;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* remove_block::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* remove_block::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .proto.coords chunk_pos = 1;
case 1:
@@ -4226,22 +5446,20 @@ uint8_t* remove_block::_InternalSerialize(
// .proto.coords chunk_pos = 1;
if (this->_internal_has_chunk_pos()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 1, _Internal::chunk_pos(this), target, stream);
+ InternalWriteMessage(1, _Internal::chunk_pos(this),
+ _Internal::chunk_pos(this).GetCachedSize(), target, stream);
}
// .proto.ivec3 block_pos = 2;
if (this->_internal_has_block_pos()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 2, _Internal::block_pos(this), target, stream);
+ InternalWriteMessage(2, _Internal::block_pos(this),
+ _Internal::block_pos(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.remove_block)
@@ -4260,45 +5478,43 @@ size_t remove_block::ByteSizeLong() const {
if (this->_internal_has_chunk_pos()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *chunk_pos_);
+ *_impl_.chunk_pos_);
}
// .proto.ivec3 block_pos = 2;
if (this->_internal_has_block_pos()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *block_pos_);
+ *_impl_.block_pos_);
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData remove_block::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
remove_block::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*remove_block::GetClassData() const { return &_class_data_; }
-void remove_block::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<remove_block *>(to)->MergeFrom(
- static_cast<const remove_block &>(from));
-}
-
-void remove_block::MergeFrom(const remove_block& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.remove_block)
- GOOGLE_DCHECK_NE(&from, this);
+void remove_block::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<remove_block*>(&to_msg);
+ auto& from = static_cast<const remove_block&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.remove_block)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_chunk_pos()) {
- _internal_mutable_chunk_pos()->::proto::coords::MergeFrom(from._internal_chunk_pos());
+ _this->_internal_mutable_chunk_pos()->::proto::coords::MergeFrom(
+ from._internal_chunk_pos());
}
if (from._internal_has_block_pos()) {
- _internal_mutable_block_pos()->::proto::ivec3::MergeFrom(from._internal_block_pos());
+ _this->_internal_mutable_block_pos()->::proto::ivec3::MergeFrom(
+ from._internal_block_pos());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void remove_block::CopyFrom(const remove_block& from) {
@@ -4316,17 +5532,17 @@ void remove_block::InternalSwap(remove_block* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
- PROTOBUF_FIELD_OFFSET(remove_block, block_pos_)
- + sizeof(remove_block::block_pos_)
- - PROTOBUF_FIELD_OFFSET(remove_block, chunk_pos_)>(
- reinterpret_cast<char*>(&chunk_pos_),
- reinterpret_cast<char*>(&other->chunk_pos_));
+ PROTOBUF_FIELD_OFFSET(remove_block, _impl_.block_pos_)
+ + sizeof(remove_block::_impl_.block_pos_)
+ - PROTOBUF_FIELD_OFFSET(remove_block, _impl_.chunk_pos_)>(
+ reinterpret_cast<char*>(&_impl_.chunk_pos_),
+ reinterpret_cast<char*>(&other->_impl_.chunk_pos_));
}
::PROTOBUF_NAMESPACE_ID::Metadata remove_block::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[15]);
+ file_level_metadata_net_2eproto[19]);
}
// ===================================================================
@@ -4338,55 +5554,61 @@ class server_message::_Internal {
server_message::server_message(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.server_message)
}
server_message::server_message(const server_message& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ server_message* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.message_){}
+ , decltype(_impl_.fatal_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.message_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- message_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ _impl_.message_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_message().empty()) {
- message_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_message(),
- GetArenaForAllocation());
+ _this->_impl_.message_.Set(from._internal_message(),
+ _this->GetArenaForAllocation());
}
- fatal_ = from.fatal_;
+ _this->_impl_.fatal_ = from._impl_.fatal_;
// @@protoc_insertion_point(copy_constructor:proto.server_message)
}
-inline void server_message::SharedCtor() {
-message_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
-#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- message_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
-#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
-fatal_ = false;
+inline void server_message::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.message_){}
+ , decltype(_impl_.fatal_){false}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+ _impl_.message_.InitDefault();
+ #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+ _impl_.message_.Set("", GetArenaForAllocation());
+ #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
server_message::~server_message() {
// @@protoc_insertion_point(destructor:proto.server_message)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void server_message::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
- message_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+ _impl_.message_.Destroy();
}
-void server_message::ArenaDtor(void* object) {
- server_message* _this = reinterpret_cast< server_message* >(object);
- (void)_this;
-}
-void server_message::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void server_message::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void server_message::Clear() {
@@ -4395,31 +5617,31 @@ void server_message::Clear() {
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- message_.ClearToEmpty();
- fatal_ = false;
+ _impl_.message_.ClearToEmpty();
+ _impl_.fatal_ = false;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* server_message::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* server_message::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// string message = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_message();
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
- CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "proto.server_message.message"));
+ ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
+ CHK_(::_pbi::VerifyUTF8(str, "proto.server_message.message"));
} else
goto handle_unusual;
continue;
// bool fatal = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
- fatal_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ _impl_.fatal_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -4466,11 +5688,11 @@ uint8_t* server_message::_InternalSerialize(
// bool fatal = 2;
if (this->_internal_fatal() != 0) {
target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_fatal(), target);
+ target = ::_pbi::WireFormatLite::WriteBoolToArray(2, this->_internal_fatal(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.server_message)
@@ -4497,35 +5719,31 @@ size_t server_message::ByteSizeLong() const {
total_size += 1 + 1;
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData server_message::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
server_message::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*server_message::GetClassData() const { return &_class_data_; }
-void server_message::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<server_message *>(to)->MergeFrom(
- static_cast<const server_message &>(from));
-}
-
-void server_message::MergeFrom(const server_message& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.server_message)
- GOOGLE_DCHECK_NE(&from, this);
+void server_message::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<server_message*>(&to_msg);
+ auto& from = static_cast<const server_message&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.server_message)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (!from._internal_message().empty()) {
- _internal_set_message(from._internal_message());
+ _this->_internal_set_message(from._internal_message());
}
if (from._internal_fatal() != 0) {
- _internal_set_fatal(from._internal_fatal());
+ _this->_internal_set_fatal(from._internal_fatal());
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void server_message::CopyFrom(const server_message& from) {
@@ -4545,17 +5763,853 @@ void server_message::InternalSwap(server_message* other) {
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- &message_, lhs_arena,
- &other->message_, rhs_arena
+ &_impl_.message_, lhs_arena,
+ &other->_impl_.message_, rhs_arena
);
- swap(fatal_, other->fatal_);
+ swap(_impl_.fatal_, other->_impl_.fatal_);
}
::PROTOBUF_NAMESPACE_ID::Metadata server_message::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[16]);
+ file_level_metadata_net_2eproto[20]);
+}
+
+// ===================================================================
+
+class item_swap::_Internal {
+ public:
+};
+
+item_swap::item_swap(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.item_swap)
+}
+item_swap::item_swap(const item_swap& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ item_swap* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.index_a_){}
+ , decltype(_impl_.index_b_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ ::memcpy(&_impl_.index_a_, &from._impl_.index_a_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.index_b_) -
+ reinterpret_cast<char*>(&_impl_.index_a_)) + sizeof(_impl_.index_b_));
+ // @@protoc_insertion_point(copy_constructor:proto.item_swap)
+}
+
+inline void item_swap::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.index_a_){0u}
+ , decltype(_impl_.index_b_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+}
+
+item_swap::~item_swap() {
+ // @@protoc_insertion_point(destructor:proto.item_swap)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
+ SharedDtor();
+}
+
+inline void item_swap::SharedDtor() {
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
+}
+
+void item_swap::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
+}
+
+void item_swap::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.item_swap)
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ ::memset(&_impl_.index_a_, 0, static_cast<size_t>(
+ reinterpret_cast<char*>(&_impl_.index_b_) -
+ reinterpret_cast<char*>(&_impl_.index_a_)) + sizeof(_impl_.index_b_));
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* item_swap::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ uint32_t tag;
+ ptr = ::_pbi::ReadTag(ptr, &tag);
+ switch (tag >> 3) {
+ // uint32 index_a = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
+ _impl_.index_a_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // uint32 index_b = 2;
+ case 2:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
+ _impl_.index_b_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ default:
+ goto handle_unusual;
+ } // switch
+ handle_unusual:
+ if ((tag == 0) || ((tag & 7) == 4)) {
+ CHK_(ptr);
+ ctx->SetLastTag(tag);
+ goto message_done;
+ }
+ ptr = UnknownFieldParse(
+ tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ } // while
+message_done:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto message_done;
+#undef CHK_
+}
+
+uint8_t* item_swap::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:proto.item_swap)
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // uint32 index_a = 1;
+ if (this->_internal_index_a() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index_a(), target);
+ }
+
+ // uint32 index_b = 2;
+ if (this->_internal_index_b() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_index_b(), target);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:proto.item_swap)
+ return target;
+}
+
+size_t item_swap::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.item_swap)
+ size_t total_size = 0;
+
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // uint32 index_a = 1;
+ if (this->_internal_index_a() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_index_a());
+ }
+
+ // uint32 index_b = 2;
+ if (this->_internal_index_b() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_index_b());
+ }
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
+}
+
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData item_swap::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ item_swap::MergeImpl
+};
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*item_swap::GetClassData() const { return &_class_data_; }
+
+
+void item_swap::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<item_swap*>(&to_msg);
+ auto& from = static_cast<const item_swap&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.item_swap)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ if (from._internal_index_a() != 0) {
+ _this->_internal_set_index_a(from._internal_index_a());
+ }
+ if (from._internal_index_b() != 0) {
+ _this->_internal_set_index_b(from._internal_index_b());
+ }
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+}
+
+void item_swap::CopyFrom(const item_swap& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.item_swap)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool item_swap::IsInitialized() const {
+ return true;
+}
+
+void item_swap::InternalSwap(item_swap* other) {
+ using std::swap;
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::memswap<
+ PROTOBUF_FIELD_OFFSET(item_swap, _impl_.index_b_)
+ + sizeof(item_swap::_impl_.index_b_)
+ - PROTOBUF_FIELD_OFFSET(item_swap, _impl_.index_a_)>(
+ reinterpret_cast<char*>(&_impl_.index_a_),
+ reinterpret_cast<char*>(&other->_impl_.index_a_));
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata item_swap::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
+ &descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
+ file_level_metadata_net_2eproto[21]);
+}
+
+// ===================================================================
+
+class item_use::_Internal {
+ public:
+};
+
+item_use::item_use(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.item_use)
+}
+item_use::item_use(const item_use& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ item_use* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.index_){}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_impl_.index_ = from._impl_.index_;
+ // @@protoc_insertion_point(copy_constructor:proto.item_use)
+}
+
+inline void item_use::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.index_){0u}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+}
+
+item_use::~item_use() {
+ // @@protoc_insertion_point(destructor:proto.item_use)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
+ SharedDtor();
+}
+
+inline void item_use::SharedDtor() {
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
+}
+
+void item_use::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
+}
+
+void item_use::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.item_use)
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ _impl_.index_ = 0u;
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* item_use::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ uint32_t tag;
+ ptr = ::_pbi::ReadTag(ptr, &tag);
+ switch (tag >> 3) {
+ // uint32 index = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
+ _impl_.index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ default:
+ goto handle_unusual;
+ } // switch
+ handle_unusual:
+ if ((tag == 0) || ((tag & 7) == 4)) {
+ CHK_(ptr);
+ ctx->SetLastTag(tag);
+ goto message_done;
+ }
+ ptr = UnknownFieldParse(
+ tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ } // while
+message_done:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto message_done;
+#undef CHK_
+}
+
+uint8_t* item_use::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:proto.item_use)
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // uint32 index = 1;
+ if (this->_internal_index() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_index(), target);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:proto.item_use)
+ return target;
+}
+
+size_t item_use::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.item_use)
+ size_t total_size = 0;
+
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // uint32 index = 1;
+ if (this->_internal_index() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_index());
+ }
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
+}
+
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData item_use::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ item_use::MergeImpl
+};
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*item_use::GetClassData() const { return &_class_data_; }
+
+
+void item_use::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<item_use*>(&to_msg);
+ auto& from = static_cast<const item_use&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.item_use)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ if (from._internal_index() != 0) {
+ _this->_internal_set_index(from._internal_index());
+ }
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+}
+
+void item_use::CopyFrom(const item_use& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.item_use)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool item_use::IsInitialized() const {
+ return true;
+}
+
+void item_use::InternalSwap(item_use* other) {
+ using std::swap;
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ swap(_impl_.index_, other->_impl_.index_);
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata item_use::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
+ &descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
+ file_level_metadata_net_2eproto[22]);
+}
+
+// ===================================================================
+
+class item_update::_Internal {
+ public:
+};
+
+item_update::item_update(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.item_update)
+}
+item_update::item_update(const item_update& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ item_update* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.items_){from._impl_.items_}
+ , /*decltype(_impl_._cached_size_)*/{}};
+
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ // @@protoc_insertion_point(copy_constructor:proto.item_update)
+}
+
+inline void item_update::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.items_){arena}
+ , /*decltype(_impl_._cached_size_)*/{}
+ };
+}
+
+item_update::~item_update() {
+ // @@protoc_insertion_point(destructor:proto.item_update)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
+ SharedDtor();
+}
+
+inline void item_update::SharedDtor() {
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
+ _impl_.items_.~RepeatedPtrField();
+}
+
+void item_update::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
+}
+
+void item_update::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.item_update)
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ _impl_.items_.Clear();
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* item_update::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ uint32_t tag;
+ ptr = ::_pbi::ReadTag(ptr, &tag);
+ switch (tag >> 3) {
+ // repeated .proto.item items = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
+ ptr -= 1;
+ do {
+ ptr += 1;
+ ptr = ctx->ParseMessage(_internal_add_items(), ptr);
+ CHK_(ptr);
+ if (!ctx->DataAvailable(ptr)) break;
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
+ } else
+ goto handle_unusual;
+ continue;
+ default:
+ goto handle_unusual;
+ } // switch
+ handle_unusual:
+ if ((tag == 0) || ((tag & 7) == 4)) {
+ CHK_(ptr);
+ ctx->SetLastTag(tag);
+ goto message_done;
+ }
+ ptr = UnknownFieldParse(
+ tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ } // while
+message_done:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto message_done;
+#undef CHK_
+}
+
+uint8_t* item_update::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:proto.item_update)
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // repeated .proto.item items = 1;
+ for (unsigned i = 0,
+ n = static_cast<unsigned>(this->_internal_items_size()); i < n; i++) {
+ const auto& repfield = this->_internal_items(i);
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:proto.item_update)
+ return target;
+}
+
+size_t item_update::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.item_update)
+ size_t total_size = 0;
+
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // repeated .proto.item items = 1;
+ total_size += 1UL * this->_internal_items_size();
+ for (const auto& msg : this->_impl_.items_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
+ }
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
+}
+
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData item_update::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ item_update::MergeImpl
+};
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*item_update::GetClassData() const { return &_class_data_; }
+
+
+void item_update::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<item_update*>(&to_msg);
+ auto& from = static_cast<const item_update&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.item_update)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ _this->_impl_.items_.MergeFrom(from._impl_.items_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+}
+
+void item_update::CopyFrom(const item_update& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.item_update)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool item_update::IsInitialized() const {
+ return true;
+}
+
+void item_update::InternalSwap(item_update* other) {
+ using std::swap;
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ _impl_.items_.InternalSwap(&other->_impl_.items_);
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata item_update::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
+ &descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
+ file_level_metadata_net_2eproto[23]);
+}
+
+// ===================================================================
+
+class animate_update::_Internal {
+ public:
+ using HasBits = decltype(std::declval<animate_update>()._impl_._has_bits_);
+ static const ::proto::animate& animate(const animate_update* msg);
+ static void set_has_sequence(HasBits* has_bits) {
+ (*has_bits)[0] |= 1u;
+ }
+};
+
+const ::proto::animate&
+animate_update::_Internal::animate(const animate_update* msg) {
+ return *msg->_impl_.animate_;
+}
+animate_update::animate_update(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
+ SharedCtor(arena, is_message_owned);
+ // @@protoc_insertion_point(arena_constructor:proto.animate_update)
+}
+animate_update::animate_update(const animate_update& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ animate_update* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_._has_bits_){from._impl_._has_bits_}
+ , /*decltype(_impl_._cached_size_)*/{}
+ , decltype(_impl_.animate_){nullptr}
+ , decltype(_impl_.tick_){}
+ , decltype(_impl_.sequence_){}};
+
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ if (from._internal_has_animate()) {
+ _this->_impl_.animate_ = new ::proto::animate(*from._impl_.animate_);
+ }
+ ::memcpy(&_impl_.tick_, &from._impl_.tick_,
+ static_cast<size_t>(reinterpret_cast<char*>(&_impl_.sequence_) -
+ reinterpret_cast<char*>(&_impl_.tick_)) + sizeof(_impl_.sequence_));
+ // @@protoc_insertion_point(copy_constructor:proto.animate_update)
+}
+
+inline void animate_update::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_._has_bits_){}
+ , /*decltype(_impl_._cached_size_)*/{}
+ , decltype(_impl_.animate_){nullptr}
+ , decltype(_impl_.tick_){0u}
+ , decltype(_impl_.sequence_){0u}
+ };
+}
+
+animate_update::~animate_update() {
+ // @@protoc_insertion_point(destructor:proto.animate_update)
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
+ SharedDtor();
+}
+
+inline void animate_update::SharedDtor() {
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
+ if (this != internal_default_instance()) delete _impl_.animate_;
+}
+
+void animate_update::SetCachedSize(int size) const {
+ _impl_._cached_size_.Set(size);
+}
+
+void animate_update::Clear() {
+// @@protoc_insertion_point(message_clear_start:proto.animate_update)
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ if (GetArenaForAllocation() == nullptr && _impl_.animate_ != nullptr) {
+ delete _impl_.animate_;
+ }
+ _impl_.animate_ = nullptr;
+ _impl_.tick_ = 0u;
+ _impl_.sequence_ = 0u;
+ _impl_._has_bits_.Clear();
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* animate_update::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ _Internal::HasBits has_bits{};
+ while (!ctx->Done(&ptr)) {
+ uint32_t tag;
+ ptr = ::_pbi::ReadTag(ptr, &tag);
+ switch (tag >> 3) {
+ // .proto.animate animate = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
+ ptr = ctx->ParseMessage(_internal_mutable_animate(), ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // uint32 tick = 2;
+ case 2:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
+ _impl_.tick_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // optional uint32 sequence = 3;
+ case 3:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
+ _Internal::set_has_sequence(&has_bits);
+ _impl_.sequence_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ default:
+ goto handle_unusual;
+ } // switch
+ handle_unusual:
+ if ((tag == 0) || ((tag & 7) == 4)) {
+ CHK_(ptr);
+ ctx->SetLastTag(tag);
+ goto message_done;
+ }
+ ptr = UnknownFieldParse(
+ tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ } // while
+message_done:
+ _impl_._has_bits_.Or(has_bits);
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto message_done;
+#undef CHK_
+}
+
+uint8_t* animate_update::_InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:proto.animate_update)
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // .proto.animate animate = 1;
+ if (this->_internal_has_animate()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(1, _Internal::animate(this),
+ _Internal::animate(this).GetCachedSize(), target, stream);
+ }
+
+ // uint32 tick = 2;
+ if (this->_internal_tick() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_tick(), target);
+ }
+
+ // optional uint32 sequence = 3;
+ if (_internal_has_sequence()) {
+ target = stream->EnsureSpace(target);
+ target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_sequence(), target);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:proto.animate_update)
+ return target;
+}
+
+size_t animate_update::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:proto.animate_update)
+ size_t total_size = 0;
+
+ uint32_t cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // .proto.animate animate = 1;
+ if (this->_internal_has_animate()) {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
+ *_impl_.animate_);
+ }
+
+ // uint32 tick = 2;
+ if (this->_internal_tick() != 0) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_tick());
+ }
+
+ // optional uint32 sequence = 3;
+ cached_has_bits = _impl_._has_bits_[0];
+ if (cached_has_bits & 0x00000001u) {
+ total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_sequence());
+ }
+
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
+}
+
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData animate_update::_class_data_ = {
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
+ animate_update::MergeImpl
+};
+const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*animate_update::GetClassData() const { return &_class_data_; }
+
+
+void animate_update::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<animate_update*>(&to_msg);
+ auto& from = static_cast<const animate_update&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.animate_update)
+ GOOGLE_DCHECK_NE(&from, _this);
+ uint32_t cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ if (from._internal_has_animate()) {
+ _this->_internal_mutable_animate()->::proto::animate::MergeFrom(
+ from._internal_animate());
+ }
+ if (from._internal_tick() != 0) {
+ _this->_internal_set_tick(from._internal_tick());
+ }
+ if (from._internal_has_sequence()) {
+ _this->_internal_set_sequence(from._internal_sequence());
+ }
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+}
+
+void animate_update::CopyFrom(const animate_update& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:proto.animate_update)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool animate_update::IsInitialized() const {
+ return true;
+}
+
+void animate_update::InternalSwap(animate_update* other) {
+ using std::swap;
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
+ ::PROTOBUF_NAMESPACE_ID::internal::memswap<
+ PROTOBUF_FIELD_OFFSET(animate_update, _impl_.sequence_)
+ + sizeof(animate_update::_impl_.sequence_)
+ - PROTOBUF_FIELD_OFFSET(animate_update, _impl_.animate_)>(
+ reinterpret_cast<char*>(&_impl_.animate_),
+ reinterpret_cast<char*>(&other->_impl_.animate_));
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata animate_update::GetMetadata() const {
+ return ::_pbi::AssignDescriptors(
+ &descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
+ file_level_metadata_net_2eproto[24]);
}
// ===================================================================
@@ -4565,8 +6619,8 @@ class packet::_Internal {
static const ::proto::auth& auth_packet(const packet* msg);
static const ::proto::init& init_packet(const packet* msg);
static const ::proto::move& move_packet(const packet* msg);
- static const ::proto::player& player_packet(const packet* msg);
- static const ::proto::remove_player& remove_player_packet(const packet* msg);
+ static const ::proto::animate_update& animate_update_packet(const packet* msg);
+ static const ::proto::remove_entity& remove_entity_packet(const packet* msg);
static const ::proto::say& say_packet(const packet* msg);
static const ::proto::hear_player& hear_player_packet(const packet* msg);
static const ::proto::request_chunk& request_chunk_packet(const packet* msg);
@@ -4575,72 +6629,87 @@ class packet::_Internal {
static const ::proto::add_block& add_block_packet(const packet* msg);
static const ::proto::remove_block& remove_block_packet(const packet* msg);
static const ::proto::server_message& server_message_packet(const packet* msg);
+ static const ::proto::item_swap& item_swap_packet(const packet* msg);
+ static const ::proto::item_use& item_use_packet(const packet* msg);
+ static const ::proto::item_update& item_update_packet(const packet* msg);
};
const ::proto::auth&
packet::_Internal::auth_packet(const packet* msg) {
- return *msg->contents_.auth_packet_;
+ return *msg->_impl_.contents_.auth_packet_;
}
const ::proto::init&
packet::_Internal::init_packet(const packet* msg) {
- return *msg->contents_.init_packet_;
+ return *msg->_impl_.contents_.init_packet_;
}
const ::proto::move&
packet::_Internal::move_packet(const packet* msg) {
- return *msg->contents_.move_packet_;
+ return *msg->_impl_.contents_.move_packet_;
}
-const ::proto::player&
-packet::_Internal::player_packet(const packet* msg) {
- return *msg->contents_.player_packet_;
+const ::proto::animate_update&
+packet::_Internal::animate_update_packet(const packet* msg) {
+ return *msg->_impl_.contents_.animate_update_packet_;
}
-const ::proto::remove_player&
-packet::_Internal::remove_player_packet(const packet* msg) {
- return *msg->contents_.remove_player_packet_;
+const ::proto::remove_entity&
+packet::_Internal::remove_entity_packet(const packet* msg) {
+ return *msg->_impl_.contents_.remove_entity_packet_;
}
const ::proto::say&
packet::_Internal::say_packet(const packet* msg) {
- return *msg->contents_.say_packet_;
+ return *msg->_impl_.contents_.say_packet_;
}
const ::proto::hear_player&
packet::_Internal::hear_player_packet(const packet* msg) {
- return *msg->contents_.hear_player_packet_;
+ return *msg->_impl_.contents_.hear_player_packet_;
}
const ::proto::request_chunk&
packet::_Internal::request_chunk_packet(const packet* msg) {
- return *msg->contents_.request_chunk_packet_;
+ return *msg->_impl_.contents_.request_chunk_packet_;
}
const ::proto::chunk&
packet::_Internal::chunk_packet(const packet* msg) {
- return *msg->contents_.chunk_packet_;
+ return *msg->_impl_.contents_.chunk_packet_;
}
const ::proto::remove_chunk&
packet::_Internal::remove_chunk_packet(const packet* msg) {
- return *msg->contents_.remove_chunk_packet_;
+ return *msg->_impl_.contents_.remove_chunk_packet_;
}
const ::proto::add_block&
packet::_Internal::add_block_packet(const packet* msg) {
- return *msg->contents_.add_block_packet_;
+ return *msg->_impl_.contents_.add_block_packet_;
}
const ::proto::remove_block&
packet::_Internal::remove_block_packet(const packet* msg) {
- return *msg->contents_.remove_block_packet_;
+ return *msg->_impl_.contents_.remove_block_packet_;
}
const ::proto::server_message&
packet::_Internal::server_message_packet(const packet* msg) {
- return *msg->contents_.server_message_packet_;
+ return *msg->_impl_.contents_.server_message_packet_;
+}
+const ::proto::item_swap&
+packet::_Internal::item_swap_packet(const packet* msg) {
+ return *msg->_impl_.contents_.item_swap_packet_;
+}
+const ::proto::item_use&
+packet::_Internal::item_use_packet(const packet* msg) {
+ return *msg->_impl_.contents_.item_use_packet_;
+}
+const ::proto::item_update&
+packet::_Internal::item_update_packet(const packet* msg) {
+ return *msg->_impl_.contents_.item_update_packet_;
}
void packet::set_allocated_auth_packet(::proto::auth* auth_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_contents();
if (auth_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::auth>::GetOwningArena(auth_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(auth_packet);
if (message_arena != submessage_arena) {
auth_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, auth_packet, submessage_arena);
}
set_has_auth_packet();
- contents_.auth_packet_ = auth_packet;
+ _impl_.contents_.auth_packet_ = auth_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.auth_packet)
}
@@ -4649,13 +6718,13 @@ void packet::set_allocated_init_packet(::proto::init* init_packet) {
clear_contents();
if (init_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::init>::GetOwningArena(init_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(init_packet);
if (message_arena != submessage_arena) {
init_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, init_packet, submessage_arena);
}
set_has_init_packet();
- contents_.init_packet_ = init_packet;
+ _impl_.contents_.init_packet_ = init_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.init_packet)
}
@@ -4664,58 +6733,58 @@ void packet::set_allocated_move_packet(::proto::move* move_packet) {
clear_contents();
if (move_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::move>::GetOwningArena(move_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(move_packet);
if (message_arena != submessage_arena) {
move_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, move_packet, submessage_arena);
}
set_has_move_packet();
- contents_.move_packet_ = move_packet;
+ _impl_.contents_.move_packet_ = move_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.move_packet)
}
-void packet::set_allocated_player_packet(::proto::player* player_packet) {
+void packet::set_allocated_animate_update_packet(::proto::animate_update* animate_update_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_contents();
- if (player_packet) {
+ if (animate_update_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::player>::GetOwningArena(player_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(animate_update_packet);
if (message_arena != submessage_arena) {
- player_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
- message_arena, player_packet, submessage_arena);
+ animate_update_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, animate_update_packet, submessage_arena);
}
- set_has_player_packet();
- contents_.player_packet_ = player_packet;
+ set_has_animate_update_packet();
+ _impl_.contents_.animate_update_packet_ = animate_update_packet;
}
- // @@protoc_insertion_point(field_set_allocated:proto.packet.player_packet)
+ // @@protoc_insertion_point(field_set_allocated:proto.packet.animate_update_packet)
}
-void packet::set_allocated_remove_player_packet(::proto::remove_player* remove_player_packet) {
+void packet::set_allocated_remove_entity_packet(::proto::remove_entity* remove_entity_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_contents();
- if (remove_player_packet) {
+ if (remove_entity_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::remove_player>::GetOwningArena(remove_player_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(remove_entity_packet);
if (message_arena != submessage_arena) {
- remove_player_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
- message_arena, remove_player_packet, submessage_arena);
+ remove_entity_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, remove_entity_packet, submessage_arena);
}
- set_has_remove_player_packet();
- contents_.remove_player_packet_ = remove_player_packet;
+ set_has_remove_entity_packet();
+ _impl_.contents_.remove_entity_packet_ = remove_entity_packet;
}
- // @@protoc_insertion_point(field_set_allocated:proto.packet.remove_player_packet)
+ // @@protoc_insertion_point(field_set_allocated:proto.packet.remove_entity_packet)
}
void packet::set_allocated_say_packet(::proto::say* say_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_contents();
if (say_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::say>::GetOwningArena(say_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(say_packet);
if (message_arena != submessage_arena) {
say_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, say_packet, submessage_arena);
}
set_has_say_packet();
- contents_.say_packet_ = say_packet;
+ _impl_.contents_.say_packet_ = say_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.say_packet)
}
@@ -4724,13 +6793,13 @@ void packet::set_allocated_hear_player_packet(::proto::hear_player* hear_player_
clear_contents();
if (hear_player_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::hear_player>::GetOwningArena(hear_player_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(hear_player_packet);
if (message_arena != submessage_arena) {
hear_player_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, hear_player_packet, submessage_arena);
}
set_has_hear_player_packet();
- contents_.hear_player_packet_ = hear_player_packet;
+ _impl_.contents_.hear_player_packet_ = hear_player_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.hear_player_packet)
}
@@ -4739,13 +6808,13 @@ void packet::set_allocated_request_chunk_packet(::proto::request_chunk* request_
clear_contents();
if (request_chunk_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::request_chunk>::GetOwningArena(request_chunk_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(request_chunk_packet);
if (message_arena != submessage_arena) {
request_chunk_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, request_chunk_packet, submessage_arena);
}
set_has_request_chunk_packet();
- contents_.request_chunk_packet_ = request_chunk_packet;
+ _impl_.contents_.request_chunk_packet_ = request_chunk_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.request_chunk_packet)
}
@@ -4754,13 +6823,13 @@ void packet::set_allocated_chunk_packet(::proto::chunk* chunk_packet) {
clear_contents();
if (chunk_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::chunk>::GetOwningArena(chunk_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(chunk_packet);
if (message_arena != submessage_arena) {
chunk_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, chunk_packet, submessage_arena);
}
set_has_chunk_packet();
- contents_.chunk_packet_ = chunk_packet;
+ _impl_.contents_.chunk_packet_ = chunk_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.chunk_packet)
}
@@ -4769,13 +6838,13 @@ void packet::set_allocated_remove_chunk_packet(::proto::remove_chunk* remove_chu
clear_contents();
if (remove_chunk_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::remove_chunk>::GetOwningArena(remove_chunk_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(remove_chunk_packet);
if (message_arena != submessage_arena) {
remove_chunk_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, remove_chunk_packet, submessage_arena);
}
set_has_remove_chunk_packet();
- contents_.remove_chunk_packet_ = remove_chunk_packet;
+ _impl_.contents_.remove_chunk_packet_ = remove_chunk_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.remove_chunk_packet)
}
@@ -4784,13 +6853,13 @@ void packet::set_allocated_add_block_packet(::proto::add_block* add_block_packet
clear_contents();
if (add_block_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::add_block>::GetOwningArena(add_block_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(add_block_packet);
if (message_arena != submessage_arena) {
add_block_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, add_block_packet, submessage_arena);
}
set_has_add_block_packet();
- contents_.add_block_packet_ = add_block_packet;
+ _impl_.contents_.add_block_packet_ = add_block_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.add_block_packet)
}
@@ -4799,13 +6868,13 @@ void packet::set_allocated_remove_block_packet(::proto::remove_block* remove_blo
clear_contents();
if (remove_block_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::remove_block>::GetOwningArena(remove_block_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(remove_block_packet);
if (message_arena != submessage_arena) {
remove_block_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, remove_block_packet, submessage_arena);
}
set_has_remove_block_packet();
- contents_.remove_block_packet_ = remove_block_packet;
+ _impl_.contents_.remove_block_packet_ = remove_block_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.remove_block_packet)
}
@@ -4814,80 +6883,156 @@ void packet::set_allocated_server_message_packet(::proto::server_message* server
clear_contents();
if (server_message_packet) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::server_message>::GetOwningArena(server_message_packet);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(server_message_packet);
if (message_arena != submessage_arena) {
server_message_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, server_message_packet, submessage_arena);
}
set_has_server_message_packet();
- contents_.server_message_packet_ = server_message_packet;
+ _impl_.contents_.server_message_packet_ = server_message_packet;
}
// @@protoc_insertion_point(field_set_allocated:proto.packet.server_message_packet)
}
+void packet::set_allocated_item_swap_packet(::proto::item_swap* item_swap_packet) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
+ clear_contents();
+ if (item_swap_packet) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(item_swap_packet);
+ if (message_arena != submessage_arena) {
+ item_swap_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, item_swap_packet, submessage_arena);
+ }
+ set_has_item_swap_packet();
+ _impl_.contents_.item_swap_packet_ = item_swap_packet;
+ }
+ // @@protoc_insertion_point(field_set_allocated:proto.packet.item_swap_packet)
+}
+void packet::set_allocated_item_use_packet(::proto::item_use* item_use_packet) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
+ clear_contents();
+ if (item_use_packet) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(item_use_packet);
+ if (message_arena != submessage_arena) {
+ item_use_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, item_use_packet, submessage_arena);
+ }
+ set_has_item_use_packet();
+ _impl_.contents_.item_use_packet_ = item_use_packet;
+ }
+ // @@protoc_insertion_point(field_set_allocated:proto.packet.item_use_packet)
+}
+void packet::set_allocated_item_update_packet(::proto::item_update* item_update_packet) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
+ clear_contents();
+ if (item_update_packet) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(item_update_packet);
+ if (message_arena != submessage_arena) {
+ item_update_packet = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, item_update_packet, submessage_arena);
+ }
+ set_has_item_update_packet();
+ _impl_.contents_.item_update_packet_ = item_update_packet;
+ }
+ // @@protoc_insertion_point(field_set_allocated:proto.packet.item_update_packet)
+}
packet::packet(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
- SharedCtor();
- if (!is_message_owned) {
- RegisterArenaDtor(arena);
- }
+ SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:proto.packet)
}
packet::packet(const packet& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
+ packet* const _this = this; (void)_this;
+ new (&_impl_) Impl_{
+ decltype(_impl_.contents_){}
+ , /*decltype(_impl_._cached_size_)*/{}
+ , /*decltype(_impl_._oneof_case_)*/{}};
+
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
clear_has_contents();
switch (from.contents_case()) {
case kAuthPacket: {
- _internal_mutable_auth_packet()->::proto::auth::MergeFrom(from._internal_auth_packet());
+ _this->_internal_mutable_auth_packet()->::proto::auth::MergeFrom(
+ from._internal_auth_packet());
break;
}
case kInitPacket: {
- _internal_mutable_init_packet()->::proto::init::MergeFrom(from._internal_init_packet());
+ _this->_internal_mutable_init_packet()->::proto::init::MergeFrom(
+ from._internal_init_packet());
break;
}
case kMovePacket: {
- _internal_mutable_move_packet()->::proto::move::MergeFrom(from._internal_move_packet());
+ _this->_internal_mutable_move_packet()->::proto::move::MergeFrom(
+ from._internal_move_packet());
break;
}
- case kPlayerPacket: {
- _internal_mutable_player_packet()->::proto::player::MergeFrom(from._internal_player_packet());
+ case kAnimateUpdatePacket: {
+ _this->_internal_mutable_animate_update_packet()->::proto::animate_update::MergeFrom(
+ from._internal_animate_update_packet());
break;
}
- case kRemovePlayerPacket: {
- _internal_mutable_remove_player_packet()->::proto::remove_player::MergeFrom(from._internal_remove_player_packet());
+ case kRemoveEntityPacket: {
+ _this->_internal_mutable_remove_entity_packet()->::proto::remove_entity::MergeFrom(
+ from._internal_remove_entity_packet());
break;
}
case kSayPacket: {
- _internal_mutable_say_packet()->::proto::say::MergeFrom(from._internal_say_packet());
+ _this->_internal_mutable_say_packet()->::proto::say::MergeFrom(
+ from._internal_say_packet());
break;
}
case kHearPlayerPacket: {
- _internal_mutable_hear_player_packet()->::proto::hear_player::MergeFrom(from._internal_hear_player_packet());
+ _this->_internal_mutable_hear_player_packet()->::proto::hear_player::MergeFrom(
+ from._internal_hear_player_packet());
break;
}
case kRequestChunkPacket: {
- _internal_mutable_request_chunk_packet()->::proto::request_chunk::MergeFrom(from._internal_request_chunk_packet());
+ _this->_internal_mutable_request_chunk_packet()->::proto::request_chunk::MergeFrom(
+ from._internal_request_chunk_packet());
break;
}
case kChunkPacket: {
- _internal_mutable_chunk_packet()->::proto::chunk::MergeFrom(from._internal_chunk_packet());
+ _this->_internal_mutable_chunk_packet()->::proto::chunk::MergeFrom(
+ from._internal_chunk_packet());
break;
}
case kRemoveChunkPacket: {
- _internal_mutable_remove_chunk_packet()->::proto::remove_chunk::MergeFrom(from._internal_remove_chunk_packet());
+ _this->_internal_mutable_remove_chunk_packet()->::proto::remove_chunk::MergeFrom(
+ from._internal_remove_chunk_packet());
break;
}
case kAddBlockPacket: {
- _internal_mutable_add_block_packet()->::proto::add_block::MergeFrom(from._internal_add_block_packet());
+ _this->_internal_mutable_add_block_packet()->::proto::add_block::MergeFrom(
+ from._internal_add_block_packet());
break;
}
case kRemoveBlockPacket: {
- _internal_mutable_remove_block_packet()->::proto::remove_block::MergeFrom(from._internal_remove_block_packet());
+ _this->_internal_mutable_remove_block_packet()->::proto::remove_block::MergeFrom(
+ from._internal_remove_block_packet());
break;
}
case kServerMessagePacket: {
- _internal_mutable_server_message_packet()->::proto::server_message::MergeFrom(from._internal_server_message_packet());
+ _this->_internal_mutable_server_message_packet()->::proto::server_message::MergeFrom(
+ from._internal_server_message_packet());
+ break;
+ }
+ case kItemSwapPacket: {
+ _this->_internal_mutable_item_swap_packet()->::proto::item_swap::MergeFrom(
+ from._internal_item_swap_packet());
+ break;
+ }
+ case kItemUsePacket: {
+ _this->_internal_mutable_item_use_packet()->::proto::item_use::MergeFrom(
+ from._internal_item_use_packet());
+ break;
+ }
+ case kItemUpdatePacket: {
+ _this->_internal_mutable_item_update_packet()->::proto::item_update::MergeFrom(
+ from._internal_item_update_packet());
break;
}
case CONTENTS_NOT_SET: {
@@ -4897,15 +7042,25 @@ packet::packet(const packet& from)
// @@protoc_insertion_point(copy_constructor:proto.packet)
}
-inline void packet::SharedCtor() {
-clear_has_contents();
+inline void packet::SharedCtor(
+ ::_pb::Arena* arena, bool is_message_owned) {
+ (void)arena;
+ (void)is_message_owned;
+ new (&_impl_) Impl_{
+ decltype(_impl_.contents_){}
+ , /*decltype(_impl_._cached_size_)*/{}
+ , /*decltype(_impl_._oneof_case_)*/{}
+ };
+ clear_has_contents();
}
packet::~packet() {
// @@protoc_insertion_point(destructor:proto.packet)
- if (GetArenaForAllocation() != nullptr) return;
+ if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
+ (void)arena;
+ return;
+ }
SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
inline void packet::SharedDtor() {
@@ -4915,14 +7070,8 @@ inline void packet::SharedDtor() {
}
}
-void packet::ArenaDtor(void* object) {
- packet* _this = reinterpret_cast< packet* >(object);
- (void)_this;
-}
-void packet::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
void packet::SetCachedSize(int size) const {
- _cached_size_.Set(size);
+ _impl_._cached_size_.Set(size);
}
void packet::clear_contents() {
@@ -4930,79 +7079,97 @@ void packet::clear_contents() {
switch (contents_case()) {
case kAuthPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.auth_packet_;
+ delete _impl_.contents_.auth_packet_;
}
break;
}
case kInitPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.init_packet_;
+ delete _impl_.contents_.init_packet_;
}
break;
}
case kMovePacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.move_packet_;
+ delete _impl_.contents_.move_packet_;
}
break;
}
- case kPlayerPacket: {
+ case kAnimateUpdatePacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.player_packet_;
+ delete _impl_.contents_.animate_update_packet_;
}
break;
}
- case kRemovePlayerPacket: {
+ case kRemoveEntityPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.remove_player_packet_;
+ delete _impl_.contents_.remove_entity_packet_;
}
break;
}
case kSayPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.say_packet_;
+ delete _impl_.contents_.say_packet_;
}
break;
}
case kHearPlayerPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.hear_player_packet_;
+ delete _impl_.contents_.hear_player_packet_;
}
break;
}
case kRequestChunkPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.request_chunk_packet_;
+ delete _impl_.contents_.request_chunk_packet_;
}
break;
}
case kChunkPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.chunk_packet_;
+ delete _impl_.contents_.chunk_packet_;
}
break;
}
case kRemoveChunkPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.remove_chunk_packet_;
+ delete _impl_.contents_.remove_chunk_packet_;
}
break;
}
case kAddBlockPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.add_block_packet_;
+ delete _impl_.contents_.add_block_packet_;
}
break;
}
case kRemoveBlockPacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.remove_block_packet_;
+ delete _impl_.contents_.remove_block_packet_;
}
break;
}
case kServerMessagePacket: {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.server_message_packet_;
+ delete _impl_.contents_.server_message_packet_;
+ }
+ break;
+ }
+ case kItemSwapPacket: {
+ if (GetArenaForAllocation() == nullptr) {
+ delete _impl_.contents_.item_swap_packet_;
+ }
+ break;
+ }
+ case kItemUsePacket: {
+ if (GetArenaForAllocation() == nullptr) {
+ delete _impl_.contents_.item_use_packet_;
+ }
+ break;
+ }
+ case kItemUpdatePacket: {
+ if (GetArenaForAllocation() == nullptr) {
+ delete _impl_.contents_.item_update_packet_;
}
break;
}
@@ -5010,7 +7177,7 @@ void packet::clear_contents() {
break;
}
}
- _oneof_case_[0] = CONTENTS_NOT_SET;
+ _impl_._oneof_case_[0] = CONTENTS_NOT_SET;
}
@@ -5024,11 +7191,11 @@ void packet::Clear() {
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
-const char* packet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+const char* packet::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
uint32_t tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// .proto.auth auth_packet = 1;
case 1:
@@ -5054,18 +7221,18 @@ const char* packet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
} else
goto handle_unusual;
continue;
- // .proto.player player_packet = 4;
+ // .proto.animate_update animate_update_packet = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
- ptr = ctx->ParseMessage(_internal_mutable_player_packet(), ptr);
+ ptr = ctx->ParseMessage(_internal_mutable_animate_update_packet(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
- // .proto.remove_player remove_player_packet = 5;
+ // .proto.remove_entity remove_entity_packet = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
- ptr = ctx->ParseMessage(_internal_mutable_remove_player_packet(), ptr);
+ ptr = ctx->ParseMessage(_internal_mutable_remove_entity_packet(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
@@ -5134,6 +7301,30 @@ const char* packet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int
} else
goto handle_unusual;
continue;
+ // .proto.item_swap item_swap_packet = 14;
+ case 14:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 114)) {
+ ptr = ctx->ParseMessage(_internal_mutable_item_swap_packet(), ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // .proto.item_update item_update_packet = 15;
+ case 15:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) {
+ ptr = ctx->ParseMessage(_internal_mutable_item_update_packet(), ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
+ // .proto.item_use item_use_packet = 16;
+ case 16:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 130)) {
+ ptr = ctx->ParseMessage(_internal_mutable_item_use_packet(), ptr);
+ CHK_(ptr);
+ } else
+ goto handle_unusual;
+ continue;
default:
goto handle_unusual;
} // switch
@@ -5165,110 +7356,118 @@ uint8_t* packet::_InternalSerialize(
// .proto.auth auth_packet = 1;
if (_internal_has_auth_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 1, _Internal::auth_packet(this), target, stream);
+ InternalWriteMessage(1, _Internal::auth_packet(this),
+ _Internal::auth_packet(this).GetCachedSize(), target, stream);
}
// .proto.init init_packet = 2;
if (_internal_has_init_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 2, _Internal::init_packet(this), target, stream);
+ InternalWriteMessage(2, _Internal::init_packet(this),
+ _Internal::init_packet(this).GetCachedSize(), target, stream);
}
// .proto.move move_packet = 3;
if (_internal_has_move_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 3, _Internal::move_packet(this), target, stream);
+ InternalWriteMessage(3, _Internal::move_packet(this),
+ _Internal::move_packet(this).GetCachedSize(), target, stream);
}
- // .proto.player player_packet = 4;
- if (_internal_has_player_packet()) {
- target = stream->EnsureSpace(target);
+ // .proto.animate_update animate_update_packet = 4;
+ if (_internal_has_animate_update_packet()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 4, _Internal::player_packet(this), target, stream);
+ InternalWriteMessage(4, _Internal::animate_update_packet(this),
+ _Internal::animate_update_packet(this).GetCachedSize(), target, stream);
}
- // .proto.remove_player remove_player_packet = 5;
- if (_internal_has_remove_player_packet()) {
- target = stream->EnsureSpace(target);
+ // .proto.remove_entity remove_entity_packet = 5;
+ if (_internal_has_remove_entity_packet()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 5, _Internal::remove_player_packet(this), target, stream);
+ InternalWriteMessage(5, _Internal::remove_entity_packet(this),
+ _Internal::remove_entity_packet(this).GetCachedSize(), target, stream);
}
// .proto.say say_packet = 6;
if (_internal_has_say_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 6, _Internal::say_packet(this), target, stream);
+ InternalWriteMessage(6, _Internal::say_packet(this),
+ _Internal::say_packet(this).GetCachedSize(), target, stream);
}
// .proto.hear_player hear_player_packet = 7;
if (_internal_has_hear_player_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 7, _Internal::hear_player_packet(this), target, stream);
+ InternalWriteMessage(7, _Internal::hear_player_packet(this),
+ _Internal::hear_player_packet(this).GetCachedSize(), target, stream);
}
// .proto.request_chunk request_chunk_packet = 8;
if (_internal_has_request_chunk_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 8, _Internal::request_chunk_packet(this), target, stream);
+ InternalWriteMessage(8, _Internal::request_chunk_packet(this),
+ _Internal::request_chunk_packet(this).GetCachedSize(), target, stream);
}
// .proto.chunk chunk_packet = 9;
if (_internal_has_chunk_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 9, _Internal::chunk_packet(this), target, stream);
+ InternalWriteMessage(9, _Internal::chunk_packet(this),
+ _Internal::chunk_packet(this).GetCachedSize(), target, stream);
}
// .proto.remove_chunk remove_chunk_packet = 10;
if (_internal_has_remove_chunk_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 10, _Internal::remove_chunk_packet(this), target, stream);
+ InternalWriteMessage(10, _Internal::remove_chunk_packet(this),
+ _Internal::remove_chunk_packet(this).GetCachedSize(), target, stream);
}
// .proto.add_block add_block_packet = 11;
if (_internal_has_add_block_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 11, _Internal::add_block_packet(this), target, stream);
+ InternalWriteMessage(11, _Internal::add_block_packet(this),
+ _Internal::add_block_packet(this).GetCachedSize(), target, stream);
}
// .proto.remove_block remove_block_packet = 12;
if (_internal_has_remove_block_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 12, _Internal::remove_block_packet(this), target, stream);
+ InternalWriteMessage(12, _Internal::remove_block_packet(this),
+ _Internal::remove_block_packet(this).GetCachedSize(), target, stream);
}
// .proto.server_message server_message_packet = 13;
if (_internal_has_server_message_packet()) {
- target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
- InternalWriteMessage(
- 13, _Internal::server_message_packet(this), target, stream);
+ InternalWriteMessage(13, _Internal::server_message_packet(this),
+ _Internal::server_message_packet(this).GetCachedSize(), target, stream);
+ }
+
+ // .proto.item_swap item_swap_packet = 14;
+ if (_internal_has_item_swap_packet()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(14, _Internal::item_swap_packet(this),
+ _Internal::item_swap_packet(this).GetCachedSize(), target, stream);
+ }
+
+ // .proto.item_update item_update_packet = 15;
+ if (_internal_has_item_update_packet()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(15, _Internal::item_update_packet(this),
+ _Internal::item_update_packet(this).GetCachedSize(), target, stream);
+ }
+
+ // .proto.item_use item_use_packet = 16;
+ if (_internal_has_item_use_packet()) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
+ InternalWriteMessage(16, _Internal::item_use_packet(this),
+ _Internal::item_use_packet(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:proto.packet)
@@ -5288,177 +7487,222 @@ size_t packet::ByteSizeLong() const {
case kAuthPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.auth_packet_);
+ *_impl_.contents_.auth_packet_);
break;
}
// .proto.init init_packet = 2;
case kInitPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.init_packet_);
+ *_impl_.contents_.init_packet_);
break;
}
// .proto.move move_packet = 3;
case kMovePacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.move_packet_);
+ *_impl_.contents_.move_packet_);
break;
}
- // .proto.player player_packet = 4;
- case kPlayerPacket: {
+ // .proto.animate_update animate_update_packet = 4;
+ case kAnimateUpdatePacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.player_packet_);
+ *_impl_.contents_.animate_update_packet_);
break;
}
- // .proto.remove_player remove_player_packet = 5;
- case kRemovePlayerPacket: {
+ // .proto.remove_entity remove_entity_packet = 5;
+ case kRemoveEntityPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.remove_player_packet_);
+ *_impl_.contents_.remove_entity_packet_);
break;
}
// .proto.say say_packet = 6;
case kSayPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.say_packet_);
+ *_impl_.contents_.say_packet_);
break;
}
// .proto.hear_player hear_player_packet = 7;
case kHearPlayerPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.hear_player_packet_);
+ *_impl_.contents_.hear_player_packet_);
break;
}
// .proto.request_chunk request_chunk_packet = 8;
case kRequestChunkPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.request_chunk_packet_);
+ *_impl_.contents_.request_chunk_packet_);
break;
}
// .proto.chunk chunk_packet = 9;
case kChunkPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.chunk_packet_);
+ *_impl_.contents_.chunk_packet_);
break;
}
// .proto.remove_chunk remove_chunk_packet = 10;
case kRemoveChunkPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.remove_chunk_packet_);
+ *_impl_.contents_.remove_chunk_packet_);
break;
}
// .proto.add_block add_block_packet = 11;
case kAddBlockPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.add_block_packet_);
+ *_impl_.contents_.add_block_packet_);
break;
}
// .proto.remove_block remove_block_packet = 12;
case kRemoveBlockPacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.remove_block_packet_);
+ *_impl_.contents_.remove_block_packet_);
break;
}
// .proto.server_message server_message_packet = 13;
case kServerMessagePacket: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- *contents_.server_message_packet_);
+ *_impl_.contents_.server_message_packet_);
+ break;
+ }
+ // .proto.item_swap item_swap_packet = 14;
+ case kItemSwapPacket: {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
+ *_impl_.contents_.item_swap_packet_);
+ break;
+ }
+ // .proto.item_use item_use_packet = 16;
+ case kItemUsePacket: {
+ total_size += 2 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
+ *_impl_.contents_.item_use_packet_);
+ break;
+ }
+ // .proto.item_update item_update_packet = 15;
+ case kItemUpdatePacket: {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
+ *_impl_.contents_.item_update_packet_);
break;
}
case CONTENTS_NOT_SET: {
break;
}
}
- return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
+ return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData packet::_class_data_ = {
- ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
+ ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
packet::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*packet::GetClassData() const { return &_class_data_; }
-void packet::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
- const ::PROTOBUF_NAMESPACE_ID::Message& from) {
- static_cast<packet *>(to)->MergeFrom(
- static_cast<const packet &>(from));
-}
-
-void packet::MergeFrom(const packet& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:proto.packet)
- GOOGLE_DCHECK_NE(&from, this);
+void packet::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
+ auto* const _this = static_cast<packet*>(&to_msg);
+ auto& from = static_cast<const packet&>(from_msg);
+ // @@protoc_insertion_point(class_specific_merge_from_start:proto.packet)
+ GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
switch (from.contents_case()) {
case kAuthPacket: {
- _internal_mutable_auth_packet()->::proto::auth::MergeFrom(from._internal_auth_packet());
+ _this->_internal_mutable_auth_packet()->::proto::auth::MergeFrom(
+ from._internal_auth_packet());
break;
}
case kInitPacket: {
- _internal_mutable_init_packet()->::proto::init::MergeFrom(from._internal_init_packet());
+ _this->_internal_mutable_init_packet()->::proto::init::MergeFrom(
+ from._internal_init_packet());
break;
}
case kMovePacket: {
- _internal_mutable_move_packet()->::proto::move::MergeFrom(from._internal_move_packet());
+ _this->_internal_mutable_move_packet()->::proto::move::MergeFrom(
+ from._internal_move_packet());
break;
}
- case kPlayerPacket: {
- _internal_mutable_player_packet()->::proto::player::MergeFrom(from._internal_player_packet());
+ case kAnimateUpdatePacket: {
+ _this->_internal_mutable_animate_update_packet()->::proto::animate_update::MergeFrom(
+ from._internal_animate_update_packet());
break;
}
- case kRemovePlayerPacket: {
- _internal_mutable_remove_player_packet()->::proto::remove_player::MergeFrom(from._internal_remove_player_packet());
+ case kRemoveEntityPacket: {
+ _this->_internal_mutable_remove_entity_packet()->::proto::remove_entity::MergeFrom(
+ from._internal_remove_entity_packet());
break;
}
case kSayPacket: {
- _internal_mutable_say_packet()->::proto::say::MergeFrom(from._internal_say_packet());
+ _this->_internal_mutable_say_packet()->::proto::say::MergeFrom(
+ from._internal_say_packet());
break;
}
case kHearPlayerPacket: {
- _internal_mutable_hear_player_packet()->::proto::hear_player::MergeFrom(from._internal_hear_player_packet());
+ _this->_internal_mutable_hear_player_packet()->::proto::hear_player::MergeFrom(
+ from._internal_hear_player_packet());
break;
}
case kRequestChunkPacket: {
- _internal_mutable_request_chunk_packet()->::proto::request_chunk::MergeFrom(from._internal_request_chunk_packet());
+ _this->_internal_mutable_request_chunk_packet()->::proto::request_chunk::MergeFrom(
+ from._internal_request_chunk_packet());
break;
}
case kChunkPacket: {
- _internal_mutable_chunk_packet()->::proto::chunk::MergeFrom(from._internal_chunk_packet());
+ _this->_internal_mutable_chunk_packet()->::proto::chunk::MergeFrom(
+ from._internal_chunk_packet());
break;
}
case kRemoveChunkPacket: {
- _internal_mutable_remove_chunk_packet()->::proto::remove_chunk::MergeFrom(from._internal_remove_chunk_packet());
+ _this->_internal_mutable_remove_chunk_packet()->::proto::remove_chunk::MergeFrom(
+ from._internal_remove_chunk_packet());
break;
}
case kAddBlockPacket: {
- _internal_mutable_add_block_packet()->::proto::add_block::MergeFrom(from._internal_add_block_packet());
+ _this->_internal_mutable_add_block_packet()->::proto::add_block::MergeFrom(
+ from._internal_add_block_packet());
break;
}
case kRemoveBlockPacket: {
- _internal_mutable_remove_block_packet()->::proto::remove_block::MergeFrom(from._internal_remove_block_packet());
+ _this->_internal_mutable_remove_block_packet()->::proto::remove_block::MergeFrom(
+ from._internal_remove_block_packet());
break;
}
case kServerMessagePacket: {
- _internal_mutable_server_message_packet()->::proto::server_message::MergeFrom(from._internal_server_message_packet());
+ _this->_internal_mutable_server_message_packet()->::proto::server_message::MergeFrom(
+ from._internal_server_message_packet());
+ break;
+ }
+ case kItemSwapPacket: {
+ _this->_internal_mutable_item_swap_packet()->::proto::item_swap::MergeFrom(
+ from._internal_item_swap_packet());
+ break;
+ }
+ case kItemUsePacket: {
+ _this->_internal_mutable_item_use_packet()->::proto::item_use::MergeFrom(
+ from._internal_item_use_packet());
+ break;
+ }
+ case kItemUpdatePacket: {
+ _this->_internal_mutable_item_update_packet()->::proto::item_update::MergeFrom(
+ from._internal_item_update_packet());
break;
}
case CONTENTS_NOT_SET: {
break;
}
}
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void packet::CopyFrom(const packet& from) {
@@ -5475,71 +7719,121 @@ bool packet::IsInitialized() const {
void packet::InternalSwap(packet* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
- swap(contents_, other->contents_);
- swap(_oneof_case_[0], other->_oneof_case_[0]);
+ swap(_impl_.contents_, other->_impl_.contents_);
+ swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
}
::PROTOBUF_NAMESPACE_ID::Metadata packet::GetMetadata() const {
- return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
+ return ::_pbi::AssignDescriptors(
&descriptor_table_net_2eproto_getter, &descriptor_table_net_2eproto_once,
- file_level_metadata_net_2eproto[17]);
+ file_level_metadata_net_2eproto[25]);
}
// @@protoc_insertion_point(namespace_scope)
} // namespace proto
PROTOBUF_NAMESPACE_OPEN
-template<> PROTOBUF_NOINLINE ::proto::angles* Arena::CreateMaybeMessage< ::proto::angles >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::angles*
+Arena::CreateMaybeMessage< ::proto::angles >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::angles >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::coords* Arena::CreateMaybeMessage< ::proto::coords >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::coords*
+Arena::CreateMaybeMessage< ::proto::coords >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::coords >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::vec3* Arena::CreateMaybeMessage< ::proto::vec3 >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::vec3*
+Arena::CreateMaybeMessage< ::proto::vec3 >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::vec3 >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::ivec3* Arena::CreateMaybeMessage< ::proto::ivec3 >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::ivec3*
+Arena::CreateMaybeMessage< ::proto::ivec3 >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::ivec3 >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::player* Arena::CreateMaybeMessage< ::proto::player >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::entity*
+Arena::CreateMaybeMessage< ::proto::entity >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::entity >(arena);
+}
+template<> PROTOBUF_NOINLINE ::proto::animate*
+Arena::CreateMaybeMessage< ::proto::animate >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::animate >(arena);
+}
+template<> PROTOBUF_NOINLINE ::proto::item*
+Arena::CreateMaybeMessage< ::proto::item >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::item >(arena);
+}
+template<> PROTOBUF_NOINLINE ::proto::item_array*
+Arena::CreateMaybeMessage< ::proto::item_array >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::item_array >(arena);
+}
+template<> PROTOBUF_NOINLINE ::proto::player*
+Arena::CreateMaybeMessage< ::proto::player >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::player >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::auth* Arena::CreateMaybeMessage< ::proto::auth >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::auth*
+Arena::CreateMaybeMessage< ::proto::auth >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::auth >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::init* Arena::CreateMaybeMessage< ::proto::init >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::init*
+Arena::CreateMaybeMessage< ::proto::init >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::init >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::move* Arena::CreateMaybeMessage< ::proto::move >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::move*
+Arena::CreateMaybeMessage< ::proto::move >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::move >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::remove_player* Arena::CreateMaybeMessage< ::proto::remove_player >(Arena* arena) {
- return Arena::CreateMessageInternal< ::proto::remove_player >(arena);
+template<> PROTOBUF_NOINLINE ::proto::remove_entity*
+Arena::CreateMaybeMessage< ::proto::remove_entity >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::remove_entity >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::say* Arena::CreateMaybeMessage< ::proto::say >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::say*
+Arena::CreateMaybeMessage< ::proto::say >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::say >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::hear_player* Arena::CreateMaybeMessage< ::proto::hear_player >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::hear_player*
+Arena::CreateMaybeMessage< ::proto::hear_player >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::hear_player >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::request_chunk* Arena::CreateMaybeMessage< ::proto::request_chunk >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::request_chunk*
+Arena::CreateMaybeMessage< ::proto::request_chunk >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::request_chunk >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::remove_chunk* Arena::CreateMaybeMessage< ::proto::remove_chunk >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::remove_chunk*
+Arena::CreateMaybeMessage< ::proto::remove_chunk >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::remove_chunk >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::chunk* Arena::CreateMaybeMessage< ::proto::chunk >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::chunk*
+Arena::CreateMaybeMessage< ::proto::chunk >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::chunk >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::add_block* Arena::CreateMaybeMessage< ::proto::add_block >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::add_block*
+Arena::CreateMaybeMessage< ::proto::add_block >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::add_block >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::remove_block* Arena::CreateMaybeMessage< ::proto::remove_block >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::remove_block*
+Arena::CreateMaybeMessage< ::proto::remove_block >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::remove_block >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::server_message* Arena::CreateMaybeMessage< ::proto::server_message >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::server_message*
+Arena::CreateMaybeMessage< ::proto::server_message >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::server_message >(arena);
}
-template<> PROTOBUF_NOINLINE ::proto::packet* Arena::CreateMaybeMessage< ::proto::packet >(Arena* arena) {
+template<> PROTOBUF_NOINLINE ::proto::item_swap*
+Arena::CreateMaybeMessage< ::proto::item_swap >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::item_swap >(arena);
+}
+template<> PROTOBUF_NOINLINE ::proto::item_use*
+Arena::CreateMaybeMessage< ::proto::item_use >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::item_use >(arena);
+}
+template<> PROTOBUF_NOINLINE ::proto::item_update*
+Arena::CreateMaybeMessage< ::proto::item_update >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::item_update >(arena);
+}
+template<> PROTOBUF_NOINLINE ::proto::animate_update*
+Arena::CreateMaybeMessage< ::proto::animate_update >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::proto::animate_update >(arena);
+}
+template<> PROTOBUF_NOINLINE ::proto::packet*
+Arena::CreateMaybeMessage< ::proto::packet >(Arena* arena) {
return Arena::CreateMessageInternal< ::proto::packet >(arena);
}
PROTOBUF_NAMESPACE_CLOSE
diff --git a/src/shared/net/lib/protobuf/net.pb.h b/src/shared/net/lib/protobuf/net.pb.h
index 9160072..59a79fe 100644
--- a/src/shared/net/lib/protobuf/net.pb.h
+++ b/src/shared/net/lib/protobuf/net.pb.h
@@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3019000
+#if PROTOBUF_VERSION < 3021000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@@ -23,7 +23,6 @@
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h>
-#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/metadata_lite.h>
#include <google/protobuf/generated_message_reflection.h>
@@ -42,14 +41,6 @@ PROTOBUF_NAMESPACE_CLOSE
// Internal implementation detail -- do not use these members.
struct TableStruct_net_2eproto {
- static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
- PROTOBUF_SECTION_VARIABLE(protodesc_cold);
- static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[]
- PROTOBUF_SECTION_VARIABLE(protodesc_cold);
- static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[18]
- PROTOBUF_SECTION_VARIABLE(protodesc_cold);
- static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
- static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const uint32_t offsets[];
};
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_net_2eproto;
@@ -60,6 +51,12 @@ extern add_blockDefaultTypeInternal _add_block_default_instance_;
class angles;
struct anglesDefaultTypeInternal;
extern anglesDefaultTypeInternal _angles_default_instance_;
+class animate;
+struct animateDefaultTypeInternal;
+extern animateDefaultTypeInternal _animate_default_instance_;
+class animate_update;
+struct animate_updateDefaultTypeInternal;
+extern animate_updateDefaultTypeInternal _animate_update_default_instance_;
class auth;
struct authDefaultTypeInternal;
extern authDefaultTypeInternal _auth_default_instance_;
@@ -69,12 +66,30 @@ extern chunkDefaultTypeInternal _chunk_default_instance_;
class coords;
struct coordsDefaultTypeInternal;
extern coordsDefaultTypeInternal _coords_default_instance_;
+class entity;
+struct entityDefaultTypeInternal;
+extern entityDefaultTypeInternal _entity_default_instance_;
class hear_player;
struct hear_playerDefaultTypeInternal;
extern hear_playerDefaultTypeInternal _hear_player_default_instance_;
class init;
struct initDefaultTypeInternal;
extern initDefaultTypeInternal _init_default_instance_;
+class item;
+struct itemDefaultTypeInternal;
+extern itemDefaultTypeInternal _item_default_instance_;
+class item_array;
+struct item_arrayDefaultTypeInternal;
+extern item_arrayDefaultTypeInternal _item_array_default_instance_;
+class item_swap;
+struct item_swapDefaultTypeInternal;
+extern item_swapDefaultTypeInternal _item_swap_default_instance_;
+class item_update;
+struct item_updateDefaultTypeInternal;
+extern item_updateDefaultTypeInternal _item_update_default_instance_;
+class item_use;
+struct item_useDefaultTypeInternal;
+extern item_useDefaultTypeInternal _item_use_default_instance_;
class ivec3;
struct ivec3DefaultTypeInternal;
extern ivec3DefaultTypeInternal _ivec3_default_instance_;
@@ -93,9 +108,9 @@ extern remove_blockDefaultTypeInternal _remove_block_default_instance_;
class remove_chunk;
struct remove_chunkDefaultTypeInternal;
extern remove_chunkDefaultTypeInternal _remove_chunk_default_instance_;
-class remove_player;
-struct remove_playerDefaultTypeInternal;
-extern remove_playerDefaultTypeInternal _remove_player_default_instance_;
+class remove_entity;
+struct remove_entityDefaultTypeInternal;
+extern remove_entityDefaultTypeInternal _remove_entity_default_instance_;
class request_chunk;
struct request_chunkDefaultTypeInternal;
extern request_chunkDefaultTypeInternal _request_chunk_default_instance_;
@@ -112,18 +127,26 @@ extern vec3DefaultTypeInternal _vec3_default_instance_;
PROTOBUF_NAMESPACE_OPEN
template<> ::proto::add_block* Arena::CreateMaybeMessage<::proto::add_block>(Arena*);
template<> ::proto::angles* Arena::CreateMaybeMessage<::proto::angles>(Arena*);
+template<> ::proto::animate* Arena::CreateMaybeMessage<::proto::animate>(Arena*);
+template<> ::proto::animate_update* Arena::CreateMaybeMessage<::proto::animate_update>(Arena*);
template<> ::proto::auth* Arena::CreateMaybeMessage<::proto::auth>(Arena*);
template<> ::proto::chunk* Arena::CreateMaybeMessage<::proto::chunk>(Arena*);
template<> ::proto::coords* Arena::CreateMaybeMessage<::proto::coords>(Arena*);
+template<> ::proto::entity* Arena::CreateMaybeMessage<::proto::entity>(Arena*);
template<> ::proto::hear_player* Arena::CreateMaybeMessage<::proto::hear_player>(Arena*);
template<> ::proto::init* Arena::CreateMaybeMessage<::proto::init>(Arena*);
+template<> ::proto::item* Arena::CreateMaybeMessage<::proto::item>(Arena*);
+template<> ::proto::item_array* Arena::CreateMaybeMessage<::proto::item_array>(Arena*);
+template<> ::proto::item_swap* Arena::CreateMaybeMessage<::proto::item_swap>(Arena*);
+template<> ::proto::item_update* Arena::CreateMaybeMessage<::proto::item_update>(Arena*);
+template<> ::proto::item_use* Arena::CreateMaybeMessage<::proto::item_use>(Arena*);
template<> ::proto::ivec3* Arena::CreateMaybeMessage<::proto::ivec3>(Arena*);
template<> ::proto::move* Arena::CreateMaybeMessage<::proto::move>(Arena*);
template<> ::proto::packet* Arena::CreateMaybeMessage<::proto::packet>(Arena*);
template<> ::proto::player* Arena::CreateMaybeMessage<::proto::player>(Arena*);
template<> ::proto::remove_block* Arena::CreateMaybeMessage<::proto::remove_block>(Arena*);
template<> ::proto::remove_chunk* Arena::CreateMaybeMessage<::proto::remove_chunk>(Arena*);
-template<> ::proto::remove_player* Arena::CreateMaybeMessage<::proto::remove_player>(Arena*);
+template<> ::proto::remove_entity* Arena::CreateMaybeMessage<::proto::remove_entity>(Arena*);
template<> ::proto::request_chunk* Arena::CreateMaybeMessage<::proto::request_chunk>(Arena*);
template<> ::proto::say* Arena::CreateMaybeMessage<::proto::say>(Arena*);
template<> ::proto::server_message* Arena::CreateMaybeMessage<::proto::server_message>(Arena*);
@@ -138,7 +161,7 @@ class angles final :
public:
inline angles() : angles(nullptr) {}
~angles() override;
- explicit constexpr angles(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR angles(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
angles(const angles& from);
angles(angles&& from) noexcept
@@ -213,9 +236,11 @@ class angles final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const angles& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const angles& from);
+ void MergeFrom( const angles& from) {
+ angles::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -224,10 +249,10 @@ class angles final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(angles* other);
@@ -240,9 +265,6 @@ class angles final :
protected:
explicit angles(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -283,9 +305,12 @@ class angles final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- float pitch_;
- float yaw_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ float pitch_;
+ float yaw_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -295,7 +320,7 @@ class coords final :
public:
inline coords() : coords(nullptr) {}
~coords() override;
- explicit constexpr coords(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR coords(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
coords(const coords& from);
coords(coords&& from) noexcept
@@ -370,9 +395,11 @@ class coords final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const coords& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const coords& from);
+ void MergeFrom( const coords& from) {
+ coords::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -381,10 +408,10 @@ class coords final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(coords* other);
@@ -397,9 +424,6 @@ class coords final :
protected:
explicit coords(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -440,9 +464,12 @@ class coords final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- int32_t x_;
- int32_t z_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ int32_t x_;
+ int32_t z_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -452,7 +479,7 @@ class vec3 final :
public:
inline vec3() : vec3(nullptr) {}
~vec3() override;
- explicit constexpr vec3(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR vec3(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
vec3(const vec3& from);
vec3(vec3&& from) noexcept
@@ -527,9 +554,11 @@ class vec3 final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const vec3& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const vec3& from);
+ void MergeFrom( const vec3& from) {
+ vec3::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -538,10 +567,10 @@ class vec3 final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(vec3* other);
@@ -554,9 +583,6 @@ class vec3 final :
protected:
explicit vec3(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -607,10 +633,13 @@ class vec3 final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- float x_;
- float y_;
- float z_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ float x_;
+ float y_;
+ float z_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -620,7 +649,7 @@ class ivec3 final :
public:
inline ivec3() : ivec3(nullptr) {}
~ivec3() override;
- explicit constexpr ivec3(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR ivec3(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
ivec3(const ivec3& from);
ivec3(ivec3&& from) noexcept
@@ -695,9 +724,11 @@ class ivec3 final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const ivec3& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const ivec3& from);
+ void MergeFrom( const ivec3& from) {
+ ivec3::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -706,10 +737,10 @@ class ivec3 final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(ivec3* other);
@@ -722,9 +753,6 @@ class ivec3 final :
protected:
explicit ivec3(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -775,32 +803,35 @@ class ivec3 final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- int32_t x_;
- int32_t y_;
- int32_t z_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ int32_t x_;
+ int32_t y_;
+ int32_t z_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
-class player final :
- public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.player) */ {
+class entity final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.entity) */ {
public:
- inline player() : player(nullptr) {}
- ~player() override;
- explicit constexpr player(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ inline entity() : entity(nullptr) {}
+ ~entity() override;
+ explicit PROTOBUF_CONSTEXPR entity(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
- player(const player& from);
- player(player&& from) noexcept
- : player() {
+ entity(const entity& from);
+ entity(entity&& from) noexcept
+ : entity() {
*this = ::std::move(from);
}
- inline player& operator=(const player& from) {
+ inline entity& operator=(const entity& from) {
CopyFrom(from);
return *this;
}
- inline player& operator=(player&& from) noexcept {
+ inline entity& operator=(entity&& from) noexcept {
if (this == &from) return *this;
if (GetOwningArena() == from.GetOwningArena()
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
@@ -823,20 +854,20 @@ class player final :
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return default_instance().GetMetadata().reflection;
}
- static const player& default_instance() {
+ static const entity& default_instance() {
return *internal_default_instance();
}
- static inline const player* internal_default_instance() {
- return reinterpret_cast<const player*>(
- &_player_default_instance_);
+ static inline const entity* internal_default_instance() {
+ return reinterpret_cast<const entity*>(
+ &_entity_default_instance_);
}
static constexpr int kIndexInFileMessages =
4;
- friend void swap(player& a, player& b) {
+ friend void swap(entity& a, entity& b) {
a.Swap(&b);
}
- inline void Swap(player* other) {
+ inline void Swap(entity* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
@@ -849,7 +880,7 @@ class player final :
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
}
}
- void UnsafeArenaSwap(player* other) {
+ void UnsafeArenaSwap(entity* other) {
if (other == this) return;
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
@@ -857,15 +888,17 @@ class player final :
// implements Message ----------------------------------------------
- player* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
- return CreateMaybeMessage<player>(arena);
+ entity* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<entity>(arena);
}
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
- void CopyFrom(const player& from);
+ void CopyFrom(const entity& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const player& from);
+ void MergeFrom( const entity& from) {
+ entity::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -874,25 +907,22 @@ class player final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
- void InternalSwap(player* other);
+ void InternalSwap(entity* other);
private:
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
- return "proto.player";
+ return "proto.entity";
}
protected:
- explicit player(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ explicit entity(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -905,14 +935,11 @@ class player final :
// accessors -------------------------------------------------------
enum : int {
- kChunkPosFieldNumber = 3,
- kLocalPosFieldNumber = 4,
- kViewanglesFieldNumber = 5,
- kVelocityFieldNumber = 6,
+ kChunkPosFieldNumber = 2,
+ kLocalPosFieldNumber = 3,
kIndexFieldNumber = 1,
- kCommandsFieldNumber = 2,
};
- // .proto.coords chunk_pos = 3;
+ // .proto.coords chunk_pos = 2;
bool has_chunk_pos() const;
private:
bool _internal_has_chunk_pos() const;
@@ -930,7 +957,7 @@ class player final :
::proto::coords* chunk_pos);
::proto::coords* unsafe_arena_release_chunk_pos();
- // .proto.vec3 local_pos = 4;
+ // .proto.vec3 local_pos = 3;
bool has_local_pos() const;
private:
bool _internal_has_local_pos() const;
@@ -948,7 +975,179 @@ class player final :
::proto::vec3* local_pos);
::proto::vec3* unsafe_arena_release_local_pos();
- // .proto.angles viewangles = 5;
+ // uint32 index = 1;
+ void clear_index();
+ uint32_t index() const;
+ void set_index(uint32_t value);
+ private:
+ uint32_t _internal_index() const;
+ void _internal_set_index(uint32_t value);
+ public:
+
+ // @@protoc_insertion_point(class_scope:proto.entity)
+ private:
+ class _Internal;
+
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ struct Impl_ {
+ ::proto::coords* chunk_pos_;
+ ::proto::vec3* local_pos_;
+ uint32_t index_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
+ friend struct ::TableStruct_net_2eproto;
+};
+// -------------------------------------------------------------------
+
+class animate final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.animate) */ {
+ public:
+ inline animate() : animate(nullptr) {}
+ ~animate() override;
+ explicit PROTOBUF_CONSTEXPR animate(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ animate(const animate& from);
+ animate(animate&& from) noexcept
+ : animate() {
+ *this = ::std::move(from);
+ }
+
+ inline animate& operator=(const animate& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline animate& operator=(animate&& from) noexcept {
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+ && GetOwningArena() != nullptr
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
+ ) {
+ InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return default_instance().GetMetadata().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return default_instance().GetMetadata().reflection;
+ }
+ static const animate& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const animate* internal_default_instance() {
+ return reinterpret_cast<const animate*>(
+ &_animate_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 5;
+
+ friend void swap(animate& a, animate& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(animate* other) {
+ if (other == this) return;
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() != nullptr &&
+ GetOwningArena() == other->GetOwningArena()) {
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() == other->GetOwningArena()) {
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(animate* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ animate* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<animate>(arena);
+ }
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
+ void CopyFrom(const animate& from);
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
+ void MergeFrom( const animate& from) {
+ animate::MergeImpl(*this, from);
+ }
+ private:
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
+ public:
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
+
+ private:
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
+ void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(animate* other);
+
+ private:
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "proto.animate";
+ }
+ protected:
+ explicit animate(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned = false);
+ public:
+
+ static const ClassData _class_data_;
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kEntityFieldNumber = 1,
+ kViewanglesFieldNumber = 3,
+ kVelocityFieldNumber = 4,
+ kCommandsFieldNumber = 2,
+ kActiveItemFieldNumber = 5,
+ };
+ // .proto.entity entity = 1;
+ bool has_entity() const;
+ private:
+ bool _internal_has_entity() const;
+ public:
+ void clear_entity();
+ const ::proto::entity& entity() const;
+ PROTOBUF_NODISCARD ::proto::entity* release_entity();
+ ::proto::entity* mutable_entity();
+ void set_allocated_entity(::proto::entity* entity);
+ private:
+ const ::proto::entity& _internal_entity() const;
+ ::proto::entity* _internal_mutable_entity();
+ public:
+ void unsafe_arena_set_allocated_entity(
+ ::proto::entity* entity);
+ ::proto::entity* unsafe_arena_release_entity();
+
+ // .proto.angles viewangles = 3;
bool has_viewangles() const;
private:
bool _internal_has_viewangles() const;
@@ -966,7 +1165,7 @@ class player final :
::proto::angles* viewangles);
::proto::angles* unsafe_arena_release_viewangles();
- // .proto.vec3 velocity = 6;
+ // .proto.vec3 velocity = 4;
bool has_velocity() const;
private:
bool _internal_has_velocity() const;
@@ -984,6 +1183,169 @@ class player final :
::proto::vec3* velocity);
::proto::vec3* unsafe_arena_release_velocity();
+ // uint32 commands = 2;
+ void clear_commands();
+ uint32_t commands() const;
+ void set_commands(uint32_t value);
+ private:
+ uint32_t _internal_commands() const;
+ void _internal_set_commands(uint32_t value);
+ public:
+
+ // uint32 active_item = 5;
+ void clear_active_item();
+ uint32_t active_item() const;
+ void set_active_item(uint32_t value);
+ private:
+ uint32_t _internal_active_item() const;
+ void _internal_set_active_item(uint32_t value);
+ public:
+
+ // @@protoc_insertion_point(class_scope:proto.animate)
+ private:
+ class _Internal;
+
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ struct Impl_ {
+ ::proto::entity* entity_;
+ ::proto::angles* viewangles_;
+ ::proto::vec3* velocity_;
+ uint32_t commands_;
+ uint32_t active_item_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
+ friend struct ::TableStruct_net_2eproto;
+};
+// -------------------------------------------------------------------
+
+class item final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.item) */ {
+ public:
+ inline item() : item(nullptr) {}
+ ~item() override;
+ explicit PROTOBUF_CONSTEXPR item(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ item(const item& from);
+ item(item&& from) noexcept
+ : item() {
+ *this = ::std::move(from);
+ }
+
+ inline item& operator=(const item& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline item& operator=(item&& from) noexcept {
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+ && GetOwningArena() != nullptr
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
+ ) {
+ InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return default_instance().GetMetadata().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return default_instance().GetMetadata().reflection;
+ }
+ static const item& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const item* internal_default_instance() {
+ return reinterpret_cast<const item*>(
+ &_item_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 6;
+
+ friend void swap(item& a, item& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(item* other) {
+ if (other == this) return;
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() != nullptr &&
+ GetOwningArena() == other->GetOwningArena()) {
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() == other->GetOwningArena()) {
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(item* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ item* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<item>(arena);
+ }
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
+ void CopyFrom(const item& from);
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
+ void MergeFrom( const item& from) {
+ item::MergeImpl(*this, from);
+ }
+ private:
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
+ public:
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
+
+ private:
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
+ void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(item* other);
+
+ private:
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "proto.item";
+ }
+ protected:
+ explicit item(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned = false);
+ public:
+
+ static const ClassData _class_data_;
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kIndexFieldNumber = 1,
+ kTypeFieldNumber = 2,
+ kQuantityFieldNumber = 3,
+ };
// uint32 index = 1;
void clear_index();
uint32_t index() const;
@@ -993,15 +1355,359 @@ class player final :
void _internal_set_index(uint32_t value);
public:
- // uint32 commands = 2;
- void clear_commands();
- uint32_t commands() const;
- void set_commands(uint32_t value);
+ // uint32 type = 2;
+ void clear_type();
+ uint32_t type() const;
+ void set_type(uint32_t value);
private:
- uint32_t _internal_commands() const;
- void _internal_set_commands(uint32_t value);
+ uint32_t _internal_type() const;
+ void _internal_set_type(uint32_t value);
+ public:
+
+ // uint32 quantity = 3;
+ void clear_quantity();
+ uint32_t quantity() const;
+ void set_quantity(uint32_t value);
+ private:
+ uint32_t _internal_quantity() const;
+ void _internal_set_quantity(uint32_t value);
public:
+ // @@protoc_insertion_point(class_scope:proto.item)
+ private:
+ class _Internal;
+
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ struct Impl_ {
+ uint32_t index_;
+ uint32_t type_;
+ uint32_t quantity_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
+ friend struct ::TableStruct_net_2eproto;
+};
+// -------------------------------------------------------------------
+
+class item_array final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.item_array) */ {
+ public:
+ inline item_array() : item_array(nullptr) {}
+ ~item_array() override;
+ explicit PROTOBUF_CONSTEXPR item_array(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ item_array(const item_array& from);
+ item_array(item_array&& from) noexcept
+ : item_array() {
+ *this = ::std::move(from);
+ }
+
+ inline item_array& operator=(const item_array& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline item_array& operator=(item_array&& from) noexcept {
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+ && GetOwningArena() != nullptr
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
+ ) {
+ InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return default_instance().GetMetadata().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return default_instance().GetMetadata().reflection;
+ }
+ static const item_array& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const item_array* internal_default_instance() {
+ return reinterpret_cast<const item_array*>(
+ &_item_array_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 7;
+
+ friend void swap(item_array& a, item_array& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(item_array* other) {
+ if (other == this) return;
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() != nullptr &&
+ GetOwningArena() == other->GetOwningArena()) {
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() == other->GetOwningArena()) {
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(item_array* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ item_array* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<item_array>(arena);
+ }
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
+ void CopyFrom(const item_array& from);
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
+ void MergeFrom( const item_array& from) {
+ item_array::MergeImpl(*this, from);
+ }
+ private:
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
+ public:
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
+
+ private:
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
+ void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(item_array* other);
+
+ private:
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "proto.item_array";
+ }
+ protected:
+ explicit item_array(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned = false);
+ public:
+
+ static const ClassData _class_data_;
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kItemsFieldNumber = 1,
+ };
+ // repeated .proto.item items = 1;
+ int items_size() const;
+ private:
+ int _internal_items_size() const;
+ public:
+ void clear_items();
+ ::proto::item* mutable_items(int index);
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item >*
+ mutable_items();
+ private:
+ const ::proto::item& _internal_items(int index) const;
+ ::proto::item* _internal_add_items();
+ public:
+ const ::proto::item& items(int index) const;
+ ::proto::item* add_items();
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item >&
+ items() const;
+
+ // @@protoc_insertion_point(class_scope:proto.item_array)
+ private:
+ class _Internal;
+
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ struct Impl_ {
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item > items_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
+ friend struct ::TableStruct_net_2eproto;
+};
+// -------------------------------------------------------------------
+
+class player final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.player) */ {
+ public:
+ inline player() : player(nullptr) {}
+ ~player() override;
+ explicit PROTOBUF_CONSTEXPR player(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ player(const player& from);
+ player(player&& from) noexcept
+ : player() {
+ *this = ::std::move(from);
+ }
+
+ inline player& operator=(const player& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline player& operator=(player&& from) noexcept {
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+ && GetOwningArena() != nullptr
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
+ ) {
+ InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return default_instance().GetMetadata().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return default_instance().GetMetadata().reflection;
+ }
+ static const player& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const player* internal_default_instance() {
+ return reinterpret_cast<const player*>(
+ &_player_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 8;
+
+ friend void swap(player& a, player& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(player* other) {
+ if (other == this) return;
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() != nullptr &&
+ GetOwningArena() == other->GetOwningArena()) {
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() == other->GetOwningArena()) {
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(player* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ player* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<player>(arena);
+ }
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
+ void CopyFrom(const player& from);
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
+ void MergeFrom( const player& from) {
+ player::MergeImpl(*this, from);
+ }
+ private:
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
+ public:
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
+
+ private:
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
+ void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(player* other);
+
+ private:
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "proto.player";
+ }
+ protected:
+ explicit player(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned = false);
+ public:
+
+ static const ClassData _class_data_;
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kAnimateFieldNumber = 1,
+ kInventoryFieldNumber = 2,
+ };
+ // .proto.animate animate = 1;
+ bool has_animate() const;
+ private:
+ bool _internal_has_animate() const;
+ public:
+ void clear_animate();
+ const ::proto::animate& animate() const;
+ PROTOBUF_NODISCARD ::proto::animate* release_animate();
+ ::proto::animate* mutable_animate();
+ void set_allocated_animate(::proto::animate* animate);
+ private:
+ const ::proto::animate& _internal_animate() const;
+ ::proto::animate* _internal_mutable_animate();
+ public:
+ void unsafe_arena_set_allocated_animate(
+ ::proto::animate* animate);
+ ::proto::animate* unsafe_arena_release_animate();
+
+ // .proto.item_array inventory = 2;
+ bool has_inventory() const;
+ private:
+ bool _internal_has_inventory() const;
+ public:
+ void clear_inventory();
+ const ::proto::item_array& inventory() const;
+ PROTOBUF_NODISCARD ::proto::item_array* release_inventory();
+ ::proto::item_array* mutable_inventory();
+ void set_allocated_inventory(::proto::item_array* inventory);
+ private:
+ const ::proto::item_array& _internal_inventory() const;
+ ::proto::item_array* _internal_mutable_inventory();
+ public:
+ void unsafe_arena_set_allocated_inventory(
+ ::proto::item_array* inventory);
+ ::proto::item_array* unsafe_arena_release_inventory();
+
// @@protoc_insertion_point(class_scope:proto.player)
private:
class _Internal;
@@ -1009,13 +1715,12 @@ class player final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::proto::coords* chunk_pos_;
- ::proto::vec3* local_pos_;
- ::proto::angles* viewangles_;
- ::proto::vec3* velocity_;
- uint32_t index_;
- uint32_t commands_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::proto::animate* animate_;
+ ::proto::item_array* inventory_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -1025,7 +1730,7 @@ class auth final :
public:
inline auth() : auth(nullptr) {}
~auth() override;
- explicit constexpr auth(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR auth(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
auth(const auth& from);
auth(auth&& from) noexcept
@@ -1068,7 +1773,7 @@ class auth final :
&_auth_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 5;
+ 9;
friend void swap(auth& a, auth& b) {
a.Swap(&b);
@@ -1100,9 +1805,11 @@ class auth final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const auth& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const auth& from);
+ void MergeFrom( const auth& from) {
+ auth::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -1111,10 +1818,10 @@ class auth final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(auth* other);
@@ -1127,9 +1834,6 @@ class auth final :
protected:
explicit auth(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -1180,9 +1884,12 @@ class auth final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr username_;
- ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr password_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr username_;
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr password_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -1192,7 +1899,7 @@ class init final :
public:
inline init() : init(nullptr) {}
~init() override;
- explicit constexpr init(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR init(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
init(const init& from);
init(init&& from) noexcept
@@ -1235,7 +1942,7 @@ class init final :
&_init_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 6;
+ 10;
friend void swap(init& a, init& b) {
a.Swap(&b);
@@ -1267,9 +1974,11 @@ class init final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const init& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const init& from);
+ void MergeFrom( const init& from) {
+ init::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -1278,10 +1987,10 @@ class init final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(init* other);
@@ -1294,9 +2003,6 @@ class init final :
protected:
explicit init(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -1312,6 +2018,8 @@ class init final :
kLocalplayerFieldNumber = 3,
kSeedFieldNumber = 1,
kDrawDistanceFieldNumber = 2,
+ kTickrateFieldNumber = 4,
+ kTickFieldNumber = 5,
};
// .proto.player localplayer = 3;
bool has_localplayer() const;
@@ -1349,6 +2057,24 @@ class init final :
void _internal_set_draw_distance(int32_t value);
public:
+ // uint32 tickrate = 4;
+ void clear_tickrate();
+ uint32_t tickrate() const;
+ void set_tickrate(uint32_t value);
+ private:
+ uint32_t _internal_tickrate() const;
+ void _internal_set_tickrate(uint32_t value);
+ public:
+
+ // uint32 tick = 5;
+ void clear_tick();
+ uint32_t tick() const;
+ void set_tick(uint32_t value);
+ private:
+ uint32_t _internal_tick() const;
+ void _internal_set_tick(uint32_t value);
+ public:
+
// @@protoc_insertion_point(class_scope:proto.init)
private:
class _Internal;
@@ -1356,10 +2082,15 @@ class init final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::proto::player* localplayer_;
- uint64_t seed_;
- int32_t draw_distance_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::proto::player* localplayer_;
+ uint64_t seed_;
+ int32_t draw_distance_;
+ uint32_t tickrate_;
+ uint32_t tick_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -1369,7 +2100,7 @@ class move final :
public:
inline move() : move(nullptr) {}
~move() override;
- explicit constexpr move(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR move(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
move(const move& from);
move(move&& from) noexcept
@@ -1412,7 +2143,7 @@ class move final :
&_move_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 7;
+ 11;
friend void swap(move& a, move& b) {
a.Swap(&b);
@@ -1444,9 +2175,11 @@ class move final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const move& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const move& from);
+ void MergeFrom( const move& from) {
+ move::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -1455,10 +2188,10 @@ class move final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(move* other);
@@ -1471,9 +2204,6 @@ class move final :
protected:
explicit move(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -1488,6 +2218,8 @@ class move final :
enum : int {
kViewanglesFieldNumber = 2,
kCommandsFieldNumber = 1,
+ kActiveItemFieldNumber = 3,
+ kSequenceFieldNumber = 4,
};
// .proto.angles viewangles = 2;
bool has_viewangles() const;
@@ -1516,6 +2248,24 @@ class move final :
void _internal_set_commands(uint32_t value);
public:
+ // uint32 active_item = 3;
+ void clear_active_item();
+ uint32_t active_item() const;
+ void set_active_item(uint32_t value);
+ private:
+ uint32_t _internal_active_item() const;
+ void _internal_set_active_item(uint32_t value);
+ public:
+
+ // uint32 sequence = 4;
+ void clear_sequence();
+ uint32_t sequence() const;
+ void set_sequence(uint32_t value);
+ private:
+ uint32_t _internal_sequence() const;
+ void _internal_set_sequence(uint32_t value);
+ public:
+
// @@protoc_insertion_point(class_scope:proto.move)
private:
class _Internal;
@@ -1523,31 +2273,36 @@ class move final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::proto::angles* viewangles_;
- uint32_t commands_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::proto::angles* viewangles_;
+ uint32_t commands_;
+ uint32_t active_item_;
+ uint32_t sequence_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
-class remove_player final :
- public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.remove_player) */ {
+class remove_entity final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.remove_entity) */ {
public:
- inline remove_player() : remove_player(nullptr) {}
- ~remove_player() override;
- explicit constexpr remove_player(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ inline remove_entity() : remove_entity(nullptr) {}
+ ~remove_entity() override;
+ explicit PROTOBUF_CONSTEXPR remove_entity(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
- remove_player(const remove_player& from);
- remove_player(remove_player&& from) noexcept
- : remove_player() {
+ remove_entity(const remove_entity& from);
+ remove_entity(remove_entity&& from) noexcept
+ : remove_entity() {
*this = ::std::move(from);
}
- inline remove_player& operator=(const remove_player& from) {
+ inline remove_entity& operator=(const remove_entity& from) {
CopyFrom(from);
return *this;
}
- inline remove_player& operator=(remove_player&& from) noexcept {
+ inline remove_entity& operator=(remove_entity&& from) noexcept {
if (this == &from) return *this;
if (GetOwningArena() == from.GetOwningArena()
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
@@ -1570,20 +2325,20 @@ class remove_player final :
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return default_instance().GetMetadata().reflection;
}
- static const remove_player& default_instance() {
+ static const remove_entity& default_instance() {
return *internal_default_instance();
}
- static inline const remove_player* internal_default_instance() {
- return reinterpret_cast<const remove_player*>(
- &_remove_player_default_instance_);
+ static inline const remove_entity* internal_default_instance() {
+ return reinterpret_cast<const remove_entity*>(
+ &_remove_entity_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 8;
+ 12;
- friend void swap(remove_player& a, remove_player& b) {
+ friend void swap(remove_entity& a, remove_entity& b) {
a.Swap(&b);
}
- inline void Swap(remove_player* other) {
+ inline void Swap(remove_entity* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
@@ -1596,7 +2351,7 @@ class remove_player final :
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
}
}
- void UnsafeArenaSwap(remove_player* other) {
+ void UnsafeArenaSwap(remove_entity* other) {
if (other == this) return;
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
@@ -1604,15 +2359,17 @@ class remove_player final :
// implements Message ----------------------------------------------
- remove_player* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
- return CreateMaybeMessage<remove_player>(arena);
+ remove_entity* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<remove_entity>(arena);
}
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
- void CopyFrom(const remove_player& from);
+ void CopyFrom(const remove_entity& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const remove_player& from);
+ void MergeFrom( const remove_entity& from) {
+ remove_entity::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -1621,25 +2378,22 @@ class remove_player final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
- void InternalSwap(remove_player* other);
+ void InternalSwap(remove_entity* other);
private:
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
- return "proto.remove_player";
+ return "proto.remove_entity";
}
protected:
- explicit remove_player(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ explicit remove_entity(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -1663,15 +2417,18 @@ class remove_player final :
void _internal_set_index(uint32_t value);
public:
- // @@protoc_insertion_point(class_scope:proto.remove_player)
+ // @@protoc_insertion_point(class_scope:proto.remove_entity)
private:
class _Internal;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- uint32_t index_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ uint32_t index_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -1681,7 +2438,7 @@ class say final :
public:
inline say() : say(nullptr) {}
~say() override;
- explicit constexpr say(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR say(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
say(const say& from);
say(say&& from) noexcept
@@ -1724,7 +2481,7 @@ class say final :
&_say_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 9;
+ 13;
friend void swap(say& a, say& b) {
a.Swap(&b);
@@ -1756,9 +2513,11 @@ class say final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const say& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const say& from);
+ void MergeFrom( const say& from) {
+ say::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -1767,10 +2526,10 @@ class say final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(say* other);
@@ -1783,9 +2542,6 @@ class say final :
protected:
explicit say(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -1821,8 +2577,11 @@ class say final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr text_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr text_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -1832,7 +2591,7 @@ class hear_player final :
public:
inline hear_player() : hear_player(nullptr) {}
~hear_player() override;
- explicit constexpr hear_player(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR hear_player(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
hear_player(const hear_player& from);
hear_player(hear_player&& from) noexcept
@@ -1875,7 +2634,7 @@ class hear_player final :
&_hear_player_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 10;
+ 14;
friend void swap(hear_player& a, hear_player& b) {
a.Swap(&b);
@@ -1907,9 +2666,11 @@ class hear_player final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const hear_player& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const hear_player& from);
+ void MergeFrom( const hear_player& from) {
+ hear_player::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -1918,10 +2679,10 @@ class hear_player final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(hear_player* other);
@@ -1934,9 +2695,6 @@ class hear_player final :
protected:
explicit hear_player(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -1982,9 +2740,12 @@ class hear_player final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr text_;
- uint32_t index_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr text_;
+ uint32_t index_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -1994,7 +2755,7 @@ class request_chunk final :
public:
inline request_chunk() : request_chunk(nullptr) {}
~request_chunk() override;
- explicit constexpr request_chunk(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR request_chunk(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
request_chunk(const request_chunk& from);
request_chunk(request_chunk&& from) noexcept
@@ -2037,7 +2798,7 @@ class request_chunk final :
&_request_chunk_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 11;
+ 15;
friend void swap(request_chunk& a, request_chunk& b) {
a.Swap(&b);
@@ -2069,9 +2830,11 @@ class request_chunk final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const request_chunk& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const request_chunk& from);
+ void MergeFrom( const request_chunk& from) {
+ request_chunk::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -2080,10 +2843,10 @@ class request_chunk final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(request_chunk* other);
@@ -2096,9 +2859,6 @@ class request_chunk final :
protected:
explicit request_chunk(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -2138,8 +2898,11 @@ class request_chunk final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::proto::coords* chunk_pos_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::proto::coords* chunk_pos_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -2149,7 +2912,7 @@ class remove_chunk final :
public:
inline remove_chunk() : remove_chunk(nullptr) {}
~remove_chunk() override;
- explicit constexpr remove_chunk(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR remove_chunk(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
remove_chunk(const remove_chunk& from);
remove_chunk(remove_chunk&& from) noexcept
@@ -2192,7 +2955,7 @@ class remove_chunk final :
&_remove_chunk_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 12;
+ 16;
friend void swap(remove_chunk& a, remove_chunk& b) {
a.Swap(&b);
@@ -2224,9 +2987,11 @@ class remove_chunk final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const remove_chunk& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const remove_chunk& from);
+ void MergeFrom( const remove_chunk& from) {
+ remove_chunk::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -2235,10 +3000,10 @@ class remove_chunk final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(remove_chunk* other);
@@ -2251,9 +3016,6 @@ class remove_chunk final :
protected:
explicit remove_chunk(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -2293,8 +3055,11 @@ class remove_chunk final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::proto::coords* chunk_pos_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::proto::coords* chunk_pos_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -2304,7 +3069,7 @@ class chunk final :
public:
inline chunk() : chunk(nullptr) {}
~chunk() override;
- explicit constexpr chunk(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR chunk(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
chunk(const chunk& from);
chunk(chunk&& from) noexcept
@@ -2347,7 +3112,7 @@ class chunk final :
&_chunk_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 13;
+ 17;
friend void swap(chunk& a, chunk& b) {
a.Swap(&b);
@@ -2379,9 +3144,11 @@ class chunk final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const chunk& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const chunk& from);
+ void MergeFrom( const chunk& from) {
+ chunk::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -2390,10 +3157,10 @@ class chunk final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(chunk* other);
@@ -2406,9 +3173,6 @@ class chunk final :
protected:
explicit chunk(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -2471,10 +3235,13 @@ class chunk final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t > blocks_;
- mutable std::atomic<int> _blocks_cached_byte_size_;
- ::proto::coords* chunk_pos_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t > blocks_;
+ mutable std::atomic<int> _blocks_cached_byte_size_;
+ ::proto::coords* chunk_pos_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -2484,7 +3251,7 @@ class add_block final :
public:
inline add_block() : add_block(nullptr) {}
~add_block() override;
- explicit constexpr add_block(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR add_block(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
add_block(const add_block& from);
add_block(add_block&& from) noexcept
@@ -2527,7 +3294,7 @@ class add_block final :
&_add_block_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 14;
+ 18;
friend void swap(add_block& a, add_block& b) {
a.Swap(&b);
@@ -2559,9 +3326,11 @@ class add_block final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const add_block& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const add_block& from);
+ void MergeFrom( const add_block& from) {
+ add_block::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -2570,10 +3339,10 @@ class add_block final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(add_block* other);
@@ -2586,9 +3355,6 @@ class add_block final :
protected:
explicit add_block(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -2603,7 +3369,7 @@ class add_block final :
enum : int {
kChunkPosFieldNumber = 1,
kBlockPosFieldNumber = 2,
- kBlockFieldNumber = 3,
+ kActiveItemFieldNumber = 3,
};
// .proto.coords chunk_pos = 1;
bool has_chunk_pos() const;
@@ -2641,13 +3407,13 @@ class add_block final :
::proto::ivec3* block_pos);
::proto::ivec3* unsafe_arena_release_block_pos();
- // uint32 block = 3;
- void clear_block();
- uint32_t block() const;
- void set_block(uint32_t value);
+ // uint32 active_item = 3;
+ void clear_active_item();
+ uint32_t active_item() const;
+ void set_active_item(uint32_t value);
private:
- uint32_t _internal_block() const;
- void _internal_set_block(uint32_t value);
+ uint32_t _internal_active_item() const;
+ void _internal_set_active_item(uint32_t value);
public:
// @@protoc_insertion_point(class_scope:proto.add_block)
@@ -2657,10 +3423,13 @@ class add_block final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::proto::coords* chunk_pos_;
- ::proto::ivec3* block_pos_;
- uint32_t block_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::proto::coords* chunk_pos_;
+ ::proto::ivec3* block_pos_;
+ uint32_t active_item_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -2670,7 +3439,7 @@ class remove_block final :
public:
inline remove_block() : remove_block(nullptr) {}
~remove_block() override;
- explicit constexpr remove_block(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR remove_block(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
remove_block(const remove_block& from);
remove_block(remove_block&& from) noexcept
@@ -2713,7 +3482,7 @@ class remove_block final :
&_remove_block_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 15;
+ 19;
friend void swap(remove_block& a, remove_block& b) {
a.Swap(&b);
@@ -2745,9 +3514,11 @@ class remove_block final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const remove_block& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const remove_block& from);
+ void MergeFrom( const remove_block& from) {
+ remove_block::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -2756,10 +3527,10 @@ class remove_block final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(remove_block* other);
@@ -2772,9 +3543,6 @@ class remove_block final :
protected:
explicit remove_block(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -2833,9 +3601,12 @@ class remove_block final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::proto::coords* chunk_pos_;
- ::proto::ivec3* block_pos_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::proto::coords* chunk_pos_;
+ ::proto::ivec3* block_pos_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -2845,7 +3616,7 @@ class server_message final :
public:
inline server_message() : server_message(nullptr) {}
~server_message() override;
- explicit constexpr server_message(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR server_message(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
server_message(const server_message& from);
server_message(server_message&& from) noexcept
@@ -2888,7 +3659,7 @@ class server_message final :
&_server_message_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 16;
+ 20;
friend void swap(server_message& a, server_message& b) {
a.Swap(&b);
@@ -2920,9 +3691,11 @@ class server_message final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const server_message& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const server_message& from);
+ void MergeFrom( const server_message& from) {
+ server_message::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -2931,10 +3704,10 @@ class server_message final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(server_message* other);
@@ -2947,9 +3720,6 @@ class server_message final :
protected:
explicit server_message(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -2995,9 +3765,660 @@ class server_message final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_;
- bool fatal_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ struct Impl_ {
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr message_;
+ bool fatal_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
+ friend struct ::TableStruct_net_2eproto;
+};
+// -------------------------------------------------------------------
+
+class item_swap final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.item_swap) */ {
+ public:
+ inline item_swap() : item_swap(nullptr) {}
+ ~item_swap() override;
+ explicit PROTOBUF_CONSTEXPR item_swap(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ item_swap(const item_swap& from);
+ item_swap(item_swap&& from) noexcept
+ : item_swap() {
+ *this = ::std::move(from);
+ }
+
+ inline item_swap& operator=(const item_swap& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline item_swap& operator=(item_swap&& from) noexcept {
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+ && GetOwningArena() != nullptr
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
+ ) {
+ InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return default_instance().GetMetadata().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return default_instance().GetMetadata().reflection;
+ }
+ static const item_swap& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const item_swap* internal_default_instance() {
+ return reinterpret_cast<const item_swap*>(
+ &_item_swap_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 21;
+
+ friend void swap(item_swap& a, item_swap& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(item_swap* other) {
+ if (other == this) return;
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() != nullptr &&
+ GetOwningArena() == other->GetOwningArena()) {
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() == other->GetOwningArena()) {
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(item_swap* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ item_swap* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<item_swap>(arena);
+ }
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
+ void CopyFrom(const item_swap& from);
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
+ void MergeFrom( const item_swap& from) {
+ item_swap::MergeImpl(*this, from);
+ }
+ private:
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
+ public:
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
+
+ private:
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
+ void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(item_swap* other);
+
+ private:
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "proto.item_swap";
+ }
+ protected:
+ explicit item_swap(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned = false);
+ public:
+
+ static const ClassData _class_data_;
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kIndexAFieldNumber = 1,
+ kIndexBFieldNumber = 2,
+ };
+ // uint32 index_a = 1;
+ void clear_index_a();
+ uint32_t index_a() const;
+ void set_index_a(uint32_t value);
+ private:
+ uint32_t _internal_index_a() const;
+ void _internal_set_index_a(uint32_t value);
+ public:
+
+ // uint32 index_b = 2;
+ void clear_index_b();
+ uint32_t index_b() const;
+ void set_index_b(uint32_t value);
+ private:
+ uint32_t _internal_index_b() const;
+ void _internal_set_index_b(uint32_t value);
+ public:
+
+ // @@protoc_insertion_point(class_scope:proto.item_swap)
+ private:
+ class _Internal;
+
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ struct Impl_ {
+ uint32_t index_a_;
+ uint32_t index_b_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
+ friend struct ::TableStruct_net_2eproto;
+};
+// -------------------------------------------------------------------
+
+class item_use final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.item_use) */ {
+ public:
+ inline item_use() : item_use(nullptr) {}
+ ~item_use() override;
+ explicit PROTOBUF_CONSTEXPR item_use(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ item_use(const item_use& from);
+ item_use(item_use&& from) noexcept
+ : item_use() {
+ *this = ::std::move(from);
+ }
+
+ inline item_use& operator=(const item_use& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline item_use& operator=(item_use&& from) noexcept {
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+ && GetOwningArena() != nullptr
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
+ ) {
+ InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return default_instance().GetMetadata().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return default_instance().GetMetadata().reflection;
+ }
+ static const item_use& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const item_use* internal_default_instance() {
+ return reinterpret_cast<const item_use*>(
+ &_item_use_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 22;
+
+ friend void swap(item_use& a, item_use& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(item_use* other) {
+ if (other == this) return;
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() != nullptr &&
+ GetOwningArena() == other->GetOwningArena()) {
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() == other->GetOwningArena()) {
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(item_use* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ item_use* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<item_use>(arena);
+ }
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
+ void CopyFrom(const item_use& from);
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
+ void MergeFrom( const item_use& from) {
+ item_use::MergeImpl(*this, from);
+ }
+ private:
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
+ public:
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
+
+ private:
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
+ void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(item_use* other);
+
+ private:
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "proto.item_use";
+ }
+ protected:
+ explicit item_use(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned = false);
+ public:
+
+ static const ClassData _class_data_;
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kIndexFieldNumber = 1,
+ };
+ // uint32 index = 1;
+ void clear_index();
+ uint32_t index() const;
+ void set_index(uint32_t value);
+ private:
+ uint32_t _internal_index() const;
+ void _internal_set_index(uint32_t value);
+ public:
+
+ // @@protoc_insertion_point(class_scope:proto.item_use)
+ private:
+ class _Internal;
+
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ struct Impl_ {
+ uint32_t index_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
+ friend struct ::TableStruct_net_2eproto;
+};
+// -------------------------------------------------------------------
+
+class item_update final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.item_update) */ {
+ public:
+ inline item_update() : item_update(nullptr) {}
+ ~item_update() override;
+ explicit PROTOBUF_CONSTEXPR item_update(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ item_update(const item_update& from);
+ item_update(item_update&& from) noexcept
+ : item_update() {
+ *this = ::std::move(from);
+ }
+
+ inline item_update& operator=(const item_update& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline item_update& operator=(item_update&& from) noexcept {
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+ && GetOwningArena() != nullptr
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
+ ) {
+ InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return default_instance().GetMetadata().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return default_instance().GetMetadata().reflection;
+ }
+ static const item_update& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const item_update* internal_default_instance() {
+ return reinterpret_cast<const item_update*>(
+ &_item_update_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 23;
+
+ friend void swap(item_update& a, item_update& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(item_update* other) {
+ if (other == this) return;
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() != nullptr &&
+ GetOwningArena() == other->GetOwningArena()) {
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() == other->GetOwningArena()) {
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(item_update* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ item_update* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<item_update>(arena);
+ }
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
+ void CopyFrom(const item_update& from);
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
+ void MergeFrom( const item_update& from) {
+ item_update::MergeImpl(*this, from);
+ }
+ private:
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
+ public:
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
+
+ private:
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
+ void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(item_update* other);
+
+ private:
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "proto.item_update";
+ }
+ protected:
+ explicit item_update(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned = false);
+ public:
+
+ static const ClassData _class_data_;
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kItemsFieldNumber = 1,
+ };
+ // repeated .proto.item items = 1;
+ int items_size() const;
+ private:
+ int _internal_items_size() const;
+ public:
+ void clear_items();
+ ::proto::item* mutable_items(int index);
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item >*
+ mutable_items();
+ private:
+ const ::proto::item& _internal_items(int index) const;
+ ::proto::item* _internal_add_items();
+ public:
+ const ::proto::item& items(int index) const;
+ ::proto::item* add_items();
+ const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item >&
+ items() const;
+
+ // @@protoc_insertion_point(class_scope:proto.item_update)
+ private:
+ class _Internal;
+
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ struct Impl_ {
+ ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item > items_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ };
+ union { Impl_ _impl_; };
+ friend struct ::TableStruct_net_2eproto;
+};
+// -------------------------------------------------------------------
+
+class animate_update final :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:proto.animate_update) */ {
+ public:
+ inline animate_update() : animate_update(nullptr) {}
+ ~animate_update() override;
+ explicit PROTOBUF_CONSTEXPR animate_update(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ animate_update(const animate_update& from);
+ animate_update(animate_update&& from) noexcept
+ : animate_update() {
+ *this = ::std::move(from);
+ }
+
+ inline animate_update& operator=(const animate_update& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline animate_update& operator=(animate_update&& from) noexcept {
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()
+ #ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+ && GetOwningArena() != nullptr
+ #endif // !PROTOBUF_FORCE_COPY_IN_MOVE
+ ) {
+ InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return default_instance().GetMetadata().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return default_instance().GetMetadata().reflection;
+ }
+ static const animate_update& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const animate_update* internal_default_instance() {
+ return reinterpret_cast<const animate_update*>(
+ &_animate_update_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 24;
+
+ friend void swap(animate_update& a, animate_update& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(animate_update* other) {
+ if (other == this) return;
+ #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() != nullptr &&
+ GetOwningArena() == other->GetOwningArena()) {
+ #else // PROTOBUF_FORCE_COPY_IN_SWAP
+ if (GetOwningArena() == other->GetOwningArena()) {
+ #endif // !PROTOBUF_FORCE_COPY_IN_SWAP
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(animate_update* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ animate_update* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
+ return CreateMaybeMessage<animate_update>(arena);
+ }
+ using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
+ void CopyFrom(const animate_update& from);
+ using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
+ void MergeFrom( const animate_update& from) {
+ animate_update::MergeImpl(*this, from);
+ }
+ private:
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
+ public:
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ uint8_t* _InternalSerialize(
+ uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
+
+ private:
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
+ void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(animate_update* other);
+
+ private:
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "proto.animate_update";
+ }
+ protected:
+ explicit animate_update(::PROTOBUF_NAMESPACE_ID::Arena* arena,
+ bool is_message_owned = false);
+ public:
+
+ static const ClassData _class_data_;
+ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kAnimateFieldNumber = 1,
+ kTickFieldNumber = 2,
+ kSequenceFieldNumber = 3,
+ };
+ // .proto.animate animate = 1;
+ bool has_animate() const;
+ private:
+ bool _internal_has_animate() const;
+ public:
+ void clear_animate();
+ const ::proto::animate& animate() const;
+ PROTOBUF_NODISCARD ::proto::animate* release_animate();
+ ::proto::animate* mutable_animate();
+ void set_allocated_animate(::proto::animate* animate);
+ private:
+ const ::proto::animate& _internal_animate() const;
+ ::proto::animate* _internal_mutable_animate();
+ public:
+ void unsafe_arena_set_allocated_animate(
+ ::proto::animate* animate);
+ ::proto::animate* unsafe_arena_release_animate();
+
+ // uint32 tick = 2;
+ void clear_tick();
+ uint32_t tick() const;
+ void set_tick(uint32_t value);
+ private:
+ uint32_t _internal_tick() const;
+ void _internal_set_tick(uint32_t value);
+ public:
+
+ // optional uint32 sequence = 3;
+ bool has_sequence() const;
+ private:
+ bool _internal_has_sequence() const;
+ public:
+ void clear_sequence();
+ uint32_t sequence() const;
+ void set_sequence(uint32_t value);
+ private:
+ uint32_t _internal_sequence() const;
+ void _internal_set_sequence(uint32_t value);
+ public:
+
+ // @@protoc_insertion_point(class_scope:proto.animate_update)
+ private:
+ class _Internal;
+
+ template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ struct Impl_ {
+ ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ ::proto::animate* animate_;
+ uint32_t tick_;
+ uint32_t sequence_;
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// -------------------------------------------------------------------
@@ -3007,7 +4428,7 @@ class packet final :
public:
inline packet() : packet(nullptr) {}
~packet() override;
- explicit constexpr packet(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+ explicit PROTOBUF_CONSTEXPR packet(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
packet(const packet& from);
packet(packet&& from) noexcept
@@ -3049,8 +4470,8 @@ class packet final :
kAuthPacket = 1,
kInitPacket = 2,
kMovePacket = 3,
- kPlayerPacket = 4,
- kRemovePlayerPacket = 5,
+ kAnimateUpdatePacket = 4,
+ kRemoveEntityPacket = 5,
kSayPacket = 6,
kHearPlayerPacket = 7,
kRequestChunkPacket = 8,
@@ -3059,6 +4480,9 @@ class packet final :
kAddBlockPacket = 11,
kRemoveBlockPacket = 12,
kServerMessagePacket = 13,
+ kItemSwapPacket = 14,
+ kItemUsePacket = 16,
+ kItemUpdatePacket = 15,
CONTENTS_NOT_SET = 0,
};
@@ -3067,7 +4491,7 @@ class packet final :
&_packet_default_instance_);
}
static constexpr int kIndexInFileMessages =
- 17;
+ 25;
friend void swap(packet& a, packet& b) {
a.Swap(&b);
@@ -3099,9 +4523,11 @@ class packet final :
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(const packet& from);
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
- void MergeFrom(const packet& from);
+ void MergeFrom( const packet& from) {
+ packet::MergeImpl(*this, from);
+ }
private:
- static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
+ static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
public:
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
@@ -3110,10 +4536,10 @@ class packet final :
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
uint8_t* _InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
+ int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
private:
- void SharedCtor();
+ void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(packet* other);
@@ -3126,9 +4552,6 @@ class packet final :
protected:
explicit packet(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned = false);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
public:
static const ClassData _class_data_;
@@ -3144,8 +4567,8 @@ class packet final :
kAuthPacketFieldNumber = 1,
kInitPacketFieldNumber = 2,
kMovePacketFieldNumber = 3,
- kPlayerPacketFieldNumber = 4,
- kRemovePlayerPacketFieldNumber = 5,
+ kAnimateUpdatePacketFieldNumber = 4,
+ kRemoveEntityPacketFieldNumber = 5,
kSayPacketFieldNumber = 6,
kHearPlayerPacketFieldNumber = 7,
kRequestChunkPacketFieldNumber = 8,
@@ -3154,6 +4577,9 @@ class packet final :
kAddBlockPacketFieldNumber = 11,
kRemoveBlockPacketFieldNumber = 12,
kServerMessagePacketFieldNumber = 13,
+ kItemSwapPacketFieldNumber = 14,
+ kItemUsePacketFieldNumber = 16,
+ kItemUpdatePacketFieldNumber = 15,
};
// .proto.auth auth_packet = 1;
bool has_auth_packet() const;
@@ -3209,41 +4635,41 @@ class packet final :
::proto::move* move_packet);
::proto::move* unsafe_arena_release_move_packet();
- // .proto.player player_packet = 4;
- bool has_player_packet() const;
+ // .proto.animate_update animate_update_packet = 4;
+ bool has_animate_update_packet() const;
private:
- bool _internal_has_player_packet() const;
+ bool _internal_has_animate_update_packet() const;
public:
- void clear_player_packet();
- const ::proto::player& player_packet() const;
- PROTOBUF_NODISCARD ::proto::player* release_player_packet();
- ::proto::player* mutable_player_packet();
- void set_allocated_player_packet(::proto::player* player_packet);
- private:
- const ::proto::player& _internal_player_packet() const;
- ::proto::player* _internal_mutable_player_packet();
+ void clear_animate_update_packet();
+ const ::proto::animate_update& animate_update_packet() const;
+ PROTOBUF_NODISCARD ::proto::animate_update* release_animate_update_packet();
+ ::proto::animate_update* mutable_animate_update_packet();
+ void set_allocated_animate_update_packet(::proto::animate_update* animate_update_packet);
+ private:
+ const ::proto::animate_update& _internal_animate_update_packet() const;
+ ::proto::animate_update* _internal_mutable_animate_update_packet();
public:
- void unsafe_arena_set_allocated_player_packet(
- ::proto::player* player_packet);
- ::proto::player* unsafe_arena_release_player_packet();
+ void unsafe_arena_set_allocated_animate_update_packet(
+ ::proto::animate_update* animate_update_packet);
+ ::proto::animate_update* unsafe_arena_release_animate_update_packet();
- // .proto.remove_player remove_player_packet = 5;
- bool has_remove_player_packet() const;
+ // .proto.remove_entity remove_entity_packet = 5;
+ bool has_remove_entity_packet() const;
private:
- bool _internal_has_remove_player_packet() const;
+ bool _internal_has_remove_entity_packet() const;
public:
- void clear_remove_player_packet();
- const ::proto::remove_player& remove_player_packet() const;
- PROTOBUF_NODISCARD ::proto::remove_player* release_remove_player_packet();
- ::proto::remove_player* mutable_remove_player_packet();
- void set_allocated_remove_player_packet(::proto::remove_player* remove_player_packet);
- private:
- const ::proto::remove_player& _internal_remove_player_packet() const;
- ::proto::remove_player* _internal_mutable_remove_player_packet();
+ void clear_remove_entity_packet();
+ const ::proto::remove_entity& remove_entity_packet() const;
+ PROTOBUF_NODISCARD ::proto::remove_entity* release_remove_entity_packet();
+ ::proto::remove_entity* mutable_remove_entity_packet();
+ void set_allocated_remove_entity_packet(::proto::remove_entity* remove_entity_packet);
+ private:
+ const ::proto::remove_entity& _internal_remove_entity_packet() const;
+ ::proto::remove_entity* _internal_mutable_remove_entity_packet();
public:
- void unsafe_arena_set_allocated_remove_player_packet(
- ::proto::remove_player* remove_player_packet);
- ::proto::remove_player* unsafe_arena_release_remove_player_packet();
+ void unsafe_arena_set_allocated_remove_entity_packet(
+ ::proto::remove_entity* remove_entity_packet);
+ ::proto::remove_entity* unsafe_arena_release_remove_entity_packet();
// .proto.say say_packet = 6;
bool has_say_packet() const;
@@ -3389,6 +4815,60 @@ class packet final :
::proto::server_message* server_message_packet);
::proto::server_message* unsafe_arena_release_server_message_packet();
+ // .proto.item_swap item_swap_packet = 14;
+ bool has_item_swap_packet() const;
+ private:
+ bool _internal_has_item_swap_packet() const;
+ public:
+ void clear_item_swap_packet();
+ const ::proto::item_swap& item_swap_packet() const;
+ PROTOBUF_NODISCARD ::proto::item_swap* release_item_swap_packet();
+ ::proto::item_swap* mutable_item_swap_packet();
+ void set_allocated_item_swap_packet(::proto::item_swap* item_swap_packet);
+ private:
+ const ::proto::item_swap& _internal_item_swap_packet() const;
+ ::proto::item_swap* _internal_mutable_item_swap_packet();
+ public:
+ void unsafe_arena_set_allocated_item_swap_packet(
+ ::proto::item_swap* item_swap_packet);
+ ::proto::item_swap* unsafe_arena_release_item_swap_packet();
+
+ // .proto.item_use item_use_packet = 16;
+ bool has_item_use_packet() const;
+ private:
+ bool _internal_has_item_use_packet() const;
+ public:
+ void clear_item_use_packet();
+ const ::proto::item_use& item_use_packet() const;
+ PROTOBUF_NODISCARD ::proto::item_use* release_item_use_packet();
+ ::proto::item_use* mutable_item_use_packet();
+ void set_allocated_item_use_packet(::proto::item_use* item_use_packet);
+ private:
+ const ::proto::item_use& _internal_item_use_packet() const;
+ ::proto::item_use* _internal_mutable_item_use_packet();
+ public:
+ void unsafe_arena_set_allocated_item_use_packet(
+ ::proto::item_use* item_use_packet);
+ ::proto::item_use* unsafe_arena_release_item_use_packet();
+
+ // .proto.item_update item_update_packet = 15;
+ bool has_item_update_packet() const;
+ private:
+ bool _internal_has_item_update_packet() const;
+ public:
+ void clear_item_update_packet();
+ const ::proto::item_update& item_update_packet() const;
+ PROTOBUF_NODISCARD ::proto::item_update* release_item_update_packet();
+ ::proto::item_update* mutable_item_update_packet();
+ void set_allocated_item_update_packet(::proto::item_update* item_update_packet);
+ private:
+ const ::proto::item_update& _internal_item_update_packet() const;
+ ::proto::item_update* _internal_mutable_item_update_packet();
+ public:
+ void unsafe_arena_set_allocated_item_update_packet(
+ ::proto::item_update* item_update_packet);
+ ::proto::item_update* unsafe_arena_release_item_update_packet();
+
void clear_contents();
ContentsCase contents_case() const;
// @@protoc_insertion_point(class_scope:proto.packet)
@@ -3397,8 +4877,8 @@ class packet final :
void set_has_auth_packet();
void set_has_init_packet();
void set_has_move_packet();
- void set_has_player_packet();
- void set_has_remove_player_packet();
+ void set_has_animate_update_packet();
+ void set_has_remove_entity_packet();
void set_has_say_packet();
void set_has_hear_player_packet();
void set_has_request_chunk_packet();
@@ -3407,6 +4887,9 @@ class packet final :
void set_has_add_block_packet();
void set_has_remove_block_packet();
void set_has_server_message_packet();
+ void set_has_item_swap_packet();
+ void set_has_item_use_packet();
+ void set_has_item_update_packet();
inline bool has_contents() const;
inline void clear_has_contents();
@@ -3414,26 +4897,32 @@ class packet final :
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
- union ContentsUnion {
- constexpr ContentsUnion() : _constinit_{} {}
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_;
- ::proto::auth* auth_packet_;
- ::proto::init* init_packet_;
- ::proto::move* move_packet_;
- ::proto::player* player_packet_;
- ::proto::remove_player* remove_player_packet_;
- ::proto::say* say_packet_;
- ::proto::hear_player* hear_player_packet_;
- ::proto::request_chunk* request_chunk_packet_;
- ::proto::chunk* chunk_packet_;
- ::proto::remove_chunk* remove_chunk_packet_;
- ::proto::add_block* add_block_packet_;
- ::proto::remove_block* remove_block_packet_;
- ::proto::server_message* server_message_packet_;
- } contents_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
- uint32_t _oneof_case_[1];
+ struct Impl_ {
+ union ContentsUnion {
+ constexpr ContentsUnion() : _constinit_{} {}
+ ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_;
+ ::proto::auth* auth_packet_;
+ ::proto::init* init_packet_;
+ ::proto::move* move_packet_;
+ ::proto::animate_update* animate_update_packet_;
+ ::proto::remove_entity* remove_entity_packet_;
+ ::proto::say* say_packet_;
+ ::proto::hear_player* hear_player_packet_;
+ ::proto::request_chunk* request_chunk_packet_;
+ ::proto::chunk* chunk_packet_;
+ ::proto::remove_chunk* remove_chunk_packet_;
+ ::proto::add_block* add_block_packet_;
+ ::proto::remove_block* remove_block_packet_;
+ ::proto::server_message* server_message_packet_;
+ ::proto::item_swap* item_swap_packet_;
+ ::proto::item_use* item_use_packet_;
+ ::proto::item_update* item_update_packet_;
+ } contents_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ uint32_t _oneof_case_[1];
+ };
+ union { Impl_ _impl_; };
friend struct ::TableStruct_net_2eproto;
};
// ===================================================================
@@ -3449,10 +4938,10 @@ class packet final :
// float pitch = 1;
inline void angles::clear_pitch() {
- pitch_ = 0;
+ _impl_.pitch_ = 0;
}
inline float angles::_internal_pitch() const {
- return pitch_;
+ return _impl_.pitch_;
}
inline float angles::pitch() const {
// @@protoc_insertion_point(field_get:proto.angles.pitch)
@@ -3460,7 +4949,7 @@ inline float angles::pitch() const {
}
inline void angles::_internal_set_pitch(float value) {
- pitch_ = value;
+ _impl_.pitch_ = value;
}
inline void angles::set_pitch(float value) {
_internal_set_pitch(value);
@@ -3469,10 +4958,10 @@ inline void angles::set_pitch(float value) {
// float yaw = 2;
inline void angles::clear_yaw() {
- yaw_ = 0;
+ _impl_.yaw_ = 0;
}
inline float angles::_internal_yaw() const {
- return yaw_;
+ return _impl_.yaw_;
}
inline float angles::yaw() const {
// @@protoc_insertion_point(field_get:proto.angles.yaw)
@@ -3480,7 +4969,7 @@ inline float angles::yaw() const {
}
inline void angles::_internal_set_yaw(float value) {
- yaw_ = value;
+ _impl_.yaw_ = value;
}
inline void angles::set_yaw(float value) {
_internal_set_yaw(value);
@@ -3493,10 +4982,10 @@ inline void angles::set_yaw(float value) {
// int32 x = 1;
inline void coords::clear_x() {
- x_ = 0;
+ _impl_.x_ = 0;
}
inline int32_t coords::_internal_x() const {
- return x_;
+ return _impl_.x_;
}
inline int32_t coords::x() const {
// @@protoc_insertion_point(field_get:proto.coords.x)
@@ -3504,7 +4993,7 @@ inline int32_t coords::x() const {
}
inline void coords::_internal_set_x(int32_t value) {
- x_ = value;
+ _impl_.x_ = value;
}
inline void coords::set_x(int32_t value) {
_internal_set_x(value);
@@ -3513,10 +5002,10 @@ inline void coords::set_x(int32_t value) {
// int32 z = 2;
inline void coords::clear_z() {
- z_ = 0;
+ _impl_.z_ = 0;
}
inline int32_t coords::_internal_z() const {
- return z_;
+ return _impl_.z_;
}
inline int32_t coords::z() const {
// @@protoc_insertion_point(field_get:proto.coords.z)
@@ -3524,7 +5013,7 @@ inline int32_t coords::z() const {
}
inline void coords::_internal_set_z(int32_t value) {
- z_ = value;
+ _impl_.z_ = value;
}
inline void coords::set_z(int32_t value) {
_internal_set_z(value);
@@ -3537,10 +5026,10 @@ inline void coords::set_z(int32_t value) {
// float x = 1;
inline void vec3::clear_x() {
- x_ = 0;
+ _impl_.x_ = 0;
}
inline float vec3::_internal_x() const {
- return x_;
+ return _impl_.x_;
}
inline float vec3::x() const {
// @@protoc_insertion_point(field_get:proto.vec3.x)
@@ -3548,7 +5037,7 @@ inline float vec3::x() const {
}
inline void vec3::_internal_set_x(float value) {
- x_ = value;
+ _impl_.x_ = value;
}
inline void vec3::set_x(float value) {
_internal_set_x(value);
@@ -3557,10 +5046,10 @@ inline void vec3::set_x(float value) {
// float y = 2;
inline void vec3::clear_y() {
- y_ = 0;
+ _impl_.y_ = 0;
}
inline float vec3::_internal_y() const {
- return y_;
+ return _impl_.y_;
}
inline float vec3::y() const {
// @@protoc_insertion_point(field_get:proto.vec3.y)
@@ -3568,7 +5057,7 @@ inline float vec3::y() const {
}
inline void vec3::_internal_set_y(float value) {
- y_ = value;
+ _impl_.y_ = value;
}
inline void vec3::set_y(float value) {
_internal_set_y(value);
@@ -3577,10 +5066,10 @@ inline void vec3::set_y(float value) {
// float z = 3;
inline void vec3::clear_z() {
- z_ = 0;
+ _impl_.z_ = 0;
}
inline float vec3::_internal_z() const {
- return z_;
+ return _impl_.z_;
}
inline float vec3::z() const {
// @@protoc_insertion_point(field_get:proto.vec3.z)
@@ -3588,7 +5077,7 @@ inline float vec3::z() const {
}
inline void vec3::_internal_set_z(float value) {
- z_ = value;
+ _impl_.z_ = value;
}
inline void vec3::set_z(float value) {
_internal_set_z(value);
@@ -3601,10 +5090,10 @@ inline void vec3::set_z(float value) {
// int32 x = 1;
inline void ivec3::clear_x() {
- x_ = 0;
+ _impl_.x_ = 0;
}
inline int32_t ivec3::_internal_x() const {
- return x_;
+ return _impl_.x_;
}
inline int32_t ivec3::x() const {
// @@protoc_insertion_point(field_get:proto.ivec3.x)
@@ -3612,7 +5101,7 @@ inline int32_t ivec3::x() const {
}
inline void ivec3::_internal_set_x(int32_t value) {
- x_ = value;
+ _impl_.x_ = value;
}
inline void ivec3::set_x(int32_t value) {
_internal_set_x(value);
@@ -3621,10 +5110,10 @@ inline void ivec3::set_x(int32_t value) {
// int32 y = 2;
inline void ivec3::clear_y() {
- y_ = 0;
+ _impl_.y_ = 0;
}
inline int32_t ivec3::_internal_y() const {
- return y_;
+ return _impl_.y_;
}
inline int32_t ivec3::y() const {
// @@protoc_insertion_point(field_get:proto.ivec3.y)
@@ -3632,7 +5121,7 @@ inline int32_t ivec3::y() const {
}
inline void ivec3::_internal_set_y(int32_t value) {
- y_ = value;
+ _impl_.y_ = value;
}
inline void ivec3::set_y(int32_t value) {
_internal_set_y(value);
@@ -3641,10 +5130,10 @@ inline void ivec3::set_y(int32_t value) {
// int32 z = 3;
inline void ivec3::clear_z() {
- z_ = 0;
+ _impl_.z_ = 0;
}
inline int32_t ivec3::_internal_z() const {
- return z_;
+ return _impl_.z_;
}
inline int32_t ivec3::z() const {
// @@protoc_insertion_point(field_get:proto.ivec3.z)
@@ -3652,7 +5141,7 @@ inline int32_t ivec3::z() const {
}
inline void ivec3::_internal_set_z(int32_t value) {
- z_ = value;
+ _impl_.z_ = value;
}
inline void ivec3::set_z(int32_t value) {
_internal_set_z(value);
@@ -3661,87 +5150,67 @@ inline void ivec3::set_z(int32_t value) {
// -------------------------------------------------------------------
-// player
+// entity
// uint32 index = 1;
-inline void player::clear_index() {
- index_ = 0u;
+inline void entity::clear_index() {
+ _impl_.index_ = 0u;
}
-inline uint32_t player::_internal_index() const {
- return index_;
+inline uint32_t entity::_internal_index() const {
+ return _impl_.index_;
}
-inline uint32_t player::index() const {
- // @@protoc_insertion_point(field_get:proto.player.index)
+inline uint32_t entity::index() const {
+ // @@protoc_insertion_point(field_get:proto.entity.index)
return _internal_index();
}
-inline void player::_internal_set_index(uint32_t value) {
+inline void entity::_internal_set_index(uint32_t value) {
- index_ = value;
+ _impl_.index_ = value;
}
-inline void player::set_index(uint32_t value) {
+inline void entity::set_index(uint32_t value) {
_internal_set_index(value);
- // @@protoc_insertion_point(field_set:proto.player.index)
-}
-
-// uint32 commands = 2;
-inline void player::clear_commands() {
- commands_ = 0u;
-}
-inline uint32_t player::_internal_commands() const {
- return commands_;
-}
-inline uint32_t player::commands() const {
- // @@protoc_insertion_point(field_get:proto.player.commands)
- return _internal_commands();
-}
-inline void player::_internal_set_commands(uint32_t value) {
-
- commands_ = value;
-}
-inline void player::set_commands(uint32_t value) {
- _internal_set_commands(value);
- // @@protoc_insertion_point(field_set:proto.player.commands)
+ // @@protoc_insertion_point(field_set:proto.entity.index)
}
-// .proto.coords chunk_pos = 3;
-inline bool player::_internal_has_chunk_pos() const {
- return this != internal_default_instance() && chunk_pos_ != nullptr;
+// .proto.coords chunk_pos = 2;
+inline bool entity::_internal_has_chunk_pos() const {
+ return this != internal_default_instance() && _impl_.chunk_pos_ != nullptr;
}
-inline bool player::has_chunk_pos() const {
+inline bool entity::has_chunk_pos() const {
return _internal_has_chunk_pos();
}
-inline void player::clear_chunk_pos() {
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+inline void entity::clear_chunk_pos() {
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
}
-inline const ::proto::coords& player::_internal_chunk_pos() const {
- const ::proto::coords* p = chunk_pos_;
+inline const ::proto::coords& entity::_internal_chunk_pos() const {
+ const ::proto::coords* p = _impl_.chunk_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::coords&>(
::proto::_coords_default_instance_);
}
-inline const ::proto::coords& player::chunk_pos() const {
- // @@protoc_insertion_point(field_get:proto.player.chunk_pos)
+inline const ::proto::coords& entity::chunk_pos() const {
+ // @@protoc_insertion_point(field_get:proto.entity.chunk_pos)
return _internal_chunk_pos();
}
-inline void player::unsafe_arena_set_allocated_chunk_pos(
+inline void entity::unsafe_arena_set_allocated_chunk_pos(
::proto::coords* chunk_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(chunk_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.chunk_pos_);
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
if (chunk_pos) {
} else {
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.player.chunk_pos)
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.entity.chunk_pos)
}
-inline ::proto::coords* player::release_chunk_pos() {
+inline ::proto::coords* entity::release_chunk_pos() {
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -3753,34 +5222,34 @@ inline ::proto::coords* player::release_chunk_pos() {
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp;
}
-inline ::proto::coords* player::unsafe_arena_release_chunk_pos() {
- // @@protoc_insertion_point(field_release:proto.player.chunk_pos)
+inline ::proto::coords* entity::unsafe_arena_release_chunk_pos() {
+ // @@protoc_insertion_point(field_release:proto.entity.chunk_pos)
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
return temp;
}
-inline ::proto::coords* player::_internal_mutable_chunk_pos() {
+inline ::proto::coords* entity::_internal_mutable_chunk_pos() {
- if (chunk_pos_ == nullptr) {
+ if (_impl_.chunk_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::coords>(GetArenaForAllocation());
- chunk_pos_ = p;
+ _impl_.chunk_pos_ = p;
}
- return chunk_pos_;
+ return _impl_.chunk_pos_;
}
-inline ::proto::coords* player::mutable_chunk_pos() {
+inline ::proto::coords* entity::mutable_chunk_pos() {
::proto::coords* _msg = _internal_mutable_chunk_pos();
- // @@protoc_insertion_point(field_mutable:proto.player.chunk_pos)
+ // @@protoc_insertion_point(field_mutable:proto.entity.chunk_pos)
return _msg;
}
-inline void player::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
+inline void entity::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete chunk_pos_;
+ delete _impl_.chunk_pos_;
}
if (chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::coords>::GetOwningArena(chunk_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(chunk_pos);
if (message_arena != submessage_arena) {
chunk_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, chunk_pos, submessage_arena);
@@ -3789,49 +5258,49 @@ inline void player::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
} else {
}
- chunk_pos_ = chunk_pos;
- // @@protoc_insertion_point(field_set_allocated:proto.player.chunk_pos)
+ _impl_.chunk_pos_ = chunk_pos;
+ // @@protoc_insertion_point(field_set_allocated:proto.entity.chunk_pos)
}
-// .proto.vec3 local_pos = 4;
-inline bool player::_internal_has_local_pos() const {
- return this != internal_default_instance() && local_pos_ != nullptr;
+// .proto.vec3 local_pos = 3;
+inline bool entity::_internal_has_local_pos() const {
+ return this != internal_default_instance() && _impl_.local_pos_ != nullptr;
}
-inline bool player::has_local_pos() const {
+inline bool entity::has_local_pos() const {
return _internal_has_local_pos();
}
-inline void player::clear_local_pos() {
- if (GetArenaForAllocation() == nullptr && local_pos_ != nullptr) {
- delete local_pos_;
+inline void entity::clear_local_pos() {
+ if (GetArenaForAllocation() == nullptr && _impl_.local_pos_ != nullptr) {
+ delete _impl_.local_pos_;
}
- local_pos_ = nullptr;
+ _impl_.local_pos_ = nullptr;
}
-inline const ::proto::vec3& player::_internal_local_pos() const {
- const ::proto::vec3* p = local_pos_;
+inline const ::proto::vec3& entity::_internal_local_pos() const {
+ const ::proto::vec3* p = _impl_.local_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::vec3&>(
::proto::_vec3_default_instance_);
}
-inline const ::proto::vec3& player::local_pos() const {
- // @@protoc_insertion_point(field_get:proto.player.local_pos)
+inline const ::proto::vec3& entity::local_pos() const {
+ // @@protoc_insertion_point(field_get:proto.entity.local_pos)
return _internal_local_pos();
}
-inline void player::unsafe_arena_set_allocated_local_pos(
+inline void entity::unsafe_arena_set_allocated_local_pos(
::proto::vec3* local_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(local_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.local_pos_);
}
- local_pos_ = local_pos;
+ _impl_.local_pos_ = local_pos;
if (local_pos) {
} else {
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.player.local_pos)
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.entity.local_pos)
}
-inline ::proto::vec3* player::release_local_pos() {
+inline ::proto::vec3* entity::release_local_pos() {
- ::proto::vec3* temp = local_pos_;
- local_pos_ = nullptr;
+ ::proto::vec3* temp = _impl_.local_pos_;
+ _impl_.local_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -3843,34 +5312,34 @@ inline ::proto::vec3* player::release_local_pos() {
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp;
}
-inline ::proto::vec3* player::unsafe_arena_release_local_pos() {
- // @@protoc_insertion_point(field_release:proto.player.local_pos)
+inline ::proto::vec3* entity::unsafe_arena_release_local_pos() {
+ // @@protoc_insertion_point(field_release:proto.entity.local_pos)
- ::proto::vec3* temp = local_pos_;
- local_pos_ = nullptr;
+ ::proto::vec3* temp = _impl_.local_pos_;
+ _impl_.local_pos_ = nullptr;
return temp;
}
-inline ::proto::vec3* player::_internal_mutable_local_pos() {
+inline ::proto::vec3* entity::_internal_mutable_local_pos() {
- if (local_pos_ == nullptr) {
+ if (_impl_.local_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::vec3>(GetArenaForAllocation());
- local_pos_ = p;
+ _impl_.local_pos_ = p;
}
- return local_pos_;
+ return _impl_.local_pos_;
}
-inline ::proto::vec3* player::mutable_local_pos() {
+inline ::proto::vec3* entity::mutable_local_pos() {
::proto::vec3* _msg = _internal_mutable_local_pos();
- // @@protoc_insertion_point(field_mutable:proto.player.local_pos)
+ // @@protoc_insertion_point(field_mutable:proto.entity.local_pos)
return _msg;
}
-inline void player::set_allocated_local_pos(::proto::vec3* local_pos) {
+inline void entity::set_allocated_local_pos(::proto::vec3* local_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete local_pos_;
+ delete _impl_.local_pos_;
}
if (local_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::vec3>::GetOwningArena(local_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(local_pos);
if (message_arena != submessage_arena) {
local_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, local_pos, submessage_arena);
@@ -3879,49 +5348,163 @@ inline void player::set_allocated_local_pos(::proto::vec3* local_pos) {
} else {
}
- local_pos_ = local_pos;
- // @@protoc_insertion_point(field_set_allocated:proto.player.local_pos)
+ _impl_.local_pos_ = local_pos;
+ // @@protoc_insertion_point(field_set_allocated:proto.entity.local_pos)
}
-// .proto.angles viewangles = 5;
-inline bool player::_internal_has_viewangles() const {
- return this != internal_default_instance() && viewangles_ != nullptr;
+// -------------------------------------------------------------------
+
+// animate
+
+// .proto.entity entity = 1;
+inline bool animate::_internal_has_entity() const {
+ return this != internal_default_instance() && _impl_.entity_ != nullptr;
+}
+inline bool animate::has_entity() const {
+ return _internal_has_entity();
+}
+inline void animate::clear_entity() {
+ if (GetArenaForAllocation() == nullptr && _impl_.entity_ != nullptr) {
+ delete _impl_.entity_;
+ }
+ _impl_.entity_ = nullptr;
+}
+inline const ::proto::entity& animate::_internal_entity() const {
+ const ::proto::entity* p = _impl_.entity_;
+ return p != nullptr ? *p : reinterpret_cast<const ::proto::entity&>(
+ ::proto::_entity_default_instance_);
+}
+inline const ::proto::entity& animate::entity() const {
+ // @@protoc_insertion_point(field_get:proto.animate.entity)
+ return _internal_entity();
+}
+inline void animate::unsafe_arena_set_allocated_entity(
+ ::proto::entity* entity) {
+ if (GetArenaForAllocation() == nullptr) {
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.entity_);
+ }
+ _impl_.entity_ = entity;
+ if (entity) {
+
+ } else {
+
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.animate.entity)
}
-inline bool player::has_viewangles() const {
+inline ::proto::entity* animate::release_entity() {
+
+ ::proto::entity* temp = _impl_.entity_;
+ _impl_.entity_ = nullptr;
+#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ if (GetArenaForAllocation() == nullptr) { delete old; }
+#else // PROTOBUF_FORCE_COPY_IN_RELEASE
+ if (GetArenaForAllocation() != nullptr) {
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ }
+#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
+ return temp;
+}
+inline ::proto::entity* animate::unsafe_arena_release_entity() {
+ // @@protoc_insertion_point(field_release:proto.animate.entity)
+
+ ::proto::entity* temp = _impl_.entity_;
+ _impl_.entity_ = nullptr;
+ return temp;
+}
+inline ::proto::entity* animate::_internal_mutable_entity() {
+
+ if (_impl_.entity_ == nullptr) {
+ auto* p = CreateMaybeMessage<::proto::entity>(GetArenaForAllocation());
+ _impl_.entity_ = p;
+ }
+ return _impl_.entity_;
+}
+inline ::proto::entity* animate::mutable_entity() {
+ ::proto::entity* _msg = _internal_mutable_entity();
+ // @@protoc_insertion_point(field_mutable:proto.animate.entity)
+ return _msg;
+}
+inline void animate::set_allocated_entity(::proto::entity* entity) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
+ if (message_arena == nullptr) {
+ delete _impl_.entity_;
+ }
+ if (entity) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(entity);
+ if (message_arena != submessage_arena) {
+ entity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, entity, submessage_arena);
+ }
+
+ } else {
+
+ }
+ _impl_.entity_ = entity;
+ // @@protoc_insertion_point(field_set_allocated:proto.animate.entity)
+}
+
+// uint32 commands = 2;
+inline void animate::clear_commands() {
+ _impl_.commands_ = 0u;
+}
+inline uint32_t animate::_internal_commands() const {
+ return _impl_.commands_;
+}
+inline uint32_t animate::commands() const {
+ // @@protoc_insertion_point(field_get:proto.animate.commands)
+ return _internal_commands();
+}
+inline void animate::_internal_set_commands(uint32_t value) {
+
+ _impl_.commands_ = value;
+}
+inline void animate::set_commands(uint32_t value) {
+ _internal_set_commands(value);
+ // @@protoc_insertion_point(field_set:proto.animate.commands)
+}
+
+// .proto.angles viewangles = 3;
+inline bool animate::_internal_has_viewangles() const {
+ return this != internal_default_instance() && _impl_.viewangles_ != nullptr;
+}
+inline bool animate::has_viewangles() const {
return _internal_has_viewangles();
}
-inline void player::clear_viewangles() {
- if (GetArenaForAllocation() == nullptr && viewangles_ != nullptr) {
- delete viewangles_;
+inline void animate::clear_viewangles() {
+ if (GetArenaForAllocation() == nullptr && _impl_.viewangles_ != nullptr) {
+ delete _impl_.viewangles_;
}
- viewangles_ = nullptr;
+ _impl_.viewangles_ = nullptr;
}
-inline const ::proto::angles& player::_internal_viewangles() const {
- const ::proto::angles* p = viewangles_;
+inline const ::proto::angles& animate::_internal_viewangles() const {
+ const ::proto::angles* p = _impl_.viewangles_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::angles&>(
::proto::_angles_default_instance_);
}
-inline const ::proto::angles& player::viewangles() const {
- // @@protoc_insertion_point(field_get:proto.player.viewangles)
+inline const ::proto::angles& animate::viewangles() const {
+ // @@protoc_insertion_point(field_get:proto.animate.viewangles)
return _internal_viewangles();
}
-inline void player::unsafe_arena_set_allocated_viewangles(
+inline void animate::unsafe_arena_set_allocated_viewangles(
::proto::angles* viewangles) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(viewangles_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.viewangles_);
}
- viewangles_ = viewangles;
+ _impl_.viewangles_ = viewangles;
if (viewangles) {
} else {
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.player.viewangles)
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.animate.viewangles)
}
-inline ::proto::angles* player::release_viewangles() {
+inline ::proto::angles* animate::release_viewangles() {
- ::proto::angles* temp = viewangles_;
- viewangles_ = nullptr;
+ ::proto::angles* temp = _impl_.viewangles_;
+ _impl_.viewangles_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -3933,34 +5516,34 @@ inline ::proto::angles* player::release_viewangles() {
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp;
}
-inline ::proto::angles* player::unsafe_arena_release_viewangles() {
- // @@protoc_insertion_point(field_release:proto.player.viewangles)
+inline ::proto::angles* animate::unsafe_arena_release_viewangles() {
+ // @@protoc_insertion_point(field_release:proto.animate.viewangles)
- ::proto::angles* temp = viewangles_;
- viewangles_ = nullptr;
+ ::proto::angles* temp = _impl_.viewangles_;
+ _impl_.viewangles_ = nullptr;
return temp;
}
-inline ::proto::angles* player::_internal_mutable_viewangles() {
+inline ::proto::angles* animate::_internal_mutable_viewangles() {
- if (viewangles_ == nullptr) {
+ if (_impl_.viewangles_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::angles>(GetArenaForAllocation());
- viewangles_ = p;
+ _impl_.viewangles_ = p;
}
- return viewangles_;
+ return _impl_.viewangles_;
}
-inline ::proto::angles* player::mutable_viewangles() {
+inline ::proto::angles* animate::mutable_viewangles() {
::proto::angles* _msg = _internal_mutable_viewangles();
- // @@protoc_insertion_point(field_mutable:proto.player.viewangles)
+ // @@protoc_insertion_point(field_mutable:proto.animate.viewangles)
return _msg;
}
-inline void player::set_allocated_viewangles(::proto::angles* viewangles) {
+inline void animate::set_allocated_viewangles(::proto::angles* viewangles) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete viewangles_;
+ delete _impl_.viewangles_;
}
if (viewangles) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::angles>::GetOwningArena(viewangles);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(viewangles);
if (message_arena != submessage_arena) {
viewangles = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, viewangles, submessage_arena);
@@ -3969,49 +5552,49 @@ inline void player::set_allocated_viewangles(::proto::angles* viewangles) {
} else {
}
- viewangles_ = viewangles;
- // @@protoc_insertion_point(field_set_allocated:proto.player.viewangles)
+ _impl_.viewangles_ = viewangles;
+ // @@protoc_insertion_point(field_set_allocated:proto.animate.viewangles)
}
-// .proto.vec3 velocity = 6;
-inline bool player::_internal_has_velocity() const {
- return this != internal_default_instance() && velocity_ != nullptr;
+// .proto.vec3 velocity = 4;
+inline bool animate::_internal_has_velocity() const {
+ return this != internal_default_instance() && _impl_.velocity_ != nullptr;
}
-inline bool player::has_velocity() const {
+inline bool animate::has_velocity() const {
return _internal_has_velocity();
}
-inline void player::clear_velocity() {
- if (GetArenaForAllocation() == nullptr && velocity_ != nullptr) {
- delete velocity_;
+inline void animate::clear_velocity() {
+ if (GetArenaForAllocation() == nullptr && _impl_.velocity_ != nullptr) {
+ delete _impl_.velocity_;
}
- velocity_ = nullptr;
+ _impl_.velocity_ = nullptr;
}
-inline const ::proto::vec3& player::_internal_velocity() const {
- const ::proto::vec3* p = velocity_;
+inline const ::proto::vec3& animate::_internal_velocity() const {
+ const ::proto::vec3* p = _impl_.velocity_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::vec3&>(
::proto::_vec3_default_instance_);
}
-inline const ::proto::vec3& player::velocity() const {
- // @@protoc_insertion_point(field_get:proto.player.velocity)
+inline const ::proto::vec3& animate::velocity() const {
+ // @@protoc_insertion_point(field_get:proto.animate.velocity)
return _internal_velocity();
}
-inline void player::unsafe_arena_set_allocated_velocity(
+inline void animate::unsafe_arena_set_allocated_velocity(
::proto::vec3* velocity) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(velocity_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.velocity_);
}
- velocity_ = velocity;
+ _impl_.velocity_ = velocity;
if (velocity) {
} else {
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.player.velocity)
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.animate.velocity)
}
-inline ::proto::vec3* player::release_velocity() {
+inline ::proto::vec3* animate::release_velocity() {
- ::proto::vec3* temp = velocity_;
- velocity_ = nullptr;
+ ::proto::vec3* temp = _impl_.velocity_;
+ _impl_.velocity_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -4023,34 +5606,34 @@ inline ::proto::vec3* player::release_velocity() {
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp;
}
-inline ::proto::vec3* player::unsafe_arena_release_velocity() {
- // @@protoc_insertion_point(field_release:proto.player.velocity)
+inline ::proto::vec3* animate::unsafe_arena_release_velocity() {
+ // @@protoc_insertion_point(field_release:proto.animate.velocity)
- ::proto::vec3* temp = velocity_;
- velocity_ = nullptr;
+ ::proto::vec3* temp = _impl_.velocity_;
+ _impl_.velocity_ = nullptr;
return temp;
}
-inline ::proto::vec3* player::_internal_mutable_velocity() {
+inline ::proto::vec3* animate::_internal_mutable_velocity() {
- if (velocity_ == nullptr) {
+ if (_impl_.velocity_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::vec3>(GetArenaForAllocation());
- velocity_ = p;
+ _impl_.velocity_ = p;
}
- return velocity_;
+ return _impl_.velocity_;
}
-inline ::proto::vec3* player::mutable_velocity() {
+inline ::proto::vec3* animate::mutable_velocity() {
::proto::vec3* _msg = _internal_mutable_velocity();
- // @@protoc_insertion_point(field_mutable:proto.player.velocity)
+ // @@protoc_insertion_point(field_mutable:proto.animate.velocity)
return _msg;
}
-inline void player::set_allocated_velocity(::proto::vec3* velocity) {
+inline void animate::set_allocated_velocity(::proto::vec3* velocity) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete velocity_;
+ delete _impl_.velocity_;
}
if (velocity) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::vec3>::GetOwningArena(velocity);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(velocity);
if (message_arena != submessage_arena) {
velocity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, velocity, submessage_arena);
@@ -4059,8 +5642,320 @@ inline void player::set_allocated_velocity(::proto::vec3* velocity) {
} else {
}
- velocity_ = velocity;
- // @@protoc_insertion_point(field_set_allocated:proto.player.velocity)
+ _impl_.velocity_ = velocity;
+ // @@protoc_insertion_point(field_set_allocated:proto.animate.velocity)
+}
+
+// uint32 active_item = 5;
+inline void animate::clear_active_item() {
+ _impl_.active_item_ = 0u;
+}
+inline uint32_t animate::_internal_active_item() const {
+ return _impl_.active_item_;
+}
+inline uint32_t animate::active_item() const {
+ // @@protoc_insertion_point(field_get:proto.animate.active_item)
+ return _internal_active_item();
+}
+inline void animate::_internal_set_active_item(uint32_t value) {
+
+ _impl_.active_item_ = value;
+}
+inline void animate::set_active_item(uint32_t value) {
+ _internal_set_active_item(value);
+ // @@protoc_insertion_point(field_set:proto.animate.active_item)
+}
+
+// -------------------------------------------------------------------
+
+// item
+
+// uint32 index = 1;
+inline void item::clear_index() {
+ _impl_.index_ = 0u;
+}
+inline uint32_t item::_internal_index() const {
+ return _impl_.index_;
+}
+inline uint32_t item::index() const {
+ // @@protoc_insertion_point(field_get:proto.item.index)
+ return _internal_index();
+}
+inline void item::_internal_set_index(uint32_t value) {
+
+ _impl_.index_ = value;
+}
+inline void item::set_index(uint32_t value) {
+ _internal_set_index(value);
+ // @@protoc_insertion_point(field_set:proto.item.index)
+}
+
+// uint32 type = 2;
+inline void item::clear_type() {
+ _impl_.type_ = 0u;
+}
+inline uint32_t item::_internal_type() const {
+ return _impl_.type_;
+}
+inline uint32_t item::type() const {
+ // @@protoc_insertion_point(field_get:proto.item.type)
+ return _internal_type();
+}
+inline void item::_internal_set_type(uint32_t value) {
+
+ _impl_.type_ = value;
+}
+inline void item::set_type(uint32_t value) {
+ _internal_set_type(value);
+ // @@protoc_insertion_point(field_set:proto.item.type)
+}
+
+// uint32 quantity = 3;
+inline void item::clear_quantity() {
+ _impl_.quantity_ = 0u;
+}
+inline uint32_t item::_internal_quantity() const {
+ return _impl_.quantity_;
+}
+inline uint32_t item::quantity() const {
+ // @@protoc_insertion_point(field_get:proto.item.quantity)
+ return _internal_quantity();
+}
+inline void item::_internal_set_quantity(uint32_t value) {
+
+ _impl_.quantity_ = value;
+}
+inline void item::set_quantity(uint32_t value) {
+ _internal_set_quantity(value);
+ // @@protoc_insertion_point(field_set:proto.item.quantity)
+}
+
+// -------------------------------------------------------------------
+
+// item_array
+
+// repeated .proto.item items = 1;
+inline int item_array::_internal_items_size() const {
+ return _impl_.items_.size();
+}
+inline int item_array::items_size() const {
+ return _internal_items_size();
+}
+inline void item_array::clear_items() {
+ _impl_.items_.Clear();
+}
+inline ::proto::item* item_array::mutable_items(int index) {
+ // @@protoc_insertion_point(field_mutable:proto.item_array.items)
+ return _impl_.items_.Mutable(index);
+}
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item >*
+item_array::mutable_items() {
+ // @@protoc_insertion_point(field_mutable_list:proto.item_array.items)
+ return &_impl_.items_;
+}
+inline const ::proto::item& item_array::_internal_items(int index) const {
+ return _impl_.items_.Get(index);
+}
+inline const ::proto::item& item_array::items(int index) const {
+ // @@protoc_insertion_point(field_get:proto.item_array.items)
+ return _internal_items(index);
+}
+inline ::proto::item* item_array::_internal_add_items() {
+ return _impl_.items_.Add();
+}
+inline ::proto::item* item_array::add_items() {
+ ::proto::item* _add = _internal_add_items();
+ // @@protoc_insertion_point(field_add:proto.item_array.items)
+ return _add;
+}
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item >&
+item_array::items() const {
+ // @@protoc_insertion_point(field_list:proto.item_array.items)
+ return _impl_.items_;
+}
+
+// -------------------------------------------------------------------
+
+// player
+
+// .proto.animate animate = 1;
+inline bool player::_internal_has_animate() const {
+ return this != internal_default_instance() && _impl_.animate_ != nullptr;
+}
+inline bool player::has_animate() const {
+ return _internal_has_animate();
+}
+inline void player::clear_animate() {
+ if (GetArenaForAllocation() == nullptr && _impl_.animate_ != nullptr) {
+ delete _impl_.animate_;
+ }
+ _impl_.animate_ = nullptr;
+}
+inline const ::proto::animate& player::_internal_animate() const {
+ const ::proto::animate* p = _impl_.animate_;
+ return p != nullptr ? *p : reinterpret_cast<const ::proto::animate&>(
+ ::proto::_animate_default_instance_);
+}
+inline const ::proto::animate& player::animate() const {
+ // @@protoc_insertion_point(field_get:proto.player.animate)
+ return _internal_animate();
+}
+inline void player::unsafe_arena_set_allocated_animate(
+ ::proto::animate* animate) {
+ if (GetArenaForAllocation() == nullptr) {
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.animate_);
+ }
+ _impl_.animate_ = animate;
+ if (animate) {
+
+ } else {
+
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.player.animate)
+}
+inline ::proto::animate* player::release_animate() {
+
+ ::proto::animate* temp = _impl_.animate_;
+ _impl_.animate_ = nullptr;
+#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ if (GetArenaForAllocation() == nullptr) { delete old; }
+#else // PROTOBUF_FORCE_COPY_IN_RELEASE
+ if (GetArenaForAllocation() != nullptr) {
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ }
+#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
+ return temp;
+}
+inline ::proto::animate* player::unsafe_arena_release_animate() {
+ // @@protoc_insertion_point(field_release:proto.player.animate)
+
+ ::proto::animate* temp = _impl_.animate_;
+ _impl_.animate_ = nullptr;
+ return temp;
+}
+inline ::proto::animate* player::_internal_mutable_animate() {
+
+ if (_impl_.animate_ == nullptr) {
+ auto* p = CreateMaybeMessage<::proto::animate>(GetArenaForAllocation());
+ _impl_.animate_ = p;
+ }
+ return _impl_.animate_;
+}
+inline ::proto::animate* player::mutable_animate() {
+ ::proto::animate* _msg = _internal_mutable_animate();
+ // @@protoc_insertion_point(field_mutable:proto.player.animate)
+ return _msg;
+}
+inline void player::set_allocated_animate(::proto::animate* animate) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
+ if (message_arena == nullptr) {
+ delete _impl_.animate_;
+ }
+ if (animate) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(animate);
+ if (message_arena != submessage_arena) {
+ animate = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, animate, submessage_arena);
+ }
+
+ } else {
+
+ }
+ _impl_.animate_ = animate;
+ // @@protoc_insertion_point(field_set_allocated:proto.player.animate)
+}
+
+// .proto.item_array inventory = 2;
+inline bool player::_internal_has_inventory() const {
+ return this != internal_default_instance() && _impl_.inventory_ != nullptr;
+}
+inline bool player::has_inventory() const {
+ return _internal_has_inventory();
+}
+inline void player::clear_inventory() {
+ if (GetArenaForAllocation() == nullptr && _impl_.inventory_ != nullptr) {
+ delete _impl_.inventory_;
+ }
+ _impl_.inventory_ = nullptr;
+}
+inline const ::proto::item_array& player::_internal_inventory() const {
+ const ::proto::item_array* p = _impl_.inventory_;
+ return p != nullptr ? *p : reinterpret_cast<const ::proto::item_array&>(
+ ::proto::_item_array_default_instance_);
+}
+inline const ::proto::item_array& player::inventory() const {
+ // @@protoc_insertion_point(field_get:proto.player.inventory)
+ return _internal_inventory();
+}
+inline void player::unsafe_arena_set_allocated_inventory(
+ ::proto::item_array* inventory) {
+ if (GetArenaForAllocation() == nullptr) {
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.inventory_);
+ }
+ _impl_.inventory_ = inventory;
+ if (inventory) {
+
+ } else {
+
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.player.inventory)
+}
+inline ::proto::item_array* player::release_inventory() {
+
+ ::proto::item_array* temp = _impl_.inventory_;
+ _impl_.inventory_ = nullptr;
+#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ if (GetArenaForAllocation() == nullptr) { delete old; }
+#else // PROTOBUF_FORCE_COPY_IN_RELEASE
+ if (GetArenaForAllocation() != nullptr) {
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ }
+#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
+ return temp;
+}
+inline ::proto::item_array* player::unsafe_arena_release_inventory() {
+ // @@protoc_insertion_point(field_release:proto.player.inventory)
+
+ ::proto::item_array* temp = _impl_.inventory_;
+ _impl_.inventory_ = nullptr;
+ return temp;
+}
+inline ::proto::item_array* player::_internal_mutable_inventory() {
+
+ if (_impl_.inventory_ == nullptr) {
+ auto* p = CreateMaybeMessage<::proto::item_array>(GetArenaForAllocation());
+ _impl_.inventory_ = p;
+ }
+ return _impl_.inventory_;
+}
+inline ::proto::item_array* player::mutable_inventory() {
+ ::proto::item_array* _msg = _internal_mutable_inventory();
+ // @@protoc_insertion_point(field_mutable:proto.player.inventory)
+ return _msg;
+}
+inline void player::set_allocated_inventory(::proto::item_array* inventory) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
+ if (message_arena == nullptr) {
+ delete _impl_.inventory_;
+ }
+ if (inventory) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(inventory);
+ if (message_arena != submessage_arena) {
+ inventory = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, inventory, submessage_arena);
+ }
+
+ } else {
+
+ }
+ _impl_.inventory_ = inventory;
+ // @@protoc_insertion_point(field_set_allocated:proto.player.inventory)
}
// -------------------------------------------------------------------
@@ -4069,7 +5964,7 @@ inline void player::set_allocated_velocity(::proto::vec3* velocity) {
// string username = 1;
inline void auth::clear_username() {
- username_.ClearToEmpty();
+ _impl_.username_.ClearToEmpty();
}
inline const std::string& auth::username() const {
// @@protoc_insertion_point(field_get:proto.auth.username)
@@ -4079,7 +5974,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void auth::set_username(ArgT0&& arg0, ArgT... args) {
- username_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ _impl_.username_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:proto.auth.username)
}
inline std::string* auth::mutable_username() {
@@ -4088,19 +5983,19 @@ inline std::string* auth::mutable_username() {
return _s;
}
inline const std::string& auth::_internal_username() const {
- return username_.Get();
+ return _impl_.username_.Get();
}
inline void auth::_internal_set_username(const std::string& value) {
- username_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ _impl_.username_.Set(value, GetArenaForAllocation());
}
inline std::string* auth::_internal_mutable_username() {
- return username_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return _impl_.username_.Mutable(GetArenaForAllocation());
}
inline std::string* auth::release_username() {
// @@protoc_insertion_point(field_release:proto.auth.username)
- return username_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return _impl_.username_.Release();
}
inline void auth::set_allocated_username(std::string* username) {
if (username != nullptr) {
@@ -4108,11 +6003,10 @@ inline void auth::set_allocated_username(std::string* username) {
} else {
}
- username_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), username,
- GetArenaForAllocation());
+ _impl_.username_.SetAllocated(username, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- if (username_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
- username_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ if (_impl_.username_.IsDefault()) {
+ _impl_.username_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:proto.auth.username)
@@ -4120,7 +6014,7 @@ inline void auth::set_allocated_username(std::string* username) {
// string password = 2;
inline void auth::clear_password() {
- password_.ClearToEmpty();
+ _impl_.password_.ClearToEmpty();
}
inline const std::string& auth::password() const {
// @@protoc_insertion_point(field_get:proto.auth.password)
@@ -4130,7 +6024,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void auth::set_password(ArgT0&& arg0, ArgT... args) {
- password_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ _impl_.password_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:proto.auth.password)
}
inline std::string* auth::mutable_password() {
@@ -4139,19 +6033,19 @@ inline std::string* auth::mutable_password() {
return _s;
}
inline const std::string& auth::_internal_password() const {
- return password_.Get();
+ return _impl_.password_.Get();
}
inline void auth::_internal_set_password(const std::string& value) {
- password_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ _impl_.password_.Set(value, GetArenaForAllocation());
}
inline std::string* auth::_internal_mutable_password() {
- return password_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return _impl_.password_.Mutable(GetArenaForAllocation());
}
inline std::string* auth::release_password() {
// @@protoc_insertion_point(field_release:proto.auth.password)
- return password_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return _impl_.password_.Release();
}
inline void auth::set_allocated_password(std::string* password) {
if (password != nullptr) {
@@ -4159,11 +6053,10 @@ inline void auth::set_allocated_password(std::string* password) {
} else {
}
- password_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), password,
- GetArenaForAllocation());
+ _impl_.password_.SetAllocated(password, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- if (password_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
- password_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ if (_impl_.password_.IsDefault()) {
+ _impl_.password_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:proto.auth.password)
@@ -4175,10 +6068,10 @@ inline void auth::set_allocated_password(std::string* password) {
// uint64 seed = 1;
inline void init::clear_seed() {
- seed_ = uint64_t{0u};
+ _impl_.seed_ = uint64_t{0u};
}
inline uint64_t init::_internal_seed() const {
- return seed_;
+ return _impl_.seed_;
}
inline uint64_t init::seed() const {
// @@protoc_insertion_point(field_get:proto.init.seed)
@@ -4186,7 +6079,7 @@ inline uint64_t init::seed() const {
}
inline void init::_internal_set_seed(uint64_t value) {
- seed_ = value;
+ _impl_.seed_ = value;
}
inline void init::set_seed(uint64_t value) {
_internal_set_seed(value);
@@ -4195,10 +6088,10 @@ inline void init::set_seed(uint64_t value) {
// int32 draw_distance = 2;
inline void init::clear_draw_distance() {
- draw_distance_ = 0;
+ _impl_.draw_distance_ = 0;
}
inline int32_t init::_internal_draw_distance() const {
- return draw_distance_;
+ return _impl_.draw_distance_;
}
inline int32_t init::draw_distance() const {
// @@protoc_insertion_point(field_get:proto.init.draw_distance)
@@ -4206,7 +6099,7 @@ inline int32_t init::draw_distance() const {
}
inline void init::_internal_set_draw_distance(int32_t value) {
- draw_distance_ = value;
+ _impl_.draw_distance_ = value;
}
inline void init::set_draw_distance(int32_t value) {
_internal_set_draw_distance(value);
@@ -4215,19 +6108,19 @@ inline void init::set_draw_distance(int32_t value) {
// .proto.player localplayer = 3;
inline bool init::_internal_has_localplayer() const {
- return this != internal_default_instance() && localplayer_ != nullptr;
+ return this != internal_default_instance() && _impl_.localplayer_ != nullptr;
}
inline bool init::has_localplayer() const {
return _internal_has_localplayer();
}
inline void init::clear_localplayer() {
- if (GetArenaForAllocation() == nullptr && localplayer_ != nullptr) {
- delete localplayer_;
+ if (GetArenaForAllocation() == nullptr && _impl_.localplayer_ != nullptr) {
+ delete _impl_.localplayer_;
}
- localplayer_ = nullptr;
+ _impl_.localplayer_ = nullptr;
}
inline const ::proto::player& init::_internal_localplayer() const {
- const ::proto::player* p = localplayer_;
+ const ::proto::player* p = _impl_.localplayer_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::player&>(
::proto::_player_default_instance_);
}
@@ -4238,9 +6131,9 @@ inline const ::proto::player& init::localplayer() const {
inline void init::unsafe_arena_set_allocated_localplayer(
::proto::player* localplayer) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(localplayer_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.localplayer_);
}
- localplayer_ = localplayer;
+ _impl_.localplayer_ = localplayer;
if (localplayer) {
} else {
@@ -4250,8 +6143,8 @@ inline void init::unsafe_arena_set_allocated_localplayer(
}
inline ::proto::player* init::release_localplayer() {
- ::proto::player* temp = localplayer_;
- localplayer_ = nullptr;
+ ::proto::player* temp = _impl_.localplayer_;
+ _impl_.localplayer_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -4266,17 +6159,17 @@ inline ::proto::player* init::release_localplayer() {
inline ::proto::player* init::unsafe_arena_release_localplayer() {
// @@protoc_insertion_point(field_release:proto.init.localplayer)
- ::proto::player* temp = localplayer_;
- localplayer_ = nullptr;
+ ::proto::player* temp = _impl_.localplayer_;
+ _impl_.localplayer_ = nullptr;
return temp;
}
inline ::proto::player* init::_internal_mutable_localplayer() {
- if (localplayer_ == nullptr) {
+ if (_impl_.localplayer_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::player>(GetArenaForAllocation());
- localplayer_ = p;
+ _impl_.localplayer_ = p;
}
- return localplayer_;
+ return _impl_.localplayer_;
}
inline ::proto::player* init::mutable_localplayer() {
::proto::player* _msg = _internal_mutable_localplayer();
@@ -4286,11 +6179,11 @@ inline ::proto::player* init::mutable_localplayer() {
inline void init::set_allocated_localplayer(::proto::player* localplayer) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete localplayer_;
+ delete _impl_.localplayer_;
}
if (localplayer) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::player>::GetOwningArena(localplayer);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(localplayer);
if (message_arena != submessage_arena) {
localplayer = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, localplayer, submessage_arena);
@@ -4299,20 +6192,60 @@ inline void init::set_allocated_localplayer(::proto::player* localplayer) {
} else {
}
- localplayer_ = localplayer;
+ _impl_.localplayer_ = localplayer;
// @@protoc_insertion_point(field_set_allocated:proto.init.localplayer)
}
+// uint32 tickrate = 4;
+inline void init::clear_tickrate() {
+ _impl_.tickrate_ = 0u;
+}
+inline uint32_t init::_internal_tickrate() const {
+ return _impl_.tickrate_;
+}
+inline uint32_t init::tickrate() const {
+ // @@protoc_insertion_point(field_get:proto.init.tickrate)
+ return _internal_tickrate();
+}
+inline void init::_internal_set_tickrate(uint32_t value) {
+
+ _impl_.tickrate_ = value;
+}
+inline void init::set_tickrate(uint32_t value) {
+ _internal_set_tickrate(value);
+ // @@protoc_insertion_point(field_set:proto.init.tickrate)
+}
+
+// uint32 tick = 5;
+inline void init::clear_tick() {
+ _impl_.tick_ = 0u;
+}
+inline uint32_t init::_internal_tick() const {
+ return _impl_.tick_;
+}
+inline uint32_t init::tick() const {
+ // @@protoc_insertion_point(field_get:proto.init.tick)
+ return _internal_tick();
+}
+inline void init::_internal_set_tick(uint32_t value) {
+
+ _impl_.tick_ = value;
+}
+inline void init::set_tick(uint32_t value) {
+ _internal_set_tick(value);
+ // @@protoc_insertion_point(field_set:proto.init.tick)
+}
+
// -------------------------------------------------------------------
// move
// uint32 commands = 1;
inline void move::clear_commands() {
- commands_ = 0u;
+ _impl_.commands_ = 0u;
}
inline uint32_t move::_internal_commands() const {
- return commands_;
+ return _impl_.commands_;
}
inline uint32_t move::commands() const {
// @@protoc_insertion_point(field_get:proto.move.commands)
@@ -4320,7 +6253,7 @@ inline uint32_t move::commands() const {
}
inline void move::_internal_set_commands(uint32_t value) {
- commands_ = value;
+ _impl_.commands_ = value;
}
inline void move::set_commands(uint32_t value) {
_internal_set_commands(value);
@@ -4329,19 +6262,19 @@ inline void move::set_commands(uint32_t value) {
// .proto.angles viewangles = 2;
inline bool move::_internal_has_viewangles() const {
- return this != internal_default_instance() && viewangles_ != nullptr;
+ return this != internal_default_instance() && _impl_.viewangles_ != nullptr;
}
inline bool move::has_viewangles() const {
return _internal_has_viewangles();
}
inline void move::clear_viewangles() {
- if (GetArenaForAllocation() == nullptr && viewangles_ != nullptr) {
- delete viewangles_;
+ if (GetArenaForAllocation() == nullptr && _impl_.viewangles_ != nullptr) {
+ delete _impl_.viewangles_;
}
- viewangles_ = nullptr;
+ _impl_.viewangles_ = nullptr;
}
inline const ::proto::angles& move::_internal_viewangles() const {
- const ::proto::angles* p = viewangles_;
+ const ::proto::angles* p = _impl_.viewangles_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::angles&>(
::proto::_angles_default_instance_);
}
@@ -4352,9 +6285,9 @@ inline const ::proto::angles& move::viewangles() const {
inline void move::unsafe_arena_set_allocated_viewangles(
::proto::angles* viewangles) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(viewangles_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.viewangles_);
}
- viewangles_ = viewangles;
+ _impl_.viewangles_ = viewangles;
if (viewangles) {
} else {
@@ -4364,8 +6297,8 @@ inline void move::unsafe_arena_set_allocated_viewangles(
}
inline ::proto::angles* move::release_viewangles() {
- ::proto::angles* temp = viewangles_;
- viewangles_ = nullptr;
+ ::proto::angles* temp = _impl_.viewangles_;
+ _impl_.viewangles_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -4380,17 +6313,17 @@ inline ::proto::angles* move::release_viewangles() {
inline ::proto::angles* move::unsafe_arena_release_viewangles() {
// @@protoc_insertion_point(field_release:proto.move.viewangles)
- ::proto::angles* temp = viewangles_;
- viewangles_ = nullptr;
+ ::proto::angles* temp = _impl_.viewangles_;
+ _impl_.viewangles_ = nullptr;
return temp;
}
inline ::proto::angles* move::_internal_mutable_viewangles() {
- if (viewangles_ == nullptr) {
+ if (_impl_.viewangles_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::angles>(GetArenaForAllocation());
- viewangles_ = p;
+ _impl_.viewangles_ = p;
}
- return viewangles_;
+ return _impl_.viewangles_;
}
inline ::proto::angles* move::mutable_viewangles() {
::proto::angles* _msg = _internal_mutable_viewangles();
@@ -4400,11 +6333,11 @@ inline ::proto::angles* move::mutable_viewangles() {
inline void move::set_allocated_viewangles(::proto::angles* viewangles) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete viewangles_;
+ delete _impl_.viewangles_;
}
if (viewangles) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::angles>::GetOwningArena(viewangles);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(viewangles);
if (message_arena != submessage_arena) {
viewangles = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, viewangles, submessage_arena);
@@ -4413,32 +6346,72 @@ inline void move::set_allocated_viewangles(::proto::angles* viewangles) {
} else {
}
- viewangles_ = viewangles;
+ _impl_.viewangles_ = viewangles;
// @@protoc_insertion_point(field_set_allocated:proto.move.viewangles)
}
+// uint32 active_item = 3;
+inline void move::clear_active_item() {
+ _impl_.active_item_ = 0u;
+}
+inline uint32_t move::_internal_active_item() const {
+ return _impl_.active_item_;
+}
+inline uint32_t move::active_item() const {
+ // @@protoc_insertion_point(field_get:proto.move.active_item)
+ return _internal_active_item();
+}
+inline void move::_internal_set_active_item(uint32_t value) {
+
+ _impl_.active_item_ = value;
+}
+inline void move::set_active_item(uint32_t value) {
+ _internal_set_active_item(value);
+ // @@protoc_insertion_point(field_set:proto.move.active_item)
+}
+
+// uint32 sequence = 4;
+inline void move::clear_sequence() {
+ _impl_.sequence_ = 0u;
+}
+inline uint32_t move::_internal_sequence() const {
+ return _impl_.sequence_;
+}
+inline uint32_t move::sequence() const {
+ // @@protoc_insertion_point(field_get:proto.move.sequence)
+ return _internal_sequence();
+}
+inline void move::_internal_set_sequence(uint32_t value) {
+
+ _impl_.sequence_ = value;
+}
+inline void move::set_sequence(uint32_t value) {
+ _internal_set_sequence(value);
+ // @@protoc_insertion_point(field_set:proto.move.sequence)
+}
+
// -------------------------------------------------------------------
-// remove_player
+// remove_entity
// uint32 index = 1;
-inline void remove_player::clear_index() {
- index_ = 0u;
+inline void remove_entity::clear_index() {
+ _impl_.index_ = 0u;
}
-inline uint32_t remove_player::_internal_index() const {
- return index_;
+inline uint32_t remove_entity::_internal_index() const {
+ return _impl_.index_;
}
-inline uint32_t remove_player::index() const {
- // @@protoc_insertion_point(field_get:proto.remove_player.index)
+inline uint32_t remove_entity::index() const {
+ // @@protoc_insertion_point(field_get:proto.remove_entity.index)
return _internal_index();
}
-inline void remove_player::_internal_set_index(uint32_t value) {
+inline void remove_entity::_internal_set_index(uint32_t value) {
- index_ = value;
+ _impl_.index_ = value;
}
-inline void remove_player::set_index(uint32_t value) {
+inline void remove_entity::set_index(uint32_t value) {
_internal_set_index(value);
- // @@protoc_insertion_point(field_set:proto.remove_player.index)
+ // @@protoc_insertion_point(field_set:proto.remove_entity.index)
}
// -------------------------------------------------------------------
@@ -4447,7 +6420,7 @@ inline void remove_player::set_index(uint32_t value) {
// string text = 1;
inline void say::clear_text() {
- text_.ClearToEmpty();
+ _impl_.text_.ClearToEmpty();
}
inline const std::string& say::text() const {
// @@protoc_insertion_point(field_get:proto.say.text)
@@ -4457,7 +6430,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void say::set_text(ArgT0&& arg0, ArgT... args) {
- text_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ _impl_.text_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:proto.say.text)
}
inline std::string* say::mutable_text() {
@@ -4466,19 +6439,19 @@ inline std::string* say::mutable_text() {
return _s;
}
inline const std::string& say::_internal_text() const {
- return text_.Get();
+ return _impl_.text_.Get();
}
inline void say::_internal_set_text(const std::string& value) {
- text_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ _impl_.text_.Set(value, GetArenaForAllocation());
}
inline std::string* say::_internal_mutable_text() {
- return text_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return _impl_.text_.Mutable(GetArenaForAllocation());
}
inline std::string* say::release_text() {
// @@protoc_insertion_point(field_release:proto.say.text)
- return text_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return _impl_.text_.Release();
}
inline void say::set_allocated_text(std::string* text) {
if (text != nullptr) {
@@ -4486,11 +6459,10 @@ inline void say::set_allocated_text(std::string* text) {
} else {
}
- text_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), text,
- GetArenaForAllocation());
+ _impl_.text_.SetAllocated(text, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- if (text_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
- text_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ if (_impl_.text_.IsDefault()) {
+ _impl_.text_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:proto.say.text)
@@ -4502,10 +6474,10 @@ inline void say::set_allocated_text(std::string* text) {
// uint32 index = 1;
inline void hear_player::clear_index() {
- index_ = 0u;
+ _impl_.index_ = 0u;
}
inline uint32_t hear_player::_internal_index() const {
- return index_;
+ return _impl_.index_;
}
inline uint32_t hear_player::index() const {
// @@protoc_insertion_point(field_get:proto.hear_player.index)
@@ -4513,7 +6485,7 @@ inline uint32_t hear_player::index() const {
}
inline void hear_player::_internal_set_index(uint32_t value) {
- index_ = value;
+ _impl_.index_ = value;
}
inline void hear_player::set_index(uint32_t value) {
_internal_set_index(value);
@@ -4522,7 +6494,7 @@ inline void hear_player::set_index(uint32_t value) {
// string text = 2;
inline void hear_player::clear_text() {
- text_.ClearToEmpty();
+ _impl_.text_.ClearToEmpty();
}
inline const std::string& hear_player::text() const {
// @@protoc_insertion_point(field_get:proto.hear_player.text)
@@ -4532,7 +6504,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void hear_player::set_text(ArgT0&& arg0, ArgT... args) {
- text_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ _impl_.text_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:proto.hear_player.text)
}
inline std::string* hear_player::mutable_text() {
@@ -4541,19 +6513,19 @@ inline std::string* hear_player::mutable_text() {
return _s;
}
inline const std::string& hear_player::_internal_text() const {
- return text_.Get();
+ return _impl_.text_.Get();
}
inline void hear_player::_internal_set_text(const std::string& value) {
- text_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ _impl_.text_.Set(value, GetArenaForAllocation());
}
inline std::string* hear_player::_internal_mutable_text() {
- return text_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return _impl_.text_.Mutable(GetArenaForAllocation());
}
inline std::string* hear_player::release_text() {
// @@protoc_insertion_point(field_release:proto.hear_player.text)
- return text_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return _impl_.text_.Release();
}
inline void hear_player::set_allocated_text(std::string* text) {
if (text != nullptr) {
@@ -4561,11 +6533,10 @@ inline void hear_player::set_allocated_text(std::string* text) {
} else {
}
- text_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), text,
- GetArenaForAllocation());
+ _impl_.text_.SetAllocated(text, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- if (text_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
- text_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ if (_impl_.text_.IsDefault()) {
+ _impl_.text_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:proto.hear_player.text)
@@ -4577,19 +6548,19 @@ inline void hear_player::set_allocated_text(std::string* text) {
// .proto.coords chunk_pos = 1;
inline bool request_chunk::_internal_has_chunk_pos() const {
- return this != internal_default_instance() && chunk_pos_ != nullptr;
+ return this != internal_default_instance() && _impl_.chunk_pos_ != nullptr;
}
inline bool request_chunk::has_chunk_pos() const {
return _internal_has_chunk_pos();
}
inline void request_chunk::clear_chunk_pos() {
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
}
inline const ::proto::coords& request_chunk::_internal_chunk_pos() const {
- const ::proto::coords* p = chunk_pos_;
+ const ::proto::coords* p = _impl_.chunk_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::coords&>(
::proto::_coords_default_instance_);
}
@@ -4600,9 +6571,9 @@ inline const ::proto::coords& request_chunk::chunk_pos() const {
inline void request_chunk::unsafe_arena_set_allocated_chunk_pos(
::proto::coords* chunk_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(chunk_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.chunk_pos_);
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
if (chunk_pos) {
} else {
@@ -4612,8 +6583,8 @@ inline void request_chunk::unsafe_arena_set_allocated_chunk_pos(
}
inline ::proto::coords* request_chunk::release_chunk_pos() {
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -4628,17 +6599,17 @@ inline ::proto::coords* request_chunk::release_chunk_pos() {
inline ::proto::coords* request_chunk::unsafe_arena_release_chunk_pos() {
// @@protoc_insertion_point(field_release:proto.request_chunk.chunk_pos)
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
return temp;
}
inline ::proto::coords* request_chunk::_internal_mutable_chunk_pos() {
- if (chunk_pos_ == nullptr) {
+ if (_impl_.chunk_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::coords>(GetArenaForAllocation());
- chunk_pos_ = p;
+ _impl_.chunk_pos_ = p;
}
- return chunk_pos_;
+ return _impl_.chunk_pos_;
}
inline ::proto::coords* request_chunk::mutable_chunk_pos() {
::proto::coords* _msg = _internal_mutable_chunk_pos();
@@ -4648,11 +6619,11 @@ inline ::proto::coords* request_chunk::mutable_chunk_pos() {
inline void request_chunk::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete chunk_pos_;
+ delete _impl_.chunk_pos_;
}
if (chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::coords>::GetOwningArena(chunk_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(chunk_pos);
if (message_arena != submessage_arena) {
chunk_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, chunk_pos, submessage_arena);
@@ -4661,7 +6632,7 @@ inline void request_chunk::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
} else {
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
// @@protoc_insertion_point(field_set_allocated:proto.request_chunk.chunk_pos)
}
@@ -4671,19 +6642,19 @@ inline void request_chunk::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
// .proto.coords chunk_pos = 1;
inline bool remove_chunk::_internal_has_chunk_pos() const {
- return this != internal_default_instance() && chunk_pos_ != nullptr;
+ return this != internal_default_instance() && _impl_.chunk_pos_ != nullptr;
}
inline bool remove_chunk::has_chunk_pos() const {
return _internal_has_chunk_pos();
}
inline void remove_chunk::clear_chunk_pos() {
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
}
inline const ::proto::coords& remove_chunk::_internal_chunk_pos() const {
- const ::proto::coords* p = chunk_pos_;
+ const ::proto::coords* p = _impl_.chunk_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::coords&>(
::proto::_coords_default_instance_);
}
@@ -4694,9 +6665,9 @@ inline const ::proto::coords& remove_chunk::chunk_pos() const {
inline void remove_chunk::unsafe_arena_set_allocated_chunk_pos(
::proto::coords* chunk_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(chunk_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.chunk_pos_);
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
if (chunk_pos) {
} else {
@@ -4706,8 +6677,8 @@ inline void remove_chunk::unsafe_arena_set_allocated_chunk_pos(
}
inline ::proto::coords* remove_chunk::release_chunk_pos() {
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -4722,17 +6693,17 @@ inline ::proto::coords* remove_chunk::release_chunk_pos() {
inline ::proto::coords* remove_chunk::unsafe_arena_release_chunk_pos() {
// @@protoc_insertion_point(field_release:proto.remove_chunk.chunk_pos)
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
return temp;
}
inline ::proto::coords* remove_chunk::_internal_mutable_chunk_pos() {
- if (chunk_pos_ == nullptr) {
+ if (_impl_.chunk_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::coords>(GetArenaForAllocation());
- chunk_pos_ = p;
+ _impl_.chunk_pos_ = p;
}
- return chunk_pos_;
+ return _impl_.chunk_pos_;
}
inline ::proto::coords* remove_chunk::mutable_chunk_pos() {
::proto::coords* _msg = _internal_mutable_chunk_pos();
@@ -4742,11 +6713,11 @@ inline ::proto::coords* remove_chunk::mutable_chunk_pos() {
inline void remove_chunk::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete chunk_pos_;
+ delete _impl_.chunk_pos_;
}
if (chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::coords>::GetOwningArena(chunk_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(chunk_pos);
if (message_arena != submessage_arena) {
chunk_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, chunk_pos, submessage_arena);
@@ -4755,7 +6726,7 @@ inline void remove_chunk::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
} else {
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
// @@protoc_insertion_point(field_set_allocated:proto.remove_chunk.chunk_pos)
}
@@ -4765,19 +6736,19 @@ inline void remove_chunk::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
// .proto.coords chunk_pos = 1;
inline bool chunk::_internal_has_chunk_pos() const {
- return this != internal_default_instance() && chunk_pos_ != nullptr;
+ return this != internal_default_instance() && _impl_.chunk_pos_ != nullptr;
}
inline bool chunk::has_chunk_pos() const {
return _internal_has_chunk_pos();
}
inline void chunk::clear_chunk_pos() {
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
}
inline const ::proto::coords& chunk::_internal_chunk_pos() const {
- const ::proto::coords* p = chunk_pos_;
+ const ::proto::coords* p = _impl_.chunk_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::coords&>(
::proto::_coords_default_instance_);
}
@@ -4788,9 +6759,9 @@ inline const ::proto::coords& chunk::chunk_pos() const {
inline void chunk::unsafe_arena_set_allocated_chunk_pos(
::proto::coords* chunk_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(chunk_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.chunk_pos_);
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
if (chunk_pos) {
} else {
@@ -4800,8 +6771,8 @@ inline void chunk::unsafe_arena_set_allocated_chunk_pos(
}
inline ::proto::coords* chunk::release_chunk_pos() {
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -4816,17 +6787,17 @@ inline ::proto::coords* chunk::release_chunk_pos() {
inline ::proto::coords* chunk::unsafe_arena_release_chunk_pos() {
// @@protoc_insertion_point(field_release:proto.chunk.chunk_pos)
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
return temp;
}
inline ::proto::coords* chunk::_internal_mutable_chunk_pos() {
- if (chunk_pos_ == nullptr) {
+ if (_impl_.chunk_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::coords>(GetArenaForAllocation());
- chunk_pos_ = p;
+ _impl_.chunk_pos_ = p;
}
- return chunk_pos_;
+ return _impl_.chunk_pos_;
}
inline ::proto::coords* chunk::mutable_chunk_pos() {
::proto::coords* _msg = _internal_mutable_chunk_pos();
@@ -4836,11 +6807,11 @@ inline ::proto::coords* chunk::mutable_chunk_pos() {
inline void chunk::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete chunk_pos_;
+ delete _impl_.chunk_pos_;
}
if (chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::coords>::GetOwningArena(chunk_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(chunk_pos);
if (message_arena != submessage_arena) {
chunk_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, chunk_pos, submessage_arena);
@@ -4849,33 +6820,33 @@ inline void chunk::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
} else {
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
// @@protoc_insertion_point(field_set_allocated:proto.chunk.chunk_pos)
}
// repeated uint32 blocks = 2 [packed = true];
inline int chunk::_internal_blocks_size() const {
- return blocks_.size();
+ return _impl_.blocks_.size();
}
inline int chunk::blocks_size() const {
return _internal_blocks_size();
}
inline void chunk::clear_blocks() {
- blocks_.Clear();
+ _impl_.blocks_.Clear();
}
inline uint32_t chunk::_internal_blocks(int index) const {
- return blocks_.Get(index);
+ return _impl_.blocks_.Get(index);
}
inline uint32_t chunk::blocks(int index) const {
// @@protoc_insertion_point(field_get:proto.chunk.blocks)
return _internal_blocks(index);
}
inline void chunk::set_blocks(int index, uint32_t value) {
- blocks_.Set(index, value);
+ _impl_.blocks_.Set(index, value);
// @@protoc_insertion_point(field_set:proto.chunk.blocks)
}
inline void chunk::_internal_add_blocks(uint32_t value) {
- blocks_.Add(value);
+ _impl_.blocks_.Add(value);
}
inline void chunk::add_blocks(uint32_t value) {
_internal_add_blocks(value);
@@ -4883,7 +6854,7 @@ inline void chunk::add_blocks(uint32_t value) {
}
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >&
chunk::_internal_blocks() const {
- return blocks_;
+ return _impl_.blocks_;
}
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >&
chunk::blocks() const {
@@ -4892,7 +6863,7 @@ chunk::blocks() const {
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >*
chunk::_internal_mutable_blocks() {
- return &blocks_;
+ return &_impl_.blocks_;
}
inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >*
chunk::mutable_blocks() {
@@ -4906,19 +6877,19 @@ chunk::mutable_blocks() {
// .proto.coords chunk_pos = 1;
inline bool add_block::_internal_has_chunk_pos() const {
- return this != internal_default_instance() && chunk_pos_ != nullptr;
+ return this != internal_default_instance() && _impl_.chunk_pos_ != nullptr;
}
inline bool add_block::has_chunk_pos() const {
return _internal_has_chunk_pos();
}
inline void add_block::clear_chunk_pos() {
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
}
inline const ::proto::coords& add_block::_internal_chunk_pos() const {
- const ::proto::coords* p = chunk_pos_;
+ const ::proto::coords* p = _impl_.chunk_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::coords&>(
::proto::_coords_default_instance_);
}
@@ -4929,9 +6900,9 @@ inline const ::proto::coords& add_block::chunk_pos() const {
inline void add_block::unsafe_arena_set_allocated_chunk_pos(
::proto::coords* chunk_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(chunk_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.chunk_pos_);
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
if (chunk_pos) {
} else {
@@ -4941,8 +6912,8 @@ inline void add_block::unsafe_arena_set_allocated_chunk_pos(
}
inline ::proto::coords* add_block::release_chunk_pos() {
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -4957,17 +6928,17 @@ inline ::proto::coords* add_block::release_chunk_pos() {
inline ::proto::coords* add_block::unsafe_arena_release_chunk_pos() {
// @@protoc_insertion_point(field_release:proto.add_block.chunk_pos)
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
return temp;
}
inline ::proto::coords* add_block::_internal_mutable_chunk_pos() {
- if (chunk_pos_ == nullptr) {
+ if (_impl_.chunk_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::coords>(GetArenaForAllocation());
- chunk_pos_ = p;
+ _impl_.chunk_pos_ = p;
}
- return chunk_pos_;
+ return _impl_.chunk_pos_;
}
inline ::proto::coords* add_block::mutable_chunk_pos() {
::proto::coords* _msg = _internal_mutable_chunk_pos();
@@ -4977,11 +6948,11 @@ inline ::proto::coords* add_block::mutable_chunk_pos() {
inline void add_block::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete chunk_pos_;
+ delete _impl_.chunk_pos_;
}
if (chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::coords>::GetOwningArena(chunk_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(chunk_pos);
if (message_arena != submessage_arena) {
chunk_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, chunk_pos, submessage_arena);
@@ -4990,25 +6961,25 @@ inline void add_block::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
} else {
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
// @@protoc_insertion_point(field_set_allocated:proto.add_block.chunk_pos)
}
// .proto.ivec3 block_pos = 2;
inline bool add_block::_internal_has_block_pos() const {
- return this != internal_default_instance() && block_pos_ != nullptr;
+ return this != internal_default_instance() && _impl_.block_pos_ != nullptr;
}
inline bool add_block::has_block_pos() const {
return _internal_has_block_pos();
}
inline void add_block::clear_block_pos() {
- if (GetArenaForAllocation() == nullptr && block_pos_ != nullptr) {
- delete block_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.block_pos_ != nullptr) {
+ delete _impl_.block_pos_;
}
- block_pos_ = nullptr;
+ _impl_.block_pos_ = nullptr;
}
inline const ::proto::ivec3& add_block::_internal_block_pos() const {
- const ::proto::ivec3* p = block_pos_;
+ const ::proto::ivec3* p = _impl_.block_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::ivec3&>(
::proto::_ivec3_default_instance_);
}
@@ -5019,9 +6990,9 @@ inline const ::proto::ivec3& add_block::block_pos() const {
inline void add_block::unsafe_arena_set_allocated_block_pos(
::proto::ivec3* block_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(block_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.block_pos_);
}
- block_pos_ = block_pos;
+ _impl_.block_pos_ = block_pos;
if (block_pos) {
} else {
@@ -5031,8 +7002,8 @@ inline void add_block::unsafe_arena_set_allocated_block_pos(
}
inline ::proto::ivec3* add_block::release_block_pos() {
- ::proto::ivec3* temp = block_pos_;
- block_pos_ = nullptr;
+ ::proto::ivec3* temp = _impl_.block_pos_;
+ _impl_.block_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -5047,17 +7018,17 @@ inline ::proto::ivec3* add_block::release_block_pos() {
inline ::proto::ivec3* add_block::unsafe_arena_release_block_pos() {
// @@protoc_insertion_point(field_release:proto.add_block.block_pos)
- ::proto::ivec3* temp = block_pos_;
- block_pos_ = nullptr;
+ ::proto::ivec3* temp = _impl_.block_pos_;
+ _impl_.block_pos_ = nullptr;
return temp;
}
inline ::proto::ivec3* add_block::_internal_mutable_block_pos() {
- if (block_pos_ == nullptr) {
+ if (_impl_.block_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::ivec3>(GetArenaForAllocation());
- block_pos_ = p;
+ _impl_.block_pos_ = p;
}
- return block_pos_;
+ return _impl_.block_pos_;
}
inline ::proto::ivec3* add_block::mutable_block_pos() {
::proto::ivec3* _msg = _internal_mutable_block_pos();
@@ -5067,11 +7038,11 @@ inline ::proto::ivec3* add_block::mutable_block_pos() {
inline void add_block::set_allocated_block_pos(::proto::ivec3* block_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete block_pos_;
+ delete _impl_.block_pos_;
}
if (block_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::ivec3>::GetOwningArena(block_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(block_pos);
if (message_arena != submessage_arena) {
block_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, block_pos, submessage_arena);
@@ -5080,28 +7051,28 @@ inline void add_block::set_allocated_block_pos(::proto::ivec3* block_pos) {
} else {
}
- block_pos_ = block_pos;
+ _impl_.block_pos_ = block_pos;
// @@protoc_insertion_point(field_set_allocated:proto.add_block.block_pos)
}
-// uint32 block = 3;
-inline void add_block::clear_block() {
- block_ = 0u;
+// uint32 active_item = 3;
+inline void add_block::clear_active_item() {
+ _impl_.active_item_ = 0u;
}
-inline uint32_t add_block::_internal_block() const {
- return block_;
+inline uint32_t add_block::_internal_active_item() const {
+ return _impl_.active_item_;
}
-inline uint32_t add_block::block() const {
- // @@protoc_insertion_point(field_get:proto.add_block.block)
- return _internal_block();
+inline uint32_t add_block::active_item() const {
+ // @@protoc_insertion_point(field_get:proto.add_block.active_item)
+ return _internal_active_item();
}
-inline void add_block::_internal_set_block(uint32_t value) {
+inline void add_block::_internal_set_active_item(uint32_t value) {
- block_ = value;
+ _impl_.active_item_ = value;
}
-inline void add_block::set_block(uint32_t value) {
- _internal_set_block(value);
- // @@protoc_insertion_point(field_set:proto.add_block.block)
+inline void add_block::set_active_item(uint32_t value) {
+ _internal_set_active_item(value);
+ // @@protoc_insertion_point(field_set:proto.add_block.active_item)
}
// -------------------------------------------------------------------
@@ -5110,19 +7081,19 @@ inline void add_block::set_block(uint32_t value) {
// .proto.coords chunk_pos = 1;
inline bool remove_block::_internal_has_chunk_pos() const {
- return this != internal_default_instance() && chunk_pos_ != nullptr;
+ return this != internal_default_instance() && _impl_.chunk_pos_ != nullptr;
}
inline bool remove_block::has_chunk_pos() const {
return _internal_has_chunk_pos();
}
inline void remove_block::clear_chunk_pos() {
- if (GetArenaForAllocation() == nullptr && chunk_pos_ != nullptr) {
- delete chunk_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.chunk_pos_ != nullptr) {
+ delete _impl_.chunk_pos_;
}
- chunk_pos_ = nullptr;
+ _impl_.chunk_pos_ = nullptr;
}
inline const ::proto::coords& remove_block::_internal_chunk_pos() const {
- const ::proto::coords* p = chunk_pos_;
+ const ::proto::coords* p = _impl_.chunk_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::coords&>(
::proto::_coords_default_instance_);
}
@@ -5133,9 +7104,9 @@ inline const ::proto::coords& remove_block::chunk_pos() const {
inline void remove_block::unsafe_arena_set_allocated_chunk_pos(
::proto::coords* chunk_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(chunk_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.chunk_pos_);
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
if (chunk_pos) {
} else {
@@ -5145,8 +7116,8 @@ inline void remove_block::unsafe_arena_set_allocated_chunk_pos(
}
inline ::proto::coords* remove_block::release_chunk_pos() {
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -5161,17 +7132,17 @@ inline ::proto::coords* remove_block::release_chunk_pos() {
inline ::proto::coords* remove_block::unsafe_arena_release_chunk_pos() {
// @@protoc_insertion_point(field_release:proto.remove_block.chunk_pos)
- ::proto::coords* temp = chunk_pos_;
- chunk_pos_ = nullptr;
+ ::proto::coords* temp = _impl_.chunk_pos_;
+ _impl_.chunk_pos_ = nullptr;
return temp;
}
inline ::proto::coords* remove_block::_internal_mutable_chunk_pos() {
- if (chunk_pos_ == nullptr) {
+ if (_impl_.chunk_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::coords>(GetArenaForAllocation());
- chunk_pos_ = p;
+ _impl_.chunk_pos_ = p;
}
- return chunk_pos_;
+ return _impl_.chunk_pos_;
}
inline ::proto::coords* remove_block::mutable_chunk_pos() {
::proto::coords* _msg = _internal_mutable_chunk_pos();
@@ -5181,11 +7152,11 @@ inline ::proto::coords* remove_block::mutable_chunk_pos() {
inline void remove_block::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete chunk_pos_;
+ delete _impl_.chunk_pos_;
}
if (chunk_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::coords>::GetOwningArena(chunk_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(chunk_pos);
if (message_arena != submessage_arena) {
chunk_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, chunk_pos, submessage_arena);
@@ -5194,25 +7165,25 @@ inline void remove_block::set_allocated_chunk_pos(::proto::coords* chunk_pos) {
} else {
}
- chunk_pos_ = chunk_pos;
+ _impl_.chunk_pos_ = chunk_pos;
// @@protoc_insertion_point(field_set_allocated:proto.remove_block.chunk_pos)
}
// .proto.ivec3 block_pos = 2;
inline bool remove_block::_internal_has_block_pos() const {
- return this != internal_default_instance() && block_pos_ != nullptr;
+ return this != internal_default_instance() && _impl_.block_pos_ != nullptr;
}
inline bool remove_block::has_block_pos() const {
return _internal_has_block_pos();
}
inline void remove_block::clear_block_pos() {
- if (GetArenaForAllocation() == nullptr && block_pos_ != nullptr) {
- delete block_pos_;
+ if (GetArenaForAllocation() == nullptr && _impl_.block_pos_ != nullptr) {
+ delete _impl_.block_pos_;
}
- block_pos_ = nullptr;
+ _impl_.block_pos_ = nullptr;
}
inline const ::proto::ivec3& remove_block::_internal_block_pos() const {
- const ::proto::ivec3* p = block_pos_;
+ const ::proto::ivec3* p = _impl_.block_pos_;
return p != nullptr ? *p : reinterpret_cast<const ::proto::ivec3&>(
::proto::_ivec3_default_instance_);
}
@@ -5223,9 +7194,9 @@ inline const ::proto::ivec3& remove_block::block_pos() const {
inline void remove_block::unsafe_arena_set_allocated_block_pos(
::proto::ivec3* block_pos) {
if (GetArenaForAllocation() == nullptr) {
- delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(block_pos_);
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.block_pos_);
}
- block_pos_ = block_pos;
+ _impl_.block_pos_ = block_pos;
if (block_pos) {
} else {
@@ -5235,8 +7206,8 @@ inline void remove_block::unsafe_arena_set_allocated_block_pos(
}
inline ::proto::ivec3* remove_block::release_block_pos() {
- ::proto::ivec3* temp = block_pos_;
- block_pos_ = nullptr;
+ ::proto::ivec3* temp = _impl_.block_pos_;
+ _impl_.block_pos_ = nullptr;
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
@@ -5251,17 +7222,17 @@ inline ::proto::ivec3* remove_block::release_block_pos() {
inline ::proto::ivec3* remove_block::unsafe_arena_release_block_pos() {
// @@protoc_insertion_point(field_release:proto.remove_block.block_pos)
- ::proto::ivec3* temp = block_pos_;
- block_pos_ = nullptr;
+ ::proto::ivec3* temp = _impl_.block_pos_;
+ _impl_.block_pos_ = nullptr;
return temp;
}
inline ::proto::ivec3* remove_block::_internal_mutable_block_pos() {
- if (block_pos_ == nullptr) {
+ if (_impl_.block_pos_ == nullptr) {
auto* p = CreateMaybeMessage<::proto::ivec3>(GetArenaForAllocation());
- block_pos_ = p;
+ _impl_.block_pos_ = p;
}
- return block_pos_;
+ return _impl_.block_pos_;
}
inline ::proto::ivec3* remove_block::mutable_block_pos() {
::proto::ivec3* _msg = _internal_mutable_block_pos();
@@ -5271,11 +7242,11 @@ inline ::proto::ivec3* remove_block::mutable_block_pos() {
inline void remove_block::set_allocated_block_pos(::proto::ivec3* block_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
- delete block_pos_;
+ delete _impl_.block_pos_;
}
if (block_pos) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::proto::ivec3>::GetOwningArena(block_pos);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(block_pos);
if (message_arena != submessage_arena) {
block_pos = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, block_pos, submessage_arena);
@@ -5284,7 +7255,7 @@ inline void remove_block::set_allocated_block_pos(::proto::ivec3* block_pos) {
} else {
}
- block_pos_ = block_pos;
+ _impl_.block_pos_ = block_pos;
// @@protoc_insertion_point(field_set_allocated:proto.remove_block.block_pos)
}
@@ -5294,7 +7265,7 @@ inline void remove_block::set_allocated_block_pos(::proto::ivec3* block_pos) {
// string message = 1;
inline void server_message::clear_message() {
- message_.ClearToEmpty();
+ _impl_.message_.ClearToEmpty();
}
inline const std::string& server_message::message() const {
// @@protoc_insertion_point(field_get:proto.server_message.message)
@@ -5304,7 +7275,7 @@ template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void server_message::set_message(ArgT0&& arg0, ArgT... args) {
- message_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
+ _impl_.message_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:proto.server_message.message)
}
inline std::string* server_message::mutable_message() {
@@ -5313,19 +7284,19 @@ inline std::string* server_message::mutable_message() {
return _s;
}
inline const std::string& server_message::_internal_message() const {
- return message_.Get();
+ return _impl_.message_.Get();
}
inline void server_message::_internal_set_message(const std::string& value) {
- message_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
+ _impl_.message_.Set(value, GetArenaForAllocation());
}
inline std::string* server_message::_internal_mutable_message() {
- return message_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
+ return _impl_.message_.Mutable(GetArenaForAllocation());
}
inline std::string* server_message::release_message() {
// @@protoc_insertion_point(field_release:proto.server_message.message)
- return message_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+ return _impl_.message_.Release();
}
inline void server_message::set_allocated_message(std::string* message) {
if (message != nullptr) {
@@ -5333,11 +7304,10 @@ inline void server_message::set_allocated_message(std::string* message) {
} else {
}
- message_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), message,
- GetArenaForAllocation());
+ _impl_.message_.SetAllocated(message, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
- if (message_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
- message_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+ if (_impl_.message_.IsDefault()) {
+ _impl_.message_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:proto.server_message.message)
@@ -5345,10 +7315,10 @@ inline void server_message::set_allocated_message(std::string* message) {
// bool fatal = 2;
inline void server_message::clear_fatal() {
- fatal_ = false;
+ _impl_.fatal_ = false;
}
inline bool server_message::_internal_fatal() const {
- return fatal_;
+ return _impl_.fatal_;
}
inline bool server_message::fatal() const {
// @@protoc_insertion_point(field_get:proto.server_message.fatal)
@@ -5356,7 +7326,7 @@ inline bool server_message::fatal() const {
}
inline void server_message::_internal_set_fatal(bool value) {
- fatal_ = value;
+ _impl_.fatal_ = value;
}
inline void server_message::set_fatal(bool value) {
_internal_set_fatal(value);
@@ -5365,6 +7335,260 @@ inline void server_message::set_fatal(bool value) {
// -------------------------------------------------------------------
+// item_swap
+
+// uint32 index_a = 1;
+inline void item_swap::clear_index_a() {
+ _impl_.index_a_ = 0u;
+}
+inline uint32_t item_swap::_internal_index_a() const {
+ return _impl_.index_a_;
+}
+inline uint32_t item_swap::index_a() const {
+ // @@protoc_insertion_point(field_get:proto.item_swap.index_a)
+ return _internal_index_a();
+}
+inline void item_swap::_internal_set_index_a(uint32_t value) {
+
+ _impl_.index_a_ = value;
+}
+inline void item_swap::set_index_a(uint32_t value) {
+ _internal_set_index_a(value);
+ // @@protoc_insertion_point(field_set:proto.item_swap.index_a)
+}
+
+// uint32 index_b = 2;
+inline void item_swap::clear_index_b() {
+ _impl_.index_b_ = 0u;
+}
+inline uint32_t item_swap::_internal_index_b() const {
+ return _impl_.index_b_;
+}
+inline uint32_t item_swap::index_b() const {
+ // @@protoc_insertion_point(field_get:proto.item_swap.index_b)
+ return _internal_index_b();
+}
+inline void item_swap::_internal_set_index_b(uint32_t value) {
+
+ _impl_.index_b_ = value;
+}
+inline void item_swap::set_index_b(uint32_t value) {
+ _internal_set_index_b(value);
+ // @@protoc_insertion_point(field_set:proto.item_swap.index_b)
+}
+
+// -------------------------------------------------------------------
+
+// item_use
+
+// uint32 index = 1;
+inline void item_use::clear_index() {
+ _impl_.index_ = 0u;
+}
+inline uint32_t item_use::_internal_index() const {
+ return _impl_.index_;
+}
+inline uint32_t item_use::index() const {
+ // @@protoc_insertion_point(field_get:proto.item_use.index)
+ return _internal_index();
+}
+inline void item_use::_internal_set_index(uint32_t value) {
+
+ _impl_.index_ = value;
+}
+inline void item_use::set_index(uint32_t value) {
+ _internal_set_index(value);
+ // @@protoc_insertion_point(field_set:proto.item_use.index)
+}
+
+// -------------------------------------------------------------------
+
+// item_update
+
+// repeated .proto.item items = 1;
+inline int item_update::_internal_items_size() const {
+ return _impl_.items_.size();
+}
+inline int item_update::items_size() const {
+ return _internal_items_size();
+}
+inline void item_update::clear_items() {
+ _impl_.items_.Clear();
+}
+inline ::proto::item* item_update::mutable_items(int index) {
+ // @@protoc_insertion_point(field_mutable:proto.item_update.items)
+ return _impl_.items_.Mutable(index);
+}
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item >*
+item_update::mutable_items() {
+ // @@protoc_insertion_point(field_mutable_list:proto.item_update.items)
+ return &_impl_.items_;
+}
+inline const ::proto::item& item_update::_internal_items(int index) const {
+ return _impl_.items_.Get(index);
+}
+inline const ::proto::item& item_update::items(int index) const {
+ // @@protoc_insertion_point(field_get:proto.item_update.items)
+ return _internal_items(index);
+}
+inline ::proto::item* item_update::_internal_add_items() {
+ return _impl_.items_.Add();
+}
+inline ::proto::item* item_update::add_items() {
+ ::proto::item* _add = _internal_add_items();
+ // @@protoc_insertion_point(field_add:proto.item_update.items)
+ return _add;
+}
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::proto::item >&
+item_update::items() const {
+ // @@protoc_insertion_point(field_list:proto.item_update.items)
+ return _impl_.items_;
+}
+
+// -------------------------------------------------------------------
+
+// animate_update
+
+// .proto.animate animate = 1;
+inline bool animate_update::_internal_has_animate() const {
+ return this != internal_default_instance() && _impl_.animate_ != nullptr;
+}
+inline bool animate_update::has_animate() const {
+ return _internal_has_animate();
+}
+inline void animate_update::clear_animate() {
+ if (GetArenaForAllocation() == nullptr && _impl_.animate_ != nullptr) {
+ delete _impl_.animate_;
+ }
+ _impl_.animate_ = nullptr;
+}
+inline const ::proto::animate& animate_update::_internal_animate() const {
+ const ::proto::animate* p = _impl_.animate_;
+ return p != nullptr ? *p : reinterpret_cast<const ::proto::animate&>(
+ ::proto::_animate_default_instance_);
+}
+inline const ::proto::animate& animate_update::animate() const {
+ // @@protoc_insertion_point(field_get:proto.animate_update.animate)
+ return _internal_animate();
+}
+inline void animate_update::unsafe_arena_set_allocated_animate(
+ ::proto::animate* animate) {
+ if (GetArenaForAllocation() == nullptr) {
+ delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.animate_);
+ }
+ _impl_.animate_ = animate;
+ if (animate) {
+
+ } else {
+
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.animate_update.animate)
+}
+inline ::proto::animate* animate_update::release_animate() {
+
+ ::proto::animate* temp = _impl_.animate_;
+ _impl_.animate_ = nullptr;
+#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
+ auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ if (GetArenaForAllocation() == nullptr) { delete old; }
+#else // PROTOBUF_FORCE_COPY_IN_RELEASE
+ if (GetArenaForAllocation() != nullptr) {
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ }
+#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
+ return temp;
+}
+inline ::proto::animate* animate_update::unsafe_arena_release_animate() {
+ // @@protoc_insertion_point(field_release:proto.animate_update.animate)
+
+ ::proto::animate* temp = _impl_.animate_;
+ _impl_.animate_ = nullptr;
+ return temp;
+}
+inline ::proto::animate* animate_update::_internal_mutable_animate() {
+
+ if (_impl_.animate_ == nullptr) {
+ auto* p = CreateMaybeMessage<::proto::animate>(GetArenaForAllocation());
+ _impl_.animate_ = p;
+ }
+ return _impl_.animate_;
+}
+inline ::proto::animate* animate_update::mutable_animate() {
+ ::proto::animate* _msg = _internal_mutable_animate();
+ // @@protoc_insertion_point(field_mutable:proto.animate_update.animate)
+ return _msg;
+}
+inline void animate_update::set_allocated_animate(::proto::animate* animate) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
+ if (message_arena == nullptr) {
+ delete _impl_.animate_;
+ }
+ if (animate) {
+ ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(animate);
+ if (message_arena != submessage_arena) {
+ animate = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
+ message_arena, animate, submessage_arena);
+ }
+
+ } else {
+
+ }
+ _impl_.animate_ = animate;
+ // @@protoc_insertion_point(field_set_allocated:proto.animate_update.animate)
+}
+
+// uint32 tick = 2;
+inline void animate_update::clear_tick() {
+ _impl_.tick_ = 0u;
+}
+inline uint32_t animate_update::_internal_tick() const {
+ return _impl_.tick_;
+}
+inline uint32_t animate_update::tick() const {
+ // @@protoc_insertion_point(field_get:proto.animate_update.tick)
+ return _internal_tick();
+}
+inline void animate_update::_internal_set_tick(uint32_t value) {
+
+ _impl_.tick_ = value;
+}
+inline void animate_update::set_tick(uint32_t value) {
+ _internal_set_tick(value);
+ // @@protoc_insertion_point(field_set:proto.animate_update.tick)
+}
+
+// optional uint32 sequence = 3;
+inline bool animate_update::_internal_has_sequence() const {
+ bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
+ return value;
+}
+inline bool animate_update::has_sequence() const {
+ return _internal_has_sequence();
+}
+inline void animate_update::clear_sequence() {
+ _impl_.sequence_ = 0u;
+ _impl_._has_bits_[0] &= ~0x00000001u;
+}
+inline uint32_t animate_update::_internal_sequence() const {
+ return _impl_.sequence_;
+}
+inline uint32_t animate_update::sequence() const {
+ // @@protoc_insertion_point(field_get:proto.animate_update.sequence)
+ return _internal_sequence();
+}
+inline void animate_update::_internal_set_sequence(uint32_t value) {
+ _impl_._has_bits_[0] |= 0x00000001u;
+ _impl_.sequence_ = value;
+}
+inline void animate_update::set_sequence(uint32_t value) {
+ _internal_set_sequence(value);
+ // @@protoc_insertion_point(field_set:proto.animate_update.sequence)
+}
+
+// -------------------------------------------------------------------
+
// packet
// .proto.auth auth_packet = 1;
@@ -5375,12 +7599,12 @@ inline bool packet::has_auth_packet() const {
return _internal_has_auth_packet();
}
inline void packet::set_has_auth_packet() {
- _oneof_case_[0] = kAuthPacket;
+ _impl_._oneof_case_[0] = kAuthPacket;
}
inline void packet::clear_auth_packet() {
if (_internal_has_auth_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.auth_packet_;
+ delete _impl_.contents_.auth_packet_;
}
clear_has_contents();
}
@@ -5389,11 +7613,11 @@ inline ::proto::auth* packet::release_auth_packet() {
// @@protoc_insertion_point(field_release:proto.packet.auth_packet)
if (_internal_has_auth_packet()) {
clear_has_contents();
- ::proto::auth* temp = contents_.auth_packet_;
+ ::proto::auth* temp = _impl_.contents_.auth_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.auth_packet_ = nullptr;
+ _impl_.contents_.auth_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5401,7 +7625,7 @@ inline ::proto::auth* packet::release_auth_packet() {
}
inline const ::proto::auth& packet::_internal_auth_packet() const {
return _internal_has_auth_packet()
- ? *contents_.auth_packet_
+ ? *_impl_.contents_.auth_packet_
: reinterpret_cast< ::proto::auth&>(::proto::_auth_default_instance_);
}
inline const ::proto::auth& packet::auth_packet() const {
@@ -5412,8 +7636,8 @@ inline ::proto::auth* packet::unsafe_arena_release_auth_packet() {
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.auth_packet)
if (_internal_has_auth_packet()) {
clear_has_contents();
- ::proto::auth* temp = contents_.auth_packet_;
- contents_.auth_packet_ = nullptr;
+ ::proto::auth* temp = _impl_.contents_.auth_packet_;
+ _impl_.contents_.auth_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5423,7 +7647,7 @@ inline void packet::unsafe_arena_set_allocated_auth_packet(::proto::auth* auth_p
clear_contents();
if (auth_packet) {
set_has_auth_packet();
- contents_.auth_packet_ = auth_packet;
+ _impl_.contents_.auth_packet_ = auth_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.auth_packet)
}
@@ -5431,9 +7655,9 @@ inline ::proto::auth* packet::_internal_mutable_auth_packet() {
if (!_internal_has_auth_packet()) {
clear_contents();
set_has_auth_packet();
- contents_.auth_packet_ = CreateMaybeMessage< ::proto::auth >(GetArenaForAllocation());
+ _impl_.contents_.auth_packet_ = CreateMaybeMessage< ::proto::auth >(GetArenaForAllocation());
}
- return contents_.auth_packet_;
+ return _impl_.contents_.auth_packet_;
}
inline ::proto::auth* packet::mutable_auth_packet() {
::proto::auth* _msg = _internal_mutable_auth_packet();
@@ -5449,12 +7673,12 @@ inline bool packet::has_init_packet() const {
return _internal_has_init_packet();
}
inline void packet::set_has_init_packet() {
- _oneof_case_[0] = kInitPacket;
+ _impl_._oneof_case_[0] = kInitPacket;
}
inline void packet::clear_init_packet() {
if (_internal_has_init_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.init_packet_;
+ delete _impl_.contents_.init_packet_;
}
clear_has_contents();
}
@@ -5463,11 +7687,11 @@ inline ::proto::init* packet::release_init_packet() {
// @@protoc_insertion_point(field_release:proto.packet.init_packet)
if (_internal_has_init_packet()) {
clear_has_contents();
- ::proto::init* temp = contents_.init_packet_;
+ ::proto::init* temp = _impl_.contents_.init_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.init_packet_ = nullptr;
+ _impl_.contents_.init_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5475,7 +7699,7 @@ inline ::proto::init* packet::release_init_packet() {
}
inline const ::proto::init& packet::_internal_init_packet() const {
return _internal_has_init_packet()
- ? *contents_.init_packet_
+ ? *_impl_.contents_.init_packet_
: reinterpret_cast< ::proto::init&>(::proto::_init_default_instance_);
}
inline const ::proto::init& packet::init_packet() const {
@@ -5486,8 +7710,8 @@ inline ::proto::init* packet::unsafe_arena_release_init_packet() {
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.init_packet)
if (_internal_has_init_packet()) {
clear_has_contents();
- ::proto::init* temp = contents_.init_packet_;
- contents_.init_packet_ = nullptr;
+ ::proto::init* temp = _impl_.contents_.init_packet_;
+ _impl_.contents_.init_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5497,7 +7721,7 @@ inline void packet::unsafe_arena_set_allocated_init_packet(::proto::init* init_p
clear_contents();
if (init_packet) {
set_has_init_packet();
- contents_.init_packet_ = init_packet;
+ _impl_.contents_.init_packet_ = init_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.init_packet)
}
@@ -5505,9 +7729,9 @@ inline ::proto::init* packet::_internal_mutable_init_packet() {
if (!_internal_has_init_packet()) {
clear_contents();
set_has_init_packet();
- contents_.init_packet_ = CreateMaybeMessage< ::proto::init >(GetArenaForAllocation());
+ _impl_.contents_.init_packet_ = CreateMaybeMessage< ::proto::init >(GetArenaForAllocation());
}
- return contents_.init_packet_;
+ return _impl_.contents_.init_packet_;
}
inline ::proto::init* packet::mutable_init_packet() {
::proto::init* _msg = _internal_mutable_init_packet();
@@ -5523,12 +7747,12 @@ inline bool packet::has_move_packet() const {
return _internal_has_move_packet();
}
inline void packet::set_has_move_packet() {
- _oneof_case_[0] = kMovePacket;
+ _impl_._oneof_case_[0] = kMovePacket;
}
inline void packet::clear_move_packet() {
if (_internal_has_move_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.move_packet_;
+ delete _impl_.contents_.move_packet_;
}
clear_has_contents();
}
@@ -5537,11 +7761,11 @@ inline ::proto::move* packet::release_move_packet() {
// @@protoc_insertion_point(field_release:proto.packet.move_packet)
if (_internal_has_move_packet()) {
clear_has_contents();
- ::proto::move* temp = contents_.move_packet_;
+ ::proto::move* temp = _impl_.contents_.move_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.move_packet_ = nullptr;
+ _impl_.contents_.move_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5549,7 +7773,7 @@ inline ::proto::move* packet::release_move_packet() {
}
inline const ::proto::move& packet::_internal_move_packet() const {
return _internal_has_move_packet()
- ? *contents_.move_packet_
+ ? *_impl_.contents_.move_packet_
: reinterpret_cast< ::proto::move&>(::proto::_move_default_instance_);
}
inline const ::proto::move& packet::move_packet() const {
@@ -5560,8 +7784,8 @@ inline ::proto::move* packet::unsafe_arena_release_move_packet() {
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.move_packet)
if (_internal_has_move_packet()) {
clear_has_contents();
- ::proto::move* temp = contents_.move_packet_;
- contents_.move_packet_ = nullptr;
+ ::proto::move* temp = _impl_.contents_.move_packet_;
+ _impl_.contents_.move_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5571,7 +7795,7 @@ inline void packet::unsafe_arena_set_allocated_move_packet(::proto::move* move_p
clear_contents();
if (move_packet) {
set_has_move_packet();
- contents_.move_packet_ = move_packet;
+ _impl_.contents_.move_packet_ = move_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.move_packet)
}
@@ -5579,9 +7803,9 @@ inline ::proto::move* packet::_internal_mutable_move_packet() {
if (!_internal_has_move_packet()) {
clear_contents();
set_has_move_packet();
- contents_.move_packet_ = CreateMaybeMessage< ::proto::move >(GetArenaForAllocation());
+ _impl_.contents_.move_packet_ = CreateMaybeMessage< ::proto::move >(GetArenaForAllocation());
}
- return contents_.move_packet_;
+ return _impl_.contents_.move_packet_;
}
inline ::proto::move* packet::mutable_move_packet() {
::proto::move* _msg = _internal_mutable_move_packet();
@@ -5589,151 +7813,151 @@ inline ::proto::move* packet::mutable_move_packet() {
return _msg;
}
-// .proto.player player_packet = 4;
-inline bool packet::_internal_has_player_packet() const {
- return contents_case() == kPlayerPacket;
+// .proto.animate_update animate_update_packet = 4;
+inline bool packet::_internal_has_animate_update_packet() const {
+ return contents_case() == kAnimateUpdatePacket;
}
-inline bool packet::has_player_packet() const {
- return _internal_has_player_packet();
+inline bool packet::has_animate_update_packet() const {
+ return _internal_has_animate_update_packet();
}
-inline void packet::set_has_player_packet() {
- _oneof_case_[0] = kPlayerPacket;
+inline void packet::set_has_animate_update_packet() {
+ _impl_._oneof_case_[0] = kAnimateUpdatePacket;
}
-inline void packet::clear_player_packet() {
- if (_internal_has_player_packet()) {
+inline void packet::clear_animate_update_packet() {
+ if (_internal_has_animate_update_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.player_packet_;
+ delete _impl_.contents_.animate_update_packet_;
}
clear_has_contents();
}
}
-inline ::proto::player* packet::release_player_packet() {
- // @@protoc_insertion_point(field_release:proto.packet.player_packet)
- if (_internal_has_player_packet()) {
+inline ::proto::animate_update* packet::release_animate_update_packet() {
+ // @@protoc_insertion_point(field_release:proto.packet.animate_update_packet)
+ if (_internal_has_animate_update_packet()) {
clear_has_contents();
- ::proto::player* temp = contents_.player_packet_;
+ ::proto::animate_update* temp = _impl_.contents_.animate_update_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.player_packet_ = nullptr;
+ _impl_.contents_.animate_update_packet_ = nullptr;
return temp;
} else {
return nullptr;
}
}
-inline const ::proto::player& packet::_internal_player_packet() const {
- return _internal_has_player_packet()
- ? *contents_.player_packet_
- : reinterpret_cast< ::proto::player&>(::proto::_player_default_instance_);
+inline const ::proto::animate_update& packet::_internal_animate_update_packet() const {
+ return _internal_has_animate_update_packet()
+ ? *_impl_.contents_.animate_update_packet_
+ : reinterpret_cast< ::proto::animate_update&>(::proto::_animate_update_default_instance_);
}
-inline const ::proto::player& packet::player_packet() const {
- // @@protoc_insertion_point(field_get:proto.packet.player_packet)
- return _internal_player_packet();
+inline const ::proto::animate_update& packet::animate_update_packet() const {
+ // @@protoc_insertion_point(field_get:proto.packet.animate_update_packet)
+ return _internal_animate_update_packet();
}
-inline ::proto::player* packet::unsafe_arena_release_player_packet() {
- // @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.player_packet)
- if (_internal_has_player_packet()) {
+inline ::proto::animate_update* packet::unsafe_arena_release_animate_update_packet() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.animate_update_packet)
+ if (_internal_has_animate_update_packet()) {
clear_has_contents();
- ::proto::player* temp = contents_.player_packet_;
- contents_.player_packet_ = nullptr;
+ ::proto::animate_update* temp = _impl_.contents_.animate_update_packet_;
+ _impl_.contents_.animate_update_packet_ = nullptr;
return temp;
} else {
return nullptr;
}
}
-inline void packet::unsafe_arena_set_allocated_player_packet(::proto::player* player_packet) {
+inline void packet::unsafe_arena_set_allocated_animate_update_packet(::proto::animate_update* animate_update_packet) {
clear_contents();
- if (player_packet) {
- set_has_player_packet();
- contents_.player_packet_ = player_packet;
+ if (animate_update_packet) {
+ set_has_animate_update_packet();
+ _impl_.contents_.animate_update_packet_ = animate_update_packet;
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.player_packet)
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.animate_update_packet)
}
-inline ::proto::player* packet::_internal_mutable_player_packet() {
- if (!_internal_has_player_packet()) {
+inline ::proto::animate_update* packet::_internal_mutable_animate_update_packet() {
+ if (!_internal_has_animate_update_packet()) {
clear_contents();
- set_has_player_packet();
- contents_.player_packet_ = CreateMaybeMessage< ::proto::player >(GetArenaForAllocation());
+ set_has_animate_update_packet();
+ _impl_.contents_.animate_update_packet_ = CreateMaybeMessage< ::proto::animate_update >(GetArenaForAllocation());
}
- return contents_.player_packet_;
+ return _impl_.contents_.animate_update_packet_;
}
-inline ::proto::player* packet::mutable_player_packet() {
- ::proto::player* _msg = _internal_mutable_player_packet();
- // @@protoc_insertion_point(field_mutable:proto.packet.player_packet)
+inline ::proto::animate_update* packet::mutable_animate_update_packet() {
+ ::proto::animate_update* _msg = _internal_mutable_animate_update_packet();
+ // @@protoc_insertion_point(field_mutable:proto.packet.animate_update_packet)
return _msg;
}
-// .proto.remove_player remove_player_packet = 5;
-inline bool packet::_internal_has_remove_player_packet() const {
- return contents_case() == kRemovePlayerPacket;
+// .proto.remove_entity remove_entity_packet = 5;
+inline bool packet::_internal_has_remove_entity_packet() const {
+ return contents_case() == kRemoveEntityPacket;
}
-inline bool packet::has_remove_player_packet() const {
- return _internal_has_remove_player_packet();
+inline bool packet::has_remove_entity_packet() const {
+ return _internal_has_remove_entity_packet();
}
-inline void packet::set_has_remove_player_packet() {
- _oneof_case_[0] = kRemovePlayerPacket;
+inline void packet::set_has_remove_entity_packet() {
+ _impl_._oneof_case_[0] = kRemoveEntityPacket;
}
-inline void packet::clear_remove_player_packet() {
- if (_internal_has_remove_player_packet()) {
+inline void packet::clear_remove_entity_packet() {
+ if (_internal_has_remove_entity_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.remove_player_packet_;
+ delete _impl_.contents_.remove_entity_packet_;
}
clear_has_contents();
}
}
-inline ::proto::remove_player* packet::release_remove_player_packet() {
- // @@protoc_insertion_point(field_release:proto.packet.remove_player_packet)
- if (_internal_has_remove_player_packet()) {
+inline ::proto::remove_entity* packet::release_remove_entity_packet() {
+ // @@protoc_insertion_point(field_release:proto.packet.remove_entity_packet)
+ if (_internal_has_remove_entity_packet()) {
clear_has_contents();
- ::proto::remove_player* temp = contents_.remove_player_packet_;
+ ::proto::remove_entity* temp = _impl_.contents_.remove_entity_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.remove_player_packet_ = nullptr;
+ _impl_.contents_.remove_entity_packet_ = nullptr;
return temp;
} else {
return nullptr;
}
}
-inline const ::proto::remove_player& packet::_internal_remove_player_packet() const {
- return _internal_has_remove_player_packet()
- ? *contents_.remove_player_packet_
- : reinterpret_cast< ::proto::remove_player&>(::proto::_remove_player_default_instance_);
+inline const ::proto::remove_entity& packet::_internal_remove_entity_packet() const {
+ return _internal_has_remove_entity_packet()
+ ? *_impl_.contents_.remove_entity_packet_
+ : reinterpret_cast< ::proto::remove_entity&>(::proto::_remove_entity_default_instance_);
}
-inline const ::proto::remove_player& packet::remove_player_packet() const {
- // @@protoc_insertion_point(field_get:proto.packet.remove_player_packet)
- return _internal_remove_player_packet();
+inline const ::proto::remove_entity& packet::remove_entity_packet() const {
+ // @@protoc_insertion_point(field_get:proto.packet.remove_entity_packet)
+ return _internal_remove_entity_packet();
}
-inline ::proto::remove_player* packet::unsafe_arena_release_remove_player_packet() {
- // @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.remove_player_packet)
- if (_internal_has_remove_player_packet()) {
+inline ::proto::remove_entity* packet::unsafe_arena_release_remove_entity_packet() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.remove_entity_packet)
+ if (_internal_has_remove_entity_packet()) {
clear_has_contents();
- ::proto::remove_player* temp = contents_.remove_player_packet_;
- contents_.remove_player_packet_ = nullptr;
+ ::proto::remove_entity* temp = _impl_.contents_.remove_entity_packet_;
+ _impl_.contents_.remove_entity_packet_ = nullptr;
return temp;
} else {
return nullptr;
}
}
-inline void packet::unsafe_arena_set_allocated_remove_player_packet(::proto::remove_player* remove_player_packet) {
+inline void packet::unsafe_arena_set_allocated_remove_entity_packet(::proto::remove_entity* remove_entity_packet) {
clear_contents();
- if (remove_player_packet) {
- set_has_remove_player_packet();
- contents_.remove_player_packet_ = remove_player_packet;
+ if (remove_entity_packet) {
+ set_has_remove_entity_packet();
+ _impl_.contents_.remove_entity_packet_ = remove_entity_packet;
}
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.remove_player_packet)
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.remove_entity_packet)
}
-inline ::proto::remove_player* packet::_internal_mutable_remove_player_packet() {
- if (!_internal_has_remove_player_packet()) {
+inline ::proto::remove_entity* packet::_internal_mutable_remove_entity_packet() {
+ if (!_internal_has_remove_entity_packet()) {
clear_contents();
- set_has_remove_player_packet();
- contents_.remove_player_packet_ = CreateMaybeMessage< ::proto::remove_player >(GetArenaForAllocation());
+ set_has_remove_entity_packet();
+ _impl_.contents_.remove_entity_packet_ = CreateMaybeMessage< ::proto::remove_entity >(GetArenaForAllocation());
}
- return contents_.remove_player_packet_;
+ return _impl_.contents_.remove_entity_packet_;
}
-inline ::proto::remove_player* packet::mutable_remove_player_packet() {
- ::proto::remove_player* _msg = _internal_mutable_remove_player_packet();
- // @@protoc_insertion_point(field_mutable:proto.packet.remove_player_packet)
+inline ::proto::remove_entity* packet::mutable_remove_entity_packet() {
+ ::proto::remove_entity* _msg = _internal_mutable_remove_entity_packet();
+ // @@protoc_insertion_point(field_mutable:proto.packet.remove_entity_packet)
return _msg;
}
@@ -5745,12 +7969,12 @@ inline bool packet::has_say_packet() const {
return _internal_has_say_packet();
}
inline void packet::set_has_say_packet() {
- _oneof_case_[0] = kSayPacket;
+ _impl_._oneof_case_[0] = kSayPacket;
}
inline void packet::clear_say_packet() {
if (_internal_has_say_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.say_packet_;
+ delete _impl_.contents_.say_packet_;
}
clear_has_contents();
}
@@ -5759,11 +7983,11 @@ inline ::proto::say* packet::release_say_packet() {
// @@protoc_insertion_point(field_release:proto.packet.say_packet)
if (_internal_has_say_packet()) {
clear_has_contents();
- ::proto::say* temp = contents_.say_packet_;
+ ::proto::say* temp = _impl_.contents_.say_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.say_packet_ = nullptr;
+ _impl_.contents_.say_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5771,7 +7995,7 @@ inline ::proto::say* packet::release_say_packet() {
}
inline const ::proto::say& packet::_internal_say_packet() const {
return _internal_has_say_packet()
- ? *contents_.say_packet_
+ ? *_impl_.contents_.say_packet_
: reinterpret_cast< ::proto::say&>(::proto::_say_default_instance_);
}
inline const ::proto::say& packet::say_packet() const {
@@ -5782,8 +8006,8 @@ inline ::proto::say* packet::unsafe_arena_release_say_packet() {
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.say_packet)
if (_internal_has_say_packet()) {
clear_has_contents();
- ::proto::say* temp = contents_.say_packet_;
- contents_.say_packet_ = nullptr;
+ ::proto::say* temp = _impl_.contents_.say_packet_;
+ _impl_.contents_.say_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5793,7 +8017,7 @@ inline void packet::unsafe_arena_set_allocated_say_packet(::proto::say* say_pack
clear_contents();
if (say_packet) {
set_has_say_packet();
- contents_.say_packet_ = say_packet;
+ _impl_.contents_.say_packet_ = say_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.say_packet)
}
@@ -5801,9 +8025,9 @@ inline ::proto::say* packet::_internal_mutable_say_packet() {
if (!_internal_has_say_packet()) {
clear_contents();
set_has_say_packet();
- contents_.say_packet_ = CreateMaybeMessage< ::proto::say >(GetArenaForAllocation());
+ _impl_.contents_.say_packet_ = CreateMaybeMessage< ::proto::say >(GetArenaForAllocation());
}
- return contents_.say_packet_;
+ return _impl_.contents_.say_packet_;
}
inline ::proto::say* packet::mutable_say_packet() {
::proto::say* _msg = _internal_mutable_say_packet();
@@ -5819,12 +8043,12 @@ inline bool packet::has_hear_player_packet() const {
return _internal_has_hear_player_packet();
}
inline void packet::set_has_hear_player_packet() {
- _oneof_case_[0] = kHearPlayerPacket;
+ _impl_._oneof_case_[0] = kHearPlayerPacket;
}
inline void packet::clear_hear_player_packet() {
if (_internal_has_hear_player_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.hear_player_packet_;
+ delete _impl_.contents_.hear_player_packet_;
}
clear_has_contents();
}
@@ -5833,11 +8057,11 @@ inline ::proto::hear_player* packet::release_hear_player_packet() {
// @@protoc_insertion_point(field_release:proto.packet.hear_player_packet)
if (_internal_has_hear_player_packet()) {
clear_has_contents();
- ::proto::hear_player* temp = contents_.hear_player_packet_;
+ ::proto::hear_player* temp = _impl_.contents_.hear_player_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.hear_player_packet_ = nullptr;
+ _impl_.contents_.hear_player_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5845,7 +8069,7 @@ inline ::proto::hear_player* packet::release_hear_player_packet() {
}
inline const ::proto::hear_player& packet::_internal_hear_player_packet() const {
return _internal_has_hear_player_packet()
- ? *contents_.hear_player_packet_
+ ? *_impl_.contents_.hear_player_packet_
: reinterpret_cast< ::proto::hear_player&>(::proto::_hear_player_default_instance_);
}
inline const ::proto::hear_player& packet::hear_player_packet() const {
@@ -5856,8 +8080,8 @@ inline ::proto::hear_player* packet::unsafe_arena_release_hear_player_packet() {
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.hear_player_packet)
if (_internal_has_hear_player_packet()) {
clear_has_contents();
- ::proto::hear_player* temp = contents_.hear_player_packet_;
- contents_.hear_player_packet_ = nullptr;
+ ::proto::hear_player* temp = _impl_.contents_.hear_player_packet_;
+ _impl_.contents_.hear_player_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5867,7 +8091,7 @@ inline void packet::unsafe_arena_set_allocated_hear_player_packet(::proto::hear_
clear_contents();
if (hear_player_packet) {
set_has_hear_player_packet();
- contents_.hear_player_packet_ = hear_player_packet;
+ _impl_.contents_.hear_player_packet_ = hear_player_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.hear_player_packet)
}
@@ -5875,9 +8099,9 @@ inline ::proto::hear_player* packet::_internal_mutable_hear_player_packet() {
if (!_internal_has_hear_player_packet()) {
clear_contents();
set_has_hear_player_packet();
- contents_.hear_player_packet_ = CreateMaybeMessage< ::proto::hear_player >(GetArenaForAllocation());
+ _impl_.contents_.hear_player_packet_ = CreateMaybeMessage< ::proto::hear_player >(GetArenaForAllocation());
}
- return contents_.hear_player_packet_;
+ return _impl_.contents_.hear_player_packet_;
}
inline ::proto::hear_player* packet::mutable_hear_player_packet() {
::proto::hear_player* _msg = _internal_mutable_hear_player_packet();
@@ -5893,12 +8117,12 @@ inline bool packet::has_request_chunk_packet() const {
return _internal_has_request_chunk_packet();
}
inline void packet::set_has_request_chunk_packet() {
- _oneof_case_[0] = kRequestChunkPacket;
+ _impl_._oneof_case_[0] = kRequestChunkPacket;
}
inline void packet::clear_request_chunk_packet() {
if (_internal_has_request_chunk_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.request_chunk_packet_;
+ delete _impl_.contents_.request_chunk_packet_;
}
clear_has_contents();
}
@@ -5907,11 +8131,11 @@ inline ::proto::request_chunk* packet::release_request_chunk_packet() {
// @@protoc_insertion_point(field_release:proto.packet.request_chunk_packet)
if (_internal_has_request_chunk_packet()) {
clear_has_contents();
- ::proto::request_chunk* temp = contents_.request_chunk_packet_;
+ ::proto::request_chunk* temp = _impl_.contents_.request_chunk_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.request_chunk_packet_ = nullptr;
+ _impl_.contents_.request_chunk_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5919,7 +8143,7 @@ inline ::proto::request_chunk* packet::release_request_chunk_packet() {
}
inline const ::proto::request_chunk& packet::_internal_request_chunk_packet() const {
return _internal_has_request_chunk_packet()
- ? *contents_.request_chunk_packet_
+ ? *_impl_.contents_.request_chunk_packet_
: reinterpret_cast< ::proto::request_chunk&>(::proto::_request_chunk_default_instance_);
}
inline const ::proto::request_chunk& packet::request_chunk_packet() const {
@@ -5930,8 +8154,8 @@ inline ::proto::request_chunk* packet::unsafe_arena_release_request_chunk_packet
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.request_chunk_packet)
if (_internal_has_request_chunk_packet()) {
clear_has_contents();
- ::proto::request_chunk* temp = contents_.request_chunk_packet_;
- contents_.request_chunk_packet_ = nullptr;
+ ::proto::request_chunk* temp = _impl_.contents_.request_chunk_packet_;
+ _impl_.contents_.request_chunk_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5941,7 +8165,7 @@ inline void packet::unsafe_arena_set_allocated_request_chunk_packet(::proto::req
clear_contents();
if (request_chunk_packet) {
set_has_request_chunk_packet();
- contents_.request_chunk_packet_ = request_chunk_packet;
+ _impl_.contents_.request_chunk_packet_ = request_chunk_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.request_chunk_packet)
}
@@ -5949,9 +8173,9 @@ inline ::proto::request_chunk* packet::_internal_mutable_request_chunk_packet()
if (!_internal_has_request_chunk_packet()) {
clear_contents();
set_has_request_chunk_packet();
- contents_.request_chunk_packet_ = CreateMaybeMessage< ::proto::request_chunk >(GetArenaForAllocation());
+ _impl_.contents_.request_chunk_packet_ = CreateMaybeMessage< ::proto::request_chunk >(GetArenaForAllocation());
}
- return contents_.request_chunk_packet_;
+ return _impl_.contents_.request_chunk_packet_;
}
inline ::proto::request_chunk* packet::mutable_request_chunk_packet() {
::proto::request_chunk* _msg = _internal_mutable_request_chunk_packet();
@@ -5967,12 +8191,12 @@ inline bool packet::has_chunk_packet() const {
return _internal_has_chunk_packet();
}
inline void packet::set_has_chunk_packet() {
- _oneof_case_[0] = kChunkPacket;
+ _impl_._oneof_case_[0] = kChunkPacket;
}
inline void packet::clear_chunk_packet() {
if (_internal_has_chunk_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.chunk_packet_;
+ delete _impl_.contents_.chunk_packet_;
}
clear_has_contents();
}
@@ -5981,11 +8205,11 @@ inline ::proto::chunk* packet::release_chunk_packet() {
// @@protoc_insertion_point(field_release:proto.packet.chunk_packet)
if (_internal_has_chunk_packet()) {
clear_has_contents();
- ::proto::chunk* temp = contents_.chunk_packet_;
+ ::proto::chunk* temp = _impl_.contents_.chunk_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.chunk_packet_ = nullptr;
+ _impl_.contents_.chunk_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -5993,7 +8217,7 @@ inline ::proto::chunk* packet::release_chunk_packet() {
}
inline const ::proto::chunk& packet::_internal_chunk_packet() const {
return _internal_has_chunk_packet()
- ? *contents_.chunk_packet_
+ ? *_impl_.contents_.chunk_packet_
: reinterpret_cast< ::proto::chunk&>(::proto::_chunk_default_instance_);
}
inline const ::proto::chunk& packet::chunk_packet() const {
@@ -6004,8 +8228,8 @@ inline ::proto::chunk* packet::unsafe_arena_release_chunk_packet() {
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.chunk_packet)
if (_internal_has_chunk_packet()) {
clear_has_contents();
- ::proto::chunk* temp = contents_.chunk_packet_;
- contents_.chunk_packet_ = nullptr;
+ ::proto::chunk* temp = _impl_.contents_.chunk_packet_;
+ _impl_.contents_.chunk_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6015,7 +8239,7 @@ inline void packet::unsafe_arena_set_allocated_chunk_packet(::proto::chunk* chun
clear_contents();
if (chunk_packet) {
set_has_chunk_packet();
- contents_.chunk_packet_ = chunk_packet;
+ _impl_.contents_.chunk_packet_ = chunk_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.chunk_packet)
}
@@ -6023,9 +8247,9 @@ inline ::proto::chunk* packet::_internal_mutable_chunk_packet() {
if (!_internal_has_chunk_packet()) {
clear_contents();
set_has_chunk_packet();
- contents_.chunk_packet_ = CreateMaybeMessage< ::proto::chunk >(GetArenaForAllocation());
+ _impl_.contents_.chunk_packet_ = CreateMaybeMessage< ::proto::chunk >(GetArenaForAllocation());
}
- return contents_.chunk_packet_;
+ return _impl_.contents_.chunk_packet_;
}
inline ::proto::chunk* packet::mutable_chunk_packet() {
::proto::chunk* _msg = _internal_mutable_chunk_packet();
@@ -6041,12 +8265,12 @@ inline bool packet::has_remove_chunk_packet() const {
return _internal_has_remove_chunk_packet();
}
inline void packet::set_has_remove_chunk_packet() {
- _oneof_case_[0] = kRemoveChunkPacket;
+ _impl_._oneof_case_[0] = kRemoveChunkPacket;
}
inline void packet::clear_remove_chunk_packet() {
if (_internal_has_remove_chunk_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.remove_chunk_packet_;
+ delete _impl_.contents_.remove_chunk_packet_;
}
clear_has_contents();
}
@@ -6055,11 +8279,11 @@ inline ::proto::remove_chunk* packet::release_remove_chunk_packet() {
// @@protoc_insertion_point(field_release:proto.packet.remove_chunk_packet)
if (_internal_has_remove_chunk_packet()) {
clear_has_contents();
- ::proto::remove_chunk* temp = contents_.remove_chunk_packet_;
+ ::proto::remove_chunk* temp = _impl_.contents_.remove_chunk_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.remove_chunk_packet_ = nullptr;
+ _impl_.contents_.remove_chunk_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6067,7 +8291,7 @@ inline ::proto::remove_chunk* packet::release_remove_chunk_packet() {
}
inline const ::proto::remove_chunk& packet::_internal_remove_chunk_packet() const {
return _internal_has_remove_chunk_packet()
- ? *contents_.remove_chunk_packet_
+ ? *_impl_.contents_.remove_chunk_packet_
: reinterpret_cast< ::proto::remove_chunk&>(::proto::_remove_chunk_default_instance_);
}
inline const ::proto::remove_chunk& packet::remove_chunk_packet() const {
@@ -6078,8 +8302,8 @@ inline ::proto::remove_chunk* packet::unsafe_arena_release_remove_chunk_packet()
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.remove_chunk_packet)
if (_internal_has_remove_chunk_packet()) {
clear_has_contents();
- ::proto::remove_chunk* temp = contents_.remove_chunk_packet_;
- contents_.remove_chunk_packet_ = nullptr;
+ ::proto::remove_chunk* temp = _impl_.contents_.remove_chunk_packet_;
+ _impl_.contents_.remove_chunk_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6089,7 +8313,7 @@ inline void packet::unsafe_arena_set_allocated_remove_chunk_packet(::proto::remo
clear_contents();
if (remove_chunk_packet) {
set_has_remove_chunk_packet();
- contents_.remove_chunk_packet_ = remove_chunk_packet;
+ _impl_.contents_.remove_chunk_packet_ = remove_chunk_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.remove_chunk_packet)
}
@@ -6097,9 +8321,9 @@ inline ::proto::remove_chunk* packet::_internal_mutable_remove_chunk_packet() {
if (!_internal_has_remove_chunk_packet()) {
clear_contents();
set_has_remove_chunk_packet();
- contents_.remove_chunk_packet_ = CreateMaybeMessage< ::proto::remove_chunk >(GetArenaForAllocation());
+ _impl_.contents_.remove_chunk_packet_ = CreateMaybeMessage< ::proto::remove_chunk >(GetArenaForAllocation());
}
- return contents_.remove_chunk_packet_;
+ return _impl_.contents_.remove_chunk_packet_;
}
inline ::proto::remove_chunk* packet::mutable_remove_chunk_packet() {
::proto::remove_chunk* _msg = _internal_mutable_remove_chunk_packet();
@@ -6115,12 +8339,12 @@ inline bool packet::has_add_block_packet() const {
return _internal_has_add_block_packet();
}
inline void packet::set_has_add_block_packet() {
- _oneof_case_[0] = kAddBlockPacket;
+ _impl_._oneof_case_[0] = kAddBlockPacket;
}
inline void packet::clear_add_block_packet() {
if (_internal_has_add_block_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.add_block_packet_;
+ delete _impl_.contents_.add_block_packet_;
}
clear_has_contents();
}
@@ -6129,11 +8353,11 @@ inline ::proto::add_block* packet::release_add_block_packet() {
// @@protoc_insertion_point(field_release:proto.packet.add_block_packet)
if (_internal_has_add_block_packet()) {
clear_has_contents();
- ::proto::add_block* temp = contents_.add_block_packet_;
+ ::proto::add_block* temp = _impl_.contents_.add_block_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.add_block_packet_ = nullptr;
+ _impl_.contents_.add_block_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6141,7 +8365,7 @@ inline ::proto::add_block* packet::release_add_block_packet() {
}
inline const ::proto::add_block& packet::_internal_add_block_packet() const {
return _internal_has_add_block_packet()
- ? *contents_.add_block_packet_
+ ? *_impl_.contents_.add_block_packet_
: reinterpret_cast< ::proto::add_block&>(::proto::_add_block_default_instance_);
}
inline const ::proto::add_block& packet::add_block_packet() const {
@@ -6152,8 +8376,8 @@ inline ::proto::add_block* packet::unsafe_arena_release_add_block_packet() {
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.add_block_packet)
if (_internal_has_add_block_packet()) {
clear_has_contents();
- ::proto::add_block* temp = contents_.add_block_packet_;
- contents_.add_block_packet_ = nullptr;
+ ::proto::add_block* temp = _impl_.contents_.add_block_packet_;
+ _impl_.contents_.add_block_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6163,7 +8387,7 @@ inline void packet::unsafe_arena_set_allocated_add_block_packet(::proto::add_blo
clear_contents();
if (add_block_packet) {
set_has_add_block_packet();
- contents_.add_block_packet_ = add_block_packet;
+ _impl_.contents_.add_block_packet_ = add_block_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.add_block_packet)
}
@@ -6171,9 +8395,9 @@ inline ::proto::add_block* packet::_internal_mutable_add_block_packet() {
if (!_internal_has_add_block_packet()) {
clear_contents();
set_has_add_block_packet();
- contents_.add_block_packet_ = CreateMaybeMessage< ::proto::add_block >(GetArenaForAllocation());
+ _impl_.contents_.add_block_packet_ = CreateMaybeMessage< ::proto::add_block >(GetArenaForAllocation());
}
- return contents_.add_block_packet_;
+ return _impl_.contents_.add_block_packet_;
}
inline ::proto::add_block* packet::mutable_add_block_packet() {
::proto::add_block* _msg = _internal_mutable_add_block_packet();
@@ -6189,12 +8413,12 @@ inline bool packet::has_remove_block_packet() const {
return _internal_has_remove_block_packet();
}
inline void packet::set_has_remove_block_packet() {
- _oneof_case_[0] = kRemoveBlockPacket;
+ _impl_._oneof_case_[0] = kRemoveBlockPacket;
}
inline void packet::clear_remove_block_packet() {
if (_internal_has_remove_block_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.remove_block_packet_;
+ delete _impl_.contents_.remove_block_packet_;
}
clear_has_contents();
}
@@ -6203,11 +8427,11 @@ inline ::proto::remove_block* packet::release_remove_block_packet() {
// @@protoc_insertion_point(field_release:proto.packet.remove_block_packet)
if (_internal_has_remove_block_packet()) {
clear_has_contents();
- ::proto::remove_block* temp = contents_.remove_block_packet_;
+ ::proto::remove_block* temp = _impl_.contents_.remove_block_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.remove_block_packet_ = nullptr;
+ _impl_.contents_.remove_block_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6215,7 +8439,7 @@ inline ::proto::remove_block* packet::release_remove_block_packet() {
}
inline const ::proto::remove_block& packet::_internal_remove_block_packet() const {
return _internal_has_remove_block_packet()
- ? *contents_.remove_block_packet_
+ ? *_impl_.contents_.remove_block_packet_
: reinterpret_cast< ::proto::remove_block&>(::proto::_remove_block_default_instance_);
}
inline const ::proto::remove_block& packet::remove_block_packet() const {
@@ -6226,8 +8450,8 @@ inline ::proto::remove_block* packet::unsafe_arena_release_remove_block_packet()
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.remove_block_packet)
if (_internal_has_remove_block_packet()) {
clear_has_contents();
- ::proto::remove_block* temp = contents_.remove_block_packet_;
- contents_.remove_block_packet_ = nullptr;
+ ::proto::remove_block* temp = _impl_.contents_.remove_block_packet_;
+ _impl_.contents_.remove_block_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6237,7 +8461,7 @@ inline void packet::unsafe_arena_set_allocated_remove_block_packet(::proto::remo
clear_contents();
if (remove_block_packet) {
set_has_remove_block_packet();
- contents_.remove_block_packet_ = remove_block_packet;
+ _impl_.contents_.remove_block_packet_ = remove_block_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.remove_block_packet)
}
@@ -6245,9 +8469,9 @@ inline ::proto::remove_block* packet::_internal_mutable_remove_block_packet() {
if (!_internal_has_remove_block_packet()) {
clear_contents();
set_has_remove_block_packet();
- contents_.remove_block_packet_ = CreateMaybeMessage< ::proto::remove_block >(GetArenaForAllocation());
+ _impl_.contents_.remove_block_packet_ = CreateMaybeMessage< ::proto::remove_block >(GetArenaForAllocation());
}
- return contents_.remove_block_packet_;
+ return _impl_.contents_.remove_block_packet_;
}
inline ::proto::remove_block* packet::mutable_remove_block_packet() {
::proto::remove_block* _msg = _internal_mutable_remove_block_packet();
@@ -6263,12 +8487,12 @@ inline bool packet::has_server_message_packet() const {
return _internal_has_server_message_packet();
}
inline void packet::set_has_server_message_packet() {
- _oneof_case_[0] = kServerMessagePacket;
+ _impl_._oneof_case_[0] = kServerMessagePacket;
}
inline void packet::clear_server_message_packet() {
if (_internal_has_server_message_packet()) {
if (GetArenaForAllocation() == nullptr) {
- delete contents_.server_message_packet_;
+ delete _impl_.contents_.server_message_packet_;
}
clear_has_contents();
}
@@ -6277,11 +8501,11 @@ inline ::proto::server_message* packet::release_server_message_packet() {
// @@protoc_insertion_point(field_release:proto.packet.server_message_packet)
if (_internal_has_server_message_packet()) {
clear_has_contents();
- ::proto::server_message* temp = contents_.server_message_packet_;
+ ::proto::server_message* temp = _impl_.contents_.server_message_packet_;
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- contents_.server_message_packet_ = nullptr;
+ _impl_.contents_.server_message_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6289,7 +8513,7 @@ inline ::proto::server_message* packet::release_server_message_packet() {
}
inline const ::proto::server_message& packet::_internal_server_message_packet() const {
return _internal_has_server_message_packet()
- ? *contents_.server_message_packet_
+ ? *_impl_.contents_.server_message_packet_
: reinterpret_cast< ::proto::server_message&>(::proto::_server_message_default_instance_);
}
inline const ::proto::server_message& packet::server_message_packet() const {
@@ -6300,8 +8524,8 @@ inline ::proto::server_message* packet::unsafe_arena_release_server_message_pack
// @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.server_message_packet)
if (_internal_has_server_message_packet()) {
clear_has_contents();
- ::proto::server_message* temp = contents_.server_message_packet_;
- contents_.server_message_packet_ = nullptr;
+ ::proto::server_message* temp = _impl_.contents_.server_message_packet_;
+ _impl_.contents_.server_message_packet_ = nullptr;
return temp;
} else {
return nullptr;
@@ -6311,7 +8535,7 @@ inline void packet::unsafe_arena_set_allocated_server_message_packet(::proto::se
clear_contents();
if (server_message_packet) {
set_has_server_message_packet();
- contents_.server_message_packet_ = server_message_packet;
+ _impl_.contents_.server_message_packet_ = server_message_packet;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.server_message_packet)
}
@@ -6319,9 +8543,9 @@ inline ::proto::server_message* packet::_internal_mutable_server_message_packet(
if (!_internal_has_server_message_packet()) {
clear_contents();
set_has_server_message_packet();
- contents_.server_message_packet_ = CreateMaybeMessage< ::proto::server_message >(GetArenaForAllocation());
+ _impl_.contents_.server_message_packet_ = CreateMaybeMessage< ::proto::server_message >(GetArenaForAllocation());
}
- return contents_.server_message_packet_;
+ return _impl_.contents_.server_message_packet_;
}
inline ::proto::server_message* packet::mutable_server_message_packet() {
::proto::server_message* _msg = _internal_mutable_server_message_packet();
@@ -6329,14 +8553,236 @@ inline ::proto::server_message* packet::mutable_server_message_packet() {
return _msg;
}
+// .proto.item_swap item_swap_packet = 14;
+inline bool packet::_internal_has_item_swap_packet() const {
+ return contents_case() == kItemSwapPacket;
+}
+inline bool packet::has_item_swap_packet() const {
+ return _internal_has_item_swap_packet();
+}
+inline void packet::set_has_item_swap_packet() {
+ _impl_._oneof_case_[0] = kItemSwapPacket;
+}
+inline void packet::clear_item_swap_packet() {
+ if (_internal_has_item_swap_packet()) {
+ if (GetArenaForAllocation() == nullptr) {
+ delete _impl_.contents_.item_swap_packet_;
+ }
+ clear_has_contents();
+ }
+}
+inline ::proto::item_swap* packet::release_item_swap_packet() {
+ // @@protoc_insertion_point(field_release:proto.packet.item_swap_packet)
+ if (_internal_has_item_swap_packet()) {
+ clear_has_contents();
+ ::proto::item_swap* temp = _impl_.contents_.item_swap_packet_;
+ if (GetArenaForAllocation() != nullptr) {
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ }
+ _impl_.contents_.item_swap_packet_ = nullptr;
+ return temp;
+ } else {
+ return nullptr;
+ }
+}
+inline const ::proto::item_swap& packet::_internal_item_swap_packet() const {
+ return _internal_has_item_swap_packet()
+ ? *_impl_.contents_.item_swap_packet_
+ : reinterpret_cast< ::proto::item_swap&>(::proto::_item_swap_default_instance_);
+}
+inline const ::proto::item_swap& packet::item_swap_packet() const {
+ // @@protoc_insertion_point(field_get:proto.packet.item_swap_packet)
+ return _internal_item_swap_packet();
+}
+inline ::proto::item_swap* packet::unsafe_arena_release_item_swap_packet() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.item_swap_packet)
+ if (_internal_has_item_swap_packet()) {
+ clear_has_contents();
+ ::proto::item_swap* temp = _impl_.contents_.item_swap_packet_;
+ _impl_.contents_.item_swap_packet_ = nullptr;
+ return temp;
+ } else {
+ return nullptr;
+ }
+}
+inline void packet::unsafe_arena_set_allocated_item_swap_packet(::proto::item_swap* item_swap_packet) {
+ clear_contents();
+ if (item_swap_packet) {
+ set_has_item_swap_packet();
+ _impl_.contents_.item_swap_packet_ = item_swap_packet;
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.item_swap_packet)
+}
+inline ::proto::item_swap* packet::_internal_mutable_item_swap_packet() {
+ if (!_internal_has_item_swap_packet()) {
+ clear_contents();
+ set_has_item_swap_packet();
+ _impl_.contents_.item_swap_packet_ = CreateMaybeMessage< ::proto::item_swap >(GetArenaForAllocation());
+ }
+ return _impl_.contents_.item_swap_packet_;
+}
+inline ::proto::item_swap* packet::mutable_item_swap_packet() {
+ ::proto::item_swap* _msg = _internal_mutable_item_swap_packet();
+ // @@protoc_insertion_point(field_mutable:proto.packet.item_swap_packet)
+ return _msg;
+}
+
+// .proto.item_use item_use_packet = 16;
+inline bool packet::_internal_has_item_use_packet() const {
+ return contents_case() == kItemUsePacket;
+}
+inline bool packet::has_item_use_packet() const {
+ return _internal_has_item_use_packet();
+}
+inline void packet::set_has_item_use_packet() {
+ _impl_._oneof_case_[0] = kItemUsePacket;
+}
+inline void packet::clear_item_use_packet() {
+ if (_internal_has_item_use_packet()) {
+ if (GetArenaForAllocation() == nullptr) {
+ delete _impl_.contents_.item_use_packet_;
+ }
+ clear_has_contents();
+ }
+}
+inline ::proto::item_use* packet::release_item_use_packet() {
+ // @@protoc_insertion_point(field_release:proto.packet.item_use_packet)
+ if (_internal_has_item_use_packet()) {
+ clear_has_contents();
+ ::proto::item_use* temp = _impl_.contents_.item_use_packet_;
+ if (GetArenaForAllocation() != nullptr) {
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ }
+ _impl_.contents_.item_use_packet_ = nullptr;
+ return temp;
+ } else {
+ return nullptr;
+ }
+}
+inline const ::proto::item_use& packet::_internal_item_use_packet() const {
+ return _internal_has_item_use_packet()
+ ? *_impl_.contents_.item_use_packet_
+ : reinterpret_cast< ::proto::item_use&>(::proto::_item_use_default_instance_);
+}
+inline const ::proto::item_use& packet::item_use_packet() const {
+ // @@protoc_insertion_point(field_get:proto.packet.item_use_packet)
+ return _internal_item_use_packet();
+}
+inline ::proto::item_use* packet::unsafe_arena_release_item_use_packet() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.item_use_packet)
+ if (_internal_has_item_use_packet()) {
+ clear_has_contents();
+ ::proto::item_use* temp = _impl_.contents_.item_use_packet_;
+ _impl_.contents_.item_use_packet_ = nullptr;
+ return temp;
+ } else {
+ return nullptr;
+ }
+}
+inline void packet::unsafe_arena_set_allocated_item_use_packet(::proto::item_use* item_use_packet) {
+ clear_contents();
+ if (item_use_packet) {
+ set_has_item_use_packet();
+ _impl_.contents_.item_use_packet_ = item_use_packet;
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.item_use_packet)
+}
+inline ::proto::item_use* packet::_internal_mutable_item_use_packet() {
+ if (!_internal_has_item_use_packet()) {
+ clear_contents();
+ set_has_item_use_packet();
+ _impl_.contents_.item_use_packet_ = CreateMaybeMessage< ::proto::item_use >(GetArenaForAllocation());
+ }
+ return _impl_.contents_.item_use_packet_;
+}
+inline ::proto::item_use* packet::mutable_item_use_packet() {
+ ::proto::item_use* _msg = _internal_mutable_item_use_packet();
+ // @@protoc_insertion_point(field_mutable:proto.packet.item_use_packet)
+ return _msg;
+}
+
+// .proto.item_update item_update_packet = 15;
+inline bool packet::_internal_has_item_update_packet() const {
+ return contents_case() == kItemUpdatePacket;
+}
+inline bool packet::has_item_update_packet() const {
+ return _internal_has_item_update_packet();
+}
+inline void packet::set_has_item_update_packet() {
+ _impl_._oneof_case_[0] = kItemUpdatePacket;
+}
+inline void packet::clear_item_update_packet() {
+ if (_internal_has_item_update_packet()) {
+ if (GetArenaForAllocation() == nullptr) {
+ delete _impl_.contents_.item_update_packet_;
+ }
+ clear_has_contents();
+ }
+}
+inline ::proto::item_update* packet::release_item_update_packet() {
+ // @@protoc_insertion_point(field_release:proto.packet.item_update_packet)
+ if (_internal_has_item_update_packet()) {
+ clear_has_contents();
+ ::proto::item_update* temp = _impl_.contents_.item_update_packet_;
+ if (GetArenaForAllocation() != nullptr) {
+ temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
+ }
+ _impl_.contents_.item_update_packet_ = nullptr;
+ return temp;
+ } else {
+ return nullptr;
+ }
+}
+inline const ::proto::item_update& packet::_internal_item_update_packet() const {
+ return _internal_has_item_update_packet()
+ ? *_impl_.contents_.item_update_packet_
+ : reinterpret_cast< ::proto::item_update&>(::proto::_item_update_default_instance_);
+}
+inline const ::proto::item_update& packet::item_update_packet() const {
+ // @@protoc_insertion_point(field_get:proto.packet.item_update_packet)
+ return _internal_item_update_packet();
+}
+inline ::proto::item_update* packet::unsafe_arena_release_item_update_packet() {
+ // @@protoc_insertion_point(field_unsafe_arena_release:proto.packet.item_update_packet)
+ if (_internal_has_item_update_packet()) {
+ clear_has_contents();
+ ::proto::item_update* temp = _impl_.contents_.item_update_packet_;
+ _impl_.contents_.item_update_packet_ = nullptr;
+ return temp;
+ } else {
+ return nullptr;
+ }
+}
+inline void packet::unsafe_arena_set_allocated_item_update_packet(::proto::item_update* item_update_packet) {
+ clear_contents();
+ if (item_update_packet) {
+ set_has_item_update_packet();
+ _impl_.contents_.item_update_packet_ = item_update_packet;
+ }
+ // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto.packet.item_update_packet)
+}
+inline ::proto::item_update* packet::_internal_mutable_item_update_packet() {
+ if (!_internal_has_item_update_packet()) {
+ clear_contents();
+ set_has_item_update_packet();
+ _impl_.contents_.item_update_packet_ = CreateMaybeMessage< ::proto::item_update >(GetArenaForAllocation());
+ }
+ return _impl_.contents_.item_update_packet_;
+}
+inline ::proto::item_update* packet::mutable_item_update_packet() {
+ ::proto::item_update* _msg = _internal_mutable_item_update_packet();
+ // @@protoc_insertion_point(field_mutable:proto.packet.item_update_packet)
+ return _msg;
+}
+
inline bool packet::has_contents() const {
return contents_case() != CONTENTS_NOT_SET;
}
inline void packet::clear_has_contents() {
- _oneof_case_[0] = CONTENTS_NOT_SET;
+ _impl_._oneof_case_[0] = CONTENTS_NOT_SET;
}
inline packet::ContentsCase packet::contents_case() const {
- return packet::ContentsCase(_oneof_case_[0]);
+ return packet::ContentsCase(_impl_._oneof_case_[0]);
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
@@ -6375,6 +8821,22 @@ inline packet::ContentsCase packet::contents_case() const {
// -------------------------------------------------------------------
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
// @@protoc_insertion_point(namespace_scope)
diff --git a/src/shared/net/lib/protobuf/net.proto b/src/shared/net/lib/protobuf/net.proto
index 79d58e7..f84c0e7 100644
--- a/src/shared/net/lib/protobuf/net.proto
+++ b/src/shared/net/lib/protobuf/net.proto
@@ -25,19 +25,38 @@ message ivec3 {
int32 z = 3;
}
-message player {
+message entity {
uint32 index = 1;
+ coords chunk_pos = 2;
+ vec3 local_pos = 3;
+}
+
+message animate {
+ entity entity = 1;
+
uint32 commands = 2;
+ angles viewangles = 3;
+ vec3 velocity = 4;
+ uint32 active_item = 5;
+}
- coords chunk_pos = 3;
- vec3 local_pos = 4;
+message item {
+ uint32 index = 1; // in inventory
+ uint32 type = 2;
+ uint32 quantity = 3;
+}
- angles viewangles = 5;
- vec3 velocity = 6;
+message item_array {
+ repeated item items = 1;
}
-// END OF STRUCTS
-// PACKETS
+message player {
+ animate animate = 1;
+ item_array inventory = 2;
+}
+// END STRUCTS
+
+// PACKETS
message auth {
string username = 1;
string password = 2;
@@ -47,14 +66,18 @@ message init {
uint64 seed = 1;
int32 draw_distance = 2;
player localplayer = 3;
+ uint32 tickrate = 4;
+ uint32 tick = 5;
}
message move {
uint32 commands = 1;
angles viewangles = 2;
+ uint32 active_item = 3;
+ uint32 sequence = 4;
}
-message remove_player {
+message remove_entity {
uint32 index = 1;
}
@@ -86,7 +109,7 @@ message add_block {
ivec3 block_pos = 2;
// A bit inefficient as we only need 8 bits. We could use the rest for other
// stuff down the road.
- uint32 block = 3;
+ uint32 active_item = 3;
}
message remove_block {
@@ -98,6 +121,26 @@ message server_message {
string message = 1;
bool fatal = 2;
}
+
+message item_swap { // client sent, swap items in an array of items
+ uint32 index_a = 1;
+ uint32 index_b = 2;
+}
+
+message item_use { // client sent, uses an item
+ uint32 index = 1;
+}
+
+message item_update { // server sent, reflects any inventory changes
+ repeated item items = 1;
+}
+
+message animate_update {
+ animate animate = 1;
+ uint32 tick = 2;
+ optional uint32 sequence = 3;
+}
+
// END OF PACKETS
// Actual thing we read.
@@ -107,8 +150,8 @@ oneof contents {
auth auth_packet = 1;
init init_packet = 2;
move move_packet = 3;
- player player_packet = 4;
- remove_player remove_player_packet = 5;
+ animate_update animate_update_packet = 4;
+ remove_entity remove_entity_packet = 5;
say say_packet = 6;
hear_player hear_player_packet = 7;
request_chunk request_chunk_packet = 8;
@@ -117,6 +160,9 @@ oneof contents {
add_block add_block_packet = 11;
remove_block remove_block_packet = 12;
server_message server_message_packet = 13;
+ item_swap item_swap_packet = 14;
+ item_use item_use_packet = 16;
+ item_update item_update_packet = 15;
}
}
diff --git a/src/shared/net/packet.cc b/src/shared/net/packet.cc
new file mode 100644
index 0000000..230722d
--- /dev/null
+++ b/src/shared/net/packet.cc
@@ -0,0 +1,29 @@
+#include "shared/net/packet.hh"
+
+namespace shared {
+namespace net {
+
+upacket::upacket(const proto::packet& proto) {
+ this->data = proto.SerializeAsString();
+ this->data = shared::compress_string(this->data);
+}
+
+rpacket::rpacket(const proto::packet& proto) {
+ const std::string serialised = [&]() {
+ std::string ret = proto.SerializeAsString();
+ return shared::compress_string(ret);
+ }();
+
+ const std::string header = [&]() {
+ std::string ret(sizeof(packet_header_t), '\0');
+ const packet_header_t size = htonl(static_cast<std::uint32_t>(
+ std::size(serialised) + sizeof(packet_header_t)));
+ std::memcpy(std::data(ret), &size, sizeof(size));
+ return ret;
+ }();
+
+ this->data = std::move(header) + std::move(serialised);
+}
+
+} // namespace net
+} // namespace shared
diff --git a/src/shared/net/packet.hh b/src/shared/net/packet.hh
new file mode 100644
index 0000000..417fd0e
--- /dev/null
+++ b/src/shared/net/packet.hh
@@ -0,0 +1,42 @@
+#ifndef SHARED_NET_PACKET_HH_
+#define SHARED_NET_PACKET_HH_
+
+#include <string>
+
+#include "shared/net/net.hh"
+#include "shared/net/proto.hh"
+#include "shared/shared.hh"
+
+namespace shared {
+namespace net {
+
+using packet_header_t = std::uint32_t;
+
+// A packet is a simple object which holds compressed protobuf data.
+// We split up upackets and rpackets as rpackets require a header on the
+// (due to using the reliable stream) which is not the case for the unreliable
+// stream.
+class packet {
+public:
+ std::string data;
+
+public:
+ //virtual ~packet() = 0;
+};
+
+class upacket : public packet {
+public:
+ upacket(const proto::packet& proto);
+ virtual ~upacket() {};
+};
+
+class rpacket : public packet {
+public:
+ rpacket(const proto::packet& proto);
+ virtual ~rpacket() {};
+};
+
+} // namespace net
+} // namespace shared
+
+#endif
diff --git a/src/shared/net/proto.cc b/src/shared/net/proto.cc
index 1c954b1..6d734a4 100644
--- a/src/shared/net/proto.cc
+++ b/src/shared/net/proto.cc
@@ -3,51 +3,45 @@
namespace shared {
namespace net {
-shared::player get_player(const proto::player& packet) noexcept {
- return shared::player{
- .index = packet.index(),
- .commands = packet.commands(),
- .chunk_pos = {packet.chunk_pos().x(), packet.chunk_pos().z()},
- .local_pos = {packet.local_pos().x(), packet.local_pos().y(),
- packet.local_pos().z()},
- .viewangles = {packet.viewangles().pitch(), packet.viewangles().yaw()},
- .velocity = {packet.velocity().x(), packet.velocity().y(),
- packet.velocity().z()},
- };
-}
-
-void set_angles(proto::angles& proto_angles,
+void set_angles(proto::angles* const proto_angles,
const shared::math::angles& angles) noexcept {
- proto_angles.set_pitch(angles.pitch);
- proto_angles.set_yaw(angles.yaw);
+ proto_angles->set_pitch(angles.pitch);
+ proto_angles->set_yaw(angles.yaw);
}
-void set_coords(proto::coords& proto_coords,
+void set_coords(proto::coords* const proto_coords,
const shared::math::coords& coords) noexcept {
- proto_coords.set_x(coords.x);
- proto_coords.set_z(coords.z);
+ proto_coords->set_x(coords.x);
+ proto_coords->set_z(coords.z);
}
-void set_vec3(proto::vec3& proto_vec3, const glm::vec3& vec3) noexcept {
- proto_vec3.set_x(vec3.x);
- proto_vec3.set_y(vec3.y);
- proto_vec3.set_z(vec3.z);
+void set_vec3(proto::vec3* const proto_vec3, const glm::vec3& vec3) noexcept {
+ proto_vec3->set_x(vec3.x);
+ proto_vec3->set_y(vec3.y);
+ proto_vec3->set_z(vec3.z);
}
-void set_ivec3(proto::ivec3& proto_ivec3, const glm::ivec3& ivec3) noexcept {
- proto_ivec3.set_x(ivec3.x);
- proto_ivec3.set_y(ivec3.y);
- proto_ivec3.set_z(ivec3.z);
+void set_ivec3(proto::ivec3* const proto_ivec3,
+ const glm::ivec3& ivec3) noexcept {
+ proto_ivec3->set_x(ivec3.x);
+ proto_ivec3->set_y(ivec3.y);
+ proto_ivec3->set_z(ivec3.z);
}
-void set_player(proto::player& proto_player,
- const shared::player& player) noexcept {
- proto_player.set_index(player.index);
- proto_player.set_commands(player.commands);
- set_coords(*proto_player.mutable_chunk_pos(), player.chunk_pos);
- set_vec3(*proto_player.mutable_local_pos(), player.local_pos);
- set_angles(*proto_player.mutable_viewangles(), player.viewangles);
- set_vec3(*proto_player.mutable_velocity(), player.velocity);
+shared::math::angles get_angles(const proto::angles& proto) noexcept {
+ return shared::math::angles{proto.pitch(), proto.yaw()};
+}
+
+shared::math::coords get_coords(const proto::coords& proto) noexcept {
+ return shared::math::coords{proto.x(), proto.z()};
+}
+
+glm::vec3 get_vec3(const proto::vec3& proto) noexcept {
+ return glm::vec3{proto.x(), proto.y(), proto.z()};
+}
+
+glm::ivec3 get_ivec3(const proto::ivec3& proto) noexcept {
+ return glm::ivec3{proto.x(), proto.y(), proto.z()};
}
} // namespace net
diff --git a/src/shared/net/proto.hh b/src/shared/net/proto.hh
index 93bb005..d2bbd1c 100644
--- a/src/shared/net/proto.hh
+++ b/src/shared/net/proto.hh
@@ -1,26 +1,26 @@
#ifndef SHARED_NET_PROTO_HH_
#define SHARED_NET_PROTO_HH_
-#include "shared/math.hh"
-#include "shared/player.hh"
+#include "shared/math/math.hh"
#undef Status // Protobuf doesn't like xlib apparently.
#include "shared/net/lib/protobuf/net.pb.h"
-// TODO packet struct parsing packet helper functions
+// Helper functions for getting/setting simple structs for our protobuf.
namespace shared {
namespace net {
-shared::player get_player(const proto::player& packet) noexcept;
-
-void set_angles(proto::angles& proto_angles,
+void set_angles(proto::angles* const proto,
const shared::math::angles& angles) noexcept;
-void set_coords(proto::coords& proto_coords,
+void set_coords(proto::coords* const proto,
const shared::math::coords& coords) noexcept;
-void set_vec3(proto::vec3& proto_vec3, const glm::vec3& vec3) noexcept;
-void set_ivec3(proto::ivec3& proto_ivec3, const glm::ivec3& ivec3) noexcept;
-void set_player(proto::player& proto_player,
- const shared::player& player) noexcept;
+void set_vec3(proto::vec3* const proto, const glm::vec3& vec3) noexcept;
+void set_ivec3(proto::ivec3* const proto, const glm::ivec3& ivec3) noexcept;
+
+shared::math::angles get_angles(const proto::angles& proto) noexcept;
+shared::math::coords get_coords(const proto::coords& proto) noexcept;
+glm::vec3 get_vec3(const proto::vec3& proto) noexcept;
+glm::ivec3 get_ivec3(const proto::ivec3& proto) noexcept;
} // namespace net
} // namespace shared
diff --git a/src/shared/player.cc b/src/shared/player.cc
deleted file mode 100644
index 55542ca..0000000
--- a/src/shared/player.cc
+++ /dev/null
@@ -1 +0,0 @@
-#include "player.hh"
diff --git a/src/shared/player.hh b/src/shared/player.hh
deleted file mode 100644
index 5929c5b..0000000
--- a/src/shared/player.hh
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef SHARED_PLAYER_HH_
-#define SHARED_PLAYER_HH_
-
-#include <cstdint>
-
-#include <glm/glm.hpp>
-
-#include "shared/math.hh"
-
-namespace shared {
-
-// Anything here goes over the wire.
-struct player {
-public:
- using index_t = std::uint32_t;
-
- static constexpr float HEIGHT = 1.9f;
- static constexpr float EYE_HEIGHT = HEIGHT * 0.8f;
- static constexpr float HALFWIDTH = 0.25f;
-
-public:
- std::uint32_t index = 0;
- std::uint32_t commands = 0;
-
- shared::math::coords chunk_pos = {};
- glm::vec3 local_pos = {};
-
- shared::math::angles viewangles = {};
- glm::vec3 velocity = {};
-
-public:
- enum mask : decltype(commands) {
- forward = 1 << 0,
- left = 1 << 1,
- backward = 1 << 2,
- right = 1 << 3,
- jump = 1 << 4,
- crouch = 1 << 5,
- sprint = 1 << 6,
- attack = 1 << 7
- };
-};
-
-} // namespace shared
-
-#endif
diff --git a/src/shared/shared.cc b/src/shared/shared.cc
index 55ccf1f..f5a478b 100644
--- a/src/shared/shared.cc
+++ b/src/shared/shared.cc
@@ -2,6 +2,12 @@
namespace shared {
+float get_duration_seconds(const time_duration_t& duration) noexcept {
+ const auto fdiff =
+ std::chrono::duration_cast<std::chrono::duration<float>>(duration);
+ return fdiff.count();
+}
+
std::string make_string_lower(std::string str) noexcept {
std::ranges::transform(str.begin(), str.end(), str.begin(),
[](const auto c) { return std::tolower(c); });
@@ -26,7 +32,7 @@ std::ofstream open_file(const std::string& dir,
return ret;
}
-void compress_string(std::string& str) noexcept {
+std::string compress_string(const std::string& str) {
std::stringstream input(str);
boost::iostreams::filtering_streambuf<boost::iostreams::input> out;
@@ -37,21 +43,26 @@ void compress_string(std::string& str) noexcept {
std::stringstream result;
boost::iostreams::copy(out, result);
- str = result.str();
+ return result.str();
}
-void decompress_string(std::string& str) noexcept {
- std::stringstream input;
- input << str;
+std::optional<std::string>
+maybe_decompress_string(const std::string& str) noexcept {
+ try {
+ std::stringstream input;
+ input << str;
- boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
- in.push(boost::iostreams::gzip_decompressor());
- in.push(input);
+ boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
+ in.push(boost::iostreams::gzip_decompressor());
+ in.push(input);
- std::stringstream result;
- boost::iostreams::copy(in, result);
+ std::stringstream result;
+ boost::iostreams::copy(in, result);
- str = result.str();
+ return result.str();
+ } catch (...) {
+ return std::nullopt;
+ }
}
} // namespace shared
diff --git a/src/shared/shared.hh b/src/shared/shared.hh
index 2d64814..f070425 100644
--- a/src/shared/shared.hh
+++ b/src/shared/shared.hh
@@ -4,34 +4,51 @@
#include <algorithm>
#include <atomic>
#include <chrono>
+#include <cstdlib>
+#include <execinfo.h>
#include <fstream>
+#include <getopt.h>
#include <iomanip>
#include <iostream>
#include <mutex>
+#include <optional>
#include <ranges>
+#include <signal.h>
#include <string>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
-#include "shared/math.hh"
+#include "shared/math/math.hh"
+#include "shared/net/proto.hh"
-// Tiny thread safe printing.
namespace shared {
+using time_point_t = decltype(std::chrono::steady_clock::now());
+using time_duration_t = decltype(std::chrono::steady_clock::now() -
+ std::chrono::steady_clock::now());
+float get_duration_seconds(const time_duration_t& duration) noexcept;
+
std::string make_string_lower(std::string str) noexcept;
std::string read_file(const std::string& path);
-void compress_string(std::string& str) noexcept;
-void decompress_string(std::string& str) noexcept;
+
+[[nodiscard]] std::string compress_string(const std::string& str);
+[[nodiscard]] std::optional<std::string>
+maybe_decompress_string(const std::string& str) noexcept;
+
std::ofstream open_file(const std::string& dir,
const std::ios_base::openmode mode = std::ios::trunc);
constexpr unsigned long MAX_SAY_LENGTH = 32ul;
constexpr unsigned long MAX_USER_PASS_LENGTH = 64;
-class print {
-private:
+using tick_t = std::uint32_t;
+
+// Thread safe printing - this MESS will be cleaned up when we have std::print.
+namespace print {
+class print_base {
+protected:
static inline std::mutex lock;
public:
@@ -54,65 +71,61 @@ public:
bright_cyan = 96,
bright_white = 97
};
+ static std::string make_colour(const colour clr) noexcept {
+ return {"\033[" + std::to_string(static_cast<int>(clr)) + "m"};
+ }
-private:
- static void print_message(const std::string_view message,
- const bool print_time,
- const std::string_view colour,
+protected:
+ static void print_message(std::ostream& os, const std::string_view colour,
const bool cerr = false) noexcept {
const std::lock_guard<std::mutex> guard(lock);
-
- if (print_time) {
- const auto epoch = std::time(nullptr);
- struct tm* local = localtime(&epoch);
- std::cout << std::put_time(local, "[%F %T] ");
- }
- static std::string none = make_colour(colour::none);
-
- if (cerr) {
- std::cerr << colour << message << none;
- return;
- }
-
- std::cout << colour << message << none;
- }
- static std::string make_colour(const colour clr) noexcept {
- return {"\033[" + std::to_string(static_cast<int>(clr)) + "m"};
+ static const std::string none = make_colour(colour::none);
+ (cerr ? std::cerr : std::cout) << colour << os.rdbuf() << none;
}
+};
+class print_time { // operator<< returns time as stringstream
public:
- print() noexcept = delete;
- static void message(const std::string_view msg,
- const bool print_time = true) noexcept {
- static const std::string grey = make_colour(colour::white);
- print_message(msg, print_time, grey);
- }
- static void notify(const std::string_view msg,
- const bool print_time = true) noexcept {
- static const std::string cyan = make_colour(colour::cyan);
- print_message(msg, print_time, cyan);
- }
- static void warn(const std::string_view msg,
- const bool print_time = true) noexcept {
- static const std::string b_yellow = make_colour(colour::bright_yellow);
- print_message(msg, print_time, b_yellow);
- }
- static void fault(const std::string_view msg,
- const bool print_time = true) noexcept {
- static const std::string bright_red = make_colour(colour::bright_red);
- print_message(msg, print_time, bright_red, true);
- }
- static void debug(const std::string_view msg,
- const bool print_time = true) noexcept {
- static const std::string magenta = make_colour(colour::magenta);
- print_message(msg, print_time, magenta, true);
+ friend std::ostream& operator<<(std::ostream& os,
+ const print_time&) noexcept {
+ const auto epoch = std::time(nullptr);
+ struct tm* local = localtime(&epoch);
+
+ using pb = print_base;
+ static const std::string white = pb::make_colour(pb::colour::white);
+ static const std::string none = pb::make_colour(pb::colour::none);
+ os << white << std::put_time(local, "[%F %T] ") << none;
+ return os;
}
- static void custom(const std::string_view msg, const enum colour colour,
- const bool print_time = true) noexcept {
- print_message(msg, print_time, make_colour(colour));
+};
+
+class print_colour : public print_base {
+private:
+ enum print_base::colour colour;
+ bool cerr;
+
+public:
+ print_colour(const decltype(colour) colour,
+ const decltype(cerr) cerr) noexcept
+ : colour(colour), cerr(cerr) {}
+
+ template <typename T>
+ print_colour& operator<<(const T& obj) noexcept {
+ std::stringstream ss{};
+ ss << obj;
+ print_base::print_message(ss, make_colour(this->colour), this->cerr);
+ return *this;
}
};
+inline auto time = print_time{};
+inline print_colour message{print_base::colour::white, false};
+inline print_colour notify{print_base::colour::cyan, false};
+inline print_colour warn{print_base::colour::bright_yellow, true};
+inline print_colour fault{print_base::colour::bright_red, true};
+inline print_colour debug{print_base::colour::magenta, true};
+} // namespace print
+
inline std::atomic<bool> should_exit = false;
}; // namespace shared
diff --git a/src/shared/world.hh b/src/shared/world.hh
deleted file mode 100644
index 3969992..0000000
--- a/src/shared/world.hh
+++ /dev/null
@@ -1,224 +0,0 @@
-#ifndef SHARED_WORLD_HH_
-#define SHARED_WORLD_HH_
-
-#include <algorithm>
-#include <array>
-#include <exception>
-#include <functional>
-#include <istream>
-#include <memory>
-#include <random>
-#include <type_traits>
-#include <vector>
-
-#include <boost/functional/hash.hpp>
-#include <glm/glm.hpp>
-
-#include "shared/math.hh"
-#include "shared/net/proto.hh"
-#include "shared/shared.hh"
-
-namespace shared {
-namespace world {
-
-class block {
-public:
- enum class type : std::uint8_t {
- air, // zero means air which means don't render
- dirt, // atlas should start from here
- grass,
- sand,
- sandstone,
- stone,
- cobblestone,
- wood,
- leaves,
- water,
- shrub,
- snow,
- cactus,
- dead_shrub,
- snowy_wood,
- snowy_leaves,
- snowy_shrub,
- };
- enum class visibility { solid, partial, translucent, invisible };
-
-public:
- type type;
-
-public:
- static constexpr enum block::visibility
- get_visibility(const enum block::type type) noexcept {
- switch (type) {
- case type::air:
- return visibility::invisible;
- case type::shrub:
- case type::dead_shrub:
- case type::leaves:
- case type::snowy_leaves:
- case type::snowy_shrub:
- return visibility::partial;
- case type::water:
- return visibility::translucent;
- default:
- break;
- }
- return visibility::solid;
- }
- static constexpr bool is_tangible(const enum block::type type) noexcept {
- switch (type) {
- case type::air:
- case type::shrub:
- case type::dead_shrub:
- case type::snowy_shrub:
- return false;
- default:
- break;
- }
- return true;
- }
- static constexpr bool is_collidable(const enum block::type type) noexcept {
- switch (type) {
- case type::air:
- case type::shrub:
- case type::dead_shrub:
- case type::snowy_shrub:
- case type::water:
- return false;
- default:
- break;
- }
- return true;
- }
- static constexpr bool is_liquid(const enum block::type type) noexcept {
- switch (type) {
- case type::water:
- return true;
- default:
- break;
- }
- return false;
- }
- static constexpr bool is_replaceable(const enum block::type type) noexcept {
- switch (type) {
- case type::water:
- case type::air:
- return true;
- default:
- break;
- }
- return false;
- }
- static constexpr bool is_removable(const enum block::type type) noexcept {
- switch (type) {
- case type::water:
- case type::air:
- return false;
- default:
- break;
- }
- return true;
- }
- static constexpr float get_friction(const enum block::type type) noexcept {
- switch (type) {
- case type::water:
- return 20.0f;
- case type::air:
- case type::shrub:
- case type::dead_shrub:
- case type::snowy_shrub:
- return 0.1f;
- default:
- break;
- }
- return 10.0f;
- }
-
-public:
- block(const enum block::type t = type::air) noexcept : type(t) {}
-
- operator enum block::type() const noexcept { return this->type; }
-};
-
-class chunk {
-public:
- static constexpr int WIDTH = 16;
- static constexpr int HEIGHT = 256;
- static constexpr int VOLUME = WIDTH * WIDTH * HEIGHT;
-
- // Stuff for unordered_map.
- static std::size_t hash(const shared::math::coords& c) noexcept {
- std::size_t seed = 0;
- boost::hash_combine(seed, boost::hash_value(c.x));
- boost::hash_combine(seed, boost::hash_value(c.z));
- return seed;
- }
- static std::size_t equal(const shared::math::coords& a,
- const shared::math::coords& b) noexcept {
- return a == b;
- }
- using map = std::unordered_map<shared::math::coords, shared::world::chunk,
- decltype(&shared::world::chunk::hash),
- decltype(&shared::world::chunk::equal)>;
-
-protected:
- shared::math::coords pos;
- std::array<block, VOLUME> blocks; // Use get_block for 3d index access.
-
-public:
- using block_array = decltype(chunk::blocks);
- enum class biome { desert, islands, ocean, plains, forest, tundra, alpine };
-
- static bool is_outside_chunk(const glm::ivec3& v) noexcept {
- return (std::min(v.x, v.z) < 0) || (std::max(v.x, v.z) >= WIDTH) ||
- (std::clamp(v.y, 0, HEIGHT - 1) != v.y);
- }
- static shared::math::coords
- get_normalised_chunk(const shared::math::coords& coords, const int x,
- const int z) noexcept {
- return coords + shared::math::coords{(x >= WIDTH) - (x < 0),
- (z >= WIDTH) - (z < 0)};
- }
- static std::pair<unsigned short, unsigned short>
- get_normalised_coords(const int x, const int z) noexcept {
- return {x + WIDTH * ((x < 0) - (x >= WIDTH)),
- z + WIDTH * ((z < 0) - (z >= WIDTH))};
- }
- static glm::ivec3 get_normalised_coords(const glm::ivec3& c) noexcept {
- const auto [x, z] = get_normalised_coords(c.x, c.z);
- return {x, c.y, z};
- }
- static block_array
- make_blocks_from_chunk(const proto::chunk& chunk) noexcept;
-
-public:
- static unsigned long get_3d_index(const glm::ivec3& v) noexcept {
-#ifndef NDEBUG
- if (is_outside_chunk(v)) {
- throw std::range_error("bad chunk block coordinate access");
- }
-#endif
- return static_cast<unsigned long>(v.x +
- (WIDTH * (v.y + (HEIGHT * v.z))));
- }
-
-public:
- // If a third non-std::nullopt argument is provided, we use those blocks
- // instead of what we might have otherwise generated.
- chunk(const std::uint64_t& seed, const shared::math::coords& coords,
- const std::optional<block_array> blocks = std::nullopt) noexcept;
-
- shared::math::coords get_pos() const noexcept { return this->pos; }
- block get_block(const glm::ivec3& v) const noexcept {
- return this->blocks[get_3d_index(v)];
- }
- block& get_block(const glm::ivec3& v) noexcept {
- return this->blocks[get_3d_index(v)];
- }
-};
-
-} // namespace world
-} // namespace shared
-
-#endif
diff --git a/src/shared/world/block.cc b/src/shared/world/block.cc
new file mode 100644
index 0000000..4d66462
--- /dev/null
+++ b/src/shared/world/block.cc
@@ -0,0 +1,85 @@
+#include "shared/world/block.hh"
+
+namespace shared {
+namespace world {
+
+enum block::visibility
+block::get_visibility(const enum block::type type) noexcept {
+ switch (type) {
+ case type::air:
+ return visibility::invisible;
+ case type::shrub:
+ case type::dead_shrub:
+ case type::leaves:
+ case type::snowy_leaves:
+ case type::snowy_shrub:
+ return visibility::partial;
+ case type::water:
+ return visibility::translucent;
+ default:
+ break;
+ }
+ return visibility::solid;
+}
+
+bool block::is_tangible(const enum block::type type) noexcept {
+ switch (type) {
+ case type::air:
+ case type::shrub:
+ case type::dead_shrub:
+ case type::snowy_shrub:
+ return false;
+ default:
+ break;
+ }
+ return true;
+}
+
+bool block::is_collidable(const enum block::type type) noexcept {
+ switch (type) {
+ case type::air:
+ case type::shrub:
+ case type::dead_shrub:
+ case type::snowy_shrub:
+ case type::water:
+ return false;
+ default:
+ break;
+ }
+ return true;
+}
+
+bool block::is_liquid(const enum block::type type) noexcept {
+ switch (type) {
+ case type::water:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+bool block::is_replaceable(const enum block::type type) noexcept {
+ switch (type) {
+ case type::water:
+ case type::air:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+bool block::is_removable(const enum block::type type) noexcept {
+ switch (type) {
+ case type::water:
+ case type::air:
+ return false;
+ default:
+ break;
+ }
+ return true;
+}
+
+} // namespace world
+} // namespace shared
diff --git a/src/shared/world/block.hh b/src/shared/world/block.hh
new file mode 100644
index 0000000..f8d4e11
--- /dev/null
+++ b/src/shared/world/block.hh
@@ -0,0 +1,54 @@
+#ifndef SHARED_WORLD_BLOCK_BLOCK_HH_
+#define SHARED_WORLD_BLOCK_BLOCK_HH_
+
+#include <cstdint>
+
+namespace shared {
+namespace world {
+
+class block {
+public:
+ enum class type : std::uint8_t {
+ air, // zero means air which means don't render
+ dirt, // atlas should start from here
+ grass,
+ sand,
+ sandstone,
+ stone,
+ cobblestone,
+ wood,
+ leaves,
+ water,
+ shrub,
+ snow,
+ cactus,
+ dead_shrub,
+ snowy_wood,
+ snowy_leaves,
+ snowy_shrub,
+ };
+ enum class visibility { solid, partial, translucent, invisible };
+
+public:
+ type type;
+
+public:
+ // We prefer a static switch statement over constructing an object for
+ // speed.
+ static enum visibility get_visibility(const enum type type) noexcept;
+ static bool is_tangible(const enum type type) noexcept;
+ static bool is_collidable(const enum type type) noexcept;
+ static bool is_liquid(const enum type type) noexcept;
+ static bool is_replaceable(const enum type type) noexcept;
+ static bool is_removable(const enum type type) noexcept;
+
+public:
+ block(const enum type t = type::air) noexcept : type(t) {}
+
+ operator enum block::type() const noexcept { return this->type; }
+};
+
+} // namespace world
+} // namespace shared
+
+#endif
diff --git a/src/shared/world.cc b/src/shared/world/chunk.cc
index d56b7a8..b7dec5b 100644
--- a/src/shared/world.cc
+++ b/src/shared/world/chunk.cc
@@ -1,11 +1,11 @@
-#include "shared/world.hh"
+#include "shared/world/chunk.hh"
namespace shared {
namespace world {
-// Because C++ doesn't allow us to iterate over an enum,
+// Because C++ doesn't allow us to iterate over an enum,
// (or get the size of an enum, or get the name of an enum, etc) biomes defined
-// in the chunk::biome enum class have to be readded here. Alternatively we
+// in the chunk::biome enum class have to be readded here. Alternatively we
// could use some compiler hack library.
constexpr std::array<enum shared::world::chunk::biome, 7> biome_enums{
shared::world::chunk::biome::alpine, shared::world::chunk::biome::tundra,
@@ -13,25 +13,71 @@ constexpr std::array<enum shared::world::chunk::biome, 7> biome_enums{
shared::world::chunk::biome::ocean, shared::world::chunk::biome::islands,
shared::world::chunk::biome::desert};
-constexpr long get_biome_index(const enum shared::world::chunk::biome biome) noexcept {
+static unsigned long get_3d_index(const glm::ivec3& v) noexcept {
+#ifndef NDEBUG
+ if (chunk::is_outside_chunk(v)) {
+ throw std::range_error("bad chunk block coordinate access");
+ }
+#endif
+ return static_cast<unsigned long>(
+ v.x + (chunk::WIDTH * (v.y + (chunk::HEIGHT * v.z))));
+}
+
+constexpr long
+get_biome_index(const enum shared::world::chunk::biome biome) noexcept {
return std::distance(std::begin(biome_enums),
std::ranges::find(biome_enums, biome));
}
-chunk::block_array
-chunk::make_blocks_from_chunk(const proto::chunk& chunk) noexcept {
- chunk::block_array blocks;
+block& chunk::get_block(const glm::ivec3& v) noexcept {
+ return (*this->blocks)[get_3d_index(v)];
+}
- for (int i = 0; i < chunk.blocks_size(); ++i) {
- const std::uint32_t packed_blocks = chunk.blocks(i);
- for (int j = 0; j < 4; ++j) {
- blocks[static_cast<unsigned>(i * 4 + j)] =
- static_cast<enum block::type>(
- static_cast<std::uint8_t>(packed_blocks >> j * 8));
- }
+const block& chunk::get_block(const glm::ivec3& v) const noexcept {
+ return (*this->blocks)[get_3d_index(v)];
+}
+
+const char* chunk::get_biome(const int x, const int z) const noexcept {
+ const auto biome = (*this->biomes)[(unsigned long)x][(unsigned long)z];
+ switch (biome) {
+ case chunk::biome::desert:
+ return "desert";
+ case chunk::biome::islands:
+ return "islands";
+ case chunk::biome::forest:
+ return "forest";
+ case chunk::biome::plains:
+ return "plains";
+ case chunk::biome::ocean:
+ return "ocean";
+ case chunk::biome::tundra:
+ return "tundra";
+ case chunk::biome::alpine:
+ return "alpine";
}
+}
- return blocks;
+bool chunk::is_outside_chunk(const glm::ivec3& v) noexcept {
+ return (std::min(v.x, v.z) < 0) || (std::max(v.x, v.z) >= WIDTH) ||
+ (std::clamp(v.y, 0, HEIGHT - 1) != v.y);
+}
+
+shared::math::coords
+chunk::get_normalised_chunk(const shared::math::coords& coords, const int x,
+ const int z) noexcept {
+ return coords +
+ shared::math::coords{(x >= WIDTH) - (x < 0), (z >= WIDTH) - (z < 0)};
+}
+
+std::pair<unsigned short, unsigned short>
+chunk::get_normalised_coords(const int x, const int z) noexcept {
+ return {x + WIDTH * ((x < 0) - (x >= WIDTH)),
+ z + WIDTH * ((z < 0) - (z >= WIDTH))};
+}
+
+glm::ivec3 chunk::get_normalised_coords(const glm::ivec3& c) noexcept {
+ const auto [x, z] = get_normalised_coords(c.x, c.z);
+ return {x, c.y, z};
}
// Returns a deterministic random number based on the args.
@@ -153,113 +199,142 @@ static chunk_array make_2d_perlin_array(const std::uint64_t& seed,
return perlin;
}
+static auto array_map_access(const auto& array_map,
+ const shared::math::coords& coords) noexcept {
+ return array_map.find(coords)->second;
+}
+
+static auto array_map_access(const auto& array_map,
+ const shared::math::coords& coords, const int x,
+ const int z) noexcept {
+ const shared::math::coords normalised_coords =
+ chunk::get_normalised_chunk(coords, x, z);
+ const auto [nx, nz] = chunk::get_normalised_coords(x, z);
+ return array_map_access(array_map, normalised_coords)[nx][nz];
+}
+
+// We take a std::function that generates a chunk array to fill an unordered
+// map with a 3x3 chunk_array contents, where those contents refer to the
+// values in the surrounding chunks.
+template <typename T>
+static auto make_array_map(const std::uint64_t& seed,
+ const shared::math::coords& coords,
+ const T& make_chunk_array_func) noexcept {
+
+ std::unordered_map<shared::math::coords,
+ decltype(make_chunk_array_func(seed, coords)),
+ decltype(&chunk::hash), decltype(&chunk::equal)>
+ array_map{9, chunk::hash, chunk::equal};
+ for (int x = -1; x <= 1; ++x) {
+ for (int z = -1; z <= 1; ++z) {
+ const shared::math::coords pos{coords + shared::math::coords{x, z}};
+ array_map.emplace(pos, make_chunk_array_func(seed, pos));
+ }
+ }
+
+ return array_map;
+}
+
+// START VORONOI NOISE GENERATION FUNCTIONS
+// biome_*'s are used in the generation of voronoi noise which becomes the basis
+// of our biome definitions.
using biome_array = std::array<
std::array<std::array<float, std::size(biome_enums)>, chunk::WIDTH>,
chunk::WIDTH>;
using biome_array_map =
std::unordered_map<shared::math::coords, biome_array,
decltype(&chunk::hash), decltype(&chunk::equal)>;
-// A 2d_biome_array is a 2d array containing a [0.0f-1.0f] value, tied to a
-// biome, representing the weight the biomes have on each column in the world.
-// Naturally each column should take that % of each biome's ruleset during
-// worldgen, resuling in an amount of rules that adds up to 100%.
-
-// Unfortunately this is a bit of a hell function because it is full of very
-// specific operations that can't be reasonably separated without decreasing
-// random number generation complexity or exposing a ton of random static
-// functions that will never be used outside of this.
-// Basically I am trying to minimise this bad code.
-static biome_array make_2d_biome_array(const std::uint64_t& seed,
- const shared::math::coords& coords,
- const int scale) noexcept {
+// Decreasing NUM_POINTS to the smallest meaningful value of 1 while
+// simultaneously decreasing our scale results in FAR lower computational
+// cost while achieving approximately the same result. This is because we
+// only have to generate 9 random numbers, as opposed to n * 9, which is a
+// performance KILLER. There is no reason to move this > 1.
+constexpr int NUM_BIOME_POINTS = 1;
+struct biome_point {
+ glm::vec2 pos;
+ enum chunk::biome biome;
+};
- // Decreasing NUM_POINTS to the smallest meaningful value of 1 while
- // simultaneously decreasing our scale results in FAR lower computational
- // cost while achieving approximately the same result. This is because we
- // only have to generate 9 random numbers, as opposed to n * 9, which is a
- // performance KILLER.
- constexpr int NUM_POINTS = 1;
-
- struct point {
- glm::vec2 pos;
- enum chunk::biome biome;
- };
- using point_array = std::array<struct point, NUM_POINTS>;
- const auto make_points =
- [&seed](const shared::math::coords& c) -> point_array {
- constexpr int BITS_PER_FLOAT = 48 / 2; // ranlux 48 / 2
- constexpr int MASK = ((2 << BITS_PER_FLOAT) - 1);
- static_assert(BITS_PER_FLOAT * 2 * NUM_POINTS <= 48);
-
- const unsigned long prand = make_prandom(seed, c);
- std::uniform_int_distribution<> uniform{0, std::size(biome_enums) - 1};
- std::ranlux48 generator{prand};
-
- point_array points;
- std::ranges::generate(points, [&, n = 0]() mutable -> point {
- const int x = (prand >> ((n + 1) * BITS_PER_FLOAT)) & MASK;
- const int y = (prand >> ((n)*BITS_PER_FLOAT)) & MASK;
- const glm::vec2 pos = glm::vec2{x, y} / static_cast<float>(MASK);
- const auto biome = static_cast<chunk::biome>(uniform(generator));
- ++n;
- return {pos, biome};
- });
- return points;
- };
+using biome_point_array = std::array<struct biome_point, NUM_BIOME_POINTS>;
+static biome_point_array
+make_biome_point_array(const std::uint64_t& seed,
+ const shared::math::coords& coords) noexcept {
+
+ constexpr int BITS_PER_FLOAT = 48 / 2; // ranlux 48 / 2
+ constexpr int MASK = ((2 << BITS_PER_FLOAT) - 1);
+ static_assert(BITS_PER_FLOAT * 2 * NUM_BIOME_POINTS <= 48);
+
+ const unsigned long prand = make_prandom(seed, coords);
+ std::uniform_int_distribution<> uniform{0, std::size(biome_enums) - 1};
+ std::ranlux48 generator{prand};
+
+ biome_point_array points;
+ std::ranges::generate(points, [&, n = 0]() mutable -> biome_point {
+ const int x = (prand >> ((n + 1) * BITS_PER_FLOAT)) & MASK;
+ const int y = (prand >> ((n)*BITS_PER_FLOAT)) & MASK;
+ const glm::vec2 pos = glm::vec2{x, y} / static_cast<float>(MASK);
+ const auto biome = static_cast<chunk::biome>(uniform(generator));
+ ++n;
+ return {pos, biome};
+ });
+ return points;
+}
+
+// result of calling make_array_map with make_biome_point_array
+using biome_point_map = decltype(make_array_map(0u, shared::math::coords{0, 0},
+ make_biome_point_array));
+
+struct biome_point_info {
+ struct biome_point point;
+ glm::vec2 pos;
+ shared::math::coords coords;
+ float distance;
+};
+using biome_point_info_vector = std::vector<biome_point_info>;
- const shared::math::coords scaled_coords{reflect_outer(coords.x, scale),
- reflect_outer(coords.z, scale)};
+static biome_point_info_vector
+make_biome_point_info_vector(const biome_point_map& point_map,
+ const glm::vec2& pos,
+ const shared::math::coords& coords) noexcept {
- using point_2d_array = std::array<std::array<point_array, 3>, 3>;
- const point_2d_array point_arrays = [&]() -> point_2d_array {
- point_2d_array point_arrays;
- for (int x = -1; x <= 1; ++x) {
- for (int z = -1; z <= 1; ++z) {
- const auto offset_coords =
- scaled_coords + shared::math::coords{x, z};
- const auto index_x = static_cast<unsigned long>(x + 1);
- const auto index_z = static_cast<unsigned long>(z + 1);
- point_arrays[index_x][index_z] = make_points(offset_coords);
- }
- }
- return point_arrays;
- }();
+ biome_point_info_vector point_infos{};
+ for (int x = -1; x <= 1; ++x) {
+ for (int z = -1; z <= 1; ++z) {
+ const glm::vec2 offset = {x, z};
+ const biome_point_array& point_array = array_map_access(
+ point_map, coords + shared::math::coords{x, z});
- struct point_info {
- struct point point;
- glm::vec2 pos;
- shared::math::coords coords;
- float distance;
- };
- using point_info_vector = std::vector<point_info>;
- const auto get_closest_point_infos =
- [&](const glm::vec2 pos) -> point_info_vector {
- std::vector<point_info> point_infos;
- for (int x = -1; x <= 1; ++x) {
- for (int z = -1; z <= 1; ++z) {
- const glm::vec2 offset = {x, z};
- const point_array& point_array =
- point_arrays[static_cast<unsigned long>(x + 1)]
- [static_cast<unsigned long>(z + 1)];
-
- for (const auto& point : point_array) {
-
- const float distance =
- glm::distance(point.pos + offset, pos);
- if (distance > 1.0f) {
- continue;
- }
+ for (const auto& point : point_array) {
- point_infos.push_back(point_info{
- .point = point,
- .pos = point.pos,
- .coords = shared::math::coords{x, z} + scaled_coords,
- .distance = distance});
+ const float distance = glm::distance(point.pos + offset, pos);
+ if (distance > 1.0f) {
+ continue;
}
+
+ point_infos.push_back(biome_point_info{
+ .point = point,
+ .pos = point.pos,
+ .coords = shared::math::coords{x, z} + coords,
+ .distance = distance});
}
}
- return point_infos;
- };
+ }
+
+ return point_infos;
+}
+
+using biome_point_info_vector_array =
+ std::array<std::array<biome_point_info_vector, chunk::WIDTH>, chunk::WIDTH>;
+
+static biome_array make_2d_biome_array(const std::uint64_t& seed,
+ const shared::math::coords& coords,
+ const int scale) noexcept {
+
+ const shared::math::coords scaled_coords{reflect_outer(coords.x, scale),
+ reflect_outer(coords.z, scale)};
+
+ const auto point_2d_map =
+ make_array_map(seed, scaled_coords, make_biome_point_array);
const int x_offset = reflect_inner(coords.x, scale) * chunk::WIDTH;
const int z_offset = reflect_inner(coords.z, scale) * chunk::WIDTH;
@@ -285,18 +360,21 @@ static biome_array make_2d_biome_array(const std::uint64_t& seed,
for (auto z = 0u; z < chunk::WIDTH; ++z) {
const unsigned sz = z + static_cast<unsigned>(z_offset);
- const glm::vec2 inner_pos =
- glm::vec2{static_cast<float>(sx) + 0.5f,
- static_cast<float>(sz) + 0.5f} /
- static_cast<float>(scaled_width) +
- glm::vec2{std::sin(jitter[x][z]), std::cos(jitter[x][z])} *
- 0.1f;
+ // clang-format off
+ const glm::vec2 inner_pos =
+ (glm::vec2{static_cast<float>(sx) + 0.5f,
+ static_cast<float>(sz) + 0.5f}
+ / static_cast<float>(scaled_width)) +
+ (glm::vec2{std::sin(jitter[x][z]), std::cos(jitter[x][z])} * 0.1f);
+ // clang-format on
- const auto point_infos = get_closest_point_infos(inner_pos);
+ const auto point_infos = make_biome_point_info_vector(
+ point_2d_map, inner_pos, scaled_coords);
float total_dominance = 0.0f;
for (const auto& point_info : point_infos) {
const auto index = get_biome_index(point_info.point.biome);
+
const float dominance = std::clamp(
-1.0f * std::pow(0.5f * point_info.distance - 1.0f, 21.0f),
0.0f, 1.0f);
@@ -317,36 +395,7 @@ static biome_array make_2d_biome_array(const std::uint64_t& seed,
}
return array;
}
-
-static auto array_map_access(const auto& array_map,
- const shared::math::coords& coords, const int x,
- const int z) noexcept {
- const shared::math::coords normalised_coords =
- chunk::get_normalised_chunk(coords, x, z);
- const auto [nx, nz] = chunk::get_normalised_coords(x, z);
- return array_map.find(normalised_coords)->second[nx][nz];
-}
-
-// We take a std::function that generates a chunk array to fill an unordered
-// map with a 3x3 chunk_array contents, where those contents refer to the
-// values in the surrounding chunks.
-static auto make_array_map(const std::uint64_t& seed,
- const shared::math::coords& coords,
- const auto& make_chunk_array_func) noexcept {
-
- std::unordered_map<shared::math::coords,
- decltype(make_chunk_array_func(seed, coords)),
- decltype(&chunk::hash), decltype(&chunk::equal)>
- array_map{9, chunk::hash, chunk::equal};
- for (int x = -1; x <= 1; ++x) {
- for (int z = -1; z <= 1; ++z) {
- const shared::math::coords pos{coords + shared::math::coords{x, z}};
- array_map.emplace(pos, make_chunk_array_func(seed, pos));
- }
- }
-
- return array_map;
-}
+// END VORONOI NOISE GENERATION FUNCTIONS
// These are constexpr for our static assert.
static constexpr float
@@ -526,52 +575,52 @@ constexpr int DIRT_DEPTH = 7;
// Rulesets common to all chunks go here. Water inhabits all blocks below 63
// and above the topography value. In addition, stone fills all blocks after
// the initial biome blocks.
-static void generate_post_terrain_column(chunk::block_array& blocks,
+static void generate_post_terrain_column(chunk::block_array_t& blocks,
const glm::ivec3& pos,
const int lowest) noexcept {
for (int y = lowest; y > WATER_HEIGHT; --y) {
- blocks[chunk::get_3d_index({pos.x, y, pos.z})] = block::type::sand;
+ blocks[get_3d_index({pos.x, y, pos.z})] = block::type::sand;
}
for (int y = WATER_HEIGHT; y > pos.y; --y) {
- blocks[chunk::get_3d_index({pos.x, y, pos.z})] = block::type::water;
+ blocks[get_3d_index({pos.x, y, pos.z})] = block::type::water;
}
for (int y = lowest; y >= 0; --y) {
- blocks[chunk::get_3d_index({pos.x, y, pos.z})] = block::type::stone;
+ blocks[get_3d_index({pos.x, y, pos.z})] = block::type::stone;
}
}
-static int generate_sandy_terrain_column(chunk::block_array& blocks,
+static int generate_sandy_terrain_column(chunk::block_array_t& blocks,
const glm::ivec3& pos) noexcept {
int y = pos.y;
for (const int lowest = y - SAND_DEPTH; y > lowest; --y) {
- blocks[chunk::get_3d_index({pos.x, y, pos.z})] = block::type::sand;
+ blocks[get_3d_index({pos.x, y, pos.z})] = block::type::sand;
}
for (const int lowest = y - SANDSTONE_DEPTH; y > lowest; --y) {
- blocks[chunk::get_3d_index({pos.x, y, pos.z})] = block::type::sandstone;
+ blocks[get_3d_index({pos.x, y, pos.z})] = block::type::sandstone;
}
return y;
}
-static int generate_grassy_terrain_column(chunk::block_array& blocks,
+static int generate_grassy_terrain_column(chunk::block_array_t& blocks,
const glm::ivec3& pos,
const enum block::type top) noexcept {
int y = pos.y;
if (y <= SAND_HEIGHT) {
for (const int lowest = y - SAND_DEPTH; y > lowest; --y) {
- blocks[chunk::get_3d_index({pos.x, y, pos.z})] = block::type::sand;
+ blocks[get_3d_index({pos.x, y, pos.z})] = block::type::sand;
}
} else {
for (const int lowest = y - GRASS_DEPTH; y > lowest; --y) {
- blocks[chunk::get_3d_index({pos.x, y, pos.z})] = top;
+ blocks[get_3d_index({pos.x, y, pos.z})] = top;
}
for (const int lowest = y - DIRT_DEPTH; y > lowest; --y) {
- blocks[chunk::get_3d_index({pos.x, y, pos.z})] = block::type::dirt;
+ blocks[get_3d_index({pos.x, y, pos.z})] = block::type::dirt;
}
}
return y;
}
-static void generate_terrain_column(chunk::block_array& blocks,
+static void generate_terrain_column(chunk::block_array_t& blocks,
const glm::ivec3& pos,
const enum chunk::biome biome) noexcept {
const int lowest = [&]() {
@@ -604,7 +653,7 @@ static enum chunk::biome get_dominant_biome(const auto& array) noexcept {
std::distance(std::begin(array), max_it))];
}
-static void generate_terrain(chunk::block_array& blocks,
+static void generate_terrain(chunk::block_array_t& blocks,
const shared::math::coords& coords,
const chunk_array_map& topography_map,
const biome_array_map& biome_map) noexcept {
@@ -822,7 +871,7 @@ static int get_block_priority(const enum block::type& b) noexcept {
return 2;
}
-static void generate_object(const object& object, chunk::block_array& blocks,
+static void generate_object(const object& object, chunk::block_array_t& blocks,
const glm::ivec3& pos) noexcept {
for (unsigned y = 0; y < std::size(object); ++y) {
@@ -842,7 +891,7 @@ static void generate_object(const object& object, chunk::block_array& blocks,
continue;
}
- const auto index = chunk::get_3d_index(block_pos);
+ const auto index = get_3d_index(block_pos);
const class block old_block = blocks[index];
if (get_block_priority(block) < get_block_priority(old_block)) {
@@ -855,7 +904,7 @@ static void generate_object(const object& object, chunk::block_array& blocks,
}
}
-static void generate_objects(chunk::block_array& blocks,
+static void generate_objects(chunk::block_array_t& blocks,
const shared::math::coords& coords,
const chunk_array_map& topography_map,
const biome_array_map& biome_map,
@@ -889,10 +938,20 @@ static void generate_objects(chunk::block_array& blocks,
}
}
-static chunk::block_array
-generate_blocks(const std::uint64_t& seed,
- const shared::math::coords& coords) noexcept {
+static chunk::biomes_t make_biome_array(const biome_array& array) noexcept {
+ auto ret = std::make_unique<chunk::biome_array_t>();
+ for (unsigned long x = 0; x < chunk::WIDTH; ++x) {
+ for (unsigned long z = 0; z < chunk::WIDTH; ++z) {
+ (*ret)[x][z] = get_dominant_biome(array[x][z]);
+ }
+ }
+ return ret;
+}
+// Use perlin noise and extrapolation of eigen vectors along a mobius strip.
+chunk::chunk(const std::uint64_t& seed,
+ const shared::math::coords& coords) noexcept
+ : pos(coords) {
const biome_array_map biome_arrays =
make_array_map(seed, coords, make_biomes);
// Topography relies on block temperature so we bind it as a hidden
@@ -905,27 +964,55 @@ generate_blocks(const std::uint64_t& seed,
const chunk_array_map probability_map =
make_array_map(seed, coords, make_probabilities);
- chunk::block_array blocks = {};
+ chunk::blocks_t ret = std::make_unique<chunk::block_array_t>();
- // Must be called in order, generate_objects relies on generate terrain etc.
- generate_terrain(blocks, coords, topography_arrays, biome_arrays);
- generate_objects(blocks, coords, topography_arrays, biome_arrays,
+ generate_terrain(*ret, coords, topography_arrays, biome_arrays);
+ generate_objects(*ret, coords, topography_arrays, biome_arrays,
probability_map);
// generate caves
// generate better terrain generation
- return blocks;
+
+ this->blocks = std::move(ret);
+ this->biomes = make_biome_array(biome_arrays.find(coords)->second);
}
-// Use perlin noise and extrapolation of eigen vectors along a mobius strip.
-chunk::chunk(const std::uint64_t& seed, const shared::math::coords& coords,
- std::optional<decltype(chunk::blocks)> blocks) noexcept
- : pos(coords) {
- if (blocks.has_value()) {
- this->blocks = std::move(blocks.value());
- return;
+chunk::chunk(const std::uint64_t& seed, const proto::chunk& proto) noexcept
+ : pos(shared::net::get_coords(proto.chunk_pos())) {
+
+ blocks_t ret = std::make_unique<chunk::block_array_t>();
+
+ for (int i = 0; i < proto.blocks_size(); ++i) {
+ const std::uint32_t packed_blocks = proto.blocks(i);
+ for (int j = 0; j < 4; ++j) {
+ (*ret)[static_cast<unsigned>(i * 4 + j)] =
+ static_cast<enum block::type>(
+ static_cast<std::uint8_t>(packed_blocks >> j * 8));
+ }
}
- this->blocks = generate_blocks(seed, coords);
+ // Our protobuf constructor doesn't call any of the worldgen stuff, but
+ // needs to gen the biomes locally to populate this->biomes.
+ this->blocks = std::move(ret);
+ this->biomes = make_biome_array(make_biomes(seed, this->pos));
+}
+
+void chunk::pack(proto::chunk* const proto) const noexcept {
+ shared::net::set_coords(proto->mutable_chunk_pos(), this->pos);
+
+ // Since protobuf can store at minimum uint32, we mash four of our
+ // uint_8 chunk blocks into a single uint32.
+ static_assert(shared::world::chunk::VOLUME % 4 == 0);
+ for (unsigned i = 0u; i < shared::world::chunk::VOLUME / 4u; ++i) {
+ std::uint32_t packed_blocks = 0u;
+
+ for (unsigned j = 0; j < 4; ++j) {
+ const auto block =
+ static_cast<std::uint8_t>((*this->blocks)[i * 4 + j].type);
+ packed_blocks |= static_cast<unsigned>(block << j * 8);
+ }
+
+ proto->add_blocks(packed_blocks);
+ }
}
} // namespace world
diff --git a/src/shared/world/chunk.hh b/src/shared/world/chunk.hh
new file mode 100644
index 0000000..8e724a3
--- /dev/null
+++ b/src/shared/world/chunk.hh
@@ -0,0 +1,89 @@
+#ifndef SHARED_WORLD_CHUNK_HH_
+#define SHARED_WORLD_CHUNK_HH_
+
+#include <algorithm>
+#include <array>
+#include <exception>
+#include <functional>
+#include <istream>
+#include <memory>
+#include <random>
+#include <type_traits>
+#include <vector>
+
+#include <boost/functional/hash.hpp>
+#include <glm/glm.hpp>
+
+#include "shared/math/math.hh"
+#include "shared/net/proto.hh"
+#include "shared/shared.hh"
+#include "shared/world/block.hh"
+
+namespace shared {
+namespace world {
+
+class chunk {
+public:
+ static constexpr int WIDTH = 16;
+ static constexpr int HEIGHT = 256;
+ static constexpr int VOLUME = WIDTH * WIDTH * HEIGHT;
+
+ // Stuff for unordered_map.
+ static std::size_t hash(const shared::math::coords& c) noexcept {
+ std::size_t seed = 0;
+ boost::hash_combine(seed, boost::hash_value(c.x));
+ boost::hash_combine(seed, boost::hash_value(c.z));
+ return seed;
+ }
+ static std::size_t equal(const shared::math::coords& a,
+ const shared::math::coords& b) noexcept {
+ return a == b;
+ }
+ enum class biome { desert, islands, ocean, plains, forest, tundra, alpine };
+
+ using block_array_t = std::array<block, VOLUME>;
+ using blocks_t = std::unique_ptr<block_array_t>;
+ using biome_array_t = std::array<std::array<enum biome, WIDTH>, WIDTH>;
+ using biomes_t = std::unique_ptr<biome_array_t>;
+
+protected:
+ shared::math::coords pos;
+ blocks_t blocks; // Use get_block for 3d index access.
+
+ // Simple 2d array of enums where each column maps to the dominant biome
+ // at that x, z location. Call get_biome_str for string.
+ biomes_t biomes;
+
+public:
+ static bool is_outside_chunk(const glm::ivec3& v) noexcept;
+
+ static shared::math::coords
+ get_normalised_chunk(const shared::math::coords& coords, const int x,
+ const int z) noexcept;
+
+ static std::pair<unsigned short, unsigned short>
+ get_normalised_coords(const int x, const int z) noexcept;
+
+ static glm::ivec3 get_normalised_coords(const glm::ivec3& c) noexcept;
+
+public:
+ chunk(const std::uint64_t& seed,
+ const shared::math::coords& coords) noexcept;
+ chunk(const std::uint64_t& seed, const proto::chunk& chunk) noexcept;
+ virtual ~chunk() noexcept {};
+
+protected:
+ void pack(proto::chunk* const proto) const noexcept;
+
+public:
+ block& get_block(const glm::ivec3& v) noexcept;
+ const block& get_block(const glm::ivec3& v) const noexcept;
+ const shared::math::coords& get_pos() const noexcept { return this->pos; }
+
+ const char* get_biome(const int x, const int z) const noexcept;
+};
+
+} // namespace world
+} // namespace shared
+
+#endif