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
2a744200
Commit
2a744200
authored
May 12, 2020
by
Allen B. Doelue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
bdbf1e96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
Lobby.cpp
Lobby.cpp
+46
-0
No files found.
Lobby.cpp
0 → 100644
View file @
2a744200
#include "Lobby.h"
#include "Player.h"
#include <iostream>
using
namespace
std
;
Lobby
::
Lobby
(){
capacity
=
6
;
players
=
new
Player
[
capacity
];
size
=
0
;
rankSum
=
0
;
}
Lobby
::
Lobby
(
unsigned
int
cap
)
{
capacity
=
cap
;
players
=
new
Player
[
capacity
];
size
=
0
;
rankSum
=
0
;
}
float
Lobby
::
getAverage
()
{
if
(
size
==
0
)
{
return
0
;
}
rankSum
=
0
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
rankSum
+=
players
[
i
].
getRank
();
}
return
rankSum
/
size
;
}
void
Lobby
::
addPlayer
(
Player
p
){
cout
<<
"start add"
<<
endl
;
cout
<<
"player rank: "
<<
p
.
getRank
()
<<
endl
;
players
[
size
]
=
p
;
cout
<<
"increase size"
<<
endl
;
size
++
;
}
void
Lobby
::
display
(){
for
(
unsigned
int
i
=
0
;
i
<
size
;
i
++
)
{
cout
<<
"Player "
<<
i
+
1
<<
endl
;
players
[
i
].
displayName
();
cout
<<
players
[
i
].
getRank
()
<<
endl
;
}
}
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