Merge pull request #885 from Pax1601/857-file-import-fails-if-alt-value-present-in-targetposition-entry

857 file import fails if alt value present in targetposition entry
This commit is contained in:
Pax1601 2024-03-20 16:43:13 +01:00 committed by GitHub
commit 5507bca68d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -761,9 +761,13 @@ export class GroundUnitSpawnMenu extends UnitSpawnMenu {
};
var units = [];
let initialLat = unitTable.location.lat;
let initialLng = unitTable.location.lng;
let rows = Math.floor(Math.sqrt(unitsCount))
for (let i = 0; i < unitsCount; i++) {
unitTable.location.lat = initialLat + i % rows * 0.0001;
unitTable.location.lng = initialLng + Math.floor(i / rows) * 0.0001;
units.push(JSON.parse(JSON.stringify(unitTable)));
unitTable.location.lat += i > 0? 0.0001: 0;
}
getApp().getUnitsManager().spawnUnits("GroundUnit", units, getApp().getActiveCoalition(), false, spawnOptions.airbase ? spawnOptions.airbase.getName() : "", spawnOptions.country, (res: any) => {
@ -812,9 +816,13 @@ export class NavyUnitSpawnMenu extends UnitSpawnMenu {
};
var units = [];
let initialLat = unitTable.location.lat;
let initialLng = unitTable.location.lng;
let rows = Math.floor(Math.sqrt(unitsCount))
for (let i = 0; i < unitsCount; i++) {
unitTable.location.lat = initialLat + i % rows * 0.005;
unitTable.location.lng = initialLng + Math.floor(i / rows) * 0.005;
units.push(JSON.parse(JSON.stringify(unitTable)));
unitTable.location.lat += i > 0? 0.0001: 0;
}
getApp().getUnitsManager().spawnUnits("NavyUnit", units, getApp().getActiveCoalition(), false, spawnOptions.airbase ? spawnOptions.airbase.getName() : "", spawnOptions.country, (res: any) => {