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

@@ -227,8 +227,8 @@ void SerializeNetworkGameInfo(Packet *p, const NetworkServerGameInfo *info, bool
}
/* NETWORK_GAME_INFO_VERSION = 3 */
p->Send_uint32(static_cast<int32_t>(info->game_date));
p->Send_uint32(static_cast<int32_t>(info->start_date));
p->Send_uint32(info->game_date.base());
p->Send_uint32(info->start_date.base());
/* NETWORK_GAME_INFO_VERSION = 2 */
p->Send_uint8 (info->companies_max);
@@ -321,8 +321,8 @@ void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfo
}
case 3:
info->game_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(CalendarTime::MAX_DATE));
info->start_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(CalendarTime::MAX_DATE));
info->game_date = Clamp(p->Recv_uint32(), 0, CalendarTime::MAX_DATE.base());
info->start_date = Clamp(p->Recv_uint32(), 0, CalendarTime::MAX_DATE.base());
FALLTHROUGH;
case 2: