summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-05-31 00:15:43 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-05-31 00:15:43 +0300
commit223b3793485a76f87599d39364b1003c2ca7c49c (patch)
tree67b2dcc8603a01a32e33d3f0004e7cf4797df2c0 /src/main.cpp
parent16fdb42590dc14772fcf0cc95c6baf08e6f583cd (diff)
downloadminetest-223b3793485a76f87599d39364b1003c2ca7c49c.tar.gz
minetest-223b3793485a76f87599d39364b1003c2ca7c49c.tar.bz2
minetest-223b3793485a76f87599d39364b1003c2ca7c49c.zip
Reduced the CPU usage of the sent block selector algorithm
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3d342e596..a739d71bf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -215,6 +215,8 @@ FIXME: Server sometimes goes into some infinite PeerNotFoundException loop
FIXME: The new optimized map sending doesn't sometimes send enough blocks
from big caves and such
+* Take player's walking direction into account in GetNextBlocks
+
Environment:
------------
@@ -308,6 +310,10 @@ Making it more portable:
Stuff to do before release:
---------------------------
+Fixes to the current release:
+-----------------------------
+- Make AuthManager to save only when data has changed
+
Stuff to do after release:
---------------------------
- Make sure server handles removing grass when a block is placed (etc)
@@ -386,6 +392,9 @@ Settings g_settings;
// This is located in defaultsettings.cpp
extern void set_default_settings();
+// Global profiler
+Profiler g_profiler;
+
/*
Random stuff
*/
@@ -436,7 +445,14 @@ std::ostream *derr_client_ptr = &dstream;
class TimeGetter
{
public:
- TimeGetter(IrrlichtDevice *device):
+ virtual u32 getTime() = 0;
+};
+
+// A precise irrlicht one
+class IrrlichtTimeGetter: public TimeGetter
+{
+public:
+ IrrlichtTimeGetter(IrrlichtDevice *device):
m_device(device)
{}
u32 getTime()
@@ -448,8 +464,18 @@ public:
private:
IrrlichtDevice *m_device;
};
+// Not so precise one which works without irrlicht
+class SimpleTimeGetter: public TimeGetter
+{
+public:
+ u32 getTime()
+ {
+ return porting::getTimeMs();
+ }
+};
// A pointer to a global instance of the time getter
+// TODO: why?
TimeGetter *g_timegetter = NULL;
u32 getTimeMs()
@@ -1208,6 +1234,9 @@ int main(int argc, char *argv[])
{
DSTACK("Dedicated server branch");
+ // Create time getter
+ g_timegetter = new SimpleTimeGetter();
+
// Create server
Server server(map_dir.c_str());
server.start(port);
@@ -1290,7 +1319,7 @@ int main(int argc, char *argv[])
device = device;
// Create time getter
- g_timegetter = new TimeGetter(device);
+ g_timegetter = new IrrlichtTimeGetter(device);
// Create game callback for menus
g_gamecallback = new MainGameCallback(device);