Ticket #953: Ticket#953.patch
File Ticket#953.patch, 3.2 KB (added by , 13 years ago) |
---|
-
ConfigDB.cpp
364 364 365 365 // Read file line by line 366 366 char *next=filebuf-1; 367 367 368 do 368 369 { 369 370 char *pos=next+1; … … 395 396 continue; 396 397 CConfigValue argument; 397 398 argument.m_String = value; 398 newMap[name].push_back( argument ); 399 LOGMESSAGE(L"Loaded config string \"%hs\" = \"%hs\"", name.c_str(), value.c_str()); 399 400 // Try to insert into set of used values if value already exist, skip it. 401 // Shift and Ctrl can be used at more places at once. 402 if (name.compare(0, 6, "hotkey") == 0 && value.compare(0, 5, "Shift") != 0 && 403 value.compare(0, 4, "Ctrl") != 0 && !usedKeys.insert(value).second) 404 { 405 LOGMESSAGE(L"Loaded config string \"%hs\" = \"%hs\" is already used", name.c_str(), value.c_str()); 406 } 407 else 408 { 409 newMap[name].push_back( argument ); 410 LOGMESSAGE(L"Loaded config string \"%hs\" = \"%hs\"", name.c_str(), value.c_str()); 411 } 400 412 } 401 413 } 402 414 } 403 415 while (next < filebufend); 404 416 405 417 m_Map[ns].swap(newMap); 406 418 407 419 return true; … … 445 457 446 458 return true; 447 459 } 460 461 void CConfigDB::ClearUsedSet() 462 { 463 usedKeys.clear(); 464 } 465 -
ConfigDB.h
78 78 { 79 79 static std::map <CStr, CConfigValueSet> m_Map[]; 80 80 static VfsPath m_ConfigFile[]; 81 std::set<std::string> usedKeys; 81 82 82 83 public: 83 84 // NOTE: Construct the Singleton Object *after* JavaScript init, so that … … 162 163 * false: if an error occurred 163 164 */ 164 165 bool WriteFile(EConfigNamespace ns); 166 167 /** 168 *Clear used set afret finishing using of it 169 *Call after using the last call of Reload function 170 * 171 * Returns: 172 * none 173 */ 174 void ClearUsedSet(); 165 175 }; 166 176 167 177 -
GameSetup/Config.cpp
157 157 158 158 new CConfigDB; 159 159 160 // Load the global, default config file 161 g_ConfigDB.SetConfigFile(CFG_DEFAULT, L"config/default.cfg"); 162 g_ConfigDB.Reload(CFG_DEFAULT); // 216ms 160 g_ConfigDB.SetConfigFile(CFG_MOD, L"config/mod.cfg"); 161 // No point in reloading mod.cfg here - we haven't mounted mods yet 162 163 g_ConfigDB.SetConfigFile(CFG_USER, L"config/user.cfg"); 164 g_ConfigDB.Reload(CFG_USER); 165 163 166 // Try loading the local system config file (which doesn't exist by 164 167 // default) - this is designed as a way of letting developers edit the 165 168 // system config without accidentally committing their changes back to SVN. 166 169 g_ConfigDB.SetConfigFile(CFG_SYSTEM, L"config/local.cfg"); 167 170 g_ConfigDB.Reload(CFG_SYSTEM); 168 171 169 g_ConfigDB.SetConfigFile(CFG_USER, L"config/user.cfg"); 170 g_ConfigDB.Reload(CFG_USER); 172 // Load the global, default config file 173 g_ConfigDB.SetConfigFile(CFG_DEFAULT, L"config/default.cfg"); 174 g_ConfigDB.Reload(CFG_DEFAULT); // 216ms 175 g_ConfigDB.ClearUsedSet(); 171 176 172 g_ConfigDB.SetConfigFile(CFG_MOD, L"config/mod.cfg");173 // No point in reloading mod.cfg here - we haven't mounted mods yet174 175 177 ProcessCommandLineArgs(args); 176 178 177 179 // Initialise console history file