Skip to content

Commit

Permalink
feat: refactor deserialization to use uint instead of ulong for lengt…
Browse files Browse the repository at this point in the history
…h; improve data handling in multiple components
  • Loading branch information
MasterLaplace committed Nov 28, 2024
1 parent 7378944 commit c28fee1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Libraries/Flakkari4Unity/Source/Components/Common/Child.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class Child : MonoBehaviour

internal void Deserialize(byte[] data, ref int i)
{
ulong length = BitConverter.ToUInt64(data, i);
i += sizeof(ulong);
uint length = BitConverter.ToUInt32(data, i);
i += sizeof(uint);
_name = System.Text.Encoding.UTF8.GetString(data, i, (int)length);
i += (int)length;
}
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Flakkari4Unity/Source/Components/Common/Evolve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class Evolve : MonoBehaviour

internal void Deserialize(byte[] data, ref int i)
{
ulong length = BitConverter.ToUInt64(data, i);
i += sizeof(ulong);
uint length = BitConverter.ToUInt32(data, i);
i += sizeof(uint);
_name = System.Text.Encoding.UTF8.GetString(data, i, (int)length);
i += (int)length;
}
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Flakkari4Unity/Source/Components/Common/Level.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ internal void Deserialize(byte[] data, ref int i)
{
level = BitConverter.ToUInt64(data, i);
i += sizeof(ulong);
ulong length = BitConverter.ToUInt64(data, i);
i += sizeof(ulong);
uint length = BitConverter.ToUInt32(data, i);
i += sizeof(uint);
currentWeapon = System.Text.Encoding.UTF8.GetString(data, i, (int)length);
i += (int)length;
currentExp = BitConverter.ToUInt64(data, i);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Flakkari4Unity/Source/Components/Common/Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class Tag : MonoBehaviour

internal void Deserialize(byte[] data, ref int i)
{
ulong length = BitConverter.ToUInt64(data, i);
i += sizeof(ulong);
uint length = BitConverter.ToUInt32(data, i);
i += sizeof(uint);
name = System.Text.Encoding.UTF8.GetString(data, i, (int)length);
i += (int)length;
}
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Flakkari4Unity/Source/Components/Common/Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public class Template : MonoBehaviour
{
internal void Deserialize(byte[] data, ref int i)
{
ulong length = BitConverter.ToUInt64(data, i);
i += sizeof(ulong);
uint length = BitConverter.ToUInt32(data, i);
i += sizeof(uint);
name = System.Text.Encoding.UTF8.GetString(data, i, (int)length);
i += (int)length;
}
Expand Down

0 comments on commit c28fee1

Please sign in to comment.