// 7.10.16 Eliminated usage of Star, Settlement and Planetoid Reports to calculate partial System values. // Access to Owner, Capacity and Resources values now determined (in SystemAccessController) by whether // Star, Settlement and Planetoid AccessControllers provide access. Partial values can be calc'd if not. public SystemReport(SystemData data, Player player, ISystem_Ltd item) : base(data, player, item) { }
/// <summary> /// Returns true if the sector indicated by sectorID contains a System. /// </summary> /// <param name="sectorID">ID of the sector.</param> /// <param name="system">The system if present in the sector.</param> /// <returns></returns> public bool TryGetSystem(IntVector3 sectorID, out ISystem_Ltd system) { bool isSystemFound = _systemLookupBySectorID.TryGetValue(sectorID, out system); if (isSystemFound) { //D.Log("{0} found System {1} in Sector {2}.", DebugName, system.DebugName, sectorID); } return isSystemFound; }
private void ExploreSystem(ISystem_Ltd system) { var shipSystemTgtsToExplore = system.Planets.Cast<IShipExplorable>().Where(p => !p.IsFullyExploredBy(Owner)).ToList(); IShipExplorable star = system.Star as IShipExplorable; if (!star.IsFullyExploredBy(Owner)) { shipSystemTgtsToExplore.Add(star); } D.Assert(shipSystemTgtsToExplore.Count > Constants.Zero); // OPTIMIZE System has already been validated for exploration // Note: Knowledge of each explore target in system will be checked as soon as Ship gets explore order _shipSystemExploreTgtAssignments = shipSystemTgtsToExplore.ToDictionary<IShipExplorable, IShipExplorable, ShipItem>(exploreTgt => exploreTgt, exploreTgt => null); int desiredExplorationShipQty = shipSystemTgtsToExplore.Count; IList<ShipItem> ships; bool hasShips = TryGetShips(out ships, availableOnly: false, avoidHQ: true, qty: desiredExplorationShipQty, priorityCats: _desiredExplorationShipCategories); D.Assert(hasShips); // must have ships if availableOnly = false Stack<ShipItem> explorationShips = new Stack<ShipItem>(ships); while (explorationShips.Count > Constants.Zero) { bool wasAssigned = AssignShipToExploreSystemTgt(explorationShips.Pop()); if (!wasAssigned) { break; } } }