Beispiel #1
0
        /// <summary>
        /// Evaluate residential zone.
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="traf"></param>
        /// <returns></returns>
        public short EvalRes(Position pos, int traf)
        {
            short value;

            if (traf < 0)
            {
                return(-3000);
            }

            value  = LandValueMap.WorldGet(pos.X, pos.Y);
            value -= PollutionDensityMap.WorldGet(pos.X, pos.Y);

            if (value < 0)
            {
                value = 0;          /* Cap at 0 */
            }
            else
            {
                value = (short)Math.Min(value * 32, 6000); /* Cap at 6000 */
            }

            value = (short)(value - 3000);

            return(value);
        }
Beispiel #2
0
        /// <summary>
        /// Perform residential immigration into the current residential tile.
        /// </summary>
        /// <param name="pos">Position of the tile.</param>
        /// <param name="pop">Population ?</param>
        /// <param name="value">Land value corrected for pollution.</param>
        public void DoResIn(Position pos, int pop, int value)
        {
            short pollution = PollutionDensityMap.WorldGet(pos.X, pos.Y);

            if (pollution > 128)
            {
                return;
            }

            ushort tile = (ushort)(Map[pos.X, pos.Y] & (ushort)MapTileBits.LowMask);

            if (tile == (ushort)MapTileCharacters.FREEZ)
            {
                if (pop < 8)
                {
                    BuildHouse(pos, value);
                    IncRateOfGrowth(pos, 1);
                    return;
                }

                if (PopulationDensityMap.WorldGet(pos.X, pos.Y) > 64)
                {
                    ResPlop(pos, 0, value);
                    IncRateOfGrowth(pos, 8);
                    return;
                }

                return;
            }

            if (pop < 40)
            {
                ResPlop(pos, (pop / 8) - 1, value);
                IncRateOfGrowth(pos, 8);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Compute land value at \a pos, taking pollution into account.
        /// </summary>
        /// <param name="pos"></param>
        /// <returns>Indication of land-value adjusted for pollution (\c 0 => low value, \c 3 => high value)</returns>
        public short GetLandPollutionValue(Position pos)
        {
            short landVal;

            landVal  = LandValueMap.WorldGet(pos.X, pos.Y);
            landVal -= PollutionDensityMap.WorldGet(pos.X, pos.Y);

            if (landVal < 30)
            {
                return(0);
            }

            if (landVal < 80)
            {
                return(1);
            }

            if (landVal < 150)
            {
                return(2);
            }

            return(3);
        }