commit 30412ca6
Stated to remove physfs streams
Changed files
| M | source/code/common.cpp before |
| M | source/code/highscore.cpp before |
| M | source/code/main.cpp before |
| M | source/code/stats.cpp before |
diff --git a/source/code/common.cpp b/source/code/common.cpp
index 5595edf..e3edb43 100644
--- a/source/code/common.cpp
+++ b/source/code/common.cpp
@@ -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
===========================================================================
*/
@@ -28,7 +28,6 @@ http://blockattack.net
#include "sago/SagoMiscSdl2.hpp"
#include "sago/SagoMisc.hpp"
#include <stdarg.h>
-#include "physfs_stream.hpp"
using namespace std;
using boost::format;
@@ -176,7 +175,8 @@ Config::Config() {
}
void Config::load() {
- PhysFS::ifstream inFile("configFile");
+ string filecontent = sago::GetFileContent("configFile");
+ stringstream inFile(filecontent);
string key;
string previuskey;
char value[MAX_VAR_LENGTH];
diff --git a/source/code/highscore.cpp b/source/code/highscore.cpp
index d7d7ffc..a26e4a6 100644
--- a/source/code/highscore.cpp
+++ b/source/code/highscore.cpp
@@ -23,7 +23,6 @@ http://www.blockattack.net
#include "highscore.h"
#include "os.hpp"
-#include "physfs_stream.hpp"
#include "cereal/cereal.hpp"
#include "cereal/types/vector.hpp"
#include "cereal/archives/json.hpp"
@@ -96,9 +95,7 @@ bool Highscore::isHighScore(int newScore) {
if (newScore>table.back().score) {
return true;
}
- else {
- return false;
- }
+ return false;
}
void Highscore::addScore(const std::string& newName, int newScore) {
diff --git a/source/code/main.cpp b/source/code/main.cpp
index ad02159..2c9d4a0 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -48,7 +48,6 @@ http://www.blockattack.net
#include <SDL_mixer.h> //Used for sound & music
#include <SDL_image.h> //To load PNG images!
#include <physfs.h> //Abstract file system. To use containers
-#include "physfs_stream.hpp" //To use C++ style file streams
#include "Libs/NFont.h"
//#include "ttfont.h" //To use True Type Fonts in SDL
//#include "config.h"
diff --git a/source/code/stats.cpp b/source/code/stats.cpp
index bb89618..8a124f9 100644
--- a/source/code/stats.cpp
+++ b/source/code/stats.cpp
@@ -24,7 +24,6 @@ http://www.blockattack.net
#include "stats.h"
#include "common.h"
#include "os.hpp"
-#include "physfs_stream.hpp"
#include "sago/SagoMisc.hpp"
#include <sstream>
@@ -40,17 +39,17 @@ Stats::Stats() {
}
void Stats::load() {
- PhysFS::ifstream inFile(statsFileName);
+ string fileContent = sago::GetFileContent(statsFileName);
+ stringstream inFile(fileContent);
string key;
- char value[MAX_VAR_LENGTH];
+ string value;
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.
+ getline(inFile, value); //The rest of the line is the value.
statMap[key] = str2int(value);
}
- inFile.close();
}
}