Removed uneccesary vector copy.

This commit is contained in:
hiker 2015-11-19 14:18:34 +11:00
parent 4813637a37
commit e7cc868c85
2 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ class GameSetup
/** \brief Get the players that are in the game
* \return A vector containing pointers on the players profiles.
*/
std::vector<NetworkPlayerProfile*> getPlayers() { return m_players; }
const std::vector<NetworkPlayerProfile*>& getPlayers() { return m_players; }
int getPlayerCount() { return (int)m_players.size(); }
/*! \brief Get a network player profile matching a universal id.
* \param id : Global id of the player (the one in the SQL database)

View File

@ -25,7 +25,7 @@ StartGameProtocol::StartGameProtocol(GameSetup* game_setup)
: Protocol(PROTOCOL_START_GAME)
{
m_game_setup = game_setup;
std::vector<NetworkPlayerProfile*> players = m_game_setup->getPlayers();
const std::vector<NetworkPlayerProfile*> &players = m_game_setup->getPlayers();
for (unsigned int i = 0; i < players.size(); i++)
{
m_player_states.insert(std::pair<NetworkPlayerProfile*, STATE>(players[i], LOADING));