From f48882213e31c47660cf0c87df1e04e51db9b50a Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 4 Jun 2012 22:34:22 +0300 Subject: [PATCH] Add ignore_world_load_errors configuration option and provide better error messages --- minetest.conf.example | 5 ++++- src/defaultsettings.cpp | 1 + src/map.cpp | 20 +++++++++++++------- src/mapblock.cpp | 25 +++++++++++++++++++++++-- src/server.cpp | 23 +++++++++++++++++++++-- 5 files changed, 62 insertions(+), 12 deletions(-) diff --git a/minetest.conf.example b/minetest.conf.example index 14e3f776c..7a8a2719c 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -178,4 +178,7 @@ # To reduce lag, block transfers are slowed down when a player is building something. # This determines how long they are slowed down after placing or removing a node. #full_block_send_enable_min_time_from_building = 2.0 - +# Length of a server tick in dedicated server +#dedicated_server_step = 0.05 +# Can be set to true to disable shutting down on invalid world data +#ignore_world_load_errors = false diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index ab6866cec..d0ed22c2d 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -137,5 +137,6 @@ void set_default_settings(Settings *settings) settings->setDefault("server_map_save_interval", "5.3"); settings->setDefault("full_block_send_enable_min_time_from_building", "2.0"); settings->setDefault("dedicated_server_step", "0.05"); + settings->setDefault("ignore_world_load_errors", "false"); } diff --git a/src/map.cpp b/src/map.cpp index 10dba3de9..647b9fe15 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3378,14 +3378,20 @@ void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool } catch(SerializationError &e) { - infostream<<"WARNING: Invalid block data in database " - <<" (SerializationError). " - <<"what()="<getBool("ignore_world_load_errors")){ + errorstream<<"Ignoring block load error. Duck and cover! " + <<"(ignore_world_load_errors)"<= 23) + if(version >= 23){ + TRACESTREAM(<<"MapBlock::deSerialize "<getBool("enable_mapgen_debug_info"); + + v3s16 last_tried_pos(-32768,-32768,-32768); // For error output /* Get block info from queue, emerge them and send them @@ -181,6 +183,8 @@ void * EmergeThread::Thread() v3s16 &p = q->pos; v2s16 p2d(p.X,p.Z); + + last_tried_pos = p; /* Do not generate over-limit @@ -377,8 +381,23 @@ void * EmergeThread::Thread() } catch(VersionMismatchException &e) { - m_server->setAsyncFatalError(std::string( - "World data version mismatch (server-side) (world probably saved by a newer version of Minetest): ")+e.what()); + std::ostringstream err; + err<<"World data version mismatch in MapBlock "<setAsyncFatalError(err.str()); + } + catch(SerializationError &e) + { + std::ostringstream err; + err<<"Invalid data in MapBlock "<setAsyncFatalError(err.str()); } END_DEBUG_EXCEPTION_HANDLER(errorstream) -- 2.25.1