2024-10-28 15:57:39 +01:00
|
|
|
// Luanti
|
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
2013-09-10 15:49:43 +02:00
|
|
|
|
2017-08-17 22:19:39 +02:00
|
|
|
#pragma once
|
2012-10-23 01:18:44 +04:00
|
|
|
|
2013-09-10 15:49:43 +02:00
|
|
|
#include <map>
|
2024-02-17 15:35:33 +01:00
|
|
|
#include <set>
|
2013-09-10 15:49:43 +02:00
|
|
|
#include <string>
|
2014-03-12 19:37:19 -04:00
|
|
|
#include "database.h"
|
|
|
|
#include "irrlichttypes.h"
|
2013-09-10 15:49:43 +02:00
|
|
|
|
2022-11-23 17:25:34 -05:00
|
|
|
class Database_Dummy : public MapDatabase, public PlayerDatabase, public ModStorageDatabase
|
2012-10-23 01:18:44 +04:00
|
|
|
{
|
|
|
|
public:
|
2024-02-17 15:35:33 +01:00
|
|
|
bool saveBlock(const v3s16 &pos, std::string_view data);
|
2016-05-14 12:23:15 +02:00
|
|
|
void loadBlock(const v3s16 &pos, std::string *block);
|
|
|
|
bool deleteBlock(const v3s16 &pos);
|
|
|
|
void listAllLoadableBlocks(std::vector<v3s16> &dst);
|
2014-11-16 15:31:57 -05:00
|
|
|
|
2020-09-20 12:51:12 -07:00
|
|
|
void savePlayer(RemotePlayer *player);
|
|
|
|
bool loadPlayer(RemotePlayer *player, PlayerSAO *sao);
|
|
|
|
bool removePlayer(const std::string &name);
|
|
|
|
void listPlayers(std::vector<std::string> &res);
|
2017-04-23 14:35:08 +02:00
|
|
|
|
2022-11-23 17:46:20 -05:00
|
|
|
void getModEntries(const std::string &modname, StringMap *storage);
|
|
|
|
void getModKeys(const std::string &modname, std::vector<std::string> *storage);
|
2022-09-26 17:03:43 -04:00
|
|
|
bool getModEntry(const std::string &modname,
|
|
|
|
const std::string &key, std::string *value);
|
|
|
|
bool hasModEntry(const std::string &modname, const std::string &key);
|
2022-01-07 13:28:49 -05:00
|
|
|
bool setModEntry(const std::string &modname,
|
2024-02-17 15:35:33 +01:00
|
|
|
const std::string &key,std::string_view value);
|
2022-01-07 13:28:49 -05:00
|
|
|
bool removeModEntry(const std::string &modname, const std::string &key);
|
2022-09-26 17:03:43 -04:00
|
|
|
bool removeModEntries(const std::string &modname);
|
2022-01-07 13:28:49 -05:00
|
|
|
void listMods(std::vector<std::string> *res);
|
|
|
|
|
2017-04-23 14:35:08 +02:00
|
|
|
void beginSave() {}
|
|
|
|
void endSave() {}
|
2017-05-26 17:03:46 +02:00
|
|
|
|
2012-10-23 01:18:44 +04:00
|
|
|
private:
|
2014-11-16 15:31:57 -05:00
|
|
|
std::map<s64, std::string> m_database;
|
2020-09-20 12:51:12 -07:00
|
|
|
std::set<std::string> m_player_database;
|
2022-11-23 17:25:34 -05:00
|
|
|
std::unordered_map<std::string, StringMap> m_mod_storage_database;
|
2012-10-23 01:18:44 +04:00
|
|
|
};
|