using Impostor.Shared.Innersloth.Data;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
+using Serilog;
namespace Impostor.Server.Net.Manager
{
return game;
}
- public IEnumerable<Game> FindListings(byte mapId, int impostorCount, GameKeywords language, int count = 10)
+ public IEnumerable<Game> FindListings(MapFlags map, int impostorCount, GameKeywords language, int count = 10)
{
var results = 0;
foreach (var (code, game) in _games.Where(x =>
x.Value.IsPublic &&
x.Value.GameState == GameStates.NotStarted &&
- x.Value.PlayerCount < 10)) // TODO: Do "< x.Value.Options.MaxPlayers" when GameData packets are done.
+ x.Value.PlayerCount < x.Value.Options.MaxPlayers))
{
// Check for options.
- // TODO: Re-enable map filter when GameData packets are done.
- if (/* game.Options.MapId != mapId || */
- game.Options.Keywords != language ||
- (impostorCount != 0 && game.Options.NumImpostors != impostorCount))
+ if (!map.HasFlag((MapFlags) (1 << game.Options.MapId)))
+ {
+ continue;
+ }
+
+ if (!language.HasFlag(game.Options.Keywords))
+ {
+ continue;
+ }
+
+ if (impostorCount != 0 && game.Options.NumImpostors != impostorCount)
{
continue;
}
using Hazel;
using Impostor.Server.Net.Messages;
using Impostor.Shared.Innersloth;
+using Impostor.Shared.Innersloth.Data;
namespace Impostor.Server.Net.State
{
{
using (var message = MessageWriter.Get(SendOption.Reliable))
{
- var games = _gameManager.FindListings(options.MapId, options.NumImpostors, options.Keywords);
+ var games = _gameManager.FindListings((MapFlags) options.MapId, options.NumImpostors, options.Keywords);
Message16GetGameListV2.Serialize(message, games);