mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Add AreaStore custom ID API
This commit is contained in:
parent
821551a266
commit
3ce6642a26
5 changed files with 14 additions and 7 deletions
|
@ -160,7 +160,8 @@ void AreaStore::getAreasForPos(std::vector<Area *> *result, v3s16 pos)
|
|||
|
||||
bool VectorAreaStore::insertArea(Area *a)
|
||||
{
|
||||
a->id = getNextId();
|
||||
if (a->id == U32_MAX)
|
||||
a->id = getNextId();
|
||||
std::pair<AreaMap::iterator, bool> 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue