forked from mirror/OpenTTD
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:
@@ -19,7 +19,7 @@
|
||||
|
||||
/* virtual */ uint32_t RailTypeScopeResolver::GetRandomBits() const
|
||||
{
|
||||
uint tmp = CountBits(static_cast<uint32_t>(this->tile + (TileX(this->tile) + TileY(this->tile)) * TILE_SIZE));
|
||||
uint tmp = CountBits(this->tile.base() + (TileX(this->tile) + TileY(this->tile)) * TILE_SIZE);
|
||||
return GB(tmp, 0, 2);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
case 0x40: return 0;
|
||||
case 0x41: return 0;
|
||||
case 0x42: return 0;
|
||||
case 0x43: return static_cast<int32_t>(TimerGameCalendar::date);
|
||||
case 0x43: return TimerGameCalendar::date.base();
|
||||
case 0x44: return HZB_TOWN_EDGE;
|
||||
}
|
||||
}
|
||||
@@ -40,8 +40,8 @@
|
||||
case 0x41: return 0;
|
||||
case 0x42: return IsLevelCrossingTile(this->tile) && IsCrossingBarred(this->tile);
|
||||
case 0x43:
|
||||
if (IsRailDepotTile(this->tile)) return static_cast<int32_t>(Depot::GetByTile(this->tile)->build_date);
|
||||
return static_cast<int32_t>(TimerGameCalendar::date);
|
||||
if (IsRailDepotTile(this->tile)) return Depot::GetByTile(this->tile)->build_date.base();
|
||||
return TimerGameCalendar::date.base();
|
||||
case 0x44: {
|
||||
const Town *t = nullptr;
|
||||
if (IsRailDepotTile(this->tile)) {
|
||||
|
Reference in New Issue
Block a user