diff options
author | kwolekr <kwolekr@minetest.net> | 2015-10-04 16:37:03 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-10-04 17:11:41 -0400 |
commit | 9f25aba6c2c3a922ebe74c327e275e83fef1f6f6 (patch) | |
tree | fea1c24179d6199fafbe83d1120ddea5da2c40c3 /src | |
parent | 0850d3bb930ac5e2cfd71a58fd49725e4c2a4c96 (diff) | |
download | minetest-9f25aba6c2c3a922ebe74c327e275e83fef1f6f6.tar.gz minetest-9f25aba6c2c3a922ebe74c327e275e83fef1f6f6.tar.bz2 minetest-9f25aba6c2c3a922ebe74c327e275e83fef1f6f6.zip |
Hide mapgens from main menu not intended for end users
Diffstat (limited to 'src')
-rw-r--r-- | src/emerge.cpp | 18 | ||||
-rw-r--r-- | src/emerge.h | 3 | ||||
-rw-r--r-- | src/script/lua_api/l_mainmenu.cpp | 2 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp index 15f264c1a..bb2590641 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -54,6 +54,7 @@ with this program; if not, write to the Free Software Foundation, Inc., struct MapgenDesc { const char *name; MapgenFactory *factory; + bool is_user_visible; }; class EmergeThread : public Thread { @@ -100,10 +101,10 @@ private: //// MapgenDesc g_reg_mapgens[] = { - {"v5", new MapgenFactoryV5}, - {"v6", new MapgenFactoryV6}, - {"v7", new MapgenFactoryV7}, - {"singlenode", new MapgenFactorySinglenode}, + {"v5", new MapgenFactoryV5, true}, + {"v6", new MapgenFactoryV6, true}, + {"v7", new MapgenFactoryV7, true}, + {"singlenode", new MapgenFactorySinglenode, false}, }; //// @@ -343,10 +344,13 @@ bool EmergeManager::isBlockUnderground(v3s16 blockpos) } -void EmergeManager::getMapgenNames(std::vector<const char *> *mgnames) +void EmergeManager::getMapgenNames( + std::vector<const char *> *mgnames, bool include_hidden) { - for (u32 i = 0; i != ARRLEN(g_reg_mapgens); i++) - mgnames->push_back(g_reg_mapgens[i].name); + for (u32 i = 0; i != ARRLEN(g_reg_mapgens); i++) { + if (include_hidden || g_reg_mapgens[i].is_user_visible) + mgnames->push_back(g_reg_mapgens[i].name); + } } diff --git a/src/emerge.h b/src/emerge.h index 5526a4c91..b72b2a2c3 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -139,7 +139,8 @@ public: bool isBlockUnderground(v3s16 blockpos); static MapgenFactory *getMapgenFactory(const std::string &mgname); - static void getMapgenNames(std::vector<const char *> *mgnames); + static void getMapgenNames( + std::vector<const char *> *mgnames, bool include_hidden); static v3s16 getContainingChunk(v3s16 blockpos, s16 chunksize); private: diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index d28925d5c..8478cf48a 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -707,7 +707,7 @@ int ModApiMainMenu::l_set_topleft_text(lua_State *L) int ModApiMainMenu::l_get_mapgen_names(lua_State *L) { std::vector<const char *> names; - EmergeManager::getMapgenNames(&names); + EmergeManager::getMapgenNames(&names, lua_toboolean(L, 1)); lua_newtable(L); for (size_t i = 0; i != names.size(); i++) { |