10#ifndef GAMELOG_INTERNAL_H
11#define GAMELOG_INTERNAL_H
30using GrfIDMapping = std::map<uint32_t, GRFPresence>;
34 virtual ~LoggedChange() =
default;
42 virtual void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type) = 0;
47struct LoggedChangeMode : LoggedChange {
48 LoggedChangeMode() : LoggedChange(
GLCT_MODE) {}
51 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
57struct LoggedChangeRevision : LoggedChange {
61 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
69struct LoggedChangeOldVersion : LoggedChange {
70 LoggedChangeOldVersion() : LoggedChange(
GLCT_OLDVER) {}
71 LoggedChangeOldVersion(uint32_t
type, uint32_t
version) :
73 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
79struct LoggedChangeGRFAdd : LoggedChange, GRFIdentifier {
81 LoggedChangeGRFAdd(
const GRFIdentifier &ident) :
83 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
86struct LoggedChangeGRFRemoved : LoggedChange {
87 LoggedChangeGRFRemoved() : LoggedChange(
GLCT_GRFREM) {}
88 LoggedChangeGRFRemoved(uint32_t
grfid) :
90 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
95struct LoggedChangeGRFChanged : LoggedChange, GRFIdentifier {
97 LoggedChangeGRFChanged(
const GRFIdentifier &ident) :
99 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
102struct LoggedChangeGRFParameterChanged : LoggedChange {
103 LoggedChangeGRFParameterChanged() : LoggedChange(
GLCT_GRFPARAM) {}
104 LoggedChangeGRFParameterChanged(uint32_t
grfid) :
106 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
111struct LoggedChangeGRFMoved : LoggedChange {
113 LoggedChangeGRFMoved(uint32_t
grfid, int32_t
offset) :
115 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
121struct LoggedChangeSettingChanged : LoggedChange {
122 LoggedChangeSettingChanged() : LoggedChange(
GLCT_SETTING) {}
123 LoggedChangeSettingChanged(
const std::string &
name, int32_t
oldval, int32_t
newval) :
125 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
132struct LoggedChangeGRFBug : LoggedChange {
133 LoggedChangeGRFBug() : LoggedChange(
GLCT_GRFBUG) {}
136 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
143struct LoggedChangeEmergencySave : LoggedChange {
145 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
151 std::vector<std::unique_ptr<LoggedChange>>
change;
157 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.