1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Use named casts on openrct2-ui/windows (#11136)

This commit is contained in:
Tulio Leao
2020-04-18 08:32:48 -03:00
committed by GitHub
parent b71062ce1b
commit 935cfe90fc
44 changed files with 326 additions and 298 deletions

View File

@@ -114,8 +114,8 @@ private:
uint8_t args[32]{};
if (_downloadStatusInfo.Source.empty())
{
set_format_arg_on(args, 0, int16_t, (int16_t)_downloadStatusInfo.Count);
set_format_arg_on(args, 2, int16_t, (int16_t)_downloadStatusInfo.Total);
set_format_arg_on(args, 0, int16_t, static_cast<int16_t>(_downloadStatusInfo.Count));
set_format_arg_on(args, 2, int16_t, static_cast<int16_t>(_downloadStatusInfo.Total));
set_format_arg_on(args, 4, char*, _downloadStatusInfo.Name.c_str());
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS, args);
}
@@ -123,9 +123,11 @@ private:
{
set_format_arg_on(args, 0, char*, _downloadStatusInfo.Name.c_str());
set_format_arg_on(args, sizeof(char*), char*, _downloadStatusInfo.Source.c_str());
set_format_arg_on(args, sizeof(char*) + sizeof(char*), int16_t, (int16_t)_downloadStatusInfo.Count);
set_format_arg_on(
args, sizeof(char*) + sizeof(char*) + sizeof(int16_t), int16_t, (int16_t)_downloadStatusInfo.Total);
args, sizeof(char*) + sizeof(char*), int16_t, static_cast<int16_t>(_downloadStatusInfo.Count));
set_format_arg_on(
args, sizeof(char*) + sizeof(char*) + sizeof(int16_t), int16_t,
static_cast<int16_t>(_downloadStatusInfo.Total));
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, args);
}
@@ -163,7 +165,7 @@ private:
// Check that download operation hasn't been cancelled
if (_downloadingObjects)
{
auto data = (uint8_t*)response.body.data();
auto data = reinterpret_cast<uint8_t*>(response.body.data());
auto dataLen = response.body.size();
auto& objRepo = OpenRCT2::GetContext()->GetObjectRepository();
@@ -232,7 +234,7 @@ private:
}
else
{
std::printf(" %s query failed (status %d)\n", name.c_str(), (int32_t)response.status);
std::printf(" %s query failed (status %d)\n", name.c_str(), static_cast<int32_t>(response.status));
QueueNextDownload();
}
});
@@ -441,7 +443,7 @@ rct_window* window_object_load_error_open(utf8* path, size_t numMissingObjects,
}
// Refresh list items and path
window->no_list_items = (uint16_t)numMissingObjects;
window->no_list_items = static_cast<uint16_t>(numMissingObjects);
file_path = path;
window->Invalidate();
@@ -626,7 +628,7 @@ static void window_object_load_error_update_list(rct_window* w)
_invalid_entries.begin(), _invalid_entries.end(),
[de](const rct_object_entry& e) { return std::memcmp(de.name, e.name, sizeof(e.name)) == 0; }),
_invalid_entries.end());
w->no_list_items = (uint16_t)_invalid_entries.size();
w->no_list_items = static_cast<uint16_t>(_invalid_entries.size());
}
}