mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
fix: move InvalidGameObjectId check into SearchById
This commit is contained in:
parent
ed1a6c7810
commit
8feb0a9c53
2 changed files with 4 additions and 2 deletions
|
|
@ -7,7 +7,6 @@ using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.IoC.Internal;
|
using Dalamud.IoC.Internal;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
namespace Dalamud.Game.ClientState.Objects
|
namespace Dalamud.Game.ClientState.Objects
|
||||||
|
|
@ -65,6 +64,9 @@ namespace Dalamud.Game.ClientState.Objects
|
||||||
/// <returns>A game object or null.</returns>
|
/// <returns>A game object or null.</returns>
|
||||||
public GameObject? SearchById(uint objectId)
|
public GameObject? SearchById(uint objectId)
|
||||||
{
|
{
|
||||||
|
if (objectId is GameObject.InvalidGameObjectId or 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
foreach (var obj in this)
|
foreach (var obj in this)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
||||||
/// This iterates the actor table, it should be used with care.
|
/// This iterates the actor table, it should be used with care.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
// TODO: Fix for non-networked GameObjects
|
// TODO: Fix for non-networked GameObjects
|
||||||
public virtual GameObject? TargetObject => this.TargetObjectId != InvalidGameObjectId ? Service<ObjectTable>.Get().SearchById(this.TargetObjectId) : null;
|
public virtual GameObject? TargetObject => Service<ObjectTable>.Get().SearchById(this.TargetObjectId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the underlying structure.
|
/// Gets the underlying structure.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue