10#ifndef GAMELOG_INTERNAL_H
11#define GAMELOG_INTERNAL_H
31using GrfIDMapping = std::map<uint32_t, GRFPresence>;
44 virtual void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type) = 0;
61 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
67struct LoggedChangeRevision : LoggedChange {
71 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
79struct LoggedChangeOldVersion : LoggedChange {
80 LoggedChangeOldVersion() : LoggedChange(
GLCT_OLDVER) {}
81 LoggedChangeOldVersion(uint32_t
type, uint32_t
version) :
83 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
89struct LoggedChangeGRFAdd : LoggedChange, GRFIdentifier {
91 LoggedChangeGRFAdd(
const GRFIdentifier &ident) :
93 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
96struct LoggedChangeGRFRemoved : LoggedChange {
97 LoggedChangeGRFRemoved() : LoggedChange(
GLCT_GRFREM) {}
98 LoggedChangeGRFRemoved(uint32_t
grfid) :
100 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
105struct LoggedChangeGRFChanged : LoggedChange, GRFIdentifier {
107 LoggedChangeGRFChanged(
const GRFIdentifier &ident) :
109 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
112struct LoggedChangeGRFParameterChanged : LoggedChange {
113 LoggedChangeGRFParameterChanged() : LoggedChange(
GLCT_GRFPARAM) {}
114 LoggedChangeGRFParameterChanged(uint32_t
grfid) :
116 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
121struct LoggedChangeGRFMoved : LoggedChange {
123 LoggedChangeGRFMoved(uint32_t
grfid, int32_t
offset) :
125 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
131struct LoggedChangeSettingChanged : LoggedChange {
132 LoggedChangeSettingChanged() : LoggedChange(
GLCT_SETTING) {}
133 LoggedChangeSettingChanged(
const std::string &
name, int32_t
oldval, int32_t
newval) :
135 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
142struct LoggedChangeGRFBug : LoggedChange {
143 LoggedChangeGRFBug() : LoggedChange(
GLCT_GRFBUG) {}
146 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
153struct LoggedChangeEmergencySave : LoggedChange {
155 void FormatTo(std::back_insert_iterator<std::string> &output_iterator, GrfIDMapping &grf_names,
GamelogActionType action_type)
override;
161 std::vector<std::unique_ptr<LoggedChange>>
change;
167 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.
GameMode
Mode which defines the state of the game.
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, ...)
LoggedChangeMode(GameMode mode, LandscapeType landscape)
Create the log for changing the game mode.
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.
GameMode mode
new game mode - Editor x Game
LoggedChangeMode()
Constructor for savegame loading.
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.