OpenTTD Source 20241224-master-gee860a5c8e
|
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. | |
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. | |
void | PrintDebug (int level) |
Prints gamelog to debug output. | |
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. | |
void | GRFUpdate (const GRFConfig *oldg, const GRFConfig *newg) |
Compares two NewGRF lists and logs any change. | |
void | GRFAddList (const GRFConfig *newg) |
Logs adding of list of GRFs. | |
void | GRFRemove (uint32_t grfid) |
Logs removal of a GRF. | |
void | GRFAdd (const GRFConfig *newg) |
Logs adding of a GRF. | |
void | GRFBug (uint32_t grfid, uint8_t bug, uint64_t data) |
Logs triggered GRF bug. | |
bool | GRFBugReverse (uint32_t grfid, uint16_t internal_id) |
Logs GRF bug - rail vehicle has different length after reversing. | |
void | GRFCompatible (const GRFIdentifier *newg) |
Logs loading compatible GRF (the same ID, but different MD5 hash) | |
void | GRFMove (uint32_t grfid, int32_t offset) |
Logs changing GRF order. | |
void | GRFParameters (uint32_t grfid) |
Logs change in GRF parameters. | |
void | TestRevision () |
Finds out if current revision is different than last revision stored in the savegame. | |
void | TestMode () |
Finds last stored game mode or landscape. | |
void | Info (uint32_t *last_ottd_rev, uint8_t *ever_modified, bool *removed_newgrfs) |
Get some basic information from the given gamelog. | |
const GRFIdentifier * | GetOverriddenIdentifier (const GRFConfig *c) |
Try to find the overridden GRF identifier of the given GRF. | |
Private Member Functions | |
void | Change (std::unique_ptr< LoggedChange > &&change) |
Allocates a new LoggedAction if needed, and add the change when action is active. | |
Private Attributes | |
std::unique_ptr< GamelogInternalData > | data |
GamelogActionType | action_type |
struct LoggedAction * | current_action |
Friends | |
struct | GLOGChunkHandler |
Gamelog::Gamelog | ( | ) |
Definition at line 33 of file gamelog.cpp.
Gamelog::~Gamelog | ( | ) |
Definition at line 40 of file gamelog.cpp.
|
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().
void Gamelog::Emergency | ( | ) |
Logs a emergency savegame.
Definition at line 352 of file gamelog.cpp.
References Change(), GLAT_EMERGENCY, GLAT_NONE, StartAction(), and StopAction().
Referenced by CrashLog::WriteSavegame().
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.
Referenced by AfterLoadGame().
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.
Referenced by GRFBugReverse().
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.
References LoggedChangeGRFBug::bug, LoggedChangeGRFBug::data, GBUG_VEH_LENGTH, GLAT_GRFBUG, GLCT_GRFBUG, GRFBug(), LoggedChangeGRFBug::grfid, StartAction(), and StopAction().
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 AfterLoadGame(), and 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 AfterLoadGame(), and 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, 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 GLCT_GRFREM, GLCT_REVISION, and LoggedChangeRevision::newgrf.
void Gamelog::Mode | ( | ) |
Logs a change in game mode (scenario editor or game)
Definition at line 389 of file gamelog.cpp.
References _settings_game, Change(), GameSettings::game_creation, GLAT_CHEAT, GLAT_LOAD, GLAT_START, and GameCreationSettings::landscape.
Referenced by TestMode().
void Gamelog::Oldver | ( | ) |
Logs loading from savegame without gamelog.
Definition at line 399 of file gamelog.cpp.
References _savegame_type, _sl_minor_version, _sl_version, _ttdp_version, Change(), GLAT_LOAD, and SGT_OTTD.
Referenced by AfterLoadGame().
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 GLAT_END, and la_text.
Referenced by PrintConsole(), PrintDebug(), and SurveyGamelog().
void Gamelog::PrintConsole | ( | ) |
Print the gamelog data to the console.
Definition at line 310 of file gamelog.cpp.
References CC_WARNING, IConsolePrint(), and Print().
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 AfterLoadGame(), and StopAction().
void Gamelog::Reset | ( | ) |
Resets and frees all memory allocated - used before loading or starting a new game.
Definition at line 94 of file gamelog.cpp.
References GLAT_NONE.
Referenced by LoadCheckData::Clear(), DoLoad(), SaveOrLoad(), and ShutdownGame().
void Gamelog::Revision | ( | ) |
Logs a change in game revision.
Definition at line 378 of file gamelog.cpp.
References Change(), GetGamelogRevisionString(), GLAT_LOAD, GLAT_START, and SAVEGAME_VERSION.
Referenced by TestRevision().
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(), DoLoad(), Emergency(), GRFBugReverse(), NewGRFConfirmationCallback(), and SaveOrLoad().
void Gamelog::StopAction | ( | ) |
Stops logging of any changes.
Definition at line 74 of file gamelog.cpp.
References GLAT_NONE, and PrintDebug().
Referenced by IntSettingDesc::ChangeValue(), DoLoad(), Emergency(), GRFBugReverse(), NewGRFConfirmationCallback(), and SaveOrLoad().
void Gamelog::StopAnyAction | ( | ) |
Definition at line 86 of file gamelog.cpp.
bool Gamelog::TestEmergency | ( | ) |
Finds out if current game is a loaded emergency savegame.
Definition at line 364 of file gamelog.cpp.
References GLCT_EMERGENCY.
Referenced by HandleCrash(), and HandleCrash().
void Gamelog::TestMode | ( | ) |
Finds last stored game mode or landscape.
Any change is logged
Definition at line 446 of file gamelog.cpp.
References _settings_game, GameSettings::game_creation, GLCT_MODE, LoggedChangeMode::landscape, GameCreationSettings::landscape, Mode(), and LoggedChangeMode::mode.
Referenced by AfterLoadGame().
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 GetGamelogRevisionString(), GLCT_REVISION, LoggedChangeRevision::newgrf, Revision(), and LoggedChangeRevision::text.
Referenced by AfterLoadGame().
|
friend |
|
private |
|
private |
|
private |