]> git.lizzy.rs Git - minetest.git/blobdiff - src/debug.cpp
Firelike drawtype: Add missing docs for visual_scale in lua_api.txt (#5434)
[minetest.git] / src / debug.cpp
index 9f10426467309c7cede129ef3014f2501c63857d..8647160b1bed7c20cae3dae6e035bfc23bef521e 100644 (file)
@@ -37,6 +37,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
        #include "filesys.h"
 #endif
 
+#if USE_CURSES
+       #include "terminal_chat_console.h"
+#endif
+
 /*
        Assert
 */
@@ -44,8 +48,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 void sanity_check_fn(const char *assertion, const char *file,
                unsigned int line, const char *function)
 {
+#if USE_CURSES
+       g_term_console.stopAndWaitforThread();
+#endif
+
        errorstream << std::endl << "In thread " << std::hex
-               << (unsigned long)thr_get_current_thread_id() << ":" << std::endl;
+               << thr_get_current_thread_id() << ":" << std::endl;
        errorstream << file << ":" << line << ": " << function
                << ": An engine assumption '" << assertion << "' failed." << std::endl;
 
@@ -57,8 +65,12 @@ void sanity_check_fn(const char *assertion, const char *file,
 void fatal_error_fn(const char *msg, const char *file,
                unsigned int line, const char *function)
 {
+#if USE_CURSES
+       g_term_console.stopAndWaitforThread();
+#endif
+
        errorstream << std::endl << "In thread " << std::hex
-               << (unsigned long)thr_get_current_thread_id() << ":" << std::endl;
+               << thr_get_current_thread_id() << ":" << std::endl;
        errorstream << file << ":" << line << ": " << function
                << ": A fatal error occured: " << msg << std::endl;
 
@@ -93,8 +105,10 @@ DebugStack::DebugStack(threadid_t id)
 
 void DebugStack::print(FILE *file, bool everything)
 {
-       fprintf(file, "DEBUG STACK FOR THREAD %lx:\n",
-                       (unsigned long)threadid);
+       std::ostringstream os;
+       os << threadid;
+       fprintf(file, "DEBUG STACK FOR THREAD %s:\n",
+               os.str().c_str());
 
        for(int i=0; i<stack_max_i; i++)
        {
@@ -113,7 +127,7 @@ void DebugStack::print(FILE *file, bool everything)
 
 void DebugStack::print(std::ostream &os, bool everything)
 {
-       os<<"DEBUG STACK FOR THREAD "<<(unsigned long)threadid<<": "<<std::endl;
+       os<<"DEBUG STACK FOR THREAD "<<threadid<<": "<<std::endl;
 
        for(int i=0; i<stack_max_i; i++)
        {