mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-18 05:11:42 +00:00
Changed: Used write* methods to write variables
This commit is contained in:
parent
44879f5d3f
commit
1bbb5fa822
1 changed files with 24 additions and 36 deletions
|
@ -1972,54 +1972,42 @@ void CClientConfig::release ()
|
||||||
// Do we have to save the cfg file ?
|
// Do we have to save the cfg file ?
|
||||||
if (ClientCfg.SaveConfig)
|
if (ClientCfg.SaveConfig)
|
||||||
{
|
{
|
||||||
// Driver still alive ?
|
// Save values
|
||||||
if (Driver && Driver->isActive ())
|
try
|
||||||
{
|
{
|
||||||
sint32 x, y;
|
CConfigFile::CVar *varPtr = NULL;
|
||||||
uint32 width, height;
|
|
||||||
|
|
||||||
Driver->getWindowPos(x, y);
|
// Driver still alive ?
|
||||||
Driver->getWindowSize(width, height);
|
if (Driver && Driver->isActive ())
|
||||||
|
|
||||||
// Save values
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
CConfigFile::CVar *varPtr = NULL;
|
sint32 x, y;
|
||||||
|
uint32 width, height;
|
||||||
|
|
||||||
|
Driver->getWindowPos(x, y);
|
||||||
|
Driver->getWindowSize(width, height);
|
||||||
|
|
||||||
// Are we in window mode ?
|
// Are we in window mode ?
|
||||||
if (ClientCfg.Windowed /* && !isWindowMaximized() */)
|
if (ClientCfg.Windowed /* && !isWindowMaximized() */)
|
||||||
{
|
{
|
||||||
// Save windows position
|
// Save windows position
|
||||||
varPtr = ClientCfg.ConfigFile.getVarPtr ("PositionX");
|
writeInt("PositionX", x);
|
||||||
if (varPtr)
|
writeInt("PositionY", y);
|
||||||
varPtr->forceAsInt (x);
|
|
||||||
varPtr = ClientCfg.ConfigFile.getVarPtr ("PositionY");
|
|
||||||
if (varPtr)
|
|
||||||
varPtr->forceAsInt (y);
|
|
||||||
|
|
||||||
// Save windows size
|
// Save windows size
|
||||||
varPtr = ClientCfg.ConfigFile.getVarPtr ("Width");
|
writeInt("Width", std::max((sint)width, 800));
|
||||||
if (varPtr)
|
writeInt("Height", std::max((sint)height, 600));
|
||||||
varPtr->forceAsInt (std::max((int)width, 800));
|
|
||||||
varPtr = ClientCfg.ConfigFile.getVarPtr ("Height");
|
|
||||||
if (varPtr)
|
|
||||||
varPtr->forceAsInt (std::max((int)height, 600));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save if in FPV or TPV.
|
|
||||||
varPtr = ClientCfg.ConfigFile.getVarPtr("FPV");
|
|
||||||
if(varPtr)
|
|
||||||
varPtr->forceAsInt((sint)ClientCfg.FPV);
|
|
||||||
|
|
||||||
// Save the camera distance
|
|
||||||
varPtr = ClientCfg.ConfigFile.getVarPtr("CameraDistance");
|
|
||||||
if(varPtr)
|
|
||||||
varPtr->forceAsDouble(ClientCfg.CameraDistance);
|
|
||||||
}
|
|
||||||
catch (Exception &e)
|
|
||||||
{
|
|
||||||
nlwarning ("Error while set config file variables : %s", e.what ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save if in FPV or TPV.
|
||||||
|
writeBool("FPV", ClientCfg.FPV);
|
||||||
|
|
||||||
|
// Save the camera distance
|
||||||
|
writeDouble("CameraDistance", ClientCfg.CameraDistance);
|
||||||
|
}
|
||||||
|
catch (Exception &e)
|
||||||
|
{
|
||||||
|
nlwarning ("Error while set config file variables : %s", e.what ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save it
|
// Save it
|
||||||
|
|
Loading…
Reference in a new issue