aboutsummaryrefslogtreecommitdiff
path: root/src/mapsector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapsector.h')
-rw-r--r--src/mapsector.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/mapsector.h b/src/mapsector.h
index ffd4cdd1d..7ebf9b413 100644
--- a/src/mapsector.h
+++ b/src/mapsector.h
@@ -39,7 +39,6 @@ class IGameDef;
class MapSector
{
public:
-
MapSector(Map *parent, v2s16 pos, IGameDef *gamedef);
virtual ~MapSector();
@@ -60,13 +59,14 @@ public:
void getBlocks(MapBlockVect &dest);
- bool empty() const { return m_blocks.empty(); }
+ bool empty() const { return m_blocks_used == 0; }
+
+ int size() const { return m_blocks_used; }
- int size() const { return m_blocks.size(); }
-protected:
+ // The array of MapBlocks
+ MapBlock** m_blocks = ((MapBlock**)malloc(65536*sizeof(*m_blocks)/MAP_BLOCKSIZE)) + 65536/MAP_BLOCKSIZE/2;
- // The pile of MapBlocks
- std::unordered_map<s16, MapBlock*> m_blocks;
+ u16 m_blocks_used = 0;
Map *m_parent;
// Position on parent (in MapBlock widths)
@@ -74,14 +74,8 @@ protected:
IGameDef *m_gamedef;
- // Last-used block is cached here for quicker access.
- // Be sure to set this to nullptr when the cached block is deleted
- MapBlock *m_block_cache = nullptr;
- s16 m_block_cache_y;
-
/*
Private methods
*/
MapBlock *getBlockBuffered(s16 y);
-
};