diff --git a/aircraft_gui.c b/aircraft_gui.c index 486214fa6d..31d9a181f2 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -32,7 +32,7 @@ void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number) { const AircraftVehicleInfo *avi = AircraftVehInfo(engine_number); - const Engine* e = GetEngine(engine_number); + const Engine *e = GetEngine(engine_number); CargoID cargo; YearMonthDay ymd; ConvertDayToYMD(&ymd, e->intro_date); @@ -93,7 +93,7 @@ static void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selectio void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2) { if (success) { - const Vehicle* v = GetVehicle(_new_vehicle_id); + const Vehicle *v = GetVehicle(_new_vehicle_id); if (v->tile == _backup_orders_tile) { _backup_orders_tile = 0; @@ -127,7 +127,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e) EngineID eid; for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) { - const AircraftVehicleInfo* avi; + const AircraftVehicleInfo *avi; if (!HASBIT(GetEngine(eid)->player_avail, _local_player)) continue; @@ -150,7 +150,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e) EngineID eid; for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) { - const AircraftVehicleInfo* avi; + const AircraftVehicleInfo *avi; if (!HASBIT(GetEngine(eid)->player_avail, _local_player)) continue; @@ -322,7 +322,7 @@ static const WindowDesc _aircraft_refit_desc = { AircraftRefitWndProc }; -static void ShowAircraftRefitWindow(const Vehicle* v) +static void ShowAircraftRefitWindow(const Vehicle *v) { Window *w; @@ -482,7 +482,7 @@ static const WindowDesc _aircraft_details_desc = { }; -static void ShowAircraftDetailsWindow(const Vehicle* v) +static void ShowAircraftDetailsWindow(const Vehicle *v) { Window *w; VehicleID veh = v->index; @@ -522,7 +522,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); uint32 disabled = 1 << 8; StringID str; @@ -576,7 +576,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) } break; case WE_CLICK: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); switch (e->click.widget) { case 5: /* start stop */ @@ -618,7 +618,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) break; case WE_MOUSELOOP: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); uint32 h = IsAircraftInHangarStopped(v) ? 1 << 7 : 1 << 11; if (h != w->hidden_state) { @@ -639,9 +639,9 @@ static const WindowDesc _aircraft_view_desc = { }; -void ShowAircraftViewWindow(const Vehicle* v) +void ShowAircraftViewWindow(const Vehicle *v) { - Window* w = AllocateWindowDescFront(&_aircraft_view_desc, v->index); + Window *w = AllocateWindowDescFront(&_aircraft_view_desc, v->index); if (w != NULL) { w->caption_color = v->owner; @@ -774,7 +774,7 @@ static void AircraftDepotClickAircraft(Window *w, int x, int y) * @param *v is the original vehicle to clone * @param *w is the window of the hangar where the clone is build */ -static void HandleCloneVehClick(const Vehicle* v, const Window* w) +static void HandleCloneVehClick(const Vehicle *v, const Window *w) { if (v == NULL || v->type != VEH_Aircraft) return; @@ -785,9 +785,9 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w) ResetObjectToPlace(); } -static void ClonePlaceObj(const Window* w) +static void ClonePlaceObj(const Window *w) { - const Vehicle* v = CheckMouseOverVehicle(); + const Vehicle *v = CheckMouseOverVehicle(); if (v != NULL) HandleCloneVehClick(v, w); } @@ -841,7 +841,7 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e) // check if a vehicle in a depot was clicked.. case WE_MOUSELOOP: { - const Vehicle* v = _place_clicked_vehicle; + const Vehicle *v = _place_clicked_vehicle; // since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button if (v != NULL && HASBIT(w->click_state, 8)) { @@ -943,7 +943,7 @@ void ShowAircraftDepotWindow(TileIndex tile) } } -static void DrawSmallOrderList(const Vehicle* v, int x, int y) +static void DrawSmallOrderList(const Vehicle *v, int x, int y) { const Order *order; int sel, i = 0; @@ -1088,7 +1088,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e) case 7: { /* Matrix to show vehicles */ uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG; - const Vehicle* v; + const Vehicle *v; if (id_v >= w->vscroll.cap) return; // click out of bounds diff --git a/airport.c b/airport.c index 6f8cb5ceb5..401e3ac5d9 100644 --- a/airport.c +++ b/airport.c @@ -9,16 +9,16 @@ #include "variables.h" #include "airport_movement.h" -static AirportFTAClass* CountryAirport; -static AirportFTAClass* CityAirport; -static AirportFTAClass* Oilrig; -static AirportFTAClass* Heliport; -static AirportFTAClass* MetropolitanAirport; -static AirportFTAClass* InternationalAirport; -static AirportFTAClass* CommuterAirport; -static AirportFTAClass* HeliDepot; -static AirportFTAClass* IntercontinentalAirport; -static AirportFTAClass* HeliStation; +static AirportFTAClass *CountryAirport; +static AirportFTAClass *CityAirport; +static AirportFTAClass *Oilrig; +static AirportFTAClass *Heliport; +static AirportFTAClass *MetropolitanAirport; +static AirportFTAClass *InternationalAirport; +static AirportFTAClass *CommuterAirport; +static AirportFTAClass *HeliDepot; +static AirportFTAClass *IntercontinentalAirport; +static AirportFTAClass *HeliStation; static void AirportFTAClass_Constructor(AirportFTAClass *Airport, const byte *terminals, const byte *helipads, @@ -201,7 +201,7 @@ static void AirportFTAClass_Constructor(AirportFTAClass *Airport, byte nofterminals, nofhelipads; byte nofterminalgroups = 0; byte nofhelipadgroups = 0; - const byte * curr; + const byte *curr; int i; nofterminals = nofhelipads = 0; @@ -329,7 +329,7 @@ static void AirportBuildAutomata(AirportFTAClass *Airport, const AirportFTAbuild // outgoing nodes from the same position, create linked list while (current->position == FA[internalcounter + 1].position) { - AirportFTA* newNode = malloc(sizeof(AirportFTA)); + AirportFTA *newNode = malloc(sizeof(AirportFTA)); newNode->position = FA[internalcounter + 1].position; newNode->heading = FA[internalcounter + 1].heading; @@ -444,7 +444,7 @@ static void AirportPrintOut(const AirportFTAClass *Airport, const bool full_repo } #endif -const AirportFTAClass* GetAirport(const byte airport_type) +const AirportFTAClass *GetAirport(const byte airport_type) { //FIXME -- AircraftNextAirportPos_and_Order -> Needs something nicer, don't like this code // needs constant change if more airports are added diff --git a/airport.h b/airport.h index a8ca84c1cc..19243e7d35 100644 --- a/airport.h +++ b/airport.h @@ -150,7 +150,7 @@ typedef struct AirportFTA { void InitializeAirports(void); void UnInitializeAirports(void); -const AirportFTAClass* GetAirport(const byte airport_type); +const AirportFTAClass *GetAirport(const byte airport_type); const AirportMovingData *GetAirportMovingData(byte airport_type, byte position); /** Get buildable airport bitmask. diff --git a/airport_gui.c b/airport_gui.c index e150cf6d61..08fe9bbd37 100644 --- a/airport_gui.c +++ b/airport_gui.c @@ -146,7 +146,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) int sel; int rad = 4; // default catchment radious uint32 avail_airports; - const AirportFTAClass* airport; + const AirportFTAClass *airport; if (WP(w,def_d).close) return; diff --git a/aystar.c b/aystar.c index a45e662853..e540a881a3 100644 --- a/aystar.c +++ b/aystar.c @@ -25,24 +25,24 @@ 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); } // This adds a node to the ClosedList // It makes a copy of the data -static void AyStarMain_ClosedList_Add(AyStar* aystar, const PathNode* node) +static void AyStarMain_ClosedList_Add(AyStar *aystar, const PathNode *node) { // Add a node to the ClosedList - PathNode* new_node = malloc(sizeof(*new_node)); + PathNode *new_node = malloc(sizeof(*new_node)); *new_node = *node; Hash_Set(&aystar->ClosedListHash, node->node.tile, node->node.direction, new_node); } // Checks if a node is in the OpenList // If so, it returns the OpenListNode, else NULL -static OpenListNode* AyStarMain_OpenList_IsInList(AyStar* aystar, const AyStarNode* node) +static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, const AyStarNode *node) { return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction); } @@ -53,7 +53,7 @@ static OpenListNode* AyStarMain_OpenList_IsInList(AyStar* aystar, const AyStarNo static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar) { // Return the item the Queue returns.. the best next OpenList item. - OpenListNode* res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue); + OpenListNode *res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue); if (res != NULL) { Hash_Delete(&aystar->OpenListHash, res->path.node.tile, res->path.node.direction); } @@ -63,10 +63,10 @@ static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar) // Adds a node to the OpenList // It makes a copy of node, and puts the pointer of parent in the struct -static void AyStarMain_OpenList_Add(AyStar* aystar, PathNode* parent, const AyStarNode* node, int f, int g) +static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, const AyStarNode *node, int f, int g) { // Add a new Node to the OpenList - OpenListNode* new_node = malloc(sizeof(*new_node)); + OpenListNode *new_node = malloc(sizeof(*new_node)); new_node->g = g; new_node->path.parent = parent; new_node->path.node = *node; @@ -81,7 +81,7 @@ static void AyStarMain_OpenList_Add(AyStar* aystar, PathNode* parent, const AySt * return values: * AYSTAR_DONE : indicates we are done */ -int AyStarMain_CheckTile(AyStar* aystar, AyStarNode* current, OpenListNode* parent) +int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent) { int new_f, new_g, new_h; PathNode *closedlist_parent; @@ -147,7 +147,7 @@ int AyStarMain_CheckTile(AyStar* aystar, AyStarNode* current, OpenListNode* pare * AYSTAR_FOUND_END_NODE : indicates we found the end. Path_found now is true, and in path is the path found. * AYSTAR_STILL_BUSY : indicates we have done this tile, did not found the path yet, and have items left to try. */ -int AyStarMain_Loop(AyStar* aystar) +int AyStarMain_Loop(AyStar *aystar) { int i, r; @@ -191,7 +191,7 @@ int AyStarMain_Loop(AyStar* aystar) /* * This function frees the memory it allocated */ -void AyStarMain_Free(AyStar* aystar) +void AyStarMain_Free(AyStar *aystar) { aystar->OpenListQueue.free(&aystar->OpenListQueue, false); /* 2nd argument above is false, below is true, to free the values only @@ -207,7 +207,7 @@ void AyStarMain_Free(AyStar* aystar) * This function make the memory go back to zero * This function should be called when you are using the same instance again. */ -void AyStarMain_Clear(AyStar* aystar) +void AyStarMain_Clear(AyStar *aystar) { // Clean the Queue, but not the elements within. That will be done by // the hash. @@ -266,7 +266,7 @@ int AyStarMain_Main(AyStar *aystar) { * clear() automatically when the algorithm finishes * g is the cost for starting with this node. */ -void AyStarMain_AddStartNode(AyStar* aystar, AyStarNode* start_node, uint g) +void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g) { #ifdef AYSTAR_DEBUG printf("[AyStar] Starting A* Algorithm from node (%d, %d, %d)\n", @@ -275,7 +275,7 @@ void AyStarMain_AddStartNode(AyStar* aystar, AyStarNode* start_node, uint g) AyStarMain_OpenList_Add(aystar, NULL, start_node, 0, g); } -void init_AyStar(AyStar* aystar, Hash_HashProc hash, uint num_buckets) +void init_AyStar(AyStar *aystar, Hash_HashProc hash, uint num_buckets) { // Allocated the Hash for the OpenList and ClosedList init_Hash(&aystar->OpenListHash, hash, num_buckets); diff --git a/aystar.h b/aystar.h index 6b2594033c..fed4213ecc 100644 --- a/aystar.h +++ b/aystar.h @@ -99,7 +99,7 @@ typedef void AyStar_GetNeighbours(AyStar *aystar, OpenListNode *current); typedef void AyStar_FoundEndNode(AyStar *aystar, OpenListNode *current); // For internal use, see aystar.c -typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode* start_node, uint g); +typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g); typedef int AyStar_Main(AyStar *aystar); typedef int AyStar_Loop(AyStar *aystar); typedef int AyStar_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent); @@ -112,11 +112,11 @@ struct AyStar { /* These should point to the application specific routines that do the * actual work */ - AyStar_CalculateG* CalculateG; - AyStar_CalculateH* CalculateH; - AyStar_GetNeighbours* GetNeighbours; - AyStar_EndNodeCheck* EndNodeCheck; - AyStar_FoundEndNode* FoundEndNode; + AyStar_CalculateG *CalculateG; + AyStar_CalculateH *CalculateH; + AyStar_GetNeighbours *GetNeighbours; + AyStar_EndNodeCheck *EndNodeCheck; + AyStar_FoundEndNode *FoundEndNode; /* These are completely untouched by AyStar, they can be accesed by * the application specific routines to input and output data. @@ -144,12 +144,12 @@ struct AyStar { /* These will contain the methods for manipulating the AyStar. Only * main() should be called externally */ - AyStar_AddStartNode* addstart; - AyStar_Main* main; - AyStar_Loop* loop; - AyStar_Free* free; - AyStar_Clear* clear; - AyStar_CheckTile* checktile; + AyStar_AddStartNode *addstart; + AyStar_Main *main; + AyStar_Loop *loop; + AyStar_Free *free; + AyStar_Clear *clear; + AyStar_CheckTile *checktile; /* These will contain the open and closed lists */ @@ -173,7 +173,7 @@ void AyStarMain_Clear(AyStar *aystar); /* Initialize an AyStar. You should fill all appropriate fields before * callling init_AyStar (see the declaration of AyStar for which fields are * internal */ -void init_AyStar(AyStar* aystar, Hash_HashProc hash, uint num_buckets); +void init_AyStar(AyStar *aystar, Hash_HashProc hash, uint num_buckets); #endif /* AYSTAR_H */ diff --git a/console.c b/console.c index 216e875b09..550b72a1c4 100644 --- a/console.c +++ b/console.c @@ -59,11 +59,11 @@ static void IConsoleClearCommand(void) static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;} -static void IConsoleHistoryAdd(const char* cmd); +static void IConsoleHistoryAdd(const char *cmd); static void IConsoleHistoryNavigate(int direction); // ** console window ** // -static void IConsoleWndProc(Window* w, WindowEvent* e) +static void IConsoleWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: { @@ -255,7 +255,7 @@ static void IConsoleClear(void) IConsoleClearBuffer(); } -static void IConsoleWriteToLogFile(const char* string) +static void IConsoleWriteToLogFile(const char *string) { if (_iconsole_output_file != NULL) { // if there is an console output file ... also print it there @@ -331,7 +331,7 @@ void IConsoleOpen(void) {if (_iconsole_mode == ICONSOLE_CLOSED) IConsoleSwitch( * scroll, etc. Put it to the beginning as it is the latest text * @param cmd Text to be entered into the 'history' */ -static void IConsoleHistoryAdd(const char* cmd) +static void IConsoleHistoryAdd(const char *cmd) { free(_iconsole_history[ICON_HISTORY_SIZE - 1]); @@ -376,7 +376,7 @@ static void IConsoleHistoryNavigate(int direction) * @param color_code the colour of the command. Red in case of errors, etc. * @param string the message entered or output on the console (notice, error, etc.) */ -void IConsolePrint(uint16 color_code, const char* string) +void IConsolePrint(uint16 color_code, const char *string) { #ifdef ENABLE_NETWORK if (_redirect_console_to_client != 0) { @@ -433,7 +433,7 @@ void CDECL IConsolePrintF(uint16 color_code, const char *s, ...) * @debug() in debug.c. You need at least a level 2 (developer) for debugging * messages to show up */ -void IConsoleDebug(const char* string) +void IConsoleDebug(const char *string) { if (_stdlib_developer > 1) IConsolePrintF(_icolour_dbg, "dbg: %s", string); @@ -444,7 +444,7 @@ void IConsoleDebug(const char* string) * errors or mishaps, but non-fatal. You need at least a level 1 (developer) for * debugging messages to show up */ -void IConsoleWarning(const char* string) +void IConsoleWarning(const char *string) { if (_stdlib_developer > 0) IConsolePrintF(_icolour_warn, "WARNING: %s", string); @@ -454,7 +454,7 @@ void IConsoleWarning(const char* string) * It is possible to print error information to the console. This can include * game errors, or errors in general you would want the user to notice */ -void IConsoleError(const char* string) +void IConsoleError(const char *string) { IConsolePrintF(_icolour_err, "ERROR: %s", string); } @@ -693,7 +693,7 @@ static inline int IConsoleCopyInParams(char *dst, const char *src, uint bufpos) * @param tokencount the number of parameters passed * @param *tokens are the parameters given to the original command (0 is the first param) */ -static void IConsoleAliasExec(const IConsoleAlias* alias, byte tokencount, char* tokens[ICON_TOKEN_COUNT]) +static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens[ICON_TOKEN_COUNT]) { const char *cmdptr; char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE]; @@ -859,7 +859,7 @@ static void IConsoleVarSetValue(const IConsoleVar *var, uint32 value) * @param *var the variable in question * @param *value the new value */ -static void IConsoleVarSetStringvalue(const IConsoleVar* var, const char* value) +static void IConsoleVarSetStringvalue(const IConsoleVar *var, const char *value) { if (var->type != ICONSOLE_VAR_STRING || var->addr == NULL) return; diff --git a/elrail.c b/elrail.c index 75f77c0891..e1ab24ec81 100644 --- a/elrail.c +++ b/elrail.c @@ -126,7 +126,7 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override) * @param tile The tile to analyse * @param *tileh the tileh */ -static void AdjustTileh(TileIndex tile, Slope* tileh) +static void AdjustTileh(TileIndex tile, Slope *tileh) { if (IsTileType(tile, MP_TUNNELBRIDGE)) { if (IsTunnel(tile)) { diff --git a/engine.c b/engine.c index 76502e3503..1d66b89ffa 100644 --- a/engine.c +++ b/engine.c @@ -240,7 +240,7 @@ void EnginesDailyLoop(void) if (_cur_year >= 130) return; for (i = 0; i != lengthof(_engines); i++) { - Engine* e = &_engines[i]; + Engine *e = &_engines[i]; if (e->flags & ENGINE_INTRODUCING) { if (e->flags & ENGINE_PREVIEWING) { @@ -489,7 +489,7 @@ static EngineRenew *AllocateEngineRenew(void) * engine type from the given renewlist */ static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine) { - EngineRenew* er = (EngineRenew*)erl; /* Fetch first element */ + EngineRenew *er = (EngineRenew*)erl; /* Fetch first element */ while (er) { if (er->from == engine) return er; er = er->next; @@ -497,9 +497,9 @@ static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine) return NULL; } -void RemoveAllEngineReplacement(EngineRenewList* erl) +void RemoveAllEngineReplacement(EngineRenewList *erl) { - EngineRenew* er = (EngineRenew*)(*erl); /* Fetch first element */ + EngineRenew *er = (EngineRenew*)(*erl); /* Fetch first element */ while (er) { er->from = INVALID_ENGINE; /* "Deallocate" all elements */ er = er->next; @@ -513,7 +513,7 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine) return er == NULL ? INVALID_ENGINE : er->to; } -int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, uint32 flags) +int32 AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, uint32 flags) { EngineRenew *er; @@ -538,10 +538,10 @@ int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID n return 0; } -int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, uint32 flags) +int32 RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, uint32 flags) { - EngineRenew* er = (EngineRenew*)(*erl); /* Start at the first element */ - EngineRenew* prev = NULL; + EngineRenew *er = (EngineRenew*)(*erl); /* Start at the first element */ + EngineRenew *prev = NULL; while (er) { diff --git a/gfx.c b/gfx.c index b8f594b445..028feaa425 100644 --- a/gfx.c +++ b/gfx.c @@ -677,8 +677,8 @@ void DrawSprite(uint32 img, int x, int y) typedef struct BlitterParams { int start_x, start_y; - const byte* sprite; - const byte* sprite_org; + const byte *sprite; + const byte *sprite_org; Pixel *dst; int mode; int width, height; @@ -690,12 +690,12 @@ typedef struct BlitterParams { static void GfxBlitTileZoomIn(BlitterParams *bp) { - const byte* src_o = bp->sprite; - const byte* src; + const byte *src_o = bp->sprite; + const byte *src; int num, skip; byte done; Pixel *dst; - const byte* ctab; + const byte *ctab; if (bp->mode & 1) { src_o += ReadLE16Aligned(src_o + bp->start_y * 2); @@ -892,12 +892,12 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp) static void GfxBlitTileZoomMedium(BlitterParams *bp) { - const byte* src_o = bp->sprite; - const byte* src; + const byte *src_o = bp->sprite; + const byte *src; int num, skip; byte done; Pixel *dst; - const byte* ctab; + const byte *ctab; if (bp->mode & 1) { src_o += ReadLE16Aligned(src_o + bp->start_y * 2); @@ -1097,12 +1097,12 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp) static void GfxBlitTileZoomOut(BlitterParams *bp) { - const byte* src_o = bp->sprite; - const byte* src; + const byte *src_o = bp->sprite; + const byte *src; int num, skip; byte done; Pixel *dst; - const byte* ctab; + const byte *ctab; if (bp->mode & 1) { src_o += ReadLE16Aligned(src_o + bp->start_y * 2); @@ -1313,7 +1313,7 @@ static void GfxBlitTileZoomOut(BlitterParams *bp) static void GfxBlitZoomOutUncomp(BlitterParams *bp) { - const byte* src = bp->sprite; + const byte *src = bp->sprite; Pixel *dst = bp->dst; int height = bp->height; int width = bp->width; @@ -1361,9 +1361,9 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp) typedef void (*BlitZoomFunc)(BlitterParams *bp); -static void GfxMainBlitter(const Sprite* sprite, int x, int y, int mode) +static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode) { - const DrawPixelInfo* dpi = _cur_dpi; + const DrawPixelInfo *dpi = _cur_dpi; int start_x, start_y; byte info; BlitterParams bp; @@ -1496,8 +1496,8 @@ void GfxInitPalettes(void) void DoPaletteAnimations(void) { - const Colour* s; - Colour* d; + const Colour *s; + Colour *d; /* Amount of colors to be rotated. * A few more for the DOS palette, because the water colors are * 245-254 for DOS and 217-226 for Windows. */ @@ -1712,7 +1712,7 @@ void DrawMouseCursor(void) static void DbgScreenRect(int left, int top, int right, int bottom) { DrawPixelInfo dp; - DrawPixelInfo* old; + DrawPixelInfo *old; old = _cur_dpi; _cur_dpi = &dp; @@ -1864,7 +1864,7 @@ void MarkWholeScreenDirty(void) SetDirtyBlocks(0, 0, _screen.width, _screen.height); } -bool FillDrawPixelInfo(DrawPixelInfo* n, const DrawPixelInfo* o, int left, int top, int width, int height) +bool FillDrawPixelInfo(DrawPixelInfo *n, const DrawPixelInfo *o, int left, int top, int width, int height) { int t; diff --git a/gui.h b/gui.h index c6102a6739..cb7c20af97 100644 --- a/gui.h +++ b/gui.h @@ -41,9 +41,9 @@ void PlaceProc_BuyLand(TileIndex tile); /* train_gui.c */ void ShowPlayerTrains(PlayerID player, StationID station); void ShowTrainViewWindow(const Vehicle *v); -void ShowOrdersWindow(const Vehicle* v); +void ShowOrdersWindow(const Vehicle *v); -void ShowRoadVehViewWindow(const Vehicle* v); +void ShowRoadVehViewWindow(const Vehicle *v); /* road_gui.c */ void ShowBuildRoadToolbar(void); @@ -54,7 +54,7 @@ void ShowPlayerRoadVehicles(PlayerID player, StationID station); void ShowBuildDocksToolbar(void); void ShowPlayerShips(PlayerID player, StationID station); -void ShowShipViewWindow(const Vehicle* v); +void ShowShipViewWindow(const Vehicle *v); /* aircraft_gui.c */ void ShowBuildAirToolbar(void); @@ -93,7 +93,7 @@ void ShowEstimatedCostOrIncome(int32 cost, int x, int y); void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y); void DrawStationCoverageAreaText(int sx, int sy, uint mask,int rad); -void CheckRedrawStationCoverage(const Window* w); +void CheckRedrawStationCoverage(const Window *w); void ShowSmallMap(void); void ShowExtraViewPortWindow(void); @@ -134,7 +134,7 @@ enum { ZOOM_NONE = 2, // hack, used to update the button status }; -bool DoZoomInOutWindow(int how, Window * w); +bool DoZoomInOutWindow(int how, Window *w); void ShowBuildIndustryWindow(void); void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number); void ShowMusicWindow(void); diff --git a/industry_gui.c b/industry_gui.c index 597a018b7d..5d55ecf67f 100644 --- a/industry_gui.c +++ b/industry_gui.c @@ -279,7 +279,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_PAINT: { - const Industry* i = GetIndustry(w->window_number); + const Industry *i = GetIndustry(w->window_number); SetDParam(0, w->window_number); DrawWindowWidgets(w); @@ -433,7 +433,7 @@ static const WindowDesc _industry_view_desc = { void ShowIndustryViewWindow(int industry) { - Window* w = AllocateWindowDescFront(&_industry_view_desc, industry); + Window *w = AllocateWindowDescFront(&_industry_view_desc, industry); if (w != NULL) { w->flags4 |= WF_DISABLE_VP_SCROLL; @@ -571,7 +571,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) n = 0; while (p < _num_industry_sort) { - const Industry* i = GetIndustry(_industry_sort[p]); + const Industry *i = GetIndustry(_industry_sort[p]); SetDParam(0, i->index); if (i->produced_cargo[0] != CT_INVALID) { @@ -658,7 +658,7 @@ static const WindowDesc _industry_directory_desc = { void ShowIndustryDirectory(void) { - Window* w = AllocateWindowDescFront(&_industry_directory_desc, 0); + Window *w = AllocateWindowDescFront(&_industry_directory_desc, 0); if (w != NULL) { w->vscroll.cap = 16; diff --git a/intro_gui.c b/intro_gui.c index 9c415d0d85..f674dbb26c 100644 --- a/intro_gui.c +++ b/intro_gui.c @@ -156,7 +156,7 @@ static const Widget _ask_abandon_game_widgets[] = { { WIDGETS_END }, }; -static void AskAbandonGameWndProc(Window* w, WindowEvent* e) +static void AskAbandonGameWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: @@ -220,7 +220,7 @@ static const Widget _ask_quit_game_widgets[] = { { WIDGETS_END }, }; -static void AskQuitGameWndProc(Window* w, WindowEvent* e) +static void AskQuitGameWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: diff --git a/main_gui.c b/main_gui.c index 3e63d41449..8a23a7203f 100644 --- a/main_gui.c +++ b/main_gui.c @@ -537,7 +537,7 @@ static const Widget _player_menu_widgets[] = { static int GetPlayerIndexFromMenu(int index) { if (index >= 0) { - const Player* p; + const Player *p; FOR_ALL_PLAYERS(p) { if (p->is_active && --index < 0) return p->index; @@ -549,7 +549,7 @@ static int GetPlayerIndexFromMenu(int index) static void UpdatePlayerMenuHeight(Window *w) { uint num = 0; - const Player* p; + const Player *p; FOR_ALL_PLAYERS(p) { if (p->is_active) num++; @@ -786,7 +786,7 @@ static void ToolbarIndustryClick(Window *w) static void ToolbarTrainClick(Window *w) { - const Vehicle* v; + const Vehicle *v; int dis = -1; FOR_ALL_VEHICLES(v) { @@ -797,7 +797,7 @@ static void ToolbarTrainClick(Window *w) static void ToolbarRoadClick(Window *w) { - const Vehicle* v; + const Vehicle *v; int dis = -1; FOR_ALL_VEHICLES(v) { @@ -808,7 +808,7 @@ static void ToolbarRoadClick(Window *w) static void ToolbarShipClick(Window *w) { - const Vehicle* v; + const Vehicle *v; int dis = -1; FOR_ALL_VEHICLES(v) { @@ -819,7 +819,7 @@ static void ToolbarShipClick(Window *w) static void ToolbarAirClick(Window *w) { - const Vehicle* v; + const Vehicle *v; int dis = -1; FOR_ALL_VEHICLES(v) { @@ -869,7 +869,7 @@ bool DoZoomInOutWindow(int how, Window *w) // routine to disable/enable the zoom buttons. Didn't know where to place these otherwise { - Window* wt = NULL; + Window *wt = NULL; switch (w->window_class) { case WC_MAIN_WINDOW: @@ -920,7 +920,7 @@ static void ToolbarZoomOutClick(Window *w) static void ToolbarBuildRailClick(Window *w) { - const Player* p = GetPlayer(_local_player); + const Player *p = GetPlayer(_local_player); Window *w2; w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, RAILTYPE_END, ~p->avail_railtypes); WP(w2,menu_d).sel_index = _last_built_railtype; @@ -1032,7 +1032,7 @@ static void ToolbarScenZoomOut(Window *w) void ZoomInOrOutToCursorWindow(bool in, Window *w) { - ViewPort * vp; + ViewPort *vp; Point pt; assert(w != 0); @@ -1629,7 +1629,7 @@ static const Widget _scenedit_industry_candy_widgets[] = { static bool AnyTownExists(void) { - const Town* t; + const Town *t; FOR_ALL_TOWNS(t) { if (t->xy != 0) return true; @@ -1809,7 +1809,7 @@ static void ToolbarBtn_NULL(Window *w) typedef void ToolbarButtonProc(Window *w); -static ToolbarButtonProc* const _toolbar_button_procs[] = { +static ToolbarButtonProc * const _toolbar_button_procs[] = { ToolbarPauseClick, ToolbarFastForwardClick, ToolbarOptionsClick, @@ -2016,7 +2016,7 @@ static const Widget _toolb_scen_widgets[] = { {WIDGETS_END}, }; -static ToolbarButtonProc* const _scen_toolbar_button_procs[] = { +static ToolbarButtonProc * const _scen_toolbar_button_procs[] = { ToolbarPauseClick, ToolbarFastForwardClick, ToolbarOptionsClick, @@ -2274,7 +2274,7 @@ static WindowDesc _main_status_desc = { extern void UpdateAllStationVirtCoord(void); -static void MainWindowWndProc(Window* w, WindowEvent* e) +static void MainWindowWndProc(Window *w, WindowEvent *e) { int off_x; @@ -2392,7 +2392,7 @@ void SetupColorsAndInitialWindow(void) int width,height; for (i = 0; i != 16; i++) { - const byte* b = GetNonSprite(PALETTE_RECOLOR_START + i); + const byte *b = GetNonSprite(PALETTE_RECOLOR_START + i); assert(b); _color_list[i] = *(const ColorList*)(b + 0xC6); diff --git a/misc_gui.c b/misc_gui.c index 2189f3842c..d17a8aa90f 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -43,7 +43,7 @@ typedef struct LandInfoData { static void LandInfoWndProc(Window *w, WindowEvent *e) { if (e->event == WE_PAINT) { - const LandInfoData* lid; + const LandInfoData *lid; StringID str; int i; @@ -488,7 +488,7 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e) _errmsg_message_1, 238); } else { - const Player* p = GetPlayer(GetDParamX(_errmsg_decode_params,2)); + const Player *p = GetPlayer(GetDParamX(_errmsg_decode_params,2)); DrawPlayerFace(p->face, p->player_color, 2, 16); DrawStringMultiCenter( @@ -718,7 +718,7 @@ void DrawStationCoverageAreaText(int sx, int sy, uint mask, int rad) { } } -void CheckRedrawStationCoverage(const Window* w) +void CheckRedrawStationCoverage(const Window *w) { if (_thd.dirty & 1) { _thd.dirty &= ~1; @@ -1197,9 +1197,9 @@ static void MakeSortedSaveGameList(void) uint s_amount; int i; - /* Directories are always above the files (FIOS_TYPE_DIR) - * Drives (A:\ (windows only) are always under the files (FIOS_TYPE_DRIVE) - * Only sort savegames/scenarios, not directories + /* Directories are always above the files (FIOS_TYPE_DIR) + * Drives (A:\ (windows only) are always under the files (FIOS_TYPE_DRIVE) + * Only sort savegames/scenarios, not directories */ for (i = 0; i < _fios_num; i++) { switch (_fios_list[i].type) { @@ -1218,7 +1218,7 @@ static void GenerateFileName(void) { /* Check if we are not a specatator who wants to generate a name.. Let's use the name of player #0 for now. */ - const Player* p = GetPlayer(_local_player < MAX_PLAYERS ? _local_player : 0); + const Player *p = GetPlayer(_local_player < MAX_PLAYERS ? _local_player : 0); SetDParam(0, p->name_1); SetDParam(1, p->name_2); @@ -1274,7 +1274,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) y = w->widget[7].top + 1; for (pos = w->vscroll.pos; pos < _fios_num; pos++) { - const FiosItem* item = _fios_list + pos; + const FiosItem *item = _fios_list + pos; DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], w->width - 18); y += 10; @@ -1503,7 +1503,7 @@ static const Widget _select_scenario_widgets[] = { { WIDGETS_END}, }; -static void SelectScenarioWndProc(Window* w, WindowEvent* e) +static void SelectScenarioWndProc(Window *w, WindowEvent *e) { const int list_start = 45; @@ -1560,7 +1560,7 @@ static void SelectScenarioWndProc(Window* w, WindowEvent* e) GenRandomNewGame(Random(), InteractiveRandom()); } else { int y = (e->click.pt.y - list_start) / 10; - const char* name; + const char *name; const FiosItem *file; if (y < 0 || (y += w->vscroll.pos) >= w->vscroll.count) return; diff --git a/network_gui.c b/network_gui.c index ea7d78f906..c5e0aa3560 100644 --- a/network_gui.c +++ b/network_gui.c @@ -100,7 +100,7 @@ enum { // called when a new server is found on the network void UpdateNetworkGameWindow(bool unselect) { - Window* w = FindWindowById(WC_NETWORK_WINDOW, 0); + Window *w = FindWindowById(WC_NETWORK_WINDOW, 0); if (w != NULL) { if (unselect) WP(w, network_ql_d).n.server = NULL; @@ -183,7 +183,7 @@ static void BuildNetworkGameList(network_ql_d *nqld) static void SortNetworkGameList(network_ql_d *nqld) { - static NGameNameSortFunction* const ngame_sorter[] = { + static NGameNameSortFunction * const ngame_sorter[] = { &NGameNameSorter, &NGameClientSorter, &NGameAllowedSorter @@ -564,7 +564,7 @@ void ShowNetworkGameWindow(void) w = AllocateWindowDesc(&_network_game_window_desc); if (w != NULL) { - querystr_d* querystr = &WP(w, network_ql_d).q; + querystr_d *querystr = &WP(w, network_ql_d).q; ttd_strlcpy(_edit_str_buf, _network_player_name, lengthof(_edit_str_buf)); w->vscroll.cap = 12; @@ -1052,9 +1052,9 @@ static WindowDesc _client_list_desc = { }; // Finds the Xth client-info that is active -static const NetworkClientInfo* NetworkFindClientInfo(byte client_no) +static const NetworkClientInfo *NetworkFindClientInfo(byte client_no) { - const NetworkClientInfo* ci; + const NetworkClientInfo *ci; for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) { // Skip non-active items @@ -1174,7 +1174,7 @@ static uint ClientListPopupHeigth(void) { static Window *PopupClientList(Window *w, int client_no, int x, int y) { int i, h; - const NetworkClientInfo* ci; + const NetworkClientInfo *ci; DeleteWindowById(WC_TOOLBAR_MENU, 0); // Clean the current actions @@ -1476,7 +1476,7 @@ static byte _chat_type; static byte _chat_dest; -static void SendChat(const char* buf) +static void SendChat(const char *buf) { if (buf[0] == '\0') return; if (!_network_server) { diff --git a/news_gui.c b/news_gui.c index 0b27ad2ade..4258c32569 100644 --- a/news_gui.c +++ b/news_gui.c @@ -459,7 +459,7 @@ static void MoveToNexItem(void) switch (GetNewsDisplayValue(ni->type)) { case 0: { /* Off - show nothing only a small reminder in the status bar */ - Window* w = FindWindowById(WC_STATUS_BAR, 0); + Window *w = FindWindowById(WC_STATUS_BAR, 0); if (w != NULL) { WP(w, def_d).data_2 = 91; @@ -866,7 +866,7 @@ void DeleteVehicleNews(VehicleID vid, StringID news) if (ni->flags & NF_VEHICLE && ni->data_a == vid && (news == INVALID_STRING_ID || ni->string_id == news)) { - Window* w; + Window *w; byte i; if (_forced_news == n) MoveToNexItem(); diff --git a/openttd.c b/openttd.c index b8ec455175..f1352ae19e 100644 --- a/openttd.c +++ b/openttd.c @@ -68,7 +68,7 @@ extern void ShowOSErrorBox(const char *buf); * caused by the user, i.e. missing files or fatal configuration errors. * Post-0.4.0 since Celestar doesn't want this in SVN before. --pasky */ -void CDECL error(const char* s, ...) +void CDECL error(const char *s, ...) { va_list va; char buf[512]; @@ -230,7 +230,7 @@ md_continue_here:; } -static void ParseResolution(int res[2], const char* s) +static void ParseResolution(int res[2], const char *s) { char *t = strchr(s, 'x'); if (t == NULL) { @@ -310,7 +310,7 @@ static void LoadIntroGame(void) extern void DedicatedFork(void); #endif -int ttd_main(int argc, char* argv[]) +int ttd_main(int argc, char *argv[]) { MyGetOptData mgo; int i; @@ -1001,7 +1001,7 @@ void GameLoop(void) void BeforeSaveGame(void) { - const Window* w = FindWindowById(WC_MAIN_WINDOW, 0); + const Window *w = FindWindowById(WC_MAIN_WINDOW, 0); if (w != NULL) { _saved_scrollpos_x = WP(w, const vp_d).scrollpos_x; @@ -1034,7 +1034,7 @@ static void ConvertTownOwner(void) // before savegame version 4, the name of the company determined if it existed static void CheckIsPlayerActive(void) { - Player* p; + Player *p; FOR_ALL_PLAYERS(p) { if (p->name_1 != 0) p->is_active = true; @@ -1044,7 +1044,7 @@ static void CheckIsPlayerActive(void) // since savegame version 4.1, exclusive transport rights are stored at towns static void UpdateExclusiveRights(void) { - Town* t; + Town *t; FOR_ALL_TOWNS(t) { if (t->xy != 0) t->exclusivity = (byte)-1; @@ -1264,13 +1264,13 @@ bool AfterLoadGame(void) /* Elrails got added in rev 24 */ if (CheckSavegameVersion(24)) { - Vehicle* v; + Vehicle *v; uint i; TileIndex t; RailType min_rail = RAILTYPE_ELECTRIC; for (i = 0; i < lengthof(_engines); i++) { - Engine* e = GetEngine(i); + Engine *e = GetEngine(i); if (e->type == VEH_Train && (e->railtype != RAILTYPE_RAIL || RailVehInfo(i)->engclass == 2)) { e->railtype++; diff --git a/order_gui.c b/order_gui.c index e7425ad631..c5f38fc3d5 100644 --- a/order_gui.c +++ b/order_gui.c @@ -22,9 +22,9 @@ #include "train.h" #include "water_map.h" -static int OrderGetSel(const Window* w) +static int OrderGetSel(const Window *w) { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); int num = WP(w,order_d).sel; return (num >= 0 && num < v->num_orders) ? num : v->num_orders; @@ -94,27 +94,27 @@ static void DrawOrdersWindow(Window *w) break; case OT_GOTO_DEPOT: - SETBIT(w->disabled_state, 9); /* unload */ + SETBIT(w->disabled_state, 9); /* unload */ SETBIT(w->disabled_state, 10); /* transfer */ SetDParam(2,STR_SERVICE); break; case OT_GOTO_WAYPOINT: - SETBIT(w->disabled_state, 8); /* full load */ - SETBIT(w->disabled_state, 9); /* unload */ + SETBIT(w->disabled_state, 8); /* full load */ + SETBIT(w->disabled_state, 9); /* unload */ SETBIT(w->disabled_state, 10); /* transfer */ break; default: - SETBIT(w->disabled_state, 6); /* nonstop */ - SETBIT(w->disabled_state, 8); /* full load */ - SETBIT(w->disabled_state, 9); /* unload */ + SETBIT(w->disabled_state, 6); /* nonstop */ + SETBIT(w->disabled_state, 8); /* full load */ + SETBIT(w->disabled_state, 9); /* unload */ } } else { - SETBIT(w->disabled_state, 6); /* nonstop */ - SETBIT(w->disabled_state, 8); /* full load */ - SETBIT(w->disabled_state, 9); /* unload */ - SETBIT(w->disabled_state, 10); /* transfer */ + SETBIT(w->disabled_state, 6); /* nonstop */ + SETBIT(w->disabled_state, 8); /* full load */ + SETBIT(w->disabled_state, 9); /* unload */ + SETBIT(w->disabled_state, 10); /* transfer */ } SetDParam(0, v->string_id); @@ -259,7 +259,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) if (IsTileType(tile, MP_STATION)) { StationID st_index = GetStationIndex(tile); - const Station* st = GetStation(st_index); + const Station *st = GetStation(st_index); if (st->owner == _current_player || st->owner == OWNER_NONE) { byte facil; @@ -284,7 +284,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) return order; } -static bool HandleOrderVehClick(const Vehicle* v, const Vehicle* u, Window* w) +static bool HandleOrderVehClick(const Vehicle *v, const Vehicle *u, Window *w) { if (u->type != v->type) return false; @@ -306,10 +306,10 @@ static bool HandleOrderVehClick(const Vehicle* v, const Vehicle* u, Window* w) return true; } -static void OrdersPlaceObj(const Vehicle* v, TileIndex tile, Window* w) +static void OrdersPlaceObj(const Vehicle *v, TileIndex tile, Window *w) { Order cmd; - const Vehicle* u; + const Vehicle *u; // check if we're clicking on a vehicle first.. clone orders in that case. u = CheckMouseOverVehicle(); @@ -324,7 +324,7 @@ static void OrdersPlaceObj(const Vehicle* v, TileIndex tile, Window* w) } } -static void OrderClick_Goto(Window* w, const Vehicle* v) +static void OrderClick_Goto(Window *w, const Vehicle *v) { InvalidateWidget(w, 7); TOGGLEBIT(w->click_state, 7); @@ -336,17 +336,17 @@ static void OrderClick_Goto(Window* w, const Vehicle* v) } } -static void OrderClick_FullLoad(Window* w, const Vehicle* v) +static void OrderClick_FullLoad(Window *w, const Vehicle *v) { DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_FULL_LOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); } -static void OrderClick_Unload(Window* w, const Vehicle* v) +static void OrderClick_Unload(Window *w, const Vehicle *v) { DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_UNLOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); } -static void OrderClick_Nonstop(Window* w, const Vehicle* v) +static void OrderClick_Nonstop(Window *w, const Vehicle *v) { DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_NON_STOP, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); } @@ -356,19 +356,19 @@ static void OrderClick_Transfer(Window* w, const Vehicle* v) DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); } -static void OrderClick_Skip(Window* w, const Vehicle* v) +static void OrderClick_Skip(Window *w, const Vehicle *v) { DoCommandP(v->tile, v->index, 0, NULL, CMD_SKIP_ORDER); } -static void OrderClick_Delete(Window* w, const Vehicle* v) +static void OrderClick_Delete(Window *w, const Vehicle *v) { DoCommandP(v->tile, v->index, OrderGetSel(w), NULL, CMD_DELETE_ORDER | CMD_MSG(STR_8834_CAN_T_DELETE_THIS_ORDER)); } -typedef void OnButtonClick(Window* w, const Vehicle* v); +typedef void OnButtonVehClick(Window *w, const Vehicle *v); -static OnButtonClick* const _order_button_proc[] = { +static OnButtonVehClick* const _order_button_proc[] = { OrderClick_Skip, OrderClick_Delete, OrderClick_Nonstop, @@ -469,7 +469,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) } case WE_RCLICK: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); int s = OrderGetSel(w); if (e->click.widget != 8) break; @@ -491,7 +491,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e) // check if a vehicle in a depot was clicked.. case WE_MOUSELOOP: { - const Vehicle* v = _place_clicked_vehicle; + const Vehicle *v = _place_clicked_vehicle; /* * Check if we clicked on a vehicle * and if the GOTO button of this window is pressed @@ -587,7 +587,7 @@ static const WindowDesc _other_orders_desc = { OrdersWndProc }; -void ShowOrdersWindow(const Vehicle* v) +void ShowOrdersWindow(const Vehicle *v) { Window *w; VehicleID veh = v->index; diff --git a/player_gui.c b/player_gui.c index c3deebf986..ed1b46c155 100644 --- a/player_gui.c +++ b/player_gui.c @@ -151,7 +151,7 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e) switch (e->event) { case WE_PAINT: { PlayerID player = w->window_number; - const Player* p = GetPlayer(player); + const Player *p = GetPlayer(player); w->disabled_state = p->current_loan != 0 ? 0 : (1 << 7); @@ -248,7 +248,7 @@ static void SelectPlayerColorWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: { - const Player* p; + const Player *p; uint used_colors = 0; int num_free = 16; int x,y,pos; @@ -421,7 +421,7 @@ static void DrawPlayerVehiclesAmount(PlayerID player) { const int x = 110; int y = 72; - const Vehicle* v; + const Vehicle *v; uint train = 0; uint road = 0; uint air = 0; @@ -479,7 +479,7 @@ int GetAmountOwnedBy(const Player *p, PlayerID owner) static void DrawCompanyOwnerText(const Player *p) { - const Player* p2; + const Player *p2; int num = -1; FOR_ALL_PLAYERS(p2) { @@ -502,7 +502,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: { - const Player* p = GetPlayer(w->window_number); + const Player *p = GetPlayer(w->window_number); uint32 dis = 0; if (!IsWindowOfPrototype(w, _other_player_company_widgets)) { @@ -577,7 +577,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) } break; case 5: {/* change president name */ - const Player* p = GetPlayer(w->window_number); + const Player *p = GetPlayer(w->window_number); WP(w, def_d).byte_1 = 0; SetDParam(0, p->president_name_2); ShowQueryString(p->president_name_1, STR_700B_PRESIDENT_S_NAME, 31, 94, w->window_class, w->window_number); @@ -686,7 +686,7 @@ static const WindowDesc _other_player_company_desc = { void ShowPlayerCompany(PlayerID player) { - Window* w; + Window *w; w = AllocateWindowDescFront(player == _local_player ? &_my_player_company_desc : &_other_player_company_desc, player); if (w != NULL) w->caption_color = w->window_number; diff --git a/rail_gui.c b/rail_gui.c index 1b48db6b8c..68979d80fe 100644 --- a/rail_gui.c +++ b/rail_gui.c @@ -555,7 +555,7 @@ typedef enum { * @param railtype the railtype to display * @param w the window to modify */ -static void SetupRailToolbar(RailType railtype, Window* w) +static void SetupRailToolbar(RailType railtype, Window *w) { const RailtypeInfo *rti = GetRailTypeInfo(railtype); diff --git a/road_gui.c b/road_gui.c index 8613916fb6..fc16e46fd6 100644 --- a/road_gui.c +++ b/road_gui.c @@ -179,7 +179,7 @@ static OnButtonClick* const _build_road_button_proc[] = { BuildRoadClick_Landscaping, }; -static void BuildRoadToolbWndProc(Window* w, WindowEvent* e) +static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: @@ -346,7 +346,7 @@ void ShowBuildRoadScenToolbar(void) AllocateWindowDescFront(&_build_road_scen_desc, 0); } -static void BuildRoadDepotWndProc(Window* w, WindowEvent* e) +static void BuildRoadDepotWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: diff --git a/roadveh_gui.c b/roadveh_gui.c index df50282e33..b1434844cf 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -29,7 +29,7 @@ void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number) { const RoadVehicleInfo *rvi = RoadVehInfo(engine_number); - const Engine* e = GetEngine(engine_number); + const Engine *e = GetEngine(engine_number); bool refittable = (_engine_info[engine_number].refit_mask != 0); YearMonthDay ymd; ConvertDayToYMD(&ymd, e->intro_date); @@ -286,7 +286,7 @@ static const WindowDesc _roadveh_details_desc = { RoadVehDetailsWndProc }; -static void ShowRoadVehDetailsWindow(const Vehicle* v) +static void ShowRoadVehDetailsWindow(const Vehicle *v) { Window *w; VehicleID veh = v->index; @@ -365,7 +365,7 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) } break; case WE_CLICK: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); switch (e->click.widget) { case 5: /* start stop */ @@ -410,7 +410,7 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) case WE_MOUSELOOP: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); uint32 h = IsRoadVehInDepotStopped(v) ? 1 << 7 | 1 << 8 : 1 << 11 | 1 << 12; if (h != w->hidden_state) { @@ -448,9 +448,9 @@ static const WindowDesc _roadveh_view_desc = { RoadVehViewWndProc, }; -void ShowRoadVehViewWindow(const Vehicle* v) +void ShowRoadVehViewWindow(const Vehicle *v) { - Window* w = AllocateWindowDescFront(&_roadveh_view_desc, v->index); + Window *w = AllocateWindowDescFront(&_roadveh_view_desc, v->index); if (w != NULL) { w->caption_color = v->owner; @@ -468,7 +468,7 @@ static void DrawNewRoadVehWindow(Window *w) { int count = 0; int num = NUM_ROAD_ENGINES; - const Engine* e = GetEngine(ROAD_ENGINES_INDEX); + const Engine *e = GetEngine(ROAD_ENGINES_INDEX); do { if (HASBIT(e->player_avail, _local_player)) @@ -481,7 +481,7 @@ static void DrawNewRoadVehWindow(Window *w) { int num = NUM_ROAD_ENGINES; - const Engine* e = GetEngine(ROAD_ENGINES_INDEX); + const Engine *e = GetEngine(ROAD_ENGINES_INDEX); int x = 1; int y = 15; int sel = WP(w,buildtrain_d).sel_index; @@ -510,7 +510,7 @@ static void DrawNewRoadVehWindow(Window *w) void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2) { - const Vehicle* v; + const Vehicle *v; if (!success) return; @@ -735,7 +735,7 @@ static void RoadDepotClickVeh(Window *w, int x, int y) * @param *v is the original vehicle to clone * @param *w is the window of the depot where the clone is build */ -static void HandleCloneVehClick(const Vehicle* v, const Window* w) +static void HandleCloneVehClick(const Vehicle *v, const Window *w) { if (v == NULL || v->type != VEH_Road) return; @@ -746,9 +746,9 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w) ResetObjectToPlace(); } -static void ClonePlaceObj(const Window* w) +static void ClonePlaceObj(const Window *w) { - const Vehicle* v = CheckMouseOverVehicle(); + const Vehicle *v = CheckMouseOverVehicle(); if (v != NULL) HandleCloneVehClick(v, w); } @@ -801,7 +801,7 @@ static void RoadDepotWndProc(Window *w, WindowEvent *e) // check if a vehicle in a depot was clicked.. case WE_MOUSELOOP: { - const Vehicle* v = _place_clicked_vehicle; + const Vehicle *v = _place_clicked_vehicle; // since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button if (v != NULL && HASBIT(w->click_state, 8)) { @@ -891,7 +891,7 @@ static const WindowDesc _road_depot_desc = { void ShowRoadDepotWindow(TileIndex tile) { - Window* w = AllocateWindowDescFront(&_road_depot_desc, tile); + Window *w = AllocateWindowDescFront(&_road_depot_desc, tile); if (w != NULL) { w->caption_color = GetTileOwner(w->window_number); @@ -960,7 +960,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e) /* draw the widgets */ if (station == INVALID_STATION) { - const Player* p = GetPlayer(owner); + const Player *p = GetPlayer(owner); /* Company Name -- (###) Road vehicles */ SetDParam(0, p->name_1); @@ -1024,7 +1024,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e) return; case 7: { /* Matrix to show vehicles */ uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_SMALL; - const Vehicle* v; + const Vehicle *v; if (id_v >= w->vscroll.cap) return; // click out of bounds diff --git a/ship_gui.c b/ship_gui.c index ed58849efd..93cd990f13 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -30,7 +30,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number) { YearMonthDay ymd; const ShipVehicleInfo *svi = ShipVehInfo(engine_number); - const Engine* e; + const Engine *e; /* Purchase cost - Max speed */ SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5); @@ -138,7 +138,7 @@ static const WindowDesc _ship_refit_desc = { ShipRefitWndProc, }; -static void ShowShipRefitWindow(const Vehicle* v) +static void ShowShipRefitWindow(const Vehicle *v) { Window *w; @@ -282,7 +282,7 @@ static const WindowDesc _ship_details_desc = { ShipDetailsWndProc }; -static void ShowShipDetailsWindow(const Vehicle* v) +static void ShowShipDetailsWindow(const Vehicle *v) { Window *w; VehicleID veh = v->index; @@ -297,7 +297,7 @@ static void ShowShipDetailsWindow(const Vehicle* v) void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2) { - const Vehicle* v; + const Vehicle *v; if (!success) return; v = GetVehicle(_new_vehicle_id); @@ -323,7 +323,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e) { int count = 0; int num = NUM_SHIP_ENGINES; - const Engine* e = GetEngine(SHIP_ENGINES_INDEX); + const Engine *e = GetEngine(SHIP_ENGINES_INDEX); do { if (HASBIT(e->player_avail, _local_player)) count++; @@ -335,7 +335,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e) { int num = NUM_SHIP_ENGINES; - const Engine* e = GetEngine(SHIP_ENGINES_INDEX); + const Engine *e = GetEngine(SHIP_ENGINES_INDEX); int x = 2; int y = 15; int sel = WP(w,buildtrain_d).sel_index; @@ -448,7 +448,7 @@ static void ShowBuildShipWindow(TileIndex tile) } -static void ShipViewWndProc(Window* w, WindowEvent* e) +static void ShipViewWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: { @@ -511,7 +511,7 @@ static void ShipViewWndProc(Window* w, WindowEvent* e) } break; case WE_CLICK: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); switch (e->click.widget) { case 5: /* start stop */ @@ -554,7 +554,7 @@ static void ShipViewWndProc(Window* w, WindowEvent* e) case WE_MOUSELOOP: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); uint32 h = IsShipInDepot(v) ? 1 << 7 : 1 << 11; if (h != w->hidden_state) { @@ -591,9 +591,9 @@ static const WindowDesc _ship_view_desc = { ShipViewWndProc }; -void ShowShipViewWindow(const Vehicle* v) +void ShowShipViewWindow(const Vehicle *v) { - Window* w = AllocateWindowDescFront(&_ship_view_desc, v->index); + Window *w = AllocateWindowDescFront(&_ship_view_desc, v->index); if (w != NULL) { w->caption_color = v->owner; @@ -722,7 +722,7 @@ static void ShipDepotClick(Window *w, int x, int y) * @param *v is the original vehicle to clone * @param *w is the window of the depot where the clone is build */ -static void HandleCloneVehClick(const Vehicle* v, const Window* w) +static void HandleCloneVehClick(const Vehicle *v, const Window *w) { if (v == NULL || v->type != VEH_Ship) return; @@ -733,14 +733,14 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w) ResetObjectToPlace(); } -static void ClonePlaceObj(const Window* w) +static void ClonePlaceObj(const Window *w) { - const Vehicle* v = CheckMouseOverVehicle(); + const Vehicle *v = CheckMouseOverVehicle(); if (v != NULL) HandleCloneVehClick(v, w); } -static void ShipDepotWndProc(Window* w, WindowEvent* e) +static void ShipDepotWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_PAINT: @@ -788,7 +788,7 @@ static void ShipDepotWndProc(Window* w, WindowEvent* e) // check if a vehicle in a depot was clicked.. case WE_MOUSELOOP: { - const Vehicle* v = _place_clicked_vehicle; + const Vehicle *v = _place_clicked_vehicle; // since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button if (v != NULL && HASBIT(w->click_state, 8)) { @@ -875,7 +875,7 @@ static const WindowDesc _ship_depot_desc = { void ShowShipDepotWindow(TileIndex tile) { - Window* w = AllocateWindowDescFront(&_ship_depot_desc,tile); + Window *w = AllocateWindowDescFront(&_ship_depot_desc,tile); if (w != NULL) { w->caption_color = GetTileOwner(w->window_number); @@ -889,7 +889,7 @@ void ShowShipDepotWindow(TileIndex tile) } -static void DrawSmallOrderList(const Vehicle* v, int x, int y) +static void DrawSmallOrderList(const Vehicle *v, int x, int y) { const Order *order; int sel, i = 0; @@ -1035,7 +1035,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e) return; case 7: { /* Matrix to show vehicles */ uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG; - const Vehicle* v; + const Vehicle *v; if (id_v >= w->vscroll.cap) return; // click out of bounds diff --git a/smallmap_gui.c b/smallmap_gui.c index 700532cacf..7e71e77aeb 100644 --- a/smallmap_gui.c +++ b/smallmap_gui.c @@ -216,7 +216,7 @@ static const uint16 * const _legend_table[] = { } /* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */ - static inline void WRITE_PIXELS_OR(Pixel* d, uint32 val) + static inline void WRITE_PIXELS_OR(Pixel *d, uint32 val) { # if defined(TTD_BIG_ENDIAN) d[0] |= GB(val, 24, 8); @@ -262,7 +262,7 @@ typedef struct AndOr { uint32 mand; } AndOr; -static inline uint32 ApplyMask(uint32 colour, const AndOr* mask) +static inline uint32 ApplyMask(uint32 colour, const AndOr *mask) { return (colour & mask->mand) | mask->mor; } @@ -605,7 +605,7 @@ static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_town /* setup owner table */ if (type == 5) { - const Player* p; + const Player *p; /* fill with some special colors */ _owner_colors[OWNER_TOWN] = MKCOLOR(0xB4B4B4B4); @@ -672,7 +672,7 @@ static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_town reps = (dpi->height - y + 1) / 2; if (reps > 0) { // assert(ptr >= dpi->dst_ptr); - DrawSmallMapStuff(ptr, tile_x, tile_y, dpi->pitch*2, reps, mask, _smallmap_draw_procs[type]); + DrawSmallMapStuff(ptr, tile_x, tile_y, dpi->pitch * 2, reps, mask, _smallmap_draw_procs[type]); } skip_column: @@ -963,7 +963,7 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e) } break; case 8: { /* inverse location button (move this view to same spot as main view) 'Copy Location' */ - const Window* w2 = FindWindowById(WC_MAIN_WINDOW, 0); + const Window *w2 = FindWindowById(WC_MAIN_WINDOW, 0); int x = WP(w2, const vp_d).scrollpos_x; int y = WP(w2, const vp_d).scrollpos_y; diff --git a/sound.c b/sound.c index 3e26ebb65a..c3eacd685f 100644 --- a/sound.c +++ b/sound.c @@ -20,7 +20,7 @@ typedef struct FileEntry { } FileEntry; static uint _file_count; -static FileEntry* _files; +static FileEntry *_files; #define SOUND_SLOT 63 // Number of levels of panning per side @@ -29,7 +29,7 @@ static FileEntry* _files; static void OpenBankFile(const char *filename) { - FileEntry* fe; + FileEntry *fe; uint count; uint i; @@ -102,8 +102,8 @@ static void OpenBankFile(const char *filename) static bool SetBankSource(MixerChannel *mc, uint bank) { - const FileEntry* fe; - int8* mem; + const FileEntry *fe; + int8 *mem; uint i; if (bank >= _file_count) return false; @@ -136,7 +136,7 @@ bool SoundInitialize(const char *filename) // Low level sound player static void StartSound(uint sound, int panning, uint volume) { - MixerChannel* mc; + MixerChannel *mc; uint left_vol, right_vol; if (volume == 0) return; @@ -182,7 +182,7 @@ static const byte _sound_idx[] = { static void SndPlayScreenCoordFx(SoundFx sound, int x, int y) { - const Window* w; + const Window *w; if (msf.effect_vol == 0) return; diff --git a/subsidy_gui.c b/subsidy_gui.c index ee7609b430..018980fd95 100644 --- a/subsidy_gui.c +++ b/subsidy_gui.c @@ -15,7 +15,7 @@ static void HandleSubsidyClick(int y) { - const Subsidy* s; + const Subsidy *s; uint num; int offs; TileIndex xy; @@ -73,10 +73,10 @@ handle_click: } } -static void DrawSubsidiesWindow(const Window* w) +static void DrawSubsidiesWindow(const Window *w) { YearMonthDay ymd; - const Subsidy* s; + const Subsidy *s; uint num; int x; int y; @@ -116,7 +116,7 @@ static void DrawSubsidiesWindow(const Window* w) for (s = _subsidies; s != endof(_subsidies); s++) { if (s->cargo_type != CT_INVALID && s->age >= 12) { - const Player* p; + const Player *p; int xt; SetupSubsidyDecodeParam(s, 1); diff --git a/town_gui.c b/town_gui.c index 6512c42fcc..8fe0dc1ab9 100644 --- a/town_gui.c +++ b/town_gui.c @@ -110,7 +110,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) { int y; - const Player* p; + const Player *p; int r; StringID str; @@ -219,7 +219,7 @@ static const WindowDesc _town_authority_desc = { static void ShowTownAuthorityWindow(uint town) { - Window* w = AllocateWindowDescFront(&_town_authority_desc, town); + Window *w = AllocateWindowDescFront(&_town_authority_desc, town); if (w != NULL) { w->vscroll.cap = 5; @@ -442,7 +442,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e) DoDrawString(_town_sort_order & 1 ? DOWNARROW : UPARROW, (_town_sort_order <= 1) ? 88 : 187, 15, 0x10); { - const Town* t; + const Town *t; int n = 0; uint16 i = w->vscroll.pos; int y = 28; @@ -489,7 +489,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e) if (id_v >= _num_town_sort) return; // click out of town bounds { - const Town* t = GetTown(_town_sort[id_v]); + const Town *t = GetTown(_town_sort[id_v]); assert(t->xy); ScrollMainWindowToTile(t->xy); @@ -519,7 +519,7 @@ static const WindowDesc _town_directory_desc = { void ShowTownDirectory(void) { - Window* w = AllocateWindowDescFront(&_town_directory_desc, 0); + Window *w = AllocateWindowDescFront(&_town_directory_desc, 0); if (w != NULL) { w->vscroll.cap = 16; diff --git a/train_gui.c b/train_gui.c index 34e02a3b60..1a3542a2a5 100644 --- a/train_gui.c +++ b/train_gui.c @@ -30,7 +30,7 @@ void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number) { const RailVehicleInfo *rvi = RailVehInfo(engine_number); - const Engine* e = GetEngine(engine_number); + const Engine *e = GetEngine(engine_number); int multihead = (rvi->flags&RVI_MULTIHEAD?1:0); YearMonthDay ymd; ConvertDayToYMD(&ymd, e->intro_date); @@ -132,7 +132,7 @@ void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number) void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2) { - Vehicle *v,*found; + Vehicle *v, *found; if (!success) return; @@ -158,7 +158,7 @@ void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2) void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2) { - const Vehicle* v; + const Vehicle *v; if (!success) return; @@ -176,7 +176,7 @@ void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2) } static void engine_drawing_loop(int *x, int *y, int *pos, int *sel, - EngineID* selected_id, RailType railtype, byte show_max, bool is_engine) + EngineID *selected_id, RailType railtype, byte show_max, bool is_engine) { EngineID j; @@ -619,7 +619,7 @@ static void TrainDepotClickTrain(Window *w, int x, int y) * @param *v is the original vehicle to clone * @param *w is the window of the depot where the clone is build */ -static void HandleCloneVehClick(const Vehicle* v, const Window* w) +static void HandleCloneVehClick(const Vehicle *v, const Window *w) { if (v == NULL || v->type != VEH_Train) return; @@ -637,9 +637,9 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w) ResetObjectToPlace(); } -static void ClonePlaceObj(const Window* w) +static void ClonePlaceObj(const Window *w) { - Vehicle* v = CheckMouseOverVehicle(); + Vehicle *v = CheckMouseOverVehicle(); if (v != NULL) HandleCloneVehClick(v, w); } @@ -690,7 +690,7 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e) // check if a vehicle in a depot was clicked.. case WE_MOUSELOOP: { - const Vehicle* v = _place_clicked_vehicle; + const Vehicle *v = _place_clicked_vehicle; // since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button if (v != NULL && HASBIT(w->click_state, 9)) { @@ -914,7 +914,7 @@ static const Widget _train_view_widgets[] = { { WIDGETS_END } }; -static void ShowTrainDetailsWindow(const Vehicle* v); +static void ShowTrainDetailsWindow(const Vehicle *v); static void TrainViewWndProc(Window *w, WindowEvent *e) { @@ -1053,7 +1053,7 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) break; case WE_MOUSELOOP: { - const Vehicle* v = GetVehicle(w->window_number); + const Vehicle *v = GetVehicle(w->window_number); uint32 h; assert(v->type == VEH_Train); @@ -1076,9 +1076,9 @@ static const WindowDesc _train_view_desc = { TrainViewWndProc }; -void ShowTrainViewWindow(const Vehicle* v) +void ShowTrainViewWindow(const Vehicle *v) { - Window* w = AllocateWindowDescFront(&_train_view_desc,v->index); + Window *w = AllocateWindowDescFront(&_train_view_desc,v->index); if (w != NULL) { w->caption_color = v->owner; @@ -1341,7 +1341,7 @@ static const WindowDesc _train_details_desc = { }; -static void ShowTrainDetailsWindow(const Vehicle* v) +static void ShowTrainDetailsWindow(const Vehicle *v) { Window *w; VehicleID veh = v->index; @@ -1485,7 +1485,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e) case 7: { /* Matrix to show vehicles */ uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_SMALL; - const Vehicle* v; + const Vehicle *v; if (id_v >= w->vscroll.cap) return; // click out of bounds diff --git a/viewport.c b/viewport.c index c215d95f4d..6fc60d7fa3 100644 --- a/viewport.c +++ b/viewport.c @@ -215,7 +215,7 @@ static void DoSetViewportPosition(Window *w, int left, int top, int width, int h } } -static void SetViewportPosition(Window* w, int x, int y) +static void SetViewportPosition(Window *w, int x, int y) { ViewPort *vp = w->viewport; int old_left = vp->virtual_left; @@ -420,7 +420,7 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz, { ViewportDrawer *vd = _cur_vd; ParentSpriteToDraw *ps; - const Sprite* spr; + const Sprite *spr; Point pt; assert((image & SPRITE_MASK) < MAX_SPRITES); @@ -1018,7 +1018,7 @@ static void ViewportDrawTileSprites(TileSpriteToDraw *ts) } while (ts != NULL); } -static void ViewportSortParentSprites(ParentSpriteToDraw* psd[]) +static void ViewportSortParentSprites(ParentSpriteToDraw *psd[]) { while (*psd != NULL) { ParentSpriteToDraw* ps = *psd; @@ -1662,9 +1662,9 @@ static void SafeShowTrainViewWindow(const Vehicle* v) ShowTrainViewWindow(v); } -static void Nop(const Vehicle* v) {} +static void Nop(const Vehicle *v) {} -typedef void OnVehicleClickProc(const Vehicle* v); +typedef void OnVehicleClickProc(const Vehicle *v); static OnVehicleClickProc* const _on_vehicle_click_proc[] = { SafeShowTrainViewWindow, ShowRoadVehViewWindow, @@ -1676,7 +1676,7 @@ static OnVehicleClickProc* const _on_vehicle_click_proc[] = { void HandleViewportClicked(const ViewPort *vp, int x, int y) { - const Vehicle* v; + const Vehicle *v; if (CheckClickOnTown(vp, x, y)) return; if (CheckClickOnStation(vp, x, y)) return; @@ -1693,8 +1693,8 @@ void HandleViewportClicked(const ViewPort *vp, int x, int y) Vehicle *CheckMouseOverVehicle(void) { - const Window* w; - const ViewPort* vp; + const Window *w; + const ViewPort *vp; int x = _cursor.pos.x; int y = _cursor.pos.y; @@ -1737,7 +1737,7 @@ void PlaceObject(void) /* scrolls the viewport in a window to a given location */ -bool ScrollWindowTo(int x , int y, Window* w) +bool ScrollWindowTo(int x , int y, Window *w) { Point pt; diff --git a/water_cmd.c b/water_cmd.c index 1b691757f7..ca23cc84fb 100644 --- a/water_cmd.c +++ b/water_cmd.c @@ -479,7 +479,7 @@ void DrawShipDepotSprite(int x, int y, int image) } -static uint GetSlopeZ_Water(const TileInfo* ti) +static uint GetSlopeZ_Water(const TileInfo *ti) { return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z; } @@ -610,7 +610,7 @@ static void FloodVehicle(Vehicle *v) v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast RebuildVehicleLists(); } else if (v->type == VEH_Train) { - Vehicle* u; + Vehicle *u; v = GetFirstVehicleInChain(v); u = v; @@ -747,7 +747,7 @@ const TileTypeProcs _tile_type_water_procs = { ClearTile_Water, /* clear_tile_proc */ GetAcceptedCargo_Water, /* get_accepted_cargo_proc */ GetTileDesc_Water, /* get_tile_desc_proc */ - GetTileTrackStatus_Water, /* get_tile_track_status_proc */ + GetTileTrackStatus_Water,/* get_tile_track_status_proc */ ClickTile_Water, /* click_tile_proc */ AnimateTile_Water, /* animate_tile_proc */ TileLoop_Water, /* tile_loop_clear */ diff --git a/window.c b/window.c index 84b0c5639d..b003bd06da 100644 --- a/window.c +++ b/window.c @@ -24,10 +24,10 @@ void HandleButtonClick(Window *w, byte widget) } -static Window* StartWindowDrag(Window* w); -static Window* StartWindowSizing(Window* w); +static Window *StartWindowDrag(Window *w); +static Window *StartWindowSizing(Window *w); -static void DispatchLeftClickEvent(Window* w, int x, int y) +static void DispatchLeftClickEvent(Window *w, int x, int y) { WindowEvent e; const Widget *wi; @@ -86,7 +86,7 @@ static void DispatchLeftClickEvent(Window* w, int x, int y) w->wndproc(w, &e); } -static void DispatchRightClickEvent(Window* w, int x, int y) +static void DispatchRightClickEvent(Window *w, int x, int y) { WindowEvent e; @@ -114,7 +114,7 @@ static void DispatchRightClickEvent(Window* w, int x, int y) * @param widget the widget where the scrollwheel was used * @param wheel scroll up or down */ -static void DispatchMouseWheelEvent(Window* w, int widget, int wheel) +static void DispatchMouseWheelEvent(Window *w, int widget, int wheel) { const Widget *wi1, *wi2; Scrollbar *sb; @@ -142,7 +142,7 @@ static void DispatchMouseWheelEvent(Window* w, int widget, int wheel) } -static void DrawOverlappedWindow(Window* w, int left, int top, int right, int bottom); +static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom); void DrawOverlappedWindowForAll(int left, int top, int right, int bottom) { @@ -160,9 +160,9 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom) } } -static void DrawOverlappedWindow(Window* w, int left, int top, int right, int bottom) +static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom) { - const Window* v = w; + const Window *v = w; int x; while (++v != _last_window) { @@ -219,7 +219,7 @@ void CallWindowEventNP(Window *w, int event) w->wndproc(w, &e); } -void SetWindowDirty(const Window* w) +void SetWindowDirty(const Window *w) { if (w == NULL) return; SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height); @@ -293,7 +293,7 @@ void DeleteWindowByClass(WindowClass cls) } -static Window* BringWindowToFront(Window* w); +static Window *BringWindowToFront(Window *w); Window *BringWindowToFrontById(WindowClass cls, WindowNumber number) { @@ -320,7 +320,7 @@ static inline bool IsVitalWindow(const Window *w) * - New window, Chatbar (only if open) * @param w window that is put into the foreground */ -static Window* BringWindowToFront(Window* w) +static Window *BringWindowToFront(Window *w) { Window *v; Window temp; @@ -378,7 +378,7 @@ static Window *ForceFindDeletableWindow(void) } } -bool IsWindowOfPrototype(const Window* w, const Widget* widget) +bool IsWindowOfPrototype(const Window *w, const Widget *widget) { return (w->original_widget == widget); } @@ -390,7 +390,7 @@ void AssignWidgetToWindow(Window *w, const Widget *widget) if (widget != NULL) { uint index = 1; - const Widget* wi; + const Widget *wi; for (wi = widget; wi->type != WWT_LAST; wi++) index++; @@ -1070,7 +1070,7 @@ static bool HandleWindowDragging(void) return false; } -static Window* StartWindowDrag(Window* w) +static Window *StartWindowDrag(Window *w) { w->flags4 |= WF_DRAGGING; _dragging_window = true; @@ -1083,7 +1083,7 @@ static Window* StartWindowDrag(Window* w) return w; } -static Window* StartWindowSizing(Window* w) +static Window *StartWindowSizing(Window *w) { w->flags4 |= WF_SIZING; _dragging_window = true; @@ -1170,7 +1170,7 @@ stop_capt:; } if (w->window_class != WC_SMALLMAP) { - ViewPort* vp = IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y); + ViewPort *vp = IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y); if (vp == NULL) goto stop_capt; @@ -1282,7 +1282,7 @@ static Window *MaybeBringWindowToFront(Window *w) * @param wparam Specifies additional message-specific information * @param lparam Specifies additional message-specific information */ -static void SendWindowMessageW(Window* w, uint msg, uint wparam, uint lparam) +static void SendWindowMessageW(Window *w, uint msg, uint wparam, uint lparam) { WindowEvent e; @@ -1536,14 +1536,14 @@ int GetMenuItemIndex(const Window *w, int x, int y) void InvalidateWindow(WindowClass cls, WindowNumber number) { - const Window* w; + const Window *w; for (w = _windows; w != _last_window; w++) { if (w->window_class == cls && w->window_number == number) SetWindowDirty(w); } } -void InvalidateWidget(const Window* w, byte widget_index) +void InvalidateWidget(const Window *w, byte widget_index) { const Widget *wi = &w->widget[widget_index]; @@ -1555,7 +1555,7 @@ void InvalidateWidget(const Window* w, byte widget_index) void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index) { - const Window* w; + const Window *w; for (w = _windows; w != _last_window; w++) { if (w->window_class == cls && w->window_number == number) { @@ -1566,7 +1566,7 @@ void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_in void InvalidateWindowClasses(WindowClass cls) { - const Window* w; + const Window *w; for (w = _windows; w != _last_window; w++) { if (w->window_class == cls) SetWindowDirty(w); diff --git a/window.h b/window.h index 56997ad124..353e6bc124 100644 --- a/window.h +++ b/window.h @@ -249,7 +249,7 @@ typedef struct querystr_d { WindowClass wnd_class; WindowNumber wnd_num; Textbuf text; - const char* orig; + const char *orig; } querystr_d; #define WP(ptr,str) (*(str*)(ptr)->custom) @@ -301,11 +301,11 @@ struct Window { }; typedef struct { - byte item_count; /* follow_vehicle */ - byte sel_index; /* scrollpos_x */ - byte main_button; /* scrollpos_y */ + byte item_count; /* follow_vehicle */ + byte sel_index; /* scrollpos_x */ + byte main_button; /* scrollpos_y */ byte action_id; - StringID string_id; /* unk30 */ + StringID string_id; /* unk30 */ uint16 checked_items; /* unk32 */ byte disabled_items; } menu_d; @@ -556,7 +556,7 @@ enum WindowFlags { /* window.c */ void CallWindowEventNP(Window *w, int event); void CallWindowTickEvent(void); -void SetWindowDirty(const Window* w); +void SetWindowDirty(const Window *w); void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam); Window *FindWindowById(WindowClass cls, WindowNumber number); @@ -564,7 +564,7 @@ void DeleteWindow(Window *w); Window *BringWindowToFrontById(WindowClass cls, WindowNumber number); Window *FindWindowFromPt(int x, int y); -bool IsWindowOfPrototype(const Window* w, const Widget* widget); +bool IsWindowOfPrototype(const Window *w, const Widget *widget); void AssignWidgetToWindow(Window *w, const Widget *widget); Window *AllocateWindow( int x, @@ -586,7 +586,7 @@ void ResetWindowSystem(void); int GetMenuItemIndex(const Window *w, int x, int y); void InputLoop(void); void UpdateWindows(void); -void InvalidateWidget(const Window* w, byte widget_index); +void InvalidateWidget(const Window *w, byte widget_index); void GuiShowTooltips(StringID string_id);