diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index 51feff2888..c5a81c1d4b 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -25,8 +25,7 @@ * types w/ or w/o 90-deg turns allowed */ template -struct CFollowTrackT -{ +struct CFollowTrackT { enum ErrorCode : uint8_t { EC_NONE, EC_OWNER, diff --git a/src/pathfinder/water_regions.cpp b/src/pathfinder/water_regions.cpp index 4ef9694af1..52b460d7b1 100644 --- a/src/pathfinder/water_regions.cpp +++ b/src/pathfinder/water_regions.cpp @@ -60,8 +60,7 @@ class WaterRegionData { * only to tiles within the square section, there is no knowledge about the rest of the map. This makes it easy to invalidate * and update a water region if any changes are made to it, such as construction or terraforming. */ -class WaterRegion -{ +class WaterRegion { private: WaterRegionData &data; const OrthogonalTileArea tile_area; diff --git a/src/pathfinder/water_regions.h b/src/pathfinder/water_regions.h index 4e35f7090c..0e93f2dbbd 100644 --- a/src/pathfinder/water_regions.h +++ b/src/pathfinder/water_regions.h @@ -24,8 +24,7 @@ constexpr WaterRegionPatchLabel INVALID_WATER_REGION_PATCH{0}; /** * Describes a single interconnected patch of water within a particular water region. */ -struct WaterRegionPatchDesc -{ +struct WaterRegionPatchDesc { int x; ///< The X coordinate of the water region, i.e. X=2 is the 3rd water region along the X-axis int y; ///< The Y coordinate of the water region, i.e. Y=2 is the 3rd water region along the Y-axis WaterRegionPatchLabel label; ///< Unique label identifying the patch within the region @@ -37,8 +36,7 @@ struct WaterRegionPatchDesc /** * Describes a single square water region. */ -struct WaterRegionDesc -{ +struct WaterRegionDesc { int x; ///< The X coordinate of the water region, i.e. X=2 is the 3rd water region along the X-axis int y; ///< The Y coordinate of the water region, i.e. Y=2 is the 3rd water region along the Y-axis diff --git a/src/pathfinder/yapf/yapf_common.hpp b/src/pathfinder/yapf/yapf_common.hpp index 58e78150a2..5e0765c5c0 100644 --- a/src/pathfinder/yapf/yapf_common.hpp +++ b/src/pathfinder/yapf/yapf_common.hpp @@ -16,8 +16,7 @@ /** YAPF origin provider base class - used when origin is one tile / multiple trackdirs */ template -class CYapfOriginTileT -{ +class CYapfOriginTileT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::NodeList::Item Node; ///< this will be our node type @@ -56,8 +55,7 @@ public: /** YAPF origin provider base class - used when there are two tile/trackdir origins */ template -class CYapfOriginTileTwoWayT -{ +class CYapfOriginTileTwoWayT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::NodeList::Item Node; ///< this will be our node type diff --git a/src/pathfinder/yapf/yapf_costcache.hpp b/src/pathfinder/yapf/yapf_costcache.hpp index 43f3f31b21..12a377aef6 100644 --- a/src/pathfinder/yapf/yapf_costcache.hpp +++ b/src/pathfinder/yapf/yapf_costcache.hpp @@ -20,8 +20,7 @@ * defined (they don't count with any segment cost caching). */ template -class CYapfSegmentCostCacheNoneT -{ +class CYapfSegmentCostCacheNoneT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::NodeList::Item Node; ///< this will be our node type @@ -43,8 +42,7 @@ public: * to be shared between all rail YAPF types (one shared counter, one notification * function. */ -struct CSegmentCostCacheBase -{ +struct CSegmentCostCacheBase { static int s_rail_change_counter; static void NotifyTrackLayoutChange(TileIndex, Track) diff --git a/src/pathfinder/yapf/yapf_node.hpp b/src/pathfinder/yapf/yapf_node.hpp index d08302e1f1..6d635bcf33 100644 --- a/src/pathfinder/yapf/yapf_node.hpp +++ b/src/pathfinder/yapf/yapf_node.hpp @@ -44,8 +44,7 @@ struct CYapfNodeKeyExitDir { } }; -struct CYapfNodeKeyTrackDir : public CYapfNodeKeyExitDir -{ +struct CYapfNodeKeyTrackDir : public CYapfNodeKeyExitDir { inline int CalcHash() const { return this->td | (this->tile.base() << 4); diff --git a/src/pathfinder/yapf/yapf_node_rail.hpp b/src/pathfinder/yapf/yapf_node_rail.hpp index e6131589b4..fafa75dbca 100644 --- a/src/pathfinder/yapf/yapf_node_rail.hpp +++ b/src/pathfinder/yapf/yapf_node_rail.hpp @@ -17,8 +17,7 @@ #include "yapf_type.hpp" /** key for cached segment cost for rail YAPF */ -struct CYapfRailSegmentKey -{ +struct CYapfRailSegmentKey { uint32_t value; inline CYapfRailSegmentKey(const CYapfNodeKeyTrackDir &node_key) @@ -64,8 +63,7 @@ struct CYapfRailSegmentKey }; /** cached segment cost for rail YAPF */ -struct CYapfRailSegment -{ +struct CYapfRailSegment { typedef CYapfRailSegmentKey Key; CYapfRailSegmentKey key; @@ -113,10 +111,8 @@ struct CYapfRailSegment /** Yapf Node for rail YAPF */ template -struct CYapfRailNodeT - : CYapfNodeT > -{ - typedef CYapfNodeT > base; +struct CYapfRailNodeT : CYapfNodeT> { + typedef CYapfNodeT> base; typedef CYapfRailSegment CachedData; CYapfRailSegment *segment; diff --git a/src/pathfinder/yapf/yapf_node_road.hpp b/src/pathfinder/yapf/yapf_node_road.hpp index 58992f6fea..0a9dc59648 100644 --- a/src/pathfinder/yapf/yapf_node_road.hpp +++ b/src/pathfinder/yapf/yapf_node_road.hpp @@ -17,8 +17,8 @@ /** Yapf Node for road YAPF */ template -struct CYapfRoadNodeT : CYapfNodeT > { - typedef CYapfNodeT > base; +struct CYapfRoadNodeT : CYapfNodeT> { + typedef CYapfNodeT> base; TileIndex segment_last_tile; Trackdir segment_last_td; diff --git a/src/pathfinder/yapf/yapf_node_ship.hpp b/src/pathfinder/yapf/yapf_node_ship.hpp index 99b0f5353f..a6eae6a12e 100644 --- a/src/pathfinder/yapf/yapf_node_ship.hpp +++ b/src/pathfinder/yapf/yapf_node_ship.hpp @@ -17,8 +17,8 @@ /** Yapf Node for ships */ template -struct CYapfShipNodeT : CYapfNodeT > { - typedef CYapfNodeT > base; +struct CYapfShipNodeT : CYapfNodeT> { + typedef CYapfNodeT> base; TileIndex segment_last_tile; Trackdir segment_last_td; diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp index df31a27b93..b462b4eee8 100644 --- a/src/pathfinder/yapf/yapf_rail.cpp +++ b/src/pathfinder/yapf/yapf_rail.cpp @@ -33,8 +33,7 @@ template void DumpState(Tpf &pf1, Tpf &pf2) } template -class CYapfReserveTrack -{ +class CYapfReserveTrack { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; @@ -208,8 +207,7 @@ public: }; template -class CYapfFollowAnyDepotRailT -{ +class CYapfFollowAnyDepotRailT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; @@ -300,8 +298,7 @@ public: }; template -class CYapfFollowAnySafeTileRailT : public CYapfReserveTrack -{ +class CYapfFollowAnySafeTileRailT : public CYapfReserveTrack { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; @@ -383,8 +380,7 @@ public: }; template -class CYapfFollowRailT : public CYapfReserveTrack -{ +class CYapfFollowRailT : public CYapfReserveTrack { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; @@ -533,8 +529,7 @@ public: }; template class TdestinationT, template class TfollowT> -struct CYapfRail_TypesT -{ +struct CYapfRail_TypesT { typedef CYapfRail_TypesT Types; typedef Tpf_ Tpf; @@ -549,14 +544,14 @@ struct CYapfRail_TypesT typedef CYapfCostRailT PfCost; }; -struct CYapfRail1 : CYapfT > {}; -struct CYapfRail2 : CYapfT > {}; +struct CYapfRail1 : CYapfT> {}; +struct CYapfRail2 : CYapfT> {}; -struct CYapfAnyDepotRail1 : CYapfT > {}; -struct CYapfAnyDepotRail2 : CYapfT > {}; +struct CYapfAnyDepotRail1 : CYapfT> {}; +struct CYapfAnyDepotRail2 : CYapfT> {}; -struct CYapfAnySafeTileRail1 : CYapfT > {}; -struct CYapfAnySafeTileRail2 : CYapfT > {}; +struct CYapfAnySafeTileRail1 : CYapfT> {}; +struct CYapfAnySafeTileRail2 : CYapfT> {}; Track YapfTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, PBSTileInfo *target, TileIndex *dest) diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index cb240b79ed..87506e8652 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -16,8 +16,7 @@ template -class CYapfCostRoadT -{ +class CYapfCostRoadT { public: typedef typename Types::Tpf Tpf; ///< pathfinder (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; ///< track follower helper @@ -184,8 +183,7 @@ public: template -class CYapfDestinationAnyDepotRoadT -{ +class CYapfDestinationAnyDepotRoadT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; @@ -222,8 +220,7 @@ public: template -class CYapfDestinationTileRoadT -{ +class CYapfDestinationTileRoadT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; @@ -323,8 +320,7 @@ public: template -class CYapfFollowRoadT -{ +class CYapfFollowRoadT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class) typedef typename Types::TrackFollower TrackFollower; @@ -503,8 +499,7 @@ public: }; template class Tdestination> -struct CYapfRoad_TypesT -{ +struct CYapfRoad_TypesT { typedef CYapfRoad_TypesT Types; typedef Tpf_ Tpf; @@ -519,11 +514,11 @@ struct CYapfRoad_TypesT typedef CYapfCostRoadT PfCost; }; -struct CYapfRoad1 : CYapfT > {}; -struct CYapfRoad2 : CYapfT > {}; +struct CYapfRoad1 : CYapfT> {}; +struct CYapfRoad2 : CYapfT> {}; -struct CYapfRoadAnyDepot1 : CYapfT > {}; -struct CYapfRoadAnyDepot2 : CYapfT > {}; +struct CYapfRoadAnyDepot1 : CYapfT> {}; +struct CYapfRoadAnyDepot2 : CYapfT> {}; Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool &path_found, RoadVehPathCache &path_cache) diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp index 9698cc603f..3596b2126f 100644 --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -24,8 +24,7 @@ constexpr int MAX_SHIP_PF_NODES = (NUMBER_OR_WATER_REGIONS_LOOKAHEAD + 1) * WATE constexpr int SHIP_LOST_PATH_LENGTH = 8; // The length of the (aimless) path assigned when a ship is lost. template -class CYapfDestinationTileWaterT -{ +class CYapfDestinationTileWaterT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class). typedef typename Types::TrackFollower TrackFollower; @@ -123,8 +122,7 @@ public: /** Node Follower module of YAPF for ships */ template -class CYapfFollowShipT -{ +class CYapfFollowShipT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class). typedef typename Types::TrackFollower TrackFollower; @@ -325,8 +323,7 @@ public: /** Cost Provider module of YAPF for ships. */ template -class CYapfCostShipT -{ +class CYapfCostShipT { public: typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class). typedef typename Types::TrackFollower TrackFollower; @@ -415,8 +412,7 @@ public: * Defines all 6 base YAPF modules as classes providing services for CYapfBaseT. */ template -struct CYapfShip_TypesT -{ +struct CYapfShip_TypesT { typedef CYapfShip_TypesT Types; ///< Shortcut for this struct type. typedef Tpf_ Tpf; ///< Pathfinder type. typedef Ttrack_follower TrackFollower; ///< Track follower helper class. @@ -432,8 +428,7 @@ struct CYapfShip_TypesT typedef CYapfCostShipT PfCost; ///< Cost provider. }; -struct CYapfShip : CYapfT > -{ +struct CYapfShip : CYapfT> { explicit CYapfShip(int max_nodes) { this->max_search_nodes = max_nodes; } }; diff --git a/src/pathfinder/yapf/yapf_ship_regions.cpp b/src/pathfinder/yapf/yapf_ship_regions.cpp index 0a1a831a05..19ea441613 100644 --- a/src/pathfinder/yapf/yapf_ship_regions.cpp +++ b/src/pathfinder/yapf/yapf_ship_regions.cpp @@ -40,7 +40,7 @@ inline uint ManhattanDistance(const CYapfRegionPatchNodeKey &a, const CYapfRegio /** Yapf Node for water regions. */ template -struct CYapfRegionNodeT : CYapfNodeT > { +struct CYapfRegionNodeT : CYapfNodeT> { typedef Tkey_ Key; typedef CYapfRegionNodeT Node; @@ -73,8 +73,7 @@ struct CYapfRegionNodeT : CYapfNodeT > { /** YAPF origin for water regions. */ template -class CYapfOriginRegionT -{ +class CYapfOriginRegionT { public: typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class). typedef typename Types::NodeList::Item Node; ///< This will be our node type. @@ -110,8 +109,7 @@ public: /** YAPF destination provider for water regions. */ template -class CYapfDestinationRegionT -{ +class CYapfDestinationRegionT { public: typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class). typedef typename Types::NodeList::Item Node; ///< This will be our node type. @@ -150,8 +148,7 @@ public: /** YAPF node following for water region pathfinding. */ template -class CYapfFollowRegionT -{ +class CYapfFollowRegionT { public: typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class). typedef typename Types::TrackFollower TrackFollower; @@ -222,8 +219,7 @@ public: /** Cost Provider of YAPF for water regions. */ template -class CYapfCostRegionT -{ +class CYapfCostRegionT { public: typedef typename Types::Tpf Tpf; ///< The pathfinder class (derived from THIS class). typedef typename Types::TrackFollower TrackFollower; @@ -263,8 +259,7 @@ struct DummyFollower : public CFollowTrackWater {}; * Defines all 6 base YAPF modules as classes providing services for CYapfBaseT. */ template -struct CYapfRegion_TypesT -{ +struct CYapfRegion_TypesT { typedef CYapfRegion_TypesT Types; ///< Shortcut for this struct type. typedef Tpf_ Tpf; ///< Pathfinder type. typedef DummyFollower TrackFollower; ///< Track follower helper class @@ -282,8 +277,7 @@ struct CYapfRegion_TypesT typedef NodeList, 12, 12> CRegionNodeListWater; -struct CYapfRegionWater : CYapfT> -{ +struct CYapfRegionWater : CYapfT> { explicit CYapfRegionWater(int max_nodes) { this->max_search_nodes = max_nodes; } };