Minor performance optimisations.

This commit is contained in:
UnknownShadow200 2016-08-05 18:52:44 +10:00
parent ce33c52d48
commit 94e231ce49
3 changed files with 10 additions and 9 deletions

View File

@ -96,7 +96,7 @@ namespace MCGalaxy.Drawing.Ops {
Coords.X = x; Coords.Y = y; Coords.Z = z;
Coords.Block = brush.NextBlock(this);
if (Coords.Block != Block.Zero)
if (Coords.Block == Block.custom_block)
Coords.ExtBlock = brush.NextExtBlock(this);
return Coords;
}

View File

@ -244,10 +244,11 @@ namespace MCGalaxy {
// therefore raw = 64log2(speed) + 128
byte rawSpeed = (byte)(64 * Math.Log(def.Speed, 2) + 128);
buffer[index++] = def.BlockID;
Encoding.ASCII.GetBytes(def.Name.PadRight(64), 0, 64, buffer, index);
index += 64;
NetUtils.WriteAscii(def.Name, buffer, index);
index += 64;
buffer[index++] = def.CollideType;
buffer[index++] = rawSpeed;
buffer[index++] = def.TopTex;
if (uniqueSideTexs) {
buffer[index++] = def.LeftTex;

View File

@ -178,12 +178,12 @@ namespace MCGalaxy {
if (p.Rank < LevelPermission.Admin) {
bool foundDel = FindZones(p, x, y, z, ref inZone, ref AllowBuild, ref Owners);
if (!AllowBuild) {
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
if (p.ZoneSpam <= DateTime.UtcNow) {
if (Owners != "")
Player.Message(p, "This zone belongs to &b" + Owners.Remove(0, 2) + ".");
else
Player.Message(p, "This zone belongs to no one.");
p.ZoneSpam = DateTime.UtcNow;
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
}
return false;
}
@ -222,17 +222,17 @@ namespace MCGalaxy {
bool CheckRank(Player p, bool AllowBuild, bool inZone) {
if (p.Rank < permissionbuild && (!inZone || !AllowBuild)) {
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
if (p.ZoneSpam <= DateTime.UtcNow) {
Player.Message(p, "Must be at least " + PermissionToName(permissionbuild) + " to build here");
p.ZoneSpam = DateTime.UtcNow;
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
}
return false;
}
if (p.Rank > perbuildmax && (!inZone || !AllowBuild) && !p.group.CanExecute("perbuildmax")) {
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
if (p.ZoneSpam <= DateTime.UtcNow) {
Player.Message(p, "Your rank must be " + perbuildmax + " or lower to build here!");
p.ZoneSpam = DateTime.UtcNow;
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
}
return false;
}