From 90b78c544657bf0fc41d6b86276a0873060345b5 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 6 May 2018 15:51:03 +0200 Subject: ENGINES: Merge GameDescriptor and DetectedGame --- gui/editgamedialog.h | 2 -- gui/launcher.cpp | 4 ++-- gui/massadd.cpp | 9 +++++---- gui/massadd.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'gui') diff --git a/gui/editgamedialog.h b/gui/editgamedialog.h index 06a8514dd5..7c6a08eb3c 100644 --- a/gui/editgamedialog.h +++ b/gui/editgamedialog.h @@ -40,8 +40,6 @@ class StaticTextWidget; class EditTextWidget; class SaveLoadChooser; -Common::String addGameToConf(const GameDescriptor &result); - /* * A dialog that allows the user to edit a config game entry. * TODO: add widgets for some/all of the following diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 67a62ad61e..7a37a7d3be 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -562,14 +562,14 @@ bool LauncherDialog::doGameDetection(const Common::String &path) { // Display the candidates to the user and let her/him pick one StringArray list; for (idx = 0; idx < (int)candidates.size(); idx++) - list.push_back(candidates[idx].matchedGame.description); + list.push_back(candidates[idx].description); ChooserDialog dialog(_("Pick the game:")); dialog.setList(list); idx = dialog.runModal(); } if (0 <= idx && idx < (int)candidates.size()) { - const GameDescriptor &result = candidates[idx].matchedGame; + const DetectedGame &result = candidates[idx]; Common::String domain = EngineMan.createTargetForGame(result); diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 56b15ecfd7..8bc5a10720 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -117,13 +117,13 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir) } struct GameTargetLess { - bool operator()(const GameDescriptor &x, const GameDescriptor &y) const { + bool operator()(const DetectedGame &x, const DetectedGame &y) const { return x.preferredTarget.compareToIgnoreCase(y.preferredTarget) < 0; } }; struct GameDescLess { - bool operator()(const GameDescriptor &x, const GameDescriptor &y) const { + bool operator()(const DetectedGame &x, const DetectedGame &y) const { return x.description.compareToIgnoreCase(y.description) < 0; } }; @@ -142,7 +142,7 @@ void MassAddDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data // people who want to edit their config file by hand after a mass add. Common::sort(_games.begin(), _games.end(), GameTargetLess()); // Add all the detected games to the config - for (GameList::iterator iter = _games.begin(); iter != _games.end(); ++iter) { + for (DetectedGames::iterator iter = _games.begin(); iter != _games.end(); ++iter) { debug(1, " Added gameid '%s', desc '%s'\n", iter->gameId.c_str(), iter->description.c_str()); @@ -199,7 +199,8 @@ void MassAddDialog::handleTickle() { // However, we only add games which are not already in the config file. DetectedGames candidates = detectionResults.listRecognizedGames(); for (DetectedGames::const_iterator cand = candidates.begin(); cand != candidates.end(); ++cand) { - const GameDescriptor &result = cand->matchedGame; + const DetectedGame &result = *cand; + Common::String path = dir.getPath(); // Remove trailing slashes diff --git a/gui/massadd.h b/gui/massadd.h index b954c87161..b81a6046e2 100644 --- a/gui/massadd.h +++ b/gui/massadd.h @@ -51,7 +51,7 @@ public: private: Common::Stack _scanStack; - GameList _games; + DetectedGames _games; /** * Map each path occuring in the config file to the target(s) using that path. -- cgit v1.2.3