OpenTTD Source: src/crashlog.cpp Source File

OpenTTD Source 13.1

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 #include "walltime_func.h"
36
37 #ifdef WITH_ALLEGRO
38 # include <allegro.h>
39 #endif /* WITH_ALLEGRO */
40 #ifdef WITH_FONTCONFIG
41 # include <fontconfig/fontconfig.h>
42 #endif /* WITH_FONTCONFIG */
43 #ifdef WITH_PNG
44 /* pngconf.h, included by png.h doesn't like something in the
45 * freetype headers. As such it's not alphabetically sorted. */
46 # include <png.h>
47 #endif /* WITH_PNG */
48 #ifdef WITH_FREETYPE
49 # include <ft2build.h>
50 # include FT_FREETYPE_H
51 #endif /* WITH_FREETYPE */
52 #if defined(WITH_ICU_LX) || defined(WITH_ICU_I18N)
53 # include <unicode/uversion.h>
54 #endif /* WITH_ICU_LX || WITH_ICU_I18N */
55 #ifdef WITH_LIBLZMA
56 # include <lzma.h>
57 #endif
58 #ifdef WITH_LZO
59 #include <lzo/lzo1x.h>
60 #endif
61 #if defined(WITH_SDL) || defined(WITH_SDL2)
62 # include <SDL.h>
63 #endif /* WITH_SDL || WITH_SDL2 */
64 #ifdef WITH_ZLIB
65 # include <zlib.h>
66 #endif
67
68 #include "safeguards.h"
69
70 /* static */ const char *CrashLog::message = nullptr;
71 /* static */ char *CrashLog::gamelog_buffer = nullptr;
72 /* static */ const char *CrashLog::gamelog_last = nullptr;
73
74 char *CrashLog::LogCompiler(char *buffer, const char *last) const
75 {
76 buffer += seprintf(buffer, last, " Compiler: "
77 #if defined(_MSC_VER)
78 "MSVC %d", _MSC_VER
79 #elif defined(__ICC) && defined(__GNUC__)
80 "ICC %d (GCC %d.%d.%d mode)", __ICC, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
81 #elif defined(__ICC)
82 "ICC %d", __ICC
83 #elif defined(__GNUC__)
84 "GCC %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
85 #elif defined(__WATCOMC__)
86 "WatcomC %d", __WATCOMC__
87 #else
88 "<unknown>"
89 #endif
90 );
91 #if defined(__VERSION__)
92 return buffer + seprintf(buffer, last, " \"" __VERSION__ "\"\n\n");
93 #else
94 return buffer + seprintf(buffer, last, "\n\n");
95 #endif
96 }
97
98 /* virtual */ char *CrashLog::LogRegisters(char *buffer, const char *last) const
99 {
100 /* Stub implementation; not all OSes support this. */
101 return buffer;
102 }
103
104 /* virtual */ char *CrashLog::LogModules(char *buffer, const char *last) const
105 {
106 /* Stub implementation; not all OSes support this. */
107 return buffer;
108 }
109
116 char *CrashLog::LogOpenTTDVersion(char *buffer, const char *last) const
117 {
118 return buffer + seprintf(buffer, last,
119 "OpenTTD version:\n"
120 " Version: %s (%d)\n"
121 " NewGRF ver: %08x\n"
122 " Bits: %d\n"
123 " Endian: %s\n"
124 " Dedicated: %s\n"
125 " Build date: %s\n\n",
126 _openttd_revision,
127 _openttd_revision_modified,
128 _openttd_newgrf_version,
129 #ifdef POINTER_IS_64BIT
130 64,
131 #else
132 32,
133 #endif
134 #if (TTD_ENDIAN == TTD_LITTLE_ENDIAN)
135 "little",
136 #else
137 "big",
138 #endif
139 #ifdef DEDICATED
140 "yes",
141 #else
142 "no",
143 #endif
144 _openttd_build_date
145 );
146 }
147
155 char *CrashLog::LogConfiguration(char *buffer, const char *last) const
156 {
157 buffer += seprintf(buffer, last,
158 "Configuration:\n"
159 " Blitter: %s\n"
160 " Graphics set: %s (%u)\n"
161 " Language: %s\n"
162 " Music driver: %s\n"
163 " Music set: %s (%u)\n"
164 " Network: %s\n"
165 " Sound driver: %s\n"
166 " Sound set: %s (%u)\n"
167 " Video driver: %s\n\n",
168 BlitterFactory::GetCurrentBlitter() == nullptr ? "none" : BlitterFactory::GetCurrentBlitter()->GetName(),
169 BaseGraphics::GetUsedSet() == nullptr ? "none" : BaseGraphics::GetUsedSet()->name.c_str(),
170 BaseGraphics::GetUsedSet() == nullptr ? UINT32_MAX : BaseGraphics::GetUsedSet()->version,
171 _current_language == nullptr ? "none" : _current_language->file,
172 MusicDriver::GetInstance() == nullptr ? "none" : MusicDriver::GetInstance()->GetName(),
173 BaseMusic::GetUsedSet() == nullptr ? "none" : BaseMusic::GetUsedSet()->name.c_str(),
174 BaseMusic::GetUsedSet() == nullptr ? UINT32_MAX : BaseMusic::GetUsedSet()->version,
175 _networking ? (_network_server ? "server" : "client") : "no",
176 SoundDriver::GetInstance() == nullptr ? "none" : SoundDriver::GetInstance()->GetName(),
177 BaseSounds::GetUsedSet() == nullptr ? "none" : BaseSounds::GetUsedSet()->name.c_str(),
178 BaseSounds::GetUsedSet() == nullptr ? UINT32_MAX : BaseSounds::GetUsedSet()->version,
179 VideoDriver::GetInstance() == nullptr ? "none" : VideoDriver::GetInstance()->GetInfoString()
180 );
181
182 buffer += seprintf(buffer, last,
183 "Fonts:\n"
184 " Small: %s\n"
185 " Medium: %s\n"
186 " Large: %s\n"
187 " Mono: %s\n\n",
188 FontCache::Get(FS_SMALL)->GetFontName(),
189 FontCache::Get(FS_NORMAL)->GetFontName(),
190 FontCache::Get(FS_LARGE)->GetFontName(),
191 FontCache::Get(FS_MONO)->GetFontName()
192 );
193
194 buffer += seprintf(buffer, last, "AI Configuration (local: %i) (current: %i):\n", (int)_local_company, (int)_current_company);
195 for (const Company *c : Company::Iterate()) {
196 if (c->ai_info == nullptr) {
197 buffer += seprintf(buffer, last, " %2i: Human\n", (int)c->index);
198 } else {
199 buffer += seprintf(buffer, last, " %2i: %s (v%d)\n", (int)c->index, c->ai_info->GetName(), c->ai_info->GetVersion());
200 }
201 }
202
203 if (Game::GetInfo() != nullptr) {
204 buffer += seprintf(buffer, last, " GS: %s (v%d)\n", Game::GetInfo()->GetName(), Game::GetInfo()->GetVersion());
205 }
206 buffer += seprintf(buffer, last, "\n");
207
208 return buffer;
209 }
210
217 char *CrashLog::LogLibraries(char *buffer, const char *last) const
218 {
219 buffer += seprintf(buffer, last, "Libraries:\n");
220
221 #ifdef WITH_ALLEGRO
222 buffer += seprintf(buffer, last, " Allegro: %s\n", allegro_id);
223 #endif /* WITH_ALLEGRO */
224
225 #ifdef WITH_FONTCONFIG
226 int version = FcGetVersion();
227 buffer += seprintf(buffer, last, " FontConfig: %d.%d.%d\n", version / 10000, (version / 100) % 100, version % 100);
228 #endif /* WITH_FONTCONFIG */
229
230 #ifdef WITH_FREETYPE
231 FT_Library library;
232 int major, minor, patch;
233 FT_Init_FreeType(&library);
234 FT_Library_Version(library, &major, &minor, &patch);
235 FT_Done_FreeType(library);
236 buffer += seprintf(buffer, last, " FreeType: %d.%d.%d\n", major, minor, patch);
237 #endif /* WITH_FREETYPE */
238
239 #if defined(WITH_ICU_LX) || defined(WITH_ICU_I18N)
240 /* 4 times 0-255, separated by dots (.) and a trailing '\0' */
241 char buf[4 * 3 + 3 + 1];
242 UVersionInfo ver;
243 u_getVersion(ver);
244 u_versionToString(ver, buf);
245 #ifdef WITH_ICU_I18N
246 buffer += seprintf(buffer, last, " ICU i18n: %s\n", buf);
247 #endif
248 #ifdef WITH_ICU_LX
249 buffer += seprintf(buffer, last, " ICU lx: %s\n", buf);
250 #endif
251 #endif /* WITH_ICU_LX || WITH_ICU_I18N */
252
253 #ifdef WITH_LIBLZMA
254 buffer += seprintf(buffer, last, " LZMA: %s\n", lzma_version_string());
255 #endif
256
257 #ifdef WITH_LZO
258 buffer += seprintf(buffer, last, " LZO: %s\n", lzo_version_string());
259 #endif
260
261 #ifdef WITH_PNG
262 buffer += seprintf(buffer, last, " PNG: %s\n", png_get_libpng_ver(nullptr));
263 #endif /* WITH_PNG */
264
265 #ifdef WITH_SDL
266 const SDL_version *sdl_v = SDL_Linked_Version();
267 buffer += seprintf(buffer, last, " SDL1: %d.%d.%d\n", sdl_v->major, sdl_v->minor, sdl_v->patch);
268 #elif defined(WITH_SDL2)
269 SDL_version sdl2_v;
270 SDL_GetVersion(&sdl2_v);
271 buffer += seprintf(buffer, last, " SDL2: %d.%d.%d\n", sdl2_v.major, sdl2_v.minor, sdl2_v.patch);
272 #endif
273
274 #ifdef WITH_ZLIB
275 buffer += seprintf(buffer, last, " Zlib: %s\n", zlibVersion());
276 #endif
277
278 buffer += seprintf(buffer, last, "\n");
279 return buffer;
280 }
281
286 /* static */ void CrashLog::GamelogFillCrashLog(const char *s)
287 {
288 CrashLog::gamelog_buffer += seprintf(CrashLog::gamelog_buffer, CrashLog::gamelog_last, "%s\n", s);
289 }
290
297 char *CrashLog::LogGamelog(char *buffer, const char *last) const
298 {
299 CrashLog::gamelog_buffer = buffer;
300 CrashLog::gamelog_last = last;
301 GamelogPrint(&CrashLog::GamelogFillCrashLog);
302 return CrashLog::gamelog_buffer + seprintf(CrashLog::gamelog_buffer, last, "\n");
303 }
304
311 char *CrashLog::LogRecentNews(char *buffer, const char *last) const
312 {
313 buffer += seprintf(buffer, last, "Recent news messages:\n");
314
315 int i = 0;
316 for (NewsItem *news = _latest_news; i < 32 && news != nullptr; news = news->prev, i++) {
317 YearMonthDay ymd;
318 ConvertDateToYMD(news->date, &ymd);
319 buffer += seprintf(buffer, last, "(%i-%02i-%02i) StringID: %u, Type: %u, Ref1: %u, %u, Ref2: %u, %u\n",
320 ymd.year, ymd.month + 1, ymd.day, news->string_id, news->type,
321 news->reftype1, news->ref1, news->reftype2, news->ref2);
322 }
323 buffer += seprintf(buffer, last, "\n");
324 return buffer;
325 }
326
335 int CrashLog::CreateFileName(char *filename, const char *filename_last, const char *ext, bool with_dir) const
336 {
337 static std::string crashname;
338
339 if (crashname.empty()) {
340 UTCTime::Format(filename, filename_last, "crash%Y%m%d%H%M%S");
341 crashname = filename;
342 }
343 return seprintf(filename, filename_last, "%s%s%s", with_dir ? _personal_dir.c_str() : "", crashname.c_str(), ext);
344 }
345
352 char *CrashLog::FillCrashLog(char *buffer, const char *last) const
353 {
354 buffer += seprintf(buffer, last, "*** OpenTTD Crash Report ***\n\n");
355 buffer += UTCTime::Format(buffer, last, "Crash at: %Y-%m-%d %H:%M:%S (UTC)\n");
356
357 YearMonthDay ymd;
358 ConvertDateToYMD(_date, &ymd);
359 buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i)\n\n", ymd.year, ymd.month + 1, ymd.day, _date_fract);
360
361 buffer = this->LogError(buffer, last, CrashLog::message);
362 buffer = this->LogOpenTTDVersion(buffer, last);
363 buffer = this->LogRegisters(buffer, last);
364 buffer = this->LogStacktrace(buffer, last);
365 buffer = this->LogOSVersion(buffer, last);
366 buffer = this->LogCompiler(buffer, last);
367 buffer = this->LogConfiguration(buffer, last);
368 buffer = this->LogLibraries(buffer, last);
369 buffer = this->LogModules(buffer, last);
370 buffer = this->LogGamelog(buffer, last);
371 buffer = this->LogRecentNews(buffer, last);
372
373 buffer += seprintf(buffer, last, "*** End of OpenTTD Crash Report ***\n");
374 return buffer;
375 }
376
386 bool CrashLog::WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const
387 {
388 this->CreateFileName(filename, filename_last, ".log");
389
390 FILE *file = FioFOpenFile(filename, "w", NO_DIRECTORY);
391 if (file == nullptr) return false;
392
393 size_t len = strlen(buffer);
394 size_t written = fwrite(buffer, 1, len, file);
395
396 FioFCloseFile(file);
397 return len == written;
398 }
399
400 /* virtual */ int CrashLog::WriteCrashDump(char *filename, const char *filename_last) const
401 {
402 /* Stub implementation; not all OSes support this. */
403 return 0;
404 }
405
414 bool CrashLog::WriteSavegame(char *filename, const char *filename_last) const
415 {
416 /* If the map array doesn't exist, saving will fail too. If the map got
417 * initialised, there is a big chance the rest is initialised too. */
418 if (_m == nullptr) return false;
419
420 try {
421 GamelogEmergency();
422
423 this->CreateFileName(filename, filename_last, ".sav");
424
425 /* Don't do a threaded saveload. */
426 return SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, NO_DIRECTORY, false) == SL_OK;
427 } catch (...) {
428 return false;
429 }
430 }
431
440 bool CrashLog::WriteScreenshot(char *filename, const char *filename_last) const
441 {
442 /* Don't draw when we have invalid screen size */
443 if (_screen.width < 1 || _screen.height < 1 || _screen.dst_ptr == nullptr) return false;
444
445 this->CreateFileName(filename, filename_last, "", false);
446 bool res = MakeScreenshot(SC_CRASHLOG, filename);
447 filename[0] = '\0';
448 if (res) strecpy(filename, _full_screenshot_name, filename_last);
449 return res;
450 }
451
458 bool CrashLog::MakeCrashLog() const
459 {
460 /* Don't keep looping logging crashes. */
461 static bool crashlogged = false;
462 if (crashlogged) return false;
463 crashlogged = true;
464
465 char filename[MAX_PATH];
466 char buffer[65536];
467 bool ret = true;
468
469 printf("Crash encountered, generating crash log...\n");
470 this->FillCrashLog(buffer, lastof(buffer));
471 printf("%s\n", buffer);
472 printf("Crash log generated.\n\n");
473
474 printf("Writing crash log to disk...\n");
475 bool bret = this->WriteCrashLog(buffer, filename, lastof(filename));
476 if (bret) {
477 printf("Crash log written to %s. Please add this file to any bug reports.\n\n", filename);
478 } else {
479 printf("Writing crash log failed. Please attach the output above to any bug reports.\n\n");
480 ret = false;
481 }
482
483 /* Don't mention writing crash dumps because not all platforms support it. */
484 int dret = this->WriteCrashDump(filename, lastof(filename));
485 if (dret < 0) {
486 printf("Writing crash dump failed.\n\n");
487 ret = false;
488 } else if (dret > 0) {
489 printf("Crash dump written to %s. Please add this file to any bug reports.\n\n", filename);
490 }
491
492 printf("Writing crash savegame...\n");
493 bret = this->WriteSavegame(filename, lastof(filename));
494 if (bret) {
495 printf("Crash savegame written to %s. Please add this file and the last (auto)save to any bug reports.\n\n", filename);
496 } else {
497 ret = false;
498 printf("Writing crash savegame failed. Please attach the last (auto)save to any bug reports.\n\n");
499 }
500
501 printf("Writing crash screenshot...\n");
502 bret = this->WriteScreenshot(filename, lastof(filename));
503 if (bret) {
504 printf("Crash screenshot written to %s. Please add this file to any bug reports.\n\n", filename);
505 } else {
506 ret = false;
507 printf("Writing crash screenshot failed.\n\n");
508 }
509
510 return ret;
511 }
512
517 /* static */ void CrashLog::SetErrorMessage(const char *message)
518 {
519 CrashLog::message = message;
520 }
521
526 /* static */ void CrashLog::AfterCrashLogCleanup()
527 {
528 if (MusicDriver::GetInstance() != nullptr) MusicDriver::GetInstance()->Stop();
529 if (SoundDriver::GetInstance() != nullptr) SoundDriver::GetInstance()->Stop();
530 if (VideoDriver::GetInstance() != nullptr) VideoDriver::GetInstance()->Stop();
531 }
game.hpp
CrashLog::LogLibraries
char * LogLibraries(char *buffer, const char *last) const
Writes information (versions) of the used libraries.
Definition: crashlog.cpp:217
YearMonthDay::day
Day day
Day (1..31)
Definition: date_type.h:107
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:458
game_info.hpp
_personal_dir
std::string _personal_dir
custom directory for personal settings, saves, newgrf, etc.
Definition: fileio.cpp:957
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:526
NewsItem
Information about a single item of news.
Definition: news_type.h:126
company_base.h
CrashLog::WriteScreenshot
bool WriteScreenshot(char *filename, const char *filename_last) const
Write the (crash) screenshot to a file.
Definition: crashlog.cpp:440
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:3234
_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:59
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:155
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:116
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:297
ai_info.hpp
screenshot.h
gfx_func.h
GamelogPrint
void GamelogPrint(GamelogPrintProc *proc)
Prints active gamelog.
Definition: gamelog.cpp:192
walltime_func.h
_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:104
YearMonthDay::month
Month month
Month (0..11)
Definition: date_type.h:106
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:311
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:245
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:517
BlitterFactory::GetCurrentBlitter
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Definition: factory.hpp:141
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:47
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:98
_networking
bool _networking
are we in networking mode?
Definition: network.cpp:58
NewsItem::prev
NewsItem * prev
Previous news item.
Definition: news_type.h:127
Time::Format
static size_t Format(char *buffer, const char *last, const char *format) NOACCESS(2) WARN_TIME_FORMAT(3)
Format the current time with the given strftime format specifiers.
Definition: walltime_func.h:58
CrashLog::WriteCrashDump
virtual int WriteCrashDump(char *filename, const char *filename_last) const
Write the (crash) dump to a file.
Definition: crashlog.cpp:400
LanguageMetadata::file
char file[MAX_PATH]
Name of the file we read this data from.
Definition: language.h:94
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:202
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:74
YearMonthDay::year
Year year
Year (0...)
Definition: date_type.h:105
_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:386
strings_func.h
video_driver.hpp
CrashLog::GamelogFillCrashLog
static void GamelogFillCrashLog(const char *s)
Helper function for printing the gamelog.
Definition: crashlog.cpp:286
CrashLog::WriteSavegame
bool WriteSavegame(char *filename, const char *filename_last) const
Write the (crash) savegame to a file.
Definition: crashlog.cpp:414
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:554
company_func.h
_full_screenshot_name
char _full_screenshot_name[MAX_PATH]
Pathname of the screenshot file.
Definition: screenshot.cpp:43
CrashLog::CreateFileName
int CreateFileName(char *filename, const char *filename_last, const char *ext, bool with_dir=true) const
Create a timestamped filename.
Definition: crashlog.cpp:335
MakeScreenshot
bool MakeScreenshot(ScreenshotType t, std::string name, uint32 width, uint32 height)
Schedule making a screenshot.
Definition: screenshot.cpp:990
network.h
_latest_news
NewsItem * _latest_news
tail of news items queue
Definition: news_gui.cpp:52
YearMonthDay
Data structure to convert between Date and triplet (year, month, and day).
Definition: date_type.h:104
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:352
CrashLog::WriteCrashLog
bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const
Write the crash log to a file.
Definition: crashlog.cpp:386
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:113
Company
Definition: company_base.h:117
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:402
SL_OK
@ SL_OK
completed successfully
Definition: saveload.h:353
_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:130
FontCache::Get
static FontCache * Get(FontSize fs)
Get the font cache of a given font size.
Definition: fontcache.h:142