diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-10-30 00:04:10 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2016-03-07 16:33:20 -0500 |
commit | 5641da43d635ae46770eb20c5482a8971086202f (patch) | |
tree | 95a5424a224abbafc0c2a9073efe04cc8f1e3d9d /src/util/areastore.h | |
parent | 2e74e9ee20cee987a7326378c6ab73ec93e25457 (diff) | |
download | minetest-5641da43d635ae46770eb20c5482a8971086202f.tar.gz minetest-5641da43d635ae46770eb20c5482a8971086202f.tar.bz2 minetest-5641da43d635ae46770eb20c5482a8971086202f.zip |
Clean up VectorAreaStore
Diffstat (limited to 'src/util/areastore.h')
-rw-r--r-- | src/util/areastore.h | 8 |
1 files changed, 5 insertions, 3 deletions
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<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); |