mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-22 23:26:34 +00:00
(svn r4126) - Feature: A new multi-lingual multi-measuring-unit system:
- Replace miles/kilometres game option with a general measuring units option. - Add {POWER}, {WEIGHT}, {WEIGHT_S} and {VOLUME_S} (_S for short) tags to the language/string system. - Add SI as option for measuring units. Language file updates to use the system will come soon.
This commit is contained in:
parent
a91c52e169
commit
38a0ef3bc6
@ -278,8 +278,6 @@ STR_OSNAME_MORPHOS :MorphOS
|
|||||||
STR_OSNAME_AMIGAOS :AmigaOS
|
STR_OSNAME_AMIGAOS :AmigaOS
|
||||||
STR_OSNAME_OS2 :OS/2
|
STR_OSNAME_OS2 :OS/2
|
||||||
|
|
||||||
STR_0139_IMPERIAL_MILES :Imperial (miles)
|
|
||||||
STR_013A_METRIC_KILOMETERS :Metric (kilometers)
|
|
||||||
STR_013B_OWNED_BY :{WHITE}...owned by {STRING2}
|
STR_013B_OWNED_BY :{WHITE}...owned by {STRING2}
|
||||||
STR_013C_CARGO :{BLACK}Cargo
|
STR_013C_CARGO :{BLACK}Cargo
|
||||||
STR_013D_INFORMATION :{BLACK}Information
|
STR_013D_INFORMATION :{BLACK}Information
|
||||||
@ -308,6 +306,34 @@ STR_0151_MAP_OF_WORLD :Map of world
|
|||||||
STR_0152_TOWN_DIRECTORY :Town directory
|
STR_0152_TOWN_DIRECTORY :Town directory
|
||||||
STR_0153_SUBSIDIES :Subsidies
|
STR_0153_SUBSIDIES :Subsidies
|
||||||
|
|
||||||
|
STR_UNITS_IMPERIAL :Imperial
|
||||||
|
STR_UNITS_METRIC :Metric
|
||||||
|
STR_UNITS_SI :SI
|
||||||
|
|
||||||
|
STR_UNITS_VELOCITY_IMPERIAL :{COMMA} mph
|
||||||
|
STR_UNITS_VELOCITY_METRIC :{COMMA} km/h
|
||||||
|
STR_UNITS_VELOCITY_SI :{COMMA} m/s
|
||||||
|
|
||||||
|
STR_UNITS_POWER_IMPERIAL :{COMMA}hp
|
||||||
|
STR_UNITS_POWER_METRIC :{COMMA}hp
|
||||||
|
STR_UNITS_POWER_SI :{COMMA}kW
|
||||||
|
|
||||||
|
STR_UNITS_WEIGHT_SHORT_IMPERIAL :{COMMA}t
|
||||||
|
STR_UNITS_WEIGHT_SHORT_METRIC :{COMMA}t
|
||||||
|
STR_UNITS_WEIGHT_SHORT_SI :{COMMA}kg
|
||||||
|
|
||||||
|
STR_UNITS_WEIGHT_LONG_IMPERIAL :{COMMA} ton{P "" s}
|
||||||
|
STR_UNITS_WEIGHT_LONG_METRIC :{COMMA} tonne{P "" s}
|
||||||
|
STR_UNITS_WEIGHT_LONG_SI :{COMMA} kg
|
||||||
|
|
||||||
|
STR_UNITS_VOLUME_SHORT_IMPERIAL :{COMMA}gal
|
||||||
|
STR_UNITS_VOLUME_SHORT_METRIC :{COMMA}l
|
||||||
|
STR_UNITS_VOLUME_SHORT_SI :{COMMA}m³
|
||||||
|
|
||||||
|
STR_UNITS_VOLUME_LONG_IMPERIAL :{COMMA} gallon{P "" s}
|
||||||
|
STR_UNITS_VOLUME_LONG_METRIC :{COMMA} litre{P "" s}
|
||||||
|
STR_UNITS_VOLUME_LONG_SI :{COMMA} m³
|
||||||
|
|
||||||
############ range for menu starts
|
############ range for menu starts
|
||||||
STR_0154_OPERATING_PROFIT_GRAPH :Operating profit graph
|
STR_0154_OPERATING_PROFIT_GRAPH :Operating profit graph
|
||||||
STR_0155_INCOME_GRAPH :Income graph
|
STR_0155_INCOME_GRAPH :Income graph
|
||||||
@ -760,9 +786,9 @@ STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT :{BLACK}Paste th
|
|||||||
STR_02E0_CURRENCY_UNITS :{BLACK}Currency units
|
STR_02E0_CURRENCY_UNITS :{BLACK}Currency units
|
||||||
STR_02E1 :{BLACK}{SKIP}{STRING}
|
STR_02E1 :{BLACK}{SKIP}{STRING}
|
||||||
STR_02E2_CURRENCY_UNITS_SELECTION :{BLACK}Currency units selection
|
STR_02E2_CURRENCY_UNITS_SELECTION :{BLACK}Currency units selection
|
||||||
STR_02E3_DISTANCE_UNITS :{BLACK}Distance units
|
STR_MEASURING_UNITS :{BLACK}Measuring units
|
||||||
STR_02E4 :{BLACK}{SKIP}{SKIP}{STRING}
|
STR_02E4 :{BLACK}{SKIP}{SKIP}{STRING}
|
||||||
STR_02E5_DISTANCE_UNITS_SELECTION :{BLACK}Distance units selection
|
STR_MEASURING_UNITS_SELECTION :{BLACK}Measuring units selection
|
||||||
STR_02E6_ROAD_VEHICLES :{BLACK}Road vehicles
|
STR_02E6_ROAD_VEHICLES :{BLACK}Road vehicles
|
||||||
STR_02E7 :{BLACK}{SKIP}{SKIP}{SKIP}{STRING}
|
STR_02E7 :{BLACK}{SKIP}{SKIP}{SKIP}{STRING}
|
||||||
STR_02E8_SELECT_SIDE_OF_ROAD_FOR :{BLACK}Select side of road for vehicles to drive on
|
STR_02E8_SELECT_SIDE_OF_ROAD_FOR :{BLACK}Select side of road for vehicles to drive on
|
||||||
|
@ -1495,7 +1495,7 @@ static const OldChunks main_chunk[] = {
|
|||||||
OCL_VAR ( OC_FILE_U8 | OC_VAR_U16, 1, &_station_tick_ctr ),
|
OCL_VAR ( OC_FILE_U8 | OC_VAR_U16, 1, &_station_tick_ctr ),
|
||||||
|
|
||||||
OCL_VAR ( OC_UINT8, 1, &_opt.currency ),
|
OCL_VAR ( OC_UINT8, 1, &_opt.currency ),
|
||||||
OCL_VAR ( OC_UINT8, 1, &_opt.kilometers ),
|
OCL_VAR ( OC_UINT8, 1, &_opt.units ),
|
||||||
OCL_VAR ( OC_FILE_U8 | OC_VAR_U32, 1, &_cur_player_tick_index ),
|
OCL_VAR ( OC_FILE_U8 | OC_VAR_U32, 1, &_cur_player_tick_index ),
|
||||||
|
|
||||||
OCL_NULL( 2 ), // Date stuff, calculated automatically
|
OCL_NULL( 2 ), // Date stuff, calculated automatically
|
||||||
|
@ -1127,7 +1127,7 @@ static const SettingDesc _gameopt_settings[] = {
|
|||||||
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, NULL, STR_NULL, NULL, 4, SL_MAX_VERSION),
|
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, NULL, STR_NULL, NULL, 4, SL_MAX_VERSION),
|
||||||
SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9,0, 9, STR_NULL, NULL),
|
SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9,0, 9, STR_NULL, NULL),
|
||||||
SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, 23, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SEK|custom", STR_NULL, NULL),
|
SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, 23, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SEK|custom", STR_NULL, NULL),
|
||||||
SDT_OMANY(GameOptions, kilometers,SLE_UINT8, N, 0, 1, 1, "imperial|metric", STR_NULL, NULL),
|
SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL),
|
||||||
SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 16, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss", STR_NULL, NULL),
|
SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 16, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss", STR_NULL, NULL),
|
||||||
SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "normal|hilly|desert|candy", STR_NULL, NULL),
|
SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "normal|hilly|desert|candy", STR_NULL, NULL),
|
||||||
SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 1,0,56, STR_NULL, NULL),
|
SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 1,0,56, STR_NULL, NULL),
|
||||||
|
@ -24,9 +24,10 @@ static uint32 _difficulty_click_a;
|
|||||||
static uint32 _difficulty_click_b;
|
static uint32 _difficulty_click_b;
|
||||||
static byte _difficulty_timeout;
|
static byte _difficulty_timeout;
|
||||||
|
|
||||||
static const StringID _distances_dropdown[] = {
|
static const StringID _units_dropdown[] = {
|
||||||
STR_0139_IMPERIAL_MILES,
|
STR_UNITS_IMPERIAL,
|
||||||
STR_013A_METRIC_KILOMETERS,
|
STR_UNITS_METRIC,
|
||||||
|
STR_UNITS_SI,
|
||||||
INVALID_STRING_ID
|
INVALID_STRING_ID
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
|
|||||||
w->disabled_state = (_vehicle_design_names & 1) ? (++str, 0) : (1 << 21);
|
w->disabled_state = (_vehicle_design_names & 1) ? (++str, 0) : (1 << 21);
|
||||||
SetDParam(0, str);
|
SetDParam(0, str);
|
||||||
SetDParam(1, _currency_string_list[_opt_ptr->currency]);
|
SetDParam(1, _currency_string_list[_opt_ptr->currency]);
|
||||||
SetDParam(2, _opt_ptr->kilometers + STR_0139_IMPERIAL_MILES);
|
SetDParam(2, STR_UNITS_IMPERIAL + _opt_ptr->units);
|
||||||
SetDParam(3, STR_02E9_DRIVE_ON_LEFT + _opt_ptr->road_side);
|
SetDParam(3, STR_02E9_DRIVE_ON_LEFT + _opt_ptr->road_side);
|
||||||
SetDParam(4, STR_TOWNNAME_ORIGINAL_ENGLISH + _opt_ptr->town_name);
|
SetDParam(4, STR_TOWNNAME_ORIGINAL_ENGLISH + _opt_ptr->town_name);
|
||||||
SetDParam(5, _autosave_dropdown[_opt_ptr->autosave]);
|
SetDParam(5, _autosave_dropdown[_opt_ptr->autosave]);
|
||||||
@ -115,7 +116,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
|
|||||||
ShowDropDownMenu(w, _currency_string_list, _opt_ptr->currency, 5, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);
|
ShowDropDownMenu(w, _currency_string_list, _opt_ptr->currency, 5, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);
|
||||||
return;
|
return;
|
||||||
case 7: case 8: /* Setup distance unit dropdown */
|
case 7: case 8: /* Setup distance unit dropdown */
|
||||||
ShowDropDownMenu(w, _distances_dropdown, _opt_ptr->kilometers, 8, 0, 0);
|
ShowDropDownMenu(w, _units_dropdown, _opt_ptr->units, 8, 0, 0);
|
||||||
return;
|
return;
|
||||||
case 10: case 11: { /* Setup road-side dropdown */
|
case 10: case 11: { /* Setup road-side dropdown */
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -174,8 +175,8 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
|
|||||||
_opt_ptr->currency = e->dropdown.index;
|
_opt_ptr->currency = e->dropdown.index;
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
break;
|
break;
|
||||||
case 8: /* Distance units */
|
case 8: /* Measuring units */
|
||||||
_opt_ptr->kilometers = e->dropdown.index;
|
_opt_ptr->units = e->dropdown.index;
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
break;
|
break;
|
||||||
case 11: /* Road side */
|
case 11: /* Road side */
|
||||||
@ -241,9 +242,9 @@ static const Widget _game_options_widgets[] = {
|
|||||||
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 20, 55, STR_02E0_CURRENCY_UNITS, STR_NULL},
|
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 20, 55, STR_02E0_CURRENCY_UNITS, STR_NULL},
|
||||||
{ WWT_6, RESIZE_NONE, 14, 20, 169, 34, 45, STR_02E1, STR_02E2_CURRENCY_UNITS_SELECTION},
|
{ WWT_6, RESIZE_NONE, 14, 20, 169, 34, 45, STR_02E1, STR_02E2_CURRENCY_UNITS_SELECTION},
|
||||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 158, 168, 35, 44, STR_0225, STR_02E2_CURRENCY_UNITS_SELECTION},
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 158, 168, 35, 44, STR_0225, STR_02E2_CURRENCY_UNITS_SELECTION},
|
||||||
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 20, 55, STR_02E3_DISTANCE_UNITS, STR_NULL},
|
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 20, 55, STR_MEASURING_UNITS, STR_NULL},
|
||||||
{ WWT_6, RESIZE_NONE, 14, 200, 349, 34, 45, STR_02E4, STR_02E5_DISTANCE_UNITS_SELECTION},
|
{ WWT_6, RESIZE_NONE, 14, 200, 349, 34, 45, STR_02E4, STR_MEASURING_UNITS_SELECTION},
|
||||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 338, 348, 35, 44, STR_0225, STR_02E5_DISTANCE_UNITS_SELECTION},
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 338, 348, 35, 44, STR_0225, STR_MEASURING_UNITS_SELECTION},
|
||||||
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 62, 97, STR_02E6_ROAD_VEHICLES, STR_NULL},
|
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 62, 97, STR_02E6_ROAD_VEHICLES, STR_NULL},
|
||||||
{ WWT_6, RESIZE_NONE, 14, 20, 169, 76, 87, STR_02E7, STR_02E8_SELECT_SIDE_OF_ROAD_FOR},
|
{ WWT_6, RESIZE_NONE, 14, 20, 169, 76, 87, STR_02E7, STR_02E8_SELECT_SIDE_OF_ROAD_FOR},
|
||||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 158, 168, 77, 86, STR_0225, STR_02E8_SELECT_SIDE_OF_ROAD_FOR},
|
{ WWT_TEXTBTN, RESIZE_NONE, 14, 158, 168, 77, 86, STR_0225, STR_02E8_SELECT_SIDE_OF_ROAD_FOR},
|
||||||
|
@ -438,6 +438,10 @@ static const CmdStruct _cmd_structs[] = {
|
|||||||
{"VOLUME", EmitEscapedByte, 12, 1, 0},
|
{"VOLUME", EmitEscapedByte, 12, 1, 0},
|
||||||
{"DATE_TINY", EmitEscapedByte, 14, 1, 0},
|
{"DATE_TINY", EmitEscapedByte, 14, 1, 0},
|
||||||
{"CARGO", EmitEscapedByte, 15, 2, 0},
|
{"CARGO", EmitEscapedByte, 15, 2, 0},
|
||||||
|
{"POWER", EmitEscapedByte, 16, 1, 0},
|
||||||
|
{"VOLUME_S", EmitEscapedByte, 17, 1, 0},
|
||||||
|
{"WEIGHT", EmitEscapedByte, 18, 1, 0},
|
||||||
|
{"WEIGHT_S", EmitEscapedByte, 19, 1, 0},
|
||||||
|
|
||||||
{"P", EmitPlural, 0, 0, C_DONTCOUNT}, // plural specifier
|
{"P", EmitPlural, 0, 0, C_DONTCOUNT}, // plural specifier
|
||||||
{"G", EmitGender, 0, 0, C_DONTCOUNT}, // gender specifier
|
{"G", EmitGender, 0, 0, C_DONTCOUNT}, // gender specifier
|
||||||
|
125
strings.c
125
strings.c
@ -480,6 +480,43 @@ static const char *ParseStringChoice(const char *b, uint form, char *dst, int *d
|
|||||||
return b + pos;
|
return b + pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct Units {
|
||||||
|
int s_m; ///< Multiplier for velocity
|
||||||
|
int s_s; ///< Shift for velocity
|
||||||
|
StringID velocity; ///< String for velocity
|
||||||
|
int p_m; ///< Multiplier for power
|
||||||
|
int p_s; ///< Shift for power
|
||||||
|
StringID power; ///< String for velocity
|
||||||
|
int w_m; ///< Multiplier for weight
|
||||||
|
int w_s; ///< Shift for weight
|
||||||
|
StringID s_weight; ///< Short string for weight
|
||||||
|
StringID l_weight; ///< Long string for weight
|
||||||
|
int v_m; ///< Multiplier for volume
|
||||||
|
int v_s; ///< Shift for volume
|
||||||
|
StringID s_volume; ///< Short string for volume
|
||||||
|
StringID l_volume; ///< Long string for volume
|
||||||
|
} Units;
|
||||||
|
|
||||||
|
static const Units units[] = {
|
||||||
|
{ // Imperial (Original)
|
||||||
|
1, 0, STR_UNITS_VELOCITY_IMPERIAL,
|
||||||
|
1, 0, STR_UNITS_POWER_IMPERIAL,
|
||||||
|
1, 0, STR_UNITS_WEIGHT_SHORT_METRIC, STR_UNITS_WEIGHT_LONG_METRIC,
|
||||||
|
1000, 0, STR_UNITS_VOLUME_SHORT_METRIC, STR_UNITS_VOLUME_LONG_METRIC,
|
||||||
|
},
|
||||||
|
{ // Metric
|
||||||
|
1648, 10, STR_UNITS_VELOCITY_METRIC,
|
||||||
|
1, 0, STR_UNITS_POWER_METRIC,
|
||||||
|
1, 0, STR_UNITS_WEIGHT_SHORT_METRIC, STR_UNITS_WEIGHT_LONG_METRIC,
|
||||||
|
1000, 0, STR_UNITS_VOLUME_SHORT_METRIC, STR_UNITS_VOLUME_LONG_METRIC,
|
||||||
|
},
|
||||||
|
{ // SI
|
||||||
|
458, 10, STR_UNITS_VELOCITY_SI,
|
||||||
|
764, 10, STR_UNITS_POWER_SI,
|
||||||
|
1000, 0, STR_UNITS_WEIGHT_SHORT_SI, STR_UNITS_WEIGHT_LONG_SI,
|
||||||
|
1000, 0, STR_UNITS_VOLUME_SHORT_SI, STR_UNITS_VOLUME_LONG_SI,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
static char *FormatString(char *buff, const char *str, const int32 *argv, uint casei)
|
static char *FormatString(char *buff, const char *str, const int32 *argv, uint casei)
|
||||||
{
|
{
|
||||||
@ -510,16 +547,11 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
|
|||||||
buff = FormatMonthAndYear(buff, GetInt32(&argv));
|
buff = FormatMonthAndYear(buff, GetInt32(&argv));
|
||||||
break;
|
break;
|
||||||
case 0x84: {// {VELOCITY}
|
case 0x84: {// {VELOCITY}
|
||||||
int value = GetInt32(&argv);
|
int32 args[1];
|
||||||
if (_opt_ptr->kilometers) value = value * 1648 >> 10;
|
assert(_opt_ptr->units < lengthof(units));
|
||||||
buff = FormatCommaNumber(buff, value);
|
args[0] = GetInt32(&argv) * units[_opt_ptr->units].s_m >> units[_opt_ptr->units].s_s;
|
||||||
if (_opt_ptr->kilometers) {
|
buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].velocity), args, modifier >> 24);
|
||||||
memcpy(buff, " km/h", 5);
|
modifier = 0;
|
||||||
buff += 5;
|
|
||||||
} else {
|
|
||||||
memcpy(buff, " mph", 4);
|
|
||||||
buff += 4;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 0x85 is used as escape character..
|
// 0x85 is used as escape character..
|
||||||
@ -536,11 +568,31 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
|
|||||||
// 8-bit = cargo type
|
// 8-bit = cargo type
|
||||||
// 16-bit = cargo count
|
// 16-bit = cargo count
|
||||||
StringID cargo_str = _cargo_string_list[_opt_ptr->landscape][GetInt32(&argv)];
|
StringID cargo_str = _cargo_string_list[_opt_ptr->landscape][GetInt32(&argv)];
|
||||||
uint16 multiplier = (cargo_str == STR_LITERS) ? 1000 : 1;
|
switch (cargo_str) {
|
||||||
// liquid type of cargo is multiplied by 100 to get correct amount
|
case STR_TONS: {
|
||||||
buff = FormatCommaNumber(buff, GetInt32(&argv) * multiplier);
|
int32 args[1];
|
||||||
buff = strecpy(buff, " ", NULL);
|
assert(_opt_ptr->units < lengthof(units));
|
||||||
buff = strecpy(buff, GetStringPtr(cargo_str), NULL);
|
args[0] = GetInt32(&argv) * units[_opt_ptr->units].w_m >> units[_opt_ptr->units].w_s;
|
||||||
|
buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].l_weight), args, modifier >> 24);
|
||||||
|
modifier = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STR_LITERS: {
|
||||||
|
int32 args[1];
|
||||||
|
assert(_opt_ptr->units < lengthof(units));
|
||||||
|
args[0] = GetInt32(&argv) * units[_opt_ptr->units].v_m >> units[_opt_ptr->units].v_s;
|
||||||
|
buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].l_volume), args, modifier >> 24);
|
||||||
|
modifier = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
buff = FormatCommaNumber(buff, GetInt32(&argv));
|
||||||
|
buff = strecpy(buff, " ", NULL);
|
||||||
|
buff = strecpy(buff, GetStringPtr(cargo_str), NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case 4: {/* {CURRCOMPACT64} */
|
case 4: {/* {CURRCOMPACT64} */
|
||||||
// 64 bit compact currency-unit
|
// 64 bit compact currency-unit
|
||||||
@ -605,9 +657,10 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 12: { // {VOLUME}
|
case 12: { // {VOLUME}
|
||||||
buff = FormatCommaNumber(buff, GetInt32(&argv) * 1000);
|
int32 args[1];
|
||||||
buff = strecpy(buff, " ", NULL);
|
assert(_opt_ptr->units < lengthof(units));
|
||||||
buff = FormatString(buff, GetStringPtr(STR_LITERS), NULL, modifier >> 24);
|
args[0] = GetInt32(&argv) * units[_opt_ptr->units].v_m >> units[_opt_ptr->units].v_s;
|
||||||
|
buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].l_volume), args, modifier >> 24);
|
||||||
modifier = 0;
|
modifier = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -636,6 +689,42 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 16: { // {POWER}
|
||||||
|
int32 args[1];
|
||||||
|
assert(_opt_ptr->units < lengthof(units));
|
||||||
|
args[0] = GetInt32(&argv) * units[_opt_ptr->units].p_m >> units[_opt_ptr->units].p_s;
|
||||||
|
buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].power), args, modifier >> 24);
|
||||||
|
modifier = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 17: { // {VOLUME_S}
|
||||||
|
int32 args[1];
|
||||||
|
assert(_opt_ptr->units < lengthof(units));
|
||||||
|
args[0] = GetInt32(&argv) * units[_opt_ptr->units].v_m >> units[_opt_ptr->units].v_s;
|
||||||
|
buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].s_volume), args, modifier >> 24);
|
||||||
|
modifier = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 18: { // {WEIGHT}
|
||||||
|
int32 args[1];
|
||||||
|
assert(_opt_ptr->units < lengthof(units));
|
||||||
|
args[0] = GetInt32(&argv) * units[_opt_ptr->units].w_m >> units[_opt_ptr->units].w_s;
|
||||||
|
buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].l_weight), args, modifier >> 24);
|
||||||
|
modifier = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 19: { // {WEIGHT_S}
|
||||||
|
int32 args[1];
|
||||||
|
assert(_opt_ptr->units < lengthof(units));
|
||||||
|
args[0] = GetInt32(&argv) * units[_opt_ptr->units].w_m >> units[_opt_ptr->units].w_s;
|
||||||
|
buff = FormatString(buff, GetStringPtr(units[_opt_ptr->units].s_weight), args, modifier >> 24);
|
||||||
|
modifier = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error("!invalid escape sequence in string");
|
error("!invalid escape sequence in string");
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ typedef struct {
|
|||||||
GameDifficulty diff;
|
GameDifficulty diff;
|
||||||
byte diff_level;
|
byte diff_level;
|
||||||
byte currency;
|
byte currency;
|
||||||
bool kilometers;
|
byte units;
|
||||||
byte town_name;
|
byte town_name;
|
||||||
byte landscape;
|
byte landscape;
|
||||||
byte snow_line;
|
byte snow_line;
|
||||||
|
Loading…
Reference in New Issue
Block a user