Merge branch 'cpp-11' into crashlog_improvements

# Conflicts:
#	Makefile.src.in
#	src/crashlog.cpp
#	src/crashlog.h
This commit is contained in:
Jonathan G Rennison
2018-04-27 00:33:44 +01:00
253 changed files with 9829 additions and 2475 deletions

View File

@@ -28,6 +28,7 @@
#include "network/network.h"
#include "language.h"
#include "fontcache.h"
#include "news_gui.h"
#include "scope_info.h"
#include "command_func.h"
#include "thread/thread.h"
@@ -329,6 +330,27 @@ char *CrashLog::LogGamelog(char *buffer, const char *last) const
return CrashLog::gamelog_buffer + seprintf(CrashLog::gamelog_buffer, last, "\n");
}
/**
* Writes any recent news messages to the buffer.
* @param buffer The begin where to write at.
* @param last The last position in the buffer to write to.
* @return the position of the \c '\0' character after the buffer.
*/
char *CrashLog::LogRecentNews(char *buffer, const char *last) const
{
buffer += seprintf(buffer, last, "Recent news messages:\n");
for (NewsItem *news = _oldest_news; news != NULL; news = news->next) {
YearMonthDay ymd;
ConvertDateToYMD(news->date, &ymd);
buffer += seprintf(buffer, last, "(%i-%02i-%02i) StringID: %u, Type: %u, Ref1: %u, %u, Ref2: %u, %u\n",
ymd.year, ymd.month + 1, ymd.day, news->string_id, news->type,
news->reftype1, news->ref1, news->reftype2, news->ref2);
}
buffer += seprintf(buffer, last, "\n");
return buffer;
}
/**
* Writes the command log data to the buffer.
* @param buffer The begin where to write at.
@@ -384,6 +406,7 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last) const
buffer = this->LogLibraries(buffer, last);
buffer = this->LogModules(buffer, last);
buffer = this->LogGamelog(buffer, last);
buffer = this->LogRecentNews(buffer, last);
buffer = this->LogCommandLog(buffer, last);
buffer += seprintf(buffer, last, "*** End of OpenTTD Crash Report ***\n");