1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-15 08:22:34 +01:00

Codechange: Dereference with x-> instead of (*x). (#14700)

This commit is contained in:
Peter Nelson
2025-10-05 15:47:33 +01:00
committed by GitHub
parent c9fbc41636
commit a617d009cc
12 changed files with 19 additions and 19 deletions

View File

@@ -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<AILibrary *>((*it).second);
return static_cast<AILibrary *>(it->second);
}

View File

@@ -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;
}

View File

@@ -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<Colour *>(reinterpret_cast<std::byte *>(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;
}
}

View File

@@ -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;
}
};

View File

@@ -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()) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);