Esempio n. 1
0
        CanonWorld( WorldDatabase wdb, bool runtime, bool readOnly )
        {
            Log.Info( "Starting World" );

            _wdb = wdb;
            _readOnly = readOnly;

            // Load up managers for all the mobs in the world.
            int highest = -1;
            foreach( int mobId in _wdb.mobList )
            {
            _objects[mobId] = _wdb.loadMob( mobId, this );
            highest = Math.Max( highest, mobId );
            }

            // And load up the previous nextId.
            int? nid = _wdb.getConfigInt( World.ConfigNextId );
            if( !nid.HasValue )
            {
            // Just divine it from what we have. (This might be an import.)
            _nextId = highest + 1;
            }
            else
            _nextId = nid.Value;

            if( runtime )
            {
            if( !readOnly )
            {
                _saver = new SaveRunner( this, _wdb );
                _saver.start();
            }

            _pulse = new PulseRunner( World.Wrap( new ShadowWorld( this ) ) );
            _pulse.start( wdb );
            }
        }