OpenTTD Source: src/crashlog.cpp Source File

OpenTTD Source 1.11.0-RC1

crashlog.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10 #include "stdafx.h"
11 #include "crashlog.h"
12 #include "gamelog.h"
13 #include "date_func.h"
14 #include "map_func.h"
15 #include "rev.h"
16 #include "strings_func.h"
17 #include "blitter/factory.hpp"
18 #include "base_media_base.h"
19 #include "music/music_driver.hpp"
20 #include "sound/sound_driver.hpp"
21 #include "video/video_driver.hpp"
22 #include "saveload/saveload.h"
23 #include "screenshot.h"
24 #include "gfx_func.h"
25 #include "network/network.h"
26 #include "language.h"
27 #include "fontcache.h"
28 #include "news_gui.h"
29
30 #include "ai/ai_info.hpp"
31 #include "game/game.hpp"
32 #include "game/game_info.hpp"
33 #include "company_base.h"
34 #include "company_func.h"
35
36 #include <time.h>
37
38 #ifdef WITH_ALLEGRO
39 # include <allegro.h>
40 #endif /* WITH_ALLEGRO */
41 #ifdef WITH_FONTCONFIG
42 # include <fontconfig/fontconfig.h>
43 #endif /* WITH_FONTCONFIG */
44 #ifdef WITH_PNG
45 /* pngconf.h, included by png.h doesn't like something in the
46 * freetype headers. As such it's not alphabetically sorted. */
47 # include <png.h>
48 #endif /* WITH_PNG */
49 #ifdef WITH_FREETYPE
50 # include <ft2build.h>
51 # include FT_FREETYPE_H
52 #endif /* WITH_FREETYPE */
53 #if defined(WITH_ICU_LX) || defined(WITH_ICU_I18N)
54 # include <unicode/uversion.h>
55 #endif /* WITH_ICU_LX || WITH_ICU_I18N */
56 #ifdef WITH_LIBLZMA
57 # include <lzma.h>
58 #endif
59 #ifdef WITH_LZO
60 #include <lzo/lzo1x.h>
61 #endif
62 #if defined(WITH_SDL) || defined(WITH_SDL2)
63 # include <SDL.h>
64 #endif /* WITH_SDL || WITH_SDL2 */
65 #ifdef WITH_ZLIB
66 # include <zlib.h>
67 #endif
68
69 #include "safeguards.h"
70
71 /* static */ const char *CrashLog::message = nullptr;
72 /* static */ char *CrashLog::gamelog_buffer = nullptr;
73 /* static */ const char *CrashLog::gamelog_last = nullptr;
74
75 char *CrashLog::LogCompiler(char *buffer, const char *last) const
76 {
77 buffer += seprintf(buffer, last, " Compiler: "
78 #if defined(_MSC_VER)
79 "MSVC %d", _MSC_VER
80 #elif defined(__ICC) && defined(__GNUC__)
81 "ICC %d (GCC %d.%d.%d mode)", __ICC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
82 #elif defined(__ICC)
83 "ICC %d", __ICC
84 #elif defined(__GNUC__)
85 "GCC %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
86 #elif defined(__WATCOMC__)
87 "WatcomC %d", __WATCOMC__
88 #else
89 "<unknown>"
90 #endif
91 );
92 #if defined(__VERSION__)
93 return buffer + seprintf(buffer, last, " \"" __VERSION__ "\"\n\n");
94 #else
95 return buffer + seprintf(buffer, last, "\n\n");
96 #endif
97 }
98
99 /* virtual */ char *CrashLog::LogRegisters(char *buffer, const char *last) const
100 {
101 /* Stub implementation; not all OSes support this. */
102 return buffer;
103 }
104
105 /* virtual */ char *CrashLog::LogModules(char *buffer, const char *last) const
106 {
107 /* Stub implementation; not all OSes support this. */
108 return buffer;
109 }
110
117 char *CrashLog::LogOpenTTDVersion(char *buffer, const char *last) const
118 {
119 return buffer + seprintf(buffer, last,
120 "OpenTTD version:\n"
121 " Version: %s (%d)\n"
122 " NewGRF ver: %08x\n"
123 " Bits: %d\n"
124 " Endian: %s\n"
125 " Dedicated: %s\n"
126 " Build date: %s\n\n",
127 _openttd_revision,
128 _openttd_revision_modified,
129 _openttd_newgrf_version,
130 #ifdef _SQ64
131 64,
132 #else
133 32,
134 #endif
135 #if (TTD_ENDIAN == TTD_LITTLE_ENDIAN)
136 "little",
137 #else
138 "big",
139 #endif
140 #ifdef DEDICATED
141 "yes",
142 #else
143 "no",
144 #endif
145 _openttd_build_date
146 );
147 }
148
156 char *CrashLog::LogConfiguration(char *buffer, const char *last) const
157 {
158 buffer += seprintf(buffer, last,
159 "Configuration:\n"
160 " Blitter: %s\n"
161 " Graphics set: %s (%u)\n"
162 " Language: %s\n"
163 " Music driver: %s\n"
164 " Music set: %s (%u)\n"
165 " Network: %s\n"
166 " Sound driver: %s\n"
167 " Sound set: %s (%u)\n"
168 " Video driver: %s\n\n",
169 BlitterFactory::GetCurrentBlitter() == nullptr ? "none" : BlitterFactory::GetCurrentBlitter()->GetName(),
170 BaseGraphics::GetUsedSet() == nullptr ? "none" : BaseGraphics::GetUsedSet()->name.c_str(),
171 BaseGraphics::GetUsedSet() == nullptr ? UINT32_MAX : BaseGraphics::GetUsedSet()->version,
172 _current_language == nullptr ? "none" : _current_language->file,
173 MusicDriver::GetInstance() == nullptr ? "none" : MusicDriver::GetInstance()->GetName(),
174 BaseMusic::GetUsedSet() == nullptr ? "none" : BaseMusic::GetUsedSet()->name.c_str(),
175 BaseMusic::GetUsedSet() == nullptr ? UINT32_MAX : BaseMusic::GetUsedSet()->version,
176 _networking ? (_network_server ? "server" : "client") : "no",
177 SoundDriver::GetInstance() == nullptr ? "none" : SoundDriver::GetInstance()->GetName(),
178 BaseSounds::GetUsedSet() == nullptr ? "none" : BaseSounds::GetUsedSet()->name.c_str(),
179 BaseSounds::GetUsedSet() == nullptr ? UINT32_MAX : BaseSounds::GetUsedSet()->version,
180 VideoDriver::GetInstance() == nullptr ? "none" : VideoDriver::GetInstance()->GetName()
181 );
182
183 buffer += seprintf(buffer, last,
184 "Fonts:\n"
185 " Small: %s\n"
186 " Medium: %s\n"
187 " Large: %s\n"
188 " Mono: %s\n\n",
189 FontCache::Get(FS_SMALL)->GetFontName(),
190 FontCache::Get(FS_NORMAL)->GetFontName(),
191 FontCache::Get(FS_LARGE)->GetFontName(),
192 FontCache::Get(FS_MONO)->GetFontName()
193 );
194
195 buffer += seprintf(buffer, last, "AI Configuration (local: %i) (current: %i):\n", (int)_local_company, (int)_current_company);
196 for (const Company *c : Company::Iterate()) {
197 if (c->ai_info == nullptr) {
198 buffer += seprintf(buffer, last, " %2i: Human\n", (int)c->index);
199 } else {
200 buffer += seprintf(buffer, last, " %2i: %s (v%d)\n", (int)c->index, c->ai_info->GetName(), c->ai_info->GetVersion());
201 }
202 }
203
204 if (Game::GetInfo() != nullptr) {
205 buffer += seprintf(buffer, last, " GS: %s (v%d)\n", Game::GetInfo()->GetName(), Game::GetInfo()->GetVersion());
206 }
207 buffer += seprintf(buffer, last, "\n");
208
209 return buffer;
210 }
211
218 char *CrashLog::LogLibraries(char *buffer, const char *last) const
219 {
220 buffer += seprintf(buffer, last, "Libraries:\n");
221
222 #ifdef WITH_ALLEGRO
223 buffer += seprintf(buffer, last, " Allegro: %s\n", allegro_id);
224 #endif /* WITH_ALLEGRO */
225
226 #ifdef WITH_FONTCONFIG
227 int version = FcGetVersion();
228 buffer += seprintf(buffer, last, " FontConfig: %d.%d.%d\n", version / 10000, (version / 100) % 100, version % 100);
229 #endif /* WITH_FONTCONFIG */
230
231 #ifdef WITH_FREETYPE
232 FT_Library library;
233 int major, minor, patch;
234 FT_Init_FreeType(&library);
235 FT_Library_Version(library, &major, &minor, &patch);
236 FT_Done_FreeType(library);
237 buffer += seprintf(buffer, last, " FreeType: %d.%d.%d\n", major, minor, patch);
238 #endif /* WITH_FREETYPE */
239
240 #if defined(WITH_ICU_LX) || defined(WITH_ICU_I18N)
241 /* 4 times 0-255, separated by dots (.) and a trailing '\0' */
242 char buf[4 * 3 + 3 + 1];
243 UVersionInfo ver;
244 u_getVersion(ver);
245 u_versionToString(ver, buf);
246 #ifdef WITH_ICU_I18N
247 buffer += seprintf(buffer, last, " ICU i18n: %s\n", buf);
248 #endif
249 #ifdef WITH_ICU_LX
250 buffer += seprintf(buffer, last, " ICU lx: %s\n", buf);
251 #endif
252 #endif /* WITH_ICU_LX || WITH_ICU_I18N */
253
254 #ifdef WITH_LIBLZMA
255 buffer += seprintf(buffer, last, " LZMA: %s\n", lzma_version_string());
256 #endif
257
258 #ifdef WITH_LZO
259 buffer += seprintf(buffer, last, " LZO: %s\n", lzo_version_string());
260 #endif
261
262 #ifdef WITH_PNG
263 buffer += seprintf(buffer, last, " PNG: %s\n", png_get_libpng_ver(nullptr));
264 #endif /* WITH_PNG */
265
266 #ifdef WITH_SDL
267 const SDL_version *sdl_v = SDL_Linked_Version();
268 buffer += seprintf(buffer, last, " SDL1: %d.%d.%d\n", sdl_v->major, sdl_v->minor, sdl_v->patch);
269 #elif defined(WITH_SDL2)
270 SDL_version sdl2_v;
271 SDL_GetVersion(&sdl2_v);
272 buffer += seprintf(buffer, last, " SDL2: %d.%d.%d\n", sdl2_v.major, sdl2_v.minor, sdl2_v.patch);
273 #endif
274
275 #ifdef WITH_ZLIB
276 buffer += seprintf(buffer, last, " Zlib: %s\n", zlibVersion());
277 #endif
278
279 buffer += seprintf(buffer, last, "\n");
280 return buffer;
281 }
282
287 /* static */ void CrashLog::GamelogFillCrashLog(const char *s)
288 {
289 CrashLog::gamelog_buffer += seprintf(CrashLog::gamelog_buffer, CrashLog::gamelog_last, "%s\n", s);
290 }
291
298 char *CrashLog::LogGamelog(char *buffer, const char *last) const
299 {
300 CrashLog::gamelog_buffer = buffer;
301 CrashLog::gamelog_last = last;
302 GamelogPrint(&CrashLog::GamelogFillCrashLog);
303 return CrashLog::gamelog_buffer + seprintf(CrashLog::gamelog_buffer, last, "\n");
304 }
305
312 char *CrashLog::LogRecentNews(char *buffer, const char *last) const
313 {
314 buffer += seprintf(buffer, last, "Recent news messages:\n");
315
316 int i = 0;
317 for (NewsItem *news = _latest_news; i < 32 && news != nullptr; news = news->prev, i++) {
318 YearMonthDay ymd;
319 ConvertDateToYMD(news->date, &ymd);
320 buffer += seprintf(buffer, last, "(%i-%02i-%02i) StringID: %u, Type: %u, Ref1: %u, %u, Ref2: %u, %u\n",
321 ymd.year, ymd.month + 1, ymd.day, news->string_id, news->type,
322 news->reftype1, news->ref1, news->reftype2, news->ref2);
323 }
324 buffer += seprintf(buffer, last, "\n");
325 return buffer;
326 }
327
334 char *CrashLog::FillCrashLog(char *buffer, const char *last) const
335 {
336 time_t cur_time = time(nullptr);
337 buffer += seprintf(buffer, last, "*** OpenTTD Crash Report ***\n\n");
338 buffer += seprintf(buffer, last, "Crash at: %s", asctime(gmtime(&cur_time)));
339
340 YearMonthDay ymd;
341 ConvertDateToYMD(_date, &ymd);
342 buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i)\n\n", ymd.year, ymd.month + 1, ymd.day, _date_fract);
343
344 buffer = this->LogError(buffer, last, CrashLog::message);
345 buffer = this->LogOpenTTDVersion(buffer, last);
346 buffer = this->LogRegisters(buffer, last);
347 buffer = this->LogStacktrace(buffer, last);
348 buffer = this->LogOSVersion(buffer, last);
349 buffer = this->LogCompiler(buffer, last);
350 buffer = this->LogConfiguration(buffer, last);
351 buffer = this->LogLibraries(buffer, last);
352 buffer = this->LogModules(buffer, last);
353 buffer = this->LogGamelog(buffer, last);
354 buffer = this->LogRecentNews(buffer, last);
355
356 buffer += seprintf(buffer, last, "*** End of OpenTTD Crash Report ***\n");
357 return buffer;
358 }
359
369 bool CrashLog::WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const
370 {
371 seprintf(filename, filename_last, "%scrash.log", _personal_dir.c_str());
372
373 FILE *file = FioFOpenFile(filename, "w", NO_DIRECTORY);
374 if (file == nullptr) return false;
375
376 size_t len = strlen(buffer);
377 size_t written = fwrite(buffer, 1, len, file);
378
379 FioFCloseFile(file);
380 return len == written;
381 }
382
383 /* virtual */ int CrashLog::WriteCrashDump(char *filename, const char *filename_last) const
384 {
385 /* Stub implementation; not all OSes support this. */
386 return 0;
387 }
388
397 bool CrashLog::WriteSavegame(char *filename, const char *filename_last) const
398 {
399 /* If the map array doesn't exist, saving will fail too. If the map got
400 * initialised, there is a big chance the rest is initialised too. */
401 if (_m == nullptr) return false;
402
403 try {
404 GamelogEmergency();
405
406 seprintf(filename, filename_last, "%scrash.sav", _personal_dir.c_str());
407
408 /* Don't do a threaded saveload. */
409 return SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, NO_DIRECTORY, false) == SL_OK;
410 } catch (...) {
411 return false;
412 }
413 }
414
423 bool CrashLog::WriteScreenshot(char *filename, const char *filename_last) const
424 {
425 /* Don't draw when we have invalid screen size */
426 if (_screen.width < 1 || _screen.height < 1 || _screen.dst_ptr == nullptr) return false;
427
428 bool res = MakeScreenshot(SC_CRASHLOG, "crash");
429 if (res) strecpy(filename, _full_screenshot_name, filename_last);
430 return res;
431 }
432
439 bool CrashLog::MakeCrashLog() const
440 {
441 /* Don't keep looping logging crashes. */
442 static bool crashlogged = false;
443 if (crashlogged) return false;
444 crashlogged = true;
445
446 char filename[MAX_PATH];
447 char buffer[65536];
448 bool ret = true;
449
450 printf("Crash encountered, generating crash log...\n");
451 this->FillCrashLog(buffer, lastof(buffer));
452 printf("%s\n", buffer);
453 printf("Crash log generated.\n\n");
454
455 printf("Writing crash log to disk...\n");
456 bool bret = this->WriteCrashLog(buffer, filename, lastof(filename));
457 if (bret) {
458 printf("Crash log written to %s. Please add this file to any bug reports.\n\n", filename);
459 } else {
460 printf("Writing crash log failed. Please attach the output above to any bug reports.\n\n");
461 ret = false;
462 }
463
464 /* Don't mention writing crash dumps because not all platforms support it. */
465 int dret = this->WriteCrashDump(filename, lastof(filename));
466 if (dret < 0) {
467 printf("Writing crash dump failed.\n\n");
468 ret = false;
469 } else if (dret > 0) {
470 printf("Crash dump written to %s. Please add this file to any bug reports.\n\n", filename);
471 }
472
473 printf("Writing crash savegame...\n");
474 bret = this->WriteSavegame(filename, lastof(filename));
475 if (bret) {
476 printf("Crash savegame written to %s. Please add this file and the last (auto)save to any bug reports.\n\n", filename);
477 } else {
478 ret = false;
479 printf("Writing crash savegame failed. Please attach the last (auto)save to any bug reports.\n\n");
480 }
481
482 printf("Writing crash screenshot...\n");
483 bret = this->WriteScreenshot(filename, lastof(filename));
484 if (bret) {
485 printf("Crash screenshot written to %s. Please add this file to any bug reports.\n\n", filename);
486 } else {
487 ret = false;
488 printf("Writing crash screenshot failed.\n\n");
489 }
490
491 return ret;
492 }
493
498 /* static */ void CrashLog::SetErrorMessage(const char *message)
499 {
500 CrashLog::message = message;
501 }
502
507 /* static */ void CrashLog::AfterCrashLogCleanup()
508 {
509 if (MusicDriver::GetInstance() != nullptr) MusicDriver::GetInstance()->Stop();
510 if (SoundDriver::GetInstance() != nullptr) SoundDriver::GetInstance()->Stop();
511 if (VideoDriver::GetInstance() != nullptr) VideoDriver::GetInstance()->Stop();
512 }
game.hpp
CrashLog::LogLibraries
char * LogLibraries(char *buffer, const char *last) const
Writes information (versions) of the used libraries.
Definition: crashlog.cpp:218
YearMonthDay::day
Day day
Day (1..31)
Definition: date_type.h:106
factory.hpp
Driver::GetName
virtual const char * GetName() const =0
Get the name of this driver.
CrashLog::MakeCrashLog
bool MakeCrashLog() const
Makes the crash log, writes it to a file and then subsequently tries to make a crash dump and crash s...
Definition: crashlog.cpp:439
game_info.hpp
_personal_dir
std::string _personal_dir
custom directory for personal settings, saves, newgrf, etc.
Definition: fileio.cpp:1119
CrashLog::AfterCrashLogCleanup
static void AfterCrashLogCleanup()
Try to close the sound/video stuff so it doesn't keep lingering around incorrect video states or so,...
Definition: crashlog.cpp:507
NewsItem
Information about a single item of news.
Definition: news_type.h:119
company_base.h
CrashLog::WriteScreenshot
bool WriteScreenshot(char *filename, const char *filename_last) const
Write the (crash) screenshot to a file.
Definition: crashlog.cpp:423
SaveOrLoad
SaveOrLoadResult SaveOrLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded)
Main Save or Load function where the high-level saveload functions are handled.
Definition: saveload.cpp:2764
_date_fract
DateFract _date_fract
Fractional part of the day.
Definition: date.cpp:29
_network_server
bool _network_server
network-server is active
Definition: network.cpp:53
BaseSet::name
std::string name
The name of the base set.
Definition: base_media_base.h:61
CrashLog::LogConfiguration
char * LogConfiguration(char *buffer, const char *last) const
Writes the (important) configuration settings to the buffer.
Definition: crashlog.cpp:156
Game::GetInfo
static class GameInfo * GetInfo()
Get the current GameInfo.
Definition: game.hpp:80
CrashLog::LogOpenTTDVersion
char * LogOpenTTDVersion(char *buffer, const char *last) const
Writes OpenTTD's version to the buffer.
Definition: crashlog.cpp:117
map_func.h
FS_LARGE
@ FS_LARGE
Index of the large font in the font tables.
Definition: gfx_type.h:209
DFT_GAME_FILE
@ DFT_GAME_FILE
Save game or scenario file.
Definition: fileio_type.h:31
saveload.h
base_media_base.h
BaseSet::version
uint32 version
The version of this base set.
Definition: base_media_base.h:64
CrashLog::LogOSVersion
virtual char * LogOSVersion(char *buffer, const char *last) const =0
Writes OS' version to the buffer.
CrashLog::gamelog_buffer
static char * gamelog_buffer
Temporary 'local' location of the buffer.
Definition: crashlog.h:22
TTD_LITTLE_ENDIAN
#define TTD_LITTLE_ENDIAN
Little endian builds use this for TTD_ENDIAN.
Definition: endian_type.hpp:22
gamelog.h
CrashLog::LogGamelog
char * LogGamelog(char *buffer, const char *last) const
Writes the gamelog data to the buffer.
Definition: crashlog.cpp:298
ai_info.hpp
screenshot.h
gfx_func.h
GamelogPrint
void GamelogPrint(GamelogPrintProc *proc)
Prints active gamelog.
Definition: gamelog.cpp:192
_date
Date _date
Current date in days (day counter)
Definition: date.cpp:28
SLO_SAVE
@ SLO_SAVE
File is being saved.
Definition: fileio_type.h:50
MusicDriver::GetInstance
static MusicDriver * GetInstance()
Get the currently active instance of the music driver.
Definition: music_driver.hpp:46
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition: gfx_type.h:207
CrashLog::LogModules
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...
Definition: crashlog.cpp:105
YearMonthDay::month
Month month
Month (0..11)
Definition: date_type.h:105
CrashLog::LogRecentNews
char * LogRecentNews(char *buffer, const char *list) const
Writes up to 32 recent news messages to the buffer, with the most recent first.
Definition: crashlog.cpp:312
FioFOpenFile
FILE * FioFOpenFile(const std::string &filename, const char *mode, Subdirectory subdir, size_t *filesize)
Opens a OpenTTD file somewhere in a personal or global directory.
Definition: fileio.cpp:406
FS_SMALL
@ FS_SMALL
Index of the small font in the font tables.
Definition: gfx_type.h:208
CrashLog::SetErrorMessage
static void SetErrorMessage(const char *message)
Sets a message for the error message handler.
Definition: crashlog.cpp:498
BlitterFactory::GetCurrentBlitter
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Definition: factory.hpp:140
GamelogEmergency
void GamelogEmergency()
Logs a emergency savegame.
Definition: gamelog.cpp:408
ConvertDateToYMD
void ConvertDateToYMD(Date date, YearMonthDay *ymd)
Converts a Date to a Year, Month & Day.
Definition: date.cpp:94
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
CrashLog::message
static const char * message
Pointer to the error message.
Definition: crashlog.h:19
_current_language
const LanguageMetadata * _current_language
The currently loaded language.
Definition: strings.cpp:46
safeguards.h
music_driver.hpp
CrashLog::LogRegisters
virtual char * LogRegisters(char *buffer, const char *last) const
Writes information about the data in the registers, if there is information about it available.
Definition: crashlog.cpp:99
_networking
bool _networking
are we in networking mode?
Definition: network.cpp:52
NewsItem::prev
NewsItem * prev
Previous news item.
Definition: news_type.h:120
CrashLog::WriteCrashDump
virtual int WriteCrashDump(char *filename, const char *filename_last) const
Write the (crash) dump to a file.
Definition: crashlog.cpp:383
LanguageMetadata::file
char file[MAX_PATH]
Name of the file we read this data from.
Definition: language.h:93
language.h
date_func.h
stdafx.h
VideoDriver::GetInstance
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
Definition: video_driver.hpp:187
CrashLog::LogError
virtual char * LogError(char *buffer, const char *last, const char *message) const =0
Writes actually encountered error to the buffer.
sound_driver.hpp
CrashLog::LogCompiler
virtual char * LogCompiler(char *buffer, const char *last) const
Writes compiler (and its version, if available) to the buffer.
Definition: crashlog.cpp:75
YearMonthDay::year
Year year
Year (0...)
Definition: date_type.h:104
_current_company
CompanyID _current_company
Company currently doing an action.
Definition: company_cmd.cpp:47
rev.h
Pool::PoolItem<&_company_pool >::Iterate
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Definition: pool_type.hpp:378
strings_func.h
MakeScreenshot
bool MakeScreenshot(ScreenshotType t, const char *name, uint32 width, uint32 height)
Make a screenshot.
Definition: screenshot.cpp:899
video_driver.hpp
CrashLog::GamelogFillCrashLog
static void GamelogFillCrashLog(const char *s)
Helper function for printing the gamelog.
Definition: crashlog.cpp:287
CrashLog::WriteSavegame
bool WriteSavegame(char *filename, const char *filename_last) const
Write the (crash) savegame to a file.
Definition: crashlog.cpp:397
NO_DIRECTORY
@ NO_DIRECTORY
A path without any base directory.
Definition: fileio_type.h:125
CrashLog::gamelog_last
static const char * gamelog_last
Temporary 'local' location of the end of the buffer.
Definition: crashlog.h:25
news_gui.h
seprintf
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
Definition: string.cpp:442
company_func.h
_full_screenshot_name
char _full_screenshot_name[MAX_PATH]
Pathname of the screenshot file.
Definition: screenshot.cpp:41
network.h
_latest_news
NewsItem * _latest_news
tail of news items queue
Definition: news_gui.cpp:51
YearMonthDay
Data structure to convert between Date and triplet (year, month, and day).
Definition: date_type.h:103
FS_MONO
@ FS_MONO
Index of the monospaced font in the font tables.
Definition: gfx_type.h:210
SoundDriver::GetInstance
static SoundDriver * GetInstance()
Get the currently active instance of the sound driver.
Definition: sound_driver.hpp:35
crashlog.h
fontcache.h
CrashLog::FillCrashLog
char * FillCrashLog(char *buffer, const char *last) const
Fill the crash log buffer with all data of a crash log.
Definition: crashlog.cpp:334
CrashLog::WriteCrashLog
bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const
Write the crash log to a file.
Definition: crashlog.cpp:369
SC_CRASHLOG
@ SC_CRASHLOG
Raw screenshot from blitter buffer.
Definition: screenshot.h:20
BaseMedia< GraphicsSet >::GetUsedSet
static const GraphicsSet * GetUsedSet()
Return the used set.
Definition: base_media_func.h:357
strecpy
char * strecpy(char *dst, const char *src, const char *last)
Copies characters from one buffer to another.
Definition: string.cpp:112
Company
Definition: company_base.h:110
Driver::Stop
virtual void Stop()=0
Stop this driver.
lastof
#define lastof(x)
Get the last element of an fixed size array.
Definition: stdafx.h:383
SL_OK
@ SL_OK
completed successfully
Definition: saveload.h:333
_m
Tile * _m
Tiles of the map.
Definition: map.cpp:30
CrashLog::LogStacktrace
virtual char * LogStacktrace(char *buffer, const char *last) const =0
Writes the stack trace to the buffer, if there is information about it available.
FioFCloseFile
void FioFCloseFile(FILE *f)
Close a file in a safe way.
Definition: fileio.cpp:288
FontCache::Get
static FontCache * Get(FontSize fs)
Get the font cache of a given font size.
Definition: fontcache.h:149