Bug fixes. Compare() added to compare two Dictionary<>
This commit is contained in:
parent
6c09c10bd9
commit
6742fb9050
@ -177,7 +177,7 @@ namespace CoopClient.Entities
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (Clothes != LastClothes)
|
||||
else if (!Clothes.Compare(LastClothes))
|
||||
{
|
||||
foreach (KeyValuePair<byte, short> cloth in Clothes)
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ namespace CoopClient.Entities
|
||||
}
|
||||
}
|
||||
|
||||
if (Character.Weapons.Current.Hash != (WeaponHash)CurrentWeaponHash || WeaponComponents != LastWeaponComponents)
|
||||
if (Character.Weapons.Current.Hash != (WeaponHash)CurrentWeaponHash || !WeaponComponents.Compare(LastWeaponComponents))
|
||||
{
|
||||
Character.Weapons.RemoveAll();
|
||||
|
||||
|
@ -194,7 +194,7 @@ namespace CoopClient.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VehicleMods != null && VehicleMods != LastVehicleMods)
|
||||
if (VehicleMods != null && !VehicleMods.Compare(LastVehicleMods))
|
||||
{
|
||||
Function.Call(Hash.SET_VEHICLE_MOD_KIT, MainVehicle, 0);
|
||||
|
||||
|
@ -75,6 +75,32 @@ namespace CoopClient
|
||||
return Comparer<T>.Default.Compare(item, start) >= 0 && Comparer<T>.Default.Compare(item, end) <= 0;
|
||||
}
|
||||
|
||||
public static bool Compare<T, Y>(this Dictionary<T, Y> item, Dictionary<T, Y> item2)
|
||||
{
|
||||
if (item == null || item2 == null || item.Count != item2.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<T, Y> pair in item)
|
||||
{
|
||||
if (item2.TryGetValue(pair.Key, out Y value))
|
||||
{
|
||||
if (!Equals(value, pair.Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Vector3 LinearVectorLerp(Vector3 start, Vector3 end, ulong currentTime, int duration)
|
||||
{
|
||||
return new Vector3()
|
||||
|
Loading…
x
Reference in New Issue
Block a user