refactor(B.4b): unify _selectedTargetGuid -> _selectedGuid

Retail's selection model is a single "current target" used by combat,
interaction, NPC dialog, and HUD alike - not two parallel selections.
Renames the existing combat-only field on GameWindow so the upcoming
B.4b click handler and the existing Q-cycle SelectClosestCombatTarget
share the same selection state.

Mechanical rename, no behavior change. Build + tests green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-13 17:55:24 +02:00
parent 5821bdc9ea
commit 7b4aff21b6

View file

@ -783,7 +783,7 @@ public sealed class GameWindow : IDisposable
/// fields when a 0xF625 ObjDescEvent arrives carrying only updated visuals.
/// </summary>
private readonly Dictionary<uint, AcDream.Core.Net.WorldSession.EntitySpawn> _lastSpawnByGuid = new();
private uint? _selectedTargetGuid;
private uint? _selectedGuid;
private readonly record struct LiveEntityInfo(
string? Name,
AcDream.Core.Items.ItemType ItemType);
@ -2998,8 +2998,8 @@ public sealed class GameWindow : IDisposable
_liveEntityInfoByGuid.Remove(serverGuid);
_entitiesByServerGuid.Remove(serverGuid);
_lastSpawnByGuid.Remove(serverGuid);
if (_selectedTargetGuid == serverGuid)
_selectedTargetGuid = null;
if (_selectedGuid == serverGuid)
_selectedGuid = null;
if (logDelete)
_lightingSink?.UnregisterOwner(existingEntity.Id);
@ -8697,7 +8697,7 @@ public sealed class GameWindow : IDisposable
private uint? GetSelectedOrClosestCombatTarget()
{
if (_selectedTargetGuid is { } selected && IsLiveCreatureTarget(selected))
if (_selectedGuid is { } selected && IsLiveCreatureTarget(selected))
return selected;
return SelectClosestCombatTarget(showToast: false);
@ -8725,7 +8725,7 @@ public sealed class GameWindow : IDisposable
bestGuid = guid;
}
_selectedTargetGuid = bestGuid;
_selectedGuid = bestGuid;
if (bestGuid is { } selected)
{
string label = DescribeLiveEntity(selected);