actually fix not sending data properly

This commit is contained in:
Stanley Dimant
2022-07-26 18:45:46 +02:00
parent 6b9d79b88d
commit 975a813b7f
4 changed files with 28 additions and 12 deletions

View File

@@ -77,6 +77,7 @@ namespace MareSynchronos.Models
private unsafe bool CompareAndUpdateByteData(byte* equipSlotData, byte* customizeData)
{
bool hasChanges = false;
DoNotSendUpdate = false;
for (int i = 0; i < EquipSlotData.Length; i++)
{
var data = Marshal.ReadByte((IntPtr)equipSlotData, i);
@@ -103,14 +104,22 @@ namespace MareSynchronos.Models
var newWeaponOrVisorState = Marshal.ReadByte((IntPtr)customizeData + 31, 0);
if (newHatState != HatState)
{
if (HatState != null && !hasChanges) DoNotSendUpdate = true;
if (HatState != null && !hasChanges)
{
Logger.Verbose("Not Sending Update, only Hat changed");
DoNotSendUpdate = true;
}
HatState = newHatState;
hasChanges = true;
}
if (newWeaponOrVisorState != VisorWeaponState)
{
if (VisorWeaponState != null && !hasChanges) DoNotSendUpdate = true;
if (VisorWeaponState != null && !hasChanges)
{
Logger.Verbose("Not Sending Update, only Visor/Weapon changed");
DoNotSendUpdate = true;
}
VisorWeaponState = newWeaponOrVisorState;
hasChanges = true;
}