Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG1004_2022_group4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Magnus Westerheim Johannessen
PROG1004_2022_group4
Commits
7ef3b109
Commit
7ef3b109
authored
3 years ago
by
aurora
Browse files
Options
Downloads
Patches
Plain Diff
improvement:edit player changed to global function
parent
4a1686e9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/kode/checkmate.cpp
+19
-49
19 additions, 49 deletions
src/kode/checkmate.cpp
with
19 additions
and
49 deletions
src/kode/checkmate.cpp
+
19
−
49
View file @
7ef3b109
...
@@ -159,55 +159,6 @@ Player* findPlayerID(const int ID) {
...
@@ -159,55 +159,6 @@ Player* findPlayerID(const int ID) {
}
}
}
}
/**
* Updates the info of an excisting player
*
* @see viewPlayers()
* @see findPlayer()
* @see findPlayerID()
*/
void
Player
::
updatePlayer
()
{
int
choise
,
ID
;
string
search
;
choise
=
lesInt
(
"
\n\t
1. Enter info or 2. List"
,
1
,
2
);
cout
<<
"
\n\n
"
;
if
(
choise
==
1
)
{
choise
=
0
;
choise
=
lesInt
(
"
\n\t
1. search by name or 2. search by playerID"
,
1
,
2
);
cout
<<
"
\n\n
"
;
if
(
choise
==
1
)
{
cout
<<
"
\n\t
Name: "
;
getline
(
cin
,
search
);
if
(
findPlayer
(
name
)
==
nullptr
)
{
cout
<<
"
\n\t
Name not recognized!"
;
}
else
{
cout
<<
"
\n\t
Player found!
\n
"
;
findPlayer
(
name
)
->
writePlayer
();
}
}
else
if
(
choise
==
2
)
{
ID
=
lesInt
(
"
\n\t
PlayerID: "
,
1
,
1000
);
if
(
findPlayerID
(
ID
)
==
nullptr
)
{
cout
<<
"
\n\t
PlayerID not recognized!"
;
}
else
{
cout
<<
"
\n\t
Player found!
\n
"
;
findPlayerID
(
ID
)
->
writePlayer
();
}
}
}
else
if
(
choise
==
2
)
{
viewPlayers
();
}
}
}
/**
/**
* Calculates the score for a single player
* Calculates the score for a single player
...
@@ -400,6 +351,25 @@ void editPlayer(){
...
@@ -400,6 +351,25 @@ void editPlayer(){
choise
=
0
;
choise
=
0
;
choise
=
lesInt
(
"
\n\t
1. search by name or 2. search by playerID"
,
1
,
2
);
choise
=
lesInt
(
"
\n\t
1. search by name or 2. search by playerID"
,
1
,
2
);
if
(
choise
==
1
){
cout
<<
"
\n\t
Name: "
;
getline
(
cin
,
search
);
if
(
findPlayer
(
search
)
==
nullptr
)
{
cout
<<
"
\n\t
Name not recognized!
\n
"
;
}
else
{
cout
<<
"
\n\t
Player found!
\n
"
;
findPlayer
(
search
)
->
writePlayer
();
}
}
else
if
(
choise
==
2
){
findPlayer
(
search
)
->
ID
=
lesInt
(
"
\n\t
PlayerID: "
,
1
,
1000
);
if
(
findPlayerID
(
ID
)
==
nullptr
)
{
cout
<<
"
\n\t
PlayerID not recognized!"
;
}
else
{
cout
<<
"
\n\t
Player found!
\n
"
;
findPlayerID
(
ID
)
->
writePlayer
();
}
}
cout
<<
"
\n\n
"
;
cout
<<
"
\n\n
"
;
}
}
else
if
(
choise
==
2
)
{
else
if
(
choise
==
2
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment