public void makeJump(string secString) { // 1st see if we've a world already loaded, and save off any notes if (edNotes.Text.Length > 0) { world.saveNotes(edNotes.Text, edNPC.Text); } // our jump from travelogue if (world != null) { ship.travelogue("Prepping for jumping from " + world.Name); } // 1st see if we're in jump range Traveller.World newWorld = new Traveller.World(); if (newWorld.isValidSEC(secString)) { newWorld = new Traveller.World(secString, ship.Version); if (world == null) { world = newWorld; } Traveller.TravUtils util = new Traveller.TravUtils(); if (util.calcDistance(newWorld.Hex, world.Hex) <= ship.Jump) { ship.makeJump(secString); world = new Traveller.World(secString, ship.Version); showShip(ship.Filename); } else { MessageBox.Show("You can't jump that far!"); } } else { MessageBox.Show(secString, "Invalid SEC format"); } }
private void loadDataFile(string filename) { // and load our world picker cbWorld.Items.Clear(); StreamReader rd = new StreamReader(filename); string line = ""; Traveller.World tw = new Traveller.World(); while ((line = rd.ReadLine()) != null) { if (tw.isValidSEC(line)) { cbWorld.Items.Add(line); } } }
private void loadSector() { // clear out anything if we've got it cbWorlds.Items.Clear(); // and load the sector file StreamReader rd = new StreamReader("Assets/" + ship.SECDataFile); string line = ""; Traveller.World tw = new Traveller.World(); while ((line = rd.ReadLine()) != null) { if (tw.isValidSEC(line)) { cbWorlds.Items.Add(line); } } }