Weaver ProcessSyncVars: remove redundant numSyncVars field, use syncVars.Count instead

This commit is contained in:
vis2k 2020-08-21 17:33:11 +02:00
parent 54c32227bd
commit fe32557a38

View File

@ -306,8 +306,6 @@ public static void ProcessSyncVar(TypeDefinition td, FieldDefinition fd, Diction
public static void ProcessSyncVars(TypeDefinition td, List<FieldDefinition> syncVars, List<FieldDefinition> syncObjects, Dictionary<FieldDefinition, FieldDefinition> syncVarNetIds)
{
int numSyncVars = 0;
// the mapping of dirtybits to sync-vars is implicit in the order of the fields here. this order is recorded in m_replacementProperties.
// start assigning syncvars at the place the base class stopped, if any
int dirtyBitCounter = Weaver.GetSyncVarStart(td.BaseType.FullName);
@ -341,7 +339,6 @@ public static void ProcessSyncVars(TypeDefinition td, List<FieldDefinition> sync
ProcessSyncVar(td, fd, syncVarNetIds, 1L << dirtyBitCounter);
dirtyBitCounter += 1;
numSyncVars += 1;
if (dirtyBitCounter == SyncVarLimit)
{
@ -374,8 +371,7 @@ public static void ProcessSyncVars(TypeDefinition td, List<FieldDefinition> sync
{
td.Fields.Add(fd);
}
Weaver.SetNumSyncVars(td.FullName, numSyncVars);
Weaver.SetNumSyncVars(td.FullName, syncVars.Count);
}
public static void WriteCallHookMethodUsingArgument(ILProcessor worker, MethodDefinition hookMethod, VariableDefinition oldValue)