OpenTTD

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