]> git.lizzy.rs Git - minetest.git/blobdiff - src/database-leveldb.cpp
Refactor Game class (part 2) (#5422)
[minetest.git] / src / database-leveldb.cpp
index acd0fd1eb7dd3d13edfd4e6b7f845d97f1fbc7b8..4a4904c6a0b122f58a5ee217577236b22cf767fb 100644 (file)
@@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #define ENSURE_STATUS_OK(s) \
        if (!(s).ok()) { \
-               throw FileNotGoodException(std::string("LevelDB error: ") + \
+               throw DatabaseException(std::string("LevelDB error: ") + \
                                (s).ToString()); \
        }
 
@@ -65,16 +65,13 @@ bool Database_LevelDB::saveBlock(const v3s16 &pos, const std::string &data)
        return true;
 }
 
-std::string Database_LevelDB::loadBlock(const v3s16 &pos)
+void Database_LevelDB::loadBlock(const v3s16 &pos, std::string *block)
 {
        std::string datastr;
        leveldb::Status status = m_database->Get(leveldb::ReadOptions(),
                i64tos(getBlockAsInteger(pos)), &datastr);
 
-       if(status.ok())
-               return datastr;
-       else
-               return "";
+       *block = (status.ok()) ? datastr : "";
 }
 
 bool Database_LevelDB::deleteBlock(const v3s16 &pos)