10#ifndef GAMELOG_INTERNAL_H
11#define GAMELOG_INTERNAL_H
30using GrfIDMapping = std::map<uint32_t, GRFPresence>;
43 virtual void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type) = 0;
48struct LoggedChangeMode : LoggedChange {
49 LoggedChangeMode() : LoggedChange(
GLCT_MODE) {}
52 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
58struct LoggedChangeRevision : LoggedChange {
62 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
70struct LoggedChangeOldVersion : LoggedChange {
71 LoggedChangeOldVersion() : LoggedChange(
GLCT_OLDVER) {}
72 LoggedChangeOldVersion(uint32_t
type, uint32_t
version) :
74 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
80struct LoggedChangeGRFAdd : LoggedChange, GRFIdentifier {
82 LoggedChangeGRFAdd(
const GRFIdentifier &ident) :
84 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
87struct LoggedChangeGRFRemoved : LoggedChange {
88 LoggedChangeGRFRemoved() : LoggedChange(
GLCT_GRFREM) {}
89 LoggedChangeGRFRemoved(uint32_t
grfid) :
91 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
96struct LoggedChangeGRFChanged : LoggedChange, GRFIdentifier {
98 LoggedChangeGRFChanged(
const GRFIdentifier &ident) :
100 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
103struct LoggedChangeGRFParameterChanged : LoggedChange {
104 LoggedChangeGRFParameterChanged() : LoggedChange(
GLCT_GRFPARAM) {}
105 LoggedChangeGRFParameterChanged(uint32_t
grfid) :
107 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
112struct LoggedChangeGRFMoved : LoggedChange {
114 LoggedChangeGRFMoved(uint32_t
grfid, int32_t
offset) :
116 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
122struct LoggedChangeSettingChanged : LoggedChange {
123 LoggedChangeSettingChanged() : LoggedChange(
GLCT_SETTING) {}
124 LoggedChangeSettingChanged(
const std::string &
name, int32_t
oldval, int32_t
newval) :
126 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
133struct LoggedChangeGRFBug : LoggedChange {
134 LoggedChangeGRFBug() : LoggedChange(
GLCT_GRFBUG) {}
137 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
144struct LoggedChangeEmergencySave : LoggedChange {
146 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
152 std::vector<std::unique_ptr<LoggedChange>>
change;
158 std::vector<LoggedAction> action;
Functions to be called to log fundamental changes to the game.
GamelogChangeType
Type of logged change.
@ GLCT_MODE
Scenario editor x Game, different landscape.
@ GLCT_OLDVER
Loaded from savegame without logged data.
@ GLCT_SETTING
Non-networksafe setting value changed.
@ GLCT_GRFCOMPAT
Loading compatible GRF.
@ GLCT_GRFADD
Removed GRF.
@ GLCT_EMERGENCY
Emergency savegame.
@ GLCT_GRFPARAM
GRF parameter changed.
@ GLCT_GRFMOVE
GRF order changed.
@ GLCT_GRFBUG
GRF bug triggered.
@ GLCT_REVISION
Changed game revision string.
@ GLCT_NONE
In savegames, end of list.
GamelogActionType
The actions we log.
Types related to the landscape.
LandscapeType
Landscape types.
GRFBug
Encountered GRF bugs.
Information about GRF, used in the game and (part of it) in savegames.
Information about the presence of a Grf at a certain point during gamelog history Note about missing ...
bool was_missing
Grf was missing during some gameload in the past.
const GRFConfig * gc
GRFConfig, if known.
Contains information about one logged action that caused at least one logged change.
uint64_t tick
Tick when it happened.
std::vector< std::unique_ptr< LoggedChange > > change
Logged changes in this action.
GamelogActionType at
Type of action.
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
uint64_t data
additional data
uint32_t grfid
ID of problematic GRF.
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
uint32_t grfid
ID of moved GRF.
int32_t offset
offset, positive = move down
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
uint32_t grfid
ID of GRF with changed parameters.
uint32_t grfid
ID of removed GRF.
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
LandscapeType landscape
landscape (temperate, arctic, ...)
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
uint8_t mode
new game mode - Editor x Game
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
uint32_t type
type of savegame,
uint32_t version
major and minor version OR ttdp version
std::string text
revision string, _openttd_revision
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
uint16_t slver
_sl_version
uint32_t newgrf
_openttd_newgrf_version
uint8_t modified
_openttd_revision_modified
std::string name
name of the setting
void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) override
Format the content of this change into the given output.
virtual void FormatTo(std::back_insert_iterator< std::string > &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type)=0
Format the content of this change into the given output.
virtual ~LoggedChange()=default
Ensure the destructor of the sub classes are called as well.