From 45b6079899710eb8fe77db7e86b2384ac0a02807 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 22 Feb 2024 20:29:11 +0000 Subject: [PATCH] Add string code for absolute timetable time --- src/lang/extra/english.txt | 1 + src/strings.cpp | 5 +++-- src/table/control_codes.h | 1 + src/table/strgen_tables.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index 74e4d248df..10003785ff 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -13,6 +13,7 @@ STR_JUST_VELOCITY :{VELOCITY} STR_JUST_TT_TICKS :{TT_TICKS} STR_JUST_TT_TICKS_LONG :{TT_TICKS_LONG} STR_JUST_TT_TIME :{TT_TIME} +STR_JUST_TT_TIME_ABS :{TT_TIME_ABS} STR_JUST_STATION :{STATION} STR_RED_INT :{RED}{NUM} diff --git a/src/strings.cpp b/src/strings.cpp index 57c38f92b4..3d2a15b97e 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1602,10 +1602,11 @@ static void FormatString(StringBuilder builder, const char *str_arg, StringParam } break; - case SCC_TT_TIME: { // {TT_TIME} + case SCC_TT_TIME: // {TT_TIME} + case SCC_TT_TIME_ABS: { // {TT_TIME_ABS} if (_settings_time.time_in_minutes) { FormatStateTicksHHMMString(builder, args.GetNextParameter(), next_substr_case_index); - } else if (EconTime::UsingWallclockUnits()) { + } else if (EconTime::UsingWallclockUnits() && b == SCC_TT_TIME) { StateTicks tick = args.GetNextParameter(); StateTicksDelta offset = tick - _state_ticks; auto tmp_params = MakeParameters(offset / TICKS_PER_SECOND); diff --git a/src/table/control_codes.h b/src/table/control_codes.h index 7ecaede2d0..52e2c8fc35 100644 --- a/src/table/control_codes.h +++ b/src/table/control_codes.h @@ -87,6 +87,7 @@ enum StringControlCode { SCC_TT_TICKS, SCC_TT_TICKS_LONG, SCC_TT_TIME, + SCC_TT_TIME_ABS, /* Must be consecutive */ SCC_STRING1, diff --git a/src/table/strgen_tables.h b/src/table/strgen_tables.h index 7968e09cca..10006a4959 100644 --- a/src/table/strgen_tables.h +++ b/src/table/strgen_tables.h @@ -108,6 +108,7 @@ static const CmdStruct _cmd_structs[] = { {"TT_TICKS", EmitSingleChar, SCC_TT_TICKS, 1, -1, C_NONE}, {"TT_TICKS_LONG", EmitSingleChar, SCC_TT_TICKS_LONG, 1, -1, C_NONE}, {"TT_TIME", EmitSingleChar, SCC_TT_TIME, 1, -1, C_NONE}, + {"TT_TIME_ABS", EmitSingleChar, SCC_TT_TIME_ABS, 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},