diff --git a/source/code/block.make b/source/code/block.make index 7cff0ef..046be35 100644 --- a/source/code/block.make +++ b/source/code/block.make @@ -18,7 +18,7 @@ DEBUG=1 endif ifndef NETWORK -NETWORK=1 +NETWORK=0 endif #Compile with debug information or optimized. diff --git a/source/code/common.h b/source/code/common.h index 98c0ef8..93be48d 100644 --- a/source/code/common.h +++ b/source/code/common.h @@ -63,6 +63,13 @@ string itoa(int num); string getPathToSaveFiles(); +/** + * str2int parses a string and returns an int with the value of the string. + * if the string is not an int then 0 is returned instead of throing an error + * in that way this function will always return a useable value. + */ +int str2int(string str2parse); + #ifdef WIN32 string getMyDocumentsPath(); #endif diff --git a/source/code/stats.cc b/source/code/stats.cc index 7364e08..a12bd6c 100644 --- a/source/code/stats.cc +++ b/source/code/stats.cc @@ -40,17 +40,15 @@ void Stats::load() string filename = getPathToSaveFiles()+"/statsFile"; ifstream inFile(filename.c_str()); string key; - unsigned int value; + char value[MAX_VAR_LENGTH]; if(inFile) { - //int antal; - //inFile >> antal; - //for(int i = 0;i> key; - inFile >> value; - statMap[key] = value; + 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. + statMap[key] = str2int(value); } inFile.close(); }