From 2dc0127af6f88c258aedd32a12abee26a96e5714 Mon Sep 17 00:00:00 2001 From: MoNTE48 Date: Wed, 12 Jun 2019 21:47:03 +0200 Subject: [PATCH] Merge fixes --- src/basicmacros.h | 46 -------------------- src/client/clientlauncher.cpp | 12 ++--- src/database-dummy.h | 1 - src/database-leveldb.h | 1 - src/defaultsettings.cpp | 12 ++--- src/dungeongen.cpp | 2 +- src/environment.cpp | 2 +- src/environment.h | 1 - src/game.cpp | 12 ++--- src/gettext.cpp | 2 +- src/gettext.h | 1 - src/guiEngine.cpp | 8 ++-- src/main.cpp | 2 +- src/mapchunk.h | 77 --------------------------------- src/mapgen_v6.cpp | 11 ++--- src/nameidmapping.h | 1 - src/script/lua_api/l_metadata.h | 1 - 17 files changed, 32 insertions(+), 160 deletions(-) delete mode 100644 src/basicmacros.h delete mode 100644 src/mapchunk.h diff --git a/src/basicmacros.h b/src/basicmacros.h deleted file mode 100644 index b47305be3..000000000 --- a/src/basicmacros.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Minetest -Copyright (C) 2010-2013 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3.0 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef BASICMACROS_HEADER -#define BASICMACROS_HEADER - -#include - -#define ARRLEN(x) (sizeof(x) / sizeof((x)[0])) - -#define MYMIN(a, b) ((a) < (b) ? (a) : (b)) - -#define MYMAX(a, b) ((a) > (b) ? (a) : (b)) - -#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end()) - -// To disable copy constructors and assignment operations for some class -// 'Foobar', add the macro DISABLE_CLASS_COPY(Foobar) as a private member. -// Note this also disables copying for any classes derived from 'Foobar' as well -// as classes having a 'Foobar' member. -#define DISABLE_CLASS_COPY(C) \ - C(const C &); \ - C &operator=(const C &) - -// Fail compilation if condition expr is not met. -// Note that 'msg' must follow the format of a valid identifier, e.g. -// STATIC_ASSERT(sizeof(foobar_t) == 40), foobar_t_is_wrong_size); -#define STATIC_ASSERT(expr, msg) typedef char msg[!!(expr) * 2 - 1] - -#endif diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index dcaa52299..1299f93f9 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -551,16 +551,16 @@ void ClientLauncher::main_menu(MainMenuData *menudata) bool ClientLauncher::create_engine_device() { - #ifdef __ANDROID__ + #if defined(__ANDROID__) || defined(__IOS__) // set correct resolution - g_settings->setU16("screen_w", porting::getDisplaySize().X); - g_settings->setU16("screen_h", porting::getDisplaySize().Y); + g_settings->setU16("screenW", porting::getDisplaySize().X); + g_settings->setU16("screenH", porting::getDisplaySize().Y); #endif // Resolution selection bool fullscreen = g_settings->getBool("fullscreen"); - u16 screen_w = g_settings->getU16("screen_w"); - u16 screen_h = g_settings->getU16("screen_h"); + u16 screenW = g_settings->getU16("screenW"); + u16 screenH = g_settings->getU16("screenH"); // bpp, fsaa, vsync bool vsync = g_settings->getBool("vsync"); @@ -587,7 +587,7 @@ bool ClientLauncher::create_engine_device() SIrrlichtCreationParameters params = SIrrlichtCreationParameters(); params.DriverType = driverType; - params.WindowSize = core::dimension2d(screen_w, screen_h); + params.WindowSize = core::dimension2d(screenW, screenH); params.Bits = bits; params.AntiAlias = fsaa; params.Fullscreen = fullscreen; diff --git a/src/database-dummy.h b/src/database-dummy.h index a09562799..4af0c52a1 100644 --- a/src/database-dummy.h +++ b/src/database-dummy.h @@ -40,7 +40,6 @@ public: void beginSave() {} void endSave() {} - private: std::map m_database; }; diff --git a/src/database-leveldb.h b/src/database-leveldb.h index 30322bb87..316d464fb 100644 --- a/src/database-leveldb.h +++ b/src/database-leveldb.h @@ -41,7 +41,6 @@ public: void beginSave() {} void endSave() {} - private: leveldb::DB *m_database; }; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 24f8a28bd..46d9c51ab 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -132,8 +132,8 @@ void set_default_settings(Settings *settings) settings->setDefault("pause_fps_max", "15"); settings->setDefault("viewing_range", "100"); settings->setDefault("near_plane", "0.1"); - settings->setDefault("screen_w", "1024"); - settings->setDefault("screen_h", "600"); + settings->setDefault("screenW", "1024"); + settings->setDefault("screenH", "600"); settings->setDefault("autosave_screensize", "true"); settings->setDefault("fullscreen", "false"); settings->setDefault("fullscreen_bpp", "24"); @@ -153,7 +153,7 @@ void set_default_settings(Settings *settings) settings->setDefault("view_bobbing_amount", "1.0"); settings->setDefault("fall_bobbing_amount", "1.0"); settings->setDefault("enable_3d_clouds", "true"); - settings->setDefault("cloud_height", "180"); + settings->setDefault("cloud_height", "120"); settings->setDefault("cloud_radius", "12"); settings->setDefault("menu_clouds", "false"); settings->setDefault("opaque_water", "false"); @@ -174,7 +174,7 @@ void set_default_settings(Settings *settings) settings->setDefault("hud_hotbar_max_width", "1.0"); settings->setDefault("hud_move_upwards", "0"); settings->setDefault("enable_local_map_saving", "false"); - settings->setDefault("show_entity_selectionbox", "show_entity_selectionbox"); + settings->setDefault("show_entity_selectionbox", "false"); settings->setDefault("texture_clean_transparent", "false"); settings->setDefault("texture_min_size", "32"); settings->setDefault("ambient_occlusion_gamma", "2.2"); @@ -381,8 +381,8 @@ void set_default_settings(Settings *settings) // Mobile Platform #if defined(__ANDROID__) || defined(__IOS__) - settings->setDefault("screen_w", "0"); - settings->setDefault("screen_h", "0"); + settings->setDefault("screenW", "0"); + settings->setDefault("screenH", "0"); settings->setDefault("fullscreen", "true"); settings->setDefault("fps_max", "35"); settings->setDefault("enable_shaders", "false"); diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp index bd4b0b8dd..9e4644177 100644 --- a/src/dungeongen.cpp +++ b/src/dungeongen.cpp @@ -158,7 +158,7 @@ void DungeonGen::makeDungeon(v3s16 start_padding) /* Find place for first room. There is a 1 in 4 chance of the first room being 'large', - all other rooms are noif (dp.only_in_ground) {t 'large'. + all other rooms are not 'large'. */ bool fits = false; for (u32 i = 0; i < 100 && !fits; i++) { diff --git a/src/environment.cpp b/src/environment.cpp index 7eaec95be..4351e1b4f 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -125,4 +125,4 @@ u32 Environment::getDayCount() { // Atomic counter return m_day_count; -} \ No newline at end of file +} diff --git a/src/environment.h b/src/environment.h index a56fecd10..394ddf854 100644 --- a/src/environment.h +++ b/src/environment.h @@ -79,7 +79,6 @@ public: u32 m_added_objects; IGameDef *getGameDef() { return m_gamedef; } - protected: GenericAtomic m_time_of_day_speed; diff --git a/src/game.cpp b/src/game.cpp index 9dd060ffe..6e25725bf 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1689,8 +1689,8 @@ void Game::run() && client->checkPrivilege("fast"); #endif - irr::core::dimension2d previous_screen_size(g_settings->getU16("screen_w"), - g_settings->getU16("screen_h")); + irr::core::dimension2d previous_screen_size(g_settings->getU16("screenW"), + g_settings->getU16("screenH")); while (device->run() && !(*kill || g_gamecallback->shutdown_requested @@ -1704,8 +1704,8 @@ void Game::run() if (previous_screen_size != current_screen_size && current_screen_size != irr::core::dimension2d(0,0) && g_settings->getBool("autosave_screensize")) { - g_settings->setU16("screen_w", current_screen_size.Width); - g_settings->setU16("screen_h", current_screen_size.Height); + g_settings->setU16("screenW", current_screen_size.Width); + g_settings->setU16("screenH", current_screen_size.Height); previous_screen_size = current_screen_size; } @@ -2499,7 +2499,7 @@ void Game::processUserInput(f32 dtime) // Reset input if window not active or some menu is active if (!device->isWindowActive() || isMenuActive() || guienv->hasFocus(gui_chat_console)) { input->clear(); -#if defined(HAVE_TOUCHSCREENGUI) && !defined(__IOS__) +#ifdef HAVE_TOUCHSCREENGUI g_touchscreengui->hide(); #endif } @@ -2526,7 +2526,7 @@ void Game::processUserInput(f32 dtime) #endif // Increase timer for double tap of "keymap_jump" - if (m_cache_doubletap_jump && runData.jump_timer <= 0.15) + if (m_cache_doubletap_jump && runData.jump_timer <= 0.15f) runData.jump_timer += dtime; processKeyInput(); diff --git a/src/gettext.cpp b/src/gettext.cpp index 7908f83dc..f5485a89a 100644 --- a/src/gettext.cpp +++ b/src/gettext.cpp @@ -24,12 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "gettext.h" #include "util/string.h" #include "log.h" -#include "filesys.h" #if USE_GETTEXT && defined(_MSC_VER) #include #include #include +#include "filesys.h" #define setlocale(category, localename) \ setlocale(category, MSVC_LocaleLookup(localename)) diff --git a/src/gettext.h b/src/gettext.h index 775cdb331..757e6a928 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" // for USE_GETTEXT #if USE_GETTEXT -// #include #include #else // In certain environments, some standard headers like diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp index ee70854a9..7c87cbbe5 100644 --- a/src/guiEngine.cpp +++ b/src/guiEngine.cpp @@ -272,8 +272,8 @@ void GUIEngine::run() unsigned int text_height = g_fontengine->getTextHeight(); - irr::core::dimension2d previous_screen_size(g_settings->getU16("screen_w"), - g_settings->getU16("screen_h")); + irr::core::dimension2d previous_screen_size(g_settings->getU16("screenW"), + g_settings->getU16("screenH")); while (m_device->run() && (!m_startgame) && (!m_kill)) { @@ -285,8 +285,8 @@ void GUIEngine::run() if (previous_screen_size != current_screen_size && current_screen_size != irr::core::dimension2d(0,0) && g_settings->getBool("autosave_screensize")) { - g_settings->setU16("screen_w", current_screen_size.Width); - g_settings->setU16("screen_h", current_screen_size.Height); + g_settings->setU16("screenW", current_screen_size.Width); + g_settings->setU16("screenH", current_screen_size.Height); previous_screen_size = current_screen_size; } diff --git a/src/main.cpp b/src/main.cpp index 1a7160695..6f24fbb9e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -828,7 +828,7 @@ static bool run_dedicated_server(const GameParams &game_params, const Settings & if (!name_ok) { if (admin_nick.empty()) { errorstream << "No name given for admin. " - << "Please check your MultiCraft.conf that it " + << "Please check your multicraft.conf that it " << "contains a 'name = ' to your main admin account." << std::endl; } else { diff --git a/src/mapchunk.h b/src/mapchunk.h deleted file mode 100644 index f64bdccbd..000000000 --- a/src/mapchunk.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -Minetest -Copyright (C) 2013 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 3.0 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef MAPCHUNK_HEADER -#define MAPCHUNK_HEADER - -/* - TODO: Remove -*/ - -#if 0 -/* - MapChunk contains map-generation-time metadata for an area of - some MapSectors. (something like 16x16) -*/ - -// These should fit in 8 bits, as they are saved as such. -enum{ - GENERATED_FULLY = 0, - GENERATED_PARTLY = 10, - GENERATED_NOT = 20 -}; - -class MapChunk -{ -public: - MapChunk(): - m_generation_level(GENERATED_NOT), - m_modified(true) - { - } - - /* - Generation level. Possible values: - GENERATED_FULLY = 0 = fully generated - GENERATED_PARTLY = partly generated - GENERATED_NOT = not generated - */ - u16 getGenLevel(){ return m_generation_level; } - void setGenLevel(u16 lev){ m_generation_level = lev; } - - void serialize(std::ostream &os, u8 version) - { - os.write((char*)&m_generation_level, 1); - } - void deSerialize(std::istream &is, u8 version) - { - is.read((char*)&m_generation_level, 1); - } - - bool isModified(){ return m_modified; } - void setModified(bool modified){ m_modified = modified; } - -private: - u8 m_generation_level; - bool m_modified; -}; -#endif - -#endif - diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 9e6e1cdc2..0fdf99623 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -1002,13 +1002,14 @@ void MapgenV6::placeTreesAndJungleGrass() continue; v3s16 p(x, y, z); - // Trees grow only on mud and grass + // Trees grow only on mud and grass and snowblock { u32 i = vm->m_area.index(p); content_t c = vm->m_data[i].getContent(); if (c != c_dirt && c != c_dirt_with_grass && - c != c_dirt_with_snow) + c != c_dirt_with_snow && + c != c_snowblock) continue; } p.Y++; @@ -1063,15 +1064,15 @@ void MapgenV6::growGrass() // Add surface nodes content_t c = vm->m_data[i].getContent(); if (surface_y >= water_level - 20) { if (bt == BT_TAIGA && c == c_dirt) { + vm->m_data[i] = n_snowblock; + vm->m_area.add_y(em, i, -1); vm->m_data[i] = n_dirt_with_snow; } else if (bt == BT_TUNDRA) { if (c == c_dirt) { - vm->m_data[i] = n_snowblock; - vm->m_area.add_y(em, i, -1); vm->m_data[i] = n_dirt_with_snow; } else if (c == c_stone && surface_y < node_max.Y) { vm->m_area.add_y(em, i, 1); - vm->m_data[i] = n_snowblock; + vm->m_data[i] = n_snow; } } else if (c == c_dirt) { vm->m_data[i] = n_dirt_with_grass; diff --git a/src/nameidmapping.h b/src/nameidmapping.h index eef8ee37f..a4e8083d2 100644 --- a/src/nameidmapping.h +++ b/src/nameidmapping.h @@ -80,7 +80,6 @@ public: return true; } u16 size() const { return m_id_to_name.size(); } - private: UNORDERED_MAP m_id_to_name; UNORDERED_MAP m_name_to_id; diff --git a/src/script/lua_api/l_metadata.h b/src/script/lua_api/l_metadata.h index 5d1d98422..57c7f39fb 100644 --- a/src/script/lua_api/l_metadata.h +++ b/src/script/lua_api/l_metadata.h @@ -32,7 +32,6 @@ class MetaDataRef : public ModApiBase { public: virtual ~MetaDataRef() {} - protected: static MetaDataRef *checkobject(lua_State *L, int narg);