1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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
This commit is contained in:
Loïc Blot 2017-08-18 18:18:25 +02:00 committed by GitHub
parent fb196be8cf
commit c427533389
34 changed files with 254 additions and 355 deletions

View file

@ -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