From c56825758fb5ef6cf0094296b16be717c29c4665 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 30 May 2013 01:50:27 +0300 Subject: Prevent losing per server settings. Prevent losing per server settings if partially connect to server and save settings. --- src/client.cpp | 1 + src/configuration.cpp | 10 ++++++++++ src/configuration.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/client.cpp b/src/client.cpp index ceff605ff..4fcfaa081 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1707,6 +1707,7 @@ int Client::gameExec() Net::getGameHandler()->disconnect(); Net::getGameHandler()->clear(); mServerName.clear(); + serverConfig.unload(); mState = STATE_CHOOSE_SERVER; BLOCK_END("Client::gameExec STATE_SWITCH_SERVER") diff --git a/src/configuration.cpp b/src/configuration.cpp index ca2281a71..66615d12d 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -367,6 +367,16 @@ Configuration::~Configuration() cleanDefaults(); } +void Configuration::unload() +{ + cleanDefaults(); + mConfigPath.clear(); + mDirectory.clear(); + mFilename.clear(); + mUseResManager = false; + ConfigurationObject::clear(); +} + void Configuration::setDefaultValues(DefaultsData *const defaultsData) { cleanDefaults(); diff --git a/src/configuration.h b/src/configuration.h index f2215147b..d14171dbb 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -251,6 +251,8 @@ class Configuration final : public ConfigurationObject void reInit(); + void unload(); + /** * Set the default values for each keys. * -- cgit v1.2.3-70-g09d2