More debug logs

This commit is contained in:
Sergii Pylypenko
2018-01-29 21:23:41 +02:00
parent 613faa31ec
commit 109a5e8d82
3 changed files with 12 additions and 5 deletions

View File

@@ -203,7 +203,7 @@ static inline bool IsValidNewGRFImageIndex(uint8 image_index)
return image_index == 0xFD || IsValidImageIndex<T>(image_index);
}
class OTTDByteReaderSignal { };
class OTTDByteReaderSignal: public std::runtime_error { public: OTTDByteReaderSignal():std::runtime_error("OTTDByteReaderSignal: NewGRF byte data invalid") {} };
/** Class to read from a NewGRF file */
class ByteReader {

View File

@@ -70,6 +70,7 @@
#include "safeguards.h"
#ifdef __ANDROID__
#include <unistd.h>
#include <SDL_android.h>
#endif
#include <limits.h>
@@ -501,7 +502,7 @@ struct AfterNewGRFScan : NewGRFScanCallback {
unlink("libsdl-DownloadFinished-1.flag");
//_exit_game = true;
//_restart_game = true;
abort(); // Kill myself with contempt, user will restart the app, because otherwise we enter infinite restart loop
_exit(0); // kill(getpid(), SIG_KILL); //abort(); // Kill myself with contempt, user will restart the app, because otherwise we enter infinite restart loop
}
checked = true;
@@ -891,7 +892,15 @@ int openttd_main(int argc, char *argv[])
ScanNewGRFFiles(scanner);
scanner = NULL;
VideoDriver::GetInstance()->MainLoop();
try {
VideoDriver::GetInstance()->MainLoop();
} catch (const std::exception & e) {
DEBUG(misc, 0, "Main thread got exception: %s", e.what());
throw;
} catch (...) {
DEBUG(misc, 0, "Main thread got unknown exception");
throw;
}
WaitTillSaved();

View File

@@ -12,5 +12,3 @@
- New game crashes with AdmiralAI enabled.
- 'Title bars' text should be black, and the button should be bigger.
- AI crashes the game.