refactor: remove some warnings
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using NLog;
|
||||
using Ragon.Core.Game;
|
||||
|
||||
@@ -9,7 +10,7 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user