From a4035af3375825ae277f1363c5d814ee55b92d7c Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Fri, 5 Feb 2021 10:00:36 +0000 Subject: Codechange: Apply coding style (#8640) * Fix: Missing or needed spaces * Codechange: Remove space * Codechange: Remove space * Codechange: More missing spaces * Codechange: Missing spaces * Codechange: Remove space * Codechange: Remove space --- src/console_cmds.cpp | 8 ++++---- src/fontcache.cpp | 2 +- src/group_gui.cpp | 6 +++--- src/network/network_gui.cpp | 2 +- src/station_cmd.cpp | 6 +++--- src/town_cmd.cpp | 4 ++-- src/tree_cmd.cpp | 2 +- src/vehicle.cpp | 2 +- src/vehicle_gui.cpp | 1 - src/video/sdl2_v.cpp | 10 +++++----- src/viewport.cpp | 4 ++-- src/viewport_sprite_sorter_sse4.cpp | 4 ++-- 12 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 7dbd5658c..905a41c3e 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1255,7 +1255,7 @@ DEF_CONSOLE_CMD(ConReloadAI) } /* First kill the company of the AI, then start a new one. This should start the current AI again */ - DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0,CMD_COMPANY_CTRL); + DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL); DoCommandP(0, CCA_NEW_AI | company_id << 16, 0, CMD_COMPANY_CTRL); IConsolePrint(CC_DEFAULT, "AI reloaded."); @@ -2136,7 +2136,7 @@ static void ConDumpRoadTypes() grfs.emplace(grfid, grf); } IConsolePrintF(CC_DEFAULT, " %02u %s %c%c%c%c, Flags: %c%c%c%c%c, GRF: %08X, %s", - (uint) rt, + (uint)rt, RoadTypeIsTram(rt) ? "Tram" : "Road", rti->label >> 24, rti->label >> 16, rti->label >> 8, rti->label, HasBit(rti->flags, ROTF_CATENARY) ? 'c' : '-', @@ -2174,7 +2174,7 @@ static void ConDumpRailTypes() grfs.emplace(grfid, grf); } IConsolePrintF(CC_DEFAULT, " %02u %c%c%c%c, Flags: %c%c%c%c%c%c, GRF: %08X, %s", - (uint) rt, + (uint)rt, rti->label >> 24, rti->label >> 16, rti->label >> 8, rti->label, HasBit(rti->flags, RTF_CATENARY) ? 'c' : '-', HasBit(rti->flags, RTF_NO_LEVEL_CROSSING) ? 'l' : '-', @@ -2217,7 +2217,7 @@ static void ConDumpCargoTypes() grfs.emplace(grfid, grf); } IConsolePrintF(CC_DEFAULT, " %02u Bit: %2u, Label: %c%c%c%c, Callback mask: 0x%02X, Cargo class: %c%c%c%c%c%c%c%c%c%c%c, GRF: %08X, %s", - (uint) i, + (uint)i, spec->bitnum, spec->label >> 24, spec->label >> 16, spec->label >> 8, spec->label, spec->callback_mask, diff --git a/src/fontcache.cpp b/src/fontcache.cpp index ec336612a..0b2764aab 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -1008,7 +1008,7 @@ static void LoadWin32Font(FontSize fs) if (fontPath[0] != 0) { if (AddFontResourceEx(fontPath, FR_PRIVATE, 0) != 0) { /* Try a nice little undocumented function first for getting the internal font name. - * Some documentation is found at: http://www.undocprint.org/winspool/getfontresourceinfo */ + * Some documentation is found at: http://www.undocprint.org/winspool/getfontresourceinfo */ typedef BOOL(WINAPI * PFNGETFONTRESOURCEINFO)(LPCTSTR, LPDWORD, LPVOID, DWORD); #ifdef UNICODE static PFNGETFONTRESOURCEINFO GetFontResourceInfo = (PFNGETFONTRESOURCEINFO)GetProcAddress(GetModuleHandle(_T("Gdi32")), "GetFontResourceInfoW"); diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 2ab2a5b51..e711201a6 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -741,9 +741,9 @@ public: assert(vehgroup.NumVehicles() > 0); v = vehgroup.vehicles_begin[0]; /* - No VehicleClicked(v) support for now, because don't want - to enable any contextual actions except perhaps clicking/ctrl-clicking to clone orders. - */ + * No VehicleClicked(v) support for now, because don't want + * to enable any contextual actions except perhaps clicking/ctrl-clicking to clone orders. + */ break; } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 42915c410..eb7ff78b2 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -332,7 +332,7 @@ protected: if (r == 0) r = a->info.use_password - b->info.use_password; /* Finally sort on the number of clients of the server in reverse order. */ - return (r != 0) ? r < 0: !NGameClientSorter(a, b); + return (r != 0) ? r < 0 : !NGameClientSorter(a, b); } /** Sort the server list */ diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 7bd124f06..4077a7b8c 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -4036,7 +4036,7 @@ uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, Sourc first_station = st; continue; } - if (used_stations.empty()) { + if (used_stations.empty()) { used_stations.reserve(2); used_stations.emplace_back(std::make_pair(first_station, 0)); } @@ -4081,9 +4081,9 @@ uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, Sourc moving += p.second; } - /* If there is some cargo left due to rounding issues distribute it among the best rated stations. */ + /* If there is some cargo left due to rounding issues distribute it among the best rated stations. */ if (amount > moving) { - std::sort(used_stations.begin(), used_stations.end(), [type] (const StationInfo &a, const StationInfo &b) { + std::sort(used_stations.begin(), used_stations.end(), [type](const StationInfo &a, const StationInfo &b) { return b.first->goods[type].rating < a.first->goods[type].rating; }); diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 1aadd5927..c2d148a1a 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1117,7 +1117,7 @@ static bool GrowTownWithRoad(const Town *t, TileIndex tile, RoadBits rcmd) * @param road_dir The direction of the road * @return true if the road can be continued, else false */ -static bool CanRoadContinueIntoNextTile(const Town* t, const TileIndex tile, const DiagDirection road_dir) +static bool CanRoadContinueIntoNextTile(const Town *t, const TileIndex tile, const DiagDirection road_dir) { const int delta = TileOffsByDiagDir(road_dir); // +1 tile in the direction of the road TileIndex next_tile = tile + delta; // The tile beyond which must be connectable to the target tile @@ -1236,7 +1236,7 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi * @param tunnel_dir The valid direction in which to grow a tunnel * @return true if a tunnel has been built, else false */ -static bool GrowTownWithTunnel(const Town* t, const TileIndex tile, const DiagDirection tunnel_dir) +static bool GrowTownWithTunnel(const Town *t, const TileIndex tile, const DiagDirection tunnel_dir) { assert(tunnel_dir < DIAGDIR_END); diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index f4610b569..dee79e1b7 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -762,7 +762,7 @@ static void TileLoop_Trees(TileIndex tile) break; case 6: // final stage of tree destruction - if (!CanPlantExtraTrees(tile)) { + if (!CanPlantExtraTrees(tile)) { /* if trees can't spread just plant a new one to prevent deforestation */ SetTreeGrowth(tile, 0); } else if (GetTreeCount(tile) > 1) { diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 21d02f181..3bec19080 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1179,7 +1179,7 @@ void ViewportAddVehicles(DrawPixelInfo *dpi) t <= v->coord.bottom && r >= v->coord.left && b >= v->coord.top) DoDrawVehicle(v); - } + } v = v->hash_viewport_next; } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 66db4f6e8..d28849ebd 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1575,7 +1575,6 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int } case GB_SHARED_ORDERS: - assert(vehgroup.NumVehicles() > 0); for (int i = 0; i < static_cast(vehgroup.NumVehicles()); ++i) { diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index aa7a23c72..66e6586fd 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -524,7 +524,7 @@ static uint ConvertSdlKeycodeIntoMy(SDL_Keycode kc) } /* check scancode for BACKQUOTE key, because we want the key left - of "1", not anything else (on non-US keyboards) */ + * of "1", not anything else (on non-US keyboards) */ SDL_Scancode sc = SDL_GetScancodeFromKey(kc); if (sc == SDL_SCANCODE_GRAVE) key = WKC_BACKQUOTE; @@ -542,10 +542,10 @@ int VideoDriver_SDL::PollEvent() #ifdef __EMSCRIPTEN__ if (_cursor_new_in_window) { /* The cursor just moved into the window; this means we don't - * know the absolutely position yet to move relative from. - * Before this time, SDL didn't know it either, and this is - * why we postpone it till now. Update the absolute position - * for this once, and work relative after. */ + * know the absolutely position yet to move relative from. + * Before this time, SDL didn't know it either, and this is + * why we postpone it till now. Update the absolute position + * for this once, and work relative after. */ _cursor.pos.x = ev.motion.x; _cursor.pos.y = ev.motion.y; _cursor.dirty = true; diff --git a/src/viewport.cpp b/src/viewport.cpp index 44ff37c74..822b0db9c 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1527,7 +1527,7 @@ static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv) sprite_list.sort(); - std::vector preceding; // Temporarily stores sprites that precede current and their position in the list + std::vector preceding; // Temporarily stores sprites that precede current and their position in the list auto preceding_prev = sprite_list.begin(); // Store iterator in case we need to delete a single preciding sprite auto out = psdv->begin(); // Iterator to output sorted sprites @@ -1606,7 +1606,7 @@ static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv) /* Sort all preceding sprites by order and assign new orders in reverse (as original sorter did). */ std::sort(preceding.begin(), preceding.end(), [](const ParentSpriteToDraw *a, const ParentSpriteToDraw *b) { - return a->order > b->order; + return a->order > b->order; }); s->order = ORDER_COMPARED; diff --git a/src/viewport_sprite_sorter_sse4.cpp b/src/viewport_sprite_sorter_sse4.cpp index ae5121818..f3747b89b 100644 --- a/src/viewport_sprite_sorter_sse4.cpp +++ b/src/viewport_sprite_sorter_sse4.cpp @@ -55,7 +55,7 @@ void ViewportSortParentSpritesSSE41(ParentSpriteToSortVector *psdv) sprite_list.sort(); - std::vector preceding; // Temporarily stores sprites that precede current and their position in the list + std::vector preceding; // Temporarily stores sprites that precede current and their position in the list auto preceding_prev = sprite_list.begin(); // Store iterator in case we need to delete a single preciding sprite auto out = psdv->begin(); // Iterator to output sorted sprites @@ -151,7 +151,7 @@ void ViewportSortParentSpritesSSE41(ParentSpriteToSortVector *psdv) /* Sort all preceding sprites by order and assign new orders in reverse (as original sorter did). */ std::sort(preceding.begin(), preceding.end(), [](const ParentSpriteToDraw *a, const ParentSpriteToDraw *b) { - return a->order > b->order; + return a->order > b->order; }); s->order = ORDER_COMPARED; -- cgit v1.2.3-70-g09d2