mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-26 18:21:04 +00:00
Add count based unload limit for mapblocks
This commit is contained in:
parent
2b04ab874d
commit
a8e238ed06
8 changed files with 154 additions and 65 deletions
|
@ -40,7 +40,7 @@ class IGameDef;
|
|||
class MapSector
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
MapSector(Map *parent, v2s16 pos, IGameDef *gamedef);
|
||||
virtual ~MapSector();
|
||||
|
||||
|
@ -58,16 +58,18 @@ public:
|
|||
MapBlock * createBlankBlock(s16 y);
|
||||
|
||||
void insertBlock(MapBlock *block);
|
||||
|
||||
|
||||
void deleteBlock(MapBlock *block);
|
||||
|
||||
|
||||
void getBlocks(MapBlockVect &dest);
|
||||
|
||||
|
||||
bool empty();
|
||||
|
||||
// Always false at the moment, because sector contains no metadata.
|
||||
bool differs_from_disk;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
// The pile of MapBlocks
|
||||
std::map<s16, MapBlock*> m_blocks;
|
||||
|
||||
|
@ -76,12 +78,12 @@ protected:
|
|||
v2s16 m_pos;
|
||||
|
||||
IGameDef *m_gamedef;
|
||||
|
||||
|
||||
// Last-used block is cached here for quicker access.
|
||||
// Be sure to set this to NULL when the cached block is deleted
|
||||
// Be sure to set this to NULL when the cached block is deleted
|
||||
MapBlock *m_block_cache;
|
||||
s16 m_block_cache_y;
|
||||
|
||||
|
||||
/*
|
||||
Private methods
|
||||
*/
|
||||
|
@ -94,7 +96,7 @@ class ServerMapSector : public MapSector
|
|||
public:
|
||||
ServerMapSector(Map *parent, v2s16 pos, IGameDef *gamedef);
|
||||
~ServerMapSector();
|
||||
|
||||
|
||||
u32 getId() const
|
||||
{
|
||||
return MAPSECTOR_SERVER;
|
||||
|
@ -106,7 +108,7 @@ public:
|
|||
*/
|
||||
|
||||
void serialize(std::ostream &os, u8 version);
|
||||
|
||||
|
||||
static ServerMapSector* deSerialize(
|
||||
std::istream &is,
|
||||
Map *parent,
|
||||
|
@ -114,7 +116,7 @@ public:
|
|||
std::map<v2s16, MapSector*> & sectors,
|
||||
IGameDef *gamedef
|
||||
);
|
||||
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
@ -124,7 +126,7 @@ class ClientMapSector : public MapSector
|
|||
public:
|
||||
ClientMapSector(Map *parent, v2s16 pos, IGameDef *gamedef);
|
||||
~ClientMapSector();
|
||||
|
||||
|
||||
u32 getId() const
|
||||
{
|
||||
return MAPSECTOR_CLIENT;
|
||||
|
@ -133,6 +135,6 @@ public:
|
|||
private:
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue