Пример #1
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 void smoothStationMap(MapShort8 map)
        {
            short x, y, edge;
            var   tempMap = new MapShort8(map);

            for (x = 0; x < tempMap.MAP_W; x++)
            {
                for (y = 0; y < tempMap.MAP_H; y++)
                {
                    edge = 0;
                    if (x > 0)
                    {
                        edge += tempMap.get(x - 1, y);
                    }
                    if (x < tempMap.MAP_W - 1)
                    {
                        edge += tempMap.get(x + 1, y);
                    }
                    if (y > 0)
                    {
                        edge += tempMap.get(x, y - 1);
                    }
                    if (y < tempMap.MAP_H - 1)
                    {
                        edge += tempMap.get(x, y + 1);
                    }
                    edge = (short)(tempMap.get(x, y) + edge / 4);
                    map.set(x, y, (short)(edge / 2));
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Simualtor constructor.
 /// </summary>
 public Micropolis()
 {
     populationDensityMap   = new MapByte2(0);
     trafficDensityMap      = new MapByte2(0);
     pollutionDensityMap    = new MapByte2(0);
     landValueMap           = new MapByte2(0);
     crimeRateMap           = new MapByte2(0);
     terrainDensityMap      = new MapByte4(0);
     tempMap1               = new MapByte2(0);
     tempMap2               = new MapByte2(0);
     tempMap3               = new MapByte4(0);
     powerGridMap           = new MapByte1(0);
     rateOfGrowthMap        = new MapShort8(0);
     fireStationMap         = new MapShort8(0);
     fireStationEffectMap   = new MapShort8(0);
     policeStationMap       = new MapShort8(0);
     policeStationEffectMap = new MapShort8(0);
     comRateMap             = new MapShort8(0);
     init();
 }