From da21772f2d4cbf30743ba9d3c91d96d5f2759728 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 6 Jul 2023 18:50:27 +0200 Subject: [PATCH] Fix #11108, e2f583a: missing argument for SCC_CARGO_SHORT formatting (cherry picked from commit 968de827d63c72c71b8b6f38ec0e19ea3d05b559) --- src/strings.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/strings.cpp b/src/strings.cpp index b16d7d9691..5773ad911a 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1435,17 +1435,19 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg switch (cargo_str) { case STR_TONS: { assert(_settings_game.locale.units_weight < lengthof(_units_weight)); - int64 args_array[] = {_units_weight[_settings_game.locale.units_weight].c.ToDisplay(args->GetInt64())}; + const auto &x = _units_weight[_settings_game.locale.units_weight]; + int64 args_array[] = {x.c.ToDisplay(args->GetInt64()), x.decimal_places}; StringParameters tmp_params(args_array); - buff = FormatString(buff, GetStringPtr(_units_weight[_settings_game.locale.units_weight].l), &tmp_params, last); + buff = FormatString(buff, GetStringPtr(x.l), &tmp_params, last); break; } case STR_LITERS: { assert(_settings_game.locale.units_volume < lengthof(_units_volume)); - int64 args_array[] = {_units_volume[_settings_game.locale.units_volume].c.ToDisplay(args->GetInt64())}; + const auto &x = _units_volume[_settings_game.locale.units_volume]; + int64 args_array[] = {x.c.ToDisplay(args->GetInt64()), x.decimal_places}; StringParameters tmp_params(args_array); - buff = FormatString(buff, GetStringPtr(_units_volume[_settings_game.locale.units_volume].l), &tmp_params, last); + buff = FormatString(buff, GetStringPtr(x.l), &tmp_params, last); break; }