diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index c08fb1f6fe..a1efa7452c 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -537,7 +537,7 @@ using SaveLoadCompatTable = std::span; /** Handler for saving/loading an object to/from disk. */ class SaveLoadHandler { public: - std::optional> load_description; + std::optional> 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 DefaultSaveLoadHandler : public SaveLoadHandler { public: SaveLoadTable GetDescription() const override { return static_cast(this)->description; } + SaveLoadCompatTable GetCompatDescription() const override { return static_cast(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(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(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(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(object)); } };