diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 632feaf5c6..f644312222 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -55,7 +55,11 @@ void CcTerraform(Commands, const CommandCost &result, Money, TileIndex tile) } -/** Scenario editor command that generates desert areas */ +/** + * Scenario editor command that generates desert areas. + * @param end The end tile of the map drag. + * @param start The start tile of the map drag. + */ static void GenerateDesertArea(TileIndex end, TileIndex start) { if (_game_mode != GM_EDITOR) return; @@ -72,7 +76,11 @@ static void GenerateDesertArea(TileIndex end, TileIndex start) InvalidateWindowClassesData(WC_TOWN_VIEW, 0); } -/** Scenario editor command that generates rocky areas */ +/** + * Scenario editor command that generates rocky areas. + * @param end The end tile of the map drag. + * @param start The start tile of the map drag. + */ static void GenerateRockyArea(TileIndex end, TileIndex start) { if (_game_mode != GM_EDITOR) return; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 316823453a..3379868be2 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1189,6 +1189,7 @@ static CallBackFunction ToolbarSwitchClick(Window *w) /** * Called when clicking at the date panel of the scenario editor toolbar. + * @copydoc ToolbarButtonProc */ static CallBackFunction ToolbarScenDatePanel(Window *w) { @@ -1938,7 +1939,12 @@ class NWidgetScenarioToolbarContainer : public NWidgetToolbarContainer { /* --- Toolbar handling for the 'normal' case */ -typedef CallBackFunction ToolbarButtonProc(Window *w); +/** + * Callback for when a button is clicked in the given window. + * @param w The clicked window. + * @return The callback function. + */ +using ToolbarButtonProc = CallBackFunction(Window *w); static ToolbarButtonProc * const _toolbar_button_procs[] = { ToolbarPauseClick, diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 351cfdfe1b..176bd22f90 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -170,8 +170,9 @@ Town::~Town() /** * Invalidating of the "nearest town cache" has to be done * after removing item from the pool. + * @copydoc Pool::PoolItem::PostDestructor */ -void Town::PostDestructor(size_t) +void Town::PostDestructor([[maybe_unused]] size_t index) { InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_FORCE_REBUILD); UpdateNearestTownForRoadTiles(false); @@ -931,6 +932,7 @@ static RoadBits GetTownRoadBits(TileIndex tile) /** * Get the road type that towns should build at this current moment. * They may have built a different type in the past. + * @return The best road type for towns at this time. */ RoadType GetTownRoadType() { @@ -1471,6 +1473,7 @@ static bool TownCanGrowRoad(TileIndex tile) /** * Check if the town is allowed to build roads. + * @param modes The configuration of the town growth. * @return true If the town is allowed to build roads. */ static inline bool TownAllowedToBuildRoads(TownExpandModes modes) @@ -2698,6 +2701,7 @@ static inline bool TownLayoutAllows2x2HouseHere(Town *t, TileIndex tile, TownExp * @param noslope Are foundations disallowed for this house? * @param second The diagdir from the first tile to the second tile. * @param modes The parts of the town that are being grown. + * @return \c true iff a 2x1 or 1x2 house can be built. */ static bool CheckTownBuild2House(TileIndex *tile, Town *t, int maxz, bool noslope, DiagDirection second, TownExpandModes modes) { @@ -2724,6 +2728,7 @@ static bool CheckTownBuild2House(TileIndex *tile, Town *t, int maxz, bool noslop * @param maxz The maximum Z level, since all tiles must have the same height. * @param noslope Are foundations disallowed for this house? * @param modes The parts of the town that are being grown. + * @return \c true iff a 2x2 house can be built. */ static bool CheckTownBuild2x2House(TileIndex *tile, Town *t, int maxz, bool noslope, TownExpandModes modes) { diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 05aab1433e..f64ad6e126 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -529,6 +529,7 @@ public: /** * Gets the desired height for the information panel. + * @param width The width of the panel in pixels. * @return the desired height in pixels. */ uint GetDesiredInfoHeight(int width) const diff --git a/src/track_func.h b/src/track_func.h index 49c81d4764..423cf847a8 100644 --- a/src/track_func.h +++ b/src/track_func.h @@ -325,6 +325,7 @@ inline TrackdirBits TrackBitsToTrackdirBits(TrackBits bits) * Checks whether a TrackBits has a given Track. * @param tracks The track bits. * @param track The track to check. + * @return \c true iff \c track is in \c tracks. */ inline bool HasTrack(TrackBits tracks, Track track) { @@ -336,6 +337,7 @@ inline bool HasTrack(TrackBits tracks, Track track) * Checks whether a TrackdirBits has a given Trackdir. * @param trackdirs The trackdir bits. * @param trackdir The trackdir to check. + * @return \c true iff \c trackdir is in \c trackdirs. */ inline bool HasTrackdir(TrackdirBits trackdirs, Trackdir trackdir) { @@ -494,6 +496,9 @@ inline Trackdir TrackEnterdirToTrackdir(Track track, DiagDirection diagdir) /** * Maps a track and a full (8-way) direction to the trackdir that represents * the track running in the given direction. + * @param track The track to get the trackdir for. + * @param dir The direction along the track. + * @return The resulting trackdir. */ inline Trackdir TrackDirectionToTrackdir(Track track, Direction dir) { diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index efccdcade5..0267b872a7 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -717,7 +717,10 @@ static CommandCost CmdBuildRailWagon(DoCommandFlags flags, TileIndex tile, const return CommandCost(); } -/** Move all free vehicles in the depot to the train */ +/** + * Move all free vehicles in the depot to the train. + * @param u The train to move the free vehicles to. + */ void NormalizeTrainVehInDepot(const Train *u) { assert(u->IsEngine()); @@ -2215,7 +2218,6 @@ ClosestDepot Train::FindClosestDepot() return ClosestDepot(tfdd.tile, GetDepotIndex(tfdd.tile), tfdd.reverse); } -/** Play a sound for a train leaving the station. */ void Train::PlayLeaveStationSound(bool force) const { static const SoundFx sfx[] = { @@ -2512,7 +2514,10 @@ static Track DoTrainPathfind(const Train *v, TileIndex tile, DiagDirection enter /** * Extend a train path as far as possible. Stops on encountering a safe tile, * another reservation or a track choice. - * @return INVALID_TILE indicates that the reservation failed. + * @param v The train to extend the reservation for. + * @param new_tracks Optional pointer to the track bits at the end of the reservation. + * @param enterdir Optional pointer to the enter dir at the end of the reservation. + * @return Information about the reservation, empty if no path could be found. */ static PBSTileInfo ExtendTrainReservation(const Train *v, TrackBits *new_tracks, DiagDirection *enterdir) { @@ -3247,6 +3252,7 @@ static uint CheckTrainCollision(Vehicle *v, Train *t) * Reports the incident in a flashy news item, modifies station ratings and * plays a sound. * @param v %Train to test. + * @return \c true iff there has been a collision. */ static bool CheckTrainCollision(Train *v) { diff --git a/src/train_gui.cpp b/src/train_gui.cpp index 5ba28b3340..1968046ae9 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -185,7 +185,11 @@ struct CargoSummaryItem { uint amount; ///< Amount that is carried StationID source; ///< One of the source stations - /** Used by std::find() and similar functions */ + /** + * Used by std::find() and similar functions. + * @param other The other item. + * @return \c true iff both items have the same cargo. + */ inline bool operator == (const CargoSummaryItem &other) const { return !(this->cargo != other.cargo); diff --git a/src/transparency.h b/src/transparency.h index 8eaa980b71..934f360505 100644 --- a/src/transparency.h +++ b/src/transparency.h @@ -46,6 +46,7 @@ extern StationFacilities _facility_display_opt; * and if we aren't in the game menu (there's never transparency) * * @param to the structure which transparency option is ask for + * @return \c true if transparency is set for the option, and not in the main menu. */ inline bool IsTransparencySet(TransparencyOption to) { @@ -57,6 +58,7 @@ inline bool IsTransparencySet(TransparencyOption to) * and if we aren't in the game menu (there's never transparency) * * @param to the structure which invisibility option is ask for + * @return \c true if invisibility is set for the option, and not in the main menu. */ inline bool IsInvisibilitySet(TransparencyOption to) { diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index 23f4d711ee..68fdb13443 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -254,7 +254,7 @@ public: * Make widgets for the current available tree types. * This does not use a NWID_MATRIX or WWT_MATRIX control as those are more difficult to * get producing the correct result than dynamically building the widgets is. - * @see NWidgetFunctionType + * @copydoc NWidgetFunctionType */ static std::unique_ptr MakeTreeTypeButtons() { diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 9f4e5f5274..7e70041d2d 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -567,7 +567,14 @@ void DepotSortList(VehicleList *list) std::sort(list->begin(), list->end(), &VehicleNumberSorter); } -/** draw the vehicle profit button in the vehicle list window. */ +/** + * Draw the vehicle profit button in the vehicle list window. + * @param age The age of the vehicle. + * @param display_profit_last_year The profit last year. + * @param num_vehicles The number of vehicles in the group. + * @param x The X-coordinate to draw the button at. + * @param y The Y-coordinate to draw the button at. + */ static void DrawVehicleProfitButton(TimerGameEconomy::Date age, Money display_profit_last_year, uint num_vehicles, int x, int y) { SpriteID spr; @@ -1354,7 +1361,14 @@ void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *pare w->parent = parent; } -/** Display list of cargo types of the engine, for the purchase information window */ +/** + * Display list of cargo types of the engine, for the purchase information window. + * @param left The left bound of the area to draw in. + * @param right The right bound of the area to draw in. + * @param y The top bound of the area to draw in. + * @param engine The engine to draw the options for. + * @return The bottom of the area that was drawn to. + */ uint ShowRefitOptionsList(int left, int right, int y, EngineID engine) { /* List of cargo types of this engine */ @@ -1684,7 +1698,14 @@ static void DrawSmallOrderList(const Vehicle *v, int left, int right, int y, uin } while (oid != start); } -/** Draw small order list in the vehicle GUI, but without the little black arrow. This is used for shared order groups. */ +/** + * Draw small order list in the vehicle GUI, but without the little black arrow. This is used for shared order groups. + * @param orderlist The list of orders to draw. + * @param left The left bound of the area to draw in. + * @param right The right bound of the area to draw in. + * @param y The top bound of the area to draw in. + * @param order_arrow_width The width of the order arrow. + */ static void DrawSmallOrderList(const OrderList *orderlist, int left, int right, int y, uint order_arrow_width) { if (orderlist == nullptr) return; @@ -2411,7 +2432,11 @@ struct VehicleDetailsWindow : Window { TrainDetailsWindowTabs tab = TDW_TAB_CARGO; ///< For train vehicles: which tab is displayed. Scrollbar *vscroll = nullptr; - /** Initialize a newly created vehicle details window */ + /** + * Initialize a newly created vehicle details window. + * @param desc The configuration of the window. + * @param window_number The unique number of the window within the class. + */ VehicleDetailsWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc) { const Vehicle *v = Vehicle::Get(window_number); @@ -2818,7 +2843,10 @@ static WindowDesc _nontrain_vehicle_details_desc( _nested_nontrain_vehicle_details_widgets ); -/** Shows the vehicle details window of the given vehicle. */ +/** + * Shows the vehicle details window of the given vehicle. + * @param v The vehicle to show the window for. + */ static void ShowVehicleDetailsWindow(const Vehicle *v) { CloseWindowById(WC_VEHICLE_ORDERS, v->index, false); @@ -3450,7 +3478,10 @@ static WindowDesc _train_view_desc( &VehicleViewWindow::hotkeys ); -/** Shows the vehicle view window of the given vehicle. */ +/** + * Shows the vehicle view window of the given vehicle. + * @param v The vehicle to show the view for. + */ void ShowVehicleViewWindow(const Vehicle *v) { AllocateWindowDescFront((v->type == VEH_TRAIN) ? _train_view_desc : _vehicle_view_desc, v->index);