diff options
126 files changed, 556 insertions, 556 deletions
diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp index a19d43625..01c8dcd68 100644 --- a/src/ai/ai.cpp +++ b/src/ai/ai.cpp @@ -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; diff --git a/src/ai/ai.h b/src/ai/ai.h index beac1cbdf..0f18490d5 100644 --- a/src/ai/ai.h +++ b/src/ai/ai.h @@ -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. diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index 4e7fecd25..f2daca8b2 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -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; diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp index 288ac1660..0e08ddf77 100644 --- a/src/ai/trolly/pathfinder.cpp +++ b/src/ai/trolly/pathfinder.cpp @@ -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) { diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp index 4a9c51c3f..6b874ec0d 100644 --- a/src/ai/trolly/trolly.cpp +++ b/src/ai/trolly/trolly.cpp @@ -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, diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index e27088cd6..bf05fb952 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -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) { diff --git a/src/aystar.cpp b/src/aystar.cpp index 05fb0a806..be1e6aaf8 100644 --- a/src/aystar.cpp +++ b/src/aystar.cpp @@ -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); } diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 581064033..d27d1589b 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -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 diff --git a/src/cheat.cpp b/src/cheat.cpp index 8f18e5bc1..5c6188b4e 100644 --- a/src/cheat.cpp +++ b/src/cheat.cpp @@ -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; diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 8b9a6edef..8e55ce4c0 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -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, diff --git a/src/console.cpp b/src/console.cpp index f034d498c..b0a5191a1 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -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; diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index ff0790e8b..5dbb888cd 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -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>'"); diff --git a/src/console_internal.h b/src/console_internal.h index c7c71d04e..06ab72431 100644 --- a/src/console_internal.h +++ b/src/console_internal.h @@ -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); diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp index cc549658f..a2bda93e4 100644 --- a/src/core/alloc_type.hpp +++ b/src/core/alloc_type.hpp @@ -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); diff --git a/src/currency.cpp b/src/currency.cpp index b6df46fca..c40c6ec9c 100644 --- a/src/currency.cpp +++ b/src/currency.cpp @@ -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]; diff --git a/src/currency.h b/src/currency.h index 699dc0ab9..15afaebd8 100644 --- a/src/currency.h +++ b/src/currency.h @@ -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 */ diff --git a/src/dedicated.cpp b/src/dedicated.cpp index 95b2a186a..cb760c208 100644 --- a/src/dedicated.cpp +++ b/src/dedicated.cpp @@ -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"); diff --git a/src/driver.cpp b/src/driver.cpp index 3a0653990..f1b2d5927 100644 --- a/src/driver.cpp +++ b/src/driver.cpp @@ -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; } diff --git a/src/economy.cpp b/src/economy.cpp index f8d0205b0..d43be165b 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -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 && diff --git a/src/effectvehicle.cpp b/src/effectvehicle.cpp index e4371cf45..4d13684f1 100644 --- a/src/effectvehicle.cpp +++ b/src/effectvehicle.cpp @@ -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); diff --git a/src/functions.h b/src/functions.h index adeb1db03..1d33d70cb 100644 --- a/src/functions.h +++ b/src/functions.h @@ -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 */ diff --git a/src/gfx.cpp b/src/gfx.cpp index 97ac74d2f..81bbe69c6 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -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); diff --git a/src/gfx_func.h b/src/gfx_func.h index 4a709bf88..5a9077afa 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -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); diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index ea30d13ca..4fda4e12b 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -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; diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index ef2fe50bb..704b84e4e 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -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; } diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 7e5996c13..7fde5ddc3 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -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] = { "", "" }; diff --git a/src/highscore.cpp b/src/highscore.cpp index 9512fc2b9..c109c7539 100644 --- a/src/highscore.cpp +++ b/src/highscore.cpp @@ -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); diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index fa4800eba..49934af40 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -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); diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 93a1121e1..721f7e5e5 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -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, diff --git a/src/landscape.cpp b/src/landscape.cpp index 9bcedcdc1..e2e7d2504 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -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); diff --git a/src/landscape.h b/src/landscape.h index 79edaec6b..fceb63eb9 100644 --- a/src/landscape.h +++ b/src/landscape.h @@ -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) { diff --git a/src/misc/binaryheap.hpp b/src/misc/binaryheap.hpp index f8a343724..ed5a44b71 100644 --- a/src/misc/binaryheap.hpp +++ b/src/misc/binaryheap.hpp @@ -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) diff --git a/src/misc/blob.hpp b/src/misc/blob.hpp index 12f7e54ff..d28f6f00d 100644 --- a/src/misc/blob.hpp +++ b/src/misc/blob.hpp @@ -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); } diff --git a/src/misc/countedptr.hpp b/src/misc/countedptr.hpp index c19e64b0b..59e1273a6 100644 --- a/src/misc/countedptr.hpp +++ b/src/misc/countedptr.hpp @@ -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 } diff --git a/src/misc/crc32.hpp b/src/misc/crc32.hpp index 1d2f86dcd..2c0ca3abd 100644 --- a/src/misc/crc32.hpp +++ b/src/misc/crc32.hpp @@ -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] = { diff --git a/src/misc/dbg_helpers.cpp b/src/misc/dbg_helpers.cpp index 1c34e25b3..11fdaf19b 100644 --- a/src/misc/dbg_helpers.cpp +++ b/src/misc/dbg_helpers.cpp @@ -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", }; diff --git a/src/misc/dbg_helpers.h b/src/misc/dbg_helpers.h index 83aa6c294..7cbe57810 100644 --- a/src/misc/dbg_helpers.h +++ b/src/misc/dbg_helpers.h @@ -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(); diff --git a/src/misc/fixedsizearray.hpp b/src/misc/fixedsizearray.hpp index 10eb4eaa1..cd3d8c904 100644 --- a/src/misc/fixedsizearray.hpp +++ b/src/misc/fixedsizearray.hpp @@ -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 diff --git a/src/misc/hashtable.hpp b/src/misc/hashtable.hpp index 7b93b6cd8..2f1c18530 100644 --- a/src/misc/hashtable.hpp +++ b/src/misc/hashtable.hpp @@ -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; } diff --git a/src/misc/str.hpp b/src/misc/str.hpp index 93e60d441..666c03187 100644 --- a/src/misc/str.hpp +++ b/src/misc/str.hpp @@ -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); diff --git a/src/mixer.cpp b/src/mixer.cpp index 41d49043a..4314e3ddf 100644 --- a/src/mixer.cpp +++ b/src/mixer.cpp @@ -138,7 +138,7 @@ void MxSetChannelVolume(MixerChannel *mc, uint left, uint right) } -void MxActivateChannel(MixerChannel* mc) +void MxActivateChannel(MixerChannel *mc) { mc->active = true; } diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index cefb96a55..0c2291a33 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -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; diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index 6179501a6..0e0a427d5 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -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(); diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index c9fc6ece0..4b2bb03fd 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -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]; diff --git a/src/music_gui.cpp b/src/music_gui.cpp index d92477279..a79f1429d 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -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; diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp index beddb6d7e..c88c96f55 100644 --- a/src/network/core/host.cpp +++ b/src/network/core/host.cpp @@ -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; diff --git a/src/network/core/packet.cpp b/src/network/core/packet.cpp index 62ab4c61a..21d8cf5df 100644 --- a/src/network/core/packet.cpp +++ b/src/network/core/packet.cpp @@ -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. */ diff --git a/src/network/core/packet.h b/src/network/core/packet.h index 295c4e8c2..1dd35a70d 100644 --- a/src/network/core/packet.h +++ b/src/network/core/packet.h @@ -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); diff --git a/src/network/network.cpp b/src/network/network.cpp index 04a6e4518..ffda6a1f9 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -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; diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 23d112ce1..7e44757a7 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -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,*/ diff --git a/src/network/network_func.h b/src/network/network_func.h index 51249f8da..237afe851 100644 --- a/src/network/network_func.h +++ b/src/network/network_func.h @@ -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); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 7e3483501..f9a4f6bfd 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -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); diff --git a/src/network/network_internal.h b/src/network/network_internal.h index d3bb63584..05e373959 100644 --- a/src/network/network_internal.h +++ b/src/network/network_internal.h @@ -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(); diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 051c97148..332364385 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -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'", diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp index 493242bdf..822347b41 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -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; diff --git a/src/network/network_udp.h b/src/network/network_udp.h index 4071ddc0f..48fa4e1e6 100644 --- a/src/network/network_udp.h +++ b/src/network/network_udp.h @@ -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(); diff --git a/src/newgrf.cpp b/src/newgrf.cpp index f6561df95..19ff34803 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -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); diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index b56ae766a..2b8746ff1 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -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; diff --git a/src/newgrf_engine.h b/src/newgrf_engine.h index 013fc4c7f..0d6d396be 100644 --- a/src/newgrf_engine.h +++ b/src/newgrf_engine.h @@ -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) diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 3556e2185..be0253f95 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -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 || diff --git a/src/newgrf_station.h b/src/newgrf_station.h index 13844268b..45552e20b 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -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); diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 4178eda0a..c62d2c445 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -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); } diff --git a/src/npf.cpp b/src/npf.cpp index b4b836b9d..021426a9a 100644 --- a/src/npf.cpp +++ b/src/npf.cpp @@ -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 = ¤t->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); @@ -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); diff --git a/src/oldpool.h b/src/oldpool.h index 5859571b5..d619eeba8 100644 --- a/src/oldpool.h +++ b/src/oldpool.h @@ -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(); } diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index dd010c3ed..c1ac606a0 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -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; diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm index c1e872a57..090e5f4b3 100644 --- a/src/os/macosx/macos.mm +++ b/src/os/macosx/macos.mm @@ -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 diff --git a/src/os2.cpp b/src/os2.cpp index 5e1a3e0dd..e15b96a5b 100644 --- a/src/os2.cpp +++ b/src/os2.cpp @@ -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++) { diff --git a/src/pathfind.cpp b/src/pathfind.cpp index e6a27df72..eb43d7d85 100644 --- a/src/pathfind.cpp +++ b/src/pathfind.cpp @@ -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; diff --git a/src/pathfind.h b/src/pathfind.h index c6528c377..d09b2a053 100644 --- a/src/pathfind.h +++ b/src/pathfind.h @@ -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 */ diff --git a/src/queue.cpp b/src/queue.cpp index c1c6dcb6d..0c736994a 100644 --- a/src/queue.cpp +++ b/src/queue.cpp @@ -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; } diff --git a/src/queue.h b/src/queue.h index 7caecf7db..c0406e75c 100644 --- a/src/queue.h +++ b/src/queue.h @@ -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 { diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 72383777d..482306df5 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -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); } diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index cb4595bd6..54ebd80e3 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -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 */ diff --git a/src/road_gui.cpp b/src/road_gui.cpp index fea1411a8..447cd7c42 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -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, diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index e36ec61e8..1b98ef383 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -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(); diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index c4ecb664a..4aa4a2eee 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -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); diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp index 532d58f8c..9e503077b 100644 --- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -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]); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index a2bc2e324..904c7ea44 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -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++) { diff --git a/src/sdl.cpp b/src/sdl.cpp index 200828743..090b2d1d4 100644 --- a/src/sdl.cpp +++ b/src/sdl.cpp @@ -99,7 +99,7 @@ static void SdlAbort(int sig) #endif -const char* SdlOpen(uint32 x) +const char *SdlOpen(uint32 x) { #ifdef DYNAMICALLY_LOADED_SDL { @@ -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 diff --git a/src/settings.cpp b/src/settings.cpp index a329be0b9..3f52549ce 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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); diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index f5d7fc27d..1fe14870c 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -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); diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 314a2fbf9..23366cf50 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -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]; diff --git a/src/sortlist_type.h b/src/sortlist_type.h index 9c0f6638e..bd1413140 100644 --- a/src/sortlist_type.h +++ b/src/sortlist_type.h @@ -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; } diff --git a/src/sound/win32_s.cpp b/src/sound/win32_s.cpp index 20569bd25..1bb0e9d53 100644 --- a/src/sound/win32_s.cpp +++ b/src/sound/win32_s.cpp @@ -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; diff --git a/src/spritecache.cpp b/src/spritecache.cpp index a354c65ff..963f7704b 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -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); diff --git a/src/station_func.h b/src/station_func.h index 9f47cfb38..4bcf3d8eb 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -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); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 1fa339259..dca791db2 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -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; diff --git a/src/stdafx.h b/src/stdafx.h index 6fdc4fd37..99595ffd7 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -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 diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index 4f4008bf5..a837d7515 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -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 = "."; diff --git a/src/string.cpp b/src/string.cpp index e9338e922..016a4990f 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -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') { diff --git a/src/table/road_land.h b/src/table/road_land.h index 5a221a6cb..ceea16a88 100644 --- a/src/table/road_land.h +++ b/src/table/road_land.h @@ -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, diff --git a/src/table/water_land.h b/src/table/water_land.h index 3a5c01f27..eb47c6aae 100644 --- a/src/table/water_land.h +++ b/src/table/water_land.h @@ -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, diff --git a/src/town.h b/src/town.h index 1d9fb3380..e3c7d6f8e 100644 --- a/src/town.h +++ b/src/town.h @@ -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); /** diff --git a/src/train.h b/src/train.h index 0adcc69cc..3a462438f 100644 --- a/src/train.h +++ b/src/train.h @@ -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); diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 354e80cea..dc9d3c993 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -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; diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 4af0315be..263ec8ca1 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -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: * diff --git a/src/unix.cpp b/src/unix.cpp index 047a7bda6..ea86c16c8 100644 --- a/src/unix.cpp +++ b/src/unix.cpp @@ -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; diff --git a/src/vehicle.cpp b/src/vehicle.cpp index d84be5218..7ccb81215 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -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); diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 7d6a9985d..c72ead86c 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -354,7 +354,7 @@ public: * Get a string 'representation' of the vehicle type. * @return the string representation. */ - virtual const char* GetTypeString() const { return "base vehicle"; } + virtual const char *GetTypeString() const { return "base vehicle"; } /** * Marks the vehicles to be redrawn and updates cached variables @@ -707,7 +707,7 @@ static inline Order *GetLastVehicleOrder(const Vehicle *v) { return (v->orders.l * For other vehicles types, or vehicles with no clear trackdir (such as those * in depots), returns 0xFF. */ -Trackdir GetVehicleTrackdir(const Vehicle* v); +Trackdir GetVehicleTrackdir(const Vehicle *v); void CheckVehicle32Day(Vehicle *v); diff --git a/src/vehicle_func.h b/src/vehicle_func.h index ee2d2607a..616ccee54 100644 --- a/src/vehicle_func.h +++ b/src/vehicle_func.h @@ -47,7 +47,7 @@ void ViewportAddVehicles(DrawPixelInfo *dpi); SpriteID GetRotorImage(const Vehicle *v); -StringID VehicleInTheWayErrMsg(const Vehicle* v); +StringID VehicleInTheWayErrMsg(const Vehicle *v); bool HasVehicleOnTunnelBridge(TileIndex tile, TileIndex endtile, const Vehicle *ignore = NULL); void DecreaseVehicleValue(Vehicle *v); diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index f8ed36523..1a02167d8 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -59,7 +59,7 @@ static GUIVehicleList::SortFunction VehicleValueSorter; static GUIVehicleList::SortFunction VehicleLengthSorter; static GUIVehicleList::SortFunction VehicleTimeToLiveSorter; -GUIVehicleList::SortFunction* const BaseVehicleListWindow::vehicle_sorter_funcs[] = { +GUIVehicleList::SortFunction * const BaseVehicleListWindow::vehicle_sorter_funcs[] = { &VehicleNumberSorter, &VehicleNameSorter, &VehicleAgeSorter, @@ -507,13 +507,13 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine) /** Sort vehicles by their number */ -static int CDECL VehicleNumberSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleNumberSorter(const Vehicle * const *a, const Vehicle * const *b) { return (*a)->unitnumber - (*b)->unitnumber; } /** Sort vehicles by their name */ -static int CDECL VehicleNameSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleNameSorter(const Vehicle * const *a, const Vehicle * const *b) { static char last_name[2][64]; @@ -534,28 +534,28 @@ static int CDECL VehicleNameSorter(const Vehicle* const *a, const Vehicle* const } /** Sort vehicles by their age */ -static int CDECL VehicleAgeSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleAgeSorter(const Vehicle * const *a, const Vehicle * const *b) { int r = (*a)->age - (*b)->age; return (r != 0) ? r : VehicleNumberSorter(a, b); } /** Sort vehicles by this year profit */ -static int CDECL VehicleProfitThisYearSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleProfitThisYearSorter(const Vehicle * const *a, const Vehicle * const *b) { int r = ClampToI32((*a)->GetDisplayProfitThisYear() - (*b)->GetDisplayProfitThisYear()); return (r != 0) ? r : VehicleNumberSorter(a, b); } /** Sort vehicles by last year profit */ -static int CDECL VehicleProfitLastYearSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleProfitLastYearSorter(const Vehicle * const *a, const Vehicle * const *b) { int r = ClampToI32((*a)->GetDisplayProfitLastYear() - (*b)->GetDisplayProfitLastYear()); return (r != 0) ? r : VehicleNumberSorter(a, b); } /** Sort vehicles by their cargo */ -static int CDECL VehicleCargoSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleCargoSorter(const Vehicle * const *a, const Vehicle * const *b) { const Vehicle *v; AcceptedCargo diff; @@ -575,14 +575,14 @@ static int CDECL VehicleCargoSorter(const Vehicle* const *a, const Vehicle* cons } /** Sort vehicles by their reliability */ -static int CDECL VehicleReliabilitySorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleReliabilitySorter(const Vehicle * const *a, const Vehicle * const *b) { int r = (*a)->reliability - (*b)->reliability; return (r != 0) ? r : VehicleNumberSorter(a, b); } /** Sort vehicles by their max speed */ -static int CDECL VehicleMaxSpeedSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleMaxSpeedSorter(const Vehicle * const *a, const Vehicle * const *b) { int r = 0; if ((*a)->type == VEH_TRAIN && (*b)->type == VEH_TRAIN) { @@ -594,14 +594,14 @@ static int CDECL VehicleMaxSpeedSorter(const Vehicle* const *a, const Vehicle* c } /** Sort vehicles by model */ -static int CDECL VehicleModelSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleModelSorter(const Vehicle * const *a, const Vehicle * const *b) { int r = (*a)->engine_type - (*b)->engine_type; return (r != 0) ? r : VehicleNumberSorter(a, b); } /** Sort vehciles by their value */ -static int CDECL VehicleValueSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleValueSorter(const Vehicle * const *a, const Vehicle * const *b) { const Vehicle *u; Money diff = 0; @@ -614,7 +614,7 @@ static int CDECL VehicleValueSorter(const Vehicle* const *a, const Vehicle* cons } /** Sort vehicles by their length */ -static int CDECL VehicleLengthSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleLengthSorter(const Vehicle * const *a, const Vehicle * const *b) { int r = 0; switch ((*a)->type) { @@ -634,7 +634,7 @@ static int CDECL VehicleLengthSorter(const Vehicle* const *a, const Vehicle* con } /** Sort vehicles by the time they can still live */ -static int CDECL VehicleTimeToLiveSorter(const Vehicle* const *a, const Vehicle* const *b) +static int CDECL VehicleTimeToLiveSorter(const Vehicle * const *a, const Vehicle * const *b) { int r = ClampToI32(((*a)->max_age - (*a)->age) - ((*b)->max_age - (*b)->age)); return (r != 0) ? r : VehicleNumberSorter(a, b); diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h index cfc63147d..0b742f4cd 100644 --- a/src/video/cocoa/cocoa_v.h +++ b/src/video/cocoa/cocoa_v.h @@ -42,7 +42,7 @@ public: virtual void MakeDirty(int left, int top, int width, int height) = 0; virtual void UpdatePalette(uint first_color, uint num_colors) = 0; - virtual uint ListModes(OTTD_Point* modes, uint max_modes) = 0; + virtual uint ListModes(OTTD_Point *modes, uint max_modes) = 0; virtual bool ChangeResolution(int w, int h) = 0; @@ -52,7 +52,7 @@ public: virtual void *GetPixelBuffer() = 0; /* Convert local coordinate to window server (CoreGraphics) coordinate */ - virtual CGPoint PrivateLocalToCG(NSPoint* p) = 0; + virtual CGPoint PrivateLocalToCG(NSPoint *p) = 0; virtual NSPoint GetMouseLocation(NSEvent *event) = 0; virtual bool MouseIsInsideView(NSPoint *pt) = 0; @@ -60,7 +60,7 @@ public: virtual bool IsActive() = 0; }; -extern CocoaSubdriver* _cocoa_subdriver; +extern CocoaSubdriver *_cocoa_subdriver; CocoaSubdriver *QZ_CreateFullscreenSubdriver(int width, int height, int bpp); @@ -81,6 +81,6 @@ void QZ_GameLoop(); void QZ_ShowMouse(); void QZ_HideMouse(); -uint QZ_ListModes(OTTD_Point* modes, uint max_modes, CGDirectDisplayID display_id, int display_depth); +uint QZ_ListModes(OTTD_Point *modes, uint max_modes, CGDirectDisplayID display_id, int display_depth); #endif /* VIDEO_COCOA_H */ diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index 516910509..f04ae8a63 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -31,9 +31,9 @@ struct CPSProcessSerNum { UInt32 hi; }; -extern "C" OSErr CPSGetCurrentProcess(CPSProcessSerNum* psn); -extern "C" OSErr CPSEnableForegroundOperation(CPSProcessSerNum* psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); -extern "C" OSErr CPSSetFrontProcess(CPSProcessSerNum* psn); +extern "C" OSErr CPSGetCurrentProcess(CPSProcessSerNum *psn); +extern "C" OSErr CPSEnableForegroundOperation(CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern "C" OSErr CPSSetFrontProcess(CPSProcessSerNum *psn); /* Disables a warning. This is needed since the method exists but has been dropped from the header, supposedly as of 10.4. */ #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) @@ -74,7 +74,7 @@ static OTTDMain *_ottd_main; static bool _cocoa_video_started = false; static bool _cocoa_video_dialog = false; -CocoaSubdriver* _cocoa_subdriver = NULL; +CocoaSubdriver *_cocoa_subdriver = NULL; @@ -147,9 +147,9 @@ static void setApplicationMenu() /* Create a window menu */ static void setupWindowMenu() { - NSMenu* windowMenu; - NSMenuItem* windowMenuItem; - NSMenuItem* menuItem; + NSMenu *windowMenu; + NSMenuItem *windowMenuItem; + NSMenuItem *menuItem; windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; @@ -392,7 +392,7 @@ bool VideoDriver_Cocoa::ToggleFullscreen(bool full_screen) /* This is needed since sometimes assert is called before the videodriver is initialized */ -void CocoaDialog(const char* title, const char* message, const char* buttonLabel) +void CocoaDialog(const char *title, const char *message, const char *buttonLabel) { bool wasstarted; diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm index a9273deb7..ca90009db 100644 --- a/src/video/cocoa/event.mm +++ b/src/video/cocoa/event.mm @@ -602,8 +602,8 @@ static bool QZ_PollEvent() } /* else: deltaY was 0.0 and we don't want to do anything */ /* Set the scroll count for scrollwheel scrolling */ - _cursor.h_wheel -= (int)([ event deltaX ]* 5 * _settings_client.gui.scrollwheel_multiplier); - _cursor.v_wheel -= (int)([ event deltaY ]* 5 * _settings_client.gui.scrollwheel_multiplier); + _cursor.h_wheel -= (int)([ event deltaX ] * 5 * _settings_client.gui.scrollwheel_multiplier); + _cursor.v_wheel -= (int)([ event deltaY ] * 5 * _settings_client.gui.scrollwheel_multiplier); break; default: diff --git a/src/video/cocoa/fullscreen.mm b/src/video/cocoa/fullscreen.mm index d24a3704e..3d97c5263 100644 --- a/src/video/cocoa/fullscreen.mm +++ b/src/video/cocoa/fullscreen.mm @@ -77,7 +77,7 @@ struct OTTD_QuartzGammaTable { -uint QZ_ListModes(OTTD_Point* modes, uint max_modes, CGDirectDisplayID display_id, int display_depth) +uint QZ_ListModes(OTTD_Point *modes, uint max_modes, CGDirectDisplayID display_id, int display_depth) { CFArrayRef mode_list; CFIndex num_modes; @@ -170,8 +170,8 @@ class FullscreenSubdriver: public CocoaSubdriver { int display_height; int display_depth; int screen_pitch; - void* screen_buffer; - void* pixel_buffer; + void *screen_buffer; + void *pixel_buffer; CGDirectDisplayID display_id; /* 0 == main display (only support single display) */ CFDictionaryRef cur_mode; /* current mode of the display */ @@ -187,7 +187,7 @@ class FullscreenSubdriver: public CocoaSubdriver { * Fade the display from normal to black * Save gamma tables for fade back to normal */ - uint32 FadeGammaOut(OTTD_QuartzGammaTable* table) + uint32 FadeGammaOut(OTTD_QuartzGammaTable *table) { CGGammaValue redTable[QZ_GAMMA_TABLE_SIZE]; CGGammaValue greenTable[QZ_GAMMA_TABLE_SIZE]; @@ -232,7 +232,7 @@ class FullscreenSubdriver: public CocoaSubdriver { /* Fade the display from black to normal * Restore previously saved gamma values */ - uint32 FadeGammaIn(const OTTD_QuartzGammaTable* table) + uint32 FadeGammaIn(const OTTD_QuartzGammaTable *table) { CGGammaValue redTable[QZ_GAMMA_TABLE_SIZE]; CGGammaValue greenTable[QZ_GAMMA_TABLE_SIZE]; @@ -470,8 +470,8 @@ public: virtual void Draw() { - const uint8* src = (uint8*) pixel_buffer; - uint8* dst = (uint8*) screen_buffer; + const uint8 *src = (uint8*) pixel_buffer; + uint8 *dst = (uint8*) screen_buffer; uint pitch = screen_pitch; uint width = display_width; uint num_dirty = num_dirty_rects; @@ -536,7 +536,7 @@ public: CGDisplaySetPalette(display_id, palette); } - virtual uint ListModes(OTTD_Point* modes, uint max_modes) + virtual uint ListModes(OTTD_Point *modes, uint max_modes) { return QZ_ListModes(modes, max_modes, display_id, display_depth); } @@ -579,7 +579,7 @@ public: Convert local coordinate to window server (CoreGraphics) coordinate. In fullscreen mode this just means copying the coords. */ - virtual CGPoint PrivateLocalToCG(NSPoint* p) + virtual CGPoint PrivateLocalToCG(NSPoint *p) { CGPoint cgp; diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm index 9538a52cb..518668022 100644 --- a/src/video/cocoa/wnd_quartz.mm +++ b/src/video/cocoa/wnd_quartz.mm @@ -98,8 +98,8 @@ class WindowQuartzSubdriver: public CocoaSubdriver { int buffer_depth; - void* pixel_buffer; - void* image_buffer; + void *pixel_buffer; + void *image_buffer; OTTD_QuartzWindow *window; @@ -113,8 +113,8 @@ public: bool active; bool setup; - OTTD_QuartzView* qzview; - CGContextRef cgcontext; + OTTD_QuartzView *qzview; + CGContextRef cgcontext; private: void GetDeviceInfo(); @@ -139,7 +139,7 @@ public: virtual void MakeDirty(int left, int top, int width, int height); virtual void UpdatePalette(uint first_color, uint num_colors); - virtual uint ListModes(OTTD_Point* modes, uint max_modes); + virtual uint ListModes(OTTD_Point *modes, uint max_modes); virtual bool ChangeResolution(int w, int h); @@ -150,7 +150,7 @@ public: virtual void *GetPixelBuffer() { return buffer_depth == 8 ? pixel_buffer : image_buffer; } /* Convert local coordinate to window server (CoreGraphics) coordinate */ - virtual CGPoint PrivateLocalToCG(NSPoint* p); + virtual CGPoint PrivateLocalToCG(NSPoint *p); virtual NSPoint GetMouseLocation(NSEvent *event); virtual bool MouseIsInsideView(NSPoint *pt); @@ -335,7 +335,7 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace() CGImageRef fullImage; CGImageRef clippedImage; NSRect rect; - const NSRect* dirtyRects; + const NSRect *dirtyRects; int dirtyRectCount; int n; CGRect clipRect; @@ -537,9 +537,9 @@ bool WindowQuartzSubdriver::SetVideoMode(int width, int height) void WindowQuartzSubdriver::BlitIndexedToView32(int left, int top, int right, int bottom) { - const uint32* pal = palette; - const uint8* src = (uint8*)pixel_buffer; - uint32* dst = (uint32*)image_buffer; + const uint32 *pal = palette; + const uint8 *src = (uint8*)pixel_buffer; + uint32 *dst = (uint32*)image_buffer; uint width = window_width; uint pitch = window_width; int x; @@ -658,7 +658,7 @@ void WindowQuartzSubdriver::UpdatePalette(uint first_color, uint num_colors) num_dirty_rects = MAX_DIRTY_RECTS; } -uint WindowQuartzSubdriver::ListModes(OTTD_Point* modes, uint max_modes) +uint WindowQuartzSubdriver::ListModes(OTTD_Point *modes, uint max_modes) { return QZ_ListModes(modes, max_modes, kCGDirectMainDisplay, buffer_depth); } @@ -678,7 +678,7 @@ bool WindowQuartzSubdriver::ChangeResolution(int w, int h) } /* Convert local coordinate to window server (CoreGraphics) coordinate */ -CGPoint WindowQuartzSubdriver::PrivateLocalToCG(NSPoint* p) +CGPoint WindowQuartzSubdriver::PrivateLocalToCG(NSPoint *p) { CGPoint cgp; @@ -718,7 +718,7 @@ bool WindowQuartzSubdriver::MouseIsInsideView(NSPoint *pt) */ void WindowQuartzSubdriver::SetPortAlphaOpaque() { - uint32* pixels = (uint32*)image_buffer; + uint32 *pixels = (uint32*)image_buffer; uint32 pitch = window_width; int x, y; diff --git a/src/video/cocoa/wnd_quickdraw.mm b/src/video/cocoa/wnd_quickdraw.mm index 0d9b3ee4d..ed6a4d6df 100644 --- a/src/video/cocoa/wnd_quickdraw.mm +++ b/src/video/cocoa/wnd_quickdraw.mm @@ -154,7 +154,7 @@ public: virtual void MakeDirty(int left, int top, int width, int height); virtual void UpdatePalette(uint first_color, uint num_colors); - virtual uint ListModes(OTTD_Point* modes, uint max_modes); + virtual uint ListModes(OTTD_Point *modes, uint max_modes); virtual bool ChangeResolution(int w, int h); @@ -165,7 +165,7 @@ public: virtual void *GetPixelBuffer() { return pixel_buffer; } /* Convert local coordinate to window server (CoreGraphics) coordinate */ - virtual CGPoint PrivateLocalToCG(NSPoint* p); + virtual CGPoint PrivateLocalToCG(NSPoint *p); virtual NSPoint GetMouseLocation(NSEvent *event); virtual bool MouseIsInsideView(NSPoint *pt); @@ -462,8 +462,8 @@ bool WindowQuickdrawSubdriver::SetVideoMode(int width, int height) void WindowQuickdrawSubdriver::Blit32ToView32(int left, int top, int right, int bottom) { - const uint32* src = (uint32*)pixel_buffer; - uint32* dst = (uint32*)window_buffer; + const uint32 *src = (uint32*)pixel_buffer; + uint32 *dst = (uint32*)window_buffer; uint width = window_width; uint pitch = window_pitch / 4; int y; @@ -479,9 +479,9 @@ void WindowQuickdrawSubdriver::Blit32ToView32(int left, int top, int right, int void WindowQuickdrawSubdriver::BlitIndexedToView32(int left, int top, int right, int bottom) { - const uint32* pal = palette32; - const uint8* src = (uint8*)pixel_buffer; - uint32* dst = (uint32*)window_buffer; + const uint32 *pal = palette32; + const uint8 *src = (uint8*)pixel_buffer; + uint32 *dst = (uint32*)window_buffer; uint width = window_width; uint pitch = window_pitch / 4; int x; @@ -496,9 +496,9 @@ void WindowQuickdrawSubdriver::BlitIndexedToView32(int left, int top, int right, void WindowQuickdrawSubdriver::BlitIndexedToView16(int left, int top, int right, int bottom) { - const uint16* pal = palette16; - const uint8* src = (uint8*)pixel_buffer; - uint16* dst = (uint16*)window_buffer; + const uint16 *pal = palette16; + const uint8 *src = (uint8*)pixel_buffer; + uint16 *dst = (uint16*)window_buffer; uint width = window_width; uint pitch = window_pitch / 2; int x; @@ -541,7 +541,7 @@ void WindowQuickdrawSubdriver::DrawResizeIcon() switch (device_depth) { case 32: for (y = 0; y < _resize_icon_height; y++) { - uint32* trg = (uint32*)window_buffer + (yoff + y) * window_pitch / 4 + xoff; + uint32 *trg = (uint32*)window_buffer + (yoff + y) * window_pitch / 4 + xoff; for (x = 0; x < _resize_icon_width; x++, trg++) { if (_resize_icon[y * _resize_icon_width + x]) *trg = 0xff000000; @@ -550,7 +550,7 @@ void WindowQuickdrawSubdriver::DrawResizeIcon() break; case 16: for (y = 0; y < _resize_icon_height; y++) { - uint16* trg = (uint16*)window_buffer + (yoff + y) * window_pitch / 2 + xoff; + uint16 *trg = (uint16*)window_buffer + (yoff + y) * window_pitch / 2 + xoff; for (x = 0; x < _resize_icon_width; x++, trg++) { if (_resize_icon[y * _resize_icon_width + x]) *trg = 0x0000; @@ -681,7 +681,7 @@ void WindowQuickdrawSubdriver::UpdatePalette(uint first_color, uint num_colors) num_dirty_rects = MAX_DIRTY_RECTS; } -uint WindowQuickdrawSubdriver::ListModes(OTTD_Point* modes, uint max_modes) +uint WindowQuickdrawSubdriver::ListModes(OTTD_Point *modes, uint max_modes) { return QZ_ListModes(modes, max_modes, kCGDirectMainDisplay, buffer_depth); } @@ -701,7 +701,7 @@ bool WindowQuickdrawSubdriver::ChangeResolution(int w, int h) } /* Convert local coordinate to window server (CoreGraphics) coordinate */ -CGPoint WindowQuickdrawSubdriver::PrivateLocalToCG(NSPoint* p) +CGPoint WindowQuickdrawSubdriver::PrivateLocalToCG(NSPoint *p) { CGPoint cgp; @@ -740,7 +740,7 @@ void WindowQuickdrawSubdriver::SetPortAlphaOpaque() if (device_depth != 32) return; - uint32* pixels = (uint32*)window_buffer; + uint32 *pixels = (uint32*)window_buffer; uint32 pitch = window_pitch / 4; int x, y; diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp index 77a820f59..85ea8f758 100644 --- a/src/video/null_v.cpp +++ b/src/video/null_v.cpp @@ -12,7 +12,7 @@ static FVideoDriver_Null iFVideoDriver_Null; -const char *VideoDriver_Null::Start(const char* const *parm) +const char *VideoDriver_Null::Start(const char * const *parm) { this->ticks = GetDriverParamInt(parm, "ticks", 1000); _screen.width = _screen.pitch = _cur_resolution.width; diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 5f5f6eb6a..55cb54c3b 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -533,7 +533,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP #if !defined(WINCE) case WM_SIZING: { - RECT* r = (RECT*)lParam; + RECT *r = (RECT*)lParam; RECT r2; int w, h; diff --git a/src/viewport.cpp b/src/viewport.cpp index 20404c61d..7029dc2da 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -572,7 +572,7 @@ void OffsetGroundSprite(int x, int y) static void AddCombinedSprite(SpriteID image, SpriteID pal, int x, int y, byte z, const SubSprite *sub) { Point pt = RemapCoords(x, y, z); - const Sprite* spr = GetSprite(image & SPRITE_MASK, ST_NORMAL); + const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL); if (pt.x + spr->x_offs >= _vd.dpi.left + _vd.dpi.width || pt.x + spr->x_offs + spr->width <= _vd.dpi.left || @@ -1591,7 +1591,7 @@ void UpdateViewportPosition(Window *w) const ViewPort *vp = w->viewport; if (w->viewport->follow_vehicle != INVALID_VEHICLE) { - const Vehicle* veh = GetVehicle(w->viewport->follow_vehicle); + const Vehicle *veh = GetVehicle(w->viewport->follow_vehicle); Point pt = MapXYZToViewport(vp, veh->x_pos, veh->y_pos, veh->z_pos); w->viewport->scrollpos_x = pt.x; diff --git a/src/waypoint.cpp b/src/waypoint.cpp index 888d2d795..061eca795 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -43,7 +43,7 @@ DEFINE_OLD_POOL_GENERIC(Waypoint, Waypoint) /** * Update the sign for the waypoint * @param wp Waypoint to update sign */ -static void UpdateWaypointSign(Waypoint* wp) +static void UpdateWaypointSign(Waypoint *wp) { Point pt = RemapCoords2(TileX(wp->xy) * TILE_SIZE, TileY(wp->xy) * TILE_SIZE); SetDParam(0, wp->index); @@ -53,7 +53,7 @@ static void UpdateWaypointSign(Waypoint* wp) /** * Redraw the sign of a waypoint * @param wp Waypoint to redraw sign */ -static void RedrawWaypointSign(const Waypoint* wp) +static void RedrawWaypointSign(const Waypoint *wp) { MarkAllViewportsDirty( wp->sign.left - 6, @@ -78,7 +78,7 @@ void UpdateAllWaypointSigns() * Set the default name for a waypoint * @param wp Waypoint to work on */ -static void MakeDefaultWaypointName(Waypoint* wp) +static void MakeDefaultWaypointName(Waypoint *wp) { uint32 used = 0; // bitmap of used waypoint numbers, sliding window with 'next' as base uint32 next = 0; // first waypoint number in the bitmap @@ -227,7 +227,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3 } wp->owner = owner; - const StationSpec* statspec; + const StationSpec *statspec; bool reserved = HasBit(GetTrackReservation(tile), AxisToTrack(axis)); MakeRailWaypoint(tile, owner, axis, GetRailType(tile), wp->index); diff --git a/src/widget.cpp b/src/widget.cpp index 9d05a7408..0e0787043 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -207,7 +207,7 @@ void DrawFrameRect(int left, int top, int right, int bottom, int color, FrameFla */ void Window::DrawWidgets() const { - const DrawPixelInfo* dpi = _cur_dpi; + const DrawPixelInfo *dpi = _cur_dpi; for (uint i = 0; i < this->widget_count; i++) { const Widget *wi = &this->widget[i]; diff --git a/src/yapf/nodelist.hpp b/src/yapf/nodelist.hpp index ede2169f8..e8c4fdc37 100644 --- a/src/yapf/nodelist.hpp +++ b/src/yapf/nodelist.hpp @@ -55,7 +55,7 @@ public: /** return number of closed nodes */ FORCEINLINE int ClosedCount() {return m_closed.Count();} /** allocate new data item from m_arr */ - FORCEINLINE Titem_* CreateNewNode() + FORCEINLINE Titem_ *CreateNewNode() { if (m_new_node == NULL) m_new_node = &m_arr.Add(); return m_new_node; @@ -80,7 +80,7 @@ public: m_new_node = NULL; } /** return the best open node */ - FORCEINLINE Titem_* GetBestOpenNode() + FORCEINLINE Titem_ *GetBestOpenNode() { if (!m_open_queue.IsEmpty()) { Titem_& item = m_open_queue.GetHead(); @@ -89,7 +89,7 @@ public: return NULL; } /** remove and return the best open node */ - FORCEINLINE Titem_* PopBestOpenNode() + FORCEINLINE Titem_ *PopBestOpenNode() { if (!m_open_queue.IsEmpty()) { Titem_& item = m_open_queue.PopHead(); @@ -99,9 +99,9 @@ public: return NULL; } /** return the open node specified by a key or NULL if not found */ - FORCEINLINE Titem_* FindOpenNode(const Key& key) + FORCEINLINE Titem_ *FindOpenNode(const Key& key) { - Titem_* item = m_open.Find(key); + Titem_ *item = m_open.Find(key); return item; } /** remove and return the open node specified by a key */ @@ -119,9 +119,9 @@ public: m_closed.Push(item); } /** return the closed node specified by a key or NULL if not found */ - FORCEINLINE Titem_* FindClosedNode(const Key& key) + FORCEINLINE Titem_ *FindClosedNode(const Key& key) { - Titem_* item = m_closed.Find(key); + Titem_ *item = m_closed.Find(key); return item; } diff --git a/src/yapf/yapf.h b/src/yapf/yapf.h index 45ba94eb3..6d42b2b7e 100644 --- a/src/yapf/yapf.h +++ b/src/yapf/yapf.h @@ -44,12 +44,12 @@ Trackdir YapfChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection ent * @param tile destination tile * @return distance from origin tile to the destination (number of road tiles) or UINT_MAX if path not found */ -uint YapfRoadVehDistanceToTile(const Vehicle* v, TileIndex tile); +uint YapfRoadVehDistanceToTile(const Vehicle *v, TileIndex tile); /** Used when user sends RV to the nearest depot or if RV needs servicing. * Returns the nearest depot (or NULL if depot was not found). */ -Depot* YapfFindNearestRoadDepot(const Vehicle *v); +Depot *YapfFindNearestRoadDepot(const Vehicle *v); /** Used when user sends train to the nearest depot or if train needs servicing. * @param v train that needs to go to some depot @@ -64,7 +64,7 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v); bool YapfFindNearestRailDepotTwoWay(const Vehicle *v, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed); /** Returns true if it is better to reverse the train before leaving station */ -bool YapfCheckReverseTrain(const Vehicle* v); +bool YapfCheckReverseTrain(const Vehicle *v); /** * Try to extend the reserved path of a train to the nearest safe tile. @@ -81,7 +81,7 @@ bool YapfRailFindNearestSafeTile(const Vehicle *v, TileIndex tile, Trackdir td, void YapfNotifyTrackLayoutChange(TileIndex tile, Track track); /** performance measurement helpers */ -void* NpfBeginInterval(); +void *NpfBeginInterval(); int NpfEndInterval(void *perf); diff --git a/src/yapf/yapf.hpp b/src/yapf/yapf.hpp index 758d4d459..60d404804 100644 --- a/src/yapf/yapf.hpp +++ b/src/yapf/yapf.hpp @@ -51,7 +51,7 @@ struct CPerformanceTimer struct CPerfStartReal { - CPerformanceTimer* m_pperf; + CPerformanceTimer *m_pperf; FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();} FORCEINLINE ~CPerfStartReal() {Stop();} diff --git a/src/yapf/yapf_base.hpp b/src/yapf/yapf_base.hpp index 418a36d9f..eb134b4a1 100644 --- a/src/yapf/yapf_base.hpp +++ b/src/yapf/yapf_base.hpp @@ -164,7 +164,7 @@ public: /** If path was found return the best node that has reached the destination. Otherwise * return the best visited node (which was nearest to the destination). */ - FORCEINLINE Node* GetBestNode() + FORCEINLINE Node *GetBestNode() { return (m_pBestDestNode != NULL) ? m_pBestDestNode : m_pBestIntermediateNode; } @@ -193,7 +193,7 @@ public: } /** add multiple nodes - direct children of the given node */ - FORCEINLINE void AddMultipleNodes(Node* parent, const TrackFollower &tf) + FORCEINLINE void AddMultipleNodes(Node *parent, const TrackFollower &tf) { bool is_choice = (KillFirstBit(tf.m_new_td_bits) != TRACKDIR_BIT_NONE); for (TrackdirBits rtds = tf.m_new_td_bits; rtds != TRACKDIR_BIT_NONE; rtds = KillFirstBit(rtds)) { @@ -242,7 +242,7 @@ public: } // check new node against open list - Node* openNode = m_nodes.FindOpenNode(n.GetKey()); + Node *openNode = m_nodes.FindOpenNode(n.GetKey()); if (openNode != NULL) { // another node exists with the same key in the open list // is it better than new one? @@ -257,7 +257,7 @@ public: } // check new node against closed list - Node* closedNode = m_nodes.FindClosedNode(n.GetKey()); + Node *closedNode = m_nodes.FindClosedNode(n.GetKey()); if (closedNode != NULL) { // another node exists with the same key in the closed list // is it better than new one? diff --git a/src/yapf/yapf_costcache.hpp b/src/yapf/yapf_costcache.hpp index 964e638c3..07679822b 100644 --- a/src/yapf/yapf_costcache.hpp +++ b/src/yapf/yapf_costcache.hpp @@ -113,7 +113,7 @@ struct CSegmentCostCacheT FORCEINLINE Tsegment& Get(Key& key, bool *found) { - Tsegment* item = m_map.Find(key); + Tsegment *item = m_map.Find(key); if (item == NULL) { *found = false; item = new (&m_heap.AddNC()) Tsegment(key); diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 2af12e271..624e5b974 100644 --- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -117,7 +117,7 @@ protected: static TileIndex CalcStationCenterTile(StationID station) { - const Station* st = GetStation(station); + const Station *st = GetStation(station); /* If the rail station is (temporarily) not present, use the station sign to drive near the station */ if (!IsValidTile(st->train_tile)) return st->xy; @@ -129,7 +129,7 @@ protected: } public: - void SetDestination(const Vehicle* v) + void SetDestination(const Vehicle *v) { switch (v->current_order.GetType()) { case OT_GOTO_STATION: diff --git a/src/yapf/yapf_node.hpp b/src/yapf/yapf_node.hpp index 5857e3a7d..16146a488 100644 --- a/src/yapf/yapf_node.hpp +++ b/src/yapf/yapf_node.hpp @@ -56,7 +56,7 @@ struct CYapfNodeT { m_estimate = 0; } - FORCEINLINE Node* GetHashNext() {return m_hash_next;} + FORCEINLINE Node *GetHashNext() {return m_hash_next;} FORCEINLINE void SetHashNext(Node *pNext) {m_hash_next = pNext;} FORCEINLINE TileIndex GetTile() const {return m_key.m_tile;} FORCEINLINE Trackdir GetTrackdir() const {return m_key.m_td;} diff --git a/src/yapf/yapf_node_rail.hpp b/src/yapf/yapf_node_rail.hpp index 0d7e5d4d9..4bb8f9868 100644 --- a/src/yapf/yapf_node_rail.hpp +++ b/src/yapf/yapf_node_rail.hpp @@ -86,7 +86,7 @@ DECLARE_ENUM_AS_BIT_SET(EndSegmentReasonBits); inline CStrA ValueStr(EndSegmentReasonBits bits) { - static const char* end_segment_reason_names[] = { + static const char *end_segment_reason_names[] = { "DEAD_END", "RAIL_TYPE", "INFINITE_LOOP", "SEGMENT_TOO_LONG", "CHOICE_FOLLOWS", "DEPOT", "WAYPOINT", "STATION", "PATH_TOO_LONG", "FIRST_TWO_WAY_RED", "LOOK_AHEAD_END", "TARGET_REACHED" @@ -109,7 +109,7 @@ struct CYapfRailSegment TileIndex m_last_signal_tile; Trackdir m_last_signal_td; EndSegmentReasonBits m_end_segment_reason; - CYapfRailSegment* m_hash_next; + CYapfRailSegment *m_hash_next; FORCEINLINE CYapfRailSegment(const CYapfRailSegmentKey& key) : m_key(key) @@ -124,8 +124,8 @@ struct CYapfRailSegment FORCEINLINE const Key& GetKey() const {return m_key;} FORCEINLINE TileIndex GetTile() const {return m_key.GetTile();} - FORCEINLINE CYapfRailSegment* GetHashNext() {return m_hash_next;} - FORCEINLINE void SetHashNext(CYapfRailSegment* next) {m_hash_next = next;} + FORCEINLINE CYapfRailSegment *GetHashNext() {return m_hash_next;} + FORCEINLINE void SetHashNext(CYapfRailSegment *next) {m_hash_next = next;} void Dump(DumpTarget &dmp) const { @@ -159,7 +159,7 @@ struct CYapfRailNodeT } flags_u; SignalType m_last_red_signal_type; - FORCEINLINE void Set(CYapfRailNodeT* parent, TileIndex tile, Trackdir td, bool is_choice) + FORCEINLINE void Set(CYapfRailNodeT *parent, TileIndex tile, Trackdir td, bool is_choice) { base::Set(parent, tile, td, is_choice); m_segment = NULL; diff --git a/src/yapf/yapf_node_road.hpp b/src/yapf/yapf_node_road.hpp index 8d6fd2978..b4521b5fc 100644 --- a/src/yapf/yapf_node_road.hpp +++ b/src/yapf/yapf_node_road.hpp @@ -17,7 +17,7 @@ struct CYapfRoadNodeT TileIndex m_segment_last_tile; Trackdir m_segment_last_td; - void Set(CYapfRoadNodeT* parent, TileIndex tile, Trackdir td, bool is_choice) + void Set(CYapfRoadNodeT *parent, TileIndex tile, Trackdir td, bool is_choice) { base::Set(parent, tile, td, is_choice); m_segment_last_tile = tile; diff --git a/src/yapf/yapf_rail.cpp b/src/yapf/yapf_rail.cpp index 619e0177b..2e2b917ca 100644 --- a/src/yapf/yapf_rail.cpp +++ b/src/yapf/yapf_rail.cpp @@ -188,7 +188,7 @@ public: /// return debug report character to identify the transportation type FORCEINLINE char TransportTypeChar() const {return 't';} - static bool stFindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed) + static bool stFindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed) { Tpf pf1; bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_distance, reverse_penalty, depot_tile, reversed); @@ -207,7 +207,7 @@ public: return result1; } - FORCEINLINE bool FindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed) + FORCEINLINE bool FindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed) { // set origin and destination nodes Yapf().SetOrigin(t1, td1, t2, td2, reverse_penalty, true); @@ -307,7 +307,7 @@ public: this->SetReservationTarget(pNode, pNode->GetLastTile(), pNode->GetLastTrackdir()); /* Walk through the path back to the origin. */ - Node* pPrev = NULL; + Node *pPrev = NULL; while (pNode->m_parent != NULL) { pPrev = pNode; pNode = pNode->m_parent; @@ -401,7 +401,7 @@ public: // path was found or at least suggested // walk through the path back to the origin - Node* pPrev = NULL; + Node *pPrev = NULL; while (pNode->m_parent != NULL) { pPrev = pNode; pNode = pNode->m_parent; @@ -502,7 +502,7 @@ Trackdir YapfChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection ent return td_ret; } -bool YapfCheckReverseTrain(const Vehicle* v) +bool YapfCheckReverseTrain(const Vehicle *v) { /* last wagon */ const Vehicle *last_veh = GetLastVehicleInChain(v); diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp index 6186f1ac1..ed0be31f1 100644 --- a/src/yapf/yapf_road.cpp +++ b/src/yapf/yapf_road.cpp @@ -363,13 +363,13 @@ public: return true; } - static Depot* stFindNearestDepot(const Vehicle* v, TileIndex tile, Trackdir td) + static Depot *stFindNearestDepot(const Vehicle *v, TileIndex tile, Trackdir td) { Tpf pf; return pf.FindNearestDepot(v, tile, td); } - FORCEINLINE Depot* FindNearestDepot(const Vehicle* v, TileIndex tile, Trackdir td) + FORCEINLINE Depot *FindNearestDepot(const Vehicle *v, TileIndex tile, Trackdir td) { // set origin and destination nodes Yapf().SetOrigin(tile, TrackdirToTrackdirBits(td)); @@ -383,7 +383,7 @@ public: Node *n = Yapf().GetBestNode(); TileIndex depot_tile = n->m_segment_last_tile; assert(IsRoadDepotTile(depot_tile)); - Depot* ret = GetDepotByTile(depot_tile); + Depot *ret = GetDepotByTile(depot_tile); return ret; } }; @@ -444,7 +444,7 @@ uint YapfRoadVehDistanceToTile(const Vehicle *v, TileIndex tile) return dist; } -Depot* YapfFindNearestRoadDepot(const Vehicle *v) +Depot *YapfFindNearestRoadDepot(const Vehicle *v) { TileIndex tile = v->tile; Trackdir trackdir = GetVehicleTrackdir(v); @@ -458,13 +458,13 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v) } // default is YAPF type 2 - typedef Depot* (*PfnFindNearestDepot)(const Vehicle*, TileIndex, Trackdir); + typedef Depot *(*PfnFindNearestDepot)(const Vehicle*, TileIndex, Trackdir); PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot; // check if non-default YAPF type should be used if (_settings_game.pf.yapf.disable_node_optimization) pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg - Depot* ret = pfnFindNearestDepot(v, tile, trackdir); + Depot *ret = pfnFindNearestDepot(v, tile, trackdir); return ret; } diff --git a/src/yapf/yapf_ship.cpp b/src/yapf/yapf_ship.cpp index 9c935388f..6f75cba17 100644 --- a/src/yapf/yapf_ship.cpp +++ b/src/yapf/yapf_ship.cpp @@ -65,10 +65,10 @@ public: Trackdir next_trackdir = INVALID_TRACKDIR; // this would mean "path not found" - Node* pNode = pf.GetBestNode(); + Node *pNode = pf.GetBestNode(); if (pNode != NULL) { // walk through the path back to the origin - Node* pPrevNode = NULL; + Node *pPrevNode = NULL; while (pNode->m_parent != NULL) { pPrevNode = pNode; pNode = pNode->m_parent; |