networking addPlayer
This commit is contained in:
parent
0e8e41e4fb
commit
ef38da703e
8 changed files with 50 additions and 37 deletions
|
|
@ -62,10 +62,12 @@ namespace game {
|
|||
return true;
|
||||
}
|
||||
|
||||
void State::addPlayer(int playerId)
|
||||
int State::addPlayer()
|
||||
{
|
||||
int playerId = m_nextId++;
|
||||
Player *player = new Player(playerId);
|
||||
players.push_back(player);
|
||||
return playerId;
|
||||
}
|
||||
|
||||
void State::playerLeft(int playerId)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace game {
|
|||
|
||||
// The upper layer (network/renderer) calling these three functions
|
||||
// should keep id's unique and give one (network) input an id.
|
||||
void addPlayer(int playerId);
|
||||
int addPlayer();
|
||||
void playerLeft(int playerId);
|
||||
void commandForPlayer(int playerId, Command *cmd);
|
||||
|
||||
|
|
@ -89,5 +89,6 @@ namespace game {
|
|||
float m_playerRespawnTime;
|
||||
float m_shipRadius;
|
||||
float m_defaultEnergy;
|
||||
int m_nextId=0;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue