]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/util/areastore.cpp
Add color names from web page referenced in luaapi doc
[dragonfireclient.git] / src / util / areastore.cpp
index 17addb3af615fd9dd9e0d42f4c5a168e096108d8..cef67da2ce243378e24f7ba3b857ce7c09c25938 100644 (file)
@@ -95,6 +95,7 @@ void AreaStore::deserialize(std::istream &is)
                is.read(data, data_len);
                a.data = std::string(data, data_len);
                insertArea(&a);
+               delete [] data;
        }
 }
 
@@ -160,7 +161,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 +234,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;