The code is very simple though:
public List
{
Utilities util = new Utilities();
List
foreach (World world in TravellerTracker.App.DB.Worlds.Where(x => x.SectorID == this.SectorID))
{
if (this.Hex != world.Hex)
if (util.calcDistance(this.Hex, world.Hex) <= jump)
results.Add(world);
}
return results;
}
Just go through the list of the worlds in your subsector and if they are in range and not your planet, add them to the return list. The jump range calculation is based on hex maps for calculating ranges. I've added this method to the world class. It was either there or the ship class.
I am also thinking we could shorten the list down a bit by limiting the set of worlds to search from the entire subsector to just those with +/- jump range for the hex pairs. So that a world at 1020 and a jump range of 3 would give us the range of 0717 to 1323. However - systems are fast enough to use the brute force approach so that works for me.
Still need to make the UI prettier, and add a button to allow the user to jump to that system (add 7 days, subtract the appropriate amount of fuel). I also need to do this on the cargo tab - each world would have the passenger and bulk cargo available going to that world. Add the buttons to accept and subtract from available tonnage or steerage (well, that's not there) and add the credits.
No comments:
Post a Comment