From 576d56c7b5636cf95ac8eb1650949da6a26a1bd7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 3 Jan 2014 20:33:54 +0300 Subject: fix server config saving if select switch character or switch server. --- src/client.cpp | 1 + src/configuration.cpp | 3 +++ src/gui/windows/quitdialog.cpp | 1 + 3 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index f86365cc9..27c55dcee 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1705,6 +1705,7 @@ int Client::gameExec() Net::getGameHandler()->disconnect(); Net::getGameHandler()->clear(); mServerName.clear(); + serverConfig.write(); serverConfig.unload(); mState = STATE_CHOOSE_SERVER; diff --git a/src/configuration.cpp b/src/configuration.cpp index da6e97501..cb7adf8f1 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -801,6 +801,9 @@ void ConfigurationObject::writeToXML(const XmlTextWriterPtr writer) void Configuration::write() { + if (mConfigPath.empty()) + return; + // Do not attempt to write to file that cannot be opened for writing FILE *const testFile = fopen(mConfigPath.c_str(), "w"); if (!testFile) diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index 215987ffb..ff9f669b7 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -195,6 +195,7 @@ void QuitDialog::action(const gcn::ActionEvent &event) { Net::getCharServerHandler()->switchCharacter(); Game::closeDialogs(); + serverConfig.write(); } } } -- cgit v1.2.3-70-g09d2