fix(data): 修复NBT(BlockReader/CreateTarget)与车站时刻表数据源不一致导致终点站广播漏播的问题
- 新增 looksLikeValidDestinationText: 检测目的地/车次名是否有效(过滤Unknown和高比例问号乱码) - 新增 tryCorrectUpcomingEntryWithCurrentTrain: 用权威State.currentTrain数据校正 upcoming 条目中的乱码车次/目的地 - 新增 checkIsAtStationWithCurrentTrain: 增强 isAtStation 匹配鲁棒性, 优先站台号+车次ID匹配, 乱码时降级到目的地模糊匹配 - 提前预校正: 在生成 announceKey 前就校正乱码字段, 确保 approaching/alarm 冷却去重 key 一致 - 后置全局校正: 在赋值 State.upcomingTrains 前再次对所有条目做权威校正, 保证显示和广播使用的终点站信息一致 版本升级至 v1.0.70
This commit is contained in:
+31
-1
@@ -3210,13 +3210,28 @@ function Main.loop()
|
||||
destination = stop.Stopovers[#stop.Stopovers] or destination
|
||||
end
|
||||
|
||||
if isStationDestination(destination) then
|
||||
local platform = "1"
|
||||
if st.ScheduledStation and st.ScheduledStation.StationInfo and st.ScheduledStation.StationInfo.Platform then
|
||||
platform = st.ScheduledStation.StationInfo.Platform
|
||||
else
|
||||
platform = State.stationPlatform or "1"
|
||||
end
|
||||
|
||||
local preCorrected = tryCorrectUpcomingEntryWithCurrentTrain({
|
||||
trainName = trainName,
|
||||
dest = destination,
|
||||
platform = platform
|
||||
})
|
||||
if preCorrected then
|
||||
if not looksLikeValidDestinationText(trainName) and preCorrected.trainName then
|
||||
trainName = preCorrected.trainName
|
||||
end
|
||||
if not looksLikeValidDestinationText(destination) and preCorrected.dest then
|
||||
destination = preCorrected.dest
|
||||
end
|
||||
end
|
||||
|
||||
if isStationDestination(destination) then
|
||||
local cancelled = false
|
||||
local reason = nil
|
||||
local tr = stop.Train
|
||||
@@ -3362,6 +3377,21 @@ function Main.loop()
|
||||
platform, etaStr, tName, dest = string.match(cleanLine, "^([^%s]+)%s+(.-)%s+([^%s]+)%s+(.*)$")
|
||||
end
|
||||
|
||||
local entryPlatform = platform or State.stationPlatform or "1"
|
||||
local preCorrectedCT = tryCorrectUpcomingEntryWithCurrentTrain({
|
||||
trainName = tName or "",
|
||||
dest = dest or "",
|
||||
platform = entryPlatform
|
||||
})
|
||||
if preCorrectedCT then
|
||||
if tName and not looksLikeValidDestinationText(tName) and preCorrectedCT.trainName then
|
||||
tName = preCorrectedCT.trainName
|
||||
end
|
||||
if dest and not looksLikeValidDestinationText(dest) and preCorrectedCT.dest then
|
||||
dest = preCorrectedCT.dest
|
||||
end
|
||||
end
|
||||
|
||||
if tName and etaStr and isStationDestination(dest) then
|
||||
local announceKey = normalizeUpcomingKey(tName, dest)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user