Changeset - r18443:ceff9a227677
[Not reviewed]
master
0 3 0
truebrain - 13 years ago 2011-11-23 16:04:28
truebrain@openttd.org
(svn r23297) -Add: {CARGO_TINY} (Rubidium)
3 files changed with 27 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/strings.cpp
Show inline comments
 
@@ -912,6 +912,31 @@ static char *FormatString(char *buff, co
 
				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
src/table/control_codes.h
Show inline comments
 
@@ -50,6 +50,7 @@ enum StringControlCode {
 

	
 
	SCC_CARGO_LONG,
 
	SCC_CARGO_SHORT,
 
	SCC_CARGO_TINY,
 
	SCC_POWER,
 
	SCC_VOLUME_LONG,
 
	SCC_VOLUME_SHORT,
src/table/strgen_tables.h
Show inline comments
 
@@ -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},
0 comments (0 inline, 0 general)