+
WYGENERUJ
@@ -89,15 +96,16 @@
diff --git a/src/components/StockListTab.vue b/src/components/tabs/StockListTab.vue
similarity index 77%
rename from src/components/StockListTab.vue
rename to src/components/tabs/StockListTab.vue
index 63d5bd0..d01cc96 100644
--- a/src/components/StockListTab.vue
+++ b/src/components/tabs/StockListTab.vue
@@ -1,78 +1,53 @@
-
- POBIERZ POCIĄG
- ZRESETUJ LISTĘ
- TASUJ WAGONY
- LOSUJ SKŁAD
-
-
POJAZD NR {{ store.chosenStockListIndex + 1 }}
-
-
- Przenieś wyżej
+ PRZENIEŚ WYŻEJ
- Przenieś niżej
+ PRZENIEŚ NIŻEJ
- Usuń
+ USUŃ
-
-
Skopiuj tekst składu do schowka
+
+
+ WCZYTAJ
+
+
+
+
POBIERZ
+
+
+ SKOPIUJ
+
+
+
ZRESETUJ
+
+
PRZETASUJ
@@ -85,9 +60,11 @@
- Masa: {{ store.totalMass }}t - Długość:
+ Masa: {{ store.totalMass }}t (dopuszczalna:
+ {{ store.acceptableMass ? store.acceptableMass + 't' : '-' }} ) - Długość:
{{ store.totalLength }}m
- - Vmax pociągu: {{ store.maxStockSpeed }} km/h
+ - vMax: {{ store.maxStockSpeed }} km/h
@@ -117,13 +94,15 @@
Ten skład posiada za dużo pojazdów trakcyjnych!
+
+
-
-
+
+
diff --git a/src/constants/numberGeneratorData.json b/src/constants/numberGeneratorData.json
new file mode 100644
index 0000000..0e639a8
--- /dev/null
+++ b/src/constants/numberGeneratorData.json
@@ -0,0 +1,39 @@
+{
+ "regionNumbers": {
+ "Warszawa": 1,
+ "Lublin": 2,
+ "Kraków": 3,
+ "Sosnowiec": 4,
+ "Gdańsk": 5,
+ "Wrocław": 6,
+ "Poznań": 7,
+ "Szczecin": 8,
+ "Rezerwa": 9
+ },
+ "sameRegions": {
+ "Losowy": [
+ 10, 11, 19, 91, 93, 97, 99, 20, 22, 29, 30, 33, 39, 40, 44, 49, 94, 50, 55, 59, 90, 95, 96, 66, 60, 69, 77, 70,
+ 79, 88, 80, 89, 92, 98
+ ],
+ "Warszawa": [10, 11, 19, 91, 93, 97, 99],
+ "Lublin": [20, 22, 29],
+ "Kraków": [30, 33, 39],
+ "Sosnowiec": [40, 44, 49, 94],
+ "Gdańsk": [50, 55, 59, 90, 95, 96],
+ "Wrocław": [66, 60, 69],
+ "Poznań": [77, 70, 79],
+ "Szczecin": [88, 80],
+ "Rezerwa": [89, 92, 98]
+ },
+ "categories": {
+ "ekspres krajowy (EI)": "2:00-99:2",
+ "międzywojewódzki pośpieszny (MP)": "2:050-169:3",
+ "wojewódzki pośpieszny (RP)": "2:050-169:3",
+ "wojewódzki osobowy (RO)": "2:200-999:3",
+ "próżny \"służbowy\" (PW)": "2:6;3:0-899:3",
+ "towarowy do przewozów masowych (TM)": "2:4;3:0-899:3",
+ "towarowy do obsługi stacji (TK)": "2:3;3:0-899:3",
+ "lokomotywa luzem (LT)": "2:5;3:0-899:3"
+ }
+}
+
diff --git a/src/constants/speedLimits.json b/src/constants/speedLimits.json
new file mode 100644
index 0000000..a838c40
--- /dev/null
+++ b/src/constants/speedLimits.json
@@ -0,0 +1,53 @@
+{
+ "EU07": {
+ "passenger": {
+ "650": 125
+ },
+ "cargo": {
+ "2000": 70
+ }
+ },
+ "EP07": {
+ "passenger": {
+ "650": 125
+ },
+ "cargo": null
+ },
+ "EP08": {
+ "passenger": {
+ "650": 140
+ },
+ "cargo": null
+ },
+ "ET41": {
+ "passenger": {
+ "700": 125
+ },
+ "cargo": {
+ "4000": 70
+ }
+ },
+ "SM42": {
+ "passenger": {
+ "95": 90,
+ "200": 80,
+ "300": 70,
+ "450": 60,
+ "750": 50,
+ "1130": 40,
+ "1720": 30,
+ "2400": 20
+ },
+ "cargo": {
+ "95": 90,
+ "200": 80,
+ "300": 70,
+ "450": 60,
+ "750": 50,
+ "1130": 40,
+ "1720": 30,
+ "2400": 20
+ }
+ }
+}
+
diff --git a/src/main.ts b/src/main.ts
index ec0a36f..d628b58 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -7,11 +7,7 @@ import App from './App.vue';
const pinia = createPinia();
const updateSW = registerSW({
- onOfflineReady() {},
-
- onNeedRefresh() {
- console.log('Need refresh!');
- },
+ immediate: true,
});
createApp(App).use(pinia).mount('#app');
diff --git a/src/mixins/stockMixin.ts b/src/mixins/stockMixin.ts
index 7795bd6..6f1a633 100644
--- a/src/mixins/stockMixin.ts
+++ b/src/mixins/stockMixin.ts
@@ -15,7 +15,7 @@ export default defineComponent({
return `${Math.random().toString(36).slice(5)}`;
},
- getStockObject(vehicle: Vehicle, cargo?: ICargo, count = 1): IStock {
+ getStockObject(vehicle: Vehicle, cargo?: ICargo | null, count = 1): IStock {
const isLoco = isLocomotive(vehicle);
return {
@@ -33,13 +33,22 @@ export default defineComponent({
};
},
+ addVehicle(vehicle: Vehicle | null, cargo?: ICargo | null) {
+ if (!vehicle) return;
+
+ const stock = this.getStockObject(vehicle, cargo);
+
+ if (stock.isLoco && !this.store.stockList[0]?.isLoco) this.store.stockList.unshift(stock);
+ else this.store.stockList.push(stock);
+ },
+
addLocomotive(loco: ILocomotive) {
- const previousStock =
- this.store.stockList.length > 0 ? this.store.stockList[this.store.stockList.length - 1] : null;
- if (previousStock && previousStock.type == loco.type) {
- this.store.stockList[this.store.stockList.length - 1].count++;
- return;
- }
+ // const previousStock =
+ // this.store.stockList.length > 0 ? this.store.stockList[this.store.stockList.length - 1] : null;
+ // if (previousStock && previousStock.type == loco.type) {
+ // this.store.stockList[this.store.stockList.length - 1].count++;
+ // return;
+ // }
const stockObj = this.getStockObject(loco);
@@ -48,18 +57,51 @@ export default defineComponent({
},
addCarWagon(car: ICarWagon, cargo?: ICargo) {
- const previousStock =
- this.store.stockList.length > 0 ? this.store.stockList[this.store.stockList.length - 1] : null;
+ // const previousStock =
+ // this.store.stockList.length > 0 ? this.store.stockList[this.store.stockList.length - 1] : null;
- if (previousStock && previousStock.type == car.type && previousStock.cargo?.id == cargo?.id) {
- this.store.stockList[this.store.stockList.length - 1].count++;
+ // if (previousStock && previousStock.type == car.type && previousStock.cargo?.id == cargo?.id) {
+ // this.store.stockList[this.store.stockList.length - 1].count++;
- return;
- }
+ // return;
+ // }
const stockObj = this.getStockObject(car, cargo);
this.store.stockList.push(stockObj);
},
+
+ loadStockFromString(stockString: string) {
+ const stockArray = stockString.trim().split(';');
+
+ this.store.stockList.length = 0;
+ this.store.chosenVehicle = null;
+ this.store.chosenCar = null;
+ this.store.chosenCargo = null;
+ this.store.chosenLoco = null;
+ this.store.chosenStockListIndex = -1;
+
+ this.store.swapVehicles = false;
+
+ stockArray.forEach((type) => {
+ let vehicle: Vehicle | null = null;
+ let vehicleCargo: ICargo | null = null;
+
+ if (/^(EU|EP|ET|SM|EN|2EN|SN)/.test(type)) {
+ const [locoType, coldStart] = type.split(',');
+ vehicle = this.store.locoDataList.find((loco) => loco.type == locoType) || null;
+ } else {
+ const [carType, cargo] = type.split(':');
+ vehicle = this.store.carDataList.find((car) => car.type == carType) || null;
+
+ if (cargo) vehicleCargo = vehicle?.cargoList.find((c) => c.id == cargo) || null;
+ }
+
+ if (!vehicle) console.log('Brak pojazdu:', type);
+
+ this.addVehicle(vehicle, vehicleCargo);
+ });
+ },
},
});
+
diff --git a/src/mixins/warningsMixin.ts b/src/mixins/warningsMixin.ts
index 57cfc80..0515d62 100644
--- a/src/mixins/warningsMixin.ts
+++ b/src/mixins/warningsMixin.ts
@@ -18,32 +18,7 @@ export default defineComponent({
},
trainTooHeavy() {
- const totalMass = this.store.totalMass;
- const isTrainPassenger = this.store.isTrainPassenger;
- const stockList = this.store.stockList;
-
- if (stockList.length == 0 || !stockList[0].isLoco) return false;
-
- const activeLocomotiveType = stockList[0].type;
-
- // Spalinowy SM
- if (/^SM/.test(activeLocomotiveType) && totalMass > 2400) return true;
-
- // Elektryczne EU07 / EP07 / EP08 / ET41
-
- // Pasażerski elektr.
- if (isTrainPassenger) {
- if (/^(EU|EP)/.test(activeLocomotiveType) && totalMass > 650) return true;
- if (/^ET/.test(activeLocomotiveType) && totalMass > 700) return true;
-
- return false;
- }
-
- // Towarowy / inny elektr.
- if (/^EU/.test(activeLocomotiveType) && totalMass > 2000) return true;
- if (/^ET/.test(activeLocomotiveType) && totalMass > 4000) return true;
-
- return false;
+ return this.store.acceptableMass && this.store.totalMass > this.store.acceptableMass;
},
locoNotSuitable() {
diff --git a/src/store.ts b/src/store.ts
index 6d1c758..36d26e4 100644
--- a/src/store.ts
+++ b/src/store.ts
@@ -1,6 +1,7 @@
import { IStore } from './types';
import { defineStore } from 'pinia';
import {
+ acceptableMass,
carDataList,
chosenRealStock,
isTrainPassenger,
@@ -53,6 +54,7 @@ export const useStore = defineStore({
maxStockSpeed: (state) => maxStockSpeed(state),
isTrainPassenger: (state) => isTrainPassenger(state),
chosenRealStock: (state) => chosenRealStock(state),
+ acceptableMass: (state) => acceptableMass(state),
},
});
diff --git a/src/styles/global.scss b/src/styles/global.scss
index 6ee3950..d0d100b 100644
--- a/src/styles/global.scss
+++ b/src/styles/global.scss
@@ -3,14 +3,14 @@
$breakpointMd: 960px;
$breakpointSm: 550px;
-$bgColor: #2c3149;
+$bgColor: #2b3552;
$textColor: #fff;
$secondaryColor: #222;
$accentColor: #e4c428;
::-webkit-scrollbar {
- width: 0.5rem;
- height: 0.5rem;
+ width: 7px;
+ height: 7px;
&-track {
background: #222;
@@ -21,6 +21,10 @@ $accentColor: #e4c428;
border-radius: 1rem;
background: #777;
}
+
+ &-corner {
+ background: #222;
+ }
}
body,
@@ -31,7 +35,6 @@ html {
font-family: 'Lato', sans-serif;
background-color: $bgColor;
- width: 100vw;
overflow-x: hidden;
}
@@ -81,14 +84,20 @@ button {
}
}
-button.btn {
+.btn {
padding: 0.4em 0.75em;
outline: none;
background-color: #222;
+ border-radius: 8px;
+ font-weight: bold;
transition: all 250ms;
+ &:hover {
+ color: $accentColor;
+ }
+
&.btn--outline {
background: none;
font-weight: bold;
@@ -120,15 +129,6 @@ button.btn {
outline: 1px solid white;
}
}
-
- &--choice {
- padding: 0.25em 0.3em;
- background-color: #222;
-
- &:focus-visible {
- outline: 1px solid white;
- }
- }
}
select,
diff --git a/src/styles/tab.scss b/src/styles/tab.scss
new file mode 100644
index 0000000..7c1a8bb
--- /dev/null
+++ b/src/styles/tab.scss
@@ -0,0 +1,80 @@
+@import './global.scss';
+
+.tab {
+ height: 100%;
+ margin-top: 1px;
+
+ &_header {
+ padding: 0.5em 1em;
+
+ background-color: $secondaryColor;
+
+ h2 {
+ margin: 0;
+ color: white;
+ font-size: 1.35em;
+ text-align: center;
+ }
+
+ button {
+ margin-left: auto;
+ }
+ }
+
+ &_content {
+ margin-top: 1em;
+ height: 100%;
+ }
+
+ &_attributes {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 1em;
+
+ label {
+ display: flex;
+ flex-direction: column;
+ }
+
+ input {
+ max-width: 250px;
+ margin-top: 0.5em;
+ }
+ }
+
+ &_actions {
+ display: grid;
+ gap: 0.5em;
+ grid-template-columns: repeat(3, 1fr);
+
+ button {
+ padding: 0.5em;
+ font-weight: bold;
+ }
+
+ &[data-disabled] button {
+ opacity: 0.75;
+ }
+ }
+}
+
+hr {
+ height: 3px;
+ background-color: white;
+ outline: none;
+ margin: 0;
+}
+
+@media only screen and (max-width: 470px) {
+ .tab_attributes {
+ label {
+ width: 100%;
+ }
+
+ input {
+ max-width: 100%;
+ width: 100%;
+ }
+ }
+}
+
diff --git a/src/types.ts b/src/types.ts
index 3edbc6e..9786c80 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -27,7 +27,7 @@ export interface IStore {
isRandomizerCardOpen: boolean;
isRealStockListCardOpen: boolean;
- stockSectionMode: 'stock-list' | 'stock-generator';
+ stockSectionMode: 'stock-list' | 'stock-generator' | 'number-generator';
stockData?: IStockData;
}
@@ -49,7 +49,12 @@ export interface IStockData {
};
info: {
- [key in TStockInfoKey]: any[];
+ 'car-cargo': [string, string, boolean, boolean, string][];
+ 'car-passenger': [string, string, boolean, boolean, string][];
+ 'loco-e': [string, string, string, string, boolean][];
+ 'loco-s': [string, string, string, string, boolean][];
+ 'loco-szt': [string, string, string, string, boolean][];
+ 'loco-ezt': [string, string, string, string, boolean][];
};
props: IStockProps[];
@@ -108,3 +113,7 @@ export interface IReadyStockList {
[key: string]: { stockString: string; type: string; number: string; name: string };
}
+
+
+
+
diff --git a/src/utils/speedLimitUtils.ts b/src/utils/speedLimitUtils.ts
new file mode 100644
index 0000000..64894c6
--- /dev/null
+++ b/src/utils/speedLimitUtils.ts
@@ -0,0 +1,14 @@
+import speedLimitTable from '../constants/speedLimits.json';
+export type LocoType = keyof typeof speedLimitTable;
+
+export const calculateSpeedLimit = (locoType: LocoType, stockMass: number, isTrainPassenger: boolean) => {
+ const speedTable = speedLimitTable[locoType][isTrainPassenger ? 'passenger' : 'cargo'];
+
+ if (!speedTable) return undefined;
+
+ let speedLimit = 0;
+ for (let mass in speedTable) if (stockMass > Number(mass)) speedLimit = (speedTable as any)[mass];
+
+ return speedLimit;
+};
+
diff --git a/src/utils/vehicleUtils.ts b/src/utils/vehicleUtils.ts
index ba34193..602be1e 100644
--- a/src/utils/vehicleUtils.ts
+++ b/src/utils/vehicleUtils.ts
@@ -1,35 +1,6 @@
import { EVehicleUseType } from '../enums/EVehicleUseType';
import { ICarWagon, ILocomotive, IStore, TStockInfoKey } from '../types';
-
-// rodzaj: [tMaxPas, vMaxPas, tMaxTow, vMaxTow] | SM42: [tMax, vMax, ...]
-const maxAllowedSpeedTable = {
- EU07: [
- [650, 125],
- [2000, 70],
- ],
- EP07: [
- [650, 125],
- [0, 0],
- ],
- EP08: [
- [650, 140],
- [0, 0],
- ],
- ET41: [
- [700, 125],
- [4000, 70],
- ],
- SM42: [
- [95, 90],
- [200, 80],
- [300, 70],
- [450, 60],
- [750, 50],
- [1130, 40],
- [1720, 30],
- [2400, 20],
- ],
-};
+import { LocoType, calculateSpeedLimit } from './speedLimitUtils';
export function isLocomotive(vehicle: ILocomotive | ICarWagon): vehicle is ILocomotive {
return (vehicle as ILocomotive).power !== undefined;
@@ -40,84 +11,28 @@ export function locoDataList(state: IStore) {
const stockData = state.stockData;
- return Object.keys(stockData.info).reduce((acc, vehicleTypeKey) => {
- if (!vehicleTypeKey.startsWith('loco')) return acc;
+ return Object.keys(stockData.info).reduce((acc, vehiclePower) => {
+ if (!vehiclePower.startsWith('loco')) return acc;
- const locoVehiclesData = stockData.info[vehicleTypeKey as TStockInfoKey];
+ const locoVehiclesData = stockData.info[vehiclePower as 'loco-e' | 'loco-s' | 'loco-ezt' | 'loco-szt'];
locoVehiclesData.forEach((loco) => {
if (state.showSupporter && !loco[4]) return;
- const locoType = loco[0] as string;
-
- let length = 0,
- mass = 0;
-
- // Elektrowozy
- if (vehicleTypeKey.startsWith('loco-e')) {
- // 32m dla ET41, reszta 16
- length = locoType.startsWith('ET') ? 32 : 16;
-
- // 80t dla wszystkich EU06, EP08
- mass = 80;
-
- // 83t dla: EU07 o nr większych niż 300 & dla wszystkich EP07 oprócz nr 135,242,1002,1048
- const locoNumber = Number(locoType.split('-')[1]);
-
- if (
- (locoType.startsWith('EU') && locoNumber > 300) ||
- (locoType.startsWith('EP') && ![242, 135, 1002, 1048].includes(locoNumber))
- ) {
- mass = 83;
- }
-
- if (locoType.startsWith('ET')) {
- mass = 167;
- }
- }
-
- // Spalinowozy
- if (vehicleTypeKey.startsWith('loco-s')) {
- length = 14;
- mass = 74;
- }
-
- // EZT
- if (vehicleTypeKey.startsWith('loco-ezt')) {
- // EN57
- length = 65;
- mass = 126;
-
- // EN71
- if (locoType.startsWith('EN71')) {
- length = 86;
- mass = 182;
- }
-
- // 2xEN57
- if (locoType.startsWith('2EN57')) {
- length = 130;
- mass = 253;
- }
- }
-
- // SZT
- if (vehicleTypeKey.startsWith('loco-szt')) {
- length = 14;
- mass = 23;
- }
+ const [type, constructionType, cabinType, maxSpeed, supportersOnly] = loco;
+ const locoProps = stockData.props.find((prop) => constructionType == prop.type);
acc.push({
- power: vehicleTypeKey,
- type: loco[0] as string,
- constructionType: loco[1] as string,
- cabinType: loco[2] as string,
- maxSpeed: Number(loco[3] as string),
- supportersOnly: loco[4] as boolean,
- imageSrc: loco[5] as string,
+ power: vehiclePower,
+ type,
+ constructionType,
+ cabinType,
+ maxSpeed: Number(maxSpeed),
+ supportersOnly,
+ imageSrc: '',
- length,
- mass,
+ length: locoProps?.length && type.startsWith('2EN') ? locoProps.length * 2 : locoProps?.length || 0,
+ mass: locoProps?.mass && type.startsWith('2EN') ? 253 : locoProps?.mass || 0,
});
});
@@ -130,10 +45,10 @@ export function carDataList(state: IStore) {
const stockData = state.stockData;
- return Object.keys(stockData.info).reduce((acc, vehicleTypeKey) => {
- if (!vehicleTypeKey.startsWith('car')) return acc;
+ return Object.keys(stockData.info).reduce((acc, vehicleUseType) => {
+ if (!vehicleUseType.startsWith('car')) return acc;
- const carVehiclesData = stockData.info[vehicleTypeKey as TStockInfoKey];
+ const carVehiclesData = stockData.info[vehicleUseType as 'car-passenger' | 'car-cargo'];
carVehiclesData.forEach((car) => {
if (state.showSupporter && !car[3]) return;
@@ -141,19 +56,21 @@ export function carDataList(state: IStore) {
const carPropsData = stockData.props.find((v) => car[0].toString().startsWith(v.type));
acc.push({
- useType: vehicleTypeKey as 'car-passenger' | 'car-cargo',
- type: car[0] as string,
- constructionType: car[1] as string,
- loadable: car[2] as boolean,
- supportersOnly: car[3] as boolean,
- maxSpeed: Number(car[4] as string),
- imageSrc: car[5] as string,
- cargoList: carPropsData?.cargo.split(';').filter((s) => s.length > 0)
- ? carPropsData.cargo.split(';').map((cargo) => ({
- id: cargo.split(':')[0],
- totalMass: Number(cargo.split(':')[1]),
- }))
- : [],
+ useType: vehicleUseType as 'car-passenger' | 'car-cargo',
+ type: car[0],
+ constructionType: car[1],
+ loadable: car[2],
+ supportersOnly: car[3],
+ maxSpeed: Number(car[4]),
+ imageSrc: '',
+ cargoList:
+ !carPropsData || carPropsData.cargo === null
+ ? []
+ : carPropsData.cargo.split(';').map((cargo) => ({
+ id: cargo.split(':')[0],
+ totalMass: Number(cargo.split(':')[1]),
+ })),
+
mass: carPropsData?.mass || 0,
length: carPropsData?.length || 0,
});
@@ -164,7 +81,7 @@ export function carDataList(state: IStore) {
}
export function totalMass(state: IStore) {
- return state.stockList.reduce(
+ return ~~state.stockList.reduce(
(acc, stock) => acc + (stock.cargo ? stock.cargo.totalMass : stock.mass) * stock.count,
0
);
@@ -175,7 +92,47 @@ export function totalLength(state: IStore) {
}
export function maxStockSpeed(state: IStore) {
- return state.stockList.reduce((acc, stock) => (stock.maxSpeed < acc || acc == 0 ? stock.maxSpeed : acc), 0);
+ const stockSpeedLimit = state.stockList.reduce(
+ (acc, stock) => (stock.maxSpeed < acc || acc == 0 ? stock.maxSpeed : acc),
+ 0
+ );
+ const headingLoco = state.stockList[0]?.isLoco ? state.stockList[0] : undefined;
+
+ if (!headingLoco) return stockSpeedLimit;
+
+ const locoType = headingLoco.type.split('-')[0];
+
+ if (/^(EN|2EN|SN)/.test(locoType)) return stockSpeedLimit;
+
+ const stockMass = totalMass(state);
+
+ const speedLimitByMass = calculateSpeedLimit(locoType as LocoType, stockMass, isTrainPassenger(state));
+
+ return speedLimitByMass ? Math.min(stockSpeedLimit, speedLimitByMass) : stockSpeedLimit;
+}
+
+export function acceptableMass(state: IStore) {
+ if (state.stockList.length == 0 || !state.stockList[0].isLoco) return 0;
+ const activeLocomotiveType = state.stockList[0].type;
+
+ if (/^SM/.test(activeLocomotiveType)) return 2400;
+
+ // Elektryczne EU07 / EP07 / EP08 / ET41
+
+ // Pasażerski elektr.
+ if (isTrainPassenger(state)) {
+ if (/^(EU|EP)/.test(activeLocomotiveType)) return 650;
+ if (/^ET/.test(activeLocomotiveType)) return 700;
+
+ return 0;
+ }
+
+ // Towarowy / inny elektr.
+ if (/^EU/.test(activeLocomotiveType)) return 2000;
+ if (/^ET/.test(activeLocomotiveType)) return 4000;
+ if (/^EP/.test(activeLocomotiveType)) return 650;
+
+ return 0;
}
export function isTrainPassenger(state: IStore) {
@@ -206,124 +163,3 @@ export function chosenRealStock(state: IStore) {
return realStockObj;
}
-// export function maxAllowedSpeed(state: IStore) {
-// const headLocoType = state.stockList[0]?.isLoco ? state.stockList[0].type : undefined;
-
-// if (!headLocoType) return 0;
-
-// const isPassenger = isTrainPassenger(state);
-// const stockMass = totalMass(state);
-
-// // const maxSpeed = maxAllowedSpeedTable[headLocoType];
-
-// // if()
-// }
-
-// export function maxAllowedSpeed(state: IStore) {
-// if (state.stockList.length < 1) return -1;
-// if (!state.stockList[0].isLoco) return -1;
-
-// const headingLoco = state.stockList[0];
-// const isPassenger = isTrainPassenger(state);
-
-// if (headingLoco.type.startsWith('EU07')) {
-// if (isPassenger && totalMass.value <= 650) return 125;
-// if (!isPassenger && totalMass.value <= 2000) return 70;
-
-// return -1;
-// }
-
-// if (headingLoco.type.startsWith('EP07')) {
-// if (isPassenger && totalMass.value <= 650) return 125;
-// if (!isPassenger) return -1;
-
-// return -1;
-// }
-
-// if (headingLoco.type.startsWith('EP08')) {
-// if (isPassenger && totalMass.value <= 650) return 140;
-// if (!isPassenger) return -1;
-
-// return -1;
-// }
-
-// if (headingLoco.type.startsWith('ET41')) {
-// if (isPassenger && totalMass.value <= 700) return 125;
-// if (!isPassenger && totalMass.value <= 4000) return 70;
-
-// return -1;
-// }
-
-// if (headingLoco.type.startsWith('SM42')) {
-// if (totalMass.value <= 95) return 90;
-// if (totalMass.value <= 200) return 80;
-// if (totalMass.value <= 300) return 70;
-// if (totalMass.value <= 450) return 60;
-// if (totalMass.value <= 750) return 50;
-// if (totalMass.value <= 1130) return 40;
-// if (totalMass.value <= 1720) return 30;
-// if (totalMass.value <= 2400) return 20;
-
-// return -1;
-// }
-
-// return Store.stockList.reduce((acc, stock) => (stock.maxSpeed < acc || acc == 0 ? stock.maxSpeed : acc), 0);
-// });
-
-// export const warnings = {
-// trainTooLong: computed(() => {
-// if (isTrainPassenger.value && totalLength.value > 350) return true;
-// if (!isTrainPassenger.value && totalLength.value > 650) return true;
-
-// return false;
-// }),
-
-// locoNotSuitable: computed(() => {
-// if (
-// !isTrainPassenger.value &&
-// Store.stockList.length > 1 &&
-// !Store.stockList.every((stock) => stock.isLoco) &&
-// Store.stockList.find((stock) => stock.isLoco && stock.type.startsWith('EP'))
-// )
-// return true;
-
-// return false;
-// }),
-
-// trainTooHeavy: computed(() => {
-// if (Store.stockList.length == 0 || !Store.stockList[0].isLoco) return false;
-
-// const headingLoco = Store.stockList[0];
-
-// if (
-// isTrainPassenger.value &&
-// (headingLoco.type.startsWith('EU') || headingLoco.type.startsWith('EP')) &&
-// totalMass.value > 650
-// )
-// return true;
-// if (isTrainPassenger.value && headingLoco.type.startsWith('ET') && totalMass.value > 700) return true;
-
-// if (!isTrainPassenger.value && headingLoco.type.startsWith('EU') && totalMass.value > 2000) return true;
-// if (!isTrainPassenger.value && headingLoco.type.startsWith('ET') && totalMass.value > 4000) return true;
-
-// if (headingLoco.type.startsWith('SM') && totalMass.value > 2400) return true;
-
-// return false;
-// }),
-
-// tooManyLocos: computed(() => {
-// if (
-// Store.stockList.reduce((acc, stock) => {
-// if (!stock.isLoco) return acc;
-
-// acc += stock.count;
-
-// return acc;
-// }, 0) > 2
-// )
-// return true;
-
-// return false;
-// }),
-// };
-