OpenTTD Source: src/gamelog_internal.h Source File

OpenTTD Source 12.2

gamelog_internal.h
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 #ifndef GAMELOG_INTERNAL_H
11 #define GAMELOG_INTERNAL_H
12
13 #include "gamelog.h"
14
16 enum GamelogChangeType : uint8 {
17 GLCT_MODE,
18 GLCT_REVISION,
19 GLCT_OLDVER,
20 GLCT_SETTING,
21 GLCT_GRFADD,
22 GLCT_GRFREM,
23 GLCT_GRFCOMPAT,
24 GLCT_GRFPARAM,
25 GLCT_GRFMOVE,
26 GLCT_GRFBUG,
27 GLCT_EMERGENCY,
28 GLCT_END,
29 GLCT_NONE = 0xFF,
30 };
31
32
33 static const uint GAMELOG_REVISION_LENGTH = 15;
34
36 struct LoggedChange {
37 GamelogChangeType ct;
38 union {
39 struct {
40 byte mode;
41 byte landscape;
42 } mode;
43 struct {
44 char text[GAMELOG_REVISION_LENGTH];
45 uint32 newgrf;
46 uint16 slver;
47 byte modified;
48 } revision;
49 struct {
50 uint32 type;
51 uint32 version;
52 } oldver;
53 GRFIdentifier grfadd;
54 struct {
55 uint32 grfid;
56 } grfrem;
57 GRFIdentifier grfcompat;
58 struct {
59 uint32 grfid;
60 } grfparam;
61 struct {
62 uint32 grfid;
63 int32 offset;
64 } grfmove;
65 struct {
66 char *name;
67 int32 oldval;
68 int32 newval;
69 } setting;
70 struct {
71 uint64 data;
72 uint32 grfid;
73 byte bug;
74 } grfbug;
75 };
76 };
77
78
80 struct LoggedAction {
81 LoggedChange *change;
82 uint32 changes;
83 GamelogActionType at;
84 uint16 tick;
85 };
86
87 extern LoggedAction *_gamelog_action;
88 extern uint _gamelog_actions;
89
90 #endif /* GAMELOG_INTERNAL_H */
GLCT_GRFADD
@ GLCT_GRFADD
Removed GRF.
Definition: gamelog_internal.h:21
GLCT_GRFBUG
@ GLCT_GRFBUG
GRF bug triggered.
Definition: gamelog_internal.h:26
LoggedChange::newgrf
uint32 newgrf
_openttd_newgrf_version
Definition: gamelog_internal.h:45
LoggedChange::name
char * name
name of the setting
Definition: gamelog_internal.h:66
LoggedChange::mode
byte mode
new game mode - Editor x Game
Definition: gamelog_internal.h:40
LoggedChange::offset
int32 offset
offset, positive = move down
Definition: gamelog_internal.h:63
GLCT_GRFMOVE
@ GLCT_GRFMOVE
GRF order changed.
Definition: gamelog_internal.h:25
LoggedChange::type
uint32 type
type of savegame,
Definition: gamelog_internal.h:50
LoggedAction::tick
uint16 tick
Tick when it happened.
Definition: gamelog_internal.h:84
GLCT_EMERGENCY
@ GLCT_EMERGENCY
Emergency savegame.
Definition: gamelog_internal.h:27
GLCT_REVISION
@ GLCT_REVISION
Changed game revision string.
Definition: gamelog_internal.h:18
LoggedAction::at
GamelogActionType at
Type of action.
Definition: gamelog_internal.h:83
gamelog.h
LoggedChange::slver
uint16 slver
_sl_version
Definition: gamelog_internal.h:46
LoggedChange::landscape
byte landscape
landscape (temperate, arctic, ...)
Definition: gamelog_internal.h:41
GRFIdentifier
Basic data to distinguish a GRF.
Definition: newgrf_config.h:83
LoggedAction::changes
uint32 changes
Number of changes in this action.
Definition: gamelog_internal.h:82
LoggedChange::modified
byte modified
_openttd_revision_modified
Definition: gamelog_internal.h:47
_gamelog_action
LoggedAction * _gamelog_action
first logged action
Definition: gamelog.cpp:35
LoggedChange::data
uint64 data
additional data
Definition: gamelog_internal.h:71
GamelogChangeType
GamelogChangeType
Type of logged change.
Definition: gamelog_internal.h:16
GLCT_NONE
@ GLCT_NONE
In savegames, end of list.
Definition: gamelog_internal.h:29
LoggedAction::change
LoggedChange * change
First logged change in this action.
Definition: gamelog_internal.h:81
GLCT_GRFCOMPAT
@ GLCT_GRFCOMPAT
Loading compatible GRF.
Definition: gamelog_internal.h:23
LoggedChange::grfid
uint32 grfid
ID of removed GRF.
Definition: gamelog_internal.h:55
LoggedChange::bug
byte bug
type of bug,
Definition: gamelog_internal.h:73
LoggedChange::ct
GamelogChangeType ct
Type of change logged in this struct.
Definition: gamelog_internal.h:37
GLCT_GRFPARAM
@ GLCT_GRFPARAM
GRF parameter changed.
Definition: gamelog_internal.h:24
GLCT_END
@ GLCT_END
So we know how many GLCTs are there.
Definition: gamelog_internal.h:28
LoggedChange::grfadd
GRFIdentifier grfadd
ID and md5sum of added GRF.
Definition: gamelog_internal.h:53
GLCT_OLDVER
@ GLCT_OLDVER
Loaded from savegame without logged data.
Definition: gamelog_internal.h:19
LoggedChange::grfcompat
GRFIdentifier grfcompat
ID and new md5sum of changed GRF.
Definition: gamelog_internal.h:57
LoggedChange::oldval
int32 oldval
old value
Definition: gamelog_internal.h:67
_gamelog_actions
uint _gamelog_actions
number of actions
Definition: gamelog.cpp:36
LoggedChange::text
char text[GAMELOG_REVISION_LENGTH]
revision string, _openttd_revision
Definition: gamelog_internal.h:44
GLCT_SETTING
@ GLCT_SETTING
Non-networksafe setting value changed.
Definition: gamelog_internal.h:20
LoggedChange
Contains information about one logged change.
Definition: gamelog_internal.h:36
GLCT_GRFREM
@ GLCT_GRFREM
Added GRF.
Definition: gamelog_internal.h:22
GLCT_MODE
@ GLCT_MODE
Scenario editor x Game, different landscape.
Definition: gamelog_internal.h:17
GamelogActionType
GamelogActionType
The actions we log.
Definition: gamelog.h:16
LoggedAction
Contains information about one logged action that caused at least one logged change.
Definition: gamelog_internal.h:80
LoggedChange::version
uint32 version
major and minor version OR ttdp version
Definition: gamelog_internal.h:51
LoggedChange::newval
int32 newval
new value
Definition: gamelog_internal.h:68