refactor: remove some warnings

This commit is contained in:
2022-12-17 18:58:37 +04:00
parent a9be230960
commit 13044357a5
2 changed files with 67 additions and 65 deletions
+3 -2
View File
@@ -1,11 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using Ragon.Core.Game;
namespace Ragon.Core.Lobby;
public interface ILobby
{
public bool FindRoomById(string roomId, out Room room);
public bool FindRoomByMap(string map, out Room room);
public bool FindRoomById(string roomId, [MaybeNullWhen(false)] out Room room);
public bool FindRoomByMap(string map, [MaybeNullWhen(false)] out Room room);
public void Persist(Room room);
public void Remove(Room room);
}
+6 -5
View File
@@ -1,15 +1,16 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using NLog;
using Ragon.Core.Game;
namespace Ragon.Core.Lobby;
public class LobbyInMemory: ILobby
public class LobbyInMemory : ILobby
{
private readonly List<Room> _rooms = new();
private readonly Logger _logger = LogManager.GetCurrentClassLogger();
public bool FindRoomById(string roomId, out Room room)
public bool FindRoomById(string roomId, [MaybeNullWhen(false)] out Room room)
{
foreach (var existRoom in _rooms)
{
@@ -21,11 +22,11 @@ public class LobbyInMemory: ILobby
}
}
room = null;
room = default;
return false;
}
public bool FindRoomByMap(string map, out Room room)
public bool FindRoomByMap(string map, [MaybeNullWhen(false)] out Room room)
{
foreach (var existRoom in _rooms)
{
@@ -37,7 +38,7 @@ public class LobbyInMemory: ILobby
}
}
room = null;
room = default;
return false;
}