Fixed: #1146 Store last login in client.cfg instead of Registry
This commit is contained in:
parent
90fa3ed97c
commit
dcb9e859c6
3 changed files with 24 additions and 19 deletions
|
@ -1480,6 +1480,8 @@ void CClientConfig::setValues()
|
|||
// DebugStringManager
|
||||
READ_BOOL_DEV(DebugStringManager)
|
||||
|
||||
// LastLogin
|
||||
READ_STRING_FV(LastLogin)
|
||||
|
||||
//////////////
|
||||
// VERBOSES //
|
||||
|
@ -2037,11 +2039,11 @@ bool CClientConfig::readBool (const std::string &varName)
|
|||
return bVal;
|
||||
}
|
||||
|
||||
void CClientConfig::writeBool (const std::string &varName, bool bVal)
|
||||
void CClientConfig::writeBool (const std::string &varName, bool bVal, bool bForce)
|
||||
{
|
||||
CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
|
||||
CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
|
||||
if(varPtr)
|
||||
varPtr->forceAsInt(bVal);
|
||||
varPtr->forceAsInt(bVal ? 1:0);
|
||||
else
|
||||
nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
|
||||
}
|
||||
|
@ -2057,9 +2059,9 @@ sint32 CClientConfig::readInt (const std::string &varName)
|
|||
return bVal;
|
||||
}
|
||||
|
||||
void CClientConfig::writeInt (const std::string &varName, sint32 bVal)
|
||||
void CClientConfig::writeInt (const std::string &varName, sint32 bVal, bool bForce)
|
||||
{
|
||||
CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
|
||||
CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
|
||||
if(varPtr)
|
||||
varPtr->forceAsInt(bVal);
|
||||
else
|
||||
|
@ -2077,11 +2079,11 @@ double CClientConfig::readDouble (const std::string &varName)
|
|||
return bVal;
|
||||
}
|
||||
|
||||
void CClientConfig::writeDouble (const std::string &varName, double bVal)
|
||||
void CClientConfig::writeDouble (const std::string &varName, double dVal, bool bForce)
|
||||
{
|
||||
CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
|
||||
CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
|
||||
if(varPtr)
|
||||
varPtr->forceAsDouble(bVal);
|
||||
varPtr->forceAsDouble(dVal);
|
||||
else
|
||||
nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
|
||||
}
|
||||
|
@ -2097,11 +2099,11 @@ string CClientConfig::readString (const std::string &varName)
|
|||
return sVal;
|
||||
}
|
||||
|
||||
void CClientConfig::writeString (const std::string &varName, const std::string &bVal)
|
||||
void CClientConfig::writeString (const std::string &varName, const std::string &strVal, bool bForce)
|
||||
{
|
||||
CConfigFile::CVar *varPtr = ConfigFile.getVarPtr(varName);
|
||||
CConfigFile::CVar *varPtr = bForce ? ConfigFile.insertVar(varName, CConfigFile::CVar()):ConfigFile.getVarPtr(varName);
|
||||
if(varPtr)
|
||||
varPtr->forceAsString(bVal);
|
||||
varPtr->forceAsString(strVal);
|
||||
else
|
||||
nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
|
||||
}
|
||||
|
|
|
@ -622,6 +622,8 @@ struct CClientConfig
|
|||
bool PreCacheShapes;
|
||||
bool ResetShapeBankOnRetCharSelect;
|
||||
|
||||
std::string LastLogin;
|
||||
|
||||
uint32 SimulatePacketLossRatio;
|
||||
|
||||
// Parameters for colors of messages in system info
|
||||
|
@ -810,12 +812,12 @@ public:
|
|||
void release ();
|
||||
|
||||
bool readBool (const std::string &varName);
|
||||
void writeBool (const std::string &varName, bool val);
|
||||
void writeBool (const std::string &varName, bool val, bool bForce = false);
|
||||
sint32 readInt (const std::string &varName);
|
||||
void writeInt (const std::string &varName, sint32 val);
|
||||
void writeInt (const std::string &varName, sint32 val, bool bForce = false);
|
||||
double readDouble (const std::string &varName);
|
||||
void writeDouble (const std::string &varName, double val);
|
||||
void writeString (const std::string &varName, const std::string &bVal);
|
||||
void writeDouble (const std::string &varName, double val, bool bForce = false);
|
||||
void writeString (const std::string &varName, const std::string &bVal, bool bForce = false);
|
||||
|
||||
// return 0 / false if not succeed
|
||||
bool readBoolNoWarning (const std::string &varName);
|
||||
|
|
|
@ -733,9 +733,7 @@ void initLoginScreen()
|
|||
|
||||
ClientApp = ClientCfg.ConfigFile.getVar("Application").asString(0);
|
||||
|
||||
CSystemUtils::setRootKey("Software\\Nevrax\\Ryzom");
|
||||
|
||||
string l = CSystemUtils::getRegKey("Login");
|
||||
string l = ClientCfg.LastLogin;
|
||||
|
||||
if(!l.empty())
|
||||
{
|
||||
|
@ -1106,7 +1104,10 @@ void onlogin(bool vanishScreen = true)
|
|||
removeSpace(LoginPassword);
|
||||
|
||||
if(!LoginLogin.empty())
|
||||
CSystemUtils::setRegKey("Login", LoginLogin);
|
||||
{
|
||||
ClientCfg.LastLogin = LoginLogin;
|
||||
ClientCfg.writeString("LastLogin", ClientCfg.LastLogin, true);
|
||||
}
|
||||
|
||||
if(vanishScreen)
|
||||
pIM->getDbProp("UI:VARIABLES:SCREEN")->setValue32(-1);
|
||||
|
|
Loading…
Reference in a new issue