From ab9c0069387d93a1b64a58b798dc7be2808bd8df Mon Sep 17 00:00:00 2001 From: M10360 Date: Sat, 29 Nov 2014 01:47:13 -0600 Subject: Removed duplicate. --- MCServer/crafting.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/MCServer/crafting.txt b/MCServer/crafting.txt index 8e68d5cb5..4d28b1f52 100644 --- a/MCServer/crafting.txt +++ b/MCServer/crafting.txt @@ -75,7 +75,6 @@ Wool = String, 1:1, 1:2, 2:1, 2:2 TNT = Gunpowder, 1:1, 3:1, 2:2, 1:3, 3:3 | Sand, 2:1, 1:2, 3:2, 2:3 PillarQuartzBlock = QuartzSlab, 1:1, 1:2 ChiseledQuartzBlock, 2 = QuartzBlock, 1:1, 1:2 -CoalBlock = Coal, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3 HayBale = Wheat, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3 SnowBlock = SnowBall, 1:1, 1:2, 2:1, 2:2 ClayBlock = Clay, 1:1, 1:2, 2:1, 2:2 -- cgit v1.2.3 From 23a176057db0d6bb9b2ddd473d5050591282f578 Mon Sep 17 00:00:00 2001 From: M10360 Date: Sat, 29 Nov 2014 01:56:44 -0600 Subject: Added missing fuels. --- MCServer/furnace.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/MCServer/furnace.txt b/MCServer/furnace.txt index 0c12a798d..8efa712e7 100644 --- a/MCServer/furnace.txt +++ b/MCServer/furnace.txt @@ -90,6 +90,25 @@ RawMutton = CookedMutton ! CoalBlock = 16000 # -> 800 sec ! BlazeRod = 2400 # -> 120 sec ! NoteBlock = 300 # -> 15 sec +! HugeRedMushroom = 300 # -> 15 sec +! HugeBrownMushroom = 300 # -> 15 sec +! Banner = 300 # -> 15 sec +! BlackBanner = 300 # -> 15 sec +! RedBanner = 300 # -> 15 sec +! GreenBanner = 300 # -> 15 sec +! BrownBanner = 300 # -> 15 sec +! BlueBanner = 300 # -> 15 sec +! PurpleBanner = 300 # -> 15 sec +! CyanBanner = 300 # -> 15 sec +! SilverBanner = 300 # -> 15 sec +! GrayBanner = 300 # -> 15 sec +! PinkBanner = 300 # -> 15 sec +! LimeBanner = 300 # -> 15 sec +! YellowBanner = 300 # -> 15 sec +! LightBlueBanner = 300 # -> 15 sec +! MagentaBanner = 300 # -> 15 sec +! OrangeBanner = 300 # -> 15 sec +! WhiteBanner = 300 # -> 15 sec ! DaylightSensor = 300 # -> 15 sec ! FenceGate = 300 # -> 15 sec ! SpruceFenceGate = 300 # -> 15 sec -- cgit v1.2.3 From 7f190c4ec24ed6d4cd2c390a33741c058dc04a6c Mon Sep 17 00:00:00 2001 From: M10360 Date: Sat, 29 Nov 2014 01:59:01 -0600 Subject: Smelting Netherrack not TallGrass gives you NetherBrickItem. --- MCServer/furnace.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MCServer/furnace.txt b/MCServer/furnace.txt index 8efa712e7..7179b5299 100644 --- a/MCServer/furnace.txt +++ b/MCServer/furnace.txt @@ -52,7 +52,7 @@ RawBeef = Steak RawChicken = CookedChicken Clay = Brick ClayBlock = HardenedClay -TallGrass = NetherBrickItem +Netherrack = NetherBrickItem RawFish = CookedFish Log = CharCoal Cactus = GreenDye -- cgit v1.2.3 From 02828304c2a26c5b175e862f0525e76c4974b710 Mon Sep 17 00:00:00 2001 From: M10360 Date: Sat, 29 Nov 2014 02:02:35 -0600 Subject: Added M10360. --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8620a1475..fffc55b2a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -10,6 +10,7 @@ Howaner keyboard Lapayo Luksor +M10360 marmot21 Masy98 mborland -- cgit v1.2.3 From 615bca156720a2027545cce7a0e7d403b0daca11 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 29 Nov 2014 16:00:52 +0100 Subject: Update core --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 470247194..5b7a6d464 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 4702471943511f641458c7e8e89b430a723f43ea +Subproject commit 5b7a6d464ed3e0e5d2a438ebf119430cacab26ae -- cgit v1.2.3 From 201313a9f84192ad7f2fcd7e4ab2cc793a85b96f Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 29 Nov 2014 23:06:10 +0100 Subject: Added a basic stacktracing for assert and signal failures. --- src/Globals.h | 5 +++-- src/OSSupport/CMakeLists.txt | 8 ++++++-- src/OSSupport/StackTrace.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ src/OSSupport/StackTrace.h | 15 +++++++++++++++ src/main.cpp | 6 ++++++ 5 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 src/OSSupport/StackTrace.cpp create mode 100644 src/OSSupport/StackTrace.h diff --git a/src/Globals.h b/src/Globals.h index 582f5fdaa..d75ae0093 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -264,6 +264,7 @@ template class SizeChecker; #include "OSSupport/Thread.h" #include "OSSupport/File.h" #include "Logger.h" + #include "OSSupport/StackTrace.h" #else // Logging functions void inline LOGERROR(const char* a_Format, ...) FORMATSTRING(1, 2); @@ -349,14 +350,14 @@ void inline LOGD(const char* a_Format, ...) #else #ifdef _DEBUG - #define ASSERT( x) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__), assert(0), 0)) + #define ASSERT( x) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__), PrintStackTrace(), assert(0), 0)) #else #define ASSERT(x) ((void)(x)) #endif #endif // Pretty much the same as ASSERT() but stays in Release builds -#define VERIFY( x) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0)) +#define VERIFY( x) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), PrintStackTrace(), exit(1), 0)) // Same as assert but in all Self test builds #ifdef SELF_TEST diff --git a/src/OSSupport/CMakeLists.txt b/src/OSSupport/CMakeLists.txt index c3eabeef6..592525941 100644 --- a/src/OSSupport/CMakeLists.txt +++ b/src/OSSupport/CMakeLists.txt @@ -16,8 +16,10 @@ SET (SRCS Sleep.cpp Socket.cpp SocketThreads.cpp + StackTrace.cpp Thread.cpp - Timer.cpp) + Timer.cpp +) SET (HDRS CriticalSection.h @@ -32,8 +34,10 @@ SET (HDRS Sleep.h Socket.h SocketThreads.h + StackTrace.h Thread.h - Timer.h) + Timer.h +) if(NOT MSVC) add_library(OSSupport ${SRCS} ${HDRS}) diff --git a/src/OSSupport/StackTrace.cpp b/src/OSSupport/StackTrace.cpp new file mode 100644 index 000000000..57c547fa1 --- /dev/null +++ b/src/OSSupport/StackTrace.cpp @@ -0,0 +1,43 @@ + +// StackTrace.cpp + +// Implements the functions to print current stack traces + +#include "Globals.h" +#include "StackTrace.h" +#ifdef _WIN32 + #include "../StackWalker.h" +#else + #include +#endif + + + + + +void PrintStackTrace(void) +{ + #ifdef _WIN32 + // Reuse the StackWalker from the LeakFinder project already bound to MCS + // Define a subclass of the StackWalker that outputs everything to stdout + class PrintingStackWalker : + public StackWalker + { + virtual void OnOutput(LPCSTR szText) override + { + puts(szText); + } + } sw; + sw.ShowCallstack(); + #else + // Use the backtrace() function to get and output the stackTrace: + // Code adapted from http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes + void * stackTrace[30]; + size_t numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace)); + backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO); + #endif +} + + + + diff --git a/src/OSSupport/StackTrace.h b/src/OSSupport/StackTrace.h new file mode 100644 index 000000000..228a00077 --- /dev/null +++ b/src/OSSupport/StackTrace.h @@ -0,0 +1,15 @@ + +// StackTrace.h + +// Declares the functions to print current stack trace + + + + + +/** Prints the stacktrace for the current thread. */ +extern void PrintStackTrace(void); + + + + diff --git a/src/main.cpp b/src/main.cpp index c60e13a8c..0a8521fbc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,6 +10,7 @@ #ifdef _MSC_VER #include #endif // _MSC_VER +#include "OSSupport/StackTrace.h" bool cRoot::m_TerminateEventRaised = false; // If something has told the server to stop; checked periodically in cRoot @@ -61,6 +62,7 @@ void NonCtrlHandler(int a_Signal) std::signal(SIGSEGV, SIG_DFL); LOGERROR(" D: | MCServer has encountered an error and needs to close"); LOGERROR("Details | SIGSEGV: Segmentation fault"); + PrintStackTrace(); abort(); } case SIGABRT: @@ -71,6 +73,7 @@ void NonCtrlHandler(int a_Signal) std::signal(a_Signal, SIG_DFL); LOGERROR(" D: | MCServer has encountered an error and needs to close"); LOGERROR("Details | SIGABRT: Server self-terminated due to an internal fault"); + PrintStackTrace(); abort(); } case SIGINT: @@ -137,6 +140,9 @@ LONG WINAPI LastChanceExceptionFilter(__in struct _EXCEPTION_POINTERS * a_Except g_WriteMiniDump(GetCurrentProcess(), GetCurrentProcessId(), dumpFile, g_DumpFlags, (a_ExceptionInfo) ? &ExcInformation : nullptr, nullptr, nullptr); CloseHandle(dumpFile); + // Print the stack trace for the basic debugging: + PrintStackTrace(); + // Revert to old stack: _asm { -- cgit v1.2.3 From 8e6f98eb40375fbc3330b2ef9774d63760126bcd Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 29 Nov 2014 23:30:27 +0100 Subject: Fixed missing files in ProtoProxy. --- Tools/ProtoProxy/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tools/ProtoProxy/CMakeLists.txt b/Tools/ProtoProxy/CMakeLists.txt index bc3923d90..fc8721da0 100644 --- a/Tools/ProtoProxy/CMakeLists.txt +++ b/Tools/ProtoProxy/CMakeLists.txt @@ -57,14 +57,22 @@ set(SHARED_OSS_SRC ../../src/OSSupport/CriticalSection.cpp ../../src/OSSupport/File.cpp ../../src/OSSupport/IsThread.cpp + ../../src/OSSupport/StackTrace.cpp ../../src/OSSupport/Timer.cpp ) set(SHARED_OSS_HDR ../../src/OSSupport/CriticalSection.h ../../src/OSSupport/File.h ../../src/OSSupport/IsThread.h + ../../src/OSSupport/StackTrace.h ../../src/OSSupport/Timer.h ) + +if(WIN32) + list (APPEND SHARED_OSS_SRC ../../src/StackWalker.cpp) + list (APPEND SHARED_OSS_HDR ../../src/StackWalker.h) +endif() + flatten_files(SHARED_SRC) flatten_files(SHARED_HDR) flatten_files(SHARED_OSS_SRC) -- cgit v1.2.3 From abbe18c0ab8a9966ffc2a2d86cbac7bc79cd77de Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 29 Nov 2014 23:55:06 +0100 Subject: Fixed QtBiomeVisualiser compilation. --- Tools/QtBiomeVisualiser/QtBiomeVisualiser.pro | 19 +++++++++++++++++-- src/Noise/Noise.cpp | 1 - 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Tools/QtBiomeVisualiser/QtBiomeVisualiser.pro b/Tools/QtBiomeVisualiser/QtBiomeVisualiser.pro index 9522491a8..cccee1305 100644 --- a/Tools/QtBiomeVisualiser/QtBiomeVisualiser.pro +++ b/Tools/QtBiomeVisualiser/QtBiomeVisualiser.pro @@ -17,7 +17,7 @@ SOURCES += \ BiomeView.cpp \ ../../src/Generating/BioGen.cpp \ ../../src/VoronoiMap.cpp \ - ../../src/Noise.cpp \ + ../../src/Noise/Noise.cpp \ ../../src/StringUtils.cpp \ ../../src/LoggerListeners.cpp \ ../../src/Logger.cpp \ @@ -25,7 +25,9 @@ SOURCES += \ ../../src/OSSupport/File.cpp \ ../../src/OSSupport/CriticalSection.cpp \ ../../src/OSSupport/IsThread.cpp \ + ../../src/OSSupport/StackTrace.cpp \ ../../src/BiomeDef.cpp \ + ../../src/StackWalker.cpp \ ../../src/StringCompression.cpp \ ../../src/WorldStorage/FastNBT.cpp \ ../../lib/zlib/adler32.c \ @@ -62,7 +64,7 @@ HEADERS += \ ../../src/Generating/IntGen.h \ ../../src/Generating/ProtIntGen.h \ ../../src/VoronoiMap.h \ - ../../src/Noise.h \ + ../../src/Noise/Noise.h \ ../../src/StringUtils.h \ ../../src/LoggerListeners.h \ ../../src/Logger.h \ @@ -70,7 +72,9 @@ HEADERS += \ ../../src/OSSupport/File.h \ ../../src/OSSupport/CriticalSection.h \ ../../src/OSSupport/IsThread.h \ + ../../src/OSSupport/StackTrace.h \ ../../src/BiomeDef.h \ + ../../src/StackWalker.h \ ../../src/StringCompression.h \ ../../src/WorldStorage/FastNBT.h \ ../../lib/zlib/crc32.h \ @@ -107,4 +111,15 @@ CONFIG += C++11 OTHER_FILES += +win* { + # Add the advapi32 library for windows compiles; needed for the StackWalker: + LIBS += advapi32.lib + + # StackWalker doesn't like how Qt inconsistently defines only UNICODE, but not _UNICODE: + DEFINES -= UNICODE +} + + + + diff --git a/src/Noise/Noise.cpp b/src/Noise/Noise.cpp index 509be7d6c..0249ab6c1 100644 --- a/src/Noise/Noise.cpp +++ b/src/Noise/Noise.cpp @@ -2,7 +2,6 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Noise.h" -#include "OSSupport/Timer.h" #define FAST_FLOOR(x) (((x) < 0) ? (((int)x) - 1) : ((int)x)) -- cgit v1.2.3 From e0a846d8059da4e470f57a63bf396d30f29c4043 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 29 Nov 2014 23:55:15 +0100 Subject: Removed unneeded include. --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 0a8521fbc..fe4b360a5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,7 +10,6 @@ #ifdef _MSC_VER #include #endif // _MSC_VER -#include "OSSupport/StackTrace.h" bool cRoot::m_TerminateEventRaised = false; // If something has told the server to stop; checked periodically in cRoot -- cgit v1.2.3 From dec89478a78a4feb9411de9c288134c55e0febcb Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 29 Nov 2014 23:58:26 +0100 Subject: Fixed MCADefrag compilation. --- Tools/MCADefrag/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tools/MCADefrag/CMakeLists.txt b/Tools/MCADefrag/CMakeLists.txt index 42b42018b..618719d68 100644 --- a/Tools/MCADefrag/CMakeLists.txt +++ b/Tools/MCADefrag/CMakeLists.txt @@ -46,6 +46,7 @@ set(SHARED_HDR ../../src/ByteBuffer.h ../../src/StringUtils.h ) + flatten_files(SHARED_SRC) flatten_files(SHARED_HDR) source_group("Shared" FILES ${SHARED_SRC} ${SHARED_HDR}) @@ -54,15 +55,22 @@ set(SHARED_OSS_SRC ../../src/OSSupport/CriticalSection.cpp ../../src/OSSupport/File.cpp ../../src/OSSupport/IsThread.cpp + ../../src/OSSupport/StackTrace.cpp ../../src/OSSupport/Timer.cpp ) set(SHARED_OSS_HDR ../../src/OSSupport/CriticalSection.h ../../src/OSSupport/File.h ../../src/OSSupport/IsThread.h + ../../src/OSSupport/StackTrace.h ../../src/OSSupport/Timer.h ) +if(WIN32) + list (APPEND SHARED_OSS_SRC ../../src/StackWalker.cpp) + list (APPEND SHARED_OSS_HDR ../../src/StackWalker.h) +endif() + flatten_files(SHARED_OSS_SRC) flatten_files(SHARED_OSS_HDR) -- cgit v1.2.3 From a73c800377be83f6a4ed1cc16ba32f8deef4d27f Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 30 Nov 2014 11:11:47 +0100 Subject: Improved comments for cWorld::DoWithPlayer(). --- src/World.cpp | 2 +- src/World.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/World.cpp b/src/World.cpp index 0dec0bd96..84d40d53b 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2678,7 +2678,7 @@ bool cWorld::ForEachPlayer(cPlayerListCallback & a_Callback) bool cWorld::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) { - // Calls the callback for each player in the list + // Calls the callback for the specified player in the list cCSLock Lock(m_CSPlayers); for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { diff --git a/src/World.h b/src/World.h index 68d0654ee..31bc9dad6 100644 --- a/src/World.h +++ b/src/World.h @@ -315,7 +315,8 @@ public: /** Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true */ virtual bool ForEachPlayer(cPlayerListCallback & a_Callback) override; // >> EXPORTED IN MANUALBINDINGS << - /** Calls the callback for the player of the given name; returns true if the player was found and the callback called, false if player not found. Callback return ignored */ + /** Calls the callback for the player of the given name; returns true if the player was found and the callback called, false if player not found. + Callback return value is ignored. If there are multiple players of the same name, only (random) one is processed by the callback. */ bool DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS << /** Finds a player from a partial or complete player name and calls the callback - case-insensitive */ -- cgit v1.2.3 From 7049db5bf88e6a75f108fa0640dfb9ada85fadff Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 30 Nov 2014 14:23:51 +0100 Subject: Fixed compiling on linux. --- src/OSSupport/StackTrace.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OSSupport/StackTrace.cpp b/src/OSSupport/StackTrace.cpp index 57c547fa1..a56568457 100644 --- a/src/OSSupport/StackTrace.cpp +++ b/src/OSSupport/StackTrace.cpp @@ -9,6 +9,7 @@ #include "../StackWalker.h" #else #include + #include #endif -- cgit v1.2.3 From 65dc452923f8db74f0fcb3869d4301cb10ee1ca6 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 30 Nov 2014 16:34:41 +0100 Subject: Fixed nether ceiling --- src/Generating/CompoGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index 23cc64d78..6c3b50b4e 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -324,7 +324,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc: CeilingDisguise = -CeilingDisguise; } - int CeilingDisguiseHeight = Height - 2 - (int)CeilingDisguise * 3; + int CeilingDisguiseHeight = Height - 2 - FloorC(CeilingDisguise * 3); for (int y = Height - 1; y > CeilingDisguiseHeight; y--) { -- cgit v1.2.3 From db0f791d431a7ed690139515a42a946fc35a6a36 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 30 Nov 2014 18:19:20 +0100 Subject: Fixed a crash in cSpawnPrepare. --- src/World.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/World.cpp b/src/World.cpp index 84d40d53b..5fe64ea3a 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -164,6 +164,8 @@ protected: if (m_NumPrepared >= m_MaxIdx) { m_EvtFinished.Set(); + // Must return here, because "this" may have gotten deleted by the previous line + return; } // Queue another chunk, if appropriate: -- cgit v1.2.3 From e972c52e540ca49214d378207e2064f80bcb7983 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 30 Nov 2014 18:44:44 +0100 Subject: Hopefully fixed random build fails --- src/Generating/FinishGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 2ff3e7f67..1e8a67dd0 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -516,7 +516,7 @@ void cFinishGenSingleTopBlock::GenFinish(cChunkDesc & a_ChunkDesc) } int Height = a_ChunkDesc.GetHeight(x, z); - if (Height >= cChunkDef::Height) + if (Height >= cChunkDef::Height - 1) { // Too high up continue; -- cgit v1.2.3