Skip to content

Commit 916f467

Browse files
committed
Fixed parameter read issue
1 parent 5b2c77a commit 916f467

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

MLAPI/Data/FieldType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ internal static object[] ReadObjects(BitReader reader, byte paramCount)
378378
object[] returnVal = new object[paramCount];
379379
for (int i = 0; i < paramCount; i++)
380380
{
381-
//FieldType fieldType = (FieldType)reader.ReadBits(5);
382-
FieldType fieldType = (FieldType)reader.ReadByte();
381+
FieldType fieldType = (FieldType)reader.ReadBits(5);
382+
383383
switch (fieldType)
384384
{
385385
case FieldType.Bool:

MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -174,28 +174,6 @@ protected void InvokeCommand(string methodName, params object[] methodParams)
174174
return;
175175
}
176176

177-
/* This would not allow for cross projects.
178-
MethodInfo method = null;
179-
if (cachedMethods.ContainsKey(methodName))
180-
method = cachedMethods[methodName];
181-
else
182-
method = GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.NonPublic);
183-
184-
if (method.GetParameters().Length != methodParams.Length)
185-
{
186-
Debug.LogWarning("MLAPI: The parameter amounts are not matching.");
187-
return;
188-
}
189-
190-
for (int i = 0; i < method.GetParameters().Length; i++)
191-
{
192-
if (method.GetParameters()[i].GetType() != methodParams[i].GetType())
193-
{
194-
Debug.LogWarning("MLAPI: The " + (i + 1) + "th parameter has the wrong type");
195-
return;
196-
}
197-
}
198-
*/
199177
ulong hash = Data.Cache.GetMessageAttributeHash(methodName);
200178
using (BitWriter writer = new BitWriter())
201179
{
@@ -210,7 +188,6 @@ protected void InvokeCommand(string methodName, params object[] methodParams)
210188
FieldTypeHelper.WriteFieldType(writer, methodParams[i], fieldType);
211189
}
212190

213-
//SendToServerTarget("MLAPI_COMMAND", "MLAPI_INTERNAL", writer.Finalize());
214191
InternalMessageHandler.Send(NetId.ServerNetId.GetClientId(), "MLAPI_COMMAND", "MLAPI_INTERNAL", writer.Finalize());
215192
}
216193
}

0 commit comments

Comments
 (0)