summaryrefslogtreecommitdiff
path: root/src/environment.h
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2016-02-08 22:20:04 +0100
committerparamat <mat.gregory@virginmedia.com>2016-02-11 04:22:58 +0000
commitb1428ab4bb1e2cf73bc8ac951d41d22203ea68a0 (patch)
tree6cc3abacb6afef178ead78405277ae161e31c7dd /src/environment.h
parent47464c9344a1a4817ad6e4c6ec44526df305b1f6 (diff)
downloadminetest-b1428ab4bb1e2cf73bc8ac951d41d22203ea68a0.tar.gz
minetest-b1428ab4bb1e2cf73bc8ac951d41d22203ea68a0.tar.bz2
minetest-b1428ab4bb1e2cf73bc8ac951d41d22203ea68a0.zip
Add '/clearobjects quick'
Diffstat (limited to 'src/environment.h')
-rw-r--r--src/environment.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/environment.h b/src/environment.h
index 1aaa5091f..e7b818dc9 100644
--- a/src/environment.h
+++ b/src/environment.h
@@ -204,6 +204,18 @@ private:
};
/*
+ Operation mode for ServerEnvironment::clearObjects()
+*/
+enum ClearObjectsMode {
+ // Load and go through every mapblock, clearing objects
+ CLEAR_OBJECTS_MODE_FULL,
+
+ // Clear objects immediately in loaded mapblocks;
+ // clear objects in unloaded mapblocks only when the mapblocks are next activated.
+ CLEAR_OBJECTS_MODE_QUICK,
+};
+
+/*
The server-side environment.
This is not thread-safe. Server uses an environment mutex.
@@ -319,8 +331,8 @@ public:
// Find all active objects inside a radius around a point
void getObjectsInsideRadius(std::vector<u16> &objects, v3f pos, float radius);
- // Clear all objects, loading and going through every MapBlock
- void clearAllObjects();
+ // Clear objects, loading and going through every MapBlock
+ void clearObjects(ClearObjectsMode mode);
// This makes stuff happen
void step(f32 dtime);
@@ -410,6 +422,10 @@ private:
u32 m_game_time;
// A helper variable for incrementing the latter
float m_game_time_fraction_counter;
+ // Time of last clearObjects call (game time).
+ // When a mapblock older than this is loaded, its objects are cleared.
+ u32 m_last_clear_objects_time;
+ // Active block modifiers
std::vector<ABMWithState> m_abms;
// An interval for generally sending object positions and stuff
float m_recommended_send_interval;