balance team on player join
This commit is contained in:
@@ -33,6 +33,8 @@ public:
|
|||||||
virtual void OnGameBegin() override;
|
virtual void OnGameBegin() override;
|
||||||
virtual void OnGameEnd() override;
|
virtual void OnGameEnd() override;
|
||||||
virtual void OnGameClose() override;
|
virtual void OnGameClose() override;
|
||||||
|
|
||||||
|
virtual void OnPlayerJoin(game::PlayerID id) override;
|
||||||
private:
|
private:
|
||||||
void BalanceTeams();
|
void BalanceTeams();
|
||||||
void InitPlayerStats();
|
void InitPlayerStats();
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ void ServerConnexion::HandlePacket(const protocol::PlayerLoginPacket* packet) {
|
|||||||
|
|
||||||
protocol::PlayerListPacket listPacket(playerNames);
|
protocol::PlayerListPacket listPacket(playerNames);
|
||||||
SendPacket(&listPacket);
|
SendPacket(&listPacket);
|
||||||
|
|
||||||
|
m_Server->GetGame().NotifyListeners(&game::GameListener::OnPlayerJoin, m_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,5 +134,10 @@ void ServerGame::OnGameClose() {
|
|||||||
m_Server->Restart();
|
m_Server->Restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerGame::OnPlayerJoin(game::PlayerID id){
|
||||||
|
if (m_GameState == game::GameState::Game)
|
||||||
|
BalanceTeams();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace game
|
} // namespace game
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
|||||||
Reference in New Issue
Block a user