1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Clean up VectorAreaStore

This commit is contained in:
ShadowNinja 2015-10-30 00:04:10 -04:00
parent 2e74e9ee20
commit 5641da43d6
2 changed files with 24 additions and 32 deletions

View file

@ -59,8 +59,10 @@ protected:
virtual void getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos) = 0;
u32 getNextId() { return m_next_id++; }
// TODO change to unordered_map when we can
std::map<u32, Area> areas_map;
// Note: This can't be an unordered_map, since all
// references would be invalidated on rehash.
typedef std::map<u32, Area> AreaMap;
AreaMap areas_map;
public:
// Updates the area's ID
virtual bool insertArea(Area *a) = 0;
@ -111,8 +113,8 @@ class VectorAreaStore : public AreaStore {
protected:
virtual void getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos);
public:
virtual void reserve(size_t count) { m_areas.reserve(count); }
virtual bool insertArea(Area *a);
virtual void reserve(size_t count);
virtual bool removeArea(u32 id);
virtual void getAreasInArea(std::vector<Area *> *result,
v3s16 minedge, v3s16 maxedge, bool accept_overlap);