Skip to content

Commit

Permalink
Fix OverlayManager.RemoveOverlay (#5623)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroJr authored Jan 20, 2025
1 parent 8f2817a commit 4ba6687
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ END TEMPLATE-->

### Bugfixes

*None yet*
* Fixed one of the `IOverlayManager.RemoveOverlay` overrides not fully removing the overlay.

### Other

Expand Down
5 changes: 2 additions & 3 deletions Robust.Client/Graphics/Overlays/OverlayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public void FrameUpdate(FrameEventArgs args)

public bool AddOverlay(Overlay overlay)
{
if (_overlays.ContainsKey(overlay.GetType()))
if (!_overlays.TryAdd(overlay.GetType(), overlay))
return false;

_overlays.Add(overlay.GetType(), overlay);
Sort();
return true;
}
Expand All @@ -68,7 +67,7 @@ public bool RemoveOverlay<T>() where T : Overlay

public bool RemoveOverlay(Overlay overlay)
{
return _overlays.Remove(overlay.GetType());
return RemoveOverlay(overlay.GetType());
}

public bool TryGetOverlay(Type overlayClass, [NotNullWhen(true)] out Overlay? overlay)
Expand Down

0 comments on commit 4ba6687

Please sign in to comment.