From 7b4aff21b68e5d14272e6eab92d01ee835507c7d Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 13 May 2026 17:55:24 +0200 Subject: [PATCH] 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) --- src/AcDream.App/Rendering/GameWindow.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs index 73127de..6d2da3f 100644 --- a/src/AcDream.App/Rendering/GameWindow.cs +++ b/src/AcDream.App/Rendering/GameWindow.cs @@ -783,7 +783,7 @@ public sealed class GameWindow : IDisposable /// fields when a 0xF625 ObjDescEvent arrives carrying only updated visuals. /// private readonly Dictionary _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);