Beispiel #1
0
        void PerformUndo()
        {
            if (ids.Length == 0)
            {
                return;
            }

            // can't use "using" as it creates a local var, and read lock reference may be changed by DrawOpPerformer class
            try {
                BlockDBReadLock = Level.BlockDB.Locker.AccquireRead();
                Level.BlockDB.FindChangesBy(ids, Start, End, out dims, UndoBlock);
            } finally {
                if (BlockDBReadLock != null)
                {
                    BlockDBReadLock.Dispose();
                }
            }

            if (oldest == null)
            {
                return;
            }
            foreach (var kvp in oldest)
            {
                int index = kvp.Key;

                int x = index % dims.X;
                int y = (index / dims.X) / dims.Z;
                int z = (index / dims.X) % dims.Z;

                output(Place((ushort)x, (ushort)y, (ushort)z, kvp.Value));
            }
        }
Beispiel #2
0
        void PerformHighlight()
        {
            if (ids.Length == 0)
            {
                return;
            }

            // can't use "using" as it creates a local var, and read lock reference may be changed by DrawOpPerformer class
            try {
                BlockDBReadLock = Level.BlockDB.Locker.AccquireRead();
                if (Level.BlockDB.FindChangesBy(ids, Start, DateTime.MaxValue, out dims, HighlightBlock))
                {
                    return;
                }
            } finally {
                if (BlockDBReadLock != null)
                {
                    BlockDBReadLock.Dispose();
                }
            }
        }
Beispiel #3
0
        void PerformUndo()
        {
            if (ids.Length > 0)
            {
                // can't use "using" as it creates a local var, and read lock reference may be changed by DrawOpPerformer class
                try {
                    BlockDBReadLock = Level.BlockDB.Locker.AccquireRead();
                    if (Level.BlockDB.FindChangesBy(ids, Start, End, out dims, UndoBlock))
                    {
                        return;
                    }
                } finally {
                    if (BlockDBReadLock != null)
                    {
                        BlockDBReadLock.Dispose();
                    }
                }
            }

            UndoFormatArgs args = new UndoFormatArgs(Level.name, Start, End, OldUndoBlock);

            PerformOldUndo(args);
        }
Beispiel #4
0
        public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output)
        {
            int[] ids = NameConverter.FindIds(Player.name);
            if (ids.Length == 0)
            {
                return;
            }

            this.output = output;
            // can't use "using" as it creates a local var, and read lock reference may be changed by DrawOpPerformer class
            try {
                BlockDBReadLock = Level.BlockDB.Locker.AccquireRead();
                if (Level.BlockDB.FindChangesBy(ids, Start, End, out dims, RedoBlock))
                {
                    return;
                }
            } finally {
                if (BlockDBReadLock != null)
                {
                    BlockDBReadLock.Dispose();
                }
            }
            this.output = null;
        }