From a617d009cca418255a9682fd83c9cebc6423303e Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 5 Oct 2025 15:47:33 +0100 Subject: [PATCH] Codechange: Dereference with `x->` instead of `(*x).` (#14700) --- src/ai/ai_scanner.cpp | 2 +- src/bitmap_type.h | 4 ++-- src/blitter/32bpp_sse2.cpp | 4 ++-- src/core/geometry_type.hpp | 6 +++--- src/fileio.cpp | 2 +- src/misc/dbg_helpers.cpp | 2 +- src/script/api/script_controller.cpp | 2 +- src/script/api/script_error.cpp | 2 +- src/script/script_config.cpp | 2 +- src/station_base.h | 4 ++-- src/viewport.cpp | 4 ++-- src/viewport_sprite_sorter_sse4.cpp | 4 ++-- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp index 70e5b55148..f4b0552684 100644 --- a/src/ai/ai_scanner.cpp +++ b/src/ai/ai_scanner.cpp @@ -137,5 +137,5 @@ AILibrary *AIScannerLibrary::FindLibrary(const std::string &library, int version ScriptInfoList::iterator it = this->info_list.find(library_name); if (it == this->info_list.end()) return nullptr; - return static_cast((*it).second); + return static_cast(it->second); } diff --git a/src/bitmap_type.h b/src/bitmap_type.h index 4dd356e48a..acf3b3d22b 100644 --- a/src/bitmap_type.h +++ b/src/bitmap_type.h @@ -118,9 +118,9 @@ public: inline TileIterator& operator ++() override { - (*this).OrthogonalTileIterator::operator++(); + this->OrthogonalTileIterator::operator++(); while (this->tile != INVALID_TILE && !this->bitmap->HasTile(TileIndex(this->tile))) { - (*this).OrthogonalTileIterator::operator++(); + this->OrthogonalTileIterator::operator++(); } return *this; } diff --git a/src/blitter/32bpp_sse2.cpp b/src/blitter/32bpp_sse2.cpp index 6fc08ca6cd..791952a095 100644 --- a/src/blitter/32bpp_sse2.cpp +++ b/src/blitter/32bpp_sse2.cpp @@ -113,7 +113,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(SpriteType sprite_type, const SpriteLoader else break; dst_rgba++; } - (*dst_rgba_line).data = nb_pix_transp; + dst_rgba_line->data = nb_pix_transp; Colour *nb_right = dst_rgba_line + 1; dst_rgba_line = reinterpret_cast(reinterpret_cast(dst_rgba_line) + info.sprite_line_size); @@ -126,7 +126,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(SpriteType sprite_type, const SpriteLoader else break; dst_rgba--; } - (*nb_right).data = nb_pix_transp; + nb_right->data = nb_pix_transp; } } diff --git a/src/core/geometry_type.hpp b/src/core/geometry_type.hpp index ccc610fa90..e46315899e 100644 --- a/src/core/geometry_type.hpp +++ b/src/core/geometry_type.hpp @@ -62,14 +62,14 @@ struct Dimension { bool operator< (const Dimension &other) const { - int x = (*this).width - other.width; + int x = this->width - other.width; if (x != 0) return x < 0; - return (*this).height < other.height; + return this->height < other.height; } bool operator== (const Dimension &other) const { - return (*this).width == other.width && (*this).height == other.height; + return this->width == other.width && this->height == other.height; } }; diff --git a/src/fileio.cpp b/src/fileio.cpp index 981d37c8cd..da9ae826ab 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -593,7 +593,7 @@ bool ExtractTar(const std::string &tar_filename, Subdirectory subdir) /* We don't know the file. */ if (it == _tar_list[subdir].end()) return false; - const auto &dirname = (*it).second; + const auto &dirname = it->second; /* The file doesn't have a sub directory! */ if (dirname.empty()) { diff --git a/src/misc/dbg_helpers.cpp b/src/misc/dbg_helpers.cpp index 7e2d4314c4..bc51801fa9 100644 --- a/src/misc/dbg_helpers.cpp +++ b/src/misc/dbg_helpers.cpp @@ -91,7 +91,7 @@ bool DumpTarget::FindKnownName(size_t type_id, const void *ptr, std::string &nam KNOWN_NAMES::const_iterator it = m_known_names.find(KnownStructKey(type_id, ptr)); if (it != m_known_names.end()) { /* we have found it */ - name = (*it).second; + name = it->second; return true; } return false; diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp index 774b089ef5..65c5970bda 100644 --- a/src/script/api/script_controller.cpp +++ b/src/script/api/script_controller.cpp @@ -116,7 +116,7 @@ ScriptController::ScriptController(::CompanyID company) : LoadedLibraryList::iterator it = controller.loaded_library.find(library_name); if (it != controller.loaded_library.end()) { - fake_class = (*it).second; + fake_class = it->second; } else { int next_number = ++controller.loaded_library_count; diff --git a/src/script/api/script_error.cpp b/src/script/api/script_error.cpp index 953e9d8d38..34c1dfb9d5 100644 --- a/src/script/api/script_error.cpp +++ b/src/script/api/script_error.cpp @@ -54,7 +54,7 @@ ScriptError::ScriptErrorMapString ScriptError::error_map_string = ScriptError::S ScriptErrorMap::iterator it = error_map.find(internal_string_id); if (it == error_map.end()) return ERR_UNKNOWN; - return (*it).second; + return it->second; } /* static */ void ScriptError::RegisterErrorMap(StringID internal_string_id, ScriptErrorType ai_error_msg) diff --git a/src/script/script_config.cpp b/src/script/script_config.cpp index a599a7e30a..7243af22af 100644 --- a/src/script/script_config.cpp +++ b/src/script/script_config.cpp @@ -85,7 +85,7 @@ int ScriptConfig::GetSetting(const std::string &name) const { const auto it = this->settings.find(name); if (it == this->settings.end()) return this->info->GetSettingDefaultValue(name); - return (*it).second; + return it->second; } void ScriptConfig::SetSetting(std::string_view name, int value) diff --git a/src/station_base.h b/src/station_base.h index b1d26cc721..d8e62d2339 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -599,9 +599,9 @@ public: inline TileIterator& operator ++() override { - (*this).OrthogonalTileIterator::operator++(); + this->OrthogonalTileIterator::operator++(); while (this->tile != INVALID_TILE && !st->TileBelongsToAirport(this->tile)) { - (*this).OrthogonalTileIterator::operator++(); + this->OrthogonalTileIterator::operator++(); } return *this; } diff --git a/src/viewport.cpp b/src/viewport.cpp index 734a34bb7a..83d08f5c56 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1637,8 +1637,8 @@ static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv) auto ssum = std::max(s->xmax, s->xmin) + std::max(s->ymax, s->ymin); auto prev = sprite_list.before_begin(); auto x = sprite_list.begin(); - while (x != sprite_list.end() && ((*x).first <= ssum)) { - auto p = (*x).second; + while (x != sprite_list.end() && x->first <= ssum) { + auto p = x->second; if (p == s) { /* We found the current sprite, remove it and move on. */ x = sprite_list.erase_after(prev); diff --git a/src/viewport_sprite_sorter_sse4.cpp b/src/viewport_sprite_sorter_sse4.cpp index a5ce747dc1..448502ef0c 100644 --- a/src/viewport_sprite_sorter_sse4.cpp +++ b/src/viewport_sprite_sorter_sse4.cpp @@ -87,8 +87,8 @@ void ViewportSortParentSpritesSSE41(ParentSpriteToSortVector *psdv) auto ssum = std::max(s->xmax, s->xmin) + std::max(s->ymax, s->ymin); auto prev = sprite_list.before_begin(); auto x = sprite_list.begin(); - while (x != sprite_list.end() && ((*x).first <= ssum)) { - auto p = (*x).second; + while (x != sprite_list.end() && x->first <= ssum) { + auto p = x->second; if (p == s) { /* We found the current sprite, remove it and move on. */ x = sprite_list.erase_after(prev);