summaryrefslogtreecommitdiffstats
path: root/src/OpaqueWorld.h
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-07-24 23:30:49 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2018-07-24 23:30:49 +0200
commitc94d7184ebaf7e8540f717c70c1e03ae62e5a7bd (patch)
tree3a373f8ea6f06dc9b117d2d103bfaee5705040b8 /src/OpaqueWorld.h
parentStop cFunctionRef constructor from disabling default copy constructor. (#4173) (diff)
downloadcuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar
cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.gz
cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.bz2
cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.lz
cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.xz
cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.tar.zst
cuberite-c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd.zip
Diffstat (limited to '')
-rw-r--r--src/OpaqueWorld.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/OpaqueWorld.h b/src/OpaqueWorld.h
new file mode 100644
index 000000000..d0d4e7fd0
--- /dev/null
+++ b/src/OpaqueWorld.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+// fwd:
+class cBroadcastInterface;
+class cChunkInterface;
+class cForEachChunkProvider;
+class cWorld;
+class cWorldInterface;
+
+/** Utilities to allow casting a cWorld to one of its interfaces without including World.h. */
+namespace World
+{
+ // Defined in World.cpp
+ cBroadcastInterface * GetBroadcastInterface(cWorld * a_World);
+ cForEachChunkProvider * GetFECProvider (cWorld * a_World);
+ cWorldInterface * GetWorldInterface (cWorld * a_World);
+
+ inline cBroadcastInterface & GetBroadcastInterface(cWorld & a_World) { return *GetBroadcastInterface(&a_World); }
+ inline cForEachChunkProvider & GetFECProvider (cWorld & a_World) { return *GetFECProvider(&a_World); }
+ inline cWorldInterface & GetWorldInterface (cWorld & a_World) { return *GetWorldInterface(&a_World); }
+
+ // cChunkInterface is more like a pimpl for cChunkMap than an interface so it needs to be returned by value
+ cChunkInterface GetChunkInterface(cWorld & a_World);
+}