Commit df7e2698 authored by Kyle Malaguit's avatar Kyle Malaguit

autosave

parent c86a7074
#include "SL2048.h" #include "SL2048.h"
void SL2048::LoadContainers(){ void SL2048::LoadContainers(string fileName){
ifstream fin; ifstream fin;
fin.open("2048Data.txt"); fin.open(fileName);
if(!fin.is_open()){ if(!fin.is_open()){
cerr << "Could not open file.\n"; cerr << "Could not open file.\n";
exit(0); exit(0);
......
...@@ -15,7 +15,7 @@ using namespace std; ...@@ -15,7 +15,7 @@ using namespace std;
class Scores; class Scores;
class SL2048 : public SaveLoad{ class SL2048 : public SaveLoad{
public: public:
void LoadContainers(); void LoadContainers(string fileName);
void updateFile(string fileName); void updateFile(string fileName);
}; };
......
#include "SLSnake.h" #include "SLSnake.h"
void SLSnake::LoadContainers(){ void SLSnake::LoadContainers(string fileName){
ifstream fin; ifstream fin;
fin.open("snakedata.txt"); fin.open(fileName);
if(!fin.is_open()){ if(!fin.is_open()){
cerr << "Could not open file.\n"; cerr << "Could not open file.\n";
exit(0); exit(0);
......
...@@ -15,7 +15,7 @@ using namespace std; ...@@ -15,7 +15,7 @@ using namespace std;
class Scores; class Scores;
class SLSnake : public SaveLoad{ class SLSnake : public SaveLoad{
public: public:
void LoadContainers(); void LoadContainers(string fileName);
void updateFile(string fileName); void updateFile(string fileName);
}; };
......
...@@ -18,8 +18,8 @@ class SaveLoad { ...@@ -18,8 +18,8 @@ class SaveLoad {
public: public:
//these functions change the files data //these functions change the files data
virtual void LoadContainers() = 0; virtual void LoadContainers(string fileName) = 0;
virtual void updateFile() = 0; virtual void updateFile(string fileName) = 0;
//add new data into file //add new data into file
void sortByScore(); void sortByScore();
......
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