From 3ce6642a26d43fd368c24cdfc5460557258fb44f Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Fri, 30 Oct 2015 20:38:22 -0400 Subject: Add AreaStore custom ID API --- src/util/areastore.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/util/areastore.cpp') diff --git a/src/util/areastore.cpp b/src/util/areastore.cpp index 17addb3af..58f08a8c2 100644 --- a/src/util/areastore.cpp +++ b/src/util/areastore.cpp @@ -160,7 +160,8 @@ void AreaStore::getAreasForPos(std::vector *result, v3s16 pos) bool VectorAreaStore::insertArea(Area *a) { - a->id = getNextId(); + if (a->id == U32_MAX) + a->id = getNextId(); std::pair res = areas_map.insert(std::make_pair(a->id, *a)); if (!res.second) @@ -232,7 +233,8 @@ static inline SpatialIndex::Point get_spatial_point(const v3s16 pos) bool SpatialAreaStore::insertArea(Area *a) { - a->id = getNextId(); + if (a->id == U32_MAX) + a->id = getNextId(); if (!areas_map.insert(std::make_pair(a->id, *a)).second) // ID is not unique return false; -- cgit v1.2.3