Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
1
142GameCenter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nelson Phillips
142GameCenter
Commits
7156b14c
Commit
7156b14c
authored
Mar 12, 2019
by
Kyle Malaguit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autosave
parent
962b4c8a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
11 deletions
+14
-11
Testings/SaveLoad/2048Data.txt
Testings/SaveLoad/2048Data.txt
+1
-0
Testings/SaveLoad/SL2048.cpp
Testings/SaveLoad/SL2048.cpp
+3
-2
Testings/SaveLoad/SL2048.h
Testings/SaveLoad/SL2048.h
+1
-1
Testings/SaveLoad/SLSnake.cpp
Testings/SaveLoad/SLSnake.cpp
+2
-2
Testings/SaveLoad/SLSnake.h
Testings/SaveLoad/SLSnake.h
+1
-1
Testings/SaveLoad/SaveLoad.cpp
Testings/SaveLoad/SaveLoad.cpp
+0
-1
Testings/SaveLoad/SaveLoad.h
Testings/SaveLoad/SaveLoad.h
+6
-4
No files found.
Testings/SaveLoad/2048Data.txt
View file @
7156b14c
...
@@ -5,6 +5,7 @@ vds 10000
...
@@ -5,6 +5,7 @@ vds 10000
NEL 10000
NEL 10000
PHI 10000
PHI 10000
BAG 10000
BAG 10000
mmm 10000
BVB 9240
BVB 9240
BND 6564
BND 6564
CDS 6544
CDS 6544
...
...
Testings/SaveLoad/SL2048.cpp
View file @
7156b14c
...
@@ -26,9 +26,10 @@ void SL2048::LoadContainers(){
...
@@ -26,9 +26,10 @@ void SL2048::LoadContainers(){
fin
.
close
();
fin
.
close
();
}
}
void
SL2048
::
updateFile
(){
void
SL2048
::
updateFile
(
string
fileName
){
ofstream
fout
;
ofstream
fout
;
fout
.
open
(
"2048Data.txt"
,
ofstream
::
out
|
ofstream
::
trunc
);
fout
.
open
(
fileName
,
ofstream
::
out
|
ofstream
::
trunc
);
//delete file contents
//delete file contents
fout
<<
"NAME"
<<
"
\t
"
<<
"SCORE"
<<
endl
;
fout
<<
"NAME"
<<
"
\t
"
<<
"SCORE"
<<
endl
;
for
(
auto
scoresFull
:
scores
){
for
(
auto
scoresFull
:
scores
){
...
...
Testings/SaveLoad/SL2048.h
View file @
7156b14c
...
@@ -16,7 +16,7 @@ class Scores;
...
@@ -16,7 +16,7 @@ class Scores;
class
SL2048
:
public
SaveLoad
{
class
SL2048
:
public
SaveLoad
{
public:
public:
void
LoadContainers
();
void
LoadContainers
();
void
updateFile
();
void
updateFile
(
string
fileName
);
};
};
#endif
#endif
\ No newline at end of file
Testings/SaveLoad/SLSnake.cpp
View file @
7156b14c
...
@@ -25,10 +25,10 @@ void SLSnake::LoadContainers(){
...
@@ -25,10 +25,10 @@ void SLSnake::LoadContainers(){
fin
.
close
();
fin
.
close
();
}
}
void
SLSnake
::
updateFile
(){
void
SLSnake
::
updateFile
(
string
fileName
){
ofstream
fout
;
ofstream
fout
;
//delete date in snake data file
//delete date in snake data file
fout
.
open
(
"snakedata.txt"
,
ofstream
::
out
|
ofstream
::
trunc
);
fout
.
open
(
fileName
,
ofstream
::
out
|
ofstream
::
trunc
);
//update
//update
fout
<<
"NAME"
<<
"
\t
"
<<
"SCORE"
<<
endl
;
fout
<<
"NAME"
<<
"
\t
"
<<
"SCORE"
<<
endl
;
...
...
Testings/SaveLoad/SLSnake.h
View file @
7156b14c
...
@@ -16,7 +16,7 @@ class Scores;
...
@@ -16,7 +16,7 @@ class Scores;
class
SLSnake
:
public
SaveLoad
{
class
SLSnake
:
public
SaveLoad
{
public:
public:
void
LoadContainers
();
void
LoadContainers
();
void
updateFile
();
void
updateFile
(
string
fileName
);
};
};
#endif
#endif
\ No newline at end of file
Testings/SaveLoad/SaveLoad.cpp
View file @
7156b14c
...
@@ -40,7 +40,6 @@ void SaveLoad::userInputNameMakeScore(int intScore){
...
@@ -40,7 +40,6 @@ void SaveLoad::userInputNameMakeScore(int intScore){
}
}
catch
(
runtime_error
&
ex
){
catch
(
runtime_error
&
ex
){
cout
<<
ex
.
what
()
<<
endl
;
cout
<<
ex
.
what
()
<<
endl
;
cout
<<
userNameInput
<<
endl
;
}
}
}
while
(
true
);
}
while
(
true
);
...
...
Testings/SaveLoad/SaveLoad.h
View file @
7156b14c
...
@@ -16,22 +16,24 @@ using namespace std;
...
@@ -16,22 +16,24 @@ using namespace std;
class
Scores
;
class
Scores
;
class
SaveLoad
{
class
SaveLoad
{
public:
public:
//these functions change the files data
virtual
void
LoadContainers
()
=
0
;
virtual
void
LoadContainers
()
=
0
;
virtual
void
updateFile
()
=
0
;
virtual
void
updateFile
()
=
0
;
//add new data into file
//add new data into file
void
pushBackNewScoreAndSort
(
Scores
Score
);
void
sortByScore
();
void
sortByScore
();
static
bool
sortAscending
(
Scores
,
Scores
);
void
userInputNameMakeScore
(
int
intScore
);
void
userInputNameMakeScore
(
int
intScore
);
//display scores in the bash
//display scores in the bash
void
displayScores
();
void
displayScores
();
//function for comparing
static
bool
sortAscending
(
Scores
,
Scores
);
protected:
protected:
vector
<
Scores
>
scores
;
vector
<
Scores
>
scores
;
void
pushBackNewScoreAndSort
(
Scores
Score
);
};
};
...
...
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