-
Notifications
You must be signed in to change notification settings - Fork 0
/
SaveLoad.h
24 lines (23 loc) · 871 Bytes
/
SaveLoad.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include <iostream>
#include <fstream>
#include <sstream>
#include "constants.h"
using namespace std;
class SaveLoad {
fstream resFile;
fstream stepsFile;
public:
SaveLoad(const bool& saveOption, const bool& loadOption, string fName);
~SaveLoad() { closeFiles(); }
void openFiles(const bool& saveOption, const bool& loadOption, string fName);
void closeFiles() { stepsFile.close(); resFile.close(); }
void writeToResults(char whatHappend, int when){ resFile << whatHappend << when << '.'; }
void writeMoves(string& moves, char who) { stepsFile << '\n' << who << ':' << moves; }
string changeName(string fName, string ending);
void colorMode(bool color) { stepsFile << color << ';'; }
void readColor() { while (stepsFile.get() != '\n'); }
void readStrFromFile(string& str) { getline(stepsFile, str); }
int getTime();
char checkWhatHappend();
};