mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 20:54:16 +01:00
More readonlys.
This commit is contained in:
parent
0404ea6109
commit
c991eead89
2 changed files with 12 additions and 12 deletions
|
|
@ -9,7 +9,7 @@ public struct CharacterArmor : IEquatable<CharacterArmor>
|
||||||
public const int Size = 4;
|
public const int Size = 4;
|
||||||
|
|
||||||
[FieldOffset(0)]
|
[FieldOffset(0)]
|
||||||
public uint Value;
|
public readonly uint Value;
|
||||||
|
|
||||||
[FieldOffset(0)]
|
[FieldOffset(0)]
|
||||||
public SetId Set;
|
public SetId Set;
|
||||||
|
|
@ -37,18 +37,18 @@ public struct CharacterArmor : IEquatable<CharacterArmor>
|
||||||
public readonly CharacterWeapon ToWeapon(StainId stain)
|
public readonly CharacterWeapon ToWeapon(StainId stain)
|
||||||
=> new(Set, 0, Variant, stain);
|
=> new(Set, 0, Variant, stain);
|
||||||
|
|
||||||
public override string ToString()
|
public override readonly string ToString()
|
||||||
=> $"{Set},{Variant},{Stain}";
|
=> $"{Set},{Variant},{Stain}";
|
||||||
|
|
||||||
public static readonly CharacterArmor Empty;
|
public static readonly CharacterArmor Empty;
|
||||||
|
|
||||||
public bool Equals(CharacterArmor other)
|
public readonly bool Equals(CharacterArmor other)
|
||||||
=> Value == other.Value;
|
=> Value == other.Value;
|
||||||
|
|
||||||
public override bool Equals(object? obj)
|
public override readonly bool Equals(object? obj)
|
||||||
=> obj is CharacterArmor other && Equals(other);
|
=> obj is CharacterArmor other && Equals(other);
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override readonly int GetHashCode()
|
||||||
=> (int)Value;
|
=> (int)Value;
|
||||||
|
|
||||||
public static bool operator ==(CharacterArmor left, CharacterArmor right)
|
public static bool operator ==(CharacterArmor left, CharacterArmor right)
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ public struct CharacterWeapon : IEquatable<CharacterWeapon>
|
||||||
[FieldOffset(6)]
|
[FieldOffset(6)]
|
||||||
public StainId Stain;
|
public StainId Stain;
|
||||||
|
|
||||||
public ulong Value
|
public readonly ulong Value
|
||||||
=> (ulong)Set | ((ulong)Type << 16) | ((ulong)Variant << 32) | ((ulong)Stain << 48);
|
=> (ulong)Set | ((ulong)Type << 16) | ((ulong)Variant << 32) | ((ulong)Stain << 48);
|
||||||
|
|
||||||
public override string ToString()
|
public override readonly string ToString()
|
||||||
=> $"{Set},{Type},{Variant},{Stain}";
|
=> $"{Set},{Type},{Variant},{Stain}";
|
||||||
|
|
||||||
public CharacterWeapon(SetId set, WeaponType type, ushort variant, StainId stain)
|
public CharacterWeapon(SetId set, WeaponType type, ushort variant, StainId stain)
|
||||||
|
|
@ -48,13 +48,13 @@ public struct CharacterWeapon : IEquatable<CharacterWeapon>
|
||||||
|
|
||||||
public static readonly CharacterWeapon Empty = new(0, 0, 0, 0);
|
public static readonly CharacterWeapon Empty = new(0, 0, 0, 0);
|
||||||
|
|
||||||
public bool Equals(CharacterWeapon other)
|
public readonly bool Equals(CharacterWeapon other)
|
||||||
=> Value == other.Value;
|
=> Value == other.Value;
|
||||||
|
|
||||||
public override bool Equals(object? obj)
|
public override readonly bool Equals(object? obj)
|
||||||
=> obj is CharacterWeapon other && Equals(other);
|
=> obj is CharacterWeapon other && Equals(other);
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override readonly int GetHashCode()
|
||||||
=> Value.GetHashCode();
|
=> Value.GetHashCode();
|
||||||
|
|
||||||
public static bool operator ==(CharacterWeapon left, CharacterWeapon right)
|
public static bool operator ==(CharacterWeapon left, CharacterWeapon right)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue