X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=src%2Fclient%2Fclient.h;h=44a0de719d7ae68b729cb1694db57bbe3edeb36d;hb=75e6cc190a9b1cc1c3aae059502801365c3a412b;hp=c1a38ba48f65facbfdf6809d994a9f659b949f21;hpb=bbfae0cc673d3abdc21224c53e09b209ee4688a2;p=minetest.git diff --git a/src/client/client.h b/src/client/client.h index c1a38ba48..44a0de719 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -37,7 +37,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mesh_generator_thread.h" #include "network/address.h" #include "network/peerhandler.h" +#include "gameparams.h" #include +#include "util/numeric.h" #define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f @@ -127,7 +129,8 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef MtEventManager *event, RenderingEngine *rendering_engine, bool ipv6, - GameUI *game_ui + GameUI *game_ui, + ELoginRegister allow_login_or_register ); ~Client(); @@ -227,6 +230,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void handleCommand_PlayerSpeed(NetworkPacket *pkt); void handleCommand_MediaPush(NetworkPacket *pkt); void handleCommand_MinimapModes(NetworkPacket *pkt); + void handleCommand_SetLighting(NetworkPacket *pkt); void ProcessData(NetworkPacket *pkt); @@ -310,7 +314,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false); void updateCameraOffset(v3s16 camera_offset) - { m_mesh_update_thread.m_camera_offset = camera_offset; } + { m_mesh_update_manager.m_camera_offset = camera_offset; } bool hasClientEvents() const { return !m_client_event_queue.empty(); } // Get event from queue. If queue is empty, it triggers an assertion failure. @@ -325,25 +329,27 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef m_access_denied = true; m_access_denied_reason = reason; } + inline void setFatalError(const LuaError &e) + { + setFatalError(std::string("Lua: ") + e.what()); + } // Renaming accessDeniedReason to better name could be good as it's used to // disconnect client when CSM failed. const std::string &accessDeniedReason() const { return m_access_denied_reason; } - const bool itemdefReceived() const + bool itemdefReceived() const { return m_itemdef_received; } - const bool nodedefReceived() const + bool nodedefReceived() const { return m_nodedef_received; } - const bool mediaReceived() const + bool mediaReceived() const { return !m_media_downloader; } - const bool activeObjectsReceived() const + bool activeObjectsReceived() const { return m_activeobjects_received; } u16 getProtoVersion() { return m_proto_ver; } - void confirmRegistration(); - bool m_is_registration_confirmation_state = false; bool m_simple_singleplayer_mode; float mediaReceiveProgress(); @@ -376,10 +382,10 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef { return checkPrivilege(priv); } virtual scene::IAnimatedMesh* getMesh(const std::string &filename, bool cache = false); const std::string* getModFile(std::string filename); + ModStorageDatabase *getModStorageDatabase() override { return m_mod_storage_database; } - std::string getModStoragePath() const override; - bool registerModStorage(ModMetadata *meta) override; - void unregisterModStorage(const std::string &name) override; + // Migrates away old files-based mod storage if necessary + void migrateModStorage(); // The following set of functions is used by ClientMediaDownloader // Insert a media file appropriately into the appropriate manager @@ -399,7 +405,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef } ClientScripting *getScript() { return m_script; } - const bool modsLoaded() const { return m_mods_loaded; } + bool modsLoaded() const { return m_mods_loaded; } void pushToEventQueue(ClientEvent *event); @@ -432,6 +438,11 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef { return m_env.getLocalPlayer()->formspec_prepend; } + inline MeshGrid getMeshGrid() + { + return m_mesh_grid; + } + private: void loadMods(); @@ -452,7 +463,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef static AuthMechanism choseAuthMech(const u32 mechs); void sendInit(const std::string &playerName); - void promptConfirmRegistration(AuthMechanism chosen_auth_mechanism); void startAuth(AuthMechanism chosen_auth_mechanism); void sendDeletedBlocks(std::vector &blocks); void sendGotBlocks(const std::vector &blocks); @@ -479,11 +489,12 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef RenderingEngine *m_rendering_engine; - MeshUpdateThread m_mesh_update_thread; + MeshUpdateManager m_mesh_update_manager; ClientEnvironment m_env; ParticleManager m_particle_manager; std::unique_ptr m_con; std::string m_address_name; + ELoginRegister m_allow_login_or_register = ELoginRegister::Any; Camera *m_camera = nullptr; Minimap *m_minimap = nullptr; bool m_minimap_disabled_by_server = false; @@ -541,10 +552,8 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef std::vector m_remote_media_servers; // Media downloader, only exists during init ClientMediaDownloader *m_media_downloader; - // Set of media filenames pushed by server at runtime - std::unordered_set m_media_pushed_files; // Pending downloads of dynamic media (key: token) - std::vector>> m_pending_media_downloads; + std::vector>> m_pending_media_downloads; // time_of_day speed approximation for old protocol bool m_time_of_day_set = false; @@ -585,7 +594,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef // Client modding ClientScripting *m_script = nullptr; - std::unordered_map m_mod_storages; + ModStorageDatabase *m_mod_storage_database = nullptr; float m_mod_storage_save_timer = 10.0f; std::vector m_mods; StringMap m_mod_vfs; @@ -597,4 +606,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef u32 m_csm_restriction_noderange = 8; std::unique_ptr m_modchannel_mgr; + + // The number of blocks the client will combine for mesh generation. + MeshGrid m_mesh_grid; };