diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-08-18 18:18:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-18 18:18:25 +0200 |
commit | c42753338924bb29c61081c9f269772f89bcd808 (patch) | |
tree | 3ccbf49ad802c57a1288ea978268315b68d8e65f /src/mapsector.cpp | |
parent | fb196be8cf8606cfab144e2fe62d9c9d1f50932f (diff) | |
download | minetest-c42753338924bb29c61081c9f269772f89bcd808.tar.gz minetest-c42753338924bb29c61081c9f269772f89bcd808.tar.bz2 minetest-c42753338924bb29c61081c9f269772f89bcd808.zip |
Modernize various files (src/m*) (#6267)
* Modernize various files (src/m*)
* range-based for loops
* code style
* C++ headers instead of C headers
* Default operators
* empty function
Thanks to clang-tidy
Diffstat (limited to 'src/mapsector.cpp')
-rw-r--r-- | src/mapsector.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/mapsector.cpp b/src/mapsector.cpp index 446b43747..c6832a012 100644 --- a/src/mapsector.cpp +++ b/src/mapsector.cpp @@ -40,9 +40,8 @@ void MapSector::deleteBlocks() m_block_cache = nullptr; // Delete all - for (std::unordered_map<s16, MapBlock*>::iterator i = m_blocks.begin(); - i != m_blocks.end(); ++i) { - delete i->second; + for (auto &block : m_blocks) { + delete block.second; } // Clear container @@ -125,9 +124,8 @@ void MapSector::deleteBlock(MapBlock *block) void MapSector::getBlocks(MapBlockVect &dest) { - for (std::unordered_map<s16, MapBlock*>::iterator bi = m_blocks.begin(); - bi != m_blocks.end(); ++bi) { - dest.push_back(bi->second); + for (auto &block : m_blocks) { + dest.push_back(block.second); } } @@ -140,10 +138,6 @@ ServerMapSector::ServerMapSector(Map *parent, v2s16 pos, IGameDef *gamedef): { } -ServerMapSector::~ServerMapSector() -{ -} - void ServerMapSector::serialize(std::ostream &os, u8 version) { if(!ser_ver_supported(version)) @@ -212,11 +206,9 @@ ServerMapSector* ServerMapSector::deSerialize( assert(sector->getId() == MAPSECTOR_SERVER); return (ServerMapSector*)sector; } - else - { - sector = new ServerMapSector(parent, p2d, gamedef); - sectors[p2d] = sector; - } + + sector = new ServerMapSector(parent, p2d, gamedef); + sectors[p2d] = sector; /* Set stuff in sector @@ -236,11 +228,6 @@ ClientMapSector::ClientMapSector(Map *parent, v2s16 pos, IGameDef *gamedef): MapSector(parent, pos, gamedef) { } - -ClientMapSector::~ClientMapSector() -{ -} - #endif // !SERVER //END |