17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-10 01:10:38 +01:00

whois: consolidate the two lookahead accessors into one

Per review: StationNameAhead()/StationIsStopAhead() duplicated the same
bounds check for no reason. Replaced with a single
TimeTableEntryAhead(Offset) returning the TMTableLine itself; the whois
branch reads .StationName/.Ah off it directly.
This commit is contained in:
Piotr Warszawski
2026-09-04 21:24:01 +02:00
parent 5705062cd2
commit 93463a3850
3 changed files with 13 additions and 23 deletions

View File

@@ -1034,14 +1034,12 @@ whois_event::run_() {
m_activator->Mechanik != nullptr && m_activator->Mechanik->primary() ?
m_activator->Mechanik :
m_activator->ctOwner ) };
auto const aheadname { (
auto const *entry { (
owner != nullptr ?
owner->TrainTimetable().StationNameAhead( 1 ) :
"none" ) };
auto const aheadstop { (
owner != nullptr && owner->TrainTimetable().StationIsStopAhead( 1 ) ?
1 :
0 ) };
&owner->TrainTimetable().TimeTableEntryAhead( 1 ) :
nullptr ) };
auto const aheadname { ( entry != nullptr ? entry->StationName : "none" ) };
auto const aheadstop { ( entry != nullptr && entry->Ah >= 0 ? 1 : 0 ) };
targetcell->UpdateValues(
aheadname, // station after the next one