summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikaƫl Capelle <capelle.mikael@gmail.com>2021-01-18 21:16:55 +0100
committerGitHub <noreply@github.com>2021-01-18 21:16:55 +0100
commit339457f79d802070c36d8cc95f286b941455e789 (patch)
tree45c47f12bea9e6cb81537b9a10fd1e9135799303 /src
parentee44a38c986d953a19cbb37b0297590844cf54ac (diff)
parent4c64448947e624fa0a8e7025499cb889d272d232 (diff)
Merge pull request #1366 from LostDragonist/mod_casing
Make modlist.txt less case sensitive
Diffstat (limited to 'src')
-rw-r--r--src/modinfo.cpp2
-rw-r--r--src/modinfo.h3
-rw-r--r--src/profile.cpp18
3 files changed, 21 insertions, 2 deletions
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index b46a68ab..59026262 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -52,7 +52,7 @@ using namespace MOShared;
const std::set<unsigned int> ModInfo::s_EmptySet;
std::vector<ModInfo::Ptr> ModInfo::s_Collection;
ModInfo::Ptr ModInfo::s_Overwrite;
-std::map<QString, unsigned int> ModInfo::s_ModsByName;
+std::map<QString, unsigned int, MOBase::FileNameComparator> ModInfo::s_ModsByName;
std::map<std::pair<QString, int>, std::vector<unsigned int>> ModInfo::s_ModsByModID;
int ModInfo::s_NextID;
QMutex ModInfo::s_Mutex(QMutex::Recursive);
diff --git a/src/modinfo.h b/src/modinfo.h
index 634ea900..c9b74a66 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -21,6 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define MODINFO_H
#include "imodinterface.h"
+#include "ifiletree.h"
#include "versioninfo.h"
class OrganizerCore;
@@ -989,7 +990,7 @@ protected:
static QMutex s_Mutex;
static std::vector<ModInfo::Ptr> s_Collection;
static ModInfo::Ptr s_Overwrite;
- static std::map<QString, unsigned int> s_ModsByName;
+ static std::map<QString, unsigned int, MOBase::FileNameComparator> s_ModsByName;
static std::map<std::pair<QString, int>, std::vector<unsigned int>> s_ModsByModID;
static int s_NextID;
diff --git a/src/profile.cpp b/src/profile.cpp
index 695cd3ae..029265e2 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -381,6 +381,8 @@ void Profile::refreshModStatus()
std::set<QString> namesRead;
+ bool warnAboutOverwrite = false;
+
// load mods from file and update enabled state and priority for them
int index = 0;
while (!file.atEnd()) {
@@ -404,6 +406,9 @@ void Profile::refreshModStatus()
}
if (modName.size() > 0) {
QString lookupName = modName;
+ if (modName.compare("overwrite", Qt::CaseInsensitive) == 0) {
+ warnAboutOverwrite = true;
+ }
if (namesRead.find(lookupName) != namesRead.end()) {
continue;
} else {
@@ -485,6 +490,19 @@ void Profile::refreshModStatus()
file.close();
updateIndices();
+
+ // User has a mod named some variation of "overwrite". Tell them about it.
+ if (warnAboutOverwrite) {
+ QMessageBox::warning(
+ nullptr,
+ tr("Overwrite mod conflict"),
+ tr("At least one mod named \"overwrite\" was detected, disabled, and moved to the lowest priority on the mod list. "
+ "You may want to rename this mod and enable it again.")
+ );
+ // also, mark the mod-list as changed
+ modStatusModified = true;
+ }
+
if (modStatusModified) {
m_ModListWriter.write();
}