1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-29 15:14:33 +01:00

Codefix: add doxygen for DefaultSaveLoadHandler (#15186)

This commit is contained in:
Peter Nelson
2026-01-28 22:42:04 +00:00
committed by GitHub
parent 4adf494ebc
commit 526ee6434d

View File

@@ -537,7 +537,7 @@ using SaveLoadCompatTable = std::span<const struct SaveLoadCompat>;
/** Handler for saving/loading an object to/from disk. */
class SaveLoadHandler {
public:
std::optional<std::vector<SaveLoad>> load_description;
std::optional<std::vector<SaveLoad>> load_description; ///< Description derived from savegame being loaded.
virtual ~SaveLoadHandler() = default;
@@ -567,11 +567,13 @@ public:
/**
* Get the description of the fields in the savegame.
* @return Save load description.
*/
virtual SaveLoadTable GetDescription() const = 0;
/**
* Get the pre-header description of the fields in the savegame.
* @return Compatibility save load description.
*/
virtual SaveLoadCompatTable GetCompatDescription() const = 0;
@@ -598,17 +600,34 @@ template <class TImpl, class TObject>
class DefaultSaveLoadHandler : public SaveLoadHandler {
public:
SaveLoadTable GetDescription() const override { return static_cast<const TImpl *>(this)->description; }
SaveLoadCompatTable GetCompatDescription() const override { return static_cast<const TImpl *>(this)->compat_description; }
/**
* Save the object to disk.
* @param object The object to store.
*/
virtual void Save([[maybe_unused]] TObject *object) const {}
void Save(void *object) const override { this->Save(static_cast<TObject *>(object)); }
/**
* Load the object from disk.
* @param object The object to load.
*/
virtual void Load([[maybe_unused]] TObject *object) const {}
void Load(void *object) const override { this->Load(static_cast<TObject *>(object)); }
/**
* Similar to load, but used only to validate savegames.
* @param object The object to load.
*/
virtual void LoadCheck([[maybe_unused]] TObject *object) const {}
void LoadCheck(void *object) const override { this->LoadCheck(static_cast<TObject *>(object)); }
/**
* A post-load callback to fix #SL_REF integers into pointers.
* @param object The object to fix.
*/
virtual void FixPointers([[maybe_unused]] TObject *object) const {}
void FixPointers(void *object) const override { this->FixPointers(static_cast<TObject *>(object)); }
};