Weaver: update comments

This commit is contained in:
vis2k 2023-04-08 13:35:28 +08:00
parent 88170ed141
commit 20b7e5326e

View File

@ -10,10 +10,11 @@ public static class CommandProcessor
// generates code like: // generates code like:
public void CmdThrust(float thrusting, int spin) public void CmdThrust(float thrusting, int spin)
{ {
NetworkWriter networkWriter = new NetworkWriter(); NetworkWriterPooled writer = NetworkWriterPool.Get();
networkWriter.Write(thrusting); writer.Write(thrusting);
networkWriter.WritePackedUInt32((uint)spin); writer.WritePackedUInt32((uint)spin);
base.SendCommandInternal(cmdName, networkWriter, channel); base.SendCommandInternal(cmdName, cmdHash, writer, channel);
NetworkWriterPool.Return(writer);
} }
public void CallCmdThrust(float thrusting, int spin) public void CallCmdThrust(float thrusting, int spin)
@ -54,7 +55,7 @@ public static MethodDefinition ProcessCommandCall(WeaverTypes weaverTypes, Write
worker.Emit(OpCodes.Ldstr, md.FullName); worker.Emit(OpCodes.Ldstr, md.FullName);
// pass the function hash so we don't have to compute it at runtime // pass the function hash so we don't have to compute it at runtime
// otherwise each GetStableHash call requires O(N) complexity. // otherwise each GetStableHash call requires O(N) complexity.
// noticeable for long function names: // noticeable for long function names:
// https://github.com/MirrorNetworking/Mirror/issues/3375 // https://github.com/MirrorNetworking/Mirror/issues/3375
worker.Emit(OpCodes.Ldc_I4, md.FullName.GetStableHashCode()); worker.Emit(OpCodes.Ldc_I4, md.FullName.GetStableHashCode());
// writer // writer