1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-03 03:49:12 +00:00

Codechange: Remove line break before opening brace of Yapf classes. (#14513)

This commit is contained in:
2025-08-12 21:08:41 +01:00
committed by GitHub
parent f1a33d50a7
commit f898acae3e
13 changed files with 49 additions and 83 deletions

View File

@@ -25,8 +25,7 @@
* types w/ or w/o 90-deg turns allowed
*/
template <TransportType Ttr_type_, typename VehicleType, bool T90deg_turns_allowed_ = true, bool Tmask_reserved_tracks = false>
struct CFollowTrackT
{
struct CFollowTrackT {
enum ErrorCode : uint8_t {
EC_NONE,
EC_OWNER,

View File

@@ -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;

View File

@@ -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

View File

@@ -16,8 +16,7 @@
/** YAPF origin provider base class - used when origin is one tile / multiple trackdirs */
template <class Types>
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 Types>
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

View File

@@ -20,8 +20,7 @@
* defined (they don't count with any segment cost caching).
*/
template <class Types>
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)

View File

@@ -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);

View File

@@ -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 <class Tkey_>
struct CYapfRailNodeT
: CYapfNodeT<Tkey_, CYapfRailNodeT<Tkey_> >
{
typedef CYapfNodeT<Tkey_, CYapfRailNodeT<Tkey_> > base;
struct CYapfRailNodeT : CYapfNodeT<Tkey_, CYapfRailNodeT<Tkey_>> {
typedef CYapfNodeT<Tkey_, CYapfRailNodeT<Tkey_>> base;
typedef CYapfRailSegment CachedData;
CYapfRailSegment *segment;

View File

@@ -17,8 +17,8 @@
/** Yapf Node for road YAPF */
template <class Tkey_>
struct CYapfRoadNodeT : CYapfNodeT<Tkey_, CYapfRoadNodeT<Tkey_> > {
typedef CYapfNodeT<Tkey_, CYapfRoadNodeT<Tkey_> > base;
struct CYapfRoadNodeT : CYapfNodeT<Tkey_, CYapfRoadNodeT<Tkey_>> {
typedef CYapfNodeT<Tkey_, CYapfRoadNodeT<Tkey_>> base;
TileIndex segment_last_tile;
Trackdir segment_last_td;

View File

@@ -17,8 +17,8 @@
/** Yapf Node for ships */
template <class Tkey_>
struct CYapfShipNodeT : CYapfNodeT<Tkey_, CYapfShipNodeT<Tkey_> > {
typedef CYapfNodeT<Tkey_, CYapfShipNodeT<Tkey_> > base;
struct CYapfShipNodeT : CYapfNodeT<Tkey_, CYapfShipNodeT<Tkey_>> {
typedef CYapfNodeT<Tkey_, CYapfShipNodeT<Tkey_>> base;
TileIndex segment_last_tile;
Trackdir segment_last_td;

View File

@@ -33,8 +33,7 @@ template <typename Tpf> void DumpState(Tpf &pf1, Tpf &pf2)
}
template <class Types>
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 Types>
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 Types>
class CYapfFollowAnySafeTileRailT : public CYapfReserveTrack<Types>
{
class CYapfFollowAnySafeTileRailT : public CYapfReserveTrack<Types> {
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 Types>
class CYapfFollowRailT : public CYapfReserveTrack<Types>
{
class CYapfFollowRailT : public CYapfReserveTrack<Types> {
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 Tpf_, class Ttrack_follower, class Tnode_list, template <class Types> class TdestinationT, template <class Types> class TfollowT>
struct CYapfRail_TypesT
{
struct CYapfRail_TypesT {
typedef CYapfRail_TypesT<Tpf_, Ttrack_follower, Tnode_list, TdestinationT, TfollowT> Types;
typedef Tpf_ Tpf;
@@ -549,14 +544,14 @@ struct CYapfRail_TypesT
typedef CYapfCostRailT<Types> PfCost;
};
struct CYapfRail1 : CYapfT<CYapfRail_TypesT<CYapfRail1 , CFollowTrackRail , CRailNodeListTrackDir, CYapfDestinationTileOrStationRailT, CYapfFollowRailT> > {};
struct CYapfRail2 : CYapfT<CYapfRail_TypesT<CYapfRail2 , CFollowTrackRailNo90, CRailNodeListTrackDir, CYapfDestinationTileOrStationRailT, CYapfFollowRailT> > {};
struct CYapfRail1 : CYapfT<CYapfRail_TypesT<CYapfRail1 , CFollowTrackRail , CRailNodeListTrackDir, CYapfDestinationTileOrStationRailT, CYapfFollowRailT>> {};
struct CYapfRail2 : CYapfT<CYapfRail_TypesT<CYapfRail2 , CFollowTrackRailNo90, CRailNodeListTrackDir, CYapfDestinationTileOrStationRailT, CYapfFollowRailT>> {};
struct CYapfAnyDepotRail1 : CYapfT<CYapfRail_TypesT<CYapfAnyDepotRail1, CFollowTrackRail , CRailNodeListTrackDir, CYapfDestinationAnyDepotRailT , CYapfFollowAnyDepotRailT> > {};
struct CYapfAnyDepotRail2 : CYapfT<CYapfRail_TypesT<CYapfAnyDepotRail2, CFollowTrackRailNo90, CRailNodeListTrackDir, CYapfDestinationAnyDepotRailT , CYapfFollowAnyDepotRailT> > {};
struct CYapfAnyDepotRail1 : CYapfT<CYapfRail_TypesT<CYapfAnyDepotRail1, CFollowTrackRail , CRailNodeListTrackDir, CYapfDestinationAnyDepotRailT , CYapfFollowAnyDepotRailT>> {};
struct CYapfAnyDepotRail2 : CYapfT<CYapfRail_TypesT<CYapfAnyDepotRail2, CFollowTrackRailNo90, CRailNodeListTrackDir, CYapfDestinationAnyDepotRailT , CYapfFollowAnyDepotRailT>> {};
struct CYapfAnySafeTileRail1 : CYapfT<CYapfRail_TypesT<CYapfAnySafeTileRail1, CFollowTrackFreeRail , CRailNodeListTrackDir, CYapfDestinationAnySafeTileRailT , CYapfFollowAnySafeTileRailT> > {};
struct CYapfAnySafeTileRail2 : CYapfT<CYapfRail_TypesT<CYapfAnySafeTileRail2, CFollowTrackFreeRailNo90, CRailNodeListTrackDir, CYapfDestinationAnySafeTileRailT , CYapfFollowAnySafeTileRailT> > {};
struct CYapfAnySafeTileRail1 : CYapfT<CYapfRail_TypesT<CYapfAnySafeTileRail1, CFollowTrackFreeRail , CRailNodeListTrackDir, CYapfDestinationAnySafeTileRailT , CYapfFollowAnySafeTileRailT>> {};
struct CYapfAnySafeTileRail2 : CYapfT<CYapfRail_TypesT<CYapfAnySafeTileRail2, CFollowTrackFreeRailNo90, CRailNodeListTrackDir, CYapfDestinationAnySafeTileRailT , CYapfFollowAnySafeTileRailT>> {};
Track YapfTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, PBSTileInfo *target, TileIndex *dest)

View File

@@ -16,8 +16,7 @@
template <class Types>
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 Types>
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 Types>
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 Types>
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 Tpf_, class Tnode_list, template <class Types> class Tdestination>
struct CYapfRoad_TypesT
{
struct CYapfRoad_TypesT {
typedef CYapfRoad_TypesT<Tpf_, Tnode_list, Tdestination> Types;
typedef Tpf_ Tpf;
@@ -519,11 +514,11 @@ struct CYapfRoad_TypesT
typedef CYapfCostRoadT<Types> PfCost;
};
struct CYapfRoad1 : CYapfT<CYapfRoad_TypesT<CYapfRoad1 , CRoadNodeListTrackDir, CYapfDestinationTileRoadT > > {};
struct CYapfRoad2 : CYapfT<CYapfRoad_TypesT<CYapfRoad2 , CRoadNodeListExitDir , CYapfDestinationTileRoadT > > {};
struct CYapfRoad1 : CYapfT<CYapfRoad_TypesT<CYapfRoad1 , CRoadNodeListTrackDir, CYapfDestinationTileRoadT>> {};
struct CYapfRoad2 : CYapfT<CYapfRoad_TypesT<CYapfRoad2 , CRoadNodeListExitDir , CYapfDestinationTileRoadT>> {};
struct CYapfRoadAnyDepot1 : CYapfT<CYapfRoad_TypesT<CYapfRoadAnyDepot1, CRoadNodeListTrackDir, CYapfDestinationAnyDepotRoadT> > {};
struct CYapfRoadAnyDepot2 : CYapfT<CYapfRoad_TypesT<CYapfRoadAnyDepot2, CRoadNodeListExitDir , CYapfDestinationAnyDepotRoadT> > {};
struct CYapfRoadAnyDepot1 : CYapfT<CYapfRoad_TypesT<CYapfRoadAnyDepot1, CRoadNodeListTrackDir, CYapfDestinationAnyDepotRoadT>> {};
struct CYapfRoadAnyDepot2 : CYapfT<CYapfRoad_TypesT<CYapfRoadAnyDepot2, CRoadNodeListExitDir , CYapfDestinationAnyDepotRoadT>> {};
Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool &path_found, RoadVehPathCache &path_cache)

View File

@@ -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 Types>
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 Types>
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 Types>
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 <class Tpf_, class Ttrack_follower, class Tnode_list>
struct CYapfShip_TypesT
{
struct CYapfShip_TypesT {
typedef CYapfShip_TypesT<Tpf_, Ttrack_follower, Tnode_list> 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<Types> PfCost; ///< Cost provider.
};
struct CYapfShip : CYapfT<CYapfShip_TypesT<CYapfShip, CFollowTrackWater, CShipNodeListExitDir > >
{
struct CYapfShip : CYapfT<CYapfShip_TypesT<CYapfShip, CFollowTrackWater, CShipNodeListExitDir>> {
explicit CYapfShip(int max_nodes) { this->max_search_nodes = max_nodes; }
};

View File

@@ -40,7 +40,7 @@ inline uint ManhattanDistance(const CYapfRegionPatchNodeKey &a, const CYapfRegio
/** Yapf Node for water regions. */
template <class Tkey_>
struct CYapfRegionNodeT : CYapfNodeT<Tkey_, CYapfRegionNodeT<Tkey_> > {
struct CYapfRegionNodeT : CYapfNodeT<Tkey_, CYapfRegionNodeT<Tkey_>> {
typedef Tkey_ Key;
typedef CYapfRegionNodeT<Tkey_> Node;
@@ -73,8 +73,7 @@ struct CYapfRegionNodeT : CYapfNodeT<Tkey_, CYapfRegionNodeT<Tkey_> > {
/** YAPF origin for water regions. */
template <class Types>
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 Types>
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 Types>
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 Types>
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 <class Tpf_, class Tnode_list>
struct CYapfRegion_TypesT
{
struct CYapfRegion_TypesT {
typedef CYapfRegion_TypesT<Tpf_, Tnode_list> 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<CYapfRegionNodeT<CYapfRegionPatchNodeKey>, 12, 12> CRegionNodeListWater;
struct CYapfRegionWater : CYapfT<CYapfRegion_TypesT<CYapfRegionWater, CRegionNodeListWater>>
{
struct CYapfRegionWater : CYapfT<CYapfRegion_TypesT<CYapfRegionWater, CRegionNodeListWater>> {
explicit CYapfRegionWater(int max_nodes) { this->max_search_nodes = max_nodes; }
};