refactor(gameplay): rename ClientPlayer to LocalPlayer

This commit is contained in:
2026-07-28 18:09:43 +08:00
parent 5e96c1573b
commit 0ff5820e6e
12 changed files with 72 additions and 72 deletions

View File

@@ -8,7 +8,7 @@
namespace Cubed {
class ClientPlayer;
class LocalPlayer;
class Camera {
private:
@@ -18,7 +18,7 @@ private:
THIRD_PERSON_FRONT,
};
ClientPlayer* m_player;
LocalPlayer* m_player;
float m_last_mouse_x, m_last_mouse_y;
glm::vec3 m_camera_pos;
bool m_under_water = false;
@@ -35,7 +35,7 @@ public:
void update_move_camera();
void camera_init(ClientPlayer* player);
void camera_init(LocalPlayer* player);
void hot_reload();
void update_cursor_position_camera(float offset_x, float offset_y);
@@ -47,7 +47,7 @@ public:
void change_perspective();
bool is_first_person() const;
bool handle_event(const Event& e);
ClientPlayer* player();
LocalPlayer* player();
};
} // namespace Cubed

View File

@@ -7,7 +7,7 @@
namespace Cubed {
class WorldScene;
class ClientPlayer;
class LocalPlayer;
class App;
class DevPanel {
struct ConfigView {
@@ -42,7 +42,7 @@ private:
WorldScene& m_world_scene;
Config& m_config;
ConfigView m_config_view;
ClientPlayer* m_player;
LocalPlayer* m_player;
PlayerProfile m_player_profile;
bool m_need_save_config = false;
bool m_gen_thread_running = true;

View File

@@ -5,8 +5,8 @@
#include "Cubed/gameplay/chat_message.hpp"
#include "Cubed/gameplay/chunk_pos.hpp"
#include "Cubed/gameplay/client_chunk.hpp"
#include "Cubed/gameplay/client_player.hpp"
#include "Cubed/gameplay/game_time.hpp"
#include "Cubed/gameplay/local_player.hpp"
#include "Cubed/gameplay/network_client.hpp"
#include "Cubed/gameplay/player_data.hpp"
#include "Cubed/gameplay/world.hpp"
@@ -37,8 +37,8 @@ public:
void update_players(float dt);
bool handle_event(const Event& e);
const std::optional<LookBlock>& get_look_block_pos() const;
ClientPlayer& get_player();
const ClientPlayer& get_player() const;
LocalPlayer& get_player();
const LocalPlayer& get_player() const;
int get_block(const glm::ivec3& block_pos) const override;
bool is_solid(const glm::ivec3& block_pos) const override;
bool can_pass_block(const glm::ivec3& block_pos) const override;
@@ -131,7 +131,7 @@ private:
static constexpr int WORLD_EXIT_TIMEOUT = 200;
static constexpr int MAX_UPLOAD_CHUNK_SUM = 16;
ClientPlayer m_player;
LocalPlayer m_player;
ChunkHashMap m_chunks;
AudioEngine& m_audio;
Config& m_config;

View File

@@ -17,14 +17,14 @@
namespace Cubed {
class ClientWorld;
class ClientPlayer : public Entity {
class LocalPlayer : public Entity {
public:
static constexpr size_t HOTBAR_SUM = 10;
static constexpr float WALK_SOUND_INTERVAL = 0.45f;
static constexpr float RUN_SOUND_INTERVAL = 0.3f;
using ChunkPosSet = absl::flat_hash_set<ChunkPos, ChunkPos::Hash>;
ClientPlayer(ClientWorld& world);
~ClientPlayer();
LocalPlayer(ClientWorld& world);
~LocalPlayer();
bool handle_mouse_button_event(const MouseButtonEvent& e);
bool handle_key_event(const KeyEvent& e);