From be0ca560161d147afe2916635bac37c088169db5 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 20 Dec 2014 20:07:22 +0000 Subject: [PATCH] Reversion-related fixes. To the settings window handling changes in a189a4670fa32a4ae2c2b8e6be1e66f2a24b6ad0, so that the fix for #199 can still function without the code refactoring. --- src/gui/main.cpp | 4 ++-- src/gui/settings.cpp | 4 ++-- src/gui/settings.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 64d33e1f..61193f9b 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -628,7 +628,7 @@ void Launcher::OnOpenSettings(wxCommandEvent& event) { GetWindowSizePos(_settings["windows"]["settings"], pos, size); } - SettingsFrame settings = SettingsFrame(this, translate("LOOT: Settings"), _settings, _games, _currentGame, pos, size); + SettingsFrame settings = SettingsFrame(this, translate("LOOT: Settings"), _settings, _games, _game, pos, size); BOOST_LOG_TRIVIAL(debug) << "Settings window opened."; settings.ShowModal(); @@ -648,7 +648,7 @@ void Launcher::OnOpenSettings(wxCommandEvent& event) { // Fill games list again. for (size_t i = 0, max = _games.size(); i < max; ++i) { wxMenuItem * item = GameMenu->AppendRadioItem(MENU_LowestDynamicGameID + i, FromUTF8(_games[i].Name())); - if (_games[_currentGame] == _games[i]) + if (*_game == _games[i]) item->Check(); if (_games[i].IsInstalled()) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index b23b6861..83354e9f 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -34,7 +34,7 @@ using namespace std; -SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings, std::vector& games, size_t currentGameIndex, wxPoint pos, wxSize size) : wxDialog(parent, wxID_ANY, title, pos, size, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), _settings(settings), _games(games), _currentGameIndex(currentGameIndex) { +SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings, std::vector& games, loot::Game * currentGame, wxPoint pos, wxSize size) : wxDialog(parent, wxID_ANY, title, pos, size, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), _settings(settings), _games(games), _currentGame(currentGame) { //Initialise drop-down list contents. wxString DebugVerbosity[] = { @@ -281,7 +281,7 @@ void SettingsFrame::OnGameSelect(wxListEvent& event) { || name == loot::Game(loot::Game::tes5).Name() || name == loot::Game(loot::Game::fo3).Name() || name == loot::Game(loot::Game::fonv).Name() - || event.GetIndex() == _currentGameIndex) { + || name == _currentGame->Name()) { removeBtn->Enable(false); } else { removeBtn->Enable(true); diff --git a/src/gui/settings.h b/src/gui/settings.h index 43e8a2f7..f9a3a373 100644 --- a/src/gui/settings.h +++ b/src/gui/settings.h @@ -33,7 +33,7 @@ class SettingsFrame : public wxDialog { public: - SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings, std::vector& games, size_t currentGameIndex, wxPoint pos, wxSize size); + SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings, std::vector& games, loot::Game * currentGame, wxPoint pos, wxSize size); void OnQuit(wxCommandEvent& event); void OnGameSelect(wxListEvent& event); @@ -55,7 +55,7 @@ private: YAML::Node& _settings; std::vector& _games; - size_t _currentGameIndex; + loot::Game * _currentGame; }; class GameEditDialog : public wxDialog {