mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-01 09:48:37 +00:00
Fix room deletions
This commit is contained in:
parent
b30195c5ba
commit
6f0752c247
1 changed files with 8 additions and 7 deletions
|
@ -227,6 +227,13 @@ public class RoomHelper
|
|||
roomsToUpdate.Add(room);
|
||||
}
|
||||
|
||||
// DO NOT REMOVE ROOMS BEFORE THIS POINT!
|
||||
// this will cause the room to be added back to the database
|
||||
foreach (Room room in roomsToUpdate)
|
||||
{
|
||||
rooms.Update(room);
|
||||
}
|
||||
|
||||
// Delete old rooms based on host
|
||||
if (hostId != null)
|
||||
{
|
||||
|
@ -247,17 +254,11 @@ public class RoomHelper
|
|||
{
|
||||
foreach (int newRoomPlayer in newRoom.PlayerIds)
|
||||
{
|
||||
if (room.PlayerIds.Contains(newRoomPlayer))
|
||||
rooms.Remove(room);
|
||||
if (room.PlayerIds.Contains(newRoomPlayer)) rooms.Remove(room);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Room room in roomsToUpdate)
|
||||
{
|
||||
rooms.Update(room);
|
||||
}
|
||||
|
||||
rooms.RemoveAll(r => r.PlayerIds.Count == 0); // Remove empty rooms
|
||||
rooms.RemoveAll(r => r.HostId == -1); // Remove rooms with broken hosts
|
||||
rooms.RemoveAll(r => r.PlayerIds.Count > 4); // Remove obviously bogus rooms
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue