You keep cycling for a particular ship while the order changes when you're at it.
So I wondered if it's possible to add a alphabetical sorting to this function:
Code: Select all
function menu.getShipList()
if menu.mode == "wareexchange" then
menu.ships = { GetTradeShipData(menu.modeparam[1]) }
else
menu.ships = GetTradeShipList()
for i = #menu.ships, 1, -1 do
local ship = menu.ships[i]
local commander = GetCommander(ship.shipid)
if IsSameComponent(ship.shipid, menu.playership) then
table.remove(menu.ships, i)
elseif commander and not IsSameComponent(commander, menu.playership) then
table.remove(menu.ships, i)
elseif GetBuildAnchor(ship.shipid) then
table.remove(menu.ships, i)
elseif #GetTransportUnitMacros(GetComponentData(ship.shipid, "macro")) == 0 then
table.remove(menu.ships, i)
elseif (menu.mode == "deals") and (GetComponentData(ship.shipid, "primarypurpose") == "build") then
table.remove(menu.ships, i)
end
end
end
end