(svn r23297) -Add: {CARGO_TINY} (Rubidium)

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
truebrain 13 years ago
parent 389ffec7db
commit 4e09cde649

@ -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

@ -50,6 +50,7 @@ enum StringControlCode {
SCC_CARGO_LONG,
SCC_CARGO_SHORT,
SCC_CARGO_TINY,
SCC_POWER,
SCC_VOLUME_LONG,
SCC_VOLUME_SHORT,

@ -69,6 +69,7 @@ static const CmdStruct _cmd_structs[] = {
{"INDUSTRY", EmitSingleChar, SCC_INDUSTRY_NAME, 1, C_CASE | C_GENDER}, // industry, takes an industry #, can have cases
{"CARGO_LONG", EmitSingleChar, SCC_CARGO_LONG, 2, C_NONE | C_GENDER},
{"CARGO_SHORT", EmitSingleChar, SCC_CARGO_SHORT, 2, C_NONE}, // short cargo description, only ### tons, or ### litres
{"CARGO_TINY", EmitSingleChar, SCC_CARGO_TINY, 2, C_NONE}, // tiny cargo description with only the amount, not a specifier for the amount or the actual cargo name
{"POWER", EmitSingleChar, SCC_POWER, 1, C_NONE},
{"VOLUME_LONG", EmitSingleChar, SCC_VOLUME_LONG, 1, C_NONE},
{"VOLUME_SHORT", EmitSingleChar, SCC_VOLUME_SHORT, 1, C_NONE},

Loading…
Cancel
Save