Ignore:
Timestamp:
10/03/2008 08:17:22 PM (4 years ago)
Author:
guyru
Message:

code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/configuration.cpp

    r167 r170  
    1919 ***************************************************************************/ 
    2020 
    21 #include <iostream> 
    2221#include <cstdlib> // used in the back-compatibility code 
    2322#include <sstream> 
     
    3736        m_file = file; 
    3837 
    39         cerr<<"loading file: "<<file<<endl; 
    4038        ifstream conf_file (file.c_str()); 
    4139        if (!conf_file.is_open()) { 
    4240                // file couldn't be opened, this is due to missing file or 
    4341                // permission error. 
    44                 cerr<<"Error openning configuration file for reading: "<<m_file<<endl; 
     42                loadDefaultSettings(); 
     43                save(); 
     44                return; 
    4545        } 
    4646         
     
    4949        string header; 
    5050        getline(conf_file,header); 
    51         cerr<<"line: "<<header.substr(0,11)<<endl; 
    5251        if (header.substr(0,11) != "openyahtzee") { 
    5352                // this is probably an old sqllite file import it. 
     
    5958        while(!conf_file.eof()) { 
    6059                getline(conf_file,header); 
    61                 cerr<<"line: "<<header<<endl; 
    6260                if (header == "[settings]") { 
    6361                        parseSettings(&conf_file); 
     
    7371{ 
    7472        loadDefaultSettings(); 
    75         cerr<<"parsing settings"<<endl; 
    7673        string temp_line; 
    7774        size_t pos; // used to loacate the '=' sign 
     
    9188                        return; 
    9289                } 
    93                 cerr<<"key: "<<temp_line.substr(0,pos)<<endl; 
    94                 cerr<<"value: "<<temp_line.substr(pos+1)<<endl; 
    9590                m_settings[temp_line.substr(0,pos)] = temp_line.substr(pos+1); 
    9691        } 
     
    124119                temp_item.date = date+" "+hour; 
    125120                m_highscores.push_back(temp_item); 
    126                 cerr<<score<<" "<<name<<" "<<temp_item.date<<endl; 
    127121 
    128122                // The following two lines read one character forword and 
     
    139133        ofstream conf_file (m_file.c_str()); 
    140134        if (!conf_file.is_open()) { 
    141                 // file couldn't be opened, this is due to missing file or 
    142                 // permission error. 
    143                 cerr<<"Error openning configuration file for writing: "<<m_file<<endl; 
     135                // file couldn't be opened, probably due to permission error 
     136                return; 
    144137        } 
    145138        conf_file<<"openyahtzee="<<VERSION<<endl; 
Note: See TracChangeset for help on using the changeset viewer.