mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 08:08:47 -05:00
Use STL containers instead of irr::core::list
This commit is contained in:
parent
1cc1c56234
commit
f1e4a671dc
@ -139,7 +139,7 @@ MapBlock* Database_Dummy::loadBlock(v3s16 blockpos)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database_Dummy::listAllLoadableBlocks(core::list<v3s16> &dst)
|
void Database_Dummy::listAllLoadableBlocks(std::list<v3s16> &dst)
|
||||||
{
|
{
|
||||||
for(std::map<unsigned long long, std::string>::iterator x = m_database.begin(); x != m_database.end(); ++x)
|
for(std::map<unsigned long long, std::string>::iterator x = m_database.begin(); x != m_database.end(); ++x)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
virtual void endSave();
|
virtual void endSave();
|
||||||
virtual void saveBlock(MapBlock *block);
|
virtual void saveBlock(MapBlock *block);
|
||||||
virtual MapBlock* loadBlock(v3s16 blockpos);
|
virtual MapBlock* loadBlock(v3s16 blockpos);
|
||||||
virtual void listAllLoadableBlocks(core::list<v3s16> &dst);
|
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
|
||||||
virtual int Initialized(void);
|
virtual int Initialized(void);
|
||||||
~Database_Dummy();
|
~Database_Dummy();
|
||||||
private:
|
private:
|
||||||
|
@ -146,7 +146,7 @@ MapBlock* Database_LevelDB::loadBlock(v3s16 blockpos)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database_LevelDB::listAllLoadableBlocks(core::list<v3s16> &dst)
|
void Database_LevelDB::listAllLoadableBlocks(std::list<v3s16> &dst)
|
||||||
{
|
{
|
||||||
leveldb::Iterator* it = m_database->NewIterator(leveldb::ReadOptions());
|
leveldb::Iterator* it = m_database->NewIterator(leveldb::ReadOptions());
|
||||||
for (it->SeekToFirst(); it->Valid(); it->Next()) {
|
for (it->SeekToFirst(); it->Valid(); it->Next()) {
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
virtual void endSave();
|
virtual void endSave();
|
||||||
virtual void saveBlock(MapBlock *block);
|
virtual void saveBlock(MapBlock *block);
|
||||||
virtual MapBlock* loadBlock(v3s16 blockpos);
|
virtual MapBlock* loadBlock(v3s16 blockpos);
|
||||||
virtual void listAllLoadableBlocks(core::list<v3s16> &dst);
|
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
|
||||||
virtual int Initialized(void);
|
virtual int Initialized(void);
|
||||||
~Database_LevelDB();
|
~Database_LevelDB();
|
||||||
private:
|
private:
|
||||||
|
@ -294,7 +294,7 @@ void Database_SQLite3::createDatabase()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database_SQLite3::listAllLoadableBlocks(core::list<v3s16> &dst)
|
void Database_SQLite3::listAllLoadableBlocks(std::list<v3s16> &dst)
|
||||||
{
|
{
|
||||||
verifyDatabase();
|
verifyDatabase();
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
|
|
||||||
virtual void saveBlock(MapBlock *block);
|
virtual void saveBlock(MapBlock *block);
|
||||||
virtual MapBlock* loadBlock(v3s16 blockpos);
|
virtual MapBlock* loadBlock(v3s16 blockpos);
|
||||||
virtual void listAllLoadableBlocks(core::list<v3s16> &dst);
|
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
|
||||||
virtual int Initialized(void);
|
virtual int Initialized(void);
|
||||||
~Database_SQLite3();
|
~Database_SQLite3();
|
||||||
private:
|
private:
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "filesys.h"
|
#include "filesys.h"
|
||||||
#include "serialization.h"
|
#include "serialization.h"
|
||||||
#include <irrList.h>
|
#include <list>
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class ServerMap;
|
class ServerMap;
|
||||||
@ -23,7 +23,7 @@ public:
|
|||||||
virtual MapBlock* loadBlock(v3s16 blockpos)=0;
|
virtual MapBlock* loadBlock(v3s16 blockpos)=0;
|
||||||
long long getBlockAsInteger(const v3s16 pos);
|
long long getBlockAsInteger(const v3s16 pos);
|
||||||
v3s16 getIntegerAsBlock(long long i);
|
v3s16 getIntegerAsBlock(long long i);
|
||||||
virtual void listAllLoadableBlocks(core::list<v3s16> &dst)=0;
|
virtual void listAllLoadableBlocks(std::list<v3s16> &dst)=0;
|
||||||
virtual int Initialized(void)=0;
|
virtual int Initialized(void)=0;
|
||||||
virtual ~Database() {};
|
virtual ~Database() {};
|
||||||
};
|
};
|
||||||
|
@ -3371,10 +3371,7 @@ void ServerMap::listAllLoadableBlocks(std::list<v3s16> &dst)
|
|||||||
errorstream<<"Map::listAllLoadableBlocks(): Result will be missing "
|
errorstream<<"Map::listAllLoadableBlocks(): Result will be missing "
|
||||||
<<"all blocks that are stored in flat files"<<std::endl;
|
<<"all blocks that are stored in flat files"<<std::endl;
|
||||||
}
|
}
|
||||||
core::list<v3s16> dst_;
|
dbase->listAllLoadableBlocks(dst);
|
||||||
dbase->listAllLoadableBlocks(dst_);
|
|
||||||
for(core::list<v3s16>::Iterator i = dst_.begin(); i != dst_.end(); ++i)
|
|
||||||
dst.push_back(*i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerMap::listAllLoadedBlocks(std::list<v3s16> &dst)
|
void ServerMap::listAllLoadedBlocks(std::list<v3s16> &dst)
|
||||||
|
Loading…
Reference in New Issue
Block a user