3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4 Copyright (C) 2022 TurkeyMcMac, Jude Melton-Houghton <jwmhjwmh@gmail.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "content/mods.h"
28 #include "database/database-dummy.h"
30 class DummyGameDef : public IGameDef {
33 m_itemdef(createItemDefManager()),
34 m_nodedef(createNodeDefManager()),
35 m_craftdef(createCraftDefManager()),
36 m_mod_storage_database(new Database_Dummy())
42 delete m_mod_storage_database;
48 IItemDefManager *getItemDefManager() override { return m_itemdef; }
49 const NodeDefManager *getNodeDefManager() override { return m_nodedef; }
50 NodeDefManager* getWritableNodeDefManager() { return m_nodedef; }
51 ICraftDefManager *getCraftDefManager() override { return m_craftdef; }
53 u16 allocateUnknownNodeId(const std::string &name) override
55 return m_nodedef->allocateDummy(name);
58 const std::vector<ModSpec> &getMods() const override
60 static std::vector<ModSpec> emptymodspec;
63 const ModSpec* getModSpec(const std::string &modname) const override { return nullptr; }
64 ModStorageDatabase *getModStorageDatabase() override { return m_mod_storage_database; }
66 bool joinModChannel(const std::string &channel) override { return false; }
67 bool leaveModChannel(const std::string &channel) override { return false; }
68 bool sendModChannelMessage(const std::string &channel, const std::string &message) override
72 ModChannel *getModChannel(const std::string &channel) override { return nullptr; }
75 IItemDefManager *m_itemdef = nullptr;
76 NodeDefManager *m_nodedef = nullptr;
77 ICraftDefManager *m_craftdef = nullptr;
78 ModStorageDatabase *m_mod_storage_database = nullptr;