Changeset 1795
- Timestamp:
- Sep 17, 2008, 11:49:08 PM (16 years ago)
- Location:
- code/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/ConfigFileManager.cc
r1784 r1795 73 73 void reloadConfig() 74 74 { 75 ConfigFileManager::getInstance() ->load();75 ConfigFileManager::getInstance().load(); 76 76 } 77 77 78 78 void cleanConfig() 79 79 { 80 ConfigFileManager::getInstance() ->clean(false);80 ConfigFileManager::getInstance().clean(false); 81 81 } 82 82 83 83 void loadSettings(const std::string& filename) 84 84 { 85 ConfigFileManager::getInstance() ->setFile(CFT_Settings, filename, false);85 ConfigFileManager::getInstance().setFile(CFT_Settings, filename, false); 86 86 } 87 87 88 88 void loadKeybindings(const std::string& filename) 89 89 { 90 ConfigFileManager::getInstance() ->setFile(CFT_Keybindings, filename);90 ConfigFileManager::getInstance().setFile(CFT_Keybindings, filename); 91 91 } 92 92 … … 461 461 } 462 462 463 ConfigFileManager *ConfigFileManager::getInstance()463 ConfigFileManager& ConfigFileManager::getInstance() 464 464 { 465 465 static ConfigFileManager instance; 466 return (&instance);466 return instance; 467 467 } 468 468 -
code/trunk/src/core/ConfigFileManager.h
r1784 r1795 44 44 { 45 45 CFT_Settings, 46 CFT_Keybindings 46 CFT_Keybindings, 47 CFT_JoyStickCalibration, 48 CFT_KeyNames 47 49 }; 48 50 … … 256 258 { 257 259 public: 258 static ConfigFileManager *getInstance();260 static ConfigFileManager& getInstance(); 259 261 260 262 void setFile(ConfigFileType type, const std::string& filename, bool bCreateIfNotExisting = true); -
code/trunk/src/core/ConfigValueContainer.cc
r1791 r1795 83 83 for (unsigned int i = 0; i < this->valueVector_.size(); i++) 84 84 { 85 ConfigFileManager::getInstance() ->getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));85 ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string)); 86 86 this->defvalueStringVector_.push_back(this->valueVector_[i]); 87 87 } … … 114 114 if (this->tset(input)) 115 115 { 116 ConfigFileManager::getInstance() ->setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_string));116 ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_string)); 117 117 return true; 118 118 } … … 133 133 if (this->tset(index, input)) 134 134 { 135 ConfigFileManager::getInstance() ->setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_string));135 ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_string)); 136 136 return true; 137 137 } … … 233 233 this->valueVector_.erase(this->valueVector_.begin() + index); 234 234 for (unsigned int i = index; i < this->valueVector_.size(); i++) 235 ConfigFileManager::getInstance() ->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));236 ConfigFileManager::getInstance() ->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size());235 ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string)); 236 ConfigFileManager::getInstance().deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size()); 237 237 238 238 return true; … … 258 258 if (!this->set(i, this->defvalueStringVector_[i])) 259 259 success = false; 260 ConfigFileManager::getInstance() ->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->defvalueStringVector_.size());260 ConfigFileManager::getInstance().deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->defvalueStringVector_.size()); 261 261 return success; 262 262 } … … 269 269 { 270 270 if (!this->bIsVector_) 271 this->value_ = ConfigFileManager::getInstance() ->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_string));271 this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_string)); 272 272 else 273 273 { 274 274 this->valueVector_.clear(); 275 for (unsigned int i = 0; i < ConfigFileManager::getInstance() ->getVectorSize(this->type_, this->sectionname_, this->varname_); i++)275 for (unsigned int i = 0; i < ConfigFileManager::getInstance().getVectorSize(this->type_, this->sectionname_, this->varname_); i++) 276 276 { 277 277 if (i < this->defvalueStringVector_.size()) 278 278 { 279 this->value_ = ConfigFileManager::getInstance() ->getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_string));279 this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_string)); 280 280 } 281 281 else 282 282 { 283 this->value_ = ConfigFileManager::getInstance() ->getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_string));283 this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_string)); 284 284 } 285 285 -
code/trunk/src/core/input/KeyBinder.cc
r1755 r1795 39 39 #include "core/ConfigValueIncludes.h" 40 40 #include "core/CoreIncludes.h" 41 #include "core/ConfigFileManager.h" 41 42 #include "InputCommands.h" 42 43 … … 222 223 if (!infile) 223 224 { 224 ConfigFileManager::getInstance() ->setFile(CFT_Keybindings, "def_keybindings.ini");225 ConfigFileManager::getInstance() ->save(CFT_Keybindings, "keybindings.ini");225 ConfigFileManager::getInstance().setFile(CFT_Keybindings, "def_keybindings.ini"); 226 ConfigFileManager::getInstance().save(CFT_Keybindings, "keybindings.ini"); 226 227 } 227 228 else 228 229 infile.close(); 229 ConfigFileManager::getInstance() ->setFile(CFT_Keybindings, "keybindings.ini");230 ConfigFileManager::getInstance().setFile(CFT_Keybindings, "keybindings.ini"); 230 231 231 232 // parse key bindings -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r1792 r1795 98 98 { 99 99 #if ORXONOX_DEBUG_MODE == 1 100 ConfigFileManager::getInstance() ->setFile(CFT_Settings, "orxonox_d.ini");100 ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox_d.ini"); 101 101 #else 102 ConfigFileManager::getInstance() ->setFile(CFT_Settings, "orxonox.ini");102 ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox.ini"); 103 103 #endif 104 104
Note: See TracChangeset
for help on using the changeset viewer.