]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/environment.h
Slightly improved version of mystrtok_r
[dragonfireclient.git] / src / environment.h
index 0e4b85e06ef286e8aaa7e83e6e1f229714599ea5..d1e61967fd2b10e813868289e2dfc986d5447805 100644 (file)
@@ -33,11 +33,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <set>
 #include "irrlichttypes_extrabloated.h"
 #include "player.h"
-#include "map.h"
 #include <ostream>
 #include "activeobject.h"
 #include "util/container.h"
 #include "util/numeric.h"
+#include "mapnode.h"
+#include "mapblock.h"
 
 class Server;
 class ServerEnvironment;
@@ -46,6 +47,8 @@ class ServerActiveObject;
 typedef struct lua_State lua_State;
 class ITextureSource;
 class IGameDef;
+class Map;
+class ServerMap;
 class ClientMap;
 
 class Environment
@@ -191,11 +194,9 @@ class ServerEnvironment : public Environment
                        IBackgroundBlockEmerger *emerger);
        ~ServerEnvironment();
 
-       Map & getMap()
-               { return *m_map; }
+       Map & getMap();
 
-       ServerMap & getServerMap()
-               { return *m_map; }
+       ServerMap & getServerMap();
 
        lua_State* getLua()
                { return m_lua; }
@@ -204,9 +205,7 @@ class ServerEnvironment : public Environment
                { return m_gamedef; }
 
        float getSendRecommendedInterval()
-       {
-               return 0.10;
-       }
+               { return m_recommended_send_interval; }
 
        /*
                Save players
@@ -242,8 +241,9 @@ class ServerEnvironment : public Environment
                MapBlock.
                Caller allocates memory, ServerEnvironment frees memory.
                Return value: true if succeeded, false if failed.
+               (note:  not used, pending removal from engine)
        */
-       bool addActiveObjectAsStatic(ServerActiveObject *object);
+       //bool addActiveObjectAsStatic(ServerActiveObject *object);
        
        /*
                Find out what new objects have been added to
@@ -284,6 +284,10 @@ class ServerEnvironment : public Environment
                Other stuff
                -------------------------------------------
        */
+
+       // Script-aware node setters
+       bool setNode(v3s16 p, const MapNode &n);
+       bool removeNode(v3s16 p);
        
        // Find all active objects inside a radius around a point
        std::set<u16> getObjectsInsideRadius(v3f pos, float radius);
@@ -311,7 +315,7 @@ class ServerEnvironment : public Environment
                Returns the id of the object.
                Returns 0 if not added and thus deleted.
        */
-       u16 addActiveObjectRaw(ServerActiveObject *object, bool set_changed);
+       u16 addActiveObjectRaw(ServerActiveObject *object, bool set_changed, u32 dtime_s);
        
        /*
                Remove all objects that satisfy (m_removed && m_known_by_count==0)
@@ -321,7 +325,7 @@ class ServerEnvironment : public Environment
        /*
                Convert stored objects from block to active
        */
-       void activateObjects(MapBlock *block);
+       void activateObjects(MapBlock *block, u32 dtime_s);
        
        /*
                Convert objects that are not in active blocks to static.
@@ -359,12 +363,15 @@ class ServerEnvironment : public Environment
        IntervalLimiter m_active_blocks_management_interval;
        IntervalLimiter m_active_block_modifier_interval;
        IntervalLimiter m_active_blocks_nodemetadata_interval;
+       int m_active_block_interval_overload_skip;
        // Time from the beginning of the game in seconds.
        // Incremented in step().
        u32 m_game_time;
        // A helper variable for incrementing the latter
        float m_game_time_fraction_counter;
        core::list<ABMWithState> m_abms;
+       // An interval for generally sending object positions and stuff
+       float m_recommended_send_interval;
 };
 
 #ifndef SERVER
@@ -461,6 +468,8 @@ class ClientEnvironment : public Environment
        
        // Get event from queue. CEE_NONE is returned if queue is empty.
        ClientEnvEvent getClientEvent();
+
+       std::vector<core::vector2d<int> > attachment_list; // X is child ID, Y is parent ID
        
 private:
        ClientMap *m_map;