Fix a crash or random memory leak when reseting saved environment variable in test_se...
[oweals/minetest.git] / src / server.h
index c189860a580d7043c6e578452f30940d7af2e561..b0f65980d670ae69e747db2299395dfb5a09a3a2 100644 (file)
@@ -59,7 +59,9 @@ class EmergeManager;
 class ServerScripting;
 class ServerEnvironment;
 struct SimpleSoundSpec;
+struct CloudParams;
 class ServerThread;
+class ServerModManager;
 
 enum ClientDeletionReason {
        CDR_LEAVE,
@@ -267,7 +269,7 @@ public:
        NodeDefManager* getWritableNodeDefManager();
        IWritableCraftDefManager* getWritableCraftDefManager();
 
-       virtual const std::vector<ModSpec> &getMods() const { return m_mods; }
+       virtual const std::vector<ModSpec> &getMods() const;
        virtual const ModSpec* getModSpec(const std::string &modname) const;
        void getModNames(std::vector<std::string> &modlist);
        std::string getBuiltinLuaPath();
@@ -291,25 +293,18 @@ public:
        bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask);
        bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount);
        void hudSetHotbarImage(RemotePlayer *player, std::string name);
-       std::string hudGetHotbarImage(RemotePlayer *player);
        void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name);
-       const std::string &hudGetHotbarSelectedImage(RemotePlayer *player) const;
 
        Address getPeerAddress(session_t peer_id);
 
-       bool setLocalPlayerAnimations(RemotePlayer *player, v2s32 animation_frames[4],
+       void setLocalPlayerAnimations(RemotePlayer *player, v2s32 animation_frames[4],
                        f32 frame_speed);
-       bool setPlayerEyeOffset(RemotePlayer *player, v3f first, v3f third);
+       void setPlayerEyeOffset(RemotePlayer *player, const v3f &first, const v3f &third);
 
-       bool setSky(RemotePlayer *player, const video::SColor &bgcolor,
+       void setSky(RemotePlayer *player, const video::SColor &bgcolor,
                        const std::string &type, const std::vector<std::string> &params,
                        bool &clouds);
-       bool setClouds(RemotePlayer *player, float density,
-                       const video::SColor &color_bright,
-                       const video::SColor &color_ambient,
-                       float height,
-                       float thickness,
-                       const v2f &speed);
+       void setClouds(RemotePlayer *player, const CloudParams &params);
 
        bool overrideDayNightRatio(RemotePlayer *player, bool do_override, float brightness);
 
@@ -391,12 +386,7 @@ private:
        void SendSetSky(session_t peer_id, const video::SColor &bgcolor,
                        const std::string &type, const std::vector<std::string> &params,
                        bool &clouds);
-       void SendCloudParams(session_t peer_id, float density,
-                       const video::SColor &color_bright,
-                       const video::SColor &color_ambient,
-                       float height,
-                       float thickness,
-                       const v2f &speed);
+       void SendCloudParams(session_t peer_id, const CloudParams &params);
        void SendOverrideDayNightRatio(session_t peer_id, bool do_override, float ratio);
        void broadcastModChannelMessage(const std::string &channel,
                        const std::string &message, session_t from_peer);
@@ -412,7 +402,6 @@ private:
        void sendAddNode(v3s16 p, MapNode n, u16 ignore_id=0,
                        std::vector<u16> *far_players=NULL, float far_d_nodes=100,
                        bool remove_metadata=true);
-       void setBlockNotSent(v3s16 p);
 
        // Environment and Connection must be locked when called
        void SendBlockNoLock(session_t peer_id, MapBlock *block, u8 ver, u16 net_proto_version);
@@ -531,7 +520,6 @@ private:
 
        // Rollback manager (behind m_env_mutex)
        IRollbackManager *m_rollback = nullptr;
-       bool m_enable_rollback_recording = false; // Updated once in a while
 
        // Emerge manager
        EmergeManager *m_emerge = nullptr;
@@ -553,7 +541,7 @@ private:
        EventManager *m_event;
 
        // Mods
-       std::vector<ModSpec> m_mods;
+       std::unique_ptr<ServerModManager> m_modmgr;
 
        /*
                Threads
@@ -631,12 +619,6 @@ private:
                This is behind m_env_mutex
        */
        VoxelArea m_ignore_map_edit_events_area;
-       /*
-               If set to !=0, the incoming MapEditEvents are modified to have
-               this peed id as the disabled recipient
-               This is behind m_env_mutex
-       */
-       session_t m_ignore_map_edit_events_peer_id = 0;
 
        // media files known to server
        std::unordered_map<std::string, MediaInfo> m_media;