diff --git a/Penumbra/Collections/LinkedModCollection.cs b/Penumbra/Collections/LinkedModCollection.cs index 80cd74c7..93575544 100644 --- a/Penumbra/Collections/LinkedModCollection.cs +++ b/Penumbra/Collections/LinkedModCollection.cs @@ -1,4 +1,4 @@ -using System; +using System; using FFXIVClientStructs.FFXIV.Client.Game.Object; namespace Penumbra.Collections; @@ -6,11 +6,7 @@ namespace Penumbra.Collections; public class LinkedModCollection { private IntPtr? _associatedGameObject; - public IntPtr AssociatedGameObject - { - get => _associatedGameObject ?? IntPtr.Zero; - set => _associatedGameObject = value; - } + public IntPtr AssociatedGameObject = IntPtr.Zero; public ModCollection ModCollection; public LinkedModCollection(ModCollection modCollection) @@ -18,15 +14,13 @@ public class LinkedModCollection ModCollection = modCollection; } - public LinkedModCollection(IntPtr? gameObject, ModCollection collection) + public LinkedModCollection(IntPtr gameObject, ModCollection collection) { - AssociatedGameObject = gameObject ?? IntPtr.Zero; + AssociatedGameObject = gameObject; ModCollection = collection; } - public unsafe LinkedModCollection(GameObject* gameObject, ModCollection collection) + public unsafe LinkedModCollection(GameObject* gameObject, ModCollection collection) : this((IntPtr)gameObject, collection) { - AssociatedGameObject = ( IntPtr )gameObject; - ModCollection = collection; } } diff --git a/Penumbra/Interop/Resolver/PathResolver.PathState.cs b/Penumbra/Interop/Resolver/PathResolver.PathState.cs index 6ee4aefc..6a1d745a 100644 --- a/Penumbra/Interop/Resolver/PathResolver.PathState.cs +++ b/Penumbra/Interop/Resolver/PathResolver.PathState.cs @@ -81,7 +81,7 @@ public unsafe partial class PathResolver // Just add or remove the resolved path. [MethodImpl( MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization )] - public IntPtr ResolvePath( IntPtr? gameObject, ModCollection collection, IntPtr path ) + public IntPtr ResolvePath( IntPtr gameObject, ModCollection collection, IntPtr path ) { if( path == IntPtr.Zero ) { @@ -94,7 +94,7 @@ public unsafe partial class PathResolver } // Special handling for paths so that we do not store non-owned temporary strings in the dictionary. - public void SetCollection( IntPtr? gameObject, Utf8String path, ModCollection collection ) + public void SetCollection( IntPtr gameObject, Utf8String path, ModCollection collection ) { if( _pathCollections.ContainsKey( path ) || path.IsOwned ) { diff --git a/Penumbra/Interop/Resolver/PathResolver.ResolverHooks.cs b/Penumbra/Interop/Resolver/PathResolver.ResolverHooks.cs index 2b0bd8aa..adc3dfeb 100644 --- a/Penumbra/Interop/Resolver/PathResolver.ResolverHooks.cs +++ b/Penumbra/Interop/Resolver/PathResolver.ResolverHooks.cs @@ -227,7 +227,7 @@ public partial class PathResolver // Implementation [MethodImpl( MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization )] private IntPtr ResolvePath( IntPtr drawObject, IntPtr path ) - => _parent._paths.ResolvePath( (IntPtr?)FindParent( drawObject, out _), FindParent( drawObject, out var collection ) == null + => _parent._paths.ResolvePath( (IntPtr?)FindParent( drawObject, out _) ?? IntPtr.Zero, FindParent( drawObject, out var collection ) == null ? Penumbra.CollectionManager.Default : collection.ModCollection, path ); @@ -251,7 +251,7 @@ public partial class PathResolver } parent = FindParent( parentObject, out collection ); - return _parent._paths.ResolvePath( (IntPtr?)parent, parent == null + return _parent._paths.ResolvePath( (IntPtr?)parent ?? IntPtr.Zero, parent == null ? Penumbra.CollectionManager.Default : collection.ModCollection, path ); }