diff options
author | truebrain <truebrain@openttd.org> | 2011-11-23 16:04:28 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-11-23 16:04:28 +0000 |
commit | 4e09cde6495f35a6d56cacc0dbf636df7bc94dbd (patch) | |
tree | fa1f58ed1e44a0481c4621fa8f955aacc9b8cfd2 /src/strings.cpp | |
parent | 389ffec7dbd8ba69fddb477840fcb6f34221583c (diff) | |
download | openttd-4e09cde6495f35a6d56cacc0dbf636df7bc94dbd.tar.xz |
(svn r23297) -Add: {CARGO_TINY} (Rubidium)
Diffstat (limited to 'src/strings.cpp')
-rw-r--r-- | src/strings.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index c44e2f912..06c4132d5 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -912,6 +912,31 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg buff = FormatBytes(buff, args->GetInt64(), last); break; + case SCC_CARGO_TINY: { // {CARGO_TINY} + /* Tiny description of cargotypes. Layout: + * param 1: cargo type + * param 2: cargo count */ + StringID cargo_str = CargoSpec::Get(args->GetInt32(SCC_CARGO_SHORT))->units_volume; + int64 amount = 0; + switch (cargo_str) { + case STR_TONS: + amount = _units[_settings_game.locale.units].c_weight.ToDisplay(args->GetInt64()); + break; + + case STR_LITERS: + amount = _units[_settings_game.locale.units].c_volume.ToDisplay(args->GetInt64()); + break; + + default: { + amount = args->GetInt64(); + break; + } + } + + buff = FormatCommaNumber(buff, amount, last); + break; + } + case SCC_CARGO_SHORT: { // {CARGO_SHORT} /* Short description of cargotypes. Layout: * param 1: cargo type |