diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index 74ea637be3..ead88d8a11 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -2,19 +2,7 @@ STR_NEWS_VEHICLE_AUTORENEW_FAILED :{WHITE}Autorenew failed on {VEHICLE}{}{STRING1} STR_NEWGRF_ERROR_FATAL_POPUP :{WHITE}The NewGRF "{RAW_STRING}" has returned a fatal error: {}{STRING7} STR_NEWGRF_ERROR_POPUP :{WHITE}The NewGRF "{RAW_STRING}" has returned an error: {}{STRING7} -STR_ORDER_TEXT :{STRING6} {STRING4} {STRING} -STR_TIMETABLE_TRAVEL_FOR :Travel for {STRING3} -STR_TIMETABLE_TRAVEL_FOR_SPEED :Travel for {STRING3} with at most {VELOCITY} -STR_TIMETABLE_TRAVEL_FOR_ESTIMATED :Travel (for {STRING3}, not timetabled) -STR_TIMETABLE_TRAVEL_FOR_SPEED_ESTIMATED :Travel (for {STRING3}, not timetabled) with at most {VELOCITY} -STR_TIMETABLE_STAY_FOR_ESTIMATED :(stay for {STRING3}, not timetabled) -STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED :(travel for {STRING3}, not timetabled) -STR_TIMETABLE_STAY_FOR :and stay for {STRING3} -STR_TIMETABLE_AND_TRAVEL_FOR :and travel for {STRING3} -STR_TIMETABLE_TOTAL_TIME :{BLACK}This timetable will take {STRING3} to complete -STR_TIMETABLE_TOTAL_TIME_INCOMPLETE :{BLACK}This timetable will take at least {STRING3} to complete (not all timetabled) -STR_TIMETABLE_STATUS_LATE :{BLACK}This vehicle is currently running {STRING3} late -STR_TIMETABLE_STATUS_EARLY :{BLACK}This vehicle is currently running {STRING3} early +STR_ORDER_TEXT :{STRING6} {STRING2} {STRING} ##override off ##after STR_CONFIG_SETTING_TREE_PLACER_IMPROVED @@ -1391,8 +1379,8 @@ STR_VEHICLE_LIST_LENGTH :{STRING2}, Leng STR_VEHICLE_LIST_TIME_TO_LIVE :{STRING2}, Lifetime: {COMMA} year{P "" s} remaining STR_VEHICLE_LIST_TIME_TO_LIVE_RED :{STRING2}, Lifetime: {RED}{COMMA} {BLACK}year{P "" s} remaining STR_VEHICLE_LIST_TIME_TO_LIVE_OVERDUE :{STRING2}, Lifetime: {RED}{COMMA} {BLACK}year{P "" s} overdue -STR_VEHICLE_LIST_TIMETABLE_DELAY_LATE :{STRING2}, Timetable status: {RED}{STRING3} late -STR_VEHICLE_LIST_TIMETABLE_DELAY_EARLY :{STRING2}, Timetable status: {STRING3} early +STR_VEHICLE_LIST_TIMETABLE_DELAY_LATE :{STRING2}, Timetable status: {RED}{STRING1} late +STR_VEHICLE_LIST_TIMETABLE_DELAY_EARLY :{STRING2}, Timetable status: {STRING1} early STR_VEHICLE_LIST_TIMETABLE_DELAY_ON_TIME :{STRING2}, Timetable status: On time STR_VEHICLE_LIST_ORDER_OCCUPANCY_AVERAGE :{STRING2}, Average order occupancy: {COMMA}% @@ -1634,7 +1622,7 @@ STR_TIMETABLE_HOURS_MINUTES :{COMMA}{NBSP}ho STR_TIMETABLE_LEFTOVER_TICKS :{STRING1} + {COMMA} tick{P "" s} -STR_TIMETABLE_MINUTES_LONG :{COMMA}{NBSP}minute{P "" s} ({STRING2}){STRING3} +STR_TIMETABLE_MINUTES_LONG :{COMMA}{NBSP}minute{P "" s} ({STRING2}) STR_TIMETABLE_AUTOMATE :{BLACK}Automate STR_TIMETABLE_AUTOMATE_TOOLTIP :{BLACK}Manage the timetables automatically by updating the values for each journey @@ -1818,6 +1806,9 @@ STR_JUST_STRING3 :{STRING3} STR_JUST_VELOCITY :{VELOCITY} +STR_JUST_TT_TICKS :{TT_TICKS} +STR_JUST_TT_TICKS_LONG :{TT_TICKS_LONG} + STR_BLACK_DECIMAL :{BLACK}{DECIMAL} STR_WHITE_DATE_WALLCLOCK_LONG :{WHITE}{DATE_WALLCLOCK_LONG} STR_WHITE_DATE_WALLCLOCK_SHORT :{WHITE}{DATE_WALLCLOCK_SHORT} @@ -2038,9 +2029,9 @@ STR_ERROR_CAN_T_RENAME_SCHEDULE :{WHITE}Can't na STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST :{BLACK}Last departure at {DATE_WALLCLOCK_TINY}. STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE :{BLACK}Last departure has not left yet, it will depart at {DATE_WALLCLOCK_TINY}. STR_SCHDISPATCH_SUMMARY_L1 :{BLACK}This schedule requires {COMMA} vehicle{P "" s}. -STR_SCHDISPATCH_SUMMARY_L2 :{BLACK}This schedule repeats every {STRING8}. +STR_SCHDISPATCH_SUMMARY_L2 :{BLACK}This schedule repeats every {STRING1}. STR_SCHDISPATCH_SUMMARY_L3 :{BLACK}This schedule began at {DATE_WALLCLOCK_TINY}, and ends at {DATE_WALLCLOCK_TINY}. -STR_SCHDISPATCH_SUMMARY_L4 :{BLACK}Maximum delay of {STRING3} is allowed before the slot is skipped. +STR_SCHDISPATCH_SUMMARY_L4 :{BLACK}Maximum delay of {STRING1} is allowed before the slot is skipped. STR_SCHDISPATCH_SUMMARY_NOT_ENABLED :{BLACK}This schedule is not active. STR_SCHDISPATCH_SLOT_OUTSIDE_SCHEDULE :{BLACK}One or more departure slots are outside the schedule duration. diff --git a/src/lang/extra/galician.txt b/src/lang/extra/galician.txt index f6b927d646..b0b909229d 100644 --- a/src/lang/extra/galician.txt +++ b/src/lang/extra/galician.txt @@ -1578,7 +1578,7 @@ STR_TIMETABLE_HOURS_MINUTES :{COMMA}{NBSP}ho STR_TIMETABLE_LEFTOVER_TICKS :{STRING} + {COMMA} tick{P "" s} -STR_TIMETABLE_MINUTES_LONG :{COMMA}{NBSP}minuto{P "" s} ({STRING}){STRING} +STR_TIMETABLE_MINUTES_LONG :{COMMA}{NBSP}minuto{P "" s} ({STRING}) STR_TIMETABLE_AUTOMATE :{BLACK}Automatizar STR_TIMETABLE_AUTOMATE_TOOLTIP :{BLACK}Xestiona os horarios automáticamente actualizando os valores para cada viaxe diff --git a/src/lang/extra/german.txt b/src/lang/extra/german.txt index 17c5f4bd5a..b86a19c3f5 100644 --- a/src/lang/extra/german.txt +++ b/src/lang/extra/german.txt @@ -1471,7 +1471,7 @@ STR_TIMETABLE_HOURS_MINUTES :{COMMA}{NBSP}St STR_TIMETABLE_LEFTOVER_TICKS :{STRING} + {COMMA} Tick{P "" s} -STR_TIMETABLE_MINUTES_LONG :{COMMA}{NBSP}Minute{P "" n} ({STRING}){STRING} +STR_TIMETABLE_MINUTES_LONG :{COMMA}{NBSP}Minute{P "" n} ({STRING}) STR_TIMETABLE_AUTOMATE :{BLACK}Automatisieren STR_TIMETABLE_AUTOMATE_TOOLTIP :{BLACK}Verwaltet den Fahrplan durch automatisches Erfassen der Werte jeder Fahrt diff --git a/src/lang/extra/korean.txt b/src/lang/extra/korean.txt index c599fe7738..d90bf8e93b 100644 --- a/src/lang/extra/korean.txt +++ b/src/lang/extra/korean.txt @@ -1583,7 +1583,7 @@ STR_TIMETABLE_HOURS_MINUTES :{COMMA}시간 { STR_TIMETABLE_LEFTOVER_TICKS :{STRING} + {COMMA} 틱 -STR_TIMETABLE_MINUTES_LONG :{COMMA}분 ({STRING}){STRING} +STR_TIMETABLE_MINUTES_LONG :{COMMA}분 ({STRING}) STR_TIMETABLE_AUTOMATE :{BLACK}자동 STR_TIMETABLE_AUTOMATE_TOOLTIP :{BLACK}각 운행마다 자동으로 값을 얻어 시간표를 만듭니다. diff --git a/src/lang/extra/simplified_chinese.txt b/src/lang/extra/simplified_chinese.txt index f4608c42e9..6d1f2d8a34 100644 --- a/src/lang/extra/simplified_chinese.txt +++ b/src/lang/extra/simplified_chinese.txt @@ -1552,7 +1552,7 @@ STR_TIMETABLE_HOURS_MINUTES :{COMMA}{NBSP} STR_TIMETABLE_LEFTOVER_TICKS :{STRING} + {COMMA} 刻 -STR_TIMETABLE_MINUTES_LONG :{COMMA}{NBSP}分({STRING}){STRING} +STR_TIMETABLE_MINUTES_LONG :{COMMA}{NBSP}分({STRING}) STR_TIMETABLE_AUTOMATE :{BLACK}自动 STR_TIMETABLE_AUTOMATE_TOOLTIP :{BLACK}通过更新每次运行的值来自动管理时间表 diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 7124f76f4e..b05c61c436 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -867,12 +867,12 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int DrawString(left, rtl ? right - 2 * sprite_size.width - 3 : middle, y, STR_ORDER_INDEX, colour, SA_RIGHT | SA_FORCE); SetDParam(7, STR_EMPTY); - SetDParam(12, STR_EMPTY); + SetDParam(10, STR_EMPTY); /* Check range for aircraft. */ if (v->type == VEH_AIRCRAFT && Aircraft::From(v)->GetRange() > 0 && order->IsGotoOrder()) { const Order *next = order->next != nullptr ? order->next : v->GetFirstOrder(); - if (GetOrderDistance(order, next, v) > Aircraft::From(v)->acache.cached_max_range_sqr) SetDParam(11, STR_ORDER_OUT_OF_RANGE); + if (GetOrderDistance(order, next, v) > Aircraft::From(v)->acache.cached_max_range_sqr) SetDParam(10, STR_ORDER_OUT_OF_RANGE); } bool timetable_wait_time_valid = false; diff --git a/src/strings.cpp b/src/strings.cpp index d75bef267d..9dc78b0f9e 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1573,18 +1573,33 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg buff = FormatTimeHHMMString(buff, args->GetInt64(SCC_TIME_HHMM), last, next_substr_case_index); break; - case SCC_TT_TICKS: // {TT_TICKS} + case SCC_TT_TICKS: // {TT_TICKS} + case SCC_TT_TICKS_LONG: // {TT_TICKS_LONG} if (_settings_client.gui.timetable_in_ticks) { - int64 args_array[1] = { args->GetInt64(SCC_TT_TICKS) }; + int64 args_array[1] = { args->GetInt64(b) }; StringParameters tmp_params(args_array); buff = FormatString(buff, GetStringPtr(STR_TIMETABLE_TICKS), &tmp_params, last); } else { StringID str = _settings_time.time_in_minutes ? STR_TIMETABLE_MINUTES : STR_TIMETABLE_DAYS; - int64 ticks = args->GetInt64(SCC_TT_TICKS); + int64 ticks = args->GetInt64(b); int64 ratio = DATE_UNIT_SIZE; int64 units = ticks / ratio; - int64 leftover = ticks % ratio; - if (leftover) { + int64 leftover = _settings_client.gui.timetable_leftover_ticks ? ticks % ratio : 0; + if (b == SCC_TT_TICKS_LONG && _settings_time.time_in_minutes && units > 59) { + int64 hours = units / 60; + int64 minutes = units % 60; + int64 args_array[4] = { + units, + (minutes != 0) ? STR_TIMETABLE_HOURS_MINUTES : STR_TIMETABLE_HOURS, + hours, + minutes + }; + StringParameters tmp_params(args_array); + buff = FormatString(buff, GetStringPtr(STR_TIMETABLE_MINUTES_LONG), &tmp_params, last); + if (leftover == 0) break; + str = STR_EMPTY; + } + if (leftover != 0) { int64 args_array[3] = { str, units, leftover }; StringParameters tmp_params(args_array); buff = FormatString(buff, GetStringPtr(STR_TIMETABLE_LEFTOVER_TICKS), &tmp_params, last); diff --git a/src/table/control_codes.h b/src/table/control_codes.h index cec250a200..bbbf692d52 100644 --- a/src/table/control_codes.h +++ b/src/table/control_codes.h @@ -81,6 +81,7 @@ enum StringControlCode { SCC_TIME_HHMM, SCC_TT_TICKS, + SCC_TT_TICKS_LONG, /* Must be consecutive */ SCC_STRING1, diff --git a/src/table/strgen_tables.h b/src/table/strgen_tables.h index ab9eeff011..e2ba39253e 100644 --- a/src/table/strgen_tables.h +++ b/src/table/strgen_tables.h @@ -104,6 +104,7 @@ static const CmdStruct _cmd_structs[] = { {"TIME_HHMM", EmitSingleChar, SCC_TIME_HHMM, 1, -1, C_NONE}, {"TT_TICKS", EmitSingleChar, SCC_TT_TICKS, 1, -1, C_NONE}, + {"TT_TICKS_LONG", EmitSingleChar, SCC_TT_TICKS_LONG, 1, -1, C_NONE}, {"STRING", EmitSingleChar, SCC_STRING, 1, -1, C_CASE | C_GENDER}, {"RAW_STRING", EmitSingleChar, SCC_RAW_STRING_POINTER, 1, -1, C_NONE | C_GENDER}, diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 623a6ea9d8..4e33416f03 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -58,35 +58,8 @@ struct TimetableArrivalDeparture { */ void SetTimetableParams(int first_param, Ticks ticks, bool long_mode) { - if (_settings_client.gui.timetable_in_ticks) { - SetDParam(first_param, STR_TIMETABLE_TICKS); - SetDParam(first_param + 1, ticks); - } else { - StringID str = _settings_time.time_in_minutes ? STR_TIMETABLE_MINUTES : STR_TIMETABLE_DAYS; - size_t ratio = DATE_UNIT_SIZE; - size_t units = ticks / ratio; - size_t leftover = ticks % ratio; - if (long_mode && _settings_time.time_in_minutes && units > 59) { - SetDParam(first_param, STR_TIMETABLE_MINUTES_LONG); - SetDParam(first_param + 1, units); - size_t hours = units / 60; - size_t minutes = units % 60; - SetDParam(first_param + 2, (minutes != 0) ? STR_TIMETABLE_HOURS_MINUTES : STR_TIMETABLE_HOURS); - SetDParam(first_param + 3, hours); - SetDParam(first_param + 4, minutes); - str = STR_EMPTY; - first_param += 5; - } - if (leftover && _settings_client.gui.timetable_leftover_ticks) { - SetDParam(first_param, STR_TIMETABLE_LEFTOVER_TICKS); - SetDParam(first_param + 1, str); - SetDParam(first_param + 2, units); - SetDParam(first_param + 3, leftover); - } else { - SetDParam(first_param, str); - SetDParam(first_param + 1, units); - } - } + SetDParam(first_param, long_mode ? STR_JUST_TT_TICKS_LONG : STR_JUST_TT_TICKS); + SetDParam(first_param + 1, ticks); } /** @@ -720,7 +693,7 @@ struct TimetableWindow : GeneralVehicleWindow { string = order->GetMaxSpeed() != UINT16_MAX ? STR_TIMETABLE_TRAVEL_FOR_SPEED : STR_TIMETABLE_TRAVEL_FOR; } - SetDParam(string == STR_TIMETABLE_TRAVEL_NOT_TIMETABLED_SPEED ? 2 : 4, PackVelocity(order->GetMaxSpeed(), v->type)); + SetDParam(2, PackVelocity(order->GetMaxSpeed(), v->type)); int edge = DrawString(rtl ? tr.left : middle, rtl ? middle : tr.right, tr.top, string, colour);