refactor(net): #13 rename Shortcut → ShortcutEntry, expand doc citations

Code review nit-fix on top of d3b58c9 — addresses two issues from the
quality review of Task 1:

  I1 (Important): the record struct `Shortcut` was a homograph with the
  flag member `CharacterOptionDataFlag.Shortcut`. Both names live inside
  `PlayerDescriptionParser`'s scope. Rename to `ShortcutEntry` aligns
  with `InventoryEntry`/`EquippedEntry` and removes the trap before
  Task 3's walker references both names in the same method body.

  M2 (Minor): `EquippedEntry` had no holtburger source citation; added
  one referencing events.rs:180-190. Also expanded `InventoryEntry`'s
  comment with the strict reader's validation reference.

Plan doc updated in lockstep so Task 3+ implementers see the new name.
8/8 PlayerDescriptionParser tests still pass.
This commit is contained in:
Erik 2026-05-10 08:16:01 +02:00
parent d3b58c97e0
commit 65870349a8
2 changed files with 1239 additions and 8 deletions

File diff suppressed because it is too large Load diff

View file

@ -198,20 +198,30 @@ public static class PlayerDescriptionParser
} }
/// <summary>One shortcut bar entry. 16 bytes wire size. /// <summary>One shortcut bar entry. 16 bytes wire size.
/// holtburger shortcuts.rs:13-34.</summary> /// holtburger <c>shortcuts.rs:13-34</c>. Named <c>ShortcutEntry</c>
public readonly record struct Shortcut( /// (not <c>Shortcut</c>) to avoid a homograph with the
/// <see cref="CharacterOptionDataFlag.Shortcut"/> flag bit, which is
/// referenced from the same scope as instances of this type in the
/// trailer walker.</summary>
public readonly record struct ShortcutEntry(
uint Index, uint Index,
uint ObjectGuid, uint ObjectGuid,
ushort SpellId, ushort SpellId,
ushort Layer); ushort Layer);
/// <summary>One inventory entry — a guid plus a ContainerType discriminator /// <summary>One inventory entry — a guid plus a ContainerType
/// (0=NonContainer, 1=Container, 2=Foci).</summary> /// discriminator (0=NonContainer, 1=Container, 2=Foci). Holtburger
/// <c>events.rs:143-168</c> validates <c>ContainerType &lt;= 2</c>
/// in <c>unpack_inventory_and_equipped_strict</c>.</summary>
public readonly record struct InventoryEntry( public readonly record struct InventoryEntry(
uint Guid, uint Guid,
uint ContainerType); uint ContainerType);
/// <summary>One equipped object entry.</summary> /// <summary>One equipped object entry. Holtburger
/// <c>events.rs:180-190</c>: <c>(Guid guid, u32 loc, u32 prio)</c>.
/// <paramref name="EquipLocation"/> is an <c>EquipMask</c> bitfield;
/// <paramref name="Priority"/> orders overlapping equips in the
/// same slot.</summary>
public readonly record struct EquippedEntry( public readonly record struct EquippedEntry(
uint Guid, uint Guid,
uint EquipLocation, uint EquipLocation,
@ -231,7 +241,7 @@ public static class PlayerDescriptionParser
CharacterOptionDataFlag OptionFlags, CharacterOptionDataFlag OptionFlags,
uint Options1, uint Options1,
uint Options2, uint Options2,
IReadOnlyList<Shortcut> Shortcuts, IReadOnlyList<ShortcutEntry> Shortcuts,
IReadOnlyList<IReadOnlyList<uint>> HotbarSpells, IReadOnlyList<IReadOnlyList<uint>> HotbarSpells,
IReadOnlyList<(uint Id, uint Amount)> DesiredComps, IReadOnlyList<(uint Id, uint Amount)> DesiredComps,
uint SpellbookFilters, uint SpellbookFilters,
@ -312,7 +322,7 @@ public static class PlayerDescriptionParser
weenieType, propertyFlags, vectorFlags, hasHealth, weenieType, propertyFlags, vectorFlags, hasHealth,
bundle, positions, attributes, skills, spells, enchantments, bundle, positions, attributes, skills, spells, enchantments,
CharacterOptionDataFlag.None, 0u, 0u, CharacterOptionDataFlag.None, 0u, 0u,
System.Array.Empty<Shortcut>(), System.Array.Empty<ShortcutEntry>(),
System.Array.Empty<IReadOnlyList<uint>>(), System.Array.Empty<IReadOnlyList<uint>>(),
System.Array.Empty<(uint, uint)>(), System.Array.Empty<(uint, uint)>(),
0u, 0u,
@ -341,7 +351,7 @@ public static class PlayerDescriptionParser
bundle, positions, attributes, skills, spells, bundle, positions, attributes, skills, spells,
System.Array.Empty<EnchantmentEntry>(), System.Array.Empty<EnchantmentEntry>(),
CharacterOptionDataFlag.None, 0u, 0u, CharacterOptionDataFlag.None, 0u, 0u,
System.Array.Empty<Shortcut>(), System.Array.Empty<ShortcutEntry>(),
System.Array.Empty<IReadOnlyList<uint>>(), System.Array.Empty<IReadOnlyList<uint>>(),
System.Array.Empty<(uint, uint)>(), System.Array.Empty<(uint, uint)>(),
0u, 0u,