X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fdatabase.h;h=cee7b6fd96d5589869ee2a5a9aa322193521923b;hb=d4938554818aa71aceb0d360f33c6cfd42f67008;hp=a8686137949ba251a1a8075c55e9f6819305f93a;hpb=54ffe2e5de9ce44129f84f4748743f893b75fda7;p=minetest.git diff --git a/src/database.h b/src/database.h index a86861379..cee7b6fd9 100644 --- a/src/database.h +++ b/src/database.h @@ -20,24 +20,34 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef DATABASE_HEADER #define DATABASE_HEADER -#include +#include +#include #include "irr_v3d.h" #include "irrlichttypes.h" -class MapBlock; +#ifndef PP + #define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")" +#endif class Database { public: - virtual void beginSave()=0; - virtual void endSave()=0; - - virtual void saveBlock(MapBlock *block)=0; - virtual MapBlock* loadBlock(v3s16 blockpos)=0; - s64 getBlockAsInteger(const v3s16 pos) const; - v3s16 getIntegerAsBlock(const s64 i) const; - virtual void listAllLoadableBlocks(std::list &dst)=0; - virtual int Initialized(void)=0; - virtual ~Database() {}; + 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 &dst) = 0; + + virtual bool initialized() const { return true; } }; + #endif +