mirror of
https://github.com/glest/glest-source.git
synced 2025-08-14 04:13:58 +02:00
tracking down bug on i386 platform
This commit is contained in:
@@ -44,6 +44,7 @@ private:
|
|||||||
PropertyMap propertyMap;
|
PropertyMap propertyMap;
|
||||||
PropertyVector propertyVectorTmp;
|
PropertyVector propertyVectorTmp;
|
||||||
PropertyMap propertyMapTmp;
|
PropertyMap propertyMapTmp;
|
||||||
|
bool propertyMapTmpInUse;
|
||||||
|
|
||||||
string path;
|
string path;
|
||||||
static string applicationPath;
|
static string applicationPath;
|
||||||
@@ -54,6 +55,7 @@ private:
|
|||||||
static string tutorialPath;
|
static string tutorialPath;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Properties();
|
||||||
static void setApplicationPath(string value) { applicationPath=value; }
|
static void setApplicationPath(string value) { applicationPath=value; }
|
||||||
static string getApplicationPath() { return applicationPath; }
|
static string getApplicationPath() { return applicationPath; }
|
||||||
|
|
||||||
|
@@ -51,6 +51,10 @@ string Properties::tutorialPath = "";
|
|||||||
// class Properties
|
// class Properties
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
|
Properties::Properties() {
|
||||||
|
propertyMapTmpInUse = false;
|
||||||
|
path = "";
|
||||||
|
}
|
||||||
void Properties::load(const string &path, bool clearCurrentProperties) {
|
void Properties::load(const string &path, bool clearCurrentProperties) {
|
||||||
|
|
||||||
char lineBuffer[maxLine]="";
|
char lineBuffer[maxLine]="";
|
||||||
@@ -78,9 +82,12 @@ void Properties::load(const string &path, bool clearCurrentProperties) {
|
|||||||
|
|
||||||
if(clearCurrentProperties == true) {
|
if(clearCurrentProperties == true) {
|
||||||
propertyMap.clear();
|
propertyMap.clear();
|
||||||
|
propertyMapTmpInUse = true;
|
||||||
propertyMapTmp.clear();
|
propertyMapTmp.clear();
|
||||||
|
propertyMapTmpInUse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
propertyMapTmpInUse = true;
|
||||||
while(fileStream.eof() == false) {
|
while(fileStream.eof() == false) {
|
||||||
lineBuffer[0]='\0';
|
lineBuffer[0]='\0';
|
||||||
fileStream.getline(lineBuffer, maxLine);
|
fileStream.getline(lineBuffer, maxLine);
|
||||||
@@ -161,6 +168,7 @@ void Properties::load(const string &path, bool clearCurrentProperties) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
propertyMapTmpInUse = false;
|
||||||
|
|
||||||
fileStream.close();
|
fileStream.close();
|
||||||
#if defined(WIN32) && !defined(__MINGW32__)
|
#if defined(WIN32) && !defined(__MINGW32__)
|
||||||
@@ -375,7 +383,9 @@ void Properties::save(const string &path){
|
|||||||
|
|
||||||
void Properties::clear(){
|
void Properties::clear(){
|
||||||
propertyMap.clear();
|
propertyMap.clear();
|
||||||
|
propertyMapTmpInUse = true;
|
||||||
propertyMapTmp.clear();
|
propertyMapTmp.clear();
|
||||||
|
propertyMapTmpInUse = false;
|
||||||
propertyVector.clear();
|
propertyVector.clear();
|
||||||
propertyVectorTmp.clear();
|
propertyVectorTmp.clear();
|
||||||
}
|
}
|
||||||
@@ -443,6 +453,10 @@ float Properties::getFloat(const string &key, float min, float max, const char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
const string Properties::getString(const string &key, const char *defaultValueIfNotFound) const{
|
const string Properties::getString(const string &key, const char *defaultValueIfNotFound) const{
|
||||||
|
for(time_t elapsed = time(NULL); propertyMapTmpInUse == true && difftime(time(NULL),elapsed) < 5;) {
|
||||||
|
sleep(100);
|
||||||
|
printf("Waiting for ini file updates to complete.\n");
|
||||||
|
}
|
||||||
PropertyMap::const_iterator it = propertyMapTmp.find(key);
|
PropertyMap::const_iterator it = propertyMapTmp.find(key);
|
||||||
if(it == propertyMapTmp.end()) {
|
if(it == propertyMapTmp.end()) {
|
||||||
if(defaultValueIfNotFound != NULL) {
|
if(defaultValueIfNotFound != NULL) {
|
||||||
@@ -501,9 +515,10 @@ void Properties::setString(const string &key, const string &value){
|
|||||||
propertyMap.erase(key);
|
propertyMap.erase(key);
|
||||||
propertyMap.insert(PropertyPair(key, value));
|
propertyMap.insert(PropertyPair(key, value));
|
||||||
|
|
||||||
|
propertyMapTmpInUse = true;
|
||||||
propertyMapTmp.erase(key);
|
propertyMapTmp.erase(key);
|
||||||
propertyMapTmp.insert(PropertyPair(key, value));
|
propertyMapTmp.insert(PropertyPair(key, value));
|
||||||
|
propertyMapTmpInUse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Properties::toString(){
|
string Properties::toString(){
|
||||||
|
Reference in New Issue
Block a user