diff --git a/source/code/main.cpp b/source/code/main.cpp index 370a258..8e3789e 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -1952,7 +1952,7 @@ int main(int argc, char* argv[]) { Stats::getInstance()->save(); Config::getInstance()->save(); - + //Close file system Apstraction layer! PHYSFS_deinit(); diff --git a/source/code/puzzlehandler.hpp b/source/code/puzzlehandler.hpp index ac54eaf..e6c6390 100644 --- a/source/code/puzzlehandler.hpp +++ b/source/code/puzzlehandler.hpp @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ Source information and contacts persons can be found at -http://blockattack.net +http://www.blockattack.net =========================================================================== */ diff --git a/source/code/sago/SagoMiscSdl2.hpp b/source/code/sago/SagoMiscSdl2.hpp index 1dac489..667cdac 100644 --- a/source/code/sago/SagoMiscSdl2.hpp +++ b/source/code/sago/SagoMiscSdl2.hpp @@ -27,7 +27,17 @@ namespace sago { + /** + * Writes an error message to the screen and aborts the program + * @param errorMsg The message displayed in a pop-up box to the user. + */ void SagoFatalError(const char* errorMsg); + + /** + * Writes an error message to the screen and aborts the program + * @param fmt A printf-style format string + * @param ... Parameters to the format string + */ void SagoFatalErrorF(const char* fmt, ...) __attribute__ ((format (printf, 1, 2))); } diff --git a/source/code/stats.cpp b/source/code/stats.cpp index 2ff6cdf..78fd3da 100644 --- a/source/code/stats.cpp +++ b/source/code/stats.cpp @@ -24,27 +24,28 @@ http://blockattack.net #include "stats.h" #include "common.h" #include "os.hpp" -#include +#include "physfs_stream.hpp" using namespace std; Stats* Stats::instance = nullptr; +const char * const statsFileName = "statsFile"; + Stats::Stats() { statMap.clear(); load(); } void Stats::load() { - string filename = getPathToSaveFiles()+"/statsFile"; - ifstream inFile(filename.c_str()); + PhysFS::ifstream inFile(statsFileName); string key; char value[MAX_VAR_LENGTH]; if (inFile) { while (!inFile.eof()) { inFile >> key; // The key is first on line inFile.get(); //Take the space - inFile.getline(value,MAX_VAR_LENGTH); //The rest of the line is the value. + inFile.getline(value, MAX_VAR_LENGTH); //The rest of the line is the value. statMap[key] = str2int(value); } inFile.close(); @@ -60,9 +61,7 @@ Stats* Stats::getInstance() { } void Stats::save() { - string filename = getPathToSaveFiles()+"/statsFile"; - ofstream outFile(filename.c_str(),ios::trunc); - + PhysFS::ofstream outFile(statsFileName, ios::trunc); if (outFile) { //outFile << statMap.size() << endl; map::iterator iter; diff --git a/source/code/stats.h b/source/code/stats.h index 6a1c58b..8c8f374 100644 --- a/source/code/stats.h +++ b/source/code/stats.h @@ -34,22 +34,8 @@ http://blockattack.net #include #include - - - class Stats { -private: - std::map statMap; - - static Stats *instance; - - void load(); -protected: - - Stats(); - - public: static Stats* getInstance(); @@ -62,7 +48,11 @@ public: bool exists(const std::string &statName); - +private: + std::map statMap; + static Stats *instance; + void load(); + Stats(); }; #endif /* _STATS_H */