From 5d3f058b65c97b61709061b721d1ad6922dbc9ef Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 24 Jul 2007 17:01:23 +0000 Subject: [PATCH] (svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var. --- src/aircraft.h | 4 ++-- src/bridge.h | 2 +- src/driver.h | 4 ++-- src/economy.h | 2 +- src/engine.h | 8 +++---- src/functions.h | 4 ++-- src/gfx.h | 2 +- src/industry_map.h | 2 +- src/mixer.h | 4 ++-- src/player.h | 8 +++---- src/queue.h | 56 +++++++++++++++++++++++----------------------- src/roadveh.h | 4 ++-- src/ship.h | 4 ++-- src/sprite.h | 2 +- src/station_map.h | 2 +- src/string.h | 8 +++---- src/strings.h | 2 +- src/thread.h | 6 ++--- src/town_map.h | 2 +- src/vehicle.h | 10 ++++----- src/viewport.h | 2 +- src/waypoint.h | 2 +- 22 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/aircraft.h b/src/aircraft.h index 255225db96..2f5f14b905 100644 --- a/src/aircraft.h +++ b/src/aircraft.h @@ -35,7 +35,7 @@ static inline bool IsNormalAircraft(const Vehicle *v) * @param v vehicle to check * @return true if in hangar */ -static inline bool IsAircraftInHangar(const Vehicle* v) +static inline bool IsAircraftInHangar(const Vehicle *v) { assert(v->type == VEH_AIRCRAFT); return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile); @@ -45,7 +45,7 @@ static inline bool IsAircraftInHangar(const Vehicle* v) * @param v vehicle to check * @return true if in hangar and stopped */ -static inline bool IsAircraftInHangarStopped(const Vehicle* v) +static inline bool IsAircraftInHangarStopped(const Vehicle *v) { return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED; } diff --git a/src/bridge.h b/src/bridge.h index 27e47af3bd..76fc6934ec 100644 --- a/src/bridge.h +++ b/src/bridge.h @@ -35,6 +35,6 @@ static inline const Bridge *GetBridge(uint i) return &_bridge[i]; } -void DrawBridgeMiddle(const TileInfo* ti); +void DrawBridgeMiddle(const TileInfo *ti); #endif /* BRIDGE_H */ diff --git a/src/driver.h b/src/driver.h index fa16cd24c2..c05bfd2f8c 100644 --- a/src/driver.h +++ b/src/driver.h @@ -11,8 +11,8 @@ #include #include -bool GetDriverParamBool(const char* const* parm, const char* name); -int GetDriverParamInt(const char* const* parm, const char* name, int def); +bool GetDriverParamBool(const char * const *parm, const char *name); +int GetDriverParamInt(const char * const *parm, const char *name, int def); class Driver { public: diff --git a/src/economy.h b/src/economy.h index 00047f0020..f142c8d28f 100644 --- a/src/economy.h +++ b/src/economy.h @@ -61,7 +61,7 @@ extern int _score_part[MAX_PLAYERS][SCORE_END]; int UpdateCompanyRatingAndValue(Player *p, bool update); VARDEF Subsidy _subsidies[MAX_PLAYERS]; -Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode); +Pair SetupSubsidyDecodeParam(const Subsidy *s, bool mode); void DeleteSubsidyWithTown(TownID index); void DeleteSubsidyWithIndustry(IndustryID index); void DeleteSubsidyWithStation(StationID index); diff --git a/src/engine.h b/src/engine.h index be0a7c87ed..cd238b8a6c 100644 --- a/src/engine.h +++ b/src/engine.h @@ -45,7 +45,7 @@ struct RailVehicleInfo { // kind of visual effect to generate for a vehicle (default, steam, diesel, electric). // Same goes for the callback result, which atm is only used to check if a wagon is powered. byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor - byte tractive_effort; ///< Tractive effort coefficient + byte tractive_effort; ///< Tractive effort coefficient byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles }; @@ -309,7 +309,7 @@ typedef EngineRenew* EngineRenewList; * @param erl The renewlist for a given player. * @return The new renewlist for the player. */ -void RemoveAllEngineReplacement(EngineRenewList* erl); +void RemoveAllEngineReplacement(EngineRenewList *erl); /** * Retrieve the engine replacement in a given renewlist for an original engine type. @@ -328,7 +328,7 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group); * @param flags The calling command flags. * @return 0 on success, CMD_ERROR on failure. */ -CommandCost AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags); +CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags); /** * Remove an engine replacement from a given renewlist. @@ -337,7 +337,7 @@ CommandCost AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, Engi * @param flags The calling command flags. * @return 0 on success, CMD_ERROR on failure. */ -CommandCost RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, GroupID group, uint32 flags); +CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, uint32 flags); /** When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists * @param type The type of engine diff --git a/src/functions.h b/src/functions.h index 15bc4779a5..2f1f41cbff 100644 --- a/src/functions.h +++ b/src/functions.h @@ -96,7 +96,7 @@ void InitializeLandscapeVariables(bool only_constants); /* misc.cpp */ bool IsCustomName(StringID id); void DeleteName(StringID id); -char *GetName(char *buff, StringID id, const char* last); +char *GetName(char *buff, StringID id, const char *last); #define AllocateName(name, skip) RealAllocateName(name, skip, false) StringID RealAllocateName(const char *name, byte skip, bool check_double); @@ -117,7 +117,7 @@ void SetObjectToPlace(CursorID icon, SpriteID pal, byte mode, WindowClass window void ResetObjectToPlace(); -bool ScrollWindowTo(int x, int y, Window * w, bool instant = false); +bool ScrollWindowTo(int x, int y, Window *w, bool instant = false); bool ScrollMainWindowToTile(TileIndex tile, bool instant = false); bool ScrollMainWindowTo(int x, int y, bool instant = false); diff --git a/src/gfx.h b/src/gfx.h index 995f6556df..1a13addd22 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -110,7 +110,7 @@ void CreateConsole(); typedef int32 CursorID; struct Point { - int x,y; + int x, y; }; struct Rect { diff --git a/src/industry_map.h b/src/industry_map.h index d09a2e615f..91ea969724 100644 --- a/src/industry_map.h +++ b/src/industry_map.h @@ -68,7 +68,7 @@ static inline IndustryID GetIndustryIndex(TileIndex t) * @pre IsTileType(t, MP_INDUSTRY) * @return the industry */ -static inline Industry* GetIndustryByTile(TileIndex t) +static inline Industry *GetIndustryByTile(TileIndex t) { return GetIndustry(GetIndustryIndex(t)); } diff --git a/src/mixer.h b/src/mixer.h index 42e458c822..7b14f83cff 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -15,9 +15,9 @@ enum { }; bool MxInitialize(uint rate); -void MxMixSamples(void* buffer, uint samples); +void MxMixSamples(void *buffer, uint samples); -MixerChannel* MxAllocateChannel(); +MixerChannel *MxAllocateChannel(); void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint flags); void MxSetChannelVolume(MixerChannel *mc, uint left, uint right); void MxActivateChannel(MixerChannel*); diff --git a/src/player.h b/src/player.h index 70bf94d844..6ecbbd7dc5 100644 --- a/src/player.h +++ b/src/player.h @@ -212,8 +212,8 @@ uint16 GetDrawStringPlayerColor(PlayerID player); void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player); void GetNameOfOwner(Owner owner, TileIndex tile); -Money CalculateCompanyValue(const Player* p); -void InvalidatePlayerWindows(const Player* p); +Money CalculateCompanyValue(const Player *p); +void InvalidatePlayerWindows(const Player *p); void SetLocalPlayer(PlayerID new_player); #define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++) @@ -236,7 +236,7 @@ static inline byte ActivePlayerCount() return count; } -static inline Player* GetPlayer(PlayerID i) +static inline Player *GetPlayer(PlayerID i) { assert(IS_INSIDE_1D(i, PLAYER_FIRST, lengthof(_players))); return &_players[i]; @@ -282,7 +282,7 @@ static inline bool ValParamRailtype(uint32 rail) { return HASBIT(GetPlayer(_curr * @param p the player "in action" * @return The "best" railtype a player has available */ -static inline RailType GetBestRailtype(const Player* p) +static inline RailType GetBestRailtype(const Player *p) { if (HasRailtypeAvail(p, RAILTYPE_MAGLEV)) return RAILTYPE_MAGLEV; if (HasRailtypeAvail(p, RAILTYPE_MONO)) return RAILTYPE_MONO; diff --git a/src/queue.h b/src/queue.h index 951c75c194..44c6c2e93e 100644 --- a/src/queue.h +++ b/src/queue.h @@ -12,20 +12,20 @@ struct Queue; -typedef bool Queue_PushProc(Queue* q, void* item, int priority); -typedef void* Queue_PopProc(Queue* q); -typedef bool Queue_DeleteProc(Queue* q, void* item, int priority); -typedef void Queue_ClearProc(Queue* q, bool free_values); -typedef void Queue_FreeProc(Queue* q, bool free_values); +typedef bool Queue_PushProc(Queue *q, void *item, int priority); +typedef void* Queue_PopProc(Queue *q); +typedef bool Queue_DeleteProc(Queue *q, void* item, int priority); +typedef void Queue_ClearProc(Queue *q, bool free_values); +typedef void Queue_FreeProc(Queue *q, bool free_values); struct InsSortNode { - void* item; + void *item; int priority; InsSortNode* next; }; struct BinaryHeapNode { - void* item; + void *item; int priority; }; @@ -35,39 +35,39 @@ struct Queue{ * Pushes an element into the queue, at the appropriate place for the queue. * Requires the queue pointer to be of an appropriate type, of course. */ - Queue_PushProc* push; + Queue_PushProc *push; /* * Pops the first element from the queue. What exactly is the first element, * is defined by the exact type of queue. */ - Queue_PopProc* pop; + Queue_PopProc *pop; /* * Deletes the item from the queue. priority should be specified if * known, which speeds up the deleting for some queue's. Should be -1 * if not known. */ - Queue_DeleteProc* del; + Queue_DeleteProc *del; /* Clears the queue, by removing all values from it. It's state is * effectively reset. If free_items is true, each of the items cleared * in this way are free()'d. */ - Queue_ClearProc* clear; + Queue_ClearProc *clear; /* Frees the queue, by reclaiming all memory allocated by it. After * this it is no longer usable. If free_items is true, any remaining * items are free()'d too. */ - Queue_FreeProc* free; + Queue_FreeProc *free; union { struct { - InsSortNode* first; + InsSortNode *first; } inssort; struct { uint max_size; uint size; uint blocks; ///< The amount of blocks for which space is reserved in elements - BinaryHeapNode** elements; + BinaryHeapNode **elements; } binaryheap; } data; }; @@ -79,7 +79,7 @@ struct Queue{ /* Initializes a inssort and allocates internal memory. There is no maximum * size */ -void init_InsSort(Queue* q); +void init_InsSort(Queue *q); /* @@ -93,7 +93,7 @@ void init_InsSort(Queue* q); /** Initializes a binary heap and allocates internal memory for maximum of * max_size elements */ -void init_BinaryHeap(Queue* q, uint max_size); +void init_BinaryHeap(Queue *q, uint max_size); /* @@ -102,8 +102,8 @@ void init_BinaryHeap(Queue* q, uint max_size); struct HashNode { uint key1; uint key2; - void* value; - HashNode* next; + void *value; + HashNode *next; }; /** * Generates a hash code from the given key pair. You should make sure that @@ -112,16 +112,16 @@ struct HashNode { typedef uint Hash_HashProc(uint key1, uint key2); struct Hash { /* The hash function used */ - Hash_HashProc* hash; + Hash_HashProc *hash; /* The amount of items in the hash */ uint size; /* The number of buckets allocated */ uint num_buckets; /* A pointer to an array of num_buckets buckets. */ - HashNode* buckets; + HashNode *buckets; /* A pointer to an array of numbuckets booleans, which will be true if * there are any Nodes in the bucket */ - bool* buckets_in_use; + bool *buckets_in_use; }; /* Call these function to manipulate a hash */ @@ -129,32 +129,32 @@ struct Hash { /** Deletes the value with the specified key pair from the hash and returns * that value. Returns NULL when the value was not present. The value returned * is _not_ free()'d! */ -void* Hash_Delete(Hash* h, uint key1, uint key2); +void *Hash_Delete(Hash *h, uint key1, uint key2); /** Sets the value associated with the given key pair to the given value. * Returns the old value if the value was replaced, NULL when it was not yet present. */ -void* Hash_Set(Hash* h, uint key1, uint key2, void* value); +void *Hash_Set(Hash *h, uint key1, uint key2, void *value); /** Gets the value associated with the given key pair, or NULL when it is not * present. */ -void* Hash_Get(const Hash* h, uint key1, uint key2); +void *Hash_Get(const Hash *h, uint key1, uint key2); /* Call these function to create/destroy a hash */ /** Builds a new hash in an existing struct. Make sure that hash() always * returns a hash less than num_buckets! Call delete_hash after use */ -void init_Hash(Hash* h, Hash_HashProc* hash, uint num_buckets); +void init_Hash(Hash *h, Hash_HashProc *hash, uint num_buckets); /** * Deletes the hash and cleans up. Only cleans up memory allocated by new_Hash * & friends. If free is true, it will call free() on all the values that * are left in the hash. */ -void delete_Hash(Hash* h, bool free_values); +void delete_Hash(Hash *h, bool free_values); /** * Cleans the hash, but keeps the memory allocated */ -void clear_Hash(Hash* h, bool free_values); +void clear_Hash(Hash *h, bool free_values); /** * Gets the current size of the Hash */ -uint Hash_Size(const Hash* h); +uint Hash_Size(const Hash *h); #endif /* QUEUE_H */ diff --git a/src/roadveh.h b/src/roadveh.h index 59097d1775..a66c01263e 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -44,13 +44,13 @@ static inline bool RoadVehHasArticPart(const Vehicle *v) } -static inline bool IsRoadVehInDepot(const Vehicle* v) +static inline bool IsRoadVehInDepot(const Vehicle *v) { assert(v->type == VEH_ROAD); return v->u.road.state == 254; } -static inline bool IsRoadVehInDepotStopped(const Vehicle* v) +static inline bool IsRoadVehInDepotStopped(const Vehicle *v) { return IsRoadVehInDepot(v) && v->vehstatus & VS_STOPPED; } diff --git a/src/ship.h b/src/ship.h index 37657e7e60..0ca73ee952 100644 --- a/src/ship.h +++ b/src/ship.h @@ -12,13 +12,13 @@ void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2); void RecalcShipStuff(Vehicle *v); void GetShipSpriteSize(EngineID engine, uint &width, uint &height); -static inline bool IsShipInDepot(const Vehicle* v) +static inline bool IsShipInDepot(const Vehicle *v) { assert(v->type == VEH_SHIP); return v->u.ship.state == 0x80; } -static inline bool IsShipInDepotStopped(const Vehicle* v) +static inline bool IsShipInDepotStopped(const Vehicle *v) { return IsShipInDepot(v) && v->vehstatus & VS_STOPPED; } diff --git a/src/sprite.h b/src/sprite.h index 6c6c8e85f6..4d073ecc37 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -24,7 +24,7 @@ struct DrawTileSeqStruct { struct DrawTileSprites { SpriteID ground_sprite; SpriteID ground_pal; - const DrawTileSeqStruct* seq; + const DrawTileSeqStruct *seq; }; /** diff --git a/src/station_map.h b/src/station_map.h index 38a0a58d75..eaa092c2a2 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -17,7 +17,7 @@ static inline StationID GetStationIndex(TileIndex t) return (StationID)_m[t].m2; } -static inline Station* GetStationByTile(TileIndex t) +static inline Station *GetStationByTile(TileIndex t) { return GetStation(GetStationIndex(t)); } diff --git a/src/string.h b/src/string.h index 478c533e75..98fe7db409 100644 --- a/src/string.h +++ b/src/string.h @@ -24,10 +24,10 @@ void ttd_strlcpy(char *dst, const char *src, size_t size); * if NULL no boundary check is performed * @return a pointer to the terminating \0 in the destination buffer */ -char* strecat(char* dst, const char* src, const char* last); -char* strecpy(char* dst, const char* src, const char* last); +char *strecat(char *dst, const char *src, const char *last); +char *strecpy(char *dst, const char *src, const char *last); -char* CDECL str_fmt(const char* str, ...); +char *CDECL str_fmt(const char *str, ...); /** Scans the string for valid characters and if it finds invalid ones, * replaces them with a question mark '?' */ @@ -49,7 +49,7 @@ enum CharSetFilter { void strtolower(char *str); -static inline bool StrEmpty(const char* s) { return s[0] == '\0'; } +static inline bool StrEmpty(const char *s) { return s[0] == '\0'; } /** Get the length of a string, within a limited buffer */ diff --git a/src/strings.h b/src/strings.h index 0f2665e99a..7165f60a56 100644 --- a/src/strings.h +++ b/src/strings.h @@ -6,7 +6,7 @@ #define STRINGS_H char *InlineString(char *buf, StringID string); -char *GetString(char *buffr, StringID string, const char* last); +char *GetString(char *buffr, StringID string, const char *last); extern char _userstring[128]; diff --git a/src/thread.h b/src/thread.h index c359cbca4d..5ec169b0c3 100644 --- a/src/thread.h +++ b/src/thread.h @@ -7,10 +7,10 @@ struct OTTDThread; -typedef void* (*OTTDThreadFunc)(void*); +typedef void * (*OTTDThreadFunc)(void*); -OTTDThread* OTTDCreateThread(OTTDThreadFunc, void*); -void* OTTDJoinThread(OTTDThread*); +OTTDThread *OTTDCreateThread(OTTDThreadFunc, void*); +void *OTTDJoinThread(OTTDThread*); void OTTDExitThread(); #endif /* THREAD_H */ diff --git a/src/town_map.h b/src/town_map.h index b73404d6a8..d1fcf4b7b7 100644 --- a/src/town_map.h +++ b/src/town_map.h @@ -38,7 +38,7 @@ static inline void SetTownIndex(TileIndex t, TownID index) * @param t the tile to get the town of * @return the town */ -static inline Town* GetTownByTile(TileIndex t) +static inline Town *GetTownByTile(TileIndex t) { return GetTown(GetTownIndex(t)); } diff --git a/src/vehicle.h b/src/vehicle.h index 07d2e3acd9..880d415628 100644 --- a/src/vehicle.h +++ b/src/vehicle.h @@ -352,7 +352,7 @@ struct Vehicle { * @param v the vehicle to use as 'storage' backend * @return the memory that is 'allocated' */ - void* operator new(size_t size, Vehicle *v) { return v; } + void *operator new(size_t size, Vehicle *v) { return v; } /** * 'Free' the memory allocated by the overriden new. @@ -516,7 +516,7 @@ void AfterLoadVehicles(); Vehicle *GetLastVehicleInChain(Vehicle *v); Vehicle *GetPrevVehicleInChain(const Vehicle *v); Vehicle *GetFirstVehicleInChain(const Vehicle *v); -uint CountVehiclesInChain(const Vehicle* v); +uint CountVehiclesInChain(const Vehicle *v); bool IsEngineCountable(const Vehicle *v); void DeleteVehicleChain(Vehicle *v); void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc); @@ -592,7 +592,7 @@ enum { }; struct GetNewVehiclePosResult { - int x,y; + int x, y; TileIndex old_tile; TileIndex new_tile; }; @@ -612,10 +612,10 @@ Trackdir GetVehicleTrackdir(const Vehicle* v); /* returns true if staying in the same tile */ GetNewVehiclePosResult GetNewVehiclePos(const Vehicle *v); -Direction GetDirectionTowards(const Vehicle* v, int x, int y); +Direction GetDirectionTowards(const Vehicle *v, int x, int y); #define BEGIN_ENUM_WAGONS(v) do { -#define END_ENUM_WAGONS(v) } while ( (v=v->next) != NULL); +#define END_ENUM_WAGONS(v) } while ((v = v->next) != NULL); DECLARE_OLD_POOL(Vehicle, Vehicle, 9, 125) diff --git a/src/viewport.h b/src/viewport.h index 528253b7ab..6a4b4b0bc4 100644 --- a/src/viewport.h +++ b/src/viewport.h @@ -41,7 +41,7 @@ void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte static inline void MaxZoomInOut(int how, Window *w) { - while (DoZoomInOutWindow(how, w) ) {}; + while (DoZoomInOutWindow(how, w)) {}; } void OffsetGroundSprite(int x, int y); diff --git a/src/waypoint.h b/src/waypoint.h index 384bb4de4d..c3e2395618 100644 --- a/src/waypoint.h +++ b/src/waypoint.h @@ -69,7 +69,7 @@ static inline Waypoint *GetWaypointByTile(TileIndex tile) CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove); Station *ComposeWaypointStation(TileIndex tile); void ShowRenameWaypointWindow(const Waypoint *cp); -void DrawWaypointSprite(int x, int y, int image, RailType railtype); +void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype); void FixOldWaypoints(); void UpdateAllWaypointSigns(); void AfterLoadWaypoints();