Пример #1
0
        public void SetAllDistrictsServed(ushort buildingID, bool value)
        {
            ServiceBuildingData data = GetData(buildingID);

            if (data != null)
            {
                data.SetAllDistrictsServed(value);
            }
        }
Пример #2
0
        public void SetAdditionalTarget(ushort buildingID, byte targetDistrictID, bool allowed)
        {
            ServiceBuildingData data = GetData(buildingID);

            if (data != null)
            {
                data.SetAdditionalTarget(targetDistrictID, allowed);
            }
        }
Пример #3
0
        internal ServiceBuildingData GetData(ushort buildingID)
        {
            // the building might not be supported anymore (eg: it's district was removed), so this check
            // must be performed before anything else
            if (!IsSupported(buildingID))
            {
                OnBuildingRemoved(buildingID);
                return(null);
            }

            if (m_serviceBuildingInfos.ContainsKey(buildingID))
            {
                return(m_serviceBuildingInfos[buildingID]);
            }
            else
            {
                ServiceBuildingData result = new ServiceBuildingData();
                result.buildingID = buildingID;
                SetData(buildingID, result);
                return(result);
            }
        }
Пример #4
0
 internal void SetData(ushort buildingID, ServiceBuildingData data)
 {
     m_serviceBuildingInfos.Add(buildingID, data);
 }
Пример #5
0
        public bool AreAllDistrictsServed(ushort buildingID)
        {
            ServiceBuildingData data = GetData(buildingID);

            return(data == null ? false : data.AreAllDistrictsServed());
        }
Пример #6
0
        public bool IsAdditionalTarget(ushort buildingID, byte targetDistrictID)
        {
            ServiceBuildingData data = GetData(buildingID);

            return(data == null ? false : data.IsAdditionalTarget(targetDistrictID));
        }
Пример #7
0
        public bool IsTargetCovered(ushort buildingID, byte targetDistrictID)
        {
            ServiceBuildingData data = GetData(buildingID);

            return(data == null ? false : (data.AreAllDistrictsServed() || data.IsAdditionalTarget(targetDistrictID)));
        }