1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Use named casts instead of old-style casts

Change prepared with clang-tidy and google-readability-casting check
This commit is contained in:
Michał Janiszewski
2020-04-22 17:09:29 +02:00
committed by GitHub
parent cfd94d4fa5
commit 2323cc1596
114 changed files with 604 additions and 560 deletions

View File

@@ -39,7 +39,7 @@ static bool StringIsBlank(const utf8* str)
{
for (auto ch = str; *ch != '\0'; ch++)
{
if (!isblank((uint8_t)*ch))
if (!isblank(static_cast<uint8_t>(*ch)))
{
return false;
}
@@ -52,10 +52,10 @@ void StringTable::Read(IReadObjectContext* context, IStream* stream, uint8_t id)
try
{
RCT2LanguageId rct2LanguageId;
while ((rct2LanguageId = (RCT2LanguageId)stream->ReadValue<uint8_t>()) != RCT2_LANGUAGE_ID_END)
while ((rct2LanguageId = static_cast<RCT2LanguageId>(stream->ReadValue<uint8_t>())) != RCT2_LANGUAGE_ID_END)
{
uint8_t languageId = (rct2LanguageId <= RCT2_LANGUAGE_ID_PORTUGUESE) ? RCT2ToOpenRCT2LanguageId[rct2LanguageId]
: (uint8_t)LANGUAGE_UNDEFINED;
: static_cast<uint8_t>(LANGUAGE_UNDEFINED);
StringTableEntry entry{};
entry.Id = id;
entry.LanguageId = languageId;