Changeset - r16798:1a83d7a480d7
[Not reviewed]
master
0 2 0
smatz - 14 years ago 2010-12-19 20:15:32
smatz@openttd.org
(svn r21541) -Add: {DATE_SHORT} and {DATE_LONG} can now have cases
2 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/strings.cpp
Show inline comments
 
@@ -320,22 +320,22 @@ static char *FormatBytes(char *buff, int
 
	return buff;
 
}
 

	
 
static char *FormatYmdString(char *buff, Date date, const char *last)
 
static char *FormatYmdString(char *buff, Date date, uint modifier, const char *last)
 
{
 
	YearMonthDay ymd;
 
	ConvertDateToYMD(date, &ymd);
 

	
 
	int64 args[3] = { ymd.day + STR_ORDINAL_NUMBER_1ST - 1, STR_MONTH_ABBREV_JAN + ymd.month, ymd.year };
 
	return FormatString(buff, GetStringPtr(STR_FORMAT_DATE_LONG), args, endof(args), 0, last);
 
	return FormatString(buff, GetStringPtr(STR_FORMAT_DATE_LONG), args, endof(args), modifier >> 24, last);
 
}
 

	
 
static char *FormatMonthAndYear(char *buff, Date date, const char *last)
 
static char *FormatMonthAndYear(char *buff, Date date, uint modifier, const char *last)
 
{
 
	YearMonthDay ymd;
 
	ConvertDateToYMD(date, &ymd);
 

	
 
	int64 args[2] = { STR_MONTH_JAN + ymd.month, ymd.year };
 
	return FormatString(buff, GetStringPtr(STR_FORMAT_DATE_SHORT), args, endof(args), 0, last);
 
	return FormatString(buff, GetStringPtr(STR_FORMAT_DATE_SHORT), args, endof(args), modifier >> 24, last);
 
}
 

	
 
static char *FormatTinyOrISODate(char *buff, Date date, StringID str, const char *last)
 
@@ -680,11 +680,11 @@ static char *FormatString(char *buff, co
 
			}
 

	
 
			case SCC_DATE_LONG: // {DATE_LONG}
 
				buff = FormatYmdString(buff, GetInt32(&argv, argve, &argt, SCC_DATE_LONG), last);
 
				buff = FormatYmdString(buff, GetInt32(&argv, argve, &argt, SCC_DATE_LONG), modifier, last);
 
				break;
 

	
 
			case SCC_DATE_SHORT: // {DATE_SHORT}
 
				buff = FormatMonthAndYear(buff, GetInt32(&argv, argve, &argt, SCC_DATE_SHORT), last);
 
				buff = FormatMonthAndYear(buff, GetInt32(&argv, argve, &argt, SCC_DATE_SHORT), modifier, last);
 
				break;
 

	
 
			case SCC_VELOCITY: { // {VELOCITY}
src/table/strgen_tables.h
Show inline comments
 
@@ -68,8 +68,8 @@ static const CmdStruct _cmd_structs[] = 
 
	{"STRING5",         EmitSingleChar, SCC_STRING5,            6, C_CASE | C_GENDER}, // included string that consumes the string id and FIVE arguments
 

	
 
	{"STATIONFEATURES", EmitSingleChar, SCC_STATION_FEATURES,   1, C_NONE}, // station features string, icons of the features
 
	{"INDUSTRY",        EmitSingleChar, SCC_INDUSTRY_NAME,      1, C_GENDER | C_CASE}, // industry, takes an industry #, can have cases
 
	{"CARGO",           EmitSingleChar, SCC_CARGO,              2, C_GENDER},
 
	{"INDUSTRY",        EmitSingleChar, SCC_INDUSTRY_NAME,      1, C_CASE | C_GENDER}, // industry, takes an industry #, can have cases
 
	{"CARGO",           EmitSingleChar, SCC_CARGO,              2, C_NONE | C_GENDER},
 
	{"POWER",           EmitSingleChar, SCC_POWER,              1, C_NONE},
 
	{"VOLUME",          EmitSingleChar, SCC_VOLUME,             1, C_NONE},
 
	{"VOLUME_S",        EmitSingleChar, SCC_VOLUME_SHORT,       1, C_NONE},
 
@@ -83,8 +83,8 @@ static const CmdStruct _cmd_structs[] = 
 
	{"G",               EmitGender,     0,                      0, C_DONTCOUNT}, // gender specifier
 

	
 
	{"DATE_TINY",       EmitSingleChar, SCC_DATE_TINY,          1, C_NONE},
 
	{"DATE_SHORT",      EmitSingleChar, SCC_DATE_SHORT,         1, C_NONE},
 
	{"DATE_LONG",       EmitSingleChar, SCC_DATE_LONG,          1, C_NONE},
 
	{"DATE_SHORT",      EmitSingleChar, SCC_DATE_SHORT,         1, C_CASE},
 
	{"DATE_LONG",       EmitSingleChar, SCC_DATE_LONG,          1, C_CASE},
 
	{"DATE_ISO",        EmitSingleChar, SCC_DATE_ISO,           1, C_NONE},
 

	
 
	{"STRING",          EmitSingleChar, SCC_STRING,             1, C_CASE | C_GENDER},
0 comments (0 inline, 0 general)