aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2015-10-29 23:38:36 -0400
committerShadowNinja <shadowninja@minetest.net>2016-03-07 16:33:20 -0500
commit2e74e9ee20cee987a7326378c6ab73ec93e25457 (patch)
tree47f180f1e70668b806eba2f091e05249342f43fc
parent0079887b645e0ee441bd2cfcd7874a1148fdd656 (diff)
downloadminetest-2e74e9ee20cee987a7326378c6ab73ec93e25457.tar.gz
minetest-2e74e9ee20cee987a7326378c6ab73ec93e25457.tar.bz2
minetest-2e74e9ee20cee987a7326378c6ab73ec93e25457.zip
Move AreaStore container selection logic into getOptimalImplementation
-rw-r--r--src/script/lua_api/l_areastore.cpp9
-rw-r--r--src/util/areastore.cpp10
-rw-r--r--src/util/areastore.h3
3 files changed, 13 insertions, 9 deletions
diff --git a/src/script/lua_api/l_areastore.cpp b/src/script/lua_api/l_areastore.cpp
index 8b8b157d7..8e9b2c7d5 100644
--- a/src/script/lua_api/l_areastore.cpp
+++ b/src/script/lua_api/l_areastore.cpp
@@ -25,9 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irr_v3d.h"
#include "util/areastore.h"
#include "filesys.h"
-#ifndef ANDROID
- #include "cmake_config.h"
-#endif
#include <fstream>
static inline void get_data_and_border_flags(lua_State *L, u8 start_i,
@@ -294,11 +291,7 @@ int LuaAreaStore::l_from_file(lua_State *L)
LuaAreaStore::LuaAreaStore()
{
-#if USE_SPATIAL
- this->as = new SpatialAreaStore();
-#else
- this->as = new VectorAreaStore();
-#endif
+ this->as = AreaStore::getOptimalImplementation();
}
LuaAreaStore::LuaAreaStore(const std::string &type)
diff --git a/src/util/areastore.cpp b/src/util/areastore.cpp
index b0076faa3..cf972586c 100644
--- a/src/util/areastore.cpp
+++ b/src/util/areastore.cpp
@@ -44,6 +44,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
AST_OVERLAPS_IN_DIMENSION((amine), (amaxe), (b), Y) && \
AST_OVERLAPS_IN_DIMENSION((amine), (amaxe), (b), Z))
+
+AreaStore *AreaStore::getOptimalImplementation()
+{
+#if USE_SPATIAL
+ return new SpatialAreaStore();
+#else
+ return new VectorAreaStore();
+#endif
+}
+
u16 AreaStore::size() const
{
return areas_map.size();
diff --git a/src/util/areastore.h b/src/util/areastore.h
index c36cbc389..dee1f8bab 100644
--- a/src/util/areastore.h
+++ b/src/util/areastore.h
@@ -52,7 +52,6 @@ struct Area {
std::string data;
};
-std::vector<std::string> get_areastore_typenames();
class AreaStore {
protected:
@@ -93,6 +92,8 @@ public:
const Area *getArea(u32 id) const;
u16 size() const;
+
+ static AreaStore *getOptimalImplementation();
#if 0
bool deserialize(std::istream &is);
void serialize(std::ostream &is) const;