Codechange: replace crashlog filenames with std::string in Crashlog

This commit is contained in:
Rubidium
2023-05-20 20:04:43 +02:00
committed by rubidium42
parent 19304bd3d5
commit 30b9e02dd9
4 changed files with 59 additions and 99 deletions

View File

@@ -40,10 +40,6 @@ class CrashLogOSX : public CrashLog {
/** Signal that has been thrown. */
int signum;
char filename_log[MAX_PATH]; ///< Path of crash.log
char filename_save[MAX_PATH]; ///< Path of crash.sav
char filename_screenshot[MAX_PATH]; ///< Path of crash.(png|bmp|pcx)
void LogOSVersion(std::back_insert_iterator<std::string> &output_iterator) const override
{
int ver_maj, ver_min, ver_bug;
@@ -149,12 +145,7 @@ public:
* A crash log is always generated by signal.
* @param signum the signal that was caused by the crash.
*/
CrashLogOSX(int signum) : signum(signum)
{
filename_log[0] = '\0';
filename_save[0] = '\0';
filename_screenshot[0] = '\0';
}
CrashLogOSX(int signum) : signum(signum) {}
/** Show a dialog with the crash information. */
void DisplayCrashDialog() const
@@ -162,14 +153,13 @@ public:
static const char crash_title[] =
"A serious fault condition occurred in the game. The game will shut down.";
char message[1024];
seprintf(message, lastof(message),
std::string message = fmt::format(
"Please send the generated crash information and the last (auto)save to the developers. "
"This will greatly help debugging. The correct place to do this is https://github.com/OpenTTD/OpenTTD/issues.\n\n"
"Generated file(s):\n%s\n%s\n%s",
this->filename_log, this->filename_save, this->filename_screenshot);
"Generated file(s):\n{}\n{}\n{}",
this->crashlog_filename, this->savegame_filename, this->screenshot_filename);
ShowMacDialog(crash_title, message, "Quit");
ShowMacDialog(crash_title, message.c_str(), "Quit");
}
};