summaryrefslogtreecommitdiffstats
path: root/src/OpaqueWorld.h
blob: d0d4e7fd067c4736dbbe614fa09c0a56c1d0b84f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
}