]> git.lizzy.rs Git - dragonfireclient.git/blob - src/gamedef.h
79f5d188e304199269bda07c9bf7c0936e3ae708
[dragonfireclient.git] / src / gamedef.h
1 /*
2 Minetest-c55
3 Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
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 General Public License for more details.
14
15 You should have received a copy of the GNU 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.
18 */
19
20 #ifndef GAMEDEF_HEADER
21 #define GAMEDEF_HEADER
22
23 class IToolDefManager;
24 class INodeDefManager;
25 //class IItemDefManager; //TODO
26 // Mineral too?
27 class ITextureSource;
28
29 /*
30         An interface for fetching game-global definitions like tool and
31         mapnode properties
32 */
33
34 class IGameDef
35 {
36 public:
37         // These are thread-safe IF they are not edited while running threads.
38         // Thus, first they are set up and then they are only read.
39         virtual IToolDefManager* getToolDefManager()=0;
40         virtual INodeDefManager* getNodeDefManager()=0;
41         //virtual IItemDefManager* getItemDefManager()=0;
42
43         // This is always thread-safe, but referencing the irrlicht texture
44         // pointers in other threads than main thread will make things explode.
45         virtual ITextureSource* getTextureSource()=0;
46
47         // Shorthands
48         IToolDefManager* tdef(){return getToolDefManager();}
49         INodeDefManager* ndef(){return getNodeDefManager();}
50         ITextureSource* tsrc(){return getTextureSource();}
51 };
52
53 #endif
54