diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue
index 9de9c07..7516f9b 100644
--- a/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue
+++ b/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue
@@ -87,7 +87,8 @@ export default defineComponent({
const stop = train.timetableData?.followingStops.find(
(stop) =>
stop.stopNameRAW.toLowerCase() == name.toLowerCase() ||
- this.station?.generalInfo?.checkpoints.includes(stop.stopNameRAW)
+ this.station?.generalInfo?.checkpoints.includes(stop.stopNameRAW) ||
+ this.onlineScenery?.missingCheckpoints.includes(stop.stopNameRAW)
);
const sceneryName =
diff --git a/src/components/SceneryView/SceneryTimetable.vue b/src/components/SceneryView/SceneryTimetable.vue
index faf76ec..5e7833d 100644
--- a/src/components/SceneryView/SceneryTimetable.vue
+++ b/src/components/SceneryView/SceneryTimetable.vue
@@ -54,6 +54,18 @@
>
+
+
+
+ •
+ {{ ch }}
+
+
@@ -287,6 +299,7 @@ export default defineComponent({
const chosenCheckpoint = ref(
props.station?.generalInfo?.checkpoints[0] ??
+ props.onlineScenery?.missingCheckpoints[0] ??
props.station?.name ??
route.query['station']?.toString() ??
''
@@ -365,21 +378,30 @@ export default defineComponent({
methods: {
loadSelectedOption() {
- if (!this.station) return;
-
- if (!this.station.generalInfo) {
- this.chosenCheckpoint = this.station.name;
- return;
- }
-
const queryCheckpoint = this.$route.query['checkpoint']?.toString();
- this.chosenCheckpoint =
- this.station.generalInfo.checkpoints.find(
- (ch) => ch.toLocaleLowerCase() === queryCheckpoint?.toLocaleLowerCase()
- ) ??
- this.station.generalInfo.checkpoints[0] ??
- this.station.name;
+ let checkpointsListRef: string[] | null = null;
+ let sceneryName = '';
+
+ if (this.station && this.station.generalInfo) {
+ checkpointsListRef = this.station.generalInfo.checkpoints;
+ sceneryName = this.station.name;
+ } else if (this.onlineScenery) {
+ checkpointsListRef = this.onlineScenery.missingCheckpoints;
+ sceneryName = this.onlineScenery.name;
+ } else if (this.station) {
+ this.chosenCheckpoint = this.station.name;
+ sceneryName = this.station.name;
+ }
+
+ if (checkpointsListRef) {
+ this.chosenCheckpoint =
+ checkpointsListRef.find(
+ (ch) => ch.toLocaleLowerCase() === queryCheckpoint?.toLocaleLowerCase()
+ ) ??
+ checkpointsListRef[0] ??
+ sceneryName;
+ }
},
setCheckpoint(cp: string) {
diff --git a/src/store/mainStore.ts b/src/store/mainStore.ts
index 341f3ee..fd206d6 100644
--- a/src/store/mainStore.ts
+++ b/src/store/mainStore.ts
@@ -13,6 +13,7 @@ import { useApiStore } from './apiStore';
import { MainStoreState } from './typings';
const checkpointsTrains: Map = new Map();
+const unknownSceneryCheckpoints: Map> = new Map();
const sceneriesTrains: Map = new Map();
export const useMainStore = defineStore('mainStore', {
@@ -42,6 +43,7 @@ export const useMainStore = defineStore('mainStore', {
checkpointsTrains.clear();
sceneriesTrains.clear();
+ unknownSceneryCheckpoints.clear();
const dateNow = new Date();
@@ -133,8 +135,13 @@ export const useMainStore = defineStore('mainStore', {
// Checkpoints trains map
if (trainObj.timetableData) {
- let currentSceneryIndex = 0;
const timetablePath = trainObj.timetableData.timetablePath;
+ let currentSceneryIndex = 0;
+
+ let currentSceneryData: Station | null =
+ this.stationList.find(
+ (s) => s.name == timetablePath[currentSceneryIndex].stationName
+ ) ?? null;
trainObj.timetableData.followingStops.forEach((stop, i) => {
if (/strong|podg|pe/.test(stop.stopName)) {
@@ -153,16 +160,41 @@ export const useMainStore = defineStore('mainStore', {
timetablePathElement: timetablePath[currentSceneryIndex]
};
+ // Adding missing sceneries checkpoints as a fallback when scenery data is missing (and "generalInfo" is unavailable)
+ if (!currentSceneryData) {
+ const sceneryCheckpointsSet = unknownSceneryCheckpoints.get(
+ checkpointTrain.timetablePathElement.stationName
+ );
+
+ if (!sceneryCheckpointsSet) {
+ unknownSceneryCheckpoints.set(
+ checkpointTrain.timetablePathElement.stationName,
+ new Set([stop.stopNameRAW])
+ );
+ } else {
+ sceneryCheckpointsSet.add(stop.stopNameRAW);
+ }
+ }
+
+ // Adding trains to their corresponding checkpoints
if (checkpointsTrains.has(stop.stopNameRAW.toLowerCase())) {
checkpointsTrains.set(stop.stopNameRAW.toLowerCase(), [
...checkpointsTrains.get(stop.stopNameRAW.toLowerCase())!,
checkpointTrain
]);
- } else checkpointsTrains.set(stop.stopNameRAW.toLowerCase(), [checkpointTrain]);
+ } else {
+ checkpointsTrains.set(stop.stopNameRAW.toLowerCase(), [checkpointTrain]);
+ }
}
- if (timetablePath[currentSceneryIndex].departureRouteExt == stop.departureLine)
+ if (timetablePath[currentSceneryIndex].departureRouteExt == stop.departureLine) {
currentSceneryIndex++;
+
+ currentSceneryData =
+ this.stationList.find(
+ (s) => s.name == timetablePath[currentSceneryIndex].stationName
+ ) ?? null;
+ }
});
}
@@ -222,7 +254,9 @@ export const useMainStore = defineStore('mainStore', {
all: 0,
confirmed: 0,
unconfirmed: 0
- }
+ },
+
+ missingCheckpoints: []
});
});
@@ -266,7 +300,9 @@ export const useMainStore = defineStore('mainStore', {
all: 0,
confirmed: 0,
unconfirmed: 0
- }
+ },
+
+ missingCheckpoints: []
});
return list;
@@ -277,7 +313,7 @@ export const useMainStore = defineStore('mainStore', {
for (let i = 0, n = allActiveSceneries.length; i < n; i++) {
const scenery = allActiveSceneries[i];
- const station = this.stationList.find((s) => s.name === scenery.name);
+ let station = this.stationList.find((s) => s.name === scenery.name);
let checkpointsSet: Set = new Set();
@@ -293,6 +329,14 @@ export const useMainStore = defineStore('mainStore', {
scenery.stationTrains =
sceneriesTrains.get(scenery.name)?.filter((sc) => sc.region == this.region.id) ?? [];
+ // Missing checkpoints as a fallback for sceneries without generalInfo & checkpoints property
+ const missingCheckpointsToAdd = unknownSceneryCheckpoints.get(scenery.name);
+
+ if (missingCheckpointsToAdd) {
+ checkpoints.push(...missingCheckpointsToAdd);
+ scenery.missingCheckpoints.push(...missingCheckpointsToAdd);
+ }
+
const uniqueTrainIds: string[] = [];
checkpoints.forEach((cp) => {
const scheduledTrains = checkpointsTrains.get(cp.toLowerCase());
diff --git a/src/typings/common.ts b/src/typings/common.ts
index 545c446..26b4030 100644
--- a/src/typings/common.ts
+++ b/src/typings/common.ts
@@ -170,6 +170,7 @@ export interface ActiveScenery {
confirmed: number;
unconfirmed: number;
};
+ missingCheckpoints: string[];
}
export interface ScenerySpawn {