Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Multiplayer Lobby Simulator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Allen B. Doelue
Multiplayer Lobby Simulator
Commits
11dd2b74
Commit
11dd2b74
authored
May 14, 2020
by
Cameron Mahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more players and prevents overstuffed lobby
parent
938e2adf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
Lobby.cpp
Lobby.cpp
+0
-3
PlayersList.txt
PlayersList.txt
+20
-1
main.cpp
main.cpp
+3
-1
No files found.
Lobby.cpp
View file @
11dd2b74
...
...
@@ -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
++
;
}
...
...
PlayersList.txt
View file @
11dd2b74
...
...
@@ -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
main.cpp
View file @
11dd2b74
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment