1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 12:33:17 +01:00

Replacing set_format_arg_on macro in favor of a more C++zy solution (#11350)

This commit is contained in:
Breno Rodrigues Guimarães
2020-04-20 02:10:33 -03:00
committed by GitHub
parent 6992299c1a
commit d4a2a98e20
10 changed files with 146 additions and 129 deletions

View File

@@ -112,22 +112,20 @@ private:
{
char str_downloading_objects[256]{};
uint8_t args[32]{};
Formatter ft(args);
if (_downloadStatusInfo.Source.empty())
{
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());
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
ft.add<char*>(_downloadStatusInfo.Name.c_str());
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS, args);
}
else
{
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, 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));
ft.add<char*>(_downloadStatusInfo.Name.c_str());
ft.add<char*>(_downloadStatusInfo.Source.c_str());
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, args);
}