mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 11:45:34 +00:00
feature: ładowanie składów z pliku
This commit is contained in:
@@ -70,6 +70,27 @@ export default defineComponent({
|
||||
|
||||
this.store.stockList.push(stockObj);
|
||||
},
|
||||
|
||||
loadStockFromString(stockString: string) {
|
||||
const stockArray = stockString.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, i) => {
|
||||
let vehicle: Vehicle | null = null;
|
||||
if (i == 0) vehicle = this.store.locoDataList.find((loco) => loco.type == stockArray[0]) || null;
|
||||
else vehicle = this.store.carDataList.find((car) => car.type == type) || null;
|
||||
|
||||
this.addVehicle(vehicle);
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user