public void SetUserShipName(JournalSetUserShipName e) { ShipInformation sm = EnsureShip(e.ShipID); // this either gets current ship or makes a new one. Ships[e.ShipID] = sm.Set(e.Ship, e.ShipFD, e.ShipName, e.ShipIdent); currentid = e.ShipID; // must be in it to do this }
public void ShipyardNew(JournalShipyardNew e) { ShipInformation sm = EnsureShip(e.ShipId); // this either gets current ship or makes a new one. Ships[e.ShipId] = sm.Set(e.ShipType, e.ShipFD); // shallow copy if changed currentid = e.ShipId; }
public void Loadout(int id, string ship, string shipfd, string name, string ident, List <JournalLoadout.ShipModule> modulelist) { ShipInformation sm = EnsureShip(id); // this either gets current ship or makes a new one. sm.Set(ship, shipfd, name, ident); //System.Diagnostics.Debug.WriteLine("Loadout " + sm.ID + " " + sm.Ship); ShipInformation newsm = null; foreach (JournalLoadout.ShipModule m in modulelist) { if (!sm.Contains(m.Slot) || !sm.Same(m)) // no slot, or not the same data.. (ignore localised item) { if (m.LocalisedItem == null && itemlocalisation.ContainsKey(m.Item)) // if we have a cached localisation, use it { m.LocalisedItem = itemlocalisation[m.Item]; } if (newsm == null) // if not cloned { newsm = sm.ShallowClone(); // we need a clone, pointing to the same modules, but with a new dictionary Ships[id] = newsm; // update our record of last module list for this ship } newsm.Set(m); // update entry only.. rest will still point to same entries } } }
public void LoadGame(int id, string ship, string shipfd, string name, string ident, double fuellevel, double fueltotal) // LoadGame.. { ShipInformation sm = EnsureShip(id); // this either gets current ship or makes a new one. Ships[id] = sm = sm.Set(ship, shipfd, name, ident, fuellevel, fueltotal); // this makes a shallow copy if any data has changed.. //System.Diagnostics.Debug.WriteLine("Load Game " + sm.ID + " " + sm.Ship); if (!JournalFieldNaming.IsSRVOrFighter(ship)) { currentid = sm.ID; } }