]> git.lizzy.rs Git - minetest.git/blobdiff - src/remoteplayer.h
Fix various player save issues (performance penalty on sql backends + bugs)
[minetest.git] / src / remoteplayer.h
index 32c78b5acdb619e65f7ae67864ae1be350161bc5..212741df8de16aad5e2b5ae711fbc21a6268a845 100644 (file)
@@ -41,7 +41,7 @@ class RemotePlayer : public Player
 
 public:
        RemotePlayer(const char *name, IItemDefManager *idef);
-       virtual ~RemotePlayer() {}
+       virtual ~RemotePlayer() = default;
 
        void deSerialize(std::istream &is, const std::string &playername, PlayerSAO *sao);
 
@@ -71,7 +71,7 @@ class RemotePlayer : public Player
 
        void setHotbarImage(const std::string &name) { hud_hotbar_image = name; }
 
-       std::string getHotbarImage() const { return hud_hotbar_image; }
+       const std::string &getHotbarImage() const { return hud_hotbar_image; }
 
        void setHotbarSelectedImage(const std::string &name)
        {
@@ -135,6 +135,12 @@ class RemotePlayer : public Player
 
        u16 protocol_version = 0;
 
+       session_t getPeerId() const { return m_peer_id; }
+
+       void setPeerId(session_t peer_id) { m_peer_id = peer_id; }
+
+       void on_successful_save();
+
 private:
        /*
                serialize() writes a bunch of text that can contain
@@ -155,7 +161,7 @@ class RemotePlayer : public Player
        float m_chat_message_allowance = 5.0f;
        u16 m_message_rate_overhead = 0;
 
-       bool m_day_night_ratio_do_override;
+       bool m_day_night_ratio_do_override = false;
        float m_day_night_ratio;
        std::string hud_hotbar_image = "";
        std::string hud_hotbar_selected_image = "";
@@ -166,4 +172,6 @@ class RemotePlayer : public Player
        bool m_sky_clouds;
 
        CloudParams m_cloud_params;
+
+       session_t m_peer_id = PEER_ID_INEXISTENT;
 };