Fix scale transform.

This commit is contained in:
UnknownShadow200 2016-08-26 10:28:33 +10:00
parent c0d3114d8c
commit 5c0c177c7e
4 changed files with 7 additions and 10 deletions

View File

@ -55,7 +55,7 @@ namespace MCGalaxy.Drawing.Ops {
long affected = checkLimit ? 0L : op.GetBlocksAffected(op.Level, marks);
if (p != null) p.Transform.GetBlocksAffected(ref affected);
if (checkLimit && !op.CanDraw(marks, p, out affected))
if (checkLimit && !op.CanDraw(marks, p, affected))
return false;
if (brush != null && affected != -1) {
const string format = "{0}({1}): affecting up to {2} blocks";
@ -137,7 +137,6 @@ namespace MCGalaxy.Drawing.Ops {
static void DoDrawOp(PendingDrawOp item, Player p) {
Level lvl = item.Level;
//p.Transform = new Transforms.ScaleTransform() { XMul = 2, XDiv = 1, YMul = 2, YDiv = 1, ZMul = 2, ZDiv = 1 };
IEnumerable<DrawOpBlock> iterator =
p.Transform.Perform(item.Marks, p, lvl, item.Op, item.Brush);

View File

@ -69,8 +69,7 @@ namespace MCGalaxy.Drawing.Ops {
public abstract IEnumerable<DrawOpBlock> Perform(Vec3S32[] marks, Player p, Level lvl, Brush brush);
public virtual bool CanDraw(Vec3S32[] marks, Player p, out long affected) {
affected = GetBlocksAffected(Level, marks);
public virtual bool CanDraw(Vec3S32[] marks, Player p, long affected) {
if (p != null && affected > p.group.maxBlocks) {
Player.Message(p, "You tried to draw " + affected + " blocks.");
Player.Message(p, "You cannot draw more than " + p.group.maxBlocks + ".");

View File

@ -31,8 +31,7 @@ namespace MCGalaxy.Drawing.Ops {
return Positions.Count;
}
public override bool CanDraw(Vec3S32[] marks, Player p, out long affected) {
affected = GetBlocksAffected(p.level, marks);
public override bool CanDraw(Vec3S32[] marks, Player p, long affected) {
if (affected > p.group.maxBlocks) {
Player.Message(p, "You rank can only fill up to {0} blocks. " +
"This fill would affect more than {0} blocks.", p.group.maxBlocks);

View File

@ -52,10 +52,10 @@ namespace MCGalaxy.Drawing.Transforms {
int dx = b.X - P.X, dy = b.Y - P.Y, dz = b.Z - P.Z;
DrawOpBlock cur = b;
for (int y = b.Y + dy * YMul / YDiv; y < b.Y + (dy + 1) * YMul / YDiv; y++)
for (int z = b.Z + dz * ZMul / ZDiv; b.Z + z < (dz + 1) * ZMul / ZDiv; z++)
for (int x = b.X + dx * XMul / XDiv; b.X + x < (dx + 1) * XMul / XDiv; x++)
{
for (int y = P.Y + dy * YMul / YDiv; y < P.Y + (dy + 1) * YMul / YDiv; y++)
for (int z = P.Z + dz * ZMul / ZDiv; z < P.Z + (dz + 1) * ZMul / ZDiv; z++)
for (int x = P.X + dx * XMul / XDiv; x < P.X + (dx + 1) * XMul / XDiv; x++)
{
if (!lvl.IsValidPos(x, y, z)) continue;
cur.X = (ushort)x; cur.Y = (ushort)y; cur.Z = (ushort)z;
yield return cur;