Skip to content

Commit

Permalink
Fix leftover nullability warnings (#175)
Browse files Browse the repository at this point in the history
* Fix leftover nullability warnings

* Another fix
  • Loading branch information
DrSmugleaf authored Nov 23, 2023
1 parent d734018 commit 79ae458
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Arch/Core/EntityInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ internal EntityInfoStorage()
);
EntitySlots = new JaggedArray<EntitySlot>(
cpuL1CacheSize / Unsafe.SizeOf<EntitySlot>(),
new EntitySlot(null, new Slot(-1,-1)),
new EntitySlot(null!, new Slot(-1,-1)),
256
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Arch/Core/Extensions/EntityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public static bool HasRange(this in Entity entity, params ComponentType[] types)
/// <returns>A reference to the component.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[Pure]
public static void GetRange(this in Entity entity, ComponentType[] types, IList<object> components)
public static void GetRange(this in Entity entity, ComponentType[] types, IList<object?> components)
{
var world = World.Worlds[entity.WorldId];
world.GetRange(entity, types, components);
Expand Down
4 changes: 2 additions & 2 deletions src/Arch/Core/Extensions/WorldExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static bool HasRange(this World world, Entity entity, params ComponentTyp
/// <param name="types">The component <see cref="ComponentType"/>.</param>
/// <returns>A reference to the component.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static object[] GetRange(this World world, Entity entity, params ComponentType[] types)
public static object?[] GetRange(this World world, Entity entity, params ComponentType[] types)
{
return world.GetRange(entity, types);
}
Expand All @@ -126,7 +126,7 @@ public static object[] GetRange(this World world, Entity entity, params Componen
/// <param name="components">A <see cref="IList{T}"/> where the components are put it.</param>
/// <returns>A reference to the component.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void GetRange(this World world, Entity entity, ComponentType[] types, IList<object> components)
public static void GetRange(this World world, Entity entity, ComponentType[] types, IList<object?> components)
{
var entitySlot = world.EntityInfo.GetEntitySlot(entity.Id);
for (var index = 0; index < types.Length; index++)
Expand Down
2 changes: 1 addition & 1 deletion src/Arch/Core/Utils/CompileTimeStatics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ComponentType(int id, int byteSize)
public Type Type
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ComponentRegistry.Types[Id];
get => ComponentRegistry.Types[Id]!;
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/Arch/Core/Utils/EntityDebugView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ public EntityDebugView(Entity entity)
/// <summary>
/// The <see cref="Entity"/>s components.
/// </summary>
public object[] Components { get; }
public object[]? Components { get; }

/// <summary>
/// The <see cref="World"/> this <see cref="Entity"/> lives in.
/// </summary>
public World World => IsAlive ? World.Worlds[_entity.WorldId] : null;
public World? World => IsAlive ? World.Worlds[_entity.WorldId] : null;

/// <summary>
/// The <see cref="Archetype"/> this <see cref="Entity"/> lives in.
/// </summary>
public Archetype Archetype => IsAlive ? World.Worlds[_entity.WorldId].GetArchetype(_entity) : null;
public Archetype? Archetype => IsAlive ? World.Worlds[_entity.WorldId].GetArchetype(_entity) : null;

/// <summary>
/// The <see cref="Archetype"/> this <see cref="Entity"/> lives in.
Expand All @@ -63,7 +63,7 @@ public EntityDebugView(Entity entity)
/// <summary>
/// The stored <see cref="EntityInfo"/> for this <see cref="Entity"/>.
/// </summary>
public EntityInfo EntityInfo => IsAlive ? World.EntityInfo[_entity.Id] : new EntityInfo();
public EntityInfo EntityInfo => IsAlive ? World?.EntityInfo[_entity.Id] ?? new EntityInfo() : new EntityInfo();
}

#endif

0 comments on commit 79ae458

Please sign in to comment.