public ShipData(Traveller.Starship ship) { InitializeComponent(); loadShip(ship); this.myShip = ship; btnAdd.Text = "update current ship"; this.isNew = true; }
/// <summary> /// selling a cargo lot /// </summary> /// <param name="cargo">cargo structure - item we are selling</param> /// <param name="ship">Traveller starship - ship it is being sold from</param> /// <param name="world">Traveller world - world it is being sold on</param> public Selling(Traveller.Starship.cargoDesc cargo, Traveller.Starship ship, Traveller.World world) { InitializeComponent(); lblCurrent.Text = world.SEC; lblSelling.Text = String.Format("{0} {1} dTons; Cr{2}", cargo.origCode, cargo.dtons, cargo.purchasePrice); lblDesc.Text = cargo.desc; lblOrigSystem.Text = cargo.origSEC; edDM.Text = ship.TradeDM.ToString(); this.world = world; this.cargo = cargo; this.ship = ship; // and set the selling info this.cargo.sellingDate = this.ship.Date; this.cargo.destSEC = this.world.SEC; }
private void addNewShip() { int cargo = 0; int.TryParse(edCargo.Text, out cargo); int monthly = 0; int.TryParse(edMonthly.Text, out monthly); int perjump = 0; int.TryParse(edPerJump.Text, out perjump); int credits = 0; int.TryParse(edCredits.Text, out credits); string version = "CT"; // default if (rbCustom.Checked) version = "CU"; if (rbMongoose.Checked) version = "MT"; if (rbT5.Checked) version = "T5"; Traveller.Starship ship = new Traveller.Starship(edName.Text, (int)edMan.Value, (int)edPower.Value, (int)edJump.Value, cargo, monthly, perjump, Convert.ToInt32(edDay.Text), Convert.ToInt32(edYear.Text), credits, version, lblDataFile.Text, cbWorld.SelectedItem.ToString(), edSectorName.Text, (int)edTradeDM.Value, ckIllegal.Checked); Properties.Settings.Default.ShipDataFile = edName.Text + ".xml"; Properties.Settings.Default.Save(); }
/// <summary> /// trade instantiation /// </summary> /// <param name="ship">ship - Traveller ship object</param> /// <param name="world">world - Traveller world object</param> /// <remarks>deals with cargo</remarks> public Trade(Traveller.Starship ship, Traveller.World w) { this.errmsg = ""; this.world = w; this.ship = ship; this.cargoes = new List<Starship.cargoDesc>(); this.version = ship.Version; }
// load the file; verify it appears ok private void showShip(string shipdataname) { ship = new Traveller.Starship(shipdataname); if (ship.ErrMessage.Length > 0) { MessageBox.Show("Error in loading ship data: " + ship.ErrMessage); return; } lblShipData.Text = shipdataname; this.Text = "Traveller Trade for " + ship.Name; displayShip(); loadSector(); }