Maintain a circular buffer of recent commands, add to crashlog.
[openttd-joker.git] / src / gamelog_internal.h
blob593a5bfd3bccf4aa53e2f085a2c4575e56120f11
1 /* $Id: gamelog_internal.h 18809 2010-01-15 16:41:15Z rubidium $ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file gamelog_internal.h Declaration shared among gamelog.cpp and saveload/gamelog_sl.cpp */
12 #ifndef GAMELOG_INTERNAL_H
13 #define GAMELOG_INTERNAL_H
15 #include "network/core/config.h"
16 #include "gamelog.h"
18 /** Type of logged change */
19 enum GamelogChangeType {
20 GLCT_MODE, ///< Scenario editor x Game, different landscape
21 GLCT_REVISION, ///< Changed game revision string
22 GLCT_OLDVER, ///< Loaded from savegame without logged data
23 GLCT_SETTING, ///< Non-networksafe setting value changed
24 GLCT_GRFADD, ///< Removed GRF
25 GLCT_GRFREM, ///< Added GRF
26 GLCT_GRFCOMPAT, ///< Loading compatible GRF
27 GLCT_GRFPARAM, ///< GRF parameter changed
28 GLCT_GRFMOVE, ///< GRF order changed
29 GLCT_GRFBUG, ///< GRF bug triggered
30 GLCT_EMERGENCY, ///< Emergency savegame
31 GLCT_END, ///< So we know how many GLCTs are there
32 GLCT_NONE = 0xFF, ///< In savegames, end of list
36 /** Contains information about one logged change */
37 struct LoggedChange {
38 GamelogChangeType ct; ///< Type of change logged in this struct
39 union {
40 struct {
41 byte mode; ///< new game mode - Editor x Game
42 byte landscape; ///< landscape (temperate, arctic, ...)
43 } mode;
44 struct {
45 char text[NETWORK_REVISION_LENGTH]; ///< revision string, _openttd_revision
46 uint32 newgrf; ///< _openttd_newgrf_version
47 uint16 slver; ///< _sl_version
48 byte modified; ///< _openttd_revision_modified
49 } revision;
50 struct {
51 uint32 type; ///< type of savegame, @see SavegameType
52 uint32 version; ///< major and minor version OR ttdp version
53 } oldver;
54 GRFIdentifier grfadd; ///< ID and md5sum of added GRF
55 struct {
56 uint32 grfid; ///< ID of removed GRF
57 } grfrem;
58 GRFIdentifier grfcompat; ///< ID and new md5sum of changed GRF
59 struct {
60 uint32 grfid; ///< ID of GRF with changed parameters
61 } grfparam;
62 struct {
63 uint32 grfid; ///< ID of moved GRF
64 int32 offset; ///< offset, positive = move down
65 } grfmove;
66 struct {
67 char *name; ///< name of the setting
68 int32 oldval; ///< old value
69 int32 newval; ///< new value
70 } setting;
71 struct {
72 uint64 data; ///< additional data
73 uint32 grfid; ///< ID of problematic GRF
74 byte bug; ///< type of bug, @see enum GRFBugs
75 } grfbug;
80 /** Contains information about one logged action that caused at least one logged change */
81 struct LoggedAction {
82 LoggedChange *change; ///< First logged change in this action
83 uint32 changes; ///< Number of changes in this action
84 GamelogActionType at; ///< Type of action
85 uint16 tick; ///< Tick when it happened
88 extern LoggedAction *_gamelog_action;
89 extern uint _gamelog_actions;
91 #endif /* GAMELOG_INTERNAL_H */