(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.

This commit is contained in:
rubidium 2007-07-24 17:01:23 +00:00
parent 0d9a51de6d
commit 5d3f058b65
22 changed files with 70 additions and 70 deletions

View File

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

View File

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

View File

@ -11,8 +11,8 @@
#include <string>
#include <map>
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:

View File

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

View File

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

View File

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

View File

@ -110,7 +110,7 @@ void CreateConsole();
typedef int32 CursorID;
struct Point {
int x,y;
int x, y;
};
struct Rect {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ struct DrawTileSeqStruct {
struct DrawTileSprites {
SpriteID ground_sprite;
SpriteID ground_pal;
const DrawTileSeqStruct* seq;
const DrawTileSeqStruct *seq;
};
/**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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