protected ACity(Empire empire, CityId id) { TheEmpire = empire; Id = id; Data = empire.Data->CitiesData[id]; CachedPersistentId = PersistentId; TheEmpire.OnStartOfTurnOrResume += () => _maintenance = -1; }
public City this[PersistentCityId persistentId] { get { if (CityObjects.Count < Count) { Update(); } City city = IdLookup[persistentId]; return(city.Exists ? city : throw new KeyNotFoundException()); } }
public bool TryGetValue(PersistentCityId persistentId, out City city) { if (CityObjects.Count < Count) { Update(); } if (IdLookup.TryGetValue(persistentId, out city) && city.Exists) { return(true); } city = null; return(false); }