Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use STL containers instead of irr::core::list
  • Loading branch information
sfan5 committed Sep 9, 2013
1 parent 1cc1c56 commit f1e4a67
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/database-dummy.cpp
Expand Up @@ -139,7 +139,7 @@ MapBlock* Database_Dummy::loadBlock(v3s16 blockpos)
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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/database-dummy.h
Expand Up @@ -16,7 +16,7 @@ class Database_Dummy : public Database
virtual void endSave();
virtual void saveBlock(MapBlock *block);
virtual MapBlock* loadBlock(v3s16 blockpos);
virtual void listAllLoadableBlocks(core::list<v3s16> &dst);
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
virtual int Initialized(void);
~Database_Dummy();
private:
Expand Down
2 changes: 1 addition & 1 deletion src/database-leveldb.cpp
Expand Up @@ -146,7 +146,7 @@ MapBlock* Database_LevelDB::loadBlock(v3s16 blockpos)
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());
for (it->SeekToFirst(); it->Valid(); it->Next()) {
Expand Down
2 changes: 1 addition & 1 deletion src/database-leveldb.h
Expand Up @@ -21,7 +21,7 @@ class Database_LevelDB : public Database
virtual void endSave();
virtual void saveBlock(MapBlock *block);
virtual MapBlock* loadBlock(v3s16 blockpos);
virtual void listAllLoadableBlocks(core::list<v3s16> &dst);
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
virtual int Initialized(void);
~Database_LevelDB();
private:
Expand Down
2 changes: 1 addition & 1 deletion src/database-sqlite3.cpp
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/database-sqlite3.h
Expand Up @@ -22,7 +22,7 @@ class Database_SQLite3 : public Database

virtual void saveBlock(MapBlock *block);
virtual MapBlock* loadBlock(v3s16 blockpos);
virtual void listAllLoadableBlocks(core::list<v3s16> &dst);
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
virtual int Initialized(void);
~Database_SQLite3();
private:
Expand Down
4 changes: 2 additions & 2 deletions src/database.h
Expand Up @@ -8,7 +8,7 @@
#include "main.h"
#include "filesys.h"
#include "serialization.h"
#include <irrList.h>
#include <list>

class Database;
class ServerMap;
Expand All @@ -23,7 +23,7 @@ class Database
virtual MapBlock* loadBlock(v3s16 blockpos)=0;
long long getBlockAsInteger(const v3s16 pos);
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 ~Database() {};
};
Expand Down
5 changes: 1 addition & 4 deletions src/map.cpp
Expand Up @@ -3371,10 +3371,7 @@ void ServerMap::listAllLoadableBlocks(std::list<v3s16> &dst)
errorstream<<"Map::listAllLoadableBlocks(): Result will be missing "
<<"all blocks that are stored in flat files"<<std::endl;
}
core::list<v3s16> dst_;
dbase->listAllLoadableBlocks(dst_);
for(core::list<v3s16>::Iterator i = dst_.begin(); i != dst_.end(); ++i)
dst.push_back(*i);
dbase->listAllLoadableBlocks(dst);
}

void ServerMap::listAllLoadedBlocks(std::list<v3s16> &dst)
Expand Down

0 comments on commit f1e4a67

Please sign in to comment.