OpenTTD Source
20241108-master-g80f628063a
|
Public Member Functions | |
void | StartAction (GamelogActionType at) |
Stores information about new action, but doesn't allocate it Action is allocated only when there is at least one change. More... | |
void | StopAction () |
Stops logging of any changes. | |
void | StopAnyAction () |
void | Reset () |
Resets and frees all memory allocated - used before loading or starting a new game. | |
void | Print (std::function< void(const std::string &)> proc) |
Prints active gamelog. More... | |
void | PrintDebug (int level) |
Prints gamelog to debug output. More... | |
void | PrintConsole () |
Print the gamelog data to the console. | |
void | Emergency () |
Logs a emergency savegame. | |
bool | TestEmergency () |
Finds out if current game is a loaded emergency savegame. | |
void | Revision () |
Logs a change in game revision. | |
void | Mode () |
Logs a change in game mode (scenario editor or game) | |
void | Oldver () |
Logs loading from savegame without gamelog. | |
void | Setting (const std::string &name, int32_t oldval, int32_t newval) |
Logs change in game settings. More... | |
void | GRFUpdate (const GRFConfig *oldg, const GRFConfig *newg) |
Compares two NewGRF lists and logs any change. More... | |
void | GRFAddList (const GRFConfig *newg) |
Logs adding of list of GRFs. More... | |
void | GRFRemove (uint32_t grfid) |
Logs removal of a GRF. More... | |
void | GRFAdd (const GRFConfig *newg) |
Logs adding of a GRF. More... | |
void | GRFBug (uint32_t grfid, uint8_t bug, uint64_t data) |
Logs triggered GRF bug. More... | |
bool | GRFBugReverse (uint32_t grfid, uint16_t internal_id) |
Logs GRF bug - rail vehicle has different length after reversing. More... | |
void | GRFCompatible (const GRFIdentifier *newg) |
Logs loading compatible GRF (the same ID, but different MD5 hash) More... | |
void | GRFMove (uint32_t grfid, int32_t offset) |
Logs changing GRF order. More... | |
void | GRFParameters (uint32_t grfid) |
Logs change in GRF parameters. More... | |
void | TestRevision () |
Finds out if current revision is different than last revision stored in the savegame. More... | |
void | TestMode () |
Finds last stored game mode or landscape. More... | |
void | Info (uint32_t *last_ottd_rev, uint8_t *ever_modified, bool *removed_newgrfs) |
Get some basic information from the given gamelog. More... | |
const GRFIdentifier * | GetOverriddenIdentifier (const GRFConfig *c) |
Try to find the overridden GRF identifier of the given GRF. More... | |
Private Member Functions | |
void | Change (std::unique_ptr< LoggedChange > &&change) |
Allocates a new LoggedAction if needed, and add the change when action is active. More... | |
Private Attributes | |
std::unique_ptr< GamelogInternalData > | data |
GamelogActionType | action_type |
struct LoggedAction * | current_action |
Friends | |
struct | GLOGChunkHandler |
|
private |
Allocates a new LoggedAction if needed, and add the change when action is active.
change | The actual change. |
Definition at line 335 of file gamelog.cpp.
References LoggedAction::at, LoggedAction::change, TimerGameTick::counter, GLAT_NONE, and LoggedAction::tick.
Referenced by Emergency(), GRFAdd(), GRFBug(), GRFCompatible(), GRFMove(), GRFParameters(), GRFRemove(), Mode(), Oldver(), Revision(), and Setting().
const GRFIdentifier * Gamelog::GetOverriddenIdentifier | ( | const GRFConfig * | c | ) |
Try to find the overridden GRF identifier of the given GRF.
c | the GRF to get the 'previous' version of. |
Definition at line 712 of file gamelog.cpp.
References LoggedAction::at, LoggedAction::change, GLAT_LOAD, GLCT_GRFCOMPAT, GRFIdentifier::grfid, and GRFConfig::ident.
Referenced by HandleSavegameLoadCrash().
void Gamelog::GRFAdd | ( | const GRFConfig * | newg | ) |
Logs adding of a GRF.
newg | added GRF |
Definition at line 528 of file gamelog.cpp.
References Change(), GLAT_GRF, GLAT_LOAD, GLAT_START, GRFConfig::ident, and IsLoggableGrfConfig().
Referenced by GRFAddList(), and GRFUpdate().
void Gamelog::GRFAddList | ( | const GRFConfig * | newg | ) |
Logs adding of list of GRFs.
Useful when old savegame is loaded or when new game is started
newg | head of GRF linked list |
Definition at line 578 of file gamelog.cpp.
References GLAT_LOAD, GLAT_START, GRFAdd(), and GRFConfig::next.
void Gamelog::GRFBug | ( | uint32_t | grfid, |
uint8_t | bug, | ||
uint64_t | data | ||
) |
Logs triggered GRF bug.
grfid | ID of problematic GRF |
bug | type of bug, |
data | additional data |
Definition at line 466 of file gamelog.cpp.
References Change(), and GLAT_GRFBUG.
bool Gamelog::GRFBugReverse | ( | uint32_t | grfid, |
uint16_t | internal_id | ||
) |
Logs GRF bug - rail vehicle has different length after reversing.
Ensures this is logged only once for each GRF and engine type This check takes some time, but it is called pretty seldom, so it doesn't matter that much (ideally it shouldn't be called at all).
grfid | the broken NewGRF |
internal_id | the internal ID of whatever's broken in the NewGRF |
Definition at line 482 of file gamelog.cpp.
Referenced by VehicleLengthChanged().
void Gamelog::GRFCompatible | ( | const GRFIdentifier * | newg | ) |
Logs loading compatible GRF (the same ID, but different MD5 hash)
newg | new (updated) GRF |
Definition at line 542 of file gamelog.cpp.
References Change(), GLAT_GRF, and GLAT_LOAD.
Referenced by GRFUpdate().
void Gamelog::GRFMove | ( | uint32_t | grfid, |
int32_t | offset | ||
) |
Logs changing GRF order.
grfid | GRF that is moved |
offset | how far it is moved, positive = moved down |
Definition at line 554 of file gamelog.cpp.
References Change(), and GLAT_GRF.
Referenced by GRFUpdate().
void Gamelog::GRFParameters | ( | uint32_t | grfid | ) |
Logs change in GRF parameters.
Details about parameters changed are not stored
grfid | ID of GRF to store |
Definition at line 566 of file gamelog.cpp.
References Change(), and GLAT_GRF.
Referenced by GRFUpdate().
void Gamelog::GRFRemove | ( | uint32_t | grfid | ) |
Logs removal of a GRF.
grfid | ID of removed GRF |
Definition at line 517 of file gamelog.cpp.
References Change(), GLAT_GRF, and GLAT_LOAD.
Referenced by GRFUpdate().
Compares two NewGRF lists and logs any change.
oldc | original GRF list |
newc | new GRF list |
Definition at line 606 of file gamelog.cpp.
References GenerateGRFList(), GRFAdd(), GRFCompatible(), GRFIdentifier::grfid, GRFMove(), GRFParameters(), GRFRemove(), GRFConfig::ident, GRFIdentifier::md5sum, GRFConfig::num_params, and GRFConfig::param.
Referenced by NewGRFConfirmationCallback().
void Gamelog::Info | ( | uint32_t * | last_ottd_rev, |
uint8_t * | ever_modified, | ||
bool * | removed_newgrfs | ||
) |
Get some basic information from the given gamelog.
[out] | last_ottd_rev | OpenTTD NewGRF version from the binary that saved the savegame last. |
[out] | ever_modified | Max value of 'modified' from all binaries that ever saved this savegame. |
[out] | removed_newgrfs | Set to true if any NewGRFs have been removed. |
Definition at line 685 of file gamelog.cpp.
References LoggedAction::change, GLCT_GRFREM, GLCT_REVISION, and LoggedChangeRevision::newgrf.
void Gamelog::Print | ( | std::function< void(const std::string &)> | proc | ) |
Prints active gamelog.
proc | the procedure to draw with |
Definition at line 147 of file gamelog.cpp.
References LoggedAction::at, LoggedAction::change, GLAT_END, la_text, and LoggedAction::tick.
Referenced by PrintConsole(), PrintDebug(), and SurveyGamelog().
void Gamelog::PrintDebug | ( | int | level | ) |
Prints gamelog to debug output.
Code is executed even when there will be no output. It is called very seldom, so it doesn't matter that much. At least it gives more uniform code...
level | debug level we need to print stuff |
Definition at line 323 of file gamelog.cpp.
References Debug, and Print().
Referenced by StopAction().
void Gamelog::Setting | ( | const std::string & | name, |
int32_t | oldval, | ||
int32_t | newval | ||
) |
Logs change in game settings.
Only non-networksafe settings are logged
name | setting name |
oldval | old setting value |
newval | new setting value |
Definition at line 413 of file gamelog.cpp.
References Change(), and GLAT_SETTING.
Referenced by IntSettingDesc::ChangeValue().
void Gamelog::StartAction | ( | GamelogActionType | at | ) |
Stores information about new action, but doesn't allocate it Action is allocated only when there is at least one change.
at | type of action |
Definition at line 65 of file gamelog.cpp.
References GLAT_NONE.
Referenced by IntSettingDesc::ChangeValue(), Emergency(), and NewGRFConfirmationCallback().
void Gamelog::TestMode | ( | ) |
Finds last stored game mode or landscape.
Any change is logged
Definition at line 446 of file gamelog.cpp.
References LoggedAction::change, GLCT_MODE, and LoggedChangeMode::mode.
void Gamelog::TestRevision | ( | ) |
Finds out if current revision is different than last revision stored in the savegame.
Appends GLCT_REVISION when the revision string changed
Definition at line 425 of file gamelog.cpp.
References LoggedAction::change, GetGamelogRevisionString(), GLCT_REVISION, and LoggedChangeRevision::text.