3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef GAMEDEF_HEADER
21 #define GAMEDEF_HEADER
24 #include "irrlichttypes.h"
26 class IItemDefManager;
27 class INodeDefManager;
28 class ICraftDefManager;
33 class IRollbackManager;
37 namespace irr { namespace scene {
43 An interface for fetching game-global definitions like tool and
50 // These are thread-safe IF they are not edited while running threads.
51 // Thus, first they are set up and then they are only read.
52 virtual IItemDefManager* getItemDefManager()=0;
53 virtual INodeDefManager* getNodeDefManager()=0;
54 virtual ICraftDefManager* getCraftDefManager()=0;
56 // This is always thread-safe, but referencing the irrlicht texture
57 // pointers in other threads than main thread will make things explode.
58 virtual ITextureSource* getTextureSource()=0;
60 virtual IShaderSource* getShaderSource()=0;
62 // Used for keeping track of names/ids of unknown nodes
63 virtual u16 allocateUnknownNodeId(const std::string &name)=0;
65 // Only usable on the client
66 virtual ISoundManager* getSoundManager()=0;
67 virtual MtEventManager* getEventManager()=0;
68 virtual scene::IAnimatedMesh* getMesh(const std::string &filename)
70 virtual scene::ISceneManager* getSceneManager()=0;
72 virtual Camera* getCamera()
74 virtual void setCamera(Camera *camera) {}
76 // Only usable on the server, and NOT thread-safe. It is usable from the
77 // environment thread.
78 virtual IRollbackManager* getRollbackManager(){return NULL;}
80 // Only usable on the server. Thread safe if not written while running threads.
81 virtual EmergeManager *getEmergeManager() { return NULL; }
84 virtual bool checkLocalPrivilege(const std::string &priv)
88 IItemDefManager *idef() { return getItemDefManager(); }
89 INodeDefManager *ndef() { return getNodeDefManager(); }
90 ICraftDefManager *cdef() { return getCraftDefManager(); }
91 ITextureSource *tsrc() { return getTextureSource(); }
92 ISoundManager *sound() { return getSoundManager(); }
93 IShaderSource *shsrc() { return getShaderSource(); }
94 MtEventManager *event() { return getEventManager(); }
95 IRollbackManager *rollback() { return getRollbackManager();}
96 EmergeManager *emerge() { return getEmergeManager(); }