summaryrefslogtreecommitdiff
path: root/src/database.h
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-11-16 15:31:57 -0500
committerShadowNinja <shadowninja@minetest.net>2015-03-06 00:20:45 -0500
commit708337dfc2b3871dc6de983e781e4a4a60a1881d (patch)
tree97352d676d9d76b036d8b559ae4d3c6fe83bbf12 /src/database.h
parentc7454d4732dee0f7364ccb8e07002df1a037b94d (diff)
downloadminetest-708337dfc2b3871dc6de983e781e4a4a60a1881d.tar.gz
minetest-708337dfc2b3871dc6de983e781e4a4a60a1881d.tar.bz2
minetest-708337dfc2b3871dc6de983e781e4a4a60a1881d.zip
Clean up database API and save the local map on an interval
Diffstat (limited to 'src/database.h')
-rw-r--r--src/database.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/database.h b/src/database.h
index f4a2a4e8c..cee7b6fd9 100644
--- a/src/database.h
+++ b/src/database.h
@@ -32,16 +32,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class Database
{
public:
- virtual void beginSave() = 0;
- virtual void endSave() = 0;
-
- virtual bool saveBlock(v3s16 blockpos, std::string &data) = 0;
- virtual std::string loadBlock(v3s16 blockpos) = 0;
- virtual bool deleteBlock(v3s16 blockpos) = 0;
- s64 getBlockAsInteger(const v3s16 pos) const;
- v3s16 getIntegerAsBlock(s64 i) const;
+ virtual ~Database() {}
+
+ virtual void beginSave() {}
+ virtual void endSave() {}
+
+ virtual bool saveBlock(const v3s16 &pos, const std::string &data) = 0;
+ virtual std::string loadBlock(const v3s16 &pos) = 0;
+ virtual bool deleteBlock(const v3s16 &pos) = 0;
+
+ static s64 getBlockAsInteger(const v3s16 &pos);
+ static v3s16 getIntegerAsBlock(s64 i);
+
virtual void listAllLoadableBlocks(std::vector<v3s16> &dst) = 0;
- virtual int Initialized(void)=0;
- virtual ~Database() {};
+
+ virtual bool initialized() const { return true; }
};
+
#endif
+