Skip to content

Commit

Permalink
Don't recolor hourglasses in /randomteams, don't crash when there are…
Browse files Browse the repository at this point in the history
… 0 players
  • Loading branch information
kimden committed Oct 25, 2022
1 parent 90343fd commit 06da93a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/network/protocols/command_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2083,13 +2083,19 @@ void CommandManager::process_randomteams(Context& context)
int players_number = 0;
for (auto& peer : STKHost::get()->getPeers())
{
if (!m_lobby->canRace(peer))
continue;
if (peer->alwaysSpectate())
continue;
players_number += peer->getPlayerProfiles().size();
for (auto& profile : peer->getPlayerProfiles())
profile->setTemporaryTeam(-1);
}

if (players_number == 0) {
std::string msg = "No one can play!";
m_lobby->sendStringToPeer(msg, context.m_peer);
return;
}
int teams_number = -1;
if (argv.size() < 2 || !StringUtils::parseString(argv[1], &teams_number)
|| teams_number < 1 || teams_number > 9)
Expand Down

0 comments on commit 06da93a

Please sign in to comment.