Skip to content

Commit 2ad2945

Browse files
committed
refactor(shared): cleanup nativepointer access
1 parent a498386 commit 2ad2945

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+20
-67
lines changed

api/AltV.Net.Async/AsyncEntityPool.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ public TEntity Create(ICore core, IntPtr entityPointer)
7676

7777
public void Add(TEntity entity)
7878
{
79-
entities[entity.NativePointer] = entity;
79+
entities[entity.EntityNativePointer] = entity;
8080
if (forceAsync && entity is not AsyncEntity)
8181
throw new Exception("Tried to add sync entity to async pool. Probably you used \"new Vehicle\" syntax (should be \"new AsyncVehicle\"), or didn't adapt your custom entity class to new Async API.");
8282
OnAdd(entity);
8383
}
8484

8585
public bool Remove(TEntity entity)
8686
{
87-
return Remove(entity.NativePointer);
87+
return Remove(entity.EntityNativePointer);
8888
}
8989

9090
//TODO: what should happen on failure
@@ -101,7 +101,7 @@ public bool Remove(IntPtr entityPointer)
101101
if (ptr != IntPtr.Zero)
102102
{
103103
internalEntity.SetCached(ptr);
104-
cache[entity.NativePointer] = new WeakReference<TEntity>(entity);
104+
cache[entity.EntityNativePointer] = new WeakReference<TEntity>(entity);
105105
}
106106
}
107107
}

api/AltV.Net.Client/Elements/Entities/Audio.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public struct AudioEntity
1515
public class Audio : BaseObject, IAudio
1616
{
1717
public IntPtr AudioNativePointer { get; }
18-
public override IntPtr NativePointer => AudioNativePointer;
1918

2019
public static IntPtr GetBaseObjectNativePointer(ICore core, IntPtr audioNativePointer)
2120
{

api/AltV.Net.Client/Elements/Entities/AudioFilter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public AudioFilter(ICore core, IntPtr audioFilterNativePointer, uint id) : base(
1919
}
2020

2121
public IntPtr AudioFilterNativePointer { get; }
22-
public override IntPtr NativePointer => AudioFilterNativePointer;
2322

2423
public uint Hash
2524
{

api/AltV.Net.Client/Elements/Entities/AudioOutput.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ public AudioOutput(ICore core, IntPtr audioOutputNativePointer, BaseObjectType t
2424
}
2525

2626
public IntPtr AudioOutputNativePointer { get; }
27-
public override IntPtr NativePointer => AudioOutputNativePointer;
28-
2927

3028
public float Volume
3129
{

api/AltV.Net.Client/Elements/Entities/AudioOutputAttached.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,4 @@ public IWorldObject Entity
4242
}
4343
}
4444
}
45-
46-
public override IntPtr NativePointer => AudioOutputAttachedNativePointer;
4745
}

api/AltV.Net.Client/Elements/Entities/AudioOutputFrontend.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ public AudioOutputFrontend(ICore core, IntPtr audioOutputFrontendNativePointer,
1919
}
2020

2121
public IntPtr AudioOutputFrontendNativePointer { get; }
22-
public override IntPtr NativePointer => AudioOutputFrontendNativePointer;
2322
}

api/AltV.Net.Client/Elements/Entities/AudioOutputWorld.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,4 @@ public Position Position
4040
}
4141
}
4242
}
43-
44-
public override IntPtr NativePointer => AudioOutputWorldNativePointer;
4543
}

api/AltV.Net.Client/Elements/Entities/BaseObject.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace AltV.Net.Client.Elements.Entities
1010
public class BaseObject : SharedBaseObject, IBaseObject
1111
{
1212
public override IntPtr BaseObjectNativePointer { get; protected set; }
13-
public override IntPtr NativePointer => BaseObjectNativePointer;
1413
public override ICore Core { get; }
1514
public override BaseObjectType Type { get; }
1615
public uint Id { get; }

api/AltV.Net.Client/Elements/Entities/Blip.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace AltV.Net.Client.Elements.Entities
1111
public class Blip : WorldObject, IBlip
1212
{
1313
public IntPtr BlipNativePointer { get; }
14-
public override IntPtr NativePointer => BlipNativePointer;
1514

1615
private static IntPtr GetWorldObjectPointer(ICore core, IntPtr nativePointer)
1716
{

api/AltV.Net.Client/Elements/Entities/Checkpoint.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace AltV.Net.Client.Elements.Entities
88
public class Checkpoint : ColShape, ICheckpoint
99
{
1010
public IntPtr CheckpointNativePointer { get; }
11-
public override IntPtr NativePointer => CheckpointNativePointer;
1211

1312
private static IntPtr GetColShapePointer(ICore core, IntPtr nativePointer)
1413
{

0 commit comments

Comments
 (0)