mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 07:36:16 +00:00
Changed: If char keys/icfg file does not exist, use shared keys/icfg file
--HG-- branch : develop
This commit is contained in:
parent
438d637f66
commit
42a7d602af
3 changed files with 57 additions and 7 deletions
|
@ -2511,7 +2511,12 @@ CCtrlButton *CGroupMap::addUserLandMark(const NLMISC::CVector2f &pos, const ucst
|
|||
// Save the config file each time a user landmark is created
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
uint8 currMode = pIM->getMode();
|
||||
pIM->saveConfig ("save/interface_" + PlayerSelectedFileName + ".icfg");
|
||||
std::string filename = "save/interface_" + PlayerSelectedFileName + ".icfg";
|
||||
if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_interface.icfg"))
|
||||
{
|
||||
filename = "save/shared_interface.icfg";
|
||||
}
|
||||
pIM->saveConfig (filename);
|
||||
if (currMode != pIM->getMode())
|
||||
{
|
||||
pIM->setMode(currMode);
|
||||
|
|
|
@ -1222,6 +1222,14 @@ void CInterfaceManager::loadKeys()
|
|||
// Load the user key file
|
||||
xmlFilesToParse.push_back (userKeyFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
string filename = "save/shared_keys.xml";
|
||||
if(CFile::fileExists(filename) && CFile::getFileSize(filename) > 0)
|
||||
{
|
||||
xmlFilesToParse.push_back(filename);
|
||||
}
|
||||
}
|
||||
// Load the default key (but don't replace existings bounds, see keys.xml "key_def_no_replace")
|
||||
xmlFilesToParse.push_back ("keys.xml");
|
||||
|
||||
|
@ -1240,7 +1248,11 @@ void CInterfaceManager::loadInterfaceConfig()
|
|||
if (ClientCfg.R2EDEnabled) // in R2ED mode the CEditor class deals with it
|
||||
return;
|
||||
|
||||
loadConfig ("save/interface_" + PlayerSelectedFileName + ".icfg"); // Invalidate coords of changed groups
|
||||
string filename = "save/interface_" + PlayerSelectedFileName + ".icfg";
|
||||
if (!CFile::fileExists(filename))
|
||||
filename = "save/shared_interface.icfg";
|
||||
|
||||
loadConfig(filename); // Invalidate coords of changed groups
|
||||
|
||||
_ConfigLoaded = true;
|
||||
}
|
||||
|
@ -1254,7 +1266,11 @@ void CInterfaceManager::uninitInGame0 ()
|
|||
{
|
||||
if (!ClientCfg.R2EDEnabled)
|
||||
{
|
||||
saveKeys ("save/keys_" + PlayerSelectedFileName + ".xml");
|
||||
string filename = "save/keys_" + PlayerSelectedFileName + ".xml";
|
||||
if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_keys.xml"))
|
||||
filename = "save/shared_keys.xml";
|
||||
|
||||
saveKeys(filename);
|
||||
}
|
||||
_KeysLoaded = false;
|
||||
}
|
||||
|
@ -1264,7 +1280,11 @@ void CInterfaceManager::uninitInGame0 ()
|
|||
{
|
||||
if (!ClientCfg.R2EDEnabled)
|
||||
{
|
||||
saveConfig ("save/interface_" + PlayerSelectedFileName + ".icfg");
|
||||
string filename = "save/interface_" + PlayerSelectedFileName + ".icfg";
|
||||
if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_interface.icfg"))
|
||||
filename = "save/shared_interface.icfg";
|
||||
|
||||
saveConfig(filename);
|
||||
}
|
||||
_ConfigLoaded = false;
|
||||
}
|
||||
|
|
|
@ -2149,6 +2149,14 @@ void CEditor::loadKeySet(const std::string &keySet)
|
|||
// Load the user key file
|
||||
xmlFilesToParse.push_back (userKeyFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string filename = "save/shared_" + keySet + ".xml";
|
||||
if (CFile::fileExists(filename) && CFile::getFileSize(filename) > 0)
|
||||
{
|
||||
xmlFilesToParse.push_back(filename);
|
||||
}
|
||||
}
|
||||
// Load the default key (but don't replace existings bounds, see keys.xml "key_def_no_replace")
|
||||
xmlFilesToParse.push_back (keySet + ".xml");
|
||||
|
||||
|
@ -2179,7 +2187,13 @@ void CEditor::saveCurrentKeySet()
|
|||
CHECK_EDITOR
|
||||
std::string prefix = getKeySetPrefix(getMode());
|
||||
if (prefix.empty()) return;
|
||||
getUI().saveKeys ("save/" + prefix + "_" + PlayerSelectedFileName + ".xml");
|
||||
|
||||
std::string filename = "save/" + prefix + "_" + PlayerSelectedFileName + ".xml";
|
||||
std::string sharedfile ="save/shared_" + prefix + ".xml";
|
||||
if (!CFile::fileExists(filename) && CFile::fileExists(sharedfile))
|
||||
filename = sharedfile;
|
||||
|
||||
getUI().saveKeys (filename);
|
||||
}
|
||||
|
||||
// *********************************************************************************************************
|
||||
|
@ -2844,7 +2858,12 @@ bool CEditor::loadUIConfig(const std::string &prefix)
|
|||
{
|
||||
//H_AUTO(R2_CEditor_loadUIConfig)
|
||||
CHECK_EDITOR
|
||||
return getUI().loadConfig("save/" + prefix + PlayerSelectedFileName + ".icfg");
|
||||
|
||||
std::string filename = "save/" + prefix + PlayerSelectedFileName + ".icfg";
|
||||
if (!CFile::fileExists(filename))
|
||||
filename = "save/shared_" + prefix + ".icfg";
|
||||
|
||||
return getUI().loadConfig(filename);
|
||||
}
|
||||
|
||||
// *********************************************************************************************************
|
||||
|
@ -2871,7 +2890,13 @@ void CEditor::saveUIConfig()
|
|||
}
|
||||
}
|
||||
}
|
||||
getUI().saveConfig("save/" + getUIPrefix(_Mode) + PlayerSelectedFileName + ".icfg");
|
||||
|
||||
std::string filename = "save/" + getUIPrefix(_Mode) + PlayerSelectedFileName + ".icfg";
|
||||
std::string sharedfile = "save/shared_" + getUIPrefix(_Mode) + ".icfg";
|
||||
if (!CFile::fileExists(filename) && CFile::fileExists(sharedfile))
|
||||
filename = sharedfile;
|
||||
|
||||
getUI().saveConfig(filename);
|
||||
}
|
||||
|
||||
// *********************************************************************************************************
|
||||
|
|
Loading…
Reference in a new issue