mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
Fix lobbies (#901)
This commit is contained in:
parent
2fdcf62ec6
commit
f2fa81b5c3
@ -208,7 +208,7 @@ void ScriptedActivityComponent::PlayerLeave(LWOOBJID playerID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScriptedActivityComponent::Update(float deltaTime) {
|
void ScriptedActivityComponent::Update(float deltaTime) {
|
||||||
|
std::vector<Lobby*> lobbiesToRemove{};
|
||||||
// Ticks all the lobbies, not applicable for non-instance activities
|
// Ticks all the lobbies, not applicable for non-instance activities
|
||||||
for (Lobby* lobby : m_Queue) {
|
for (Lobby* lobby : m_Queue) {
|
||||||
for (LobbyPlayer* player : lobby->players) {
|
for (LobbyPlayer* player : lobby->players) {
|
||||||
@ -219,6 +219,11 @@ void ScriptedActivityComponent::Update(float deltaTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lobby->players.empty()) {
|
||||||
|
lobbiesToRemove.push_back(lobby);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Update the match time for all players
|
// Update the match time for all players
|
||||||
if (m_ActivityInfo.maxTeamSize != 1 && lobby->players.size() >= m_ActivityInfo.minTeamSize
|
if (m_ActivityInfo.maxTeamSize != 1 && lobby->players.size() >= m_ActivityInfo.minTeamSize
|
||||||
|| m_ActivityInfo.maxTeamSize == 1 && lobby->players.size() >= m_ActivityInfo.minTeams) {
|
|| m_ActivityInfo.maxTeamSize == 1 && lobby->players.size() >= m_ActivityInfo.minTeams) {
|
||||||
@ -262,13 +267,17 @@ void ScriptedActivityComponent::Update(float deltaTime) {
|
|||||||
// The timer has elapsed, start the instance
|
// The timer has elapsed, start the instance
|
||||||
if (lobby->timer <= 0.0f) {
|
if (lobby->timer <= 0.0f) {
|
||||||
Game::logger->Log("ScriptedActivityComponent", "Setting up instance.");
|
Game::logger->Log("ScriptedActivityComponent", "Setting up instance.");
|
||||||
|
|
||||||
ActivityInstance* instance = NewInstance();
|
ActivityInstance* instance = NewInstance();
|
||||||
LoadPlayersIntoInstance(instance, lobby->players);
|
LoadPlayersIntoInstance(instance, lobby->players);
|
||||||
RemoveLobby(lobby);
|
|
||||||
instance->StartZone();
|
instance->StartZone();
|
||||||
|
lobbiesToRemove.push_back(lobby);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!lobbiesToRemove.empty()) {
|
||||||
|
RemoveLobby(lobbiesToRemove.front());
|
||||||
|
lobbiesToRemove.erase(lobbiesToRemove.begin());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptedActivityComponent::RemoveLobby(Lobby* lobby) {
|
void ScriptedActivityComponent::RemoveLobby(Lobby* lobby) {
|
||||||
|
Loading…
Reference in New Issue
Block a user