(svn r14949) -Cleanup: pointer coding style

This commit is contained in:
rubidium
2009-01-10 00:31:47 +00:00
parent c3839648f7
commit 11da45ee55
126 changed files with 556 additions and 556 deletions

View File

@@ -55,7 +55,7 @@ public:
/** return number of closed nodes */
FORCEINLINE int ClosedCount() {return m_closed.Count();}
/** allocate new data item from m_arr */
FORCEINLINE Titem_* CreateNewNode()
FORCEINLINE Titem_ *CreateNewNode()
{
if (m_new_node == NULL) m_new_node = &m_arr.Add();
return m_new_node;
@@ -80,7 +80,7 @@ public:
m_new_node = NULL;
}
/** return the best open node */
FORCEINLINE Titem_* GetBestOpenNode()
FORCEINLINE Titem_ *GetBestOpenNode()
{
if (!m_open_queue.IsEmpty()) {
Titem_& item = m_open_queue.GetHead();
@@ -89,7 +89,7 @@ public:
return NULL;
}
/** remove and return the best open node */
FORCEINLINE Titem_* PopBestOpenNode()
FORCEINLINE Titem_ *PopBestOpenNode()
{
if (!m_open_queue.IsEmpty()) {
Titem_& item = m_open_queue.PopHead();
@@ -99,9 +99,9 @@ public:
return NULL;
}
/** return the open node specified by a key or NULL if not found */
FORCEINLINE Titem_* FindOpenNode(const Key& key)
FORCEINLINE Titem_ *FindOpenNode(const Key& key)
{
Titem_* item = m_open.Find(key);
Titem_ *item = m_open.Find(key);
return item;
}
/** remove and return the open node specified by a key */
@@ -119,9 +119,9 @@ public:
m_closed.Push(item);
}
/** return the closed node specified by a key or NULL if not found */
FORCEINLINE Titem_* FindClosedNode(const Key& key)
FORCEINLINE Titem_ *FindClosedNode(const Key& key)
{
Titem_* item = m_closed.Find(key);
Titem_ *item = m_closed.Find(key);
return item;
}

View File

@@ -44,12 +44,12 @@ Trackdir YapfChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection ent
* @param tile destination tile
* @return distance from origin tile to the destination (number of road tiles) or UINT_MAX if path not found
*/
uint YapfRoadVehDistanceToTile(const Vehicle* v, TileIndex tile);
uint YapfRoadVehDistanceToTile(const Vehicle *v, TileIndex tile);
/** Used when user sends RV to the nearest depot or if RV needs servicing.
* Returns the nearest depot (or NULL if depot was not found).
*/
Depot* YapfFindNearestRoadDepot(const Vehicle *v);
Depot *YapfFindNearestRoadDepot(const Vehicle *v);
/** Used when user sends train to the nearest depot or if train needs servicing.
* @param v train that needs to go to some depot
@@ -64,7 +64,7 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v);
bool YapfFindNearestRailDepotTwoWay(const Vehicle *v, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed);
/** Returns true if it is better to reverse the train before leaving station */
bool YapfCheckReverseTrain(const Vehicle* v);
bool YapfCheckReverseTrain(const Vehicle *v);
/**
* Try to extend the reserved path of a train to the nearest safe tile.
@@ -81,7 +81,7 @@ bool YapfRailFindNearestSafeTile(const Vehicle *v, TileIndex tile, Trackdir td,
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track);
/** performance measurement helpers */
void* NpfBeginInterval();
void *NpfBeginInterval();
int NpfEndInterval(void *perf);

View File

@@ -51,7 +51,7 @@ struct CPerformanceTimer
struct CPerfStartReal
{
CPerformanceTimer* m_pperf;
CPerformanceTimer *m_pperf;
FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();}
FORCEINLINE ~CPerfStartReal() {Stop();}

View File

@@ -164,7 +164,7 @@ public:
/** If path was found return the best node that has reached the destination. Otherwise
* return the best visited node (which was nearest to the destination).
*/
FORCEINLINE Node* GetBestNode()
FORCEINLINE Node *GetBestNode()
{
return (m_pBestDestNode != NULL) ? m_pBestDestNode : m_pBestIntermediateNode;
}
@@ -193,7 +193,7 @@ public:
}
/** add multiple nodes - direct children of the given node */
FORCEINLINE void AddMultipleNodes(Node* parent, const TrackFollower &tf)
FORCEINLINE void AddMultipleNodes(Node *parent, const TrackFollower &tf)
{
bool is_choice = (KillFirstBit(tf.m_new_td_bits) != TRACKDIR_BIT_NONE);
for (TrackdirBits rtds = tf.m_new_td_bits; rtds != TRACKDIR_BIT_NONE; rtds = KillFirstBit(rtds)) {
@@ -242,7 +242,7 @@ public:
}
// check new node against open list
Node* openNode = m_nodes.FindOpenNode(n.GetKey());
Node *openNode = m_nodes.FindOpenNode(n.GetKey());
if (openNode != NULL) {
// another node exists with the same key in the open list
// is it better than new one?
@@ -257,7 +257,7 @@ public:
}
// check new node against closed list
Node* closedNode = m_nodes.FindClosedNode(n.GetKey());
Node *closedNode = m_nodes.FindClosedNode(n.GetKey());
if (closedNode != NULL) {
// another node exists with the same key in the closed list
// is it better than new one?

View File

@@ -113,7 +113,7 @@ struct CSegmentCostCacheT
FORCEINLINE Tsegment& Get(Key& key, bool *found)
{
Tsegment* item = m_map.Find(key);
Tsegment *item = m_map.Find(key);
if (item == NULL) {
*found = false;
item = new (&m_heap.AddNC()) Tsegment(key);

View File

@@ -117,7 +117,7 @@ protected:
static TileIndex CalcStationCenterTile(StationID station)
{
const Station* st = GetStation(station);
const Station *st = GetStation(station);
/* If the rail station is (temporarily) not present, use the station sign to drive near the station */
if (!IsValidTile(st->train_tile)) return st->xy;
@@ -129,7 +129,7 @@ protected:
}
public:
void SetDestination(const Vehicle* v)
void SetDestination(const Vehicle *v)
{
switch (v->current_order.GetType()) {
case OT_GOTO_STATION:

View File

@@ -56,7 +56,7 @@ struct CYapfNodeT {
m_estimate = 0;
}
FORCEINLINE Node* GetHashNext() {return m_hash_next;}
FORCEINLINE Node *GetHashNext() {return m_hash_next;}
FORCEINLINE void SetHashNext(Node *pNext) {m_hash_next = pNext;}
FORCEINLINE TileIndex GetTile() const {return m_key.m_tile;}
FORCEINLINE Trackdir GetTrackdir() const {return m_key.m_td;}

View File

@@ -86,7 +86,7 @@ DECLARE_ENUM_AS_BIT_SET(EndSegmentReasonBits);
inline CStrA ValueStr(EndSegmentReasonBits bits)
{
static const char* end_segment_reason_names[] = {
static const char *end_segment_reason_names[] = {
"DEAD_END", "RAIL_TYPE", "INFINITE_LOOP", "SEGMENT_TOO_LONG", "CHOICE_FOLLOWS",
"DEPOT", "WAYPOINT", "STATION",
"PATH_TOO_LONG", "FIRST_TWO_WAY_RED", "LOOK_AHEAD_END", "TARGET_REACHED"
@@ -109,7 +109,7 @@ struct CYapfRailSegment
TileIndex m_last_signal_tile;
Trackdir m_last_signal_td;
EndSegmentReasonBits m_end_segment_reason;
CYapfRailSegment* m_hash_next;
CYapfRailSegment *m_hash_next;
FORCEINLINE CYapfRailSegment(const CYapfRailSegmentKey& key)
: m_key(key)
@@ -124,8 +124,8 @@ struct CYapfRailSegment
FORCEINLINE const Key& GetKey() const {return m_key;}
FORCEINLINE TileIndex GetTile() const {return m_key.GetTile();}
FORCEINLINE CYapfRailSegment* GetHashNext() {return m_hash_next;}
FORCEINLINE void SetHashNext(CYapfRailSegment* next) {m_hash_next = next;}
FORCEINLINE CYapfRailSegment *GetHashNext() {return m_hash_next;}
FORCEINLINE void SetHashNext(CYapfRailSegment *next) {m_hash_next = next;}
void Dump(DumpTarget &dmp) const
{
@@ -159,7 +159,7 @@ struct CYapfRailNodeT
} flags_u;
SignalType m_last_red_signal_type;
FORCEINLINE void Set(CYapfRailNodeT* parent, TileIndex tile, Trackdir td, bool is_choice)
FORCEINLINE void Set(CYapfRailNodeT *parent, TileIndex tile, Trackdir td, bool is_choice)
{
base::Set(parent, tile, td, is_choice);
m_segment = NULL;

View File

@@ -17,7 +17,7 @@ struct CYapfRoadNodeT
TileIndex m_segment_last_tile;
Trackdir m_segment_last_td;
void Set(CYapfRoadNodeT* parent, TileIndex tile, Trackdir td, bool is_choice)
void Set(CYapfRoadNodeT *parent, TileIndex tile, Trackdir td, bool is_choice)
{
base::Set(parent, tile, td, is_choice);
m_segment_last_tile = tile;

View File

@@ -188,7 +188,7 @@ public:
/// return debug report character to identify the transportation type
FORCEINLINE char TransportTypeChar() const {return 't';}
static bool stFindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed)
static bool stFindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed)
{
Tpf pf1;
bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_distance, reverse_penalty, depot_tile, reversed);
@@ -207,7 +207,7 @@ public:
return result1;
}
FORCEINLINE bool FindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed)
FORCEINLINE bool FindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed)
{
// set origin and destination nodes
Yapf().SetOrigin(t1, td1, t2, td2, reverse_penalty, true);
@@ -307,7 +307,7 @@ public:
this->SetReservationTarget(pNode, pNode->GetLastTile(), pNode->GetLastTrackdir());
/* Walk through the path back to the origin. */
Node* pPrev = NULL;
Node *pPrev = NULL;
while (pNode->m_parent != NULL) {
pPrev = pNode;
pNode = pNode->m_parent;
@@ -401,7 +401,7 @@ public:
// path was found or at least suggested
// walk through the path back to the origin
Node* pPrev = NULL;
Node *pPrev = NULL;
while (pNode->m_parent != NULL) {
pPrev = pNode;
pNode = pNode->m_parent;
@@ -502,7 +502,7 @@ Trackdir YapfChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection ent
return td_ret;
}
bool YapfCheckReverseTrain(const Vehicle* v)
bool YapfCheckReverseTrain(const Vehicle *v)
{
/* last wagon */
const Vehicle *last_veh = GetLastVehicleInChain(v);

View File

@@ -363,13 +363,13 @@ public:
return true;
}
static Depot* stFindNearestDepot(const Vehicle* v, TileIndex tile, Trackdir td)
static Depot *stFindNearestDepot(const Vehicle *v, TileIndex tile, Trackdir td)
{
Tpf pf;
return pf.FindNearestDepot(v, tile, td);
}
FORCEINLINE Depot* FindNearestDepot(const Vehicle* v, TileIndex tile, Trackdir td)
FORCEINLINE Depot *FindNearestDepot(const Vehicle *v, TileIndex tile, Trackdir td)
{
// set origin and destination nodes
Yapf().SetOrigin(tile, TrackdirToTrackdirBits(td));
@@ -383,7 +383,7 @@ public:
Node *n = Yapf().GetBestNode();
TileIndex depot_tile = n->m_segment_last_tile;
assert(IsRoadDepotTile(depot_tile));
Depot* ret = GetDepotByTile(depot_tile);
Depot *ret = GetDepotByTile(depot_tile);
return ret;
}
};
@@ -444,7 +444,7 @@ uint YapfRoadVehDistanceToTile(const Vehicle *v, TileIndex tile)
return dist;
}
Depot* YapfFindNearestRoadDepot(const Vehicle *v)
Depot *YapfFindNearestRoadDepot(const Vehicle *v)
{
TileIndex tile = v->tile;
Trackdir trackdir = GetVehicleTrackdir(v);
@@ -458,13 +458,13 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v)
}
// default is YAPF type 2
typedef Depot* (*PfnFindNearestDepot)(const Vehicle*, TileIndex, Trackdir);
typedef Depot *(*PfnFindNearestDepot)(const Vehicle*, TileIndex, Trackdir);
PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot;
// check if non-default YAPF type should be used
if (_settings_game.pf.yapf.disable_node_optimization)
pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg
Depot* ret = pfnFindNearestDepot(v, tile, trackdir);
Depot *ret = pfnFindNearestDepot(v, tile, trackdir);
return ret;
}

View File

@@ -65,10 +65,10 @@ public:
Trackdir next_trackdir = INVALID_TRACKDIR; // this would mean "path not found"
Node* pNode = pf.GetBestNode();
Node *pNode = pf.GetBestNode();
if (pNode != NULL) {
// walk through the path back to the origin
Node* pPrevNode = NULL;
Node *pPrevNode = NULL;
while (pNode->m_parent != NULL) {
pPrevNode = pNode;
pNode = pNode->m_parent;