]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/remoteplayer.h
lua-api: fix get/set_pitch
[dragonfireclient.git] / src / remoteplayer.h
index 6ecdb2798d932b21b31ff62219353b82658ebada..e4209c54f26d07b890d1061b5b0ad0665c9ad4c3 100644 (file)
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "player.h"
 #include "cloudparams.h"
+#include "skyparams.h"
 
 class PlayerSAO;
 
@@ -71,7 +72,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)
        {
@@ -83,23 +84,24 @@ class RemotePlayer : public Player
                return hud_hotbar_selected_image;
        }
 
-       void setSky(const video::SColor &bgcolor, const std::string &type,
-                       const std::vector<std::string> &params, bool &clouds)
+       void setSky(const SkyboxParams &skybox_params)
        {
-               m_sky_bgcolor = bgcolor;
-               m_sky_type = type;
-               m_sky_params = params;
-               m_sky_clouds = clouds;
+               m_skybox_params = skybox_params;
        }
 
-       void getSky(video::SColor *bgcolor, std::string *type,
-                       std::vector<std::string> *params, bool *clouds)
-       {
-               *bgcolor = m_sky_bgcolor;
-               *type = m_sky_type;
-               *params = m_sky_params;
-               *clouds = m_sky_clouds;
-       }
+       const SkyboxParams &getSkyParams() const { return m_skybox_params; }
+
+       void setSun(const SunParams &sun_params) { m_sun_params = sun_params; }
+
+       const SunParams &getSunParams() const { return m_sun_params; }
+
+       void setMoon(const MoonParams &moon_params) { m_moon_params = moon_params; }
+
+       const MoonParams &getMoonParams() const { return m_moon_params; }
+
+       void setStars(const StarParams &star_params) { m_star_params = star_params; }
+
+       const StarParams &getStarParams() const { return m_star_params; }
 
        void setCloudParams(const CloudParams &cloud_params)
        {
@@ -110,12 +112,7 @@ class RemotePlayer : public Player
 
        bool checkModified() const { return m_dirty || inventory.checkModified(); }
 
-       void setModified(const bool x)
-       {
-               m_dirty = x;
-               if (!x)
-                       inventory.setModified(x);
-       }
+       inline void setModified(const bool x) { m_dirty = x; }
 
        void setLocalAnimations(v2s32 frames[4], float frame_speed)
        {
@@ -135,10 +132,15 @@ class RemotePlayer : public Player
 
        u16 protocol_version = 0;
 
+       // v1 for clients older than 5.1.0-dev
+       u16 formspec_version = 1;
+
        session_t getPeerId() const { return m_peer_id; }
 
        void setPeerId(session_t peer_id) { m_peer_id = peer_id; }
 
+       void onSuccessfulSave();
+
 private:
        /*
                serialize() writes a bunch of text that can contain
@@ -164,12 +166,12 @@ class RemotePlayer : public Player
        std::string hud_hotbar_image = "";
        std::string hud_hotbar_selected_image = "";
 
-       std::string m_sky_type;
-       video::SColor m_sky_bgcolor;
-       std::vector<std::string> m_sky_params;
-       bool m_sky_clouds;
-
        CloudParams m_cloud_params;
 
+       SkyboxParams m_skybox_params;
+       SunParams m_sun_params;
+       MoonParams m_moon_params;
+       StarParams m_star_params;
+
        session_t m_peer_id = PEER_ID_INEXISTENT;
 };