diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp --- 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 --- 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 --- 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 --- 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 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -4036,7 +4036,7 @@ uint MoveGoodsToStation(CargoID type, ui 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, ui 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 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1117,7 +1117,7 @@ static bool GrowTownWithRoad(const Town * @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 Tow * @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 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -762,7 +762,7 @@ static void TileLoop_Trees(TileIndex til 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 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1179,7 +1179,7 @@ void ViewportAddVehicles(DrawPixelInfo * 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 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1575,7 +1575,6 @@ void BaseVehicleListWindow::DrawVehicleL } 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 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -524,7 +524,7 @@ static uint ConvertSdlKeycodeIntoMy(SDL_ } /* 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 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1527,7 +1527,7 @@ static void ViewportSortParentSprites(Pa 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(Pa /* 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 --- a/src/viewport_sprite_sorter_sse4.cpp +++ b/src/viewport_sprite_sorter_sse4.cpp @@ -55,7 +55,7 @@ void ViewportSortParentSpritesSSE41(Pare 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(Pare /* 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;