From 1cffcda774662af121b9948419a53497c88d0e40 Mon Sep 17 00:00:00 2001 From: excitedneon Date: Mon, 15 May 2017 00:17:42 +0300 Subject: [PATCH] Fix Inventory hash function for now --- Assets/Scripts/Entities/SyncBases/Inventory.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Entities/SyncBases/Inventory.cs b/Assets/Scripts/Entities/SyncBases/Inventory.cs index 6b1830a..38f61bc 100644 --- a/Assets/Scripts/Entities/SyncBases/Inventory.cs +++ b/Assets/Scripts/Entities/SyncBases/Inventory.cs @@ -37,18 +37,19 @@ namespace Cyber.Entities.SyncBases { } /// - /// Generates a checksum for the inventory + /// Generates a checksum for the inventory. /// /// A checksum of the IDs of the items public override int GenerateChecksum() { var Items = Drive.GetItems().ToArray(); int Checksum = 0; for (int i = 0; i < Items.Length; i++) { - Checksum ^= Items[i].ID; + // Times with primes and sprinkle some i to spice up the stew + Checksum += (Items[i].ID + 1) * 509 * (i + 1) * 53; } var EquippedItems = Equipped.GetEquippedList().ToArray(); for (int i = 0; i < EquippedItems.Length; i++) { - Checksum ^= EquippedItems[i].ID; + Checksum += (EquippedItems[i].ID + 1) * 859 * (i + 1) * 97; } return Checksum; }