mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 18:13:46 +01:00
Record player existence in dymmy database.
This commit is contained in:
parent
9ec75d7765
commit
49117de476
@ -22,6 +22,7 @@ Dummy database class
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "database-dummy.h"
|
#include "database-dummy.h"
|
||||||
|
#include "remoteplayer.h"
|
||||||
|
|
||||||
|
|
||||||
bool Database_Dummy::saveBlock(const v3s16 &pos, const std::string &data)
|
bool Database_Dummy::saveBlock(const v3s16 &pos, const std::string &data)
|
||||||
@ -57,3 +58,25 @@ void Database_Dummy::listAllLoadableBlocks(std::vector<v3s16> &dst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Database_Dummy::savePlayer(RemotePlayer *player)
|
||||||
|
{
|
||||||
|
m_player_database.insert(player->getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Database_Dummy::loadPlayer(RemotePlayer *player, PlayerSAO *sao)
|
||||||
|
{
|
||||||
|
return m_player_database.find(player->getName()) != m_player_database.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Database_Dummy::removePlayer(const std::string &name)
|
||||||
|
{
|
||||||
|
m_player_database.erase(name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Database_Dummy::listPlayers(std::vector<std::string> &res)
|
||||||
|
{
|
||||||
|
for (const auto &player : m_player_database) {
|
||||||
|
res.emplace_back(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -32,14 +32,15 @@ public:
|
|||||||
bool deleteBlock(const v3s16 &pos);
|
bool deleteBlock(const v3s16 &pos);
|
||||||
void listAllLoadableBlocks(std::vector<v3s16> &dst);
|
void listAllLoadableBlocks(std::vector<v3s16> &dst);
|
||||||
|
|
||||||
void savePlayer(RemotePlayer *player) {}
|
void savePlayer(RemotePlayer *player);
|
||||||
bool loadPlayer(RemotePlayer *player, PlayerSAO *sao) { return true; }
|
bool loadPlayer(RemotePlayer *player, PlayerSAO *sao);
|
||||||
bool removePlayer(const std::string &name) { return true; }
|
bool removePlayer(const std::string &name);
|
||||||
void listPlayers(std::vector<std::string> &res) {}
|
void listPlayers(std::vector<std::string> &res);
|
||||||
|
|
||||||
void beginSave() {}
|
void beginSave() {}
|
||||||
void endSave() {}
|
void endSave() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<s64, std::string> m_database;
|
std::map<s64, std::string> m_database;
|
||||||
|
std::set<std::string> m_player_database;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user