42 #ifdef WITH_FONTCONFIG 43 # include <fontconfig/fontconfig.h> 51 # include <ft2build.h> 52 # include FT_FREETYPE_H 54 #if defined(WITH_ICU_LAYOUT) || defined(WITH_ICU_SORT) 55 # include <unicode/uversion.h> 61 #include <lzo/lzo1x.h> 79 buffer +=
seprintf(buffer, last,
" Compiler: " 82 #elif defined(__ICC) && defined(__GNUC__)
83 "ICC %d (GCC %d.%d.%d mode)", __ICC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
86 #elif defined(__GNUC__)
87 "GCC %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
88 #elif defined(__WATCOMC__)
89 "WatcomC %d", __WATCOMC__
94 #if defined(__VERSION__) 95 return buffer +
seprintf(buffer, last,
" \"" __VERSION__
"\"\n\n");
97 return buffer +
seprintf(buffer, last,
"\n\n");
121 return buffer +
seprintf(buffer, last,
123 " Version: %s (%d)\n" 124 " NewGRF ver: %08x\n" 128 " Build date: %s\n\n",
130 _openttd_revision_modified,
131 _openttd_newgrf_version,
163 " Graphics set: %s (%u)\n" 165 " Music driver: %s\n" 166 " Music set: %s (%u)\n" 168 " Sound driver: %s\n" 169 " Sound set: %s (%u)\n" 170 " Video driver: %s\n\n",
199 FOR_ALL_COMPANIES(c) {
200 if (c->ai_info == NULL) {
201 buffer +=
seprintf(buffer, last,
" %2i: Human\n", (
int)c->
index);
210 buffer +=
seprintf(buffer, last,
"\n");
223 buffer +=
seprintf(buffer, last,
"Libraries:\n");
226 buffer +=
seprintf(buffer, last,
" Allegro: %s\n", allegro_id);
229 #ifdef WITH_FONTCONFIG 230 int version = FcGetVersion();
231 buffer +=
seprintf(buffer, last,
" FontConfig: %d.%d.%d\n", version / 10000, (version / 100) % 100, version % 100);
236 int major, minor, patch;
237 FT_Init_FreeType(&library);
238 FT_Library_Version(library, &major, &minor, &patch);
239 FT_Done_FreeType(library);
240 buffer +=
seprintf(buffer, last,
" FreeType: %d.%d.%d\n", major, minor, patch);
243 #if defined(WITH_ICU_LAYOUT) || defined(WITH_ICU_SORT) 245 char buf[4 * 3 + 3 + 1];
248 u_versionToString(ver, buf);
250 buffer +=
seprintf(buffer, last,
" ICU i18n: %s\n", buf);
252 #ifdef WITH_ICU_LAYOUT 253 buffer +=
seprintf(buffer, last,
" ICU lx: %s\n", buf);
258 buffer +=
seprintf(buffer, last,
" LZMA: %s\n", lzma_version_string());
262 buffer +=
seprintf(buffer, last,
" LZO: %s\n", lzo_version_string());
266 buffer +=
seprintf(buffer, last,
" PNG: %s\n", png_get_libpng_ver(NULL));
270 #ifdef DYNAMICALLY_LOADED_SDL 271 if (SDL_CALL SDL_Linked_Version != NULL) {
275 const SDL_version *v = SDL_CALL SDL_Linked_Version();
276 buffer +=
seprintf(buffer, last,
" SDL: %d.%d.%d\n", v->major, v->minor, v->patch);
281 buffer +=
seprintf(buffer, last,
" Zlib: %s\n", zlibVersion());
284 buffer +=
seprintf(buffer, last,
"\n");
319 time_t cur_time = time(NULL);
320 buffer +=
seprintf(buffer, last,
"*** OpenTTD Crash Report ***\n\n");
321 buffer +=
seprintf(buffer, last,
"Crash at: %s", asctime(gmtime(&cur_time)));
338 buffer +=
seprintf(buffer, last,
"*** End of OpenTTD Crash Report ***\n");
356 if (file == NULL)
return false;
358 size_t len = strlen(buffer);
359 size_t written = fwrite(buffer, 1, len, file);
362 return len == written;
383 if (
_m == NULL)
return false;
408 if (_screen.width < 1 || _screen.height < 1 || _screen.dst_ptr == NULL)
return false;
424 static bool crashlogged =
false;
425 if (crashlogged)
return false;
428 char filename[MAX_PATH];
432 printf(
"Crash encountered, generating crash log...\n");
434 printf(
"%s\n", buffer);
435 printf(
"Crash log generated.\n\n");
437 printf(
"Writing crash log to disk...\n");
440 printf(
"Crash log written to %s. Please add this file to any bug reports.\n\n", filename);
442 printf(
"Writing crash log failed. Please attach the output above to any bug reports.\n\n");
449 printf(
"Writing crash dump failed.\n\n");
451 }
else if (dret > 0) {
452 printf(
"Crash dump written to %s. Please add this file to any bug reports.\n\n", filename);
455 printf(
"Writing crash savegame...\n");
458 printf(
"Crash savegame written to %s. Please add this file and the last (auto)save to any bug reports.\n\n", filename);
461 printf(
"Writing crash savegame failed. Please attach the last (auto)save to any bug reports.\n\n");
464 printf(
"Writing crash screenshot...\n");
467 printf(
"Crash screenshot written to %s. Please add this file to any bug reports.\n\n", filename);
470 printf(
"Writing crash screenshot failed.\n\n");
Functions related to OTTD's strings.
void GamelogPrint(GamelogPrintProc *proc)
Prints active gamelog.
int GetVersion() const
Get the version of the script.
Definition of stuff that is very close to a company, like the company struct itself.
char _full_screenshot_name[MAX_PATH]
Pathname of the screenshot file.
bool _networking
are we in networking mode?
Base of all video drivers.
void GamelogEmergency()
Logs a emergency savegame.
bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const
Write the crash log to a file.
void FioFCloseFile(FILE *f)
Close a file in a safe way.
Functions related to dates.
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
static const char * gamelog_last
Temporary 'local' location of the end of the buffer.
const char * GetName() const
Get the Name of the script.
Index of the monospaced font in the font tables.
Functions to be called to log possibly unsafe game events.
virtual char * LogError(char *buffer, const char *last, const char *message) const =0
Writes actually encountered error to the buffer.
Tile * _m
Tiles of the map.
const LanguageMetadata * _current_language
The currently loaded language.
Base for all sound drivers.
Tindex index
Index of this pool item.
#define lastof(x)
Get the last element of an fixed size array.
Functions to make screenshots.
Functions related to maps.
static FontCache * Get(FontSize fs)
Get the font cache of a given font size.
virtual int WriteCrashDump(char *filename, const char *filename_last) const
Write the (crash) dump to a file.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Save game or scenario file.
Functions to read fonts from files and cache them.
Functions/types related to saving and loading games.
char * LogGamelog(char *buffer, const char *last) const
Writes the gamelog data to the buffer.
DateFract _date_fract
Fractional part of the day.
virtual void Stop()=0
Stop this driver.
char * LogOpenTTDVersion(char *buffer, const char *last) const
Writes OpenTTD's version to the buffer.
static const char * message
Pointer to the error message.
#define TTD_LITTLE_ENDIAN
Little endian builds use this for TTD_ENDIAN.
const char * name
The name of the base set.
Functions related to the gfx engine.
FILE * FioFOpenFile(const char *filename, const char *mode, Subdirectory subdir, size_t *filesize)
Opens a OpenTTD file somewhere in a personal or global directory.
A path without any base directory.
Base for all music playback.
Definition of base types and functions in a cross-platform compatible way.
Data structure to convert between Date and triplet (year, month, and day).
A number of safeguards to prevent using unsafe methods.
static void AfterCrashLogCleanup()
Try to close the sound/video stuff so it doesn't keep lingering around incorrect video states or so...
bool MakeCrashLog() const
Makes the crash log, writes it to a file and then subsequently tries to make a crash dump and crash s...
Information about languages and their files.
static char * gamelog_buffer
Temporary 'local' location of the buffer.
const char * _personal_dir
custom directory for personal settings, saves, newgrf, etc.
bool WriteScreenshot(char *filename, const char *filename_last) const
Write the (crash) screenshot to a file.
static MusicDriver * GetInstance()
Get the currently active instance of the music driver.
Basic functions/variables used all over the place.
SaveOrLoadResult SaveOrLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded)
Main Save or Load function where the high-level saveload functions are handled.
virtual char * LogCompiler(char *buffer, const char *last) const
Writes compiler (and its version, if available) to the buffer.
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
uint32 version
The version of this base set.
virtual const char * GetName() const =0
Get the name of this driver.
static class GameInfo * GetInfo()
Get the current GameInfo.
bool WriteSavegame(char *filename, const char *filename_last) const
Write the (crash) savegame to a file.
Functions to be called to log a crash.
bool MakeScreenshot(ScreenshotType t, const char *name)
Make an actual screenshot.
static SoundDriver * GetInstance()
Get the currently active instance of the sound driver.
GameInfo keeps track of all information of an Game, like Author, Description, ... ...
virtual char * LogStacktrace(char *buffer, const char *last) const =0
Writes the stack trace to the buffer, if there is information about it available. ...
Functions related to companies.
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
virtual char * LogOSVersion(char *buffer, const char *last) const =0
Writes OS' version to the buffer.
char * LogLibraries(char *buffer, const char *last) const
Writes information (versions) of the used libraries.
char * strecpy(char *dst, const char *src, const char *last)
Copies characters from one buffer to another.
Index of the normal font in the font tables.
Base functions for all Games.
bool _network_server
network-server is active
Index of the small font in the font tables.
Index of the large font in the font tables.
declaration of OTTD revision dependent variables
char * LogConfiguration(char *buffer, const char *last) const
Writes the (important) configuration settings to the buffer.
virtual char * LogRegisters(char *buffer, const char *last) const
Writes information about the data in the registers, if there is information about it available...
static void GamelogFillCrashLog(const char *s)
Helper function for printing the gamelog.
AIInfo keeps track of all information of an AI, like Author, Description, ...
char * FillCrashLog(char *buffer, const char *last) const
Fill the crash log buffer with all data of a crash log.
virtual char * LogModules(char *buffer, const char *last) const
Writes the dynamically linked libraries/modules to the buffer, if there is information about it avail...
Date _date
Current date in days (day counter)
Raw screenshot from blitter buffer.
void ConvertDateToYMD(Date date, YearMonthDay *ymd)
Converts a Date to a Year, Month & Day.
static void SetErrorMessage(const char *message)
Sets a message for the error message handler.
Factory to 'query' all available blitters.