diff --git a/airport_gui.c b/airport_gui.c index 107b493d9d..9c8fcb2f6c 100644 --- a/airport_gui.c +++ b/airport_gui.c @@ -203,7 +203,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) CheckRedrawStationCoverage(w); } break; - + case WE_DESTROY: ResetObjectToPlace(); break; diff --git a/console.c b/console.c index b1c2b4eebb..84bb97bcdb 100644 --- a/console.c +++ b/console.c @@ -1089,7 +1089,7 @@ void IConsoleCmdExec(const char* cmdstr) uint c; uint i; uint l; - + if (strlen(cmdstr) == 0) // only execute if there is something typed obviously return; diff --git a/dedicated.c b/dedicated.c index 414f2c394c..b05c3b5422 100644 --- a/dedicated.c +++ b/dedicated.c @@ -105,7 +105,7 @@ void WINAPI CheckForConsoleInput(void) void CreateWindowsConsoleThread(void) { /* Create event to signal when console input is ready */ - hEvent = CreateEvent(NULL, false, false, "keyboard input"); + hEvent = CreateEvent(NULL, false, false, "keyboard input"); hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CheckForConsoleInput, 0, 0, NULL); if (hThread == NULL) @@ -151,7 +151,7 @@ static void DedicatedVideoStop(void) #ifdef WIN32 CloseWindowsConsoleThread(); #endif - free(_dedicated_video_mem); + free(_dedicated_video_mem); } static void DedicatedVideoMakeDirty(int left, int top, int width, int height) {} @@ -183,7 +183,7 @@ static bool InputWaiting(void) { if (WaitForSingleObject(hEvent, 1) == WAIT_OBJECT_0) return true; - + return false; } #endif diff --git a/fileio.c b/fileio.c index 9808f00617..c9fee6ba48 100644 --- a/fileio.c +++ b/fileio.c @@ -87,7 +87,7 @@ void FioReadBlock(void *ptr, uint size) static inline void FioCloseFile(int slot) { if (_fio.handles[slot] != NULL) { - fclose(_fio.handles[slot]); + fclose(_fio.handles[slot]); _fio.handles[slot] = NULL; } } diff --git a/main_gui.c b/main_gui.c index 299ffbb48a..e4baf33a1d 100644 --- a/main_gui.c +++ b/main_gui.c @@ -121,7 +121,7 @@ void HandleOnEditText(WindowEvent *e) { * @param cursor How should the cursor image change? E.g. cursor with depot image in it * @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground * @param placeproc Procedure which will be called when someone clicks on the map - + * @return true if the button is clicked, false if it's unclicked */ diff --git a/namegen.c b/namegen.c index bac368e63a..17f6369537 100644 --- a/namegen.c +++ b/namegen.c @@ -13,7 +13,7 @@ static inline int32 SeedChanceBias(int shift_by, int max, uint32 seed, int bias) return SeedChance(shift_by, max + bias, seed) - bias; } -static void ReplaceWords(const char *org, const char *rep, char *buf) +static void ReplaceWords(const char *org, const char *rep, char *buf) { if (strncmp(buf, org, 4) == 0) strncpy(buf, rep, 4); } diff --git a/player_gui.c b/player_gui.c index 69948269fc..4e2b854665 100644 --- a/player_gui.c +++ b/player_gui.c @@ -927,5 +927,5 @@ void ShowEndGameChart(void) w->window_number = _opt.diff_level; WP(w, highscore_d).rank = SaveHighScoreValue(p); } - } + } } diff --git a/rail_cmd.c b/rail_cmd.c index d39d5185b0..2356de2180 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -1140,7 +1140,7 @@ int32 CmdRemoveSignals(int x, int y, uint32 flags, uint32 p1, uint32 p2) /* Do it? */ if (flags & DC_EXEC) { - + _map3_lo[tile] &= ~c; /* removed last signal from tile? */ @@ -1149,7 +1149,7 @@ int32 CmdRemoveSignals(int x, int y, uint32 flags, uint32 p1, uint32 p2) _map2[tile] &= ~0xF0; CLRBIT(_map3_hi[tile], 2); // remove any possible semaphores } - + SetSignalsOnBothDir(tile, track); MarkTileDirtyByTile(tile); @@ -1289,7 +1289,7 @@ regular_track:; return CMD_ERROR; cost += ret; }; - + m5 &= RAIL_BIT_MASK; if (flags & DC_EXEC) goto regular_track; diff --git a/road_gui.c b/road_gui.c index 046eb34f9f..ba17873f94 100644 --- a/road_gui.c +++ b/road_gui.c @@ -465,7 +465,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e) CheckRedrawStationCoverage(w); } break; - + case WE_DESTROY: ResetObjectToPlace(); break; diff --git a/train_cmd.c b/train_cmd.c index d862e21da1..debea41c8d 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -367,7 +367,7 @@ int32 EstimateTrainCost(const RailVehicleInfo *rvi) return (rvi->base_cost * (_price.build_railvehicle >> 3)) >> 5; } -void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool building) +void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool building) { u->direction = v->direction; u->owner = v->owner; @@ -387,7 +387,7 @@ void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool building) if (building) v->next = u; u->engine_type = v->engine_type; u->build_year = v->build_year; - if (building) + if (building) v->value = u->value = v->value >> 1; else u->value = v->value; @@ -2399,7 +2399,7 @@ static void HandleCrashedTrain(Vehicle *v) ChangeTrainDirRandomly(v); } - if (state >= 4440 && !(v->tick_counter&0x1F)) + if (state >= 4440 && !(v->tick_counter&0x1F)) DeleteLastWagon(v); } diff --git a/ttd.c b/ttd.c index 3ab4676a05..68b423d1d0 100644 --- a/ttd.c +++ b/ttd.c @@ -729,7 +729,7 @@ int ttd_main(int argc, char* argv[]) LoadIntroGame(); _switch_mode = SM_NONE; NetworkClientConnectGame(network_conn, rport); - } + } } #endif /* ENABLE_NETWORK */ diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index 0c7aba7580..156ea8a23c 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -817,8 +817,8 @@ static int32 ClearTile_TunnelBridge(uint tile, byte flags) { return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); return DoClearBridge(tile, flags); - } - + } + return CMD_ERROR; } diff --git a/vehicle.c b/vehicle.c index 2677b28172..bc230838c6 100644 --- a/vehicle.c +++ b/vehicle.c @@ -1361,20 +1361,20 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) settings, a vehicle can be replaced twice.. check if this is the situation here */ if (old_engine_type == new_engine_type && v->age == 0) return CMD_ERROR; - + if ( v->type == VEH_Train ) { u = GetLastVehicleInChain(v); if ( RailVehInfo(new_engine_type)->flags & RVI_MULTIHEAD ) build_cost = build_cost >> 1; //multiheaded engines have EstimateTrainCost() for both engines - + if ( old_engine_type != new_engine_type ) { - + // prevent that the rear engine can get replaced to something else than the front engine if ( v->u.rail.first_engine != 0xffff && RailVehInfo(old_engine_type)->flags & RVI_MULTIHEAD && RailVehInfo(old_engine_type)->flags ) { Vehicle *first = GetFirstVehicleInChain(v); if ( first->engine_type != new_engine_type ) return CMD_ERROR; } - + // checks if the engine is the first one if ( v->u.rail.first_engine == 0xffff ) { if ( RailVehInfo(new_engine_type)->flags & RVI_MULTIHEAD ) { @@ -1431,7 +1431,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - + if (v->engine_type != new_engine_type) { byte sprite = v->spritenum; byte cargo_type = v->cargo_type; @@ -1471,7 +1471,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) } else { v->cargo_type = rvi->cargo_type; } - + if ( rvi2->flags & RVI_MULTIHEAD && !(rvi->flags & RVI_MULTIHEAD) && v->index == first->index) { if (old_engine_type == u->engine_type ) { Vehicle *w; @@ -1482,11 +1482,11 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) DeleteVehicle(u); } } - + if ( rvi->flags & RVI_MULTIHEAD && rvi2->flags & RVI_MULTIHEAD && v->index == first->index ) { CmdReplaceVehicle(x, y, flags, u->index, p2); } - + if ( rvi->flags & RVI_MULTIHEAD && !(rvi2->flags & RVI_MULTIHEAD) && v->index == first->index ) { if ( old_engine_type != u->engine_type ) { Vehicle *w; @@ -1496,7 +1496,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) } } } - + // updates the id of the front engine in the other units, since the front engine just got a new engine_id // this is needed for wagon override if ( v->u.rail.first_engine == 0xffff && v->next != NULL ) { @@ -1505,7 +1505,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) veh->u.rail.first_engine = new_engine_type; } while ( (veh=veh->next) != NULL ); } - + break; } case VEH_Road: diff --git a/viewport.c b/viewport.c index a612b9b422..78ac0fda35 100644 --- a/viewport.c +++ b/viewport.c @@ -689,7 +689,7 @@ static void DrawTileSelection(const TileInfo *ti) diffx = myabs(TileX(start)-TileX(ti->tile)); diffy = myabs(TileY(start)-TileY(ti->tile)); - + side = myabs( diffx-diffy ); if(dir<2) side = 0; @@ -697,7 +697,7 @@ static void DrawTileSelection(const TileInfo *ti) if (thd->make_square_red) image |= 0x3048000; DrawSelectionSprite(image, ti); - } + } return; } @@ -1963,7 +1963,7 @@ void VpStartPreSizing(void) _special_mouse_mode = WSM_PRESIZE; } -/* returns information about the 2x1 piece to be build. +/* returns information about the 2x1 piece to be build. * The lower bits (0-3) are the track type. */ static byte Check2x1AutoRail(int mode) { @@ -2025,7 +2025,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth b = (Check2x1AutoRail(3)) | HT_LINE; else if (dx==-16) b = (Check2x1AutoRail(2)) | HT_LINE; - else + else b = HT_LINE | HT_DIR_X; y = thd->selstart.y; } else if (w == 16) { // Or Y direction? @@ -2033,7 +2033,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth b = (Check2x1AutoRail(1)) | HT_LINE; else if (dy==-16) // 2x1 other direction b = (Check2x1AutoRail(0)) | HT_LINE; - else + else b = HT_LINE | HT_DIR_Y; x = thd->selstart.x; } else if (w > h * 2) { // still count as x dir? @@ -2131,7 +2131,7 @@ void VpSelectTilesWithMethod(int x, int y, int method) thd->selend.y = y; } -// while dragging +// while dragging bool VpHandlePlaceSizingDrag(void) { Window *w; @@ -2160,7 +2160,7 @@ bool VpHandlePlaceSizingDrag(void) // mouse button released.. // keep the selected tool, but reset it to the original mode. _special_mouse_mode = WSM_NONE; - if (_thd.next_drawstyle == HT_RECT) + if (_thd.next_drawstyle == HT_RECT) _thd.place_mode = VHM_RECT; else if ((e.place.userdata & 0xF) == VPM_SIGNALDIRS) // some might call this a hack... -- Dominik _thd.place_mode = VHM_RECT; diff --git a/viewport.h b/viewport.h index 9065527e87..5681c82ad0 100644 --- a/viewport.h +++ b/viewport.h @@ -79,7 +79,7 @@ enum { HT_RAIL = 0x10, /* autorail (one piece) * (uses lower bits to indicate direction) */ - /* lower bits (used with HT_LINE and HT_RAIL): + /* lower bits (used with HT_LINE and HT_RAIL): * (see ASCII art in autorail.h for a visual interpretation) */ HT_DIR_X = 0, // X direction HT_DIR_Y = 1, // Y direction diff --git a/window.c b/window.c index 61353b9ab8..737f93ced1 100644 --- a/window.c +++ b/window.c @@ -52,8 +52,8 @@ void DispatchLeftClickEvent(Window *w, int x, int y) { if (e.click.widget == 0) { /* 'X' */ DeleteWindow(w); return; - } - + } + if (e.click.widget == 1) /* 'Title bar' */ StartWindowDrag(w); }