Merge fixes

This commit is contained in:
MoNTE48 2019-06-12 21:47:03 +02:00
parent 71c3dbc137
commit 2dc0127af6
17 changed files with 32 additions and 160 deletions

View File

@ -1,46 +0,0 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
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 <algorithm>
#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

View File

@ -551,16 +551,16 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
bool ClientLauncher::create_engine_device() bool ClientLauncher::create_engine_device()
{ {
#ifdef __ANDROID__ #if defined(__ANDROID__) || defined(__IOS__)
// set correct resolution // set correct resolution
g_settings->setU16("screen_w", porting::getDisplaySize().X); g_settings->setU16("screenW", porting::getDisplaySize().X);
g_settings->setU16("screen_h", porting::getDisplaySize().Y); g_settings->setU16("screenH", porting::getDisplaySize().Y);
#endif #endif
// Resolution selection // Resolution selection
bool fullscreen = g_settings->getBool("fullscreen"); bool fullscreen = g_settings->getBool("fullscreen");
u16 screen_w = g_settings->getU16("screen_w"); u16 screenW = g_settings->getU16("screenW");
u16 screen_h = g_settings->getU16("screen_h"); u16 screenH = g_settings->getU16("screenH");
// bpp, fsaa, vsync // bpp, fsaa, vsync
bool vsync = g_settings->getBool("vsync"); bool vsync = g_settings->getBool("vsync");
@ -587,7 +587,7 @@ bool ClientLauncher::create_engine_device()
SIrrlichtCreationParameters params = SIrrlichtCreationParameters(); SIrrlichtCreationParameters params = SIrrlichtCreationParameters();
params.DriverType = driverType; params.DriverType = driverType;
params.WindowSize = core::dimension2d<u32>(screen_w, screen_h); params.WindowSize = core::dimension2d<u32>(screenW, screenH);
params.Bits = bits; params.Bits = bits;
params.AntiAlias = fsaa; params.AntiAlias = fsaa;
params.Fullscreen = fullscreen; params.Fullscreen = fullscreen;

View File

@ -40,7 +40,6 @@ public:
void beginSave() {} void beginSave() {}
void endSave() {} void endSave() {}
private: private:
std::map<s64, std::string> m_database; std::map<s64, std::string> m_database;
}; };

View File

@ -41,7 +41,6 @@ public:
void beginSave() {} void beginSave() {}
void endSave() {} void endSave() {}
private: private:
leveldb::DB *m_database; leveldb::DB *m_database;
}; };

View File

@ -132,8 +132,8 @@ void set_default_settings(Settings *settings)
settings->setDefault("pause_fps_max", "15"); settings->setDefault("pause_fps_max", "15");
settings->setDefault("viewing_range", "100"); settings->setDefault("viewing_range", "100");
settings->setDefault("near_plane", "0.1"); settings->setDefault("near_plane", "0.1");
settings->setDefault("screen_w", "1024"); settings->setDefault("screenW", "1024");
settings->setDefault("screen_h", "600"); settings->setDefault("screenH", "600");
settings->setDefault("autosave_screensize", "true"); settings->setDefault("autosave_screensize", "true");
settings->setDefault("fullscreen", "false"); settings->setDefault("fullscreen", "false");
settings->setDefault("fullscreen_bpp", "24"); settings->setDefault("fullscreen_bpp", "24");
@ -153,7 +153,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("view_bobbing_amount", "1.0"); settings->setDefault("view_bobbing_amount", "1.0");
settings->setDefault("fall_bobbing_amount", "1.0"); settings->setDefault("fall_bobbing_amount", "1.0");
settings->setDefault("enable_3d_clouds", "true"); settings->setDefault("enable_3d_clouds", "true");
settings->setDefault("cloud_height", "180"); settings->setDefault("cloud_height", "120");
settings->setDefault("cloud_radius", "12"); settings->setDefault("cloud_radius", "12");
settings->setDefault("menu_clouds", "false"); settings->setDefault("menu_clouds", "false");
settings->setDefault("opaque_water", "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_hotbar_max_width", "1.0");
settings->setDefault("hud_move_upwards", "0"); settings->setDefault("hud_move_upwards", "0");
settings->setDefault("enable_local_map_saving", "false"); 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_clean_transparent", "false");
settings->setDefault("texture_min_size", "32"); settings->setDefault("texture_min_size", "32");
settings->setDefault("ambient_occlusion_gamma", "2.2"); settings->setDefault("ambient_occlusion_gamma", "2.2");
@ -381,8 +381,8 @@ void set_default_settings(Settings *settings)
// Mobile Platform // Mobile Platform
#if defined(__ANDROID__) || defined(__IOS__) #if defined(__ANDROID__) || defined(__IOS__)
settings->setDefault("screen_w", "0"); settings->setDefault("screenW", "0");
settings->setDefault("screen_h", "0"); settings->setDefault("screenH", "0");
settings->setDefault("fullscreen", "true"); settings->setDefault("fullscreen", "true");
settings->setDefault("fps_max", "35"); settings->setDefault("fps_max", "35");
settings->setDefault("enable_shaders", "false"); settings->setDefault("enable_shaders", "false");

View File

@ -158,7 +158,7 @@ void DungeonGen::makeDungeon(v3s16 start_padding)
/* /*
Find place for first room. Find place for first room.
There is a 1 in 4 chance of the first room being 'large', 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; bool fits = false;
for (u32 i = 0; i < 100 && !fits; i++) { for (u32 i = 0; i < 100 && !fits; i++) {

View File

@ -79,7 +79,6 @@ public:
u32 m_added_objects; u32 m_added_objects;
IGameDef *getGameDef() { return m_gamedef; } IGameDef *getGameDef() { return m_gamedef; }
protected: protected:
GenericAtomic<float> m_time_of_day_speed; GenericAtomic<float> m_time_of_day_speed;

View File

@ -1689,8 +1689,8 @@ void Game::run()
&& client->checkPrivilege("fast"); && client->checkPrivilege("fast");
#endif #endif
irr::core::dimension2d<u32> previous_screen_size(g_settings->getU16("screen_w"), irr::core::dimension2d<u32> previous_screen_size(g_settings->getU16("screenW"),
g_settings->getU16("screen_h")); g_settings->getU16("screenH"));
while (device->run() while (device->run()
&& !(*kill || g_gamecallback->shutdown_requested && !(*kill || g_gamecallback->shutdown_requested
@ -1704,8 +1704,8 @@ void Game::run()
if (previous_screen_size != current_screen_size && if (previous_screen_size != current_screen_size &&
current_screen_size != irr::core::dimension2d<u32>(0,0) && current_screen_size != irr::core::dimension2d<u32>(0,0) &&
g_settings->getBool("autosave_screensize")) { g_settings->getBool("autosave_screensize")) {
g_settings->setU16("screen_w", current_screen_size.Width); g_settings->setU16("screenW", current_screen_size.Width);
g_settings->setU16("screen_h", current_screen_size.Height); g_settings->setU16("screenH", current_screen_size.Height);
previous_screen_size = current_screen_size; 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 // Reset input if window not active or some menu is active
if (!device->isWindowActive() || isMenuActive() || guienv->hasFocus(gui_chat_console)) { if (!device->isWindowActive() || isMenuActive() || guienv->hasFocus(gui_chat_console)) {
input->clear(); input->clear();
#if defined(HAVE_TOUCHSCREENGUI) && !defined(__IOS__) #ifdef HAVE_TOUCHSCREENGUI
g_touchscreengui->hide(); g_touchscreengui->hide();
#endif #endif
} }
@ -2526,7 +2526,7 @@ void Game::processUserInput(f32 dtime)
#endif #endif
// Increase timer for double tap of "keymap_jump" // 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; runData.jump_timer += dtime;
processKeyInput(); processKeyInput();

View File

@ -24,12 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gettext.h" #include "gettext.h"
#include "util/string.h" #include "util/string.h"
#include "log.h" #include "log.h"
#include "filesys.h"
#if USE_GETTEXT && defined(_MSC_VER) #if USE_GETTEXT && defined(_MSC_VER)
#include <windows.h> #include <windows.h>
#include <map> #include <map>
#include <direct.h> #include <direct.h>
#include "filesys.h"
#define setlocale(category, localename) \ #define setlocale(category, localename) \
setlocale(category, MSVC_LocaleLookup(localename)) setlocale(category, MSVC_LocaleLookup(localename))

View File

@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "config.h" // for USE_GETTEXT #include "config.h" // for USE_GETTEXT
#if USE_GETTEXT #if USE_GETTEXT
// #include <libgnuintl.h>
#include <libintl.h> #include <libintl.h>
#else #else
// In certain environments, some standard headers like <iomanip> // In certain environments, some standard headers like <iomanip>

View File

@ -272,8 +272,8 @@ void GUIEngine::run()
unsigned int text_height = g_fontengine->getTextHeight(); unsigned int text_height = g_fontengine->getTextHeight();
irr::core::dimension2d<u32> previous_screen_size(g_settings->getU16("screen_w"), irr::core::dimension2d<u32> previous_screen_size(g_settings->getU16("screenW"),
g_settings->getU16("screen_h")); g_settings->getU16("screenH"));
while (m_device->run() && (!m_startgame) && (!m_kill)) { while (m_device->run() && (!m_startgame) && (!m_kill)) {
@ -285,8 +285,8 @@ void GUIEngine::run()
if (previous_screen_size != current_screen_size && if (previous_screen_size != current_screen_size &&
current_screen_size != irr::core::dimension2d<u32>(0,0) && current_screen_size != irr::core::dimension2d<u32>(0,0) &&
g_settings->getBool("autosave_screensize")) { g_settings->getBool("autosave_screensize")) {
g_settings->setU16("screen_w", current_screen_size.Width); g_settings->setU16("screenW", current_screen_size.Width);
g_settings->setU16("screen_h", current_screen_size.Height); g_settings->setU16("screenH", current_screen_size.Height);
previous_screen_size = current_screen_size; previous_screen_size = current_screen_size;
} }

View File

@ -828,7 +828,7 @@ static bool run_dedicated_server(const GameParams &game_params, const Settings &
if (!name_ok) { if (!name_ok) {
if (admin_nick.empty()) { if (admin_nick.empty()) {
errorstream << "No name given for admin. " 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." << "contains a 'name = ' to your main admin account."
<< std::endl; << std::endl;
} else { } else {

View File

@ -1,77 +0,0 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
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

View File

@ -1002,13 +1002,14 @@ void MapgenV6::placeTreesAndJungleGrass()
continue; continue;
v3s16 p(x, y, z); 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); u32 i = vm->m_area.index(p);
content_t c = vm->m_data[i].getContent(); content_t c = vm->m_data[i].getContent();
if (c != c_dirt && if (c != c_dirt &&
c != c_dirt_with_grass && c != c_dirt_with_grass &&
c != c_dirt_with_snow) c != c_dirt_with_snow &&
c != c_snowblock)
continue; continue;
} }
p.Y++; p.Y++;
@ -1063,15 +1064,15 @@ void MapgenV6::growGrass() // Add surface nodes
content_t c = vm->m_data[i].getContent(); content_t c = vm->m_data[i].getContent();
if (surface_y >= water_level - 20) { if (surface_y >= water_level - 20) {
if (bt == BT_TAIGA && c == c_dirt) { if (bt == BT_TAIGA && c == c_dirt) {
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_data[i] = n_snowblock;
vm->m_area.add_y(em, i, -1); vm->m_area.add_y(em, i, -1);
vm->m_data[i] = n_dirt_with_snow; vm->m_data[i] = n_dirt_with_snow;
} else if (bt == BT_TUNDRA) {
if (c == c_dirt) {
vm->m_data[i] = n_dirt_with_snow;
} else if (c == c_stone && surface_y < node_max.Y) { } else if (c == c_stone && surface_y < node_max.Y) {
vm->m_area.add_y(em, i, 1); 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) { } else if (c == c_dirt) {
vm->m_data[i] = n_dirt_with_grass; vm->m_data[i] = n_dirt_with_grass;

View File

@ -80,7 +80,6 @@ public:
return true; return true;
} }
u16 size() const { return m_id_to_name.size(); } u16 size() const { return m_id_to_name.size(); }
private: private:
UNORDERED_MAP<u16, std::string> m_id_to_name; UNORDERED_MAP<u16, std::string> m_id_to_name;
UNORDERED_MAP<std::string, u16> m_name_to_id; UNORDERED_MAP<std::string, u16> m_name_to_id;

View File

@ -32,7 +32,6 @@ class MetaDataRef : public ModApiBase
{ {
public: public:
virtual ~MetaDataRef() {} virtual ~MetaDataRef() {}
protected: protected:
static MetaDataRef *checkobject(lua_State *L, int narg); static MetaDataRef *checkobject(lua_State *L, int narg);