Move validation checking to sendPacketToAllPeersWith

This commit is contained in:
Benau
2019-05-13 15:41:15 +08:00
parent bb65ba927e
commit 7ee774118b
2 changed files with 2 additions and 2 deletions

View File

@@ -604,8 +604,6 @@ void ServerLobby::handleChat(Event* event)
STKHost::get()->sendPacketToAllPeersWith(
[game_started, sender_in_game](STKPeer* p)
{
if (!p->isValidated())
return false;
if (game_started)
{
if (p->isWaitingForGame() && !sender_in_game)

View File

@@ -1269,6 +1269,8 @@ void STKHost::sendPacketToAllPeersWith(std::function<bool(STKPeer*)> predicate,
for (auto p : m_peers)
{
STKPeer* stk_peer = p.second.get();
if (!stk_peer->isValidated())
continue;
if (predicate(stk_peer))
stk_peer->sendPacket(data, reliable);
}