Exemple #1
0
 public override void RemoveFromRoom(Level level, Room room)
 {
     base.RemoveFromRoom(level, room);
     try
     {
         level.GlobalScriptingIdsTable.Update(this, ScriptId, null);
     }
     catch (Exception)
     {
         base.AddToRoom(level, room);
         throw;
     }
     _scriptTable = null;
 }
Exemple #2
0
        public void MergeFrom(ScriptIdTable <T> otherTable, Action <T> resetScriptId)
        {
            if (Length != otherTable.Length)
            {
                throw new ArgumentException();
            }

            for (int i = 0; i < otherTable.Length; ++i)
            {
                if (otherTable._table[i] != null)
                {
                    if (_table[i] == null)
                    {
                        _table[i] = otherTable._table[i];
                    }
                    else
                    {
                        resetScriptId(otherTable._table[i]);
                    }
                }
            }
            otherTable._table = null; // Prevent accidental accesses to the old table.
        }
Exemple #3
0
 public void AllocateNewScriptId()
 {
     _scriptTable = Room.Level.GlobalScriptingIdsTable; // HACK: Prevent exception on TRTombalized room copy-paste events
     _scriptId    = _scriptTable?.UpdateWithNewId(this, _scriptId);
 }