diff --git a/src/gamelog_internal.h b/src/gamelog_internal.h index 755e995e40..914f71389e 100644 --- a/src/gamelog_internal.h +++ b/src/gamelog_internal.h @@ -32,6 +32,13 @@ using GrfIDMapping = std::map; struct LoggedChange { LoggedChange(GamelogChangeType type = GLCT_NONE) : ct(type) {} virtual ~LoggedChange() = default; + + /** + * Format the content of this change into the given output. + * @param output_iterator Destination of the formatted content. + * @param grf_names Cache/mapping of names of NewGRFs seen in the logs. + * @param action_type The context in which this method was called. + */ virtual void FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) = 0; GamelogChangeType ct{}; diff --git a/src/newgrf/newgrf_act3.cpp b/src/newgrf/newgrf_act3.cpp index 0ca425dc2f..6b7eae7104 100644 --- a/src/newgrf/newgrf_act3.cpp +++ b/src/newgrf/newgrf_act3.cpp @@ -153,10 +153,23 @@ static void VehicleMapSpriteGroup(ByteReader &buf, GrfSpecFeature feature, uint8 } } -/** Handler interface for mapping sprite groups. */ +/** Handler interface for mapping sprite groups to their respective feature specific specifications. */ struct MapSpriteGroupHandler { virtual ~MapSpriteGroupHandler() = default; + + /** + * Map a SpriteGroup to specific 'cargo type' of a specification. + * @param local_id The NewGRF-local id to map to. + * @param cid The 'cargo type' to map for. + * @param group The SpriteGroup to link to the specification. + */ virtual void MapSpecific(uint16_t local_id, uint8_t cid, const SpriteGroup *group) = 0; + + /** + * Map default/fallback SpriteGroup to a specification. + * @param local_id The NewGRF-local id to map to. + * @param group The SpriteGroup to link to the specification. + */ virtual void MapDefault(uint16_t local_id, const SpriteGroup *group) = 0; }; diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h index 134f469d6e..7b2714c096 100644 --- a/src/newgrf_commons.h +++ b/src/newgrf_commons.h @@ -201,6 +201,11 @@ protected: uint16_t max_entities; ///< what is the amount of entities, old and new summed uint16_t invalid_id; ///< ID used to detected invalid entities + /** + * Checks whether the given ID is valid in the context of this override manager. + * @param testid The ID to test. + * @return Whether the ID is valid. + */ virtual bool CheckValidNewID([[maybe_unused]] uint16_t testid) { return true; } public: diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index a5c5d07408..57216f1169 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -110,8 +110,10 @@ static inline uint32_t GetVariable(const ResolverObject &object, ScopeResolver * /** * Store a value into the persistent storage area (PSA). Default implementation does nothing (for newgrf classes without storage). + * @param pos The position into the storage area. + * @param value The new value to store. */ -/* virtual */ void ScopeResolver::StorePSA(uint, int32_t) {} +/* virtual */ void ScopeResolver::StorePSA([[maybe_unused]] uint pos, [[maybe_unused]] int32_t value) {} /** * Get the real sprites of the grf. @@ -128,9 +130,11 @@ static inline uint32_t GetVariable(const ResolverObject &object, ScopeResolver * /** * Get a resolver for the \a scope. + * @param scope The scope to resolve. + * @param relative The relative in case of a #VSG_SCOPE_RELATIVE. * @return The resolver for the requested scope. */ -/* virtual */ ScopeResolver *ResolverObject::GetScope(VarSpriteGroupScope, uint8_t) +/* virtual */ ScopeResolver *ResolverObject::GetScope([[maybe_unused]] VarSpriteGroupScope scope, [[maybe_unused]] uint8_t relative) { return &this->default_scope; } diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index 95486aa78f..37a8f7303b 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -47,7 +47,11 @@ extern SpriteGroupPool _spritegroup_pool; struct SpriteGroup : SpriteGroupPool::PoolItem<&_spritegroup_pool> { protected: SpriteGroup(SpriteGroupID index) : SpriteGroupPool::PoolItem<&_spritegroup_pool>(index) {} - /** Base sprite group resolver */ + /** + * Resolves a callback or rerandomisation callback to a NewGRF. + * @param object Information needed to resolve the group. + * @return The result of resolving this SpriteGroup. + */ virtual ResolverResult Resolve(ResolverObject &object) const = 0; public: diff --git a/src/script/api/script_object.hpp b/src/script/api/script_object.hpp index 76e7d3993c..fc8558ca2e 100644 --- a/src/script/api/script_object.hpp +++ b/src/script/api/script_object.hpp @@ -46,8 +46,11 @@ public: SimpleCountedObject() : ref_count(0) {} virtual ~SimpleCountedObject() = default; + /** Increase the reference count by one. */ inline void AddRef() { ++this->ref_count; } + /** Decrease the reference count by one. Once zero call FinaleRelease and then destruct the object. */ void Release(); + /** Called during Release, so the object can throw exceptions (you cannot in destructors). */ virtual void FinalRelease() {}; private: diff --git a/src/window.cpp b/src/window.cpp index 81a8b95f56..3867676bb9 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1101,6 +1101,7 @@ void Window::CloseChildWindowById(WindowClass wc, WindowNumber number) const /** * Hide the window and all its child windows, and mark them for a later deletion. + * @param data Window specific data to be passed through the window close functions. */ void Window::Close([[maybe_unused]] int data) {