Commit 11dd2b74 authored by Cameron Mahan's avatar Cameron Mahan

Added more players and prevents overstuffed lobby

parent 938e2adf
......@@ -30,10 +30,7 @@ float Lobby::getAverage() {
}
void Lobby::addPlayer(Player p){
cout<<"start add"<<endl;
cout<<"player rank: "<<p.getRank()<<endl;
players[size] = p;
cout<<"increase size"<<endl;
size++;
}
......
......@@ -3,4 +3,23 @@ Allen-4
Matthew-7
Robert-3
Owen-7
Oren-30
\ No newline at end of file
Oren-30
Jarod-31
Jules-21
Liza-25
Zach-38
Elton-30
Gina-45
Emmet-22
Alyssa-30
William-23
Lincoln-28
Ellen-37
Jill-19
Nicholas-35
Jason-5
Claire-12
Jenna-8
Kim-49
Jude-25
Alice-33
\ No newline at end of file
......@@ -40,6 +40,7 @@ int main()
conversion >> rank;
//create player object
Player p(username, rank);
cout<<"Displaying current player"<<endl;
p.displayName();
cout<<p.getRank()<<endl;
//enqueue and repeat with next player
......@@ -50,7 +51,8 @@ int main()
sorted = true;
}
else if (p.getRank() <= lobbies[i].getAverage() +5 &&
p.getRank() >= lobbies[i].getAverage() -5 ) {
p.getRank() >= lobbies[i].getAverage() -5 &&
lobbies[i].getSize() < maxPlayers ) {
lobbies[i].addPlayer(p);
sorted = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment