- added "system type" (e.g. WH, 0.0,..) to signature "leads to" select, #597
This commit is contained in:
@@ -162,6 +162,28 @@ define([
|
||||
return systemInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* get system data by mapId and systemid
|
||||
* @param mapId
|
||||
* @param systemId
|
||||
* @returns {boolean}
|
||||
*/
|
||||
let getSystemData = (mapId, systemId) => {
|
||||
let systemData = false;
|
||||
let mapData = Util.getCurrentMapData(mapId);
|
||||
|
||||
if(mapData){
|
||||
for(let j = 0; j < mapData.data.systems.length; j++){
|
||||
let systemDataTemp = mapData.data.systems[j];
|
||||
if(systemDataTemp.id === systemId){
|
||||
systemData = systemDataTemp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return systemData;
|
||||
};
|
||||
|
||||
/**
|
||||
* get system type information
|
||||
* @param {number} systemTypeId
|
||||
@@ -1060,6 +1082,7 @@ define([
|
||||
getMapIcons: getMapIcons,
|
||||
getInfoForMap: getInfoForMap,
|
||||
getInfoForSystem: getInfoForSystem,
|
||||
getSystemData: getSystemData,
|
||||
getSystemTypeInfo: getSystemTypeInfo,
|
||||
getEffectInfoForSystem: getEffectInfoForSystem,
|
||||
toggleSelectSystem: toggleSelectSystem,
|
||||
|
||||
@@ -1500,6 +1500,7 @@ define([
|
||||
let map = Map.getMapInstance( mapId );
|
||||
let systemId = MapUtil.getSystemId(mapId, systemData.id);
|
||||
let systemConnections = MapUtil.searchConnectionsBySystems(map, [systemId], 'wh');
|
||||
let newSelectOptions = [];
|
||||
let connectionOptions = [];
|
||||
|
||||
for(let i = 0; i < systemConnections.length; i++){
|
||||
@@ -1510,25 +1511,35 @@ define([
|
||||
// check whether "source" or "target" system is relevant for this connection
|
||||
// -> hint "source" === 'target' --> loop
|
||||
if(systemData.id !== connectionData.target){
|
||||
// take target...
|
||||
connectionOptions.push({
|
||||
value: connectionData.id,
|
||||
text: connectionData.targetAlias
|
||||
});
|
||||
let targetSystemData = MapUtil.getSystemData(mapId, connectionData.target);
|
||||
if(targetSystemData){
|
||||
// take target...
|
||||
connectionOptions.push({
|
||||
value: connectionData.id,
|
||||
text: connectionData.targetAlias + ' - ' + targetSystemData.security
|
||||
});
|
||||
}
|
||||
}else if(systemData.id !== connectionData.source){
|
||||
// take source...
|
||||
connectionOptions.push({
|
||||
value: connectionData.id,
|
||||
text: connectionData.sourceAlias
|
||||
});
|
||||
let sourceSystemData = MapUtil.getSystemData(mapId, connectionData.source);
|
||||
if(sourceSystemData){
|
||||
// take source...
|
||||
connectionOptions.push({
|
||||
value: connectionData.id,
|
||||
text: connectionData.sourceAlias + ' - ' + sourceSystemData.security
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add empty entry
|
||||
connectionOptions.unshift({ value: null, text: ''});
|
||||
if(connectionOptions.length > 0){
|
||||
newSelectOptions.push({ text: 'System', children: connectionOptions});
|
||||
}
|
||||
|
||||
return connectionOptions;
|
||||
// add empty entry
|
||||
newSelectOptions.unshift({ value: null, text: ''});
|
||||
|
||||
return newSelectOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1621,7 +1632,7 @@ define([
|
||||
if(newSelectOptionsCount > 0){
|
||||
if(groupId === 5){
|
||||
// "wormhole" selected => multiple <optgroup> available
|
||||
newSelectOptions.push({ text: 'Wandering WHs', children: fixSelectOptions});
|
||||
newSelectOptions.push({ text: 'Wandering WH', children: fixSelectOptions});
|
||||
}else{
|
||||
newSelectOptions = fixSelectOptions;
|
||||
}
|
||||
@@ -1645,7 +1656,7 @@ define([
|
||||
}
|
||||
|
||||
if(frigateWHData.length > 0){
|
||||
newSelectOptions.push({ text: 'Frigate WHs', children: frigateWHData});
|
||||
newSelectOptions.push({ text: 'Frigate WH', children: frigateWHData});
|
||||
}
|
||||
|
||||
// add possible incoming holes
|
||||
@@ -1661,7 +1672,7 @@ define([
|
||||
}
|
||||
|
||||
if(incomingWHData.length > 0){
|
||||
newSelectOptions.push({ text: 'Incoming WHs', children: incomingWHData});
|
||||
newSelectOptions.push({ text: 'Incoming WH', children: incomingWHData});
|
||||
}
|
||||
}else{
|
||||
// groups without "children" (optgroup) should be sorted by "value"
|
||||
@@ -1686,7 +1697,7 @@ define([
|
||||
}
|
||||
|
||||
if(staticWHData.length > 0){
|
||||
newSelectOptions.unshift({ text: 'Static WHs', children: staticWHData});
|
||||
newSelectOptions.unshift({ text: 'Static WH', children: staticWHData});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user