From 80136c1e51902d4c63264730e26a7b4aff35e829 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 7 Nov 2013 12:58:35 +0100 Subject: DEVTOOLS: Make create_project sort SCUMM as first engine. This makes create_project output consistent with configure output again. --- devtools/create_project/create_project.cpp | 35 ++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'devtools/create_project/create_project.cpp') diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 3eba36e235..16b8e1d166 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -674,6 +674,19 @@ EngineDescList parseEngineConfigure(const std::string &engineDir); * the name of the second operand. "false" otherwise. */ bool compareFSNode(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right); + +#ifdef FIRST_ENGINE +/** + * Compares two FSNode entries in a strict-weak fashion based on engine name + * order. + * + * @param left The first operand. + * @param right The second operand. + * @return "true" when the name of the left operand is strictly smaller than + * the name of the second operand. "false" otherwise. + */ +bool compareEngineNames(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right); +#endif } // End of anonymous namespace EngineDescList parseEngines(const std::string &srcDir) { @@ -684,9 +697,15 @@ EngineDescList parseEngines(const std::string &srcDir) { FileList engineFiles = listDirectory(srcDir + "/engines/"); - // Sort file list alphabetically this allows for a nicer order in - // --list-engines output, for example. +#ifdef FIRST_ENGINE + // In case we want to sort an engine to the front of the list we will + // use some manual sorting predicate which assures that. + engineFiles.sort(&compareEngineNames); +#else + // Otherwise, we simply sort the file list alphabetically this allows + // for a nicer order in --list-engines output, for example. engineFiles.sort(&compareFSNode); +#endif for (FileList::const_iterator i = engineFiles.begin(), end = engineFiles.end(); i != end; ++i) { // Each engine requires its own sub directory thus we will skip all @@ -833,6 +852,18 @@ EngineDescList parseEngineConfigure(const std::string &engineDir) { bool compareFSNode(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right) { return left.name < right.name; } + +#ifdef FIRST_ENGINE +bool compareEngineNames(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right) { + if (left.name == FIRST_ENGINE) { + return right.name != FIRST_ENGINE; + } else if (right.name == FIRST_ENGINE) { + return false; + } else { + return compareFSNode(left, right); + } +} +#endif } // End of anonymous namespace TokenList tokenize(const std::string &input, char separator) { -- cgit v1.2.3