Fixed: #1146 Store last login in client.cfg instead of Registry

This commit is contained in:
kervala 2010-10-30 17:56:38 +02:00
parent 14014cd35a
commit 10900c93be
3 changed files with 24 additions and 19 deletions

View file

@ -1480,6 +1480,8 @@ void CClientConfig::setValues()
// DebugStringManager // DebugStringManager
READ_BOOL_DEV(DebugStringManager) READ_BOOL_DEV(DebugStringManager)
// LastLogin
READ_STRING_FV(LastLogin)
////////////// //////////////
// VERBOSES // // VERBOSES //
@ -2037,11 +2039,11 @@ bool CClientConfig::readBool (const std::string &varName)
return bVal; 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) if(varPtr)
varPtr->forceAsInt(bVal); varPtr->forceAsInt(bVal ? 1:0);
else else
nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
} }
@ -2057,9 +2059,9 @@ sint32 CClientConfig::readInt (const std::string &varName)
return bVal; 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) if(varPtr)
varPtr->forceAsInt(bVal); varPtr->forceAsInt(bVal);
else else
@ -2077,11 +2079,11 @@ double CClientConfig::readDouble (const std::string &varName)
return bVal; 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) if(varPtr)
varPtr->forceAsDouble(bVal); varPtr->forceAsDouble(dVal);
else else
nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
} }
@ -2097,11 +2099,11 @@ string CClientConfig::readString (const std::string &varName)
return sVal; 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) if(varPtr)
varPtr->forceAsString(bVal); varPtr->forceAsString(strVal);
else else
nlwarning("CFG: Default value used for '%s' !!!",varName.c_str()); nlwarning("CFG: Default value used for '%s' !!!",varName.c_str());
} }

View file

@ -622,6 +622,8 @@ struct CClientConfig
bool PreCacheShapes; bool PreCacheShapes;
bool ResetShapeBankOnRetCharSelect; bool ResetShapeBankOnRetCharSelect;
std::string LastLogin;
uint32 SimulatePacketLossRatio; uint32 SimulatePacketLossRatio;
// Parameters for colors of messages in system info // Parameters for colors of messages in system info
@ -810,12 +812,12 @@ public:
void release (); void release ();
bool readBool (const std::string &varName); 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); 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); double readDouble (const std::string &varName);
void writeDouble (const std::string &varName, double val); void writeDouble (const std::string &varName, double val, bool bForce = false);
void writeString (const std::string &varName, const std::string &bVal); void writeString (const std::string &varName, const std::string &bVal, bool bForce = false);
// return 0 / false if not succeed // return 0 / false if not succeed
bool readBoolNoWarning (const std::string &varName); bool readBoolNoWarning (const std::string &varName);

View file

@ -733,9 +733,7 @@ void initLoginScreen()
ClientApp = ClientCfg.ConfigFile.getVar("Application").asString(0); ClientApp = ClientCfg.ConfigFile.getVar("Application").asString(0);
CSystemUtils::setRootKey("Software\\Nevrax\\Ryzom"); string l = ClientCfg.LastLogin;
string l = CSystemUtils::getRegKey("Login");
if(!l.empty()) if(!l.empty())
{ {
@ -1106,7 +1104,10 @@ void onlogin(bool vanishScreen = true)
removeSpace(LoginPassword); removeSpace(LoginPassword);
if(!LoginLogin.empty()) if(!LoginLogin.empty())
CSystemUtils::setRegKey("Login", LoginLogin); {
ClientCfg.LastLogin = LoginLogin;
ClientCfg.writeString("LastLogin", ClientCfg.LastLogin, true);
}
if(vanishScreen) if(vanishScreen)
pIM->getDbProp("UI:VARIABLES:SCREEN")->setValue32(-1); pIM->getDbProp("UI:VARIABLES:SCREEN")->setValue32(-1);