From 5641da43d635ae46770eb20c5482a8971086202f Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Fri, 30 Oct 2015 00:04:10 -0400 Subject: Clean up VectorAreaStore --- src/util/areastore.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/util/areastore.h') diff --git a/src/util/areastore.h b/src/util/areastore.h index dee1f8bab..da7876396 100644 --- a/src/util/areastore.h +++ b/src/util/areastore.h @@ -59,8 +59,10 @@ protected: virtual void getAreasForPosImpl(std::vector *result, v3s16 pos) = 0; u32 getNextId() { return m_next_id++; } - // TODO change to unordered_map when we can - std::map areas_map; + // Note: This can't be an unordered_map, since all + // references would be invalidated on rehash. + typedef std::map 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 *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 *result, v3s16 minedge, v3s16 maxedge, bool accept_overlap); -- cgit v1.2.3