From 06a70c3b7d8f18b50f555f64a3cde99d3c6305ab Mon Sep 17 00:00:00 2001 From: dP Date: Sun, 5 May 2024 21:50:54 +0500 Subject: [PATCH] Fix all the gcc warnings --- src/build_vehicle_gui.cpp | 1 + src/citymania/cm_commands_gui.cpp | 13 ----------- src/citymania/cm_highlight.cpp | 9 ++------ src/citymania/cm_highlight_type.hpp | 4 ++-- src/citymania/cm_minimap.cpp | 16 +++++++------- src/citymania/cm_minimap.hpp | 24 ++++++++++---------- src/citymania/cm_misc_gui.cpp | 2 +- src/citymania/cm_overlays.cpp | 4 +--- src/citymania/cm_rail_gui.cpp | 8 +++---- src/citymania/cm_station_gui.cpp | 4 ++-- src/citymania/cm_tooltips.cpp | 34 +++++++++++++---------------- src/citymania/cm_watch_gui.cpp | 20 ++++++++--------- src/citymania/cm_zoning.hpp | 3 ++- src/citymania/cm_zoning_gui.cpp | 16 +++++++++----- src/graph_gui.cpp | 2 +- src/industry_gui.cpp | 1 - src/network/network_client.cpp | 3 --- src/network/network_gui.cpp | 5 ++--- src/rail_gui.cpp | 1 - src/smallmap_gui.cpp | 6 ++--- src/toolbar_gui.cpp | 2 +- src/town_gui.cpp | 5 ++--- src/viewport.cpp | 6 ++--- src/viewport_gui.cpp | 2 +- src/widget.cpp | 2 +- src/window.cpp | 2 +- 26 files changed, 85 insertions(+), 110 deletions(-) diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index bf59bf9931..88c822551a 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1351,6 +1351,7 @@ struct BuildVehicleWindow : Window { // CM this->SelectEngine(this->eng_list[0].engine_id); return this->eng_list[0].engine_id; } + return INVALID_ENGINE; } /** Filter a single engine */ diff --git a/src/citymania/cm_commands_gui.cpp b/src/citymania/cm_commands_gui.cpp index 19068f7100..849ecef9e5 100644 --- a/src/citymania/cm_commands_gui.cpp +++ b/src/citymania/cm_commands_gui.cpp @@ -32,22 +32,9 @@ IniFile *_inilogin = NULL; static const int HTTPBUFLEN = 1024; static const int MAX_COMMUNITY_STRING_LEN = 128; -// nova* stuff probabaly obsolete -static const char * const NOVAPOLIS_IPV4_PRIMARY = "188.165.194.77"; -static const char * const NOVAPOLIS_IPV6_PRIMARY = "2a02:2b88:2:1::1d73:1"; -static const char * const NOVAPOLIS_IPV4_SECONDARY = "89.111.65.225"; -static const char * const NOVAPOLIS_IPV6_SECONDARY = "fe80::20e:7fff:fe23:bee0"; -static const char * const NOVAPOLIS_STRING = "CityMania"; static constexpr std::string_view NICE_HTTP_LOGIN = "http://n-ice.org/openttd/gettoken_md5salt.php?user={}&password={}"; static constexpr std::string_view BTPRO_HTTP_LOGIN = "http://openttd.btpro.nl/gettoken-enc.php?user={}&password={}"; -static const char * const NOVA_IP_ADDRESSES[] = { - NOVAPOLIS_IPV4_PRIMARY, - NOVAPOLIS_IPV6_PRIMARY, - NOVAPOLIS_IPV4_SECONDARY, - NOVAPOLIS_IPV6_SECONDARY, -}; - static const std::string CFG_LOGIN_FILE = "citymania.cfg"; static const std::string CFG_LOGIN_KEY = "login"; static const char * const NOVAPOLIS_LOGIN = "citymania_login"; diff --git a/src/citymania/cm_highlight.cpp b/src/citymania/cm_highlight.cpp index a327022309..3eb87646bd 100644 --- a/src/citymania/cm_highlight.cpp +++ b/src/citymania/cm_highlight.cpp @@ -223,7 +223,7 @@ ObjectTileHighlight ObjectTileHighlight::make_numbered_rect(SpriteID palette, ui } -bool ObjectHighlight::operator==(const ObjectHighlight& oh) { +bool ObjectHighlight::operator==(const ObjectHighlight& oh) const { if (this->type != oh.type) return false; return (this->tile == oh.tile && this->end_tile == oh.end_tile @@ -238,14 +238,9 @@ bool ObjectHighlight::operator==(const ObjectHighlight& oh) { && this->airport_type == oh.airport_type && this->airport_layout == oh.airport_layout && this->blueprint == oh.blueprint); - // switch (this->type) { - // case Type::RAIL_DEPOT: return this->tile == oh.tile && this->ddir == oh.ddir; - // default: return true; - // } - // return true; } -bool ObjectHighlight::operator!=(const ObjectHighlight& oh) { +bool ObjectHighlight::operator!=(const ObjectHighlight& oh) const { return !(*this == oh); } diff --git a/src/citymania/cm_highlight_type.hpp b/src/citymania/cm_highlight_type.hpp index bfdb3c7812..0655bb9221 100644 --- a/src/citymania/cm_highlight_type.hpp +++ b/src/citymania/cm_highlight_type.hpp @@ -327,8 +327,8 @@ protected: public: ObjectHighlight(Type type = Type::NONE): type{type} {} - bool operator==(const ObjectHighlight& oh); - bool operator!=(const ObjectHighlight& oh); + bool operator==(const ObjectHighlight& oh) const; + bool operator!=(const ObjectHighlight& oh) const; static ObjectHighlight make_rail_depot(TileIndex tile, DiagDirection ddir); static ObjectHighlight make_rail_station(TileIndex start_tile, TileIndex end_tile, Axis axis); diff --git a/src/citymania/cm_minimap.cpp b/src/citymania/cm_minimap.cpp index 85995cccd5..3fb9af5ed6 100644 --- a/src/citymania/cm_minimap.cpp +++ b/src/citymania/cm_minimap.cpp @@ -539,7 +539,7 @@ static inline uint32 GetSmallMapContoursPixels(TileIndex tile, TileType t) * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the small map in mode "Vehicles" */ -static inline uint32 GetSmallMapVehiclesPixels(TileIndex tile, TileType t) +static inline uint32 GetSmallMapVehiclesPixels(TileIndex /* tile */, TileType t) { const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour]; return ApplyMask(cs->default_colour, &_smallmap_vehicles_andor[t]); @@ -1235,7 +1235,7 @@ SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(des _smallmap_industry_highlight = INVALID_INDUSTRYTYPE; this->overlay = new LinkGraphOverlay(this, WID_SM_MAP, 0, this->GetOverlayCompanyMask(), 1); this->InitNested(window_number); - this->LowerWidget(this->map_type + WID_SM_CONTOUR); + this->LowerWidget(WID_SM_CONTOUR + this->map_type); this->RebuildColourIndexIfNecessary(); @@ -1483,9 +1483,9 @@ void SmallMapWindow::RebuildColourIndexIfNecessary() */ void SmallMapWindow::SwitchMapType(SmallMapType map_type) { - this->RaiseWidget(this->map_type + WID_SM_CONTOUR); + this->RaiseWidget(WID_SM_CONTOUR + this->map_type); this->map_type = map_type; - this->LowerWidget(this->map_type + WID_SM_CONTOUR); + this->LowerWidget(WID_SM_CONTOUR + this->map_type); this->SetupWidgetData(); @@ -1740,7 +1740,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt) this->SetDirty(); } -/* virtual */ bool SmallMapWindow::OnRightClick(Point pt, int widget) +/* virtual */ bool SmallMapWindow::OnRightClick(Point /* pt */, int widget) { if (widget != WID_SM_MAP || _scrolling_viewport) return false; @@ -1761,10 +1761,10 @@ int SmallMapWindow::GetPositionOnLegend(Point pt) } } -/* virtual */ void SmallMapWindow::OnRealtimeTick(uint delta_ms) +/* virtual */ void SmallMapWindow::OnRealtimeTick(uint /* delta_ms */) { /* Update the window every now and then */ - if (this->map_type == SmallMapWindow::SMT_LINKSTATS) { + if (this->map_type == SMT_LINKSTATS) { uint32 company_mask = this->GetOverlayCompanyMask(); if (this->overlay->GetCompanyMask() != company_mask) { this->overlay->SetCompanyMask(company_mask); @@ -1919,7 +1919,7 @@ void SmallMapWindow::UpdateTownCache(bool force) { } } -SmallMapWindow::SmallMapType SmallMapWindow::map_type = CM_SMT_IMBA; +SmallMapType SmallMapWindow::map_type = CM_SMT_IMBA; bool SmallMapWindow::show_towns = true; int SmallMapWindow::map_height_limit = -1; diff --git a/src/citymania/cm_minimap.hpp b/src/citymania/cm_minimap.hpp index d0a82883d2..6ec3ecbf11 100644 --- a/src/citymania/cm_minimap.hpp +++ b/src/citymania/cm_minimap.hpp @@ -67,20 +67,22 @@ struct LegendAndColour { bool col_break; ///< Perform a column break and go further at the next column. }; +/** Types of legends in the #WID_SM_LEGEND widget. */ +enum SmallMapType : byte { + SMT_CONTOUR, + SMT_VEHICLES, + SMT_INDUSTRY, + SMT_LINKSTATS, + SMT_ROUTES, + SMT_VEGETATION, + SMT_OWNER, + CM_SMT_IMBA, +}; +DECLARE_ENUM_AS_ADDABLE(SmallMapType) + /** Class managing the smallmap window. */ class SmallMapWindow : public Window { protected: - /** Types of legends in the #WID_SM_LEGEND widget. */ - enum SmallMapType { - SMT_CONTOUR, - SMT_VEHICLES, - SMT_INDUSTRY, - SMT_LINKSTATS, - SMT_ROUTES, - SMT_VEGETATION, - SMT_OWNER, - CM_SMT_IMBA, - }; /** Available kinds of zoomlevel changes. */ enum ZoomLevelChange { diff --git a/src/citymania/cm_misc_gui.cpp b/src/citymania/cm_misc_gui.cpp index 2f8af00abb..2a3a05bc44 100644 --- a/src/citymania/cm_misc_gui.cpp +++ b/src/citymania/cm_misc_gui.cpp @@ -48,7 +48,7 @@ public: TileIndex tile; TileIndex end_tile; ///< For use in ruler(dragdrop) mode - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int /* window_number */) override { int scr_top = GetMainViewTop() + 2; int scr_bot = GetMainViewBottom() - 2; diff --git a/src/citymania/cm_overlays.cpp b/src/citymania/cm_overlays.cpp index 8d1b92631d..2a8e5dbe69 100644 --- a/src/citymania/cm_overlays.cpp +++ b/src/citymania/cm_overlays.cpp @@ -23,7 +23,7 @@ namespace citymania { -static bool Intersects(PointDimension rect, Point pos, Point size) { +[[maybe_unused]] static bool Intersects(PointDimension rect, Point pos, Point size) { return ( pos.x + size.x >= rect.x && pos.x <= rect.x + rect.width && @@ -221,8 +221,6 @@ public: class BuildInfoOverlay: public OverlayWindow { bool visible = false; - int line_height = 0; - int text_ofs_x = 0; BuildInfoOverlayData data; IconTextAligner aligner; public: diff --git a/src/citymania/cm_rail_gui.cpp b/src/citymania/cm_rail_gui.cpp index fd1290d459..73e5f13eda 100644 --- a/src/citymania/cm_rail_gui.cpp +++ b/src/citymania/cm_rail_gui.cpp @@ -41,8 +41,8 @@ static sp DoRailroadTrack(TileIndex start_tile, TileIndex end_tile, Rai } -static bool DoAutodirTerraform(bool diagonal, TileIndex start_tile, TileIndex end_tile, Track track, sp rail_cmd, TileIndex s1, TileIndex e1, TileIndex s2, TileIndex e2, bool remove_mode) { - auto rail_callback = [rail_cmd, start_tile, end_tile, track, estimate=citymania::_estimate_mod](bool res) -> bool{ +static bool DoAutodirTerraform(bool diagonal, TileIndex start_tile, TileIndex /* end_tile */, Track track, sp rail_cmd, TileIndex s1, TileIndex e1, TileIndex s2, TileIndex e2, bool /* remove_mode */) { + auto rail_callback = [rail_cmd, start_tile, track, estimate=citymania::_estimate_mod](bool res) -> bool{ if (rail_cmd->call(DC_AUTO | DC_NO_WATER).GetErrorMessage() != STR_ERROR_ALREADY_BUILT || _rail_track_endtile == INVALID_TILE) { if (!rail_cmd->post()) return false; @@ -64,7 +64,7 @@ static bool DoAutodirTerraform(bool diagonal, TileIndex start_tile, TileIndex en return cmd2.with_callback(rail_callback).post(); } -static bool HandleAutodirTerraform(TileIndex start_tile, TileIndex end_tile, RailType railtype, Track track, sp rail_cmd, bool remove_mode) { +static bool HandleAutodirTerraform(TileIndex start_tile, TileIndex end_tile, Track track, sp rail_cmd, bool remove_mode) { bool eq = (TileX(end_tile) - TileY(end_tile) == TileX(start_tile) - TileY(start_tile)); bool ez = (TileX(end_tile) + TileY(end_tile) == TileX(start_tile) + TileY(start_tile)); // StoreRailPlacementEndpoints(start_tile, end_tile, track, true); @@ -160,7 +160,7 @@ void HandleAutodirPlacement(RailType railtype, bool remove_mode) { if (!cmd->post(CcPlaySound_CONSTRUCTION_RAIL)) return; } else if (_thd.cm_poly_terra) { Track trackstat = static_cast( _thd.drawstyle & HT_DIR_MASK); // 0..5 - citymania::HandleAutodirTerraform(start_tile, end_tile, railtype, trackstat, std::move(cmd), remove_mode); + citymania::HandleAutodirTerraform(start_tile, end_tile, trackstat, std::move(cmd), remove_mode); return; } else if (cmd->call(DC_AUTO | DC_NO_WATER).GetErrorMessage() != STR_ERROR_ALREADY_BUILT || _rail_track_endtile == INVALID_TILE) { diff --git a/src/citymania/cm_station_gui.cpp b/src/citymania/cm_station_gui.cpp index c44c54e587..a2aff5801e 100644 --- a/src/citymania/cm_station_gui.cpp +++ b/src/citymania/cm_station_gui.cpp @@ -145,7 +145,7 @@ void SetHighlightStationToJoin(const Station *station, bool with_area) { MarkCoverageAreaDirty(_highlight_station_to_join); } -void OnStationTileSetChange(const Station *station, bool adding, StationType type) { +void OnStationTileSetChange(const Station *station, bool /* adding */, StationType /* type */) { if (station == _highlight_station_to_join) { if (_highlight_join_area.tile != INVALID_TILE) UpdateHiglightJoinArea(_station_to_join); @@ -205,7 +205,7 @@ const Station *CheckClickOnDeadStationSign() { return last_st; } -bool CheckStationJoin(TileIndex start_tile, TileIndex end_tile) { +bool CheckStationJoin(TileIndex start_tile, TileIndex /* end_tile */) { if (citymania::_fn_mod) { if (IsTileType (start_tile, MP_STATION)) { citymania::SelectStationToJoin(Station::GetByTile(start_tile)); diff --git a/src/citymania/cm_tooltips.cpp b/src/citymania/cm_tooltips.cpp index 16a401fead..37a57f262a 100644 --- a/src/citymania/cm_tooltips.cpp +++ b/src/citymania/cm_tooltips.cpp @@ -52,7 +52,7 @@ struct LandTooltipsWindow : public Window virtual ~LandTooltipsWindow() {} - virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) + Point OnInitialPosition(int16 sm_width, int16 sm_height, int /* window_number */) override { int scr_top = GetMainViewTop() + 2; int scr_bot = GetMainViewBottom() - 2; @@ -63,7 +63,7 @@ struct LandTooltipsWindow : public Window return pt; } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int /* widget */, Dimension *size, const Dimension & /* padding */, Dimension * /* fill */, Dimension * /* resize */) override { uint icon_size = ScaleGUITrad(10); uint line_height = std::max((uint)GetCharacterHeight(FS_NORMAL), icon_size) + WidgetDimensions::scaled.hsep_normal; @@ -129,7 +129,7 @@ struct LandTooltipsWindow : public Window size->height += WidgetDimensions::scaled.framerect.Vertical() + WidgetDimensions::scaled.fullbevel.Vertical(); } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int /* widget */) const override { uint icon_size = ScaleGUITrad(10); uint line_height = std::max((uint)GetCharacterHeight(FS_NORMAL), icon_size) + WidgetDimensions::scaled.hsep_normal; @@ -300,7 +300,7 @@ public: CLRBITS(this->flags, WF_WHITE_BORDER); } - Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override + Point OnInitialPosition(int16 sm_width, int16 sm_height, int /* window_number */) override { int scr_top = GetMainViewTop() + 2; int scr_bot = GetMainViewBottom() - 2; @@ -323,7 +323,6 @@ public: this->data.push_back(GetString(CM_STR_STATION_RATING_TOOLTIP_RATING_DETAILS)); if (!ge->HasRating()) { return; } - uint line_nr = 1; int total_rating = 0; if (HasBit(cs->callback_mask, CBM_CARGO_STATION_RATING_CALC)) { @@ -363,11 +362,10 @@ public: byte waittime = ge->time_since_pickup; if (this->st->last_vehicle_type == VEH_SHIP) waittime >>= 2; int waittime_stage = 0; - (waittime > 21) || - (waittime_stage = 1, waittime > 12) || - (waittime_stage = 2, waittime > 6) || - (waittime_stage = 3, waittime > 3) || - (waittime_stage = 4, true); + if (waittime <= 21) waittime_stage = 1; + if (waittime <= 12) waittime_stage = 2; + if (waittime <= 6) waittime_stage = 3; + if (waittime <= 3) waittime_stage = 4; total_rating += STATION_RATING_WAITTIME[waittime_stage]; SetDParam(0, CM_STR_STATION_RATING_TOOLTIP_WAITTIME_0 + waittime_stage); @@ -375,14 +373,12 @@ public: SetDParam(2, this->RoundRating(STATION_RATING_WAITTIME[waittime_stage])); this->data.push_back(GetString(this->st->last_vehicle_type == VEH_SHIP ? CM_STR_STATION_RATING_TOOLTIP_WAITTIME_SHIP : CM_STR_STATION_RATING_TOOLTIP_WAITTIME)); - uint waitunits = ge->max_waiting_cargo; int waitunits_stage = 0; - (waitunits > 1500) || - (waitunits_stage = 1, waitunits > 1000) || - (waitunits_stage = 2, waitunits > 600) || - (waitunits_stage = 3, waitunits > 300) || - (waitunits_stage = 4, waitunits > 100) || - (waitunits_stage = 5, true); + if (ge->max_waiting_cargo <= 1500) waitunits_stage = 1; + if (ge->max_waiting_cargo <= 1000) waitunits_stage = 2; + if (ge->max_waiting_cargo <= 600) waitunits_stage = 3; + if (ge->max_waiting_cargo <= 300) waitunits_stage = 4; + if (ge->max_waiting_cargo <= 100) waitunits_stage = 5; total_rating += STATION_RATING_WAITUNITS[waitunits_stage]; SetDParam(0, CM_STR_STATION_RATING_TOOLTIP_WAITUNITS_0 + waitunits_stage); @@ -426,7 +422,7 @@ public: this->data.push_back(GetString(CM_STR_STATION_RATING_TOOLTIP_TOTAL_RATING)); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int /* widget */, Dimension *size, const Dimension & /* padding */, Dimension * /* fill */, Dimension * /* resize */) override { size->height = WidgetDimensions::scaled.framerect.Vertical() + WidgetDimensions::scaled.fullbevel.Vertical(); for (uint i = 0; i < data.size(); i++) { @@ -439,7 +435,7 @@ public: size->height -= WidgetDimensions::scaled.hsep_normal; } - void DrawWidget(const Rect &r, int widget) const override + void DrawWidget(const Rect &r, int /* widget */) const override { GfxFillRect(r.left, r.top, r.right, r.top + WidgetDimensions::scaled.bevel.top - 1, PC_BLACK); GfxFillRect(r.left, r.bottom - WidgetDimensions::scaled.bevel.bottom + 1, r.right, r.bottom, PC_BLACK); diff --git a/src/citymania/cm_watch_gui.cpp b/src/citymania/cm_watch_gui.cpp index 228e232f32..d5e076d144 100644 --- a/src/citymania/cm_watch_gui.cpp +++ b/src/citymania/cm_watch_gui.cpp @@ -404,14 +404,14 @@ void WatchCompany::OnMouseWheel( int wheel ) ZoomInOrOutToCursorWindow(wheel < 0, this); } -void WatchCompany::OnClick(Point pt, int widget, int click_count) +void WatchCompany::OnClick(Point /* pt */, int widget, int /* click_count */) { /* Check which button is clicked */ if (IsInsideMM(widget, EWW_COMPANY_BEGIN, EWW_COMPANY_END)) { /* Is it no on disable? */ if (!this->IsWidgetDisabled(widget)) { if (this->watched_company != INVALID_COMPANY) - this->RaiseWidget(this->watched_company + EWW_COMPANY_BEGIN); + this->RaiseWidget(EWW_COMPANY_BEGIN + this->watched_company); auto c = Company::GetIfValid((CompanyID)(widget - EWW_COMPANY_BEGIN)); if (c == nullptr || this->watched_company == c->index) { this->watched_company = INVALID_COMPANY; @@ -436,7 +436,7 @@ void WatchCompany::OnClick(Point pt, int widget, int click_count) if (!this->IsWidgetDisabled(widget)) { if (this->watched_company != INVALID_COMPANY) { /* Raise the watched company button */ - this->RaiseWidget(this->watched_company + EWW_PB_COMPANY_FIRST); + this->RaiseWidget(EWW_PB_COMPANY_FIRST + this->watched_company); } if (this->watched_company == (CompanyID)(widget - EWW_PB_COMPANY_FIRST)) { /* Stop watching watched_company */ @@ -445,7 +445,7 @@ void WatchCompany::OnClick(Point pt, int widget, int click_count) } else { /* Lower the new watched company button */ this->watched_company = (CompanyID)(widget - EWW_PB_COMPANY_FIRST); - this->LowerWidget(this->watched_company + EWW_PB_COMPANY_FIRST); + this->LowerWidget( EWW_PB_COMPANY_FIRST + this->watched_company); Company *c = Company::Get( this->watched_company ); SetDParam( 0, c->index ); this->company_name = GetString(STR_COMPANY_NAME); @@ -468,7 +468,6 @@ void WatchCompany::OnClick(Point pt, int widget, int click_count) } } else { - char msg[128]; switch (widget) { case EWW_ZOOMOUT: DoZoomInOutWindow(ZOOM_OUT, this); break; case EWW_ZOOMIN: DoZoomInOutWindow(ZOOM_IN, this); break; @@ -531,7 +530,6 @@ void WatchCompany::OnClick(Point pt, int widget, int click_count) void WatchCompany::OnQueryTextFinished(char *str) { if (str == NULL) return; - char msg[128]; switch (this->query_widget) { case EWQ_BAN: NetworkClientSendChatToServer(fmt::format("!ban {} {}", this->watched_client, str)); @@ -541,7 +539,7 @@ void WatchCompany::OnQueryTextFinished(char *str) } } -void WatchCompany::OnInvalidateData(int data, bool gui_scope) +void WatchCompany::OnInvalidateData(int data, bool /* gui_scope */) { if(this->Wtype == EWT_COMPANY){ /* Disable the companies who are not active */ @@ -583,13 +581,13 @@ void WatchCompany::OnInvalidateData(int data, bool gui_scope) /* Disable the companies who are not active */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - this->SetWidgetDisabledState(i + EWW_COMPANY_BEGIN, !Company::IsValidID(i)); + this->SetWidgetDisabledState(EWW_COMPANY_BEGIN + i, !Company::IsValidID(i)); } /* Check if the currently selected company is still active. */ if (this->watched_company != INVALID_COMPANY && !Company::IsValidID(this->watched_company)) { /* Raise the widget for the previous selection. */ - this->RaiseWidget(this->watched_company + EWW_COMPANY_BEGIN); + this->RaiseWidget(EWW_COMPANY_BEGIN + this->watched_company); this->watched_company = INVALID_COMPANY; } @@ -602,7 +600,7 @@ void WatchCompany::OnInvalidateData(int data, bool gui_scope) /* Make sure the widget is lowered */ if (this->watched_company != INVALID_COMPANY) - this->LowerWidget(this->watched_company + EWW_COMPANY_BEGIN); + this->LowerWidget(EWW_COMPANY_BEGIN + this->watched_company); } else if(this->Wtype == EWT_CLIENT){ if (data == 2) { @@ -690,7 +688,7 @@ void ShowWatchWindow(CompanyID company_to_watch = INVALID_COMPANY, int type = EW } } -void UpdateWatching(CompanyID company, TileIndex tile) { +void UpdateWatching(CompanyID /* company */, TileIndex tile) { /* Send Tile Number to Watching Company Windows */ WatchCompany *wc; for(int watching_window = 0; ; watching_window++){ diff --git a/src/citymania/cm_zoning.hpp b/src/citymania/cm_zoning.hpp index 011cd8521a..b88a2c2061 100644 --- a/src/citymania/cm_zoning.hpp +++ b/src/citymania/cm_zoning.hpp @@ -5,7 +5,7 @@ namespace citymania { -enum EvaluationMode { +enum EvaluationMode : byte { CHECKNOTHING = 0, CHECKOPINION, ///< Check the local authority's opinion. CHECKBUILD, ///< Check wither or not the player can build. @@ -19,6 +19,7 @@ enum EvaluationMode { CHECKTOWNADZONES, ///< Town advertisement zone CHECKTOWNGROWTHTILES, ///< Town growth tiles (new house, skipped/removed house) }; +DECLARE_ENUM_AS_ADDABLE(EvaluationMode) struct Zoning { EvaluationMode inner; diff --git a/src/citymania/cm_zoning_gui.cpp b/src/citymania/cm_zoning_gui.cpp index 6ab21d05a0..612c7d7215 100644 --- a/src/citymania/cm_zoning_gui.cpp +++ b/src/citymania/cm_zoning_gui.cpp @@ -57,11 +57,13 @@ struct ZoningWindow : public Window { if(_zoning.inner != CHECKNOTHING) this->LowerWidget(ZTW_INNER_FIRST + _zoning.inner - 1); } - virtual void OnPaint() { + void OnPaint() override + { this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) { + void OnClick(Point /* pt */, int widget, int /* click_count */) override + { bool outer = true; bool deselect = false; EvaluationMode clicked; @@ -84,7 +86,7 @@ struct ZoningWindow : public Window { MarkWholeScreenDirty(); } - void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { StringID strid = STR_EMPTY; if (widget >= ZTW_OUTER_FIRST && widget < ZTW_INNER_FIRST){ @@ -103,14 +105,16 @@ struct ZoningWindow : public Window { DrawString(rtl ? r.left : x + clk_dif + 1, (rtl ? r.right + clk_dif : r.right), y + 1 + clk_dif, strid, TC_FROMSTRING, SA_LEFT); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension * /* fill */, Dimension * /* resize */) override + { if (widget >= ZTW_OUTER_FIRST && widget < ZTW_INNER_END){ size->width = this->maxwidth + padding.width + 8; size->height = this->maxheight + 2; } } - void RaiseAllWidgets(bool outer){ + void RaiseAllWidgets(bool outer) + { byte start = outer ? ZTW_OUTER_FIRST : ZTW_INNER_FIRST; byte end = outer ? ZTW_INNER_FIRST : ZTW_INNER_END; for(byte i = start; i < end; i++){ @@ -121,7 +125,7 @@ struct ZoningWindow : public Window { } } - virtual EventState OnHotkey(int hotkey) + EventState OnHotkey(int hotkey) override { return Window::OnHotkey(hotkey); } diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 95b028a015..8488359bbb 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -1284,7 +1284,7 @@ struct PaymentRatesGraphWindow : ExcludingCargoBaseGraphWindow { this->UpdatePaymentRates(); }}; - void UpdateStatistics(bool initialize) override { + void UpdateStatistics(bool) override { this->UpdatePaymentRates(); } diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 1a97f27112..44aea3dc39 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -57,7 +57,6 @@ #include "safeguards.h" -static const int CM_HOTKEY_MASK = 0x1000; static const int CM_HOTKEY_SWITCH_LAYOUT = 0x1001; bool _ignore_restrictions; diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index e393cfd3cc..560a78f0b0 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -46,9 +46,6 @@ /* This file handles all the client-commands */ void SyncCMUser(const std::string &msg); -// extern const std::map OPENTTD_NEWGRF_VERSIONS; -// extern const std::map OPENTTD_RELEASE_REVISIONS; -static const uint32 OPENTTD_NEWGRF_REVISION_MASK = (1 << 19) - 1; /** Read some packets, and when do use that data as initial load filter. */ struct PacketReader : LoadFilter { diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 06b4b53126..3a6172a763 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1586,7 +1586,7 @@ private: ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, client_id); } - static void CMOnClickCompanyHQ(NetworkClientListWindow *w, Point pt, CompanyID company_id) + static void CMOnClickCompanyHQ(NetworkClientListWindow * /* w */, Point /* pt */, CompanyID company_id) { auto company = Company::GetIfValid(company_id); if (company == nullptr || company->location_of_HQ == INVALID_TILE) return; @@ -1594,7 +1594,7 @@ private: else ScrollMainWindowToTile(company->location_of_HQ); } - static void CMOnClickCompanyWatch(NetworkClientListWindow *w, Point pt, CompanyID company_id) + static void CMOnClickCompanyWatch(NetworkClientListWindow * /* w */, Point /* pt */, CompanyID company_id) { citymania::ShowWatchWindow(company_id, 0); } @@ -1846,7 +1846,6 @@ public: /* CityMania code start */ // NOTE: needs to match company order in DrawWidget if (button == nullptr) { - NWidgetBase *nwi = this->GetWidget(widget); int index = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_CL_MATRIX); NetworkClientInfo *own_ci = NetworkClientInfo::GetByClientID(_network_own_client_id); CompanyID client_playas = own_ci == nullptr ? COMPANY_SPECTATOR : own_ci->client_playas; diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 03e0c16ad6..240b31a5f2 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -69,7 +69,6 @@ static bool _convert_signal_button; ///< convert signal button in the s static SignalVariant _cur_signal_variant; ///< set the signal variant (for signal GUI) static SignalType _cur_signal_type; ///< set the signal type (for signal GUI) -static const int HOTKEY_MASK = 0x1000; static const int HOTKEY_POLYRAIL = 0x1000; static const int HOTKEY_NEW_POLYRAIL = 0x1001; static const int HOTKEY_BLUEPRINT_ROTATE = 0x1002; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index ff3f8116d4..bb53729077 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1954,6 +1954,9 @@ public: } }; +#if 0 +CityMania has its own smallmap + /** Widget parts of the smallmap display. */ static constexpr NWidgetPart _nested_smallmap_display[] = { NWidget(WWT_PANEL, COLOUR_BROWN, WID_SM_MAP_BORDER), @@ -2039,9 +2042,6 @@ static constexpr NWidgetPart _nested_smallmap_widgets[] = { EndContainer(), }; -#if 0 -CityMania has its own smallmap - static WindowDesc _smallmap_desc(__FILE__, __LINE__, WDP_AUTO, "smallmap", 484, 314, WC_SMALLMAP, WC_NONE, diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index e5757b70e3..c83a823523 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2166,7 +2166,7 @@ struct MainToolbarWindow : Window { _last_started_action = CBF_NONE; } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 1d0292f3e0..829dab4566 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1510,7 +1510,7 @@ public: if(HasBit(this->town->advertise_regularly, _local_company)) this->LowerWidget(WID_CB_ADVERT_REGULAR); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_CB_CENTER_VIEW: @@ -1582,8 +1582,7 @@ public: return nullptr; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) - { + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { static const uint EXP_TOPPADDING = 5; static const uint EXP_LINESPACE = 2; // Amount of vertical space for a horizontal (sub-)total line. diff --git a/src/viewport.cpp b/src/viewport.cpp index d3c6726fee..dff44c7fbc 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -3235,10 +3235,10 @@ static void CheckOverflow(int &test, int &other, int max, int mult) test = max; } -static const uint X_DIRS = (1 << DIR_NE) | (1 << DIR_SW); -static const uint Y_DIRS = (1 << DIR_SE) | (1 << DIR_NW); +// static const uint X_DIRS = (1 << DIR_NE) | (1 << DIR_SW); +// static const uint Y_DIRS = (1 << DIR_SE) | (1 << DIR_NW); static const uint HORZ_DIRS = (1 << DIR_W) | (1 << DIR_E); -static const uint VERT_DIRS = (1 << DIR_N) | (1 << DIR_S); +// static const uint VERT_DIRS = (1 << DIR_N) | (1 << DIR_S); /** * Convert a given point and a given #Direction to best matching #Trackdir. diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 126374e168..09fc0641ef 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -171,7 +171,7 @@ void ShowExtraViewportWindow(TileIndex tile) namespace citymania { -void ShowExtraViewportWindow(int x, int y, int z) +void ShowExtraViewportWindow(int x, int y, int /* z */) { int i = 0; diff --git a/src/widget.cpp b/src/widget.cpp index 8662fe2185..1349ebbebd 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1809,7 +1809,7 @@ NWidgetCore *NWidgetSpacer::GetWidgetFromPos(int, int) } /* CityMania code start (jgrpp viewport stuff) */ -void NWidgetSpacer::FillDirtyWidgets(std::vector &dirty_widgets) +void NWidgetSpacer::FillDirtyWidgets(std::vector & /*dirty_widgets */) { /* Spacer widget never need repainting. */ } diff --git a/src/window.cpp b/src/window.cpp index 52ca41b568..9576736f18 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -3561,7 +3561,7 @@ WindowPopup::WindowPopup(WindowDesc *desc, WindowPopupType t): Window(desc) * @param window_number Unused. * @return The origin coordinate of the window. */ -/*virtual*/ Point WindowPopup::OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) +/*virtual*/ Point WindowPopup::OnInitialPosition(int16 sm_width, int16 /* sm_height */, int /* window_number */) { int x, y;