Bug #2252
GetHangarShips: .Name returns .Type instead
Description
When Iterating over the index:item of GetHangarShips it is not possible to get the ships name. .Name will always return the ships type instead.
If you for example try to run missions, with special fit ships for each mission, you cannot clearly determine the ship you actually want.
Test Code (have two ships of the same type in your hangar, but give them different names):
method ActivateShip(string TheType, string TheName)
{
variable index:item hsIndex
variable iterator hsIterator
variable string shipType
variable string shipName
if ${Me.InStation}
{
Me:GetHangarShips[hsIndex]
hsIndex:GetIterator[hsIterator]
shipType:Set[${MyShip.ToItem.Type}]
shipName:Set[${MyShip.Name}]
echo DEBUG ${shipType} ${shipName} || ${TheType} ${TheName}
if (${shipType.NotEqual[${TheType}]} || ${shipName.NotEqual[${TheName}]}) && ${hsIterator:First(exists)}
{
do
{
if ${hsIterator.Value.Type.Equal[${TheType}]} && ${hsIterator.Value.Name.Equal[${TheName}]}
{
This:LogInfo["Switching to ship of Type ${hsIterator.Value.Type} and Name ${hsIterator.Value.Name}"]
hsIterator.Value:MakeActive
break
}
echo DEBUG WRONG SHIP ${hsIterator.Value.Type} ${hsIterator.Value.Name}
}
while ${hsIterator:Next(exists)}
}
else
{
This:LogInfo["We seem to not have... Any ships? I don't think this can happen tbh"]
}
}
}
No data to display