]> git.lizzy.rs Git - dragonfireclient.git/blob - src/gamedef.h
Make Lint Happy
[dragonfireclient.git] / src / gamedef.h
1 /*
2 Minetest
3 Copyright (C) 2013 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 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.
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 Lesser General Public License for more details.
14
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.
18 */
19
20 #pragma once
21
22 #include <string>
23 #include <vector>
24 #include "irrlichttypes.h"
25
26 class IItemDefManager;
27 class IWritableItemDefManager;
28 class NodeDefManager;
29 class ICraftDefManager;
30 class ITextureSource;
31 class IShaderSource;
32 class IRollbackManager;
33 class EmergeManager;
34 class Camera;
35 class ModChannel;
36 class ModMetadata;
37
38 namespace irr
39 {
40 namespace scene
41 {
42 class IAnimatedMesh;
43 class ISceneManager;
44 }
45 }
46
47 struct ModSpec;
48 /*
49         An interface for fetching game-global definitions like tool and
50         mapnode properties
51 */
52
53 class IGameDef
54 {
55 public:
56         // These are thread-safe IF they are not edited while running threads.
57         // Thus, first they are set up and then they are only read.
58         virtual IItemDefManager *getItemDefManager() = 0;
59         virtual IWritableItemDefManager *getWritableItemDefManager() = 0;
60         virtual const NodeDefManager *getNodeDefManager() = 0;
61         virtual NodeDefManager *getWritableNodeDefManager() = 0;
62         virtual ICraftDefManager *getCraftDefManager() = 0;
63
64         // Used for keeping track of names/ids of unknown nodes
65         virtual u16 allocateUnknownNodeId(const std::string &name) = 0;
66
67         // Only usable on the server, and NOT thread-safe. It is usable from the
68         // environment thread.
69         virtual IRollbackManager *getRollbackManager() { return NULL; }
70
71         // Shorthands
72         IItemDefManager *idef() { return getItemDefManager(); }
73         const NodeDefManager *ndef() { return getNodeDefManager(); }
74         ICraftDefManager *cdef() { return getCraftDefManager(); }
75         IRollbackManager *rollback() { return getRollbackManager(); }
76
77         virtual const std::vector<ModSpec> &getMods() const = 0;
78         virtual const ModSpec *getModSpec(const std::string &modname) const = 0;
79         virtual std::string getWorldPath() const { return ""; }
80         virtual std::string getModStoragePath() const = 0;
81         virtual bool registerModStorage(ModMetadata *storage) = 0;
82         virtual void unregisterModStorage(const std::string &name) = 0;
83
84         virtual bool joinModChannel(const std::string &channel) = 0;
85         virtual bool leaveModChannel(const std::string &channel) = 0;
86         virtual bool sendModChannelMessage(
87                         const std::string &channel, const std::string &message) = 0;
88         virtual ModChannel *getModChannel(const std::string &channel) = 0;
89 };