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:
parent
5821bdc9ea
commit
7b4aff21b6
1 changed files with 5 additions and 5 deletions
|
|
@ -783,7 +783,7 @@ public sealed class GameWindow : IDisposable
|
||||||
/// fields when a 0xF625 ObjDescEvent arrives carrying only updated visuals.
|
/// fields when a 0xF625 ObjDescEvent arrives carrying only updated visuals.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<uint, AcDream.Core.Net.WorldSession.EntitySpawn> _lastSpawnByGuid = new();
|
private readonly Dictionary<uint, AcDream.Core.Net.WorldSession.EntitySpawn> _lastSpawnByGuid = new();
|
||||||
private uint? _selectedTargetGuid;
|
private uint? _selectedGuid;
|
||||||
private readonly record struct LiveEntityInfo(
|
private readonly record struct LiveEntityInfo(
|
||||||
string? Name,
|
string? Name,
|
||||||
AcDream.Core.Items.ItemType ItemType);
|
AcDream.Core.Items.ItemType ItemType);
|
||||||
|
|
@ -2998,8 +2998,8 @@ public sealed class GameWindow : IDisposable
|
||||||
_liveEntityInfoByGuid.Remove(serverGuid);
|
_liveEntityInfoByGuid.Remove(serverGuid);
|
||||||
_entitiesByServerGuid.Remove(serverGuid);
|
_entitiesByServerGuid.Remove(serverGuid);
|
||||||
_lastSpawnByGuid.Remove(serverGuid);
|
_lastSpawnByGuid.Remove(serverGuid);
|
||||||
if (_selectedTargetGuid == serverGuid)
|
if (_selectedGuid == serverGuid)
|
||||||
_selectedTargetGuid = null;
|
_selectedGuid = null;
|
||||||
|
|
||||||
if (logDelete)
|
if (logDelete)
|
||||||
_lightingSink?.UnregisterOwner(existingEntity.Id);
|
_lightingSink?.UnregisterOwner(existingEntity.Id);
|
||||||
|
|
@ -8697,7 +8697,7 @@ public sealed class GameWindow : IDisposable
|
||||||
|
|
||||||
private uint? GetSelectedOrClosestCombatTarget()
|
private uint? GetSelectedOrClosestCombatTarget()
|
||||||
{
|
{
|
||||||
if (_selectedTargetGuid is { } selected && IsLiveCreatureTarget(selected))
|
if (_selectedGuid is { } selected && IsLiveCreatureTarget(selected))
|
||||||
return selected;
|
return selected;
|
||||||
|
|
||||||
return SelectClosestCombatTarget(showToast: false);
|
return SelectClosestCombatTarget(showToast: false);
|
||||||
|
|
@ -8725,7 +8725,7 @@ public sealed class GameWindow : IDisposable
|
||||||
bestGuid = guid;
|
bestGuid = guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
_selectedTargetGuid = bestGuid;
|
_selectedGuid = bestGuid;
|
||||||
if (bestGuid is { } selected)
|
if (bestGuid is { } selected)
|
||||||
{
|
{
|
||||||
string label = DescribeLiveEntity(selected);
|
string label = DescribeLiveEntity(selected);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue