(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

@ -53,7 +53,7 @@ static void AI_DequeueCommands(CompanyID company)
* Needed for SP; we need to delay DoCommand with 1 tick, because else events
* will make infinite loops (AIScript).
*/
static void AI_PutCommandInQueue(CompanyID company, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback* callback, const char *text = NULL)
static void AI_PutCommandInQueue(CompanyID company, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text = NULL)
{
AICommand *com;
@ -83,7 +83,7 @@ static void AI_PutCommandInQueue(CompanyID company, TileIndex tile, uint32 p1, u
/**
* Executes a raw DoCommand for the AI.
*/
CommandCost AI_DoCommandCc(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32 cmd, CommandCallback* callback, const char *text)
CommandCost AI_DoCommandCc(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32 cmd, CommandCallback *callback, const char *text)
{
CompanyID old_local_company;
CommandCost res;

View File

@ -48,7 +48,7 @@ void AI_RunGameLoop();
void AI_Initialize();
void AI_Uninitialize();
CommandCost AI_DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc, const char *text = NULL);
CommandCost AI_DoCommandCc(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc, CommandCallback* callback, const char *text = NULL);
CommandCost AI_DoCommandCc(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc, CommandCallback *callback, const char *text = NULL);
/** Is it allowed to start a new AI.
* This function checks some boundries to see if we should launch a new AI.

View File

@ -326,7 +326,7 @@ static void AiRestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
static void AiHandleReplaceTrain(Company *c)
{
const Vehicle* v = _companies_ai[c->index].cur_veh;
const Vehicle *v = _companies_ai[c->index].cur_veh;
BackuppedOrders orderbak;
EngineID veh;
@ -356,7 +356,7 @@ static void AiHandleReplaceTrain(Company *c)
static void AiHandleReplaceRoadVeh(Company *c)
{
const Vehicle* v = _companies_ai[c->index].cur_veh;
const Vehicle *v = _companies_ai[c->index].cur_veh;
BackuppedOrders orderbak;
EngineID veh;
@ -385,7 +385,7 @@ static void AiHandleReplaceRoadVeh(Company *c)
static void AiHandleReplaceAircraft(Company *c)
{
const Vehicle* v = _companies_ai[c->index].cur_veh;
const Vehicle *v = _companies_ai[c->index].cur_veh;
BackuppedOrders orderbak;
EngineID veh;
@ -417,9 +417,9 @@ static void AiHandleReplaceShip(Company *c)
/* Ships are not implemented in this (broken) AI */
}
typedef EngineID CheckReplaceProc(const Company *c, const Vehicle* v);
typedef EngineID CheckReplaceProc(const Company *c, const Vehicle *v);
static CheckReplaceProc* const _veh_check_replace_proc[] = {
static CheckReplaceProc * const _veh_check_replace_proc[] = {
AiChooseTrainToReplaceWith,
AiChooseRoadVehToReplaceWith,
AiChooseShipToReplaceWith,
@ -427,7 +427,7 @@ static CheckReplaceProc* const _veh_check_replace_proc[] = {
};
typedef void DoReplaceProc(Company *c);
static DoReplaceProc* const _veh_do_replace_proc[] = {
static DoReplaceProc * const _veh_do_replace_proc[] = {
AiHandleReplaceTrain,
AiHandleReplaceRoadVeh,
AiHandleReplaceShip,
@ -436,7 +436,7 @@ static DoReplaceProc* const _veh_do_replace_proc[] = {
static void AiStateCheckReplaceVehicle(Company *c)
{
const Vehicle* v = _companies_ai[c->index].cur_veh;
const Vehicle *v = _companies_ai[c->index].cur_veh;
if (!v->IsValid() ||
v->owner != _current_company ||
@ -451,7 +451,7 @@ static void AiStateCheckReplaceVehicle(Company *c)
static void AiStateDoReplaceVehicle(Company *c)
{
const Vehicle* v = _companies_ai[c->index].cur_veh;
const Vehicle *v = _companies_ai[c->index].cur_veh;
_companies_ai[c->index].state = AIS_VEH_LOOP;
// vehicle is not owned by the company anymore, something went very wrong.
@ -483,8 +483,8 @@ static void AiFindSubsidyIndustryRoute(FoundRoute *fr)
{
uint i;
CargoID cargo;
const Subsidy* s;
Industry* from;
const Subsidy *s;
Industry *from;
TileIndex to_xy;
// initially error
@ -509,13 +509,13 @@ static void AiFindSubsidyIndustryRoute(FoundRoute *fr)
fr->from = from = GetIndustry(s->from);
if (cargo == CT_GOODS || cargo == CT_FOOD) {
Town* to_tow = GetTown(s->to);
Town *to_tow = GetTown(s->to);
if (to_tow->population < (cargo == CT_FOOD ? 200U : 900U)) return; // error
fr->to = to_tow;
to_xy = to_tow->xy;
} else {
Industry* to_ind = GetIndustry(s->to);
Industry *to_ind = GetIndustry(s->to);
fr->to = to_ind;
to_xy = to_ind->xy;
@ -527,7 +527,7 @@ static void AiFindSubsidyIndustryRoute(FoundRoute *fr)
static void AiFindSubsidyPassengerRoute(FoundRoute *fr)
{
uint i;
const Subsidy* s;
const Subsidy *s;
Town *from, *to;
// initially error
@ -554,7 +554,7 @@ static void AiFindSubsidyPassengerRoute(FoundRoute *fr)
static void AiFindRandomIndustryRoute(FoundRoute *fr)
{
Industry* i;
Industry *i;
uint32 r;
CargoID cargo;
@ -578,7 +578,7 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr)
if (cargo != CT_GOODS && cargo != CT_FOOD) {
// pick a dest, and see if it can receive
Industry* i2 = AiFindRandomIndustry();
Industry *i2 = AiFindRandomIndustry();
if (i2 == NULL || i == i2 ||
(i2->accepts_cargo[0] != cargo &&
i2->accepts_cargo[1] != cargo &&
@ -590,7 +590,7 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr)
fr->distance = DistanceManhattan(i->xy, i2->xy);
} else {
// pick a dest town, and see if it's big enough
Town* t = AiFindRandomTown();
Town *t = AiFindRandomTown();
if (t == NULL || t->population < (cargo == CT_FOOD ? 200U : 900U)) return;
@ -601,8 +601,8 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr)
static void AiFindRandomPassengerRoute(FoundRoute *fr)
{
Town* source;
Town* dest;
Town *source;
Town *dest;
// initially error
fr->distance = -1;
@ -670,8 +670,8 @@ static bool AiCheckIfRouteIsGood(Company *c, FoundRoute *fr, byte bitmask)
}
if (fr->cargo == CT_PASSENGERS || fr->cargo == CT_MAIL) {
const Town* from = (const Town*)fr->from;
const Town* to = (const Town*)fr->to;
const Town *from = (const Town*)fr->from;
const Town *to = (const Town*)fr->to;
if (from->pct_pass_transported > 0x99 ||
to->pct_pass_transported > 0x99) {
@ -684,7 +684,7 @@ static bool AiCheckIfRouteIsGood(Company *c, FoundRoute *fr, byte bitmask)
return false;
}
} else {
const Industry* i = (const Industry*)fr->from;
const Industry *i = (const Industry*)fr->from;
if (i->last_month_pct_transported[fr->cargo != i->produced_cargo[0]] > 0x99 ||
i->last_month_production[fr->cargo != i->produced_cargo[0]] == 0) {
@ -1634,7 +1634,7 @@ static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, b
return true;
}
static CommandCost AiDoBuildDefaultRailTrack(TileIndex tile, const AiDefaultBlockData* p, RailType railtype, byte flag)
static CommandCost AiDoBuildDefaultRailTrack(TileIndex tile, const AiDefaultBlockData *p, RailType railtype, byte flag)
{
CommandCost ret;
CommandCost total_cost(EXPENSES_CONSTRUCTION);
@ -1733,7 +1733,7 @@ clear_town_stuff:;
}
// Returns rule and cost
static int AiBuildDefaultRailTrack(TileIndex tile, byte p0, byte p1, byte p2, byte p3, byte dir, byte cargo, RailType railtype, CommandCost* cost)
static int AiBuildDefaultRailTrack(TileIndex tile, byte p0, byte p1, byte p2, byte p3, byte dir, byte cargo, RailType railtype, CommandCost *cost)
{
int i;
const AiDefaultRailBlock *p;
@ -2545,7 +2545,7 @@ handle_nocash:
}
for (i = 0; _companies_ai[c->index].order_list_blocks[i] != 0xFF; i++) {
const AiBuildRec* aib = &_companies_ai[c->index].src + _companies_ai[c->index].order_list_blocks[i];
const AiBuildRec *aib = &_companies_ai[c->index].src + _companies_ai[c->index].order_list_blocks[i];
bool is_pass = (
_companies_ai[c->index].cargo_type == CT_PASSENGERS ||
_companies_ai[c->index].cargo_type == CT_MAIL ||
@ -2578,11 +2578,11 @@ handle_nocash:
static void AiStateDeleteRailBlocks(Company *c)
{
const AiBuildRec* aib = &_companies_ai[c->index].src;
const AiBuildRec *aib = &_companies_ai[c->index].src;
uint num = _companies_ai[c->index].num_build_rec;
do {
const AiDefaultBlockData* b;
const AiDefaultBlockData *b;
if (aib->cur_building_rule == 255) continue;
for (b = _default_rail_track_data[aib->cur_building_rule]->data; b->mode != 4; b++) {
@ -2718,7 +2718,7 @@ clear_town_stuff:;
// Make sure the blocks are not too close to each other
static bool AiCheckBlockDistances(Company *c, TileIndex tile)
{
const AiBuildRec* aib = &_companies_ai[c->index].src;
const AiBuildRec *aib = &_companies_ai[c->index].src;
uint num = _companies_ai[c->index].num_build_rec;
do {
@ -3280,7 +3280,7 @@ static void AiStateBuildRoadVehicles(Company *c)
}
for (i = 0; _companies_ai[c->index].order_list_blocks[i] != 0xFF; i++) {
const AiBuildRec* aib = &_companies_ai[c->index].src + _companies_ai[c->index].order_list_blocks[i];
const AiBuildRec *aib = &_companies_ai[c->index].src + _companies_ai[c->index].order_list_blocks[i];
bool is_pass = (
_companies_ai[c->index].cargo_type == CT_PASSENGERS ||
_companies_ai[c->index].cargo_type == CT_MAIL ||
@ -3306,11 +3306,11 @@ static void AiStateBuildRoadVehicles(Company *c)
static void AiStateDeleteRoadBlocks(Company *c)
{
const AiBuildRec* aib = &_companies_ai[c->index].src;
const AiBuildRec *aib = &_companies_ai[c->index].src;
uint num = _companies_ai[c->index].num_build_rec;
do {
const AiDefaultBlockData* b;
const AiDefaultBlockData *b;
if (aib->cur_building_rule == 255) continue;
for (b = _road_default_block_data[aib->cur_building_rule]->data; b->mode != 4; b++) {
@ -3325,7 +3325,7 @@ static void AiStateDeleteRoadBlocks(Company *c)
static void AiStateAirportStuff(Company *c)
{
const Station* st;
const Station *st;
int i;
AiBuildRec *aib;
byte rule;
@ -3419,7 +3419,7 @@ static bool AiCheckAirportResources(TileIndex tile, const AiDefaultBlockData *p,
for (; p->mode == 0; p++) {
TileIndex tile2 = TILE_ADD(tile, ToTileIndexDiff(p->tileoffs));
const AirportFTAClass* airport = GetAirport(p->attr);
const AirportFTAClass *airport = GetAirport(p->attr);
uint w = airport->size_x;
uint h = airport->size_y;
uint rad = _settings_game.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;

View File

@ -58,7 +58,7 @@ static bool IsRoad(TileIndex tile)
// Check if the current tile is in our end-area
static int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, OpenListNode *current)
{
const Ai_PathFinderInfo* PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
const Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
// It is not allowed to have a station on the end of a bridge or tunnel ;)
if (current->path.node.user_data[0] != 0) return AYSTAR_DONE;
@ -171,7 +171,7 @@ void clean_AyStar_AiPathFinder(AyStar *aystar, Ai_PathFinderInfo *PathFinderInfo
// The h-value, simple calculation
static int32 AyStar_AiPathFinder_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
{
const Ai_PathFinderInfo* PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
const Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
int r, r2;
if (PathFinderInfo->end_direction != AI_PATHFINDER_NO_DIRECTION) {

View File

@ -214,8 +214,8 @@ static void AiNew_State_ActionDone(Company *c)
static bool AiNew_Check_City_or_Industry(Company *c, int ic, byte type)
{
if (type == AI_CITY) {
const Town* t = GetTown(ic);
const Station* st;
const Town *t = GetTown(ic);
const Station *st;
uint count = 0;
int j = 0;
@ -274,8 +274,8 @@ static bool AiNew_Check_City_or_Industry(Company *c, int ic, byte type)
return true;
}
if (type == AI_INDUSTRY) {
const Industry* i = GetIndustry(ic);
const Station* st;
const Industry *i = GetIndustry(ic);
const Station *st;
int count = 0;
int j = 0;
@ -434,8 +434,8 @@ static void AiNew_State_LocateRoute(Company *c)
*/
if (_companies_ainew[c->index].from_type == AI_CITY && _companies_ainew[c->index].tbt == AI_BUS) {
const Town* town_from = GetTown(_companies_ainew[c->index].from_ic);
const Town* town_temp = GetTown(_companies_ainew[c->index].temp);
const Town *town_from = GetTown(_companies_ainew[c->index].from_ic);
const Town *town_temp = GetTown(_companies_ainew[c->index].temp);
uint distance = DistanceManhattan(town_from->xy, town_temp->xy);
int max_cargo;
@ -461,8 +461,8 @@ static void AiNew_State_LocateRoute(Company *c)
return;
}
} else if (_companies_ainew[c->index].tbt == AI_TRUCK) {
const Industry* ind_from = GetIndustry(_companies_ainew[c->index].from_ic);
const Industry* ind_temp = GetIndustry(_companies_ainew[c->index].temp);
const Industry *ind_from = GetIndustry(_companies_ainew[c->index].from_ic);
const Industry *ind_temp = GetIndustry(_companies_ainew[c->index].temp);
bool found = false;
int max_cargo = 0;
uint i;
@ -729,7 +729,7 @@ static void AiNew_State_FindPath(Company *c)
if (_companies_ainew[c->index].temp == -1) {
// Init path_info
if (_companies_ainew[c->index].from_tile == AI_STATION_RANGE) {
const Industry* i = GetIndustry(_companies_ainew[c->index].from_ic);
const Industry *i = GetIndustry(_companies_ainew[c->index].from_ic);
// For truck routes we take a range around the industry
_companies_ainew[c->index].path_info.start_tile_tl = i->xy - TileDiffXY(1, 1);
@ -742,7 +742,7 @@ static void AiNew_State_FindPath(Company *c)
}
if (_companies_ainew[c->index].to_tile == AI_STATION_RANGE) {
const Industry* i = GetIndustry(_companies_ainew[c->index].to_ic);
const Industry *i = GetIndustry(_companies_ainew[c->index].to_ic);
_companies_ainew[c->index].path_info.end_tile_tl = i->xy - TileDiffXY(1, 1);
_companies_ainew[c->index].path_info.end_tile_br = i->xy + TileDiffXY(i->width + 1, i->height + 1);
@ -1299,7 +1299,7 @@ static void AiNew_State_CheckAllVehicles(Company *c)
// Using the technique simular to the original AI
// Keeps things logical
// It really should be in the same order as the AI_STATE's are!
static AiNew_StateFunction* const _ainew_state[] = {
static AiNew_StateFunction * const _ainew_state[] = {
NULL,
AiNew_State_FirstTime,
AiNew_State_Nothing,

View File

@ -769,7 +769,7 @@ void HandleAircraftEnterHangar(Vehicle *v)
SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
}
static void PlayAircraftSound(const Vehicle* v)
static void PlayAircraftSound(const Vehicle *v)
{
if (!PlayVehicleSound(v, VSE_START)) {
SndPlayVehicleFx(AircraftVehInfo(v->engine_type)->sfx, v);
@ -1874,7 +1874,7 @@ static bool AirportSetBlocks(Vehicle *v, const AirportFTA *current_pos, const Ai
* checking, because it has been set by the airplane before */
if (current_pos->block == next->block) airport_flags ^= next->block;
Station* st = GetStation(v->u.air.targetairport);
Station *st = GetStation(v->u.air.targetairport);
if (HASBITS(st->airport_flags, airport_flags)) {
v->cur_speed = 0;
v->subspeed = 0;
@ -1975,8 +1975,8 @@ static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *apc)
/* if there are more helicoptergroups, pick one, just as in AirportFindFreeTerminal() */
if (apc->helipads[0] > 1) {
const Station* st = GetStation(v->u.air.targetairport);
const AirportFTA* temp = apc->layout[v->u.air.pos].next;
const Station *st = GetStation(v->u.air.targetairport);
const AirportFTA *temp = apc->layout[v->u.air.pos].next;
while (temp != NULL) {
if (temp->heading == 255) {

View File

@ -28,7 +28,7 @@ int _aystar_stats_closed_size;
// This looks in the Hash if a node exists in ClosedList
// If so, it returns the PathNode, else NULL
static PathNode* AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode *node)
static PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode *node)
{
return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
}

View File

@ -241,7 +241,7 @@ uint16 BuildBridgeWindow::last_size = 4;
Listing BuildBridgeWindow::last_sorting = {false, 0};
/* Availible bridge sorting functions */
GUIBridgeList::SortFunction* const BuildBridgeWindow::sorter_funcs[] = {
GUIBridgeList::SortFunction * const BuildBridgeWindow::sorter_funcs[] = {
&BridgeIndexSorter,
&BridgePriceSorter,
&BridgeSpeedSorter

View File

@ -15,8 +15,8 @@ void InitializeCheats()
bool CheatHasBeenUsed()
{
/* Cannot use lengthof because _cheats is of type Cheats, not Cheat */
const Cheat* cht = (Cheat*)&_cheats;
const Cheat* cht_last = &cht[sizeof(_cheats) / sizeof(Cheat)];
const Cheat *cht = (Cheat*)&_cheats;
const Cheat *cht_last = &cht[sizeof(_cheats) / sizeof(Cheat)];
for (; cht != cht_last; cht++) {
if (cht->been_used) return true;

View File

@ -25,7 +25,7 @@
static CommandCost ClearTile_Clear(TileIndex tile, byte flags)
{
static const Money* clear_price_table[] = {
static const Money *clear_price_table[] = {
&_price.clear_grass,
&_price.clear_roughland,
&_price.clear_rocks,

View File

@ -376,7 +376,7 @@ void IConsoleAliasRegister(const char *name, const char *cmd)
*/
IConsoleAlias *IConsoleAliasGet(const char *name)
{
IConsoleAlias* item;
IConsoleAlias *item;
for (item = _iconsole_aliases; item != NULL; item = item->next) {
if (strcmp(item->name, name) == 0) return item;

View File

@ -215,7 +215,7 @@ DEF_CONSOLE_CMD(ConSaveConfig)
return true;
}
static const FiosItem* GetFiosItem(const char* file)
static const FiosItem *GetFiosItem(const char *file)
{
_saveload_mode = SLD_LOAD_GAME;
BuildFileList();
@ -759,7 +759,7 @@ extern bool CloseConsoleLogIfActive();
DEF_CONSOLE_CMD(ConScript)
{
extern FILE* _iconsole_output_file;
extern FILE *_iconsole_output_file;
if (argc == 0) {
IConsoleHelp("Start or stop logging console output to a file. Usage: 'script <filename>'");

View File

@ -114,7 +114,7 @@ IConsoleAlias *IConsoleAliasGet(const char *name);
/* Variables */
void IConsoleVarRegister(const char *name, void *addr, IConsoleVarTypes type, const char *help);
void IConsoleVarStringRegister(const char *name, void *addr, uint32 size, const char *help);
IConsoleVar* IConsoleVarGet(const char *name);
IConsoleVar *IConsoleVarGet(const char *name);
void IConsoleVarPrintGetValue(const IConsoleVar *var);
void IConsoleVarPrintSetValue(const IConsoleVar *var);

View File

@ -41,7 +41,7 @@ struct SmallStackSafeStackAlloc {
* Gets a pointer to the data stored in this wrapper.
* @return the pointer.
*/
FORCEINLINE operator T* ()
FORCEINLINE operator T *()
{
return data;
}
@ -50,7 +50,7 @@ struct SmallStackSafeStackAlloc {
* Gets a pointer to the data stored in this wrapper.
* @return the pointer.
*/
FORCEINLINE T* operator -> ()
FORCEINLINE T *operator -> ()
{
return data;
}
@ -60,7 +60,7 @@ struct SmallStackSafeStackAlloc {
* @note needed because endof does not work properly for pointers.
* @return the 'endof' pointer.
*/
FORCEINLINE T* EndOf()
FORCEINLINE T *EndOf()
{
#if !defined(__NDS__)
return endof(data);

View File

@ -180,7 +180,7 @@ void ResetCurrencies(bool preserve_custom)
* Build a list of currency names StringIDs to use in a dropdown list
* @return Pointer to a (static) array of StringIDs
*/
StringID* BuildCurrencyDropdown()
StringID *BuildCurrencyDropdown()
{
/* Allow room for all currencies, plus a terminator entry */
static StringID names[NUM_CURRENCY + 1];

View File

@ -44,7 +44,7 @@ extern CurrencySpec _currency_specs[NUM_CURRENCY];
uint GetMaskOfAllowedCurrencies();
void CheckSwitchToEuro();
void ResetCurrencies(bool preserve_custom = true);
StringID* BuildCurrencyDropdown();
StringID *BuildCurrencyDropdown();
byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
#endif /* CURRENCY_H */

View File

@ -32,7 +32,7 @@ void DedicatedFork()
exit(1);
case 0: { // We're the child
FILE* f;
FILE *f;
/* Open the log-file to log all stuff too */
f = fopen(_log_file, "a");

View File

@ -25,7 +25,7 @@ char *_ini_musicdriver;
char *_ini_blitter;
const char* GetDriverParam(const char* const* parm, const char* name)
const char *GetDriverParam(const char * const *parm, const char *name)
{
size_t len;
@ -33,7 +33,7 @@ const char* GetDriverParam(const char* const* parm, const char* name)
len = strlen(name);
for (; *parm != NULL; parm++) {
const char* p = *parm;
const char *p = *parm;
if (strncmp(p, name, len) == 0) {
if (p[len] == '=') return p + len + 1;
@ -43,14 +43,14 @@ const char* GetDriverParam(const char* const* parm, const char* name)
return NULL;
}
bool GetDriverParamBool(const char* const* parm, const char* name)
bool GetDriverParamBool(const char * const *parm, const char *name)
{
return GetDriverParam(parm, name) != NULL;
}
int GetDriverParamInt(const char* const* parm, const char* name, int def)
int GetDriverParamInt(const char * const *parm, const char *name, int def)
{
const char* p = GetDriverParam(parm, name);
const char *p = GetDriverParam(parm, name);
return p != NULL ? atoi(p) : def;
}

View File

@ -186,7 +186,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
/* Count stations */
{
uint num = 0;
const Station* st;
const Station *st;
FOR_ALL_STATIONS(st) {
if (st->owner == owner) num += CountBits(st->facilities);
@ -856,7 +856,7 @@ Money GetPriceByIndex(uint8 index)
}
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode)
Pair SetupSubsidyDecodeParam(const Subsidy *s, bool mode)
{
TileIndex tile;
TileIndex tile2;
@ -1033,7 +1033,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
static bool CheckSubsidyDuplicate(Subsidy *s)
{
const Subsidy* ss;
const Subsidy *ss;
for (ss = _subsidies; ss != endof(_subsidies); ss++) {
if (s != ss &&

View File

@ -331,7 +331,7 @@ static void BulldozerTick(Vehicle *v)
{
v->progress++;
if ((v->progress & 7) == 0) {
const BulldozerMovement* b = &_bulldozer_movement[v->u.effect.animation_state];
const BulldozerMovement *b = &_bulldozer_movement[v->u.effect.animation_state];
BeginVehicleMove(v);

View File

@ -53,7 +53,7 @@ void AskExitToGameMenu();
void RedrawAutosave();
int ttd_main(int argc, char* argv[]);
int ttd_main(int argc, char *argv[]);
void HandleExitGameRequest();
#endif /* FUNCTIONS_H */

View File

@ -370,7 +370,7 @@ static int TruncateString(char *str, int maxw)
*
* @return Actual width of the (possibly) truncated string in pixels
*/
static inline int TruncateStringID(StringID src, char *dest, int maxw, const char* last)
static inline int TruncateStringID(StringID src, char *dest, int maxw, const char *last)
{
GetString(dest, src, last);
return TruncateString(dest, maxw);

View File

@ -138,7 +138,7 @@ void MarkWholeScreenDirty();
void GfxInitPalettes();
bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int height);
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height);
/* window.cpp */
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);

View File

@ -131,7 +131,7 @@ void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_t
}
}
static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int file_index)
static void LoadGrfIndexed(const char *filename, const SpriteID *index_tbl, int file_index)
{
uint sprite_id = 0;

View File

@ -787,7 +787,7 @@ private:
}
/** Sort the company league by performance history */
static int CDECL PerformanceSorter(const Company* const *c1, const Company* const *c2)
static int CDECL PerformanceSorter(const Company * const *c1, const Company * const *c2)
{
return (*c2)->old_economy[1].performance_history - (*c1)->old_economy[1].performance_history;
}

View File

@ -150,7 +150,7 @@ private:
}
/** Sort the groups by their name */
static int CDECL GroupNameSorter(const Group* const *a, const Group* const *b)
static int CDECL GroupNameSorter(const Group * const *a, const Group * const *b)
{
static const Group *last_group[2] = { NULL, NULL };
static char last_name[2][64] = { "", "" };

View File

@ -71,7 +71,7 @@ int8 SaveHighScoreValue(const Company *c)
}
/** Sort all companies given their performance */
static int CDECL HighScoreSorter(const Company* const *a, const Company* const *b)
static int CDECL HighScoreSorter(const Company * const *a, const Company * const *b)
{
return (*b)->old_economy[0].performance_history - (*a)->old_economy[0].performance_history;
}
@ -97,7 +97,7 @@ int8 SaveHighScoreValueNetwork()
/* Copy over Top5 companies */
for (i = 0; i < lengthof(_highscore_table[LAST_HS_ITEM]) && i < count; i++) {
HighScore* hs = &_highscore_table[LAST_HS_ITEM][i];
HighScore *hs = &_highscore_table[LAST_HS_ITEM][i];
SetDParam(0, cl[i]->index);
SetDParam(1, cl[i]->index);

View File

@ -1350,7 +1350,7 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i
* This function tries to flatten out the land below an industry, without
* damaging the surroundings too much.
*/
static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, uint32 flags, const IndustryTileTable* it, int type)
static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, uint32 flags, const IndustryTileTable *it, int type)
{
const int MKEND = -0x80; // used for last element in an IndustryTileTable (see build_industry.h)
int max_x = 0;
@ -1984,7 +1984,7 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
* service the industry, and 1 otherwise (only competitors can service the
* industry)
*/
int WhoCanServiceIndustry(Industry* ind)
int WhoCanServiceIndustry(Industry *ind)
{
/* Find all stations within reach of the industry */
StationSet stations = FindStationsAroundTiles(ind->xy, ind->width, ind->height);

View File

@ -643,7 +643,7 @@ public:
{
if (StrEmpty(str)) return;
Industry* i = GetIndustry(this->window_number);
Industry *i = GetIndustry(this->window_number);
int line = this->editbox_line;
i->production_rate[line] = ClampU(atoi(str), 0, 255);
@ -786,7 +786,7 @@ protected:
}
/** Sort industries by name */
static int CDECL IndustryNameSorter(const Industry* const *a, const Industry* const *b)
static int CDECL IndustryNameSorter(const Industry * const *a, const Industry * const *b)
{
static char buf_cache[96];
static char buf[96];
@ -804,14 +804,14 @@ protected:
}
/** Sort industries by type and name */
static int CDECL IndustryTypeSorter(const Industry* const *a, const Industry* const *b)
static int CDECL IndustryTypeSorter(const Industry * const *a, const Industry * const *b)
{
int r = (*a)->type - (*b)->type;
return (r == 0) ? IndustryNameSorter(a, b) : r;
}
/** Sort industries by production and name */
static int CDECL IndustryProductionSorter(const Industry* const *a, const Industry* const *b)
static int CDECL IndustryProductionSorter(const Industry * const *a, const Industry * const *b)
{
int r = 0;
@ -828,7 +828,7 @@ protected:
}
/** Sort industries by transported cargo and name */
static int CDECL IndustryTransportedCargoSorter(const Industry* const *a, const Industry* const *b)
static int CDECL IndustryTransportedCargoSorter(const Industry * const *a, const Industry * const *b)
{
int r = GetCargoTransportedSortValue(*a) - GetCargoTransportedSortValue(*b);
return (r == 0) ? IndustryNameSorter(a, b) : r;
@ -882,7 +882,7 @@ public:
int y = 28; // start of the list-widget
for (int n = this->vscroll.pos; n < max; ++n) {
const Industry* i = this->industries[n];
const Industry *i = this->industries[n];
const IndustrySpec *indsp = GetIndustrySpec(i->type);
byte p = 0;
@ -970,7 +970,7 @@ Listing IndustryDirectoryWindow::last_sorting = {false, 0};
const Industry *IndustryDirectoryWindow::last_industry = NULL;
/* Availible station sorting functions */
GUIIndustryList::SortFunction* const IndustryDirectoryWindow::sorter_funcs[] = {
GUIIndustryList::SortFunction * const IndustryDirectoryWindow::sorter_funcs[] = {
&IndustryNameSorter,
&IndustryTypeSorter,
&IndustryProductionSorter,

View File

@ -329,7 +329,7 @@ void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2)
* @param z returns the z of the foundation slope. (Can be NULL, if not needed)
* @return The slope on top of the foundation.
*/
Slope GetFoundationSlope(TileIndex tile, uint* z)
Slope GetFoundationSlope(TileIndex tile, uint *z)
{
Slope tileh = GetTileSlope(tile, z);
Foundation f = _tile_type_procs[GetTileType(tile)]->get_foundation_proc(tile, tileh);

View File

@ -32,7 +32,7 @@ uint GetPartialZ(int x, int y, Slope corners);
uint GetSlopeZ(int x, int y);
void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
int GetSlopeZInCorner(Slope tileh, Corner corner);
Slope GetFoundationSlope(TileIndex tile, uint* z);
Slope GetFoundationSlope(TileIndex tile, uint *z);
static inline Point RemapCoords(int x, int y, int z)
{

View File

@ -5,9 +5,9 @@
#ifndef BINARYHEAP_HPP
#define BINARYHEAP_HPP
//void* operator new (size_t size, void* p) {return p;}
//void *operator new (size_t size, void *p) {return p;}
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
//void operator delete (void* p, void* p2) {}
//void operator delete (void *p, void *p2) {}
#endif
@ -36,7 +36,7 @@ public:
private:
int m_size; ///< Number of items in the heap
int m_max_size; ///< Maximum number of items the heap can hold
ItemPtr* m_items; ///< The heap item pointers
ItemPtr *m_items; ///< The heap item pointers
public:
explicit CBinaryHeapT(int max_items = 102400)

View File

@ -101,7 +101,7 @@ protected:
}
/** initialize blob by attaching it to the given header followed by data */
FORCEINLINE void Init(CHdr* hdr)
FORCEINLINE void Init(CHdr *hdr)
{
ptr_u.m_pHdr_1 = &hdr[1];
}
@ -144,13 +144,13 @@ public:
};
/** return pointer to the first byte of data - non-const version */
FORCEINLINE bitem_t* RawData()
FORCEINLINE bitem_t *RawData()
{
return ptr_u.m_pData;
}
/** return pointer to the first byte of data - const version */
FORCEINLINE const bitem_t* RawData() const
FORCEINLINE const bitem_t *RawData() const
{
return ptr_u.m_pData;
}
@ -218,7 +218,7 @@ public:
/** Reallocate if there is no free space for num_bytes bytes.
* @return pointer to the new data to be added */
FORCEINLINE bitem_t* MakeRawFreeSpace(bsize_t num_bytes)
FORCEINLINE bitem_t *MakeRawFreeSpace(bsize_t num_bytes)
{
assert(num_bytes >= 0);
bsize_t new_size = RawSize() + num_bytes;
@ -228,9 +228,9 @@ public:
/** Increase RawSize() by num_bytes.
* @return pointer to the new data added */
FORCEINLINE bitem_t* GrowRawSize(bsize_t num_bytes)
FORCEINLINE bitem_t *GrowRawSize(bsize_t num_bytes)
{
bitem_t* pNewData = MakeRawFreeSpace(num_bytes);
bitem_t *pNewData = MakeRawFreeSpace(num_bytes);
RawSizeRef() += num_bytes;
return pNewData;
}
@ -255,7 +255,7 @@ public:
// ask allocation policy for some reasonable block size
bsize_t alloc_size = AllocPolicy(min_alloc_size);
// allocate new block
CHdr* pNewHdr = RawAlloc(alloc_size);
CHdr *pNewHdr = RawAlloc(alloc_size);
// setup header
pNewHdr->m_size = RawSize();
pNewHdr->m_max_size = alloc_size - (sizeof(CHdr) + Ttail_reserve);
@ -263,7 +263,7 @@ public:
if (RawSize() > 0)
memcpy(pNewHdr + 1, ptr_u.m_pData, pNewHdr->m_size);
// replace our block with new one
CHdr* pOldHdr = &Hdr();
CHdr *pOldHdr = &Hdr();
Init(pNewHdr);
if (old_max_size > 0)
RawFree(pOldHdr);
@ -289,13 +289,13 @@ public:
}
/** all allocation should happen here */
static FORCEINLINE CHdr* RawAlloc(bsize_t num_bytes)
static FORCEINLINE CHdr *RawAlloc(bsize_t num_bytes)
{
return (CHdr*)MallocT<byte>(num_bytes);
}
/** all deallocations should happen here */
static FORCEINLINE void RawFree(CHdr* p)
static FORCEINLINE void RawFree(CHdr *p)
{
free(p);
}
@ -370,26 +370,26 @@ public:
}
/** Return pointer to the first data item - non-const version */
FORCEINLINE Titem* Data()
FORCEINLINE Titem *Data()
{
return (Titem*)Tbase::RawData();
}
/** Return pointer to the first data item - const version */
FORCEINLINE const Titem* Data() const
FORCEINLINE const Titem *Data() const
{
return (const Titem*)Tbase::RawData();
}
/** Return pointer to the idx-th data item - non-const version */
FORCEINLINE Titem* Data(bsize_t idx)
FORCEINLINE Titem *Data(bsize_t idx)
{
CheckIdx(idx);
return (Data() + idx);
}
/** Return pointer to the idx-th data item - const version */
FORCEINLINE const Titem* Data(bsize_t idx) const
FORCEINLINE const Titem *Data(bsize_t idx) const
{
CheckIdx(idx);
return (Data() + idx);
@ -419,22 +419,22 @@ public:
bsize_t old_size = Size();
if (old_size > 0) {
// destroy removed items;
Titem* pI_last_to_destroy = Data(0);
for (Titem* pI = Data(old_size - 1); pI >= pI_last_to_destroy; pI--) pI->~Titem_();
Titem *pI_last_to_destroy = Data(0);
for (Titem *pI = Data(old_size - 1); pI >= pI_last_to_destroy; pI--) pI->~Titem_();
}
Tbase::Free();
}
/** Grow number of data items in Blob by given number - doesn't construct items */
FORCEINLINE Titem* GrowSizeNC(bsize_t num_items)
FORCEINLINE Titem *GrowSizeNC(bsize_t num_items)
{
return (Titem*)Tbase::GrowRawSize(num_items * Titem_size);
}
/** Grow number of data items in Blob by given number - constructs new items (using Titem_'s default constructor) */
FORCEINLINE Titem* GrowSizeC(bsize_t num_items)
FORCEINLINE Titem *GrowSizeC(bsize_t num_items)
{
Titem* pI = GrowSizeNC(num_items);
Titem *pI = GrowSizeNC(num_items);
for (bsize_t i = num_items; i > 0; i--, pI++) new (pI) Titem();
}
@ -446,34 +446,34 @@ public:
assert(num_items <= old_size);
bsize_t new_size = (num_items <= old_size) ? (old_size - num_items) : 0;
// destroy removed items;
Titem* pI_last_to_destroy = Data(new_size);
for (Titem* pI = Data(old_size - 1); pI >= pI_last_to_destroy; pI--) pI->~Titem();
Titem *pI_last_to_destroy = Data(new_size);
for (Titem *pI = Data(old_size - 1); pI >= pI_last_to_destroy; pI--) pI->~Titem();
// remove them
Tbase::ReduceRawSize(num_items * Titem_size);
}
/** Append one data item at the end (calls Titem_'s default constructor) */
FORCEINLINE Titem* AppendNew()
FORCEINLINE Titem *AppendNew()
{
Titem& dst = *GrowSizeNC(1); // Grow size by one item
Titem* pNewItem = new (&dst) Titem(); // construct the new item by calling in-place new operator
Titem *pNewItem = new (&dst) Titem(); // construct the new item by calling in-place new operator
return pNewItem;
}
/** Append the copy of given item at the end of Blob (using copy constructor) */
FORCEINLINE Titem* Append(const Titem& src)
FORCEINLINE Titem *Append(const Titem& src)
{
Titem& dst = *GrowSizeNC(1); // Grow size by one item
Titem* pNewItem = new (&dst) Titem(src); // construct the new item by calling in-place new operator with copy ctor()
Titem *pNewItem = new (&dst) Titem(src); // construct the new item by calling in-place new operator with copy ctor()
return pNewItem;
}
/** Add given items (ptr + number of items) at the end of blob */
FORCEINLINE Titem* Append(const Titem* pSrc, bsize_t num_items)
FORCEINLINE Titem *Append(const Titem *pSrc, bsize_t num_items)
{
Titem* pDst = GrowSizeNC(num_items);
Titem* pDstOrg = pDst;
Titem* pDstEnd = pDst + num_items;
Titem *pDst = GrowSizeNC(num_items);
Titem *pDstOrg = pDst;
Titem *pDstEnd = pDst + num_items;
while (pDst < pDstEnd) new (pDst++) Titem(*(pSrc++));
return pDstOrg;
}
@ -483,14 +483,14 @@ public:
{
CheckIdx(idx);
// destroy removed item
Titem* pRemoved = Data(idx);
Titem *pRemoved = Data(idx);
RemoveBySwap(pRemoved);
}
/** Remove item given by pointer replacing it by the last item and reducing the size by one */
FORCEINLINE void RemoveBySwap(Titem* pItem)
FORCEINLINE void RemoveBySwap(Titem *pItem)
{
Titem* pLast = Data(Size() - 1);
Titem *pLast = Data(Size() - 1);
assert(pItem >= Data() && pItem <= pLast);
// move last item to its new place
if (pItem != pLast) {
@ -505,7 +505,7 @@ public:
/** Ensures that given number of items can be added to the end of Blob. Returns pointer to the
* first free (unused) item */
FORCEINLINE Titem* MakeFreeSpace(bsize_t num_items)
FORCEINLINE Titem *MakeFreeSpace(bsize_t num_items)
{
return (Titem*)Tbase::MakeRawFreeSpace(num_items * Titem_size);
}

View File

@ -23,11 +23,11 @@ public:
protected:
/** here we hold our pointer to the target */
Tcls* m_pT;
Tcls *m_pT;
public:
/** default (NULL) construct or construct from a raw pointer */
FORCEINLINE CCountedPtr(Tcls* pObj = NULL) : m_pT(pObj) {AddRef();};
FORCEINLINE CCountedPtr(Tcls *pObj = NULL) : m_pT(pObj) {AddRef();};
/** copy constructor (invoked also when initializing from another smart ptr) */
FORCEINLINE CCountedPtr(const CCountedPtr& src) : m_pT(src.m_pT) {AddRef();};
@ -41,13 +41,13 @@ protected:
public:
/** release smart pointer (and decrement ref count) if not null */
FORCEINLINE void Release() {if (m_pT != NULL) {Tcls* pT = m_pT; m_pT = NULL; pT->Release();}}
FORCEINLINE void Release() {if (m_pT != NULL) {Tcls *pT = m_pT; m_pT = NULL; pT->Release();}}
/** dereference of smart pointer - const way */
FORCEINLINE const Tcls* operator -> () const {assert(m_pT != NULL); return m_pT;};
FORCEINLINE const Tcls *operator -> () const {assert(m_pT != NULL); return m_pT;};
/** dereference of smart pointer - non const way */
FORCEINLINE Tcls* operator -> () {assert(m_pT != NULL); return m_pT;};
FORCEINLINE Tcls *operator -> () {assert(m_pT != NULL); return m_pT;};
/** raw pointer casting operator - const way */
FORCEINLINE operator const Tcls*() const {assert(m_pT == NULL); return m_pT;}
@ -59,13 +59,13 @@ public:
FORCEINLINE Tcls** operator &() {assert(m_pT == NULL); return &m_pT;}
/** assignment operator from raw ptr */
FORCEINLINE CCountedPtr& operator = (Tcls* pT) {Assign(pT); return *this;}
FORCEINLINE CCountedPtr& operator = (Tcls *pT) {Assign(pT); return *this;}
/** assignment operator from another smart ptr */
FORCEINLINE CCountedPtr& operator = (const CCountedPtr& src) {Assign(src.m_pT); return *this;}
/** assignment operator helper */
FORCEINLINE void Assign(Tcls* pT);
FORCEINLINE void Assign(Tcls *pT);
/** one way how to test for NULL value */
FORCEINLINE bool IsNull() const {return m_pT == NULL;}
@ -77,19 +77,19 @@ public:
//FORCEINLINE bool operator != (const CCountedPtr& sp) const {return m_pT != sp.m_pT;}
/** assign pointer w/o incrementing ref count */
FORCEINLINE void Attach(Tcls* pT) {Release(); m_pT = pT;}
FORCEINLINE void Attach(Tcls *pT) {Release(); m_pT = pT;}
/** detach pointer w/o decrementing ref count */
FORCEINLINE Tcls* Detach() {Tcls* pT = m_pT; m_pT = NULL; return pT;}
FORCEINLINE Tcls *Detach() {Tcls *pT = m_pT; m_pT = NULL; return pT;}
};
template <class Tcls_>
FORCEINLINE void CCountedPtr<Tcls_>::Assign(Tcls* pT)
FORCEINLINE void CCountedPtr<Tcls_>::Assign(Tcls *pT)
{
// if they are the same, we do nothing
if (pT != m_pT) {
if (pT) pT->AddRef(); // AddRef new pointer if any
Tcls* pTold = m_pT; // save original ptr
Tcls *pTold = m_pT; // save original ptr
m_pT = pT; // update m_pT to new value
if (pTold) pTold->Release(); // release old ptr if any
}

View File

@ -11,18 +11,18 @@ struct CCrc32
static uint32 Calc(const void *pBuffer, int nCount)
{
uint32 crc = 0xffffffff;
const uint32* pTable = CrcTable();
const uint32 *pTable = CrcTable();
uint8* begin = (uint8*)pBuffer;
uint8* end = begin + nCount;
for(uint8* cur = begin; cur < end; cur++)
uint8 *begin = (uint8*)pBuffer;
uint8 *end = begin + nCount;
for(uint8 *cur = begin; cur < end; cur++)
crc = (crc >> 8) ^ pTable[cur[0] ^ (uint8)(crc & 0xff)];
crc ^= 0xffffffff;
return crc;
}
static const uint32* CrcTable()
static const uint32 *CrcTable()
{
static const uint32 Table[256] =
{

View File

@ -11,7 +11,7 @@
#include "dbg_helpers.h"
/** Trackdir & TrackdirBits short names. */
static const char* trackdir_names[] = {
static const char *trackdir_names[] = {
"NE", "SE", "UE", "LE", "LS", "RS", "rne", "rse",
"SW", "NW", "UW", "LW", "LN", "RN", "rsw", "rnw",
};
@ -34,7 +34,7 @@ CStrA ValueStr(TrackdirBits td_bits)
/** DiagDirection short names. */
static const char* diagdir_names[] = {
static const char *diagdir_names[] = {
"NE", "SE", "SW", "NW",
};
@ -48,7 +48,7 @@ CStrA ValueStr(DiagDirection dd)
/** SignalType short names. */
static const char* signal_type_names[] = {
static const char *signal_type_names[] = {
"NORMAL", "ENTRY", "EXIT", "COMBO", "PBS", "NOENTRY",
};

View File

@ -59,7 +59,7 @@ inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_
* or t_unk when index is out of bounds.
*/
template <typename E, typename T>
inline CStrA ComposeNameT(E value, T &t, const char* t_unk, E val_inv, const char* name_inv)
inline CStrA ComposeNameT(E value, T &t, const char *t_unk, E val_inv, const char *name_inv)
{
CStrA out;
if (value == val_inv) {
@ -123,7 +123,7 @@ struct DumpTarget {
static size_t& LastTypeId();
CStrA GetCurrentStructName();
bool FindKnownName(size_t type_id, const void* ptr, CStrA &name);
bool FindKnownName(size_t type_id, const void *ptr, CStrA &name);
void WriteIndent();

View File

@ -63,7 +63,7 @@ struct CFixedSizeArrayT {
FORCEINLINE void Clear()
{
// walk through all allocated items backward and destroy them
for (Titem* pItem = &m_items[Size() - 1]; pItem >= m_items; pItem--) {
for (Titem *pItem = &m_items[Size() - 1]; pItem >= m_items; pItem--) {
pItem->~Titem_();
}
// number of items become zero

View File

@ -10,7 +10,7 @@ struct CHashTableSlotT
{
typedef typename Titem_::Key Key; // make Titem_::Key a property of HashTable
Titem_* m_pFirst;
Titem_ *m_pFirst;
CHashTableSlotT() : m_pFirst(NULL) {}
@ -18,9 +18,9 @@ struct CHashTableSlotT
FORCEINLINE void Clear() {m_pFirst = NULL;}
/** hash table slot helper - linear search for item with given key through the given blob - const version */
FORCEINLINE const Titem_* Find(const Key& key) const
FORCEINLINE const Titem_ *Find(const Key& key) const
{
for (const Titem_* pItem = m_pFirst; pItem != NULL; pItem = pItem->GetHashNext()) {
for (const Titem_ *pItem = m_pFirst; pItem != NULL; pItem = pItem->GetHashNext()) {
if (pItem->GetKey() == key) {
// we have found the item, return it
return pItem;
@ -30,9 +30,9 @@ struct CHashTableSlotT
}
/** hash table slot helper - linear search for item with given key through the given blob - non-const version */
FORCEINLINE Titem_* Find(const Key& key)
FORCEINLINE Titem_ *Find(const Key& key)
{
for (Titem_* pItem = m_pFirst; pItem != NULL; pItem = pItem->GetHashNext()) {
for (Titem_ *pItem = m_pFirst; pItem != NULL; pItem = pItem->GetHashNext()) {
if (pItem->GetKey() == key) {
// we have found the item, return it
return pItem;
@ -57,12 +57,12 @@ struct CHashTableSlotT
item_to_remove.SetHashNext(NULL);
return true;
}
Titem_* pItem = m_pFirst;
Titem_ *pItem = m_pFirst;
while (true) {
if (pItem == NULL) {
return false;
}
Titem_* pNextItem = pItem->GetHashNext();
Titem_ *pNextItem = pItem->GetHashNext();
if (pNextItem == &item_to_remove) break;
pItem = pNextItem;
}
@ -72,7 +72,7 @@ struct CHashTableSlotT
}
/** hash table slot helper - remove and return item from a slot */
FORCEINLINE Titem_* Detach(const Key& key)
FORCEINLINE Titem_ *Detach(const Key& key)
{
// do we have any items?
if (m_pFirst == NULL) {
@ -86,8 +86,8 @@ struct CHashTableSlotT
return &ret_item;
}
// find it in the following items
Titem_* pPrev = m_pFirst;
for (Titem_* pItem = m_pFirst->GetHashNext(); pItem != NULL; pPrev = pItem, pItem = pItem->GetHashNext()) {
Titem_ *pPrev = m_pFirst;
for (Titem_ *pItem = m_pFirst->GetHashNext(); pItem != NULL; pPrev = pItem, pItem = pItem->GetHashNext()) {
if (pItem->GetKey() == key) {
// we have found the item, unlink and return it
pPrev->SetHashNext(pItem->GetHashNext());
@ -133,8 +133,8 @@ protected:
* Titem contains pointer to the next item - GetHashNext(), SetHashNext() */
typedef CHashTableSlotT<Titem_> Slot;
Slot* m_slots; // here we store our data (array of blobs)
int m_num_items; // item counter
Slot *m_slots; // here we store our data (array of blobs)
int m_num_items; // item counter
public:
// default constructor
@ -171,29 +171,29 @@ public:
FORCEINLINE void Clear() const {for (int i = 0; i < Tcapacity; i++) m_slots[i].Clear();}
/** const item search */
const Titem_* Find(const Tkey& key) const
const Titem_ *Find(const Tkey& key) const
{
int hash = CalcHash(key);
const Slot& slot = m_slots[hash];
const Titem_* item = slot.Find(key);
const Titem_ *item = slot.Find(key);
return item;
}
/** non-const item search */
Titem_* Find(const Tkey& key)
Titem_ *Find(const Tkey& key)
{
int hash = CalcHash(key);
Slot& slot = m_slots[hash];
Titem_* item = slot.Find(key);
Titem_ *item = slot.Find(key);
return item;
}
/** non-const item search & optional removal (if found) */
Titem_* TryPop(const Tkey& key)
Titem_ *TryPop(const Tkey& key)
{
int hash = CalcHash(key);
Slot& slot = m_slots[hash];
Titem_* item = slot.Detach(key);
Titem_ *item = slot.Detach(key);
if (item != NULL) {
m_num_items--;
}
@ -203,7 +203,7 @@ public:
/** non-const item search & removal */
Titem_& Pop(const Tkey& key)
{
Titem_* item = TryPop(key);
Titem_ *item = TryPop(key);
assert(item != NULL);
return *item;
}

View File

@ -19,19 +19,19 @@ struct CStrT : public CBlobT<Tchar>
typedef typename base::OnTransfer OnTransfer; ///< temporary 'transfer ownership' object type
/** Construction from C zero ended string. */
FORCEINLINE CStrT(const Tchar* str = NULL)
FORCEINLINE CStrT(const Tchar *str = NULL)
{
AppendStr(str);
}
/** Construction from C string and given number of characters. */
FORCEINLINE CStrT(const Tchar* str, bsize_t num_chars) : base(str, num_chars)
FORCEINLINE CStrT(const Tchar *str, bsize_t num_chars) : base(str, num_chars)
{
base::FixTail();
}
/** Construction from C string determined by 'begin' and 'end' pointers. */
FORCEINLINE CStrT(const Tchar* str, const Tchar* end)
FORCEINLINE CStrT(const Tchar *str, const Tchar *end)
: base(str, end - str)
{
base::FixTail();
@ -58,15 +58,15 @@ struct CStrT : public CBlobT<Tchar>
}
/** Grow the actual buffer and fix the trailing zero at the end. */
FORCEINLINE Tchar* GrowSizeNC(bsize_t count)
FORCEINLINE Tchar *GrowSizeNC(bsize_t count)
{
Tchar* ret = base::GrowSizeNC(count);
Tchar *ret = base::GrowSizeNC(count);
base::FixTail();
return ret;
}
/** Append zero-ended C string. */
FORCEINLINE void AppendStr(const Tchar* str)
FORCEINLINE void AppendStr(const Tchar *str)
{
if (str != NULL && str[0] != '\0') {
base::Append(str, (bsize_t)Api::StrLen(str));
@ -84,7 +84,7 @@ struct CStrT : public CBlobT<Tchar>
}
/** Assignment from C string. */
FORCEINLINE CStrT& operator = (const Tchar* src)
FORCEINLINE CStrT& operator = (const Tchar *src)
{
base::Clear();
AppendStr(src);

View File

@ -138,7 +138,7 @@ void MxSetChannelVolume(MixerChannel *mc, uint left, uint right)
}
void MxActivateChannel(MixerChannel* mc)
void MxActivateChannel(MixerChannel *mc)
{
mc->active = true;
}

View File

@ -21,13 +21,13 @@
static FMusicDriver_DMusic iFMusicDriver_DMusic;
/** the performance object controls manipulation of the segments */
static IDirectMusicPerformance* performance = NULL;
static IDirectMusicPerformance *performance = NULL;
/** the loader object can load many types of DMusic related files */
static IDirectMusicLoader* loader = NULL;
static IDirectMusicLoader *loader = NULL;
/** the segment object is where the MIDI data is stored for playback */
static IDirectMusicSegment* segment = NULL;
static IDirectMusicSegment *segment = NULL;
static bool seeking = false;
@ -43,7 +43,7 @@ static const char ole_files[] =
#undef M
struct ProcPtrs {
unsigned long (WINAPI * CoCreateInstance)(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv);
unsigned long (WINAPI * CoCreateInstance)(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv);
HRESULT (WINAPI * CoInitialize)(LPVOID pvReserved);
void (WINAPI * CoUninitialize)();
};
@ -140,7 +140,7 @@ void MusicDriver_DMusic::Stop()
}
void MusicDriver_DMusic::PlaySong(const char* filename)
void MusicDriver_DMusic::PlaySong(const char *filename)
{
/* set up the loader object info */
DMUS_OBJECTDESC obj_desc;

View File

@ -23,7 +23,7 @@
static FMusicDriver_ExtMidi iFMusicDriver_ExtMidi;
const char* MusicDriver_ExtMidi::Start(const char* const * parm)
const char *MusicDriver_ExtMidi::Start(const char * const * parm)
{
const char *command = GetDriverParam(parm, "cmd");
if (StrEmpty(command)) command = EXTERNAL_PLAYER;
@ -41,7 +41,7 @@ void MusicDriver_ExtMidi::Stop()
this->DoStop();
}
void MusicDriver_ExtMidi::PlaySong(const char* filename)
void MusicDriver_ExtMidi::PlaySong(const char *filename)
{
strecpy(this->song, filename, lastof(this->song));
this->DoStop();

View File

@ -49,7 +49,7 @@ void MusicDriver_Win32::SetVolume(byte vol)
SetEvent(_midi.wait_obj);
}
static MCIERROR CDECL MidiSendCommand(const TCHAR* cmd, ...)
static MCIERROR CDECL MidiSendCommand(const TCHAR *cmd, ...)
{
va_list va;
TCHAR buf[512];

View File

@ -72,7 +72,7 @@ static void SkipToPrevSong()
static void SkipToNextSong()
{
byte* b = _cur_playlist;
byte *b = _cur_playlist;
byte t;
t = b[0];
@ -219,7 +219,7 @@ public:
virtual void OnPaint()
{
const byte* p;
const byte *p;
uint i;
int y;

View File

@ -160,7 +160,7 @@ static int NetworkFindBroadcastIPsInternal(uint32 *broadcast, int limit) // !GET
const char *buf_end = buf + ifconf.ifc_len;
int index = 0;
for (const char *p = buf; p < buf_end && index != limit;) {
const struct ifreq* req = (const struct ifreq*)p;
const struct ifreq *req = (const struct ifreq*)p;
if (req->ifr_addr.sa_family == AF_INET) {
struct ifreq r;

View File

@ -124,7 +124,7 @@ void Packet::Send_uint64(uint64 data)
* the string + '\0'. No size-byte or something.
* @param data the string to send
*/
void Packet::Send_string(const char* data)
void Packet::Send_string(const char *data)
{
assert(data != NULL);
/* The <= *is* valid due to the fact that we are comparing sizes and not the index. */

View File

@ -50,7 +50,7 @@ public:
void Send_uint16(uint16 data);
void Send_uint32(uint32 data);
void Send_uint64(uint64 data);
void Send_string(const char* data);
void Send_string(const char *data);
/* Reading/receiving of packets */
void ReadRawPacketSize();
@ -62,7 +62,7 @@ public:
uint16 Recv_uint16();
uint32 Recv_uint32();
uint64 Recv_uint64();
void Recv_string(char* buffer, size_t size);
void Recv_string(char *buffer, size_t size);
};
Packet *NetworkSend_Init(PacketType type);

View File

@ -251,7 +251,7 @@ static void ServerStartError(const char *error)
NetworkError(STR_NETWORK_ERR_SERVER_START);
}
static void NetworkClientError(NetworkRecvStatus res, NetworkClientSocket* cs)
static void NetworkClientError(NetworkRecvStatus res, NetworkClientSocket *cs)
{
// First, send a CLIENT_ERROR to the server, so he knows we are
// disconnection (and why!)
@ -644,7 +644,7 @@ static void NetworkInitialize()
// Query a server to fetch his game-info
// If game_info is true, only the gameinfo is fetched,
// else only the client_info is fetched
void NetworkTCPQueryServer(const char* host, unsigned short port)
void NetworkTCPQueryServer(const char *host, unsigned short port)
{
if (!_network_available) return;

View File

@ -820,7 +820,7 @@ typedef NetworkRecvStatus NetworkClientPacket(Packet *p);
// packet it is matches against this array
// and that way the right function to handle that
// packet is found.
static NetworkClientPacket* const _network_client_packet[] = {
static NetworkClientPacket * const _network_client_packet[] = {
RECEIVE_COMMAND(PACKET_SERVER_FULL),
RECEIVE_COMMAND(PACKET_SERVER_BANNED),
NULL, /*PACKET_CLIENT_JOIN,*/

View File

@ -53,7 +53,7 @@ bool NetworkServerStart();
NetworkClientInfo *NetworkFindClientInfoFromIndex(ClientIndex index);
NetworkClientInfo *NetworkFindClientInfoFromClientID(ClientID client_id);
NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
const char* GetClientIP(const NetworkClientInfo *ci);
const char *GetClientIP(const NetworkClientInfo *ci);
void NetworkServerSendRcon(ClientID client_id, ConsoleColour colour_code, const char *string);
void NetworkServerSendError(ClientID client_id, NetworkErrorCode error);

View File

@ -150,7 +150,7 @@ protected:
}
/** Sort servers by name. */
static int CDECL NGameNameSorter(NetworkGameList* const *a, NetworkGameList* const *b)
static int CDECL NGameNameSorter(NetworkGameList * const *a, NetworkGameList * const *b)
{
return strcasecmp((*a)->info.server_name, (*b)->info.server_name);
}
@ -158,7 +158,7 @@ protected:
/** Sort servers by the amount of clients online on a
* server. If the two servers have the same amount, the one with the
* higher maximum is preferred. */
static int CDECL NGameClientSorter(NetworkGameList* const *a, NetworkGameList* const *b)
static int CDECL NGameClientSorter(NetworkGameList * const *a, NetworkGameList * const *b)
{
/* Reverse as per default we are interested in most-clients first */
int r = (*a)->info.clients_on - (*b)->info.clients_on;
@ -170,7 +170,7 @@ protected:
}
/** Sort servers by map size */
static int CDECL NGameMapSizeSorter(NetworkGameList* const *a, NetworkGameList* const *b)
static int CDECL NGameMapSizeSorter(NetworkGameList * const *a, NetworkGameList * const *b)
{
/* Sort by the area of the map. */
int r = ((*a)->info.map_height) * ((*a)->info.map_width) - ((*b)->info.map_height) * ((*b)->info.map_width);
@ -180,14 +180,14 @@ protected:
}
/** Sort servers by current date */
static int CDECL NGameDateSorter(NetworkGameList* const *a, NetworkGameList* const *b)
static int CDECL NGameDateSorter(NetworkGameList * const *a, NetworkGameList * const *b)
{
int r = (*a)->info.game_date - (*b)->info.game_date;
return (r != 0) ? r : NGameClientSorter(a, b);
}
/** Sort servers by the number of days the game is running */
static int CDECL NGameYearsSorter(NetworkGameList* const *a, NetworkGameList* const *b)
static int CDECL NGameYearsSorter(NetworkGameList * const *a, NetworkGameList * const *b)
{
int r = (*a)->info.game_date - (*a)->info.start_date - (*b)->info.game_date + (*b)->info.start_date;
return (r != 0) ? r : NGameDateSorter(a, b);
@ -195,7 +195,7 @@ protected:
/** Sort servers by joinability. If both servers are the
* same, prefer the non-passworded server first. */
static int CDECL NGameAllowedSorter(NetworkGameList* const *a, NetworkGameList* const *b)
static int CDECL NGameAllowedSorter(NetworkGameList * const *a, NetworkGameList * const *b)
{
/* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */
int r = StrEmpty((*a)->info.server_revision) - StrEmpty((*b)->info.server_revision);

View File

@ -122,7 +122,7 @@ extern uint16 _network_udp_broadcast;
extern uint8 _network_advertise_retries;
void NetworkTCPQueryServer(const char* host, unsigned short port);
void NetworkTCPQueryServer(const char *host, unsigned short port);
void NetworkAddServer(const char *b);
void NetworkRebuildHostList();

View File

@ -33,7 +33,7 @@
// This file handles all the server-commands
static void NetworkHandleCommandQueue(NetworkClientSocket* cs);
static void NetworkHandleCommandQueue(NetworkClientSocket *cs);
// **********
// Sending functions
@ -1205,7 +1205,7 @@ typedef void NetworkServerPacket(NetworkClientSocket *cs, Packet *p);
// packet it is matches against this array
// and that way the right function to handle that
// packet is found.
static NetworkServerPacket* const _network_server_packet[] = {
static NetworkServerPacket * const _network_server_packet[] = {
NULL, /*PACKET_SERVER_FULL,*/
NULL, /*PACKET_SERVER_BANNED,*/
RECEIVE_COMMAND(PACKET_CLIENT_JOIN),
@ -1420,7 +1420,7 @@ bool NetworkServer_ReadPackets(NetworkClientSocket *cs)
}
// Handle the local command-queue
static void NetworkHandleCommandQueue(NetworkClientSocket* cs)
static void NetworkHandleCommandQueue(NetworkClientSocket *cs)
{
CommandPacket *cp;
@ -1534,7 +1534,7 @@ void NetworkServerChangeOwner(Owner current_owner, Owner new_owner)
}
}
const char* GetClientIP(const NetworkClientInfo* ci)
const char *GetClientIP(const NetworkClientInfo *ci)
{
struct in_addr addr;
@ -1544,7 +1544,7 @@ const char* GetClientIP(const NetworkClientInfo* ci)
void NetworkServerShowStatusToConsole()
{
static const char* const stat_str[] = {
static const char * const stat_str[] = {
"inactive",
"authorizing",
"authorized",
@ -1559,7 +1559,7 @@ void NetworkServerShowStatusToConsole()
FOR_ALL_CLIENT_SOCKETS(cs) {
int lag = NetworkCalculateLag(cs);
const NetworkClientInfo *ci = cs->GetInfo();
const char* status;
const char *status;
status = (cs->status < (ptrdiff_t)lengthof(stat_str) ? stat_str[cs->status] : "unknown");
IConsolePrintF(CC_INFO, "Client #%1d name: '%s' status: '%s' frame-lag: %3d company: %1d IP: %s unique-id: '%s'",

View File

@ -425,7 +425,7 @@ void NetworkUDPSearchGame()
_network_udp_broadcast = 300; // Stay searching for 300 ticks
}
void NetworkUDPQueryServer(const char* host, unsigned short port, bool manually)
void NetworkUDPQueryServer(const char *host, unsigned short port, bool manually)
{
struct sockaddr_in out_addr;
NetworkGameList *item;

View File

@ -10,7 +10,7 @@
void NetworkUDPInitialize();
void NetworkUDPSearchGame();
void NetworkUDPQueryMasterServer();
void NetworkUDPQueryServer(const char* host, unsigned short port, bool manually = false);
void NetworkUDPQueryServer(const char *host, unsigned short port, bool manually = false);
void NetworkUDPAdvertise();
void NetworkUDPRemoveAdvertise();
void NetworkUDPShutdown();

View File

@ -2527,7 +2527,7 @@ static void ReserveChangeInfo(byte *buf, size_t len)
* @param value The value that was used to represent this callback result
* @return A spritegroup representing that callback result
*/
static const SpriteGroup* NewCallBackResultSpriteGroup(uint16 value)
static const SpriteGroup *NewCallBackResultSpriteGroup(uint16 value)
{
SpriteGroup *group = AllocateSpriteGroup();
@ -2552,7 +2552,7 @@ static const SpriteGroup* NewCallBackResultSpriteGroup(uint16 value)
* @param num_sprites The number of sprites per set.
* @return A spritegroup representing the sprite number result.
*/
static const SpriteGroup* NewResultSpriteGroup(SpriteID sprite, byte num_sprites)
static const SpriteGroup *NewResultSpriteGroup(SpriteID sprite, byte num_sprites)
{
SpriteGroup *group = AllocateSpriteGroup();
group->type = SGT_RESULT;
@ -2613,7 +2613,7 @@ static void SkipAct1(byte *buf, size_t len)
/* Helper function to either create a callback or link to a previously
* defined spritegroup. */
static const SpriteGroup* GetGroupFromGroupID(byte setid, byte type, uint16 groupid)
static const SpriteGroup *GetGroupFromGroupID(byte setid, byte type, uint16 groupid)
{
if (HasBit(groupid, 15)) return NewCallBackResultSpriteGroup(groupid);
@ -2626,7 +2626,7 @@ static const SpriteGroup* GetGroupFromGroupID(byte setid, byte type, uint16 grou
}
/* Helper function to either create a callback or a result sprite group. */
static const SpriteGroup* CreateGroupFromGroupID(byte feature, byte setid, byte type, uint16 spriteid, uint16 num_sprites)
static const SpriteGroup *CreateGroupFromGroupID(byte feature, byte setid, byte type, uint16 spriteid, uint16 num_sprites)
{
if (HasBit(spriteid, 15)) return NewCallBackResultSpriteGroup(spriteid);

View File

@ -481,7 +481,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
case 0x40: // Get length of consist
case 0x41: // Get length of same consecutive wagons
{
const Vehicle* u;
const Vehicle *u;
byte chain_before = 0;
byte chain_after = 0;
@ -904,7 +904,7 @@ SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_vie
* @param v The wagon to check
* @return true if it is using an override, false otherwise
*/
bool UsesWagonOverride(const Vehicle* v)
bool UsesWagonOverride(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
return v->u.rail.cached_override != NULL;

View File

@ -16,8 +16,8 @@ extern int _traininfo_vehicle_width;
void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, EngineID *train_id, uint trains);
const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, EngineID overriding_engine);
void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group);
SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle* v, bool info_view);
SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction direction);
SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_view);
#define GetCustomRotorSprite(v, i) GetRotorOverrideSprite(v->engine_type, v, i)
#define GetCustomRotorIcon(et) GetRotorOverrideSprite(et, NULL, true)

View File

@ -731,7 +731,7 @@ int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec)
* @param specindex Index of the custom station within the Station's spec list.
* @return Indicates whether the StationSpec was deallocated.
*/
void DeallocateSpecFromStation(Station* st, byte specindex)
void DeallocateSpecFromStation(Station *st, byte specindex)
{
/* specindex of 0 (default) is never freeable */
if (specindex == 0) return;
@ -844,7 +844,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
const StationSpec *GetStationSpec(TileIndex t)
{
const Station* st;
const Station *st;
uint specindex;
if (!IsCustomStationSpecIndex(t)) return NULL;
@ -859,7 +859,7 @@ const StationSpec *GetStationSpec(TileIndex t)
* XXX This could be cached (during build) in the map array to save on all the dereferencing */
bool IsStationTileBlocked(TileIndex tile)
{
const StationSpec* statspec = GetStationSpec(tile);
const StationSpec *statspec = GetStationSpec(tile);
return statspec != NULL && HasBit(statspec->blocked, GetStationGfx(tile));
}
@ -868,7 +868,7 @@ bool IsStationTileBlocked(TileIndex tile)
* XXX This could be cached (during build) in the map array to save on all the dereferencing */
bool IsStationTileElectrifiable(TileIndex tile)
{
const StationSpec* statspec = GetStationSpec(tile);
const StationSpec *statspec = GetStationSpec(tile);
return
statspec == NULL ||

View File

@ -134,7 +134,7 @@ uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, con
int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec);
/* Deallocate a StationSpec from a Station. Called when removing a single station tile. */
void DeallocateSpecFromStation(Station* st, byte specindex);
void DeallocateSpecFromStation(Station *st, byte specindex);
/* Draw representation of a station tile for GUI purposes. */
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station);

View File

@ -154,7 +154,7 @@ struct GRFText {
strcpy(text, text_);
}
void* operator new(size_t size, size_t extra)
void *operator new(size_t size, size_t extra)
{
return ::operator new(size + extra);
}

View File

@ -88,7 +88,7 @@ static uint NPFHash(uint key1, uint key2)
return ((part1 << NPF_HASH_HALFBITS | part2) + (NPF_HASH_SIZE * key2 / TRACKDIR_END)) % NPF_HASH_SIZE;
}
static int32 NPFCalcZero(AyStar* as, AyStarNode* current, OpenListNode* parent)
static int32 NPFCalcZero(AyStar *as, AyStarNode *current, OpenListNode *parent)
{
return 0;
}
@ -99,7 +99,7 @@ static int32 NPFCalcZero(AyStar* as, AyStarNode* current, OpenListNode* parent)
*/
static TileIndex CalcClosestStationTile(StationID station, TileIndex tile)
{
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;
@ -125,10 +125,10 @@ static TileIndex CalcClosestStationTile(StationID station, TileIndex tile)
/* Calcs the heuristic to the target station or tile. For train stations, it
* takes into account the direction of approach.
*/
static int32 NPFCalcStationOrTileHeuristic(AyStar* as, AyStarNode* current, OpenListNode* parent)
static int32 NPFCalcStationOrTileHeuristic(AyStar *as, AyStarNode *current, OpenListNode *parent)
{
NPFFindStationOrTileData* fstd = (NPFFindStationOrTileData*)as->user_target;
NPFFoundTargetData* ftd = (NPFFoundTargetData*)as->user_path;
NPFFindStationOrTileData *fstd = (NPFFindStationOrTileData*)as->user_target;
NPFFoundTargetData *ftd = (NPFFoundTargetData*)as->user_path;
TileIndex from = current->tile;
TileIndex to = fstd->dest_coords;
uint dist;
@ -158,7 +158,7 @@ static int32 NPFCalcStationOrTileHeuristic(AyStar* as, AyStarNode* current, Open
/* Fills AyStarNode.user_data[NPF_TRACKDIRCHOICE] with the chosen direction to
* get here, either getting it from the current choice or from the parent's
* choice */
static void NPFFillTrackdirChoice(AyStarNode* current, OpenListNode* parent)
static void NPFFillTrackdirChoice(AyStarNode *current, OpenListNode *parent)
{
if (parent->path.parent == NULL) {
Trackdir trackdir = current->direction;
@ -175,7 +175,7 @@ static void NPFFillTrackdirChoice(AyStarNode* current, OpenListNode* parent)
/* Will return the cost of the tunnel. If it is an entry, it will return the
* cost of that tile. If the tile is an exit, it will return the tunnel length
* including the exit tile. Requires that this is a Tunnel tile */
static uint NPFTunnelCost(AyStarNode* current)
static uint NPFTunnelCost(AyStarNode *current)
{
DiagDirection exitdir = TrackdirToExitdir(current->direction);
TileIndex tile = current->tile;
@ -196,7 +196,7 @@ static inline uint NPFBridgeCost(AyStarNode *current)
return NPF_TILE_LENGTH * GetTunnelBridgeLength(current->tile, GetOtherBridgeEnd(current->tile));
}
static uint NPFSlopeCost(AyStarNode* current)
static uint NPFSlopeCost(AyStarNode *current)
{
TileIndex next = current->tile + TileOffsByDiagDir(TrackdirToExitdir(current->direction));
@ -272,7 +272,7 @@ static void NPFMarkTile(TileIndex tile)
#endif
}
static int32 NPFWaterPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent)
static int32 NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
{
/* TileIndex tile = current->tile; */
int32 cost = 0;
@ -292,7 +292,7 @@ static int32 NPFWaterPathCost(AyStar* as, AyStarNode* current, OpenListNode* par
}
/* Determine the cost of this node, for road tracks */
static int32 NPFRoadPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent)
static int32 NPFRoadPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
{
TileIndex tile = current->tile;
int32 cost = 0;
@ -336,7 +336,7 @@ static int32 NPFRoadPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
/* Determine the cost of this node, for railway tracks */
static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent)
static int32 NPFRailPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent)
{
TileIndex tile = current->tile;
Trackdir trackdir = current->direction;
@ -451,7 +451,7 @@ static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
}
/* Will find any depot */
static int32 NPFFindDepot(AyStar* as, OpenListNode *current)
static int32 NPFFindDepot(AyStar *as, OpenListNode *current)
{
/* It's not worth caching the result with NPF_FLAG_IS_TARGET here as below,
* since checking the cache not that much faster than the actual check */
@ -471,9 +471,9 @@ static int32 NPFFindSafeTile(AyStar *as, OpenListNode *current)
}
/* Will find a station identified using the NPFFindStationOrTileData */
static int32 NPFFindStationOrTile(AyStar* as, OpenListNode *current)
static int32 NPFFindStationOrTile(AyStar *as, OpenListNode *current)
{
NPFFindStationOrTileData* fstd = (NPFFindStationOrTileData*)as->user_target;
NPFFindStationOrTileData *fstd = (NPFFindStationOrTileData*)as->user_target;
AyStarNode *node = &current->path.node;
TileIndex tile = node->tile;
@ -496,7 +496,7 @@ static int32 NPFFindStationOrTile(AyStar* as, OpenListNode *current)
* the second signal is returnd. If no suitable signal is present, the
* last node of the path is returned.
*/
static const PathNode* FindSafePosition(PathNode *path, const Vehicle *v)
static const PathNode *FindSafePosition(PathNode *path, const Vehicle *v)
{
/* If there is no signal, reserve the whole path. */
PathNode *sig = path;
@ -532,9 +532,9 @@ static void ClearPathReservation(const PathNode *start, const PathNode *end)
* AyStarNode[NPF_TRACKDIR_CHOICE]. If requested, path reservation
* is done here.
*/
static void NPFSaveTargetData(AyStar* as, OpenListNode* current)
static void NPFSaveTargetData(AyStar *as, OpenListNode *current)
{
NPFFoundTargetData* ftd = (NPFFoundTargetData*)as->user_path;
NPFFoundTargetData *ftd = (NPFFoundTargetData*)as->user_path;
ftd->best_trackdir = (Trackdir)current->path.node.user_data[NPF_TRACKDIR_CHOICE];
ftd->best_path_dist = current->g;
ftd->best_bird_dist = 0;
@ -769,7 +769,7 @@ static TrackdirBits GetDriveableTrackdirBits(TileIndex dst_tile, Trackdir src_tr
* entry and exit are neighbours. Will fill
* AyStarNode.user_data[NPF_TRACKDIR_CHOICE] with an appropriate value, and
* copy AyStarNode.user_data[NPF_NODE_FLAGS] from the parent */
static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
static void NPFFollowTrack(AyStar *aystar, OpenListNode *current)
{
/* We leave src_tile on track src_trackdir in direction src_exitdir */
Trackdir src_trackdir = current->path.node.direction;
@ -860,7 +860,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
}
{
/* We've found ourselves a neighbour :-) */
AyStarNode* neighbour = &aystar->neighbours[i];
AyStarNode *neighbour = &aystar->neighbours[i];
neighbour->tile = dst_tile;
neighbour->direction = dst_trackdir;
/* Save user data */
@ -882,7 +882,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
* multiple targets that are spread around, we should perform a breadth first
* search by specifiying CalcZero as our heuristic.
*/
static NPFFoundTargetData NPFRouteInternal(AyStarNode* start1, bool ignore_start_tile1, AyStarNode* start2, bool ignore_start_tile2, NPFFindStationOrTileData* target, AyStar_EndNodeCheck target_proc, AyStar_CalculateH heuristic_proc, TransportType type, uint sub_type, Owner owner, RailTypes railtypes, uint reverse_penalty)
static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start_tile1, AyStarNode *start2, bool ignore_start_tile2, NPFFindStationOrTileData *target, AyStar_EndNodeCheck target_proc, AyStar_CalculateH heuristic_proc, TransportType type, uint sub_type, Owner owner, RailTypes railtypes, uint reverse_penalty)
{
int r;
NPFFoundTargetData result;
@ -945,7 +945,7 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode* start1, bool ignore_start
return result;
}
NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir trackdir1, bool ignore_start_tile1, TileIndex tile2, Trackdir trackdir2, bool ignore_start_tile2, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes)
NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir trackdir1, bool ignore_start_tile1, TileIndex tile2, Trackdir trackdir2, bool ignore_start_tile2, NPFFindStationOrTileData *target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes)
{
AyStarNode start1;
AyStarNode start2;
@ -962,7 +962,7 @@ NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir track
return NPFRouteInternal(&start1, ignore_start_tile1, (IsValidTile(tile2) ? &start2 : NULL), ignore_start_tile2, target, NPFFindStationOrTile, NPFCalcStationOrTileHeuristic, type, sub_type, owner, railtypes, 0);
}
NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes)
NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData *target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes)
{
return NPFRouteToStationOrTileTwoWay(tile, trackdir, ignore_start_tile, INVALID_TILE, INVALID_TRACKDIR, false, target, type, sub_type, owner, railtypes);
}
@ -1007,7 +1007,7 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir,
NPFFoundTargetData result;
NPFFindStationOrTileData target;
AyStarNode start;
Depot* current;
Depot *current;
Depot *depot;
init_InsSort(&depots);

View File

@ -46,7 +46,7 @@ struct NPFFindStationOrTileData {
TileIndex dest_coords; ///< An indication of where the station is, for heuristic purposes, or the target tile
StationID station_index; ///< station index we're heading for, or INVALID_STATION when we're heading for a tile
bool reserve_path; ///< Indicates whether the found path should be reserved
const Vehicle* v; ///< The vehicle we are pathfinding for
const Vehicle *v; ///< The vehicle we are pathfinding for
};
/* Indices into AyStar.userdata[] */
@ -89,12 +89,12 @@ struct NPFFoundTargetData {
/* Will search from the given tile and direction, for a route to the given
* station for the given transport type. See the declaration of
* NPFFoundTargetData above for the meaning of the result. */
NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData *target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
/* Will search as above, but with two start nodes, the second being the
* reverse. Look at the NPF_FLAG_REVERSE flag in the result node to see which
* direction was taken (NPFGetBit(result.node, NPF_FLAG_REVERSE)) */
NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir trackdir1, bool ignore_start_tile1, TileIndex tile2, Trackdir trackdir2, bool ignore_start_tile2, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir trackdir1, bool ignore_start_tile1, TileIndex tile2, Trackdir trackdir2, bool ignore_start_tile2, NPFFindStationOrTileData *target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
/* Will search a route to the closest depot. */
@ -128,7 +128,7 @@ void NPFFillWithOrderData(NPFFindStationOrTileData *fstd, Vehicle *v, bool reser
/**
* Returns the current value of the given flag on the given AyStarNode.
*/
static inline bool NPFGetFlag(const AyStarNode* node, NPFNodeFlag flag)
static inline bool NPFGetFlag(const AyStarNode *node, NPFNodeFlag flag)
{
return HasBit(node->user_data[NPF_NODE_FLAGS], flag);
}
@ -136,7 +136,7 @@ static inline bool NPFGetFlag(const AyStarNode* node, NPFNodeFlag flag)
/**
* Sets the given flag on the given AyStarNode to the given value.
*/
static inline void NPFSetFlag(AyStarNode* node, NPFNodeFlag flag, bool value)
static inline void NPFSetFlag(AyStarNode *node, NPFNodeFlag flag, bool value)
{
if (value)
SetBit(node->user_data[NPF_NODE_FLAGS], flag);

View File

@ -29,7 +29,7 @@ protected:
new_block_proc(new_block_proc), clean_block_proc(clean_block_proc), current_blocks(0),
total_items(0), cleaning_pool(false), item_size(item_size), first_free_index(0), blocks(NULL) {}
const char* name; ///< Name of the pool (just for debugging)
const char *name; ///< Name of the pool (just for debugging)
const uint max_blocks; ///< The max amount of blocks this pool can have
const uint block_size_bits; ///< The size of each block in bits
@ -326,7 +326,7 @@ public:
#define OLD_POOL_ACCESSORS(name, type) \
static inline type* Get##name(uint index) { return _##name##_pool.Get(index); } \
static inline type *Get##name(uint index) { return _##name##_pool.Get(index); } \
static inline uint Get##name##PoolSize() { return _##name##_pool.GetSize(); }

View File

@ -361,7 +361,7 @@ void OrderList::DebugCheckSanity() const
* another order gets added), but assume the company will notice the problems,
* when (s)he's changing the orders.
*/
static void DeleteOrderWarnings(const Vehicle* v)
static void DeleteOrderWarnings(const Vehicle *v)
{
DeleteVehicleNews(v->index, STR_VEHICLE_HAS_TOO_FEW_ORDERS);
DeleteVehicleNews(v->index, STR_VEHICLE_HAS_VOID_ORDER);
@ -1374,7 +1374,7 @@ CommandCost CmdRestoreOrderIndex(TileIndex tile, uint32 flags, uint32 p1, uint32
}
static TileIndex GetStationTileForVehicle(const Vehicle* v, const Station* st)
static TileIndex GetStationTileForVehicle(const Vehicle *v, const Station *st)
{
switch (v->type) {
default: NOT_REACHED();
@ -1396,7 +1396,7 @@ static TileIndex GetStationTileForVehicle(const Vehicle* v, const Station* st)
* Check the orders of a vehicle, to see if there are invalid orders and stuff
*
*/
void CheckOrders(const Vehicle* v)
void CheckOrders(const Vehicle *v)
{
/* Does the user wants us to check things? */
if (_settings_client.gui.order_review_system == 0) return;
@ -1428,7 +1428,7 @@ void CheckOrders(const Vehicle* v)
}
/* Does station have a load-bay for this vehicle? */
if (order->IsType(OT_GOTO_STATION)) {
const Station* st = GetStation(order->GetDestination());
const Station *st = GetStation(order->GetDestination());
TileIndex required_tile = GetStationTileForVehicle(v, st);
n_st++;
@ -1438,7 +1438,7 @@ void CheckOrders(const Vehicle* v)
/* Check if the last and the first order are the same */
if (v->GetNumOrders() > 1) {
const Order* last = GetLastVehicleOrder(v);
const Order *last = GetLastVehicleOrder(v);
if (v->orders.list->GetFirstOrder()->Equals(*last)) {
problem_type = 2;

View File

@ -30,7 +30,7 @@ void ToggleFullScreen(bool fs);
static char *GetOSString()
{
static char buffer[175];
const char* CPU;
const char *CPU;
char OS[20];
char newgrf[125];
long sysVersion;
@ -75,8 +75,8 @@ static char *GetOSString()
// make a list of used newgrf files
/* if (_first_grffile != NULL) {
char* n = newgrf;
const GRFFile* file;
char *n = newgrf;
const GRFFile *file;
for (file = _first_grffile; file != NULL; file = file->next) {
n = strecpy(n, " ", lastof(newgrf));
@ -99,16 +99,16 @@ static char *GetOSString()
#ifdef WITH_SDL
void ShowMacDialog(const char* title, const char* message, const char* buttonLabel)
void ShowMacDialog(const char *title, const char *message, const char *buttonLabel)
{
NSRunAlertPanel([NSString stringWithCString: title], [NSString stringWithCString: message], [NSString stringWithCString: buttonLabel], nil, nil);
}
#elif defined WITH_COCOA
void CocoaDialog(const char* title, const char* message, const char* buttonLabel);
void CocoaDialog(const char *title, const char *message, const char *buttonLabel);
void ShowMacDialog(const char* title, const char* message, const char* buttonLabel)
void ShowMacDialog(const char *title, const char *message, const char *buttonLabel)
{
CocoaDialog(title, message, buttonLabel);
}
@ -116,16 +116,16 @@ void ShowMacDialog(const char* title, const char* message, const char* buttonLab
#else
void ShowMacDialog(const char* title, const char* message, const char* buttonLabel)
void ShowMacDialog(const char *title, const char *message, const char *buttonLabel)
{
fprintf(stderr, "%s: %s\n", title, message);
}
#endif
void ShowMacAssertDialog(const char* function, const char* file, const int line, const char* expression)
void ShowMacAssertDialog(const char *function, const char *file, const int line, const char *expression)
{
const char* buffer =
const char *buffer =
[[NSString stringWithFormat:@
"An assertion has failed and OpenTTD must quit.\n"
"%s in %s (line %d)\n"
@ -147,7 +147,7 @@ void ShowMacAssertDialog(const char* function, const char* file, const int line,
void ShowMacErrorDialog(const char *error)
{
const char* buffer =
const char *buffer =
[[NSString stringWithFormat:@
"Please update to the newest version of OpenTTD\n"
"If the problem presists, please report this to\n"
@ -166,9 +166,9 @@ void ShowMacErrorDialog(const char *error)
const char *GetCurrentLocale(const char *)
{
static char retbuf[32] = { '\0' };
NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
NSArray* languages = [defs objectForKey:@"AppleLanguages"];
NSString* preferredLang = [languages objectAtIndex:0];
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defs objectForKey:@"AppleLanguages"];
NSString *preferredLang = [languages objectAtIndex:0];
/* preferredLang is either 2 or 5 characters long ("xx" or "xx_YY"). */
/* Since Apple introduced encoding to CString in OSX 10.4 we have to make a few conditions

View File

@ -162,7 +162,7 @@ void ShowOSErrorBox(const char *buf, bool system)
WinTerminate(hab);
}
int CDECL main(int argc, char* argv[])
int CDECL main(int argc, char *argv[])
{
SetRandomSeed(time(NULL));
@ -184,13 +184,13 @@ bool InsertTextBufferClipboard(Textbuf *tb)
if (WinOpenClipbrd(hab))
{
const char* text = (const char*)WinQueryClipbrdData(hab, CF_TEXT);
const char *text = (const char*)WinQueryClipbrdData(hab, CF_TEXT);
if (text != NULL)
{
uint length = 0;
uint width = 0;
const char* i;
const char *i;
for (i = text; IsValidAsciiChar(*i); i++)
{

View File

@ -110,7 +110,7 @@ static bool TPFSetTileBit(TrackPathFinder *tpf, TileIndex tile, int dir)
return true;
}
static void TPFModeShip(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
static void TPFModeShip(TrackPathFinder *tpf, TileIndex tile, DiagDirection direction)
{
assert(tpf->tracktype == TRANSPORT_WATER);
@ -198,7 +198,7 @@ static inline bool CanAccessTileInDir(TileIndex tile, DiagDirection side, Transp
return true;
}
static void TPFModeNormal(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
static void TPFModeNormal(TrackPathFinder *tpf, TileIndex tile, DiagDirection direction)
{
const TileIndex tile_org = tile;
@ -396,7 +396,7 @@ static inline void HeapifyDown(NewTrackPathFinder *tpf)
/** mark a tile as visited and store the length of the path.
* if we already had a better path to this tile, return false.
* otherwise return true. */
static bool NtpVisit(NewTrackPathFinder* tpf, TileIndex tile, DiagDirection dir, uint length)
static bool NtpVisit(NewTrackPathFinder *tpf, TileIndex tile, DiagDirection dir, uint length)
{
uint hash,head;
HashLink *link, *new_link;
@ -538,7 +538,7 @@ static const byte _length_of_track[16] = {
* Tile is the tile the train is at.
* direction is the tile the train is moving towards. */
static void NTPEnum(NewTrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
static void NTPEnum(NewTrackPathFinder *tpf, TileIndex tile, DiagDirection direction)
{
TrackBits bits, allbits;
Trackdir track;
@ -788,7 +788,7 @@ start_at:
/** new pathfinder for trains. better and faster. */
void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypes railtypes, DiagDirection direction, NTPEnumProc* enum_proc, void* data)
void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypes railtypes, DiagDirection direction, NTPEnumProc *enum_proc, void *data)
{
SmallStackSafeStackAlloc<NewTrackPathFinder, 1> tpf;

View File

@ -74,7 +74,7 @@ enum PathfindFlags {
};
DECLARE_ENUM_AS_BIT_SET(PathfindFlags)
void FollowTrack(TileIndex tile, PathfindFlags flags, TransportType tt, uint sub_type, DiagDirection direction, TPFEnumProc* enum_proc, TPFAfterProc* after_proc, void* data);
void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypes railtypes, DiagDirection direction, NTPEnumProc* enum_proc, void* data);
void FollowTrack(TileIndex tile, PathfindFlags flags, TransportType tt, uint sub_type, DiagDirection direction, TPFEnumProc *enum_proc, TPFAfterProc *after_proc, void *data);
void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypes railtypes, DiagDirection direction, NTPEnumProc *enum_proc, void *data);
#endif /* PATHFIND_H */

View File

@ -12,10 +12,10 @@
* Insertion Sorter
*/
static void InsSort_Clear(Queue* q, bool free_values)
static void InsSort_Clear(Queue *q, bool free_values)
{
InsSortNode* node = q->data.inssort.first;
InsSortNode* prev;
InsSortNode *node = q->data.inssort.first;
InsSortNode *prev;
while (node != NULL) {
if (free_values) free(node->item);
@ -26,14 +26,14 @@ static void InsSort_Clear(Queue* q, bool free_values)
q->data.inssort.first = NULL;
}
static void InsSort_Free(Queue* q, bool free_values)
static void InsSort_Free(Queue *q, bool free_values)
{
q->clear(q, free_values);
}
static bool InsSort_Push(Queue* q, void* item, int priority)
static bool InsSort_Push(Queue *q, void *item, int priority)
{
InsSortNode* newnode = MallocT<InsSortNode>(1);
InsSortNode *newnode = MallocT<InsSortNode>(1);
if (newnode == NULL) return false;
newnode->item = item;
@ -43,7 +43,7 @@ static bool InsSort_Push(Queue* q, void* item, int priority)
newnode->next = q->data.inssort.first;
q->data.inssort.first = newnode;
} else {
InsSortNode* node = q->data.inssort.first;
InsSortNode *node = q->data.inssort.first;
while (node != NULL) {
if (node->next == NULL || node->next->priority >= priority) {
newnode->next = node->next;
@ -56,10 +56,10 @@ static bool InsSort_Push(Queue* q, void* item, int priority)
return true;
}
static void* InsSort_Pop(Queue* q)
static void *InsSort_Pop(Queue *q)
{
InsSortNode* node = q->data.inssort.first;
void* result;
InsSortNode *node = q->data.inssort.first;
void *result;
if (node == NULL) return NULL;
result = node->item;
@ -69,12 +69,12 @@ static void* InsSort_Pop(Queue* q)
return result;
}
static bool InsSort_Delete(Queue* q, void* item, int priority)
static bool InsSort_Delete(Queue *q, void *item, int priority)
{
return false;
}
void init_InsSort(Queue* q)
void init_InsSort(Queue *q)
{
q->push = InsSort_Push;
q->pop = InsSort_Pop;
@ -99,7 +99,7 @@ void init_InsSort(Queue* q)
* q->data.binaryheap.elements[i - 1] every time, we use this define. */
#define BIN_HEAP_ARR(i) q->data.binaryheap.elements[((i) - 1) >> BINARY_HEAP_BLOCKSIZE_BITS][((i) - 1) & BINARY_HEAP_BLOCKSIZE_MASK]
static void BinaryHeap_Clear(Queue* q, bool free_values)
static void BinaryHeap_Clear(Queue *q, bool free_values)
{
/* Free all items if needed and free all but the first blocks of memory */
uint i;
@ -131,7 +131,7 @@ static void BinaryHeap_Clear(Queue* q, bool free_values)
q->data.binaryheap.blocks = 1;
}
static void BinaryHeap_Free(Queue* q, bool free_values)
static void BinaryHeap_Free(Queue *q, bool free_values)
{
uint i;
@ -143,7 +143,7 @@ static void BinaryHeap_Free(Queue* q, bool free_values)
free(q->data.binaryheap.elements);
}
static bool BinaryHeap_Push(Queue* q, void* item, int priority)
static bool BinaryHeap_Push(Queue *q, void *item, int priority)
{
#ifdef QUEUE_DEBUG
printf("[BinaryHeap] Pushing an element. There are %d elements left\n", q->data.binaryheap.size);
@ -194,7 +194,7 @@ static bool BinaryHeap_Push(Queue* q, void* item, int priority)
return true;
}
static bool BinaryHeap_Delete(Queue* q, void* item, int priority)
static bool BinaryHeap_Delete(Queue *q, void *item, int priority)
{
uint i = 0;
@ -253,9 +253,9 @@ static bool BinaryHeap_Delete(Queue* q, void* item, int priority)
return true;
}
static void* BinaryHeap_Pop(Queue* q)
static void *BinaryHeap_Pop(Queue *q)
{
void* result;
void *result;
#ifdef QUEUE_DEBUG
printf("[BinaryHeap] Popping an element. There are %d elements left\n", q->data.binaryheap.size);
@ -271,7 +271,7 @@ static void* BinaryHeap_Pop(Queue* q)
return result;
}
void init_BinaryHeap(Queue* q, uint max_size)
void init_BinaryHeap(Queue *q, uint max_size)
{
assert(q != NULL);
q->push = BinaryHeap_Push;
@ -298,7 +298,7 @@ void init_BinaryHeap(Queue* q, uint max_size)
* Hash
*/
void init_Hash(Hash* h, Hash_HashProc* hash, uint num_buckets)
void init_Hash(Hash *h, Hash_HashProc *hash, uint num_buckets)
{
/* Allocate space for the Hash, the buckets and the bucket flags */
uint i;
@ -319,20 +319,20 @@ void init_Hash(Hash* h, Hash_HashProc* hash, uint num_buckets)
}
void delete_Hash(Hash* h, bool free_values)
void delete_Hash(Hash *h, bool free_values)
{
uint i;
/* Iterate all buckets */
for (i = 0; i < h->num_buckets; i++) {
if (h->buckets_in_use[i]) {
HashNode* node;
HashNode *node;
/* Free the first value */
if (free_values) free(h->buckets[i].value);
node = h->buckets[i].next;
while (node != NULL) {
HashNode* prev = node;
HashNode *prev = node;
node = node->next;
/* Free the value */
@ -351,7 +351,7 @@ void delete_Hash(Hash* h, bool free_values)
}
#ifdef HASH_STATS
static void stat_Hash(const Hash* h)
static void stat_Hash(const Hash *h)
{
uint used_buckets = 0;
uint max_collision = 0;
@ -363,7 +363,7 @@ static void stat_Hash(const Hash* h)
for (i = 0; i < h->num_buckets; i++) {
uint collision = 0;
if (h->buckets_in_use[i]) {
const HashNode* node;
const HashNode *node;
used_buckets++;
for (node = &h->buckets[i]; node != NULL; node = node->next) collision++;
@ -401,7 +401,7 @@ static void stat_Hash(const Hash* h)
}
#endif
void clear_Hash(Hash* h, bool free_values)
void clear_Hash(Hash *h, bool free_values)
{
uint i;
@ -412,14 +412,14 @@ void clear_Hash(Hash* h, bool free_values)
/* Iterate all buckets */
for (i = 0; i < h->num_buckets; i++) {
if (h->buckets_in_use[i]) {
HashNode* node;
HashNode *node;
h->buckets_in_use[i] = false;
/* Free the first value */
if (free_values) free(h->buckets[i].value);
node = h->buckets[i].next;
while (node != NULL) {
HashNode* prev = node;
HashNode *prev = node;
node = node->next;
if (free_values) free(prev->value);
@ -437,10 +437,10 @@ void clear_Hash(Hash* h, bool free_values)
* bucket, or NULL if it is empty. prev can also be NULL, in which case it is
* not used for output.
*/
static HashNode* Hash_FindNode(const Hash* h, uint key1, uint key2, HashNode** prev_out)
static HashNode *Hash_FindNode(const Hash *h, uint key1, uint key2, HashNode** prev_out)
{
uint hash = h->hash(key1, key2);
HashNode* result = NULL;
HashNode *result = NULL;
#ifdef HASH_DEBUG
debug("Looking for %u, %u", key1, key2);
@ -459,8 +459,8 @@ static HashNode* Hash_FindNode(const Hash* h, uint key1, uint key2, HashNode** p
#endif
/* Check all other nodes */
} else {
HashNode* prev = h->buckets + hash;
HashNode* node;
HashNode *prev = h->buckets + hash;
HashNode *node;
for (node = prev->next; node != NULL; node = node->next) {
if (node->key1 == key1 && node->key2 == key2) {
@ -481,11 +481,11 @@ static HashNode* Hash_FindNode(const Hash* h, uint key1, uint key2, HashNode** p
return result;
}
void* Hash_Delete(Hash* h, uint key1, uint key2)
void *Hash_Delete(Hash *h, uint key1, uint key2)
{
void* result;
HashNode* prev; // Used as output var for below function call
HashNode* node = Hash_FindNode(h, key1, key2, &prev);
void *result;
HashNode *prev; // Used as output var for below function call
HashNode *node = Hash_FindNode(h, key1, key2, &prev);
if (node == NULL) {
/* not found */
@ -496,7 +496,7 @@ void* Hash_Delete(Hash* h, uint key1, uint key2)
/* Save the value */
result = node->value;
if (node->next != NULL) {
HashNode* next = node->next;
HashNode *next = node->next;
/* Copy the second to the first */
*node = *next;
/* Free the second */
@ -525,14 +525,14 @@ void* Hash_Delete(Hash* h, uint key1, uint key2)
}
void* Hash_Set(Hash* h, uint key1, uint key2, void* value)
void *Hash_Set(Hash *h, uint key1, uint key2, void *value)
{
HashNode* prev;
HashNode* node = Hash_FindNode(h, key1, key2, &prev);
HashNode *prev;
HashNode *node = Hash_FindNode(h, key1, key2, &prev);
if (node != NULL) {
/* Found it */
void* result = node->value;
void *result = node->value;
node->value = value;
return result;
@ -556,9 +556,9 @@ void* Hash_Set(Hash* h, uint key1, uint key2, void* value)
return NULL;
}
void* Hash_Get(const Hash* h, uint key1, uint key2)
void *Hash_Get(const Hash *h, uint key1, uint key2)
{
HashNode* node = Hash_FindNode(h, key1, key2, NULL);
HashNode *node = Hash_FindNode(h, key1, key2, NULL);
#ifdef HASH_DEBUG
debug("Found node: %p", node);
@ -566,7 +566,7 @@ void* Hash_Get(const Hash* h, uint key1, uint key2)
return (node != NULL) ? node->value : NULL;
}
uint Hash_Size(const Hash* h)
uint Hash_Size(const Hash *h)
{
return h->size;
}

View File

@ -13,15 +13,15 @@
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_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;
int priority;
InsSortNode* next;
InsSortNode *next;
};
struct BinaryHeapNode {

View File

@ -1664,7 +1664,7 @@ static void DrawTrackFence_WE_2(const TileInfo *ti)
}
static void DrawTrackDetails(const TileInfo* ti)
static void DrawTrackDetails(const TileInfo *ti)
{
switch (GetRailGroundType(ti->tile)) {
case RAIL_GROUND_FENCE_NW: DrawTrackFence_NW(ti); break;
@ -1705,7 +1705,7 @@ static void DrawTrackDetails(const TileInfo* ti)
* @param ti TileInfo
* @param track TrackBits to draw
*/
static void DrawTrackBits(TileInfo* ti, TrackBits track)
static void DrawTrackBits(TileInfo *ti, TrackBits track)
{
/* SubSprite for drawing the track halftile of 'three-corners-raised'-sloped rail sprites. */
static const int INF = 1000; // big number compared to tilesprite size
@ -1918,8 +1918,8 @@ static void DrawTile_Track(TileInfo *ti)
if (HasSignals(ti->tile)) DrawSignals(ti->tile, rails);
} else {
/* draw depot/waypoint */
const DrawTileSprites* dts;
const DrawTileSeqStruct* dtss;
const DrawTileSprites *dts;
const DrawTileSeqStruct *dtss;
uint32 relocation;
SpriteID pal = PAL_NONE;
@ -1954,7 +1954,7 @@ static void DrawTile_Track(TileInfo *ti)
if (statspec != NULL) {
/* emulate station tile - open with building */
const Station* st = ComposeWaypointStation(ti->tile);
const Station *st = ComposeWaypointStation(ti->tile);
uint gfx = 2;
if (HasBit(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
@ -2039,7 +2039,7 @@ default_waypoint:
}
static void DrawTileSequence(int x, int y, SpriteID ground, const DrawTileSeqStruct* dtss, uint32 offset)
static void DrawTileSequence(int x, int y, SpriteID ground, const DrawTileSeqStruct *dtss, uint32 offset)
{
SpriteID palette = COMPANY_SPRITE_COLOR(_local_company);
@ -2054,7 +2054,7 @@ static void DrawTileSequence(int x, int y, SpriteID ground, const DrawTileSeqStr
void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
{
const DrawTileSprites* dts = &_depot_gfx_table[dir];
const DrawTileSprites *dts = &_depot_gfx_table[dir];
SpriteID image = dts->ground.sprite;
uint32 offset = GetRailTypeInfo(railtype)->total_offset;
@ -2065,7 +2065,7 @@ void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
void DrawDefaultWaypointSprite(int x, int y, RailType railtype)
{
uint32 offset = GetRailTypeInfo(railtype)->total_offset;
const DrawTileSprites* dts = &_waypoint_gfx_table[AXIS_X];
const DrawTileSprites *dts = &_waypoint_gfx_table[AXIS_X];
DrawTileSequence(x, y, dts->ground.sprite + offset, dts->seq, 0);
}

View File

@ -50,7 +50,7 @@
*/
bool RoadVehiclesAreBuilt()
{
const Vehicle* v;
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_ROAD) return true;
@ -1394,7 +1394,7 @@ static void TileLoop_Road(TileIndex tile)
{
/* Adjust road ground type depending on 'grp' (grp is the distance to the center) */
const Roadside* new_rs = (_settings_game.game_creation.landscape == LT_TOYLAND) ? _town_road_types_2[grp] : _town_road_types[grp];
const Roadside *new_rs = (_settings_game.game_creation.landscape == LT_TOYLAND) ? _town_road_types_2[grp] : _town_road_types[grp];
Roadside cur_rs = GetRoadside(tile);
/* We have our desired type, do nothing */

View File

@ -374,7 +374,7 @@ static void BuildRoadClick_Remove(Window *w)
}
/** Array with the handlers of the button-clicks for the road-toolbar */
static OnButtonClick* const _build_road_button_proc[] = {
static OnButtonClick * const _build_road_button_proc[] = {
BuildRoadClick_X_Dir,
BuildRoadClick_Y_Dir,
BuildRoadClick_AutoRoad,

View File

@ -366,9 +366,9 @@ static const DiagDirection _road_pf_directions[] = {
DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE, INVALID_DIAGDIR, INVALID_DIAGDIR
};
static bool EnumRoadSignalFindDepot(TileIndex tile, void* data, Trackdir trackdir, uint length)
static bool EnumRoadSignalFindDepot(TileIndex tile, void *data, Trackdir trackdir, uint length)
{
RoadFindDepotData* rfdd = (RoadFindDepotData*)data;
RoadFindDepotData *rfdd = (RoadFindDepotData*)data;
tile += TileOffsByDiagDir(_road_pf_directions[trackdir]);
@ -381,7 +381,7 @@ static bool EnumRoadSignalFindDepot(TileIndex tile, void* data, Trackdir trackdi
return false;
}
static const Depot* FindClosestRoadDepot(const Vehicle* v)
static const Depot *FindClosestRoadDepot(const Vehicle *v)
{
switch (_settings_game.pf.pathfinder_for_roadvehs) {
case VPF_YAPF: /* YAPF */
@ -707,7 +707,7 @@ TileIndex RoadVehicle::GetOrderStationLocation(StationID station)
}
}
static void StartRoadVehSound(const Vehicle* v)
static void StartRoadVehSound(const Vehicle *v)
{
if (!PlayVehicleSound(v, VSE_START)) {
SoundFx s = RoadVehInfo(v->engine_type)->sfx;
@ -790,7 +790,7 @@ static Vehicle *RoadVehFindCloseTo(Vehicle *v, int x, int y, Direction dir)
return rvf.best;
}
static void RoadVehArrivesAt(const Vehicle* v, Station* st)
static void RoadVehArrivesAt(const Vehicle *v, Station *st)
{
if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) {
/* Check if station was ever visited before */
@ -854,7 +854,7 @@ static int RoadVehAccelerate(Vehicle *v)
return scaled_spd;
}
static Direction RoadVehGetNewDirection(const Vehicle* v, int x, int y)
static Direction RoadVehGetNewDirection(const Vehicle *v, int x, int y)
{
static const Direction _roadveh_new_dir[] = {
DIR_N , DIR_NW, DIR_W , INVALID_DIR,
@ -869,7 +869,7 @@ static Direction RoadVehGetNewDirection(const Vehicle* v, int x, int y)
return _roadveh_new_dir[y * 4 + x];
}
static Direction RoadVehGetSlidingDirection(const Vehicle* v, int x, int y)
static Direction RoadVehGetSlidingDirection(const Vehicle *v, int x, int y)
{
Direction new_dir = RoadVehGetNewDirection(v, x, y);
Direction old_dir = v->direction;
@ -881,15 +881,15 @@ static Direction RoadVehGetSlidingDirection(const Vehicle* v, int x, int y)
}
struct OvertakeData {
const Vehicle* u;
const Vehicle* v;
const Vehicle *u;
const Vehicle *v;
TileIndex tile;
Trackdir trackdir;
};
static Vehicle *EnumFindVehBlockingOvertake(Vehicle *v, void* data)
static Vehicle *EnumFindVehBlockingOvertake(Vehicle *v, void *data)
{
const OvertakeData* od = (OvertakeData*)data;
const OvertakeData *od = (OvertakeData*)data;
return
v->type == VEH_ROAD && v->First() == v && v != od->u && v != od->v ?
@ -995,9 +995,9 @@ struct FindRoadToChooseData {
uint mindist;
};
static bool EnumRoadTrackFindDist(TileIndex tile, void* data, Trackdir trackdir, uint length)
static bool EnumRoadTrackFindDist(TileIndex tile, void *data, Trackdir trackdir, uint length)
{
FindRoadToChooseData* frd = (FindRoadToChooseData*)data;
FindRoadToChooseData *frd = (FindRoadToChooseData*)data;
uint dist = DistanceManhattan(tile, frd->dest);
if (dist <= frd->mindist) {
@ -1009,10 +1009,10 @@ static bool EnumRoadTrackFindDist(TileIndex tile, void* data, Trackdir trackdir,
return false;
}
static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes)
static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData *target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes)
{
void* perf = NpfBeginInterval();
void *perf = NpfBeginInterval();
NPFFoundTargetData ret = NPFRouteToStationOrTile(tile, trackdir, ignore_start_tile, target, type, sub_type, owner, railtypes);
int t = NpfEndInterval(perf);
DEBUG(yapf, 4, "[NPFR] %d us - %d rounds - %d open - %d closed -- ", t, 0, _aystar_stats_open_size, _aystar_stats_closed_size);
@ -1027,7 +1027,7 @@ static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Tra
* @param enterdir the direction the vehicle enters the tile from
* @return the Trackdir to take
*/
static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection enterdir)
static Trackdir RoadFindPathToDest(Vehicle *v, TileIndex tile, DiagDirection enterdir)
{
#define return_track(x) { best_track = (Trackdir)x; goto found_best_track; }
@ -1662,7 +1662,7 @@ again:
if (IsRoadVehFront(v) && !IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
/* Vehicle is not in a road stop.
* Check for another vehicle to overtake */
Vehicle* u = RoadVehFindCloseTo(v, x, y, new_dir);
Vehicle *u = RoadVehFindCloseTo(v, x, y, new_dir);
if (u != NULL) {
u = u->First();

View File

@ -730,7 +730,7 @@ bool AfterLoadGame()
}
if (CheckSavegameVersion(42)) {
Vehicle* v;
Vehicle *v;
for (TileIndex t = 0; t < map_size; t++) {
if (MayHaveBridgeAbove(t)) ClearBridgeMiddle(t);

View File

@ -331,7 +331,7 @@ static StringID *_old_vehicle_names = NULL;
static void FixOldVehicles()
{
Vehicle* v;
Vehicle *v;
FOR_ALL_VEHICLES(v) {
v->name = CopyFromOldName(_old_vehicle_names[v->index]);

View File

@ -68,7 +68,7 @@ static struct {
WriterProc *write_bytes; ///< savegame writer function
ReaderProc *read_bytes; ///< savegame loader function
const ChunkHandler* const *chs; ///< the chunk of data that is being processed atm (vehicles, signs, etc.)
const ChunkHandler * const *chs; ///< the chunk of data that is being processed atm (vehicles, signs, etc.)
/* When saving/loading savegames, they are always saved to a temporary memory-place
* to be flushed to file (save) or to final place (load) when full. */
@ -696,8 +696,8 @@ void SlArray(void *array, size_t length, VarType conv)
}
static uint ReferenceToInt(const void* obj, SLRefType rt);
static void* IntToReference(uint index, SLRefType rt);
static uint ReferenceToInt(const void *obj, SLRefType rt);
static void *IntToReference(uint index, SLRefType rt);
/**
@ -1014,7 +1014,7 @@ static void SlSaveChunk(const ChunkHandler *ch)
static void SlSaveChunks()
{
const ChunkHandler *ch;
const ChunkHandler* const *chsc;
const ChunkHandler * const *chsc;
uint p;
for (p = 0; p != CH_NUM_PRI_LEVELS; p++) {

View File

@ -99,7 +99,7 @@ static void SdlAbort(int sig)
#endif
const char* SdlOpen(uint32 x)
const char *SdlOpen(uint32 x)
{
#ifdef DYNAMICALLY_LOADED_SDL
{

View File

@ -5,7 +5,7 @@
#ifndef SDL_H
#define SDL_H
const char* SdlOpen(uint32 x);
const char *SdlOpen(uint32 x);
void SdlClose(uint32 x);
#ifdef WIN32

View File

@ -844,7 +844,7 @@ static int32 Ai_In_Multiplayer_Warning(int32 p1)
static int32 PopulationInLabelActive(int32 p1)
{
Town* t;
Town *t;
FOR_ALL_TOWNS(t) UpdateTownVirtCoord(t);

View File

@ -104,7 +104,7 @@ SpriteID Ship::GetImage(Direction direction) const
return _ship_sprites[spritenum] + direction;
}
static const Depot* FindClosestShipDepot(const Vehicle* v)
static const Depot *FindClosestShipDepot(const Vehicle *v)
{
if (_settings_game.pf.pathfinder_for_ships == VPF_NPF) { /* NPF is used */
Trackdir trackdir = GetVehicleTrackdir(v);
@ -117,8 +117,8 @@ static const Depot* FindClosestShipDepot(const Vehicle* v)
/* OPF or YAPF - find the closest depot */
const Depot* depot;
const Depot* best_depot = NULL;
const Depot *depot;
const Depot *best_depot = NULL;
uint best_dist = UINT_MAX;
FOR_ALL_DEPOTS(depot) {
@ -340,7 +340,7 @@ static CommandCost EstimateShipCost(EngineID engine_type)
return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine_type, 0x0A, ShipVehInfo(engine_type)->cost_factor) * (_price.ship_base >> 3) >> 5);
}
static void ShipArrivesAt(const Vehicle* v, Station* st)
static void ShipArrivesAt(const Vehicle *v, Station *st)
{
/* Check if station was ever visited before */
if (!(st->had_vehicle_of_type & HVOT_SHIP)) {
@ -443,10 +443,10 @@ bad:;
return best_bird_dist;
}
static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData* target, TransportType type, Owner owner, RailTypes railtypes)
static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData *target, TransportType type, Owner owner, RailTypes railtypes)
{
void* perf = NpfBeginInterval();
void *perf = NpfBeginInterval();
NPFFoundTargetData ret = NPFRouteToStationOrTile(tile, trackdir, ignore_start_tile, target, type, 0, owner, railtypes);
int t = NpfEndInterval(perf);
DEBUG(yapf, 4, "[NPFW] %d us - %d rounds - %d open - %d closed -- ", t, 0, _aystar_stats_open_size, _aystar_stats_closed_size);

View File

@ -49,7 +49,7 @@ struct SignList {
}
/** Sort signs by their name */
static int CDECL SignNameSorter(const Sign* const *a, const Sign* const *b)
static int CDECL SignNameSorter(const Sign * const *a, const Sign * const *b)
{
static char buf_cache[64];
char buf[64];

View File

@ -33,10 +33,10 @@ public:
typedef int CDECL SortFunction(const T*, const T*);
protected:
SortFunction* const *func_list; ///< The sort criteria functions
SortListFlags flags; ///< used to control sorting/resorting/etc.
uint8 sort_type; ///< what criteria to sort on
uint16 resort_timer; ///< resort list after a given amount of ticks if set
SortFunction * const *func_list; ///< The sort criteria functions
SortListFlags flags; ///< used to control sorting/resorting/etc.
uint8 sort_type; ///< what criteria to sort on
uint16 resort_timer; ///< resort list after a given amount of ticks if set
/**
* Check if the list is sortable
@ -207,7 +207,7 @@ public:
*
* @param n_funcs The pointer to the first sort func
*/
void SetSortFuncs(SortFunction* const* n_funcs)
void SetSortFuncs(SortFunction * const *n_funcs)
{
this->func_list = n_funcs;
}

View File

@ -51,7 +51,7 @@ static void CALLBACK waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance,
}
}
const char *SoundDriver_Win32::Start(const char* const* parm)
const char *SoundDriver_Win32::Start(const char * const *parm)
{
WAVEFORMATEX wfex;
wfex.wFormatTag = WAVE_FORMAT_PCM;

View File

@ -132,9 +132,9 @@ bool SpriteExists(SpriteID id)
return !(GetSpriteCache(id)->file_pos == 0 && GetSpriteCache(id)->file_slot == 0);
}
void* AllocSprite(size_t);
void *AllocSprite(size_t);
static void* ReadSprite(SpriteCache *sc, SpriteID id, SpriteType sprite_type)
static void *ReadSprite(SpriteCache *sc, SpriteID id, SpriteType sprite_type)
{
uint8 file_slot = sc->file_slot;
size_t file_pos = sc->file_pos;
@ -247,7 +247,7 @@ static void* ReadSprite(SpriteCache *sc, SpriteID id, SpriteType sprite_type)
num -= i;
for (; i > 0; --i) *dest++ = FioReadByte();
} else {
const byte* rel = dest - (((i & 7) << 8) | FioReadByte());
const byte *rel = dest - (((i & 7) << 8) | FioReadByte());
i = -(i >> 3);
num -= i;
for (; i > 0; --i) *dest++ = *rel++;
@ -320,7 +320,7 @@ void DupSprite(SpriteID old_spr, SpriteID new_spr)
#define S_FREE_MASK 1
static inline MemBlock* NextBlock(MemBlock* block)
static inline MemBlock *NextBlock(MemBlock *block)
{
return (MemBlock*)((byte*)block + (block->size & ~S_FREE_MASK));
}
@ -328,7 +328,7 @@ static inline MemBlock* NextBlock(MemBlock* block)
static size_t GetSpriteCacheUsage()
{
size_t tot_size = 0;
MemBlock* s;
MemBlock *s;
for (s = _spritecache_ptr; s->size != 0; s = NextBlock(s)) {
if (!(s->size & S_FREE_MASK)) tot_size += s->size;
@ -376,7 +376,7 @@ static void CompactSpriteCache()
for (s = _spritecache_ptr; s->size != 0;) {
if (s->size & S_FREE_MASK) {
MemBlock* next = NextBlock(s);
MemBlock *next = NextBlock(s);
MemBlock temp;
SpriteID i;
@ -412,7 +412,7 @@ static void DeleteEntryFromSpriteCache()
{
SpriteID i;
uint best = UINT_MAX;
MemBlock* s;
MemBlock *s;
int cur_lru;
DEBUG(sprite, 3, "DeleteEntryFromSpriteCache, inuse=%d", GetSpriteCacheUsage());
@ -446,7 +446,7 @@ static void DeleteEntryFromSpriteCache()
}
}
void* AllocSprite(size_t mem_req)
void *AllocSprite(size_t mem_req)
{
mem_req += sizeof(MemBlock);
@ -455,7 +455,7 @@ void* AllocSprite(size_t mem_req)
mem_req = Align(mem_req, sizeof(uint32));
for (;;) {
MemBlock* s;
MemBlock *s;
for (s = _spritecache_ptr; s->size != 0; s = NextBlock(s)) {
if (s->size & S_FREE_MASK) {
@ -487,7 +487,7 @@ void* AllocSprite(size_t mem_req)
const void *GetRawSprite(SpriteID sprite, SpriteType type)
{
SpriteCache *sc;
void* p;
void *p;
assert(sprite < _spritecache_items);

View File

@ -34,7 +34,7 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro
bool HasStationInUse(StationID station, CompanyID company);
RoadStop * GetRoadStopByTile(TileIndex tile, RoadStopType type);
uint GetNumRoadStops(const Station* st, RoadStopType type);
uint GetNumRoadStops(const Station *st, RoadStopType type);
RoadStop * AllocateRoadStop();
void ClearSlot(Vehicle *v);

View File

@ -149,7 +149,7 @@ protected:
}
/** Sort stations by their name */
static int CDECL StationNameSorter(const Station* const *a, const Station* const *b)
static int CDECL StationNameSorter(const Station * const *a, const Station * const *b)
{
static char buf_cache[64];
char buf[64];
@ -167,13 +167,13 @@ protected:
}
/** Sort stations by their type */
static int CDECL StationTypeSorter(const Station* const *a, const Station* const *b)
static int CDECL StationTypeSorter(const Station * const *a, const Station * const *b)
{
return (*a)->facilities - (*b)->facilities;
}
/** Sort stations by their waiting cargo */
static int CDECL StationWaitingSorter(const Station* const *a, const Station* const *b)
static int CDECL StationWaitingSorter(const Station * const *a, const Station * const *b)
{
Money diff = 0;
@ -187,7 +187,7 @@ protected:
}
/** Sort stations by their rating */
static int CDECL StationRatingMaxSorter(const Station* const *a, const Station* const *b)
static int CDECL StationRatingMaxSorter(const Station * const *a, const Station * const *b)
{
byte maxr1 = 0;
byte maxr2 = 0;

View File

@ -229,7 +229,7 @@
#define strncasecmp strnicmp
#endif
void SetExceptionString(const char* s, ...);
void SetExceptionString(const char *s, ...);
#if defined(NDEBUG) && defined(WITH_ASSERT)
#undef assert

View File

@ -58,7 +58,7 @@ struct Case {
static bool _masterlang;
static bool _translated;
static const char* _file = "(unknown file)";
static const char *_file = "(unknown file)";
static int _cur_line;
static int _errors, _warnings, _show_todo;
@ -136,7 +136,7 @@ static LangString *HashFind(const char *s)
int idx = _hash_head[HashStr(s)];
while (--idx >= 0) {
LangString* ls = _strings[idx];
LangString *ls = _strings[idx];
if (strcmp(ls->name, s) == 0) return ls;
idx = ls->hash_next;
@ -278,8 +278,8 @@ static void EmitSetXY(char *buf, int value)
bool ParseRelNum(char **buf, int *value)
{
const char* s = *buf;
char* end;
const char *s = *buf;
char *end;
bool rel = false;
int v;
@ -337,7 +337,7 @@ char *ParseWord(char **buf)
// Forward declaration
static int TranslateArgumentIdx(int arg);
static void EmitWordList(const char* const* words, uint nw)
static void EmitWordList(const char * const *words, uint nw)
{
uint i;
uint j;
@ -352,7 +352,7 @@ static void EmitWordList(const char* const* words, uint nw)
static void EmitPlural(char *buf, int value)
{
int argidx = _cur_argidx;
const char* words[5];
const char *words[5];
int nw = 0;
// Parse out the number, if one exists. Otherwise default to prev arg.
@ -406,7 +406,7 @@ static void EmitGender(char *buf, int value)
PutUtf8(SCC_GENDER_INDEX);
PutByte(nw);
} else {
const char* words[8];
const char *words[8];
// This is a {G 0 foo bar two} command.
// If no relative number exists, default to +0
@ -534,7 +534,7 @@ static const CmdStruct _cmd_structs[] = {
static const CmdStruct *FindCmd(const char *s, int len)
{
const CmdStruct* cs;
const CmdStruct *cs;
for (cs = _cmd_structs; cs != endof(_cmd_structs); cs++) {
if (strncmp(cs->cmd, s, len) == 0 && cs->cmd[len] == '\0') return cs;
@ -659,10 +659,10 @@ static void HandlePragma(char *str)
}
_lang_winlangid = (uint16)langid;
} else if (!memcmp(str, "gender ", 7)) {
char* buf = str + 7;
char *buf = str + 7;
for (;;) {
const char* s = ParseWord(&buf);
const char *s = ParseWord(&buf);
if (s == NULL) break;
if (_numgenders >= MAX_NUM_GENDER) error("Too many genders, max %d", MAX_NUM_GENDER);
@ -670,10 +670,10 @@ static void HandlePragma(char *str)
_numgenders++;
}
} else if (!memcmp(str, "case ", 5)) {
char* buf = str + 5;
char *buf = str + 5;
for (;;) {
const char* s = ParseWord(&buf);
const char *s = ParseWord(&buf);
if (s == NULL) break;
if (_numcases >= MAX_NUM_CASES) error("Too many cases, max %d", MAX_NUM_CASES);
@ -685,7 +685,7 @@ static void HandlePragma(char *str)
}
}
static void ExtractCommandString(ParsedCommandStruct* p, const char* s, bool warnings)
static void ExtractCommandString(ParsedCommandStruct *p, const char *s, bool warnings)
{
char param[100];
int argno;
@ -696,7 +696,7 @@ static void ExtractCommandString(ParsedCommandStruct* p, const char* s, bool war
for (;;) {
// read until next command from a.
const CmdStruct* ar = ParseCommandString(&s, param, &argno, &casei);
const CmdStruct *ar = ParseCommandString(&s, param, &argno, &casei);
if (ar == NULL) break;
@ -859,7 +859,7 @@ static void HandleString(char *str, bool master)
}
if (casep != NULL) {
Case* c = MallocT<Case>(1);
Case *c = MallocT<Case>(1);
c->caseidx = ResolveCaseName(casep, strlen(casep));
c->string = strdup(s);
@ -888,7 +888,7 @@ static void HandleString(char *str, bool master)
if (!CheckCommandsMatch(s, ent->english, str)) return;
if (casep != NULL) {
Case* c = MallocT<Case>(1);
Case *c = MallocT<Case>(1);
c->caseidx = ResolveCaseName(casep, strlen(casep));
c->string = strdup(s);
@ -958,11 +958,11 @@ static void MakeHashOfStrings()
uint i;
for (i = 0; i != lengthof(_strings); i++) {
const LangString* ls = _strings[i];
const LangString *ls = _strings[i];
if (ls != NULL) {
const CmdStruct* cs;
const char* s;
const CmdStruct *cs;
const char *s;
char buf[256];
int argno;
int casei;
@ -1180,9 +1180,9 @@ static void WriteLangfile(const char *filename)
for (i = 0; i != 32; i++) {
for (j = 0; j != in_use[i]; j++) {
const LangString* ls = _strings[(i << 11) + j];
const Case* casep;
const char* cmdp;
const LangString *ls = _strings[(i << 11) + j];
const Case *casep;
const char *cmdp;
// For undefined strings, just set that it's an empty string
if (ls == NULL) {
@ -1218,7 +1218,7 @@ static void WriteLangfile(const char *filename)
_translated = _masterlang || (cmdp != ls->english);
if (casep != NULL) {
const Case* c;
const Case *c;
uint num;
// Need to output a case-switch.
@ -1301,7 +1301,7 @@ static inline char *replace_pathsep(char *s)
static inline char *replace_pathsep(char *s) { return s; }
#endif
int CDECL main(int argc, char* argv[])
int CDECL main(int argc, char *argv[])
{
char pathbuf[MAX_PATH];
const char *src_dir = ".";

View File

@ -53,7 +53,7 @@ void ttd_strlcpy(char *dst, const char *src, size_t size)
}
char* strecat(char* dst, const char* src, const char* last)
char *strecat(char *dst, const char *src, const char *last)
{
assert(dst <= last);
while (*dst != '\0') {
@ -65,7 +65,7 @@ char* strecat(char* dst, const char* src, const char* last)
}
char* strecpy(char* dst, const char* src, const char* last)
char *strecpy(char *dst, const char *src, const char *last)
{
assert(dst <= last);
while (dst != last && *src != '\0') {

View File

@ -210,7 +210,7 @@ static const DrawRoadTileStruct _road_display_datas2_30[] = {
#undef MAKELINE
#undef ENDLINE
static const DrawRoadTileStruct* const _roadside_none[] = {
static const DrawRoadTileStruct * const _roadside_none[] = {
_roadside_nothing, _roadside_nothing,
_roadside_nothing, _roadside_nothing,
_roadside_nothing, _roadside_nothing,
@ -221,7 +221,7 @@ static const DrawRoadTileStruct* const _roadside_none[] = {
_roadside_nothing, _roadside_nothing
};
static const DrawRoadTileStruct* const _roadside_lamps[] = {
static const DrawRoadTileStruct * const _roadside_lamps[] = {
_roadside_nothing,
_roadside_nothing,
_roadside_nothing,
@ -240,7 +240,7 @@ static const DrawRoadTileStruct* const _roadside_lamps[] = {
_roadside_nothing,
};
static const DrawRoadTileStruct* const _roadside_trees[] = {
static const DrawRoadTileStruct * const _roadside_trees[] = {
_roadside_nothing,
_roadside_nothing,
_roadside_nothing,
@ -260,7 +260,7 @@ static const DrawRoadTileStruct* const _roadside_trees[] = {
_roadside_nothing,
};
static const DrawRoadTileStruct* const * const _road_display_table[] = {
static const DrawRoadTileStruct * const * const _road_display_table[] = {
_roadside_none,
_roadside_none,
_roadside_none,

View File

@ -41,7 +41,7 @@ static const WaterDrawTileStruct _shipdepot_display_seq_4[] = {
END(0)
};
static const WaterDrawTileStruct* const _shipdepot_display_seq[] = {
static const WaterDrawTileStruct * const _shipdepot_display_seq[] = {
_shipdepot_display_seq_1,
_shipdepot_display_seq_2,
_shipdepot_display_seq_3,
@ -132,7 +132,7 @@ static const WaterDrawTileStruct _shiplift_display_seq_3t[] = {
END(8)
};
static const WaterDrawTileStruct* const _shiplift_display_seq[] = {
static const WaterDrawTileStruct * const _shiplift_display_seq[] = {
_shiplift_display_seq_0,
_shiplift_display_seq_1,
_shiplift_display_seq_2,

View File

@ -367,7 +367,7 @@ void UpdateTownRadius(Town *t);
bool CheckIfAuthorityAllows(TileIndex tile);
Town *ClosestTownFromTile(TileIndex tile, uint threshold);
void ChangeTownRating(Town *t, int add, int max);
HouseZonesBits GetTownRadiusGroup(const Town* t, TileIndex tile);
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile);
void SetTownRatingTestMode(bool mode);
/**

View File

@ -294,7 +294,7 @@ byte FreightWagonMult(CargoID cargo);
int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped);
int CheckTrainStoppedInDepot(const Vehicle *v);
void UpdateTrainAcceleration(Vehicle* v);
void UpdateTrainAcceleration(Vehicle *v);
void CheckTrainsLengths();
void FreeTrainTrackReservation(const Vehicle *v, TileIndex origin = INVALID_TILE, Trackdir orig_td = INVALID_TRACKDIR);

View File

@ -59,7 +59,7 @@
#include "table/strings.h"
#include "table/train_cmd.h"
static Track ChooseTrainTrack(Vehicle* v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool force_res, bool *got_reservation, bool mark_stuck);
static Track ChooseTrainTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool force_res, bool *got_reservation, bool mark_stuck);
static bool TrainCheckIfLineEnds(Vehicle *v);
static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image);
static TileIndex TrainApproachingCrossingTile(const Vehicle *v);
@ -2615,7 +2615,7 @@ static const byte _pick_track_table[6] = {1, 3, 2, 2, 0, 0};
* @param dest [out]
* @return The best track the train should follow
*/
static Track DoTrainPathfind(Vehicle* v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool do_track_reservation, PBSTileInfo *dest)
static Track DoTrainPathfind(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool do_track_reservation, PBSTileInfo *dest)
{
Track best_track;
@ -2809,7 +2809,7 @@ static PBSTileInfo ExtendTrainReservation(const Vehicle *v, TrackBits *new_track
* @param override_tailtype Whether all physically compatible railtypes should be followed.
* @return True if a path to a safe stopping tile could be reserved.
*/
static bool TryReserveSafeTrack(const Vehicle* v, TileIndex tile, Trackdir td, bool override_tailtype)
static bool TryReserveSafeTrack(const Vehicle *v, TileIndex tile, Trackdir td, bool override_tailtype)
{
if (_settings_game.pf.pathfinder_for_trains == VPF_YAPF) {
return YapfRailFindNearestSafeTile(v, tile, td, override_tailtype);
@ -2895,7 +2895,7 @@ public:
};
/* choose a track */
static Track ChooseTrainTrack(Vehicle* v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool force_res, bool *got_reservation, bool mark_stuck)
static Track ChooseTrainTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool force_res, bool *got_reservation, bool mark_stuck)
{
Track best_track = INVALID_TRACK;
bool do_track_reservation = _settings_game.pf.reserve_paths || force_res;

View File

@ -759,7 +759,7 @@ static CommandCost ClearTile_TunnelBridge(TileIndex tile, byte flags)
* @param y Sprite Y position of front pillar.
* @param z_bridge Absolute height of bridge bottom.
*/
static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge)
static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo *ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge)
{
/* Do not draw bridge pillars if they are invisible */
if (IsInvisibilitySet(TO_BRIDGES)) return;
@ -1062,7 +1062,7 @@ static BridgePieces CalcBridgePiece(uint north, uint south)
}
void DrawBridgeMiddle(const TileInfo* ti)
void DrawBridgeMiddle(const TileInfo *ti)
{
/* Sectional view of bridge bounding boxes:
*

View File

@ -231,7 +231,7 @@ void cocoaSetupAutoreleasePool();
void cocoaReleaseAutoreleasePool();
#endif
int CDECL main(int argc, char* argv[])
int CDECL main(int argc, char *argv[])
{
int ret;

View File

@ -150,7 +150,7 @@ bool Vehicle::NeedsAutomaticServicing() const
return NeedsServicing();
}
StringID VehicleInTheWayErrMsg(const Vehicle* v)
StringID VehicleInTheWayErrMsg(const Vehicle *v)
{
switch (v->type) {
case VEH_TRAIN: return STR_8803_TRAIN_IN_THE_WAY;
@ -530,7 +530,7 @@ const Vehicle *GetLastVehicleInChain(const Vehicle *v)
return v;
}
uint CountVehiclesInChain(const Vehicle* v)
uint CountVehiclesInChain(const Vehicle *v)
{
uint count = 0;
do count++; while ((v = v->Next()) != NULL);

Some files were not shown because too many files have changed in this diff Show More