/// <summary>
        /// Initialize and Allocate Arrays for the Maps, Histories
        /// </summary>
        private void InitMapArrays()
        {
            Map = new ushort[Constants.WorldWidth, Constants.WorldHeight];

            ResHist       = new short[Constants.HistoryLength];
            ComHist       = new short[Constants.HistoryLength];
            IndHist       = new short[Constants.HistoryLength];
            MoneyHist     = new short[Constants.HistoryLength];
            PollutionHist = new short[Constants.HistoryLength];
            CrimeHist     = new short[Constants.HistoryLength];
            MiscHist      = new short[Constants.MiscHistoryLength];

            PopulationDensityMap   = new ByteMap2();
            TrafficDensityMap      = new ByteMap2();
            PollutionDensityMap    = new ByteMap2();
            LandValueMap           = new ByteMap2();
            CrimeRateMap           = new ByteMap2();
            TerrainDensityMap      = new ByteMap4();
            RateOfGrowthMap        = new ShortMap8();
            PowerGridMap           = new ByteMap1();
            FireStationMap         = new ShortMap8();
            FireStationEffectMap   = new ShortMap8();
            PoliceStationMap       = new ShortMap8();
            PoliceStationEffectMap = new ShortMap8();
            ComRateMap             = new ShortMap8();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Smooth a station map.
        ///
        ///  Used for smoothing fire station and police station coverage maps.
        /// </summary>
        /// <param name="map">Map to smooth.</param>
        private static void SmoothStationMap(ShortMap8 map)
        {
            short     x, y, edge;
            ShortMap8 tempMap = new ShortMap8(map);

            for (x = 0; x < tempMap.width; x++)
            {
                for (y = 0; y < tempMap.height; y++)
                {
                    edge = 0;
                    if (x > 0)
                    {
                        edge += tempMap.Get(x - 1, y);
                    }
                    if (x < tempMap.width - 1)
                    {
                        edge += tempMap.Get(x + 1, y);
                    }
                    if (y > 0)
                    {
                        edge += tempMap.Get(x, y - 1);
                    }
                    if (y < tempMap.height - 1)
                    {
                        edge += tempMap.Get(x, y + 1);
                    }
                    edge = (short)(tempMap.Get(x, y) + edge / 4);
                    map.Set(x, y, (short)(edge / 2));
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Simulator constructor.
        /// </summary>
        public Micropolis()
        {
            PopulationDensityMap = new ByteMap2();
            TrafficDensityMap    = new ByteMap2();
            PollutionDensityMap  = new ByteMap2();
            LandValueMap         = new ByteMap2();
            CrimeRateMap         = new ByteMap2();
            TerrainDensityMap    = new ByteMap4();

            TempMap1 = new ByteMap2();
            TempMap2 = new ByteMap2();
            TempMap3 = new ByteMap2();

            PowerGridMap           = new ByteMap1();
            RateOfGrowthMap        = new ShortMap8();
            FireStationMap         = new ShortMap8();
            FireStationEffectMap   = new ShortMap8();
            PoliceStationMap       = new ShortMap8();
            PoliceStationEffectMap = new ShortMap8();
            ComRateMap             = new ShortMap8();

            init();
        }