1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 20:22:55 +08:00

Merge pull request #18817 from peppy/remove-room-null-check-more

Remove remaining `Room != null` checks in `TestMultiplayerClient` where possible
This commit is contained in:
Dean Herbert 2022-06-23 18:27:05 +09:00 committed by GitHub
commit 777ac98599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,8 +87,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
switch (Room?.MatchState)
{
case TeamVersusRoomState teamVersus:
Debug.Assert(Room != null);
// simulate the server's automatic assignment of users to teams on join.
// the "best" team is the one with the least users on it.
int bestTeam = teamVersus.Teams
@ -103,6 +101,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void RemoveUser(APIUser user)
{
Debug.Assert(Room != null);
((IMultiplayerClient)this).UserLeft(new MultiplayerRoomUser(user.Id));
Schedule(() =>
@ -114,25 +113,23 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void ChangeRoomState(MultiplayerRoomState newState)
{
Debug.Assert(Room != null);
((IMultiplayerClient)this).RoomStateChanged(newState);
}
public void ChangeUserState(int userId, MultiplayerUserState newState)
{
Debug.Assert(Room != null);
((IMultiplayerClient)this).UserStateChanged(userId, newState);
updateRoomStateIfRequired();
}
private void updateRoomStateIfRequired()
{
Debug.Assert(Room != null);
Debug.Assert(APIRoom != null);
Schedule(() =>
{
Debug.Assert(Room != null);
switch (Room.State)
{
case MultiplayerRoomState.Open:
@ -179,8 +176,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void ChangeUserBeatmapAvailability(int userId, BeatmapAvailability newBeatmapAvailability)
{
Debug.Assert(Room != null);
((IMultiplayerClient)this).UserBeatmapAvailabilityChanged(userId, newBeatmapAvailability);
}
@ -290,7 +285,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void ChangeUserMods(int userId, IEnumerable<APIMod> newMods)
{
Debug.Assert(Room != null);
((IMultiplayerClient)this).UserModsChanged(userId, newMods.ToList());
}
@ -338,7 +332,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
public override Task AbortGameplay()
{
Debug.Assert(Room != null);
Debug.Assert(LocalUser != null);
ChangeUserState(LocalUser.UserID, MultiplayerUserState.Idle);