Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)

This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
This commit is contained in:
Peter Nelson
2023-11-06 20:29:35 +00:00
committed by GitHub
parent 737775f834
commit ab535c0a86
73 changed files with 174 additions and 173 deletions

View File

@@ -207,7 +207,7 @@ public:
/* Location */
std::stringstream tile_ss;
tile_ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << static_cast<uint32_t>(tile); // 0x%.4X
tile_ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << std::uppercase << tile.base(); // 0x%.4X
SetDParam(0, TileX(tile));
SetDParam(1, TileY(tile));
@@ -332,12 +332,12 @@ public:
bool IsNewGRFInspectable() const override
{
return ::IsNewGRFInspectable(GetGrfSpecFeature(this->tile), static_cast<uint32_t>(this->tile));
return ::IsNewGRFInspectable(GetGrfSpecFeature(this->tile), this->tile.base());
}
void ShowNewGRFInspectWindow() const override
{
::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), static_cast<uint32_t>(this->tile));
::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile.base());
}
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override