static void AppendDrawOp(Player p, DrawOp op, Brush brush, Vec3S32[] marks, long affected) { if (p == null) { BufferedBlockSender buffer = new BufferedBlockSender(op.Level); op.Perform(marks, brush, b => ConsoleOutputBlock(b, op.Level, buffer)); buffer.Send(true); return; } PendingDrawOp item = new PendingDrawOp(); item.Op = op; item.Brush = brush; item.Marks = marks; lock (p.pendingDrawOpsLock) { p.PendingDrawOps.Add(item); // Another thread is already processing draw ops. if (p.PendingDrawOps.Count > 1) { return; } } ProcessDrawOps(p); }
static bool DoDrawOp(PendingDrawOp item, Player p) { Level lvl = item.Op.Level; DrawOpOutputter outputter = new DrawOpOutputter(item.Op); if (item.Op.AffectedByTransform) { p.Transform.Perform(item.Marks, p, lvl, item.Op, item.Brush, outputter.Output); } else { item.Op.Perform(item.Marks, item.Brush, outputter.Output); } return(item.Op.TotalModified >= outputter.reloadThreshold); }
static void DoDrawOp(PendingDrawOp item, Player p) { Level lvl = item.Op.Level; Action <DrawOpBlock, DrawOp> output = OutputBlock; if (item.Op.AffectedByTransform) { p.Transform.Perform(item.Marks, p, lvl, item.Op, item.Brush, b => output(b, item.Op)); } else { item.Op.Perform(item.Marks, item.Brush, b => output(b, item.Op)); } }
static void DoQueuedDrawOp(Player p, DrawOp op, Brush brush, Vec3S32[] marks) { PendingDrawOp item = new PendingDrawOp(); item.Op = op; item.Brush = brush; item.Marks = marks; lock (p.pendingDrawOpsLock) { p.PendingDrawOps.Add(item); // Another thread is already processing draw ops. if (p.PendingDrawOps.Count > 1) { return; } } ProcessDrawOps(p); }
static void AppendDrawOp(Player p, DrawOp op, Brush brush, Vec3U16[] marks, long affected) { PendingDrawOp pending = new PendingDrawOp(); pending.Op = op; pending.Brush = brush; pending.Marks = marks; pending.Affected = affected; pending.Level = p.level; lock (p.pendingDrawOpsLock) { p.PendingDrawOps.Add(pending); // Another thread is already processing draw ops. if (p.PendingDrawOps.Count > 1) { return; } } ProcessDrawOps(p); }