Exemplo n.º 1
0
        public bool RemoveScene(Scene scene)
        {
            //  Remove the given scene from the city map
            if (scene.Equals(null))
                return (false);

            //  Firstly check to see if the region is part of one of the central regions.
            for (int c = 0; c < centralRegions.Count(); c++)
            {
                Scene s = centralRegions[c];
                if (s.Equals(scene))
                {
                    centralRegions.Remove(s);
                    break;
                }
            }

            //  Now scan the entire map and remove it.
            for (int rx = 0; rx < cityRegions.GetUpperBound(0); rx++)
            {
                for (int ry = 0; rx < cityRegions.GetUpperBound(1); ry++)
                {
                    Scene r = cityRegions[rx, ry];
                    if (r.Equals(scene))
                    {
                        cityRegions[rx, ry] = null;
                        return (true);
                    }
                }
            }

            return (false);
        }
Exemplo n.º 2
0
        //  SCENE CONTROL.
        public bool AddScene(Scene scene, bool central)
        {
            if (scene.Equals(null))
                return (false);

            // do it the hard way and find the first available space.
            if (cityRegions.Equals(null))
                return (false);
            if (cityRegions.GetUpperBound(0) == 0 || cityRegions.GetUpperBound(1) == 0)
            {
                CityModule.m_log.Info("[CITY BUILDER]: No space in city regions!");
                return (false);
            }
            for (int rx = 0; rx < cityRegions.GetUpperBound(0); rx++)
            {
                for (int ry = 0; ry < cityRegions.GetUpperBound(1); ry++)
                {
                    if (cityRegions[rx, ry].Equals(scene))
                        return (true);
                    if (cityRegions[rx, ry].Equals(null))
                    {
                        cityRegions[rx, ry] = scene;
                        if (central)
                            centralRegions.Add(scene);
                        CityModule.m_log.InfoFormat("[CITY BUILDER]: Added new region {0} @ {1},{2}",
                            scene.RegionInfo.RegionName, rx, ry);
                        return (true);
                    }
                }
            }

            return (false);
        }