Make Update a struct instead of a class.

This commit is contained in:
UnknownShadow200 2016-04-08 21:17:23 +10:00
parent a4d10ff256
commit cf8e492851
3 changed files with 9 additions and 9 deletions

View File

@ -180,9 +180,10 @@ namespace MCGalaxy {
for (int i = 0; i < ListUpdate.Count; i++) { for (int i = 0; i < ListUpdate.Count; i++) {
Update C = ListUpdate.Items[i]; Update C = ListUpdate.Items[i];
try { try {
PhysicsArgs info = C.data; byte type = C.data.Data;
if (DoPhysicsBlockchange(C.b, C.type, false, info, 0, true)) C.data.Data = 0;
bulkSender.Add(C.b, C.type, 0); if (DoPhysicsBlockchange(C.b, type, false, C.data, 0, true))
bulkSender.Add(C.b, type, 0);
} catch { } catch {
Server.s.Log("Phys update issue"); Server.s.Log("Phys update issue");
} }
@ -382,15 +383,14 @@ namespace MCGalaxy {
} }
} }
public class Update { public struct Update {
public int b; public int b;
public PhysicsArgs data; public PhysicsArgs data;
public byte type;
public Update(int b, byte type, PhysicsArgs data = default(PhysicsArgs)) { public Update(int b, byte type, PhysicsArgs data = default(PhysicsArgs)) {
this.b = b; this.b = b;
this.type = type;
this.data = data; this.data = data;
this.data.Data = type;
} }
} }
} }

View File

@ -48,7 +48,7 @@ namespace MCGalaxy.BlockPhysics {
Raw |= (uint)value << 14; } Raw |= (uint)value << 14; }
} }
public byte Time { public byte Data {
get { return (byte)(Raw >> 22); } get { return (byte)(Raw >> 22); }
set { Raw &= ~(0xFFu << 22); set { Raw &= ~(0xFFu << 22);
Raw |= (uint)value << 22; } Raw |= (uint)value << 22; }

View File

@ -137,11 +137,11 @@ namespace MCGalaxy {
break; break;
case "rplimit": case "rplimit":
try { Server.rpLimit = Convert.ToInt16(value); } try { Server.rpLimit = Convert.ToUInt16(value); }
catch { Server.s.Log("rpLimit invalid! setting to default."); } catch { Server.s.Log("rpLimit invalid! setting to default."); }
break; break;
case "rplimit-norm": case "rplimit-norm":
try { Server.rpNormLimit = Convert.ToInt16(value); } try { Server.rpNormLimit = Convert.ToUInt16(value); }
catch { Server.s.Log("rpLimit-norm invalid! setting to default."); } catch { Server.s.Log("rpLimit-norm invalid! setting to default."); }
break; break;