summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lang/english.txt3
-rw-r--r--src/strings.cpp15
-rw-r--r--src/table/control_codes.h1
-rw-r--r--src/table/strgen_tables.h1
4 files changed, 19 insertions, 1 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index cfc24b94f..f33f01f45 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -215,6 +215,9 @@ STR_UNITS_VOLUME_LONG_SI :{COMMA} m³
STR_UNITS_FORCE_SI :{COMMA} kN
+STR_UNITS_HEIGHT_IMPERIAL :{COMMA} ft
+STR_UNITS_HEIGHT_SI :{COMMA} m
+
# Common window strings
STR_LIST_FILTER_OSKTITLE :{BLACK}Enter filter string
STR_LIST_FILTER_TOOLTIP :{BLACK}Enter a keyword to filter the list for
diff --git a/src/strings.cpp b/src/strings.cpp
index 613ee8ffc..3f4339153 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -508,6 +508,9 @@ struct Units {
int f_m; ///< Multiplier for force
int f_s; ///< Shift for force
StringID force; ///< String for force
+ int h_m; ///< Multiplier for height
+ int h_s; ///< Shift for height
+ StringID height; ///< String for height
};
/* Unit conversions */
@@ -518,6 +521,7 @@ static const Units units[] = {
1, 0, STR_UNITS_WEIGHT_SHORT_METRIC, STR_UNITS_WEIGHT_LONG_METRIC,
1000, 0, STR_UNITS_VOLUME_SHORT_METRIC, STR_UNITS_VOLUME_LONG_METRIC,
1, 0, STR_UNITS_FORCE_SI,
+ 3, 0, STR_UNITS_HEIGHT_IMPERIAL,
},
{ // Metric (km/h, hp, metric ton, litre, kN)
103, 6, STR_UNITS_VELOCITY_METRIC,
@@ -525,6 +529,7 @@ static const Units units[] = {
1, 0, STR_UNITS_WEIGHT_SHORT_METRIC, STR_UNITS_WEIGHT_LONG_METRIC,
1000, 0, STR_UNITS_VOLUME_SHORT_METRIC, STR_UNITS_VOLUME_LONG_METRIC,
1, 0, STR_UNITS_FORCE_SI,
+ 1, 0, STR_UNITS_HEIGHT_SI,
},
{ // SI (m/s, kilowatt, kilogram, cubic metres, kilonewton)
1831, 12, STR_UNITS_VELOCITY_SI,
@@ -532,6 +537,7 @@ static const Units units[] = {
1000, 0, STR_UNITS_WEIGHT_SHORT_SI, STR_UNITS_WEIGHT_LONG_SI,
1, 0, STR_UNITS_VOLUME_SHORT_SI, STR_UNITS_VOLUME_LONG_SI,
1, 0, STR_UNITS_FORCE_SI,
+ 1, 0, STR_UNITS_HEIGHT_SI,
},
};
@@ -603,7 +609,7 @@ static char *FormatString(char *buff, const char *str, int64 *argv, uint casei,
buff = FormatMonthAndYear(buff, GetInt32(&argv), last);
break;
- case SCC_VELOCITY: {// {VELOCITY}
+ case SCC_VELOCITY: { // {VELOCITY}
int64 args[1];
assert(_settings_game.locale.units < lengthof(units));
args[0] = ConvertSpeedToDisplaySpeed(GetInt32(&argv) * 10 / 16);
@@ -612,6 +618,13 @@ static char *FormatString(char *buff, const char *str, int64 *argv, uint casei,
break;
}
+ case SCC_HEIGHT: { // {HEIGHT}
+ int64 args[1] = {GetInt32(&argv) * units[_settings_game.locale.units].h_m >> units[_settings_game.locale.units].h_s};
+ buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].height), args, modifier >> 24, last);
+ modifier = 0;
+ break;
+ }
+
case SCC_CURRENCY_COMPACT: // {CURRCOMPACT}
buff = FormatGenericCurrency(buff, _currency, GetInt64(&argv), true, last);
break;
diff --git a/src/table/control_codes.h b/src/table/control_codes.h
index 29ad80b26..4df3badee 100644
--- a/src/table/control_codes.h
+++ b/src/table/control_codes.h
@@ -56,6 +56,7 @@ enum StringControlCode {
SCC_WEIGHT_SHORT,
SCC_FORCE,
SCC_VELOCITY,
+ SCC_HEIGHT,
SCC_DATE_TINY,
SCC_DATE_SHORT,
diff --git a/src/table/strgen_tables.h b/src/table/strgen_tables.h
index b657f80ac..c0271434a 100644
--- a/src/table/strgen_tables.h
+++ b/src/table/strgen_tables.h
@@ -77,6 +77,7 @@ static const CmdStruct _cmd_structs[] = {
{"WEIGHT_S", EmitSingleChar, SCC_WEIGHT_SHORT, 1, C_NONE},
{"FORCE", EmitSingleChar, SCC_FORCE, 1, C_NONE},
{"VELOCITY", EmitSingleChar, SCC_VELOCITY, 1, C_NONE},
+ {"HEIGHT", EmitSingleChar, SCC_HEIGHT, 1, C_NONE},
{"P", EmitPlural, 0, 0, C_DONTCOUNT}, // plural specifier
{"G", EmitGender, 0, 0, C_DONTCOUNT}, // gender specifier