diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 052c749420..e76c508f92 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -93,6 +93,7 @@ static const SpriteID _aircraft_sprite[] = { 0x0EBD, 0x0EC5 }; +/** @copydoc IsValidImageIndex */ template <> bool IsValidImageIndex(uint8_t image_index) { diff --git a/src/base_media_base.h b/src/base_media_base.h index 5b3f9ab66a..8d3231500e 100644 --- a/src/base_media_base.h +++ b/src/base_media_base.h @@ -51,7 +51,8 @@ struct BaseSet { /** Ensure the destructor of the sub classes are called as well. */ virtual ~BaseSet() = default; - typedef std::unordered_map> TranslatedStrings; + /** Mapping of translations: language -> string. */ + using TranslatedStrings = std::unordered_map>; /** Number of files in this set */ static constexpr size_t NUM_FILES = BaseSetTraits::num_files; @@ -96,6 +97,11 @@ struct BaseSet { const IniItem *GetMandatoryItem(std::string_view full_filename, const IniGroup &group, std::string_view name) const; bool FillSetDetails(const IniFile &ini, const std::string &path, const std::string &full_filename, bool allow_empty_filename = true); + + /** + * Copy settings from the given set into this set when they are compatible. + * @param src The location to copy settings from. + */ void CopyCompatibleConfig([[maybe_unused]] const T &src) {} /** diff --git a/src/base_media_graphics.h b/src/base_media_graphics.h index b9c53d9fef..f20a143a6f 100644 --- a/src/base_media_graphics.h +++ b/src/base_media_graphics.h @@ -31,10 +31,11 @@ enum BlitterType : uint8_t { struct GRFConfig; +/** Instantiation of BaseSetTraits for a GraphicSet. */ template <> struct BaseSetTraits { - static constexpr size_t num_files = MAX_GFT; - static constexpr bool search_in_tars = true; - static constexpr std::string_view set_type = "graphics"; + static constexpr size_t num_files = MAX_GFT; ///< Number of files in a graphics set. + static constexpr bool search_in_tars = true; ///< Graphics can be in a tar file. + static constexpr std::string_view set_type = "graphics"; ///< The type of set. }; /** All data of a graphics set. */ diff --git a/src/base_media_music.h b/src/base_media_music.h index 4aed1832f5..d5c2195090 100644 --- a/src/base_media_music.h +++ b/src/base_media_music.h @@ -43,10 +43,11 @@ struct MusicSongInfo { bool loop; ///< song should play in a tight loop if possible, never ending }; +/** Instantiation of BaseSetTraits for a MusicSet. */ template <> struct BaseSetTraits { - static constexpr size_t num_files = NUM_SONGS_AVAILABLE; - static constexpr bool search_in_tars = false; - static constexpr std::string_view set_type = "music"; + static constexpr size_t num_files = NUM_SONGS_AVAILABLE; ///< Maximum number of files in a music set. + static constexpr bool search_in_tars = false; ///< Music cannot be in a tar file. + static constexpr std::string_view set_type = "music"; ///< The type of set. }; /** All data of a music set. */ diff --git a/src/base_media_sounds.h b/src/base_media_sounds.h index 45baaf0dc1..14f7e4ac27 100644 --- a/src/base_media_sounds.h +++ b/src/base_media_sounds.h @@ -12,10 +12,11 @@ #include "base_media_base.h" +/** Instantiation of BaseSetTraits for a SoundsSet. */ template <> struct BaseSetTraits { - static constexpr size_t num_files = 1; - static constexpr bool search_in_tars = true; - static constexpr std::string_view set_type = "sounds"; + static constexpr size_t num_files = 1; ///< Number of files in a sound set. + static constexpr bool search_in_tars = true; ///< Sounds can be in a tar file. + static constexpr std::string_view set_type = "sounds"; ///< The type of set. }; /** All data of a sounds set. */ diff --git a/src/base_station_base.h b/src/base_station_base.h index ce29fba7e0..3f2297c44a 100644 --- a/src/base_station_base.h +++ b/src/base_station_base.h @@ -339,7 +339,9 @@ struct SpecializedStation : public BaseStation { * @return Speclist of custom spec type. */ template std::vector> &GetStationSpecList(BaseStation *bst); +/** @copydoc GetStationSpecList */ template <> inline std::vector> &GetStationSpecList(BaseStation *bst) { return bst->speclist; } +/** @copydoc GetStationSpecList */ template <> inline std::vector> &GetStationSpecList(BaseStation *bst) { return bst->roadstop_speclist; } #endif /* BASE_STATION_BASE_H */ diff --git a/src/cargoaction.h b/src/cargoaction.h index 16b9b65861..e1b057ac79 100644 --- a/src/cargoaction.h +++ b/src/cargoaction.h @@ -24,6 +24,11 @@ protected: uint Preprocess(CargoPacket *cp); bool Postprocess(CargoPacket *cp, uint remove); public: + /** + * Create the removal. + * @param source The source of the cargo. + * @param max_move The maximum amount of cargo to be removed. + */ CargoRemoval(Tsource *source, uint max_move) : source(source), max_move(max_move) {} /** @@ -42,6 +47,14 @@ protected: CargoPayment *payment; ///< Payment object where payments will be registered. CargoType cargo; ///< The cargo type of the cargo. public: + /** + * Create the delivery. + * @param source The source of the cargo. + * @param max_move The maximum amount of cargo to be moved. + * @param cargo The type of cargo. + * @param payment The payment for the delivery. + * @param current_tile The tile the data is being delivered from. + */ CargoDelivery(VehicleCargoList *source, uint max_move, CargoType cargo, CargoPayment *payment, TileIndex current_tile) : CargoRemoval(source, max_move), current_tile(current_tile), payment(payment), cargo(cargo) {} bool operator()(CargoPacket *cp); @@ -60,6 +73,12 @@ protected: uint max_move; ///< Maximum amount of cargo to be moved with this action. CargoPacket *Preprocess(CargoPacket *cp); public: + /** + * Create the movement. + * @param source The source of the cargo. + * @param destination The destination of the cargo. + * @param max_move The maximum amount of cargo to be moved. + */ CargoMovement(Tsource *source, Tdest *destination, uint max_move) : source(source), destination(destination), max_move(max_move) {} /** @@ -120,10 +139,19 @@ public: template class CargoReroute : public CargoMovement { protected: - StationID avoid; - StationID avoid2; - const GoodsEntry *ge; + StationID avoid; ///< First station to avoid during rerouting. + StationID avoid2; ///< Second station to avoid during rerouting, could be StationID::Invalid(). + const GoodsEntry *ge; ///< Goods that are to be rerouted. public: + /** + * Create the movement. + * @param source The source of the cargo. + * @param dest The destination of the cargo. + * @param max_move The maximum amount of cargo to be moved. + * @param avoid First station to avoid. + * @param avoid2 Optional second station to avoid (use StationID::Invalid()). + * @param ge The goods to reroute. + */ CargoReroute(Tlist *source, Tlist *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge) : CargoMovement(source, dest, max_move), avoid(avoid), avoid2(avoid2), ge(ge) {} }; diff --git a/src/command_type.h b/src/command_type.h index 16f1e88ee2..0162433c15 100644 --- a/src/command_type.h +++ b/src/command_type.h @@ -452,17 +452,17 @@ enum class CommandPauseLevel : uint8_t { template struct CommandFunctionTraitHelper; template struct CommandFunctionTraitHelper { - using Args = std::tuple...>; - using RetTypes = void; - using CbArgs = Args; - using CbProcType = void(*)(Commands, const CommandCost &); + using Args = std::tuple...>; ///< \c std::tuple with argument types for the command. + using RetTypes = void; ///< The return type of the command. + using CbArgs = Args; ///< The argument type of the callback. + using CbProcType = void(*)(Commands, const CommandCost &); ///< The function prototype of the callback. }; template