public void Add(CivPopVessel vessel) { if (fleet.ContainsKey(vessel.GetId())) { fleet[vessel.GetId()] = vessel; } else { fleet.Add(vessel.GetId(), vessel); } }
public void Add(CivPopVessel vessel) { if (vessel.KSPVessel == null) { return; } if (vessel.KSPVessel.vesselType == VesselType.Debris || vessel.KSPVessel.vesselType == VesselType.SpaceObject || vessel.KSPVessel.vesselType == VesselType.EVA || vessel.KSPVessel.vesselType == VesselType.Flag || vessel.KSPVessel.vesselType == VesselType.DeployedScienceController || vessel.KSPVessel.vesselType == VesselType.DeployedSciencePart || vessel.KSPVessel.vesselType == VesselType.Unknown ) { return; } if (vessel.KSPVessel.rootPart == null) { SimpleLogger.fetch.Info("vessel.KSPVessel.rootPart == null"); string currentStackTrace = System.Environment.StackTrace; SimpleLogger.fetch.Info("currentStackTrace: " + currentStackTrace); return; } if (vessel.KSPVessel.rootPart.Modules == null) { SimpleLogger.fetch.Info("vessel.KSPVessel.rootPart.Modules == null"); string currentStackTrace = System.Environment.StackTrace; SimpleLogger.fetch.Info("currentStackTrace: " + currentStackTrace); return; } if (vessel.KSPVessel.rootPart.Modules.Contains <ModuleAsteroid>()) { SimpleLogger.fetch.Info("Vessel is asteroid"); string currentStackTrace = System.Environment.StackTrace; SimpleLogger.fetch.Info("currentStackTrace: " + currentStackTrace); return; } if (fleet.ContainsKey(vessel.GetId())) { fleet[vessel.GetId()] = vessel; } else { fleet.Add(vessel.GetId(), vessel); } }
public void Add(CivPopVessel vessel) { if (!Constants.ValidVessel(vessel.KSPVessel)) { return; } if (fleet.ContainsKey(vessel.GetId())) { fleet[vessel.GetId()] = vessel; } else { fleet.Add(vessel.GetId(), vessel); } }
public void allow_update_on_vessels() { CivPopRepository repo = new CivPopRepository(); CivPopVessel vessel = new CivPopVessel(Guid.NewGuid().ToString()); repo.Add(vessel); string json = repo.ToJson(); CivPopRepository fromJson = new CivPopRepository(json); fromJson.Add(vessel); Assert.AreEqual( repo.ToJson(), fromJson.ToJson() ); }
public void Remove(CivPopVessel civVessel) { fleet.Remove(civVessel.GetId()); }