Skip to content

Instantly share code, notes, and snippets.

View sapier's full-sized avatar

sapier

View GitHub Profile
diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua
index dfaa04d..65eaae0 100644
--- a/builtin/mainmenu/init.lua
+++ b/builtin/mainmenu/init.lua
@@ -139,9 +139,10 @@ local function init_globals()
tv_main:add(tab_credits)
tv_main:set_global_event_handler(main_event_handler)
- tv_main:set_fixed_size(false)
diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua
index e582083..10b100c 100644
--- a/builtin/mainmenu/init.lua
+++ b/builtin/mainmenu/init.lua
@@ -144,6 +144,7 @@ local function init_globals()
tv_main:set_fixed_size(false)
else
tv_main:set_tab(core.setting_get("maintab_LAST"))
+ tv_main:set_fixed_size(false)
end
float getDisplayDensity()
{
const char* current_display = getenv("DISPLAY");
if (current_display == 0)
return g_settings->getFloat("screen_dpi")/96.0;
Display * x11display = XOpenDisplay(current_display);
float dpi_height = floor(DisplayHeight(x11display, 0) / (DisplayHeightMM(x11display, 0) * 0.039370) + 0.5);
float dpi_width = floor(DisplayWidth(x11display, 0) / (DisplayWidthMM(x11display, 0) * 0.039370) +0.5);
local retval, message = os.rename(mobf_world_path .. "/mobf_settings.conf.new",
mobf_world_path .. "/mobf_settings.conf")
if not retval then
minetest.log(LOGLEVEL_ERROR,"MOBF: failed to swap old conf file" ..
" to new one: " .. mobf_world_path .. "/mobf_settings.conf" ..
"(.new): ERR=" .. message)
if string.find(message, "File exists") then
minetest.log(LOGLEVEL_ERROR,"MOBF: OS doesn't seem to rename to existing filename copying old file to .bak")
os.rename(mobf_world_path .. "/mobf_settings.conf.new",
local retval, message = os.rename(mobf_world_path .. "/mobf_settings.conf.new",
mobf_world_path .. "/mobf_settings.conf")
if not retval then
minetest.log(LOGLEVEL_ERROR,"MOBF: failed to swap old conf file" ..
" to new one: " .. mobf_world_path .. "/mobf_settings.conf" ..
"(.new): ERR=" .. message)
end
diff --git a/src/connection.cpp b/src/connection.cpp
index ee5b1eb..d3fd9e2 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -72,6 +72,9 @@ static inline float CALC_DTIME(unsigned int lasttime, unsigned int curtime) {
#define PING_TIMEOUT 5.0
+/* maximum number of retries for reliable packets */
+#define MAX_RELIABLE_RETRY 5
@@ -131,18 +131,12 @@ void draw_anaglyph_3d_mode(Camera& camera, bool show_hud, Hud& hud,
void init_texture(video::IVideoDriver* driver, const v2u32& screensize,
video::ITexture** texture)
{
- static v2u32 last_screensize = v2u32(0,0);
-
- if (( *texture == NULL ) || (screensize != last_screensize))
+ if (*texture != NULL)
{
- if (*texture != NULL)
diff --git a/src/drawscene.cpp b/src/drawscene.cpp
index 9672aff..5d214d1 100644
--- a/src/drawscene.cpp
+++ b/src/drawscene.cpp
@@ -275,7 +275,11 @@ void draw_interlaced_3d_mode(Camera& camera, bool show_hud,
guienv->drawAll();
for (unsigned int i = 0; i < screensize.Y; i+=2 ) {
+#if (IRRLICHT_VERSION_MAJOR >= 1) && (IRRLICHT_VERSION_MINOR >= 8)
+ driver->draw2DImage(left_image, irr::core::position2d<s32>(0, i),
diff --git a/src/main.cpp b/src/main.cpp
index bb2ac5f..a44a2e6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -79,6 +79,7 @@
#include "httpfetch.h"
#include "guiEngine.h"
#include "mapsector.h"
+#include "player.h"
diff --git a/src/script/cpp_api/s_env.cpp b/src/script/cpp_api/s_env.cpp
index 9ac9302..8d00178 100644
--- a/src/script/cpp_api/s_env.cpp
+++ b/src/script/cpp_api/s_env.cpp
@@ -62,6 +62,9 @@ void ScriptApiEnv::player_event(ServerActiveObject* player, std::string type)
{
SCRIPTAPI_PRECHECKHEADER
+ if (player == NULL)
+ return;