diff options
Diffstat (limited to 'src/database-dummy.cpp')
-rw-r--r-- | src/database-dummy.cpp | 50 |
1 files changed, 12 insertions, 38 deletions
diff --git a/src/database-dummy.cpp b/src/database-dummy.cpp index 5b1a14341..71f60d81c 100644 --- a/src/database-dummy.cpp +++ b/src/database-dummy.cpp @@ -18,64 +18,38 @@ with this program; if not, write to the Free Software Foundation, Inc., */ /* -Dummy "database" class +Dummy database class */ - #include "database-dummy.h" -#include "map.h" -#include "mapsector.h" -#include "mapblock.h" -#include "serialization.h" -#include "main.h" -#include "settings.h" -#include "log.h" - -Database_Dummy::Database_Dummy(ServerMap *map) -{ - srvmap = map; -} - -int Database_Dummy::Initialized(void) -{ - return 1; -} - -void Database_Dummy::beginSave() {} -void Database_Dummy::endSave() {} -bool Database_Dummy::saveBlock(v3s16 blockpos, std::string &data) +bool Database_Dummy::saveBlock(const v3s16 &pos, const std::string &data) { - m_database[getBlockAsInteger(blockpos)] = data; + m_database[getBlockAsInteger(pos)] = data; return true; } -std::string Database_Dummy::loadBlock(v3s16 blockpos) +std::string Database_Dummy::loadBlock(const v3s16 &pos) { - if (m_database.count(getBlockAsInteger(blockpos))) - return m_database[getBlockAsInteger(blockpos)]; + s64 i = getBlockAsInteger(pos); + if (m_database.count(i)) + return m_database[i]; else return ""; } -bool Database_Dummy::deleteBlock(v3s16 blockpos) +bool Database_Dummy::deleteBlock(const v3s16 &pos) { - m_database.erase(getBlockAsInteger(blockpos)); + m_database.erase(getBlockAsInteger(pos)); return true; } void Database_Dummy::listAllLoadableBlocks(std::vector<v3s16> &dst) { - for(std::map<u64, std::string>::iterator x = m_database.begin(); x != m_database.end(); ++x) - { - v3s16 p = getIntegerAsBlock(x->first); - //dstream<<"block_i="<<block_i<<" p="<<PP(p)<<std::endl; - dst.push_back(p); + for (std::map<s64, std::string>::const_iterator x = m_database.begin(); + x != m_database.end(); ++x) { + dst.push_back(getIntegerAsBlock(x->first)); } } -Database_Dummy::~Database_Dummy() -{ - m_database.clear(); -} |