From 02d3f8182984c86b6a1e778e9f32a118f6fe02fe Mon Sep 17 00:00:00 2001 From: Silarn Date: Mon, 7 May 2018 01:29:00 -0500 Subject: Changes to allow installer_NCC to use the game source set in the DL meta --- src/installationmanager.cpp | 2 +- src/organizercore.cpp | 9 +++++++++ src/organizercore.h | 1 + src/organizerproxy.cpp | 5 +++++ src/organizerproxy.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index b7ec3d68..d1922cf9 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -819,7 +819,7 @@ bool InstallationManager::install(const QString &fileName, = installerCustom->supportedExtensions(); if (installerExt.find(fileInfo.suffix()) != installerExt.end()) { installResult - = installerCustom->install(modName, fileName, version, modID); + = installerCustom->install(modName, gameName, fileName, version, modID); unsigned int idx = ModInfo::getIndex(modName); if (idx != UINT_MAX) { ModInfo::Ptr info = ModInfo::getByIndex(idx); diff --git a/src/organizercore.cpp b/src/organizercore.cpp index d1b1fcd7..35486f98 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -789,6 +789,15 @@ MOBase::IModInterface *OrganizerCore::getMod(const QString &name) const return index == UINT_MAX ? nullptr : ModInfo::getByIndex(index).data(); } +MOBase::IPluginGame *OrganizerCore::getGame(const QString &name) const +{ + for (IPluginGame *game : m_PluginContainer->plugins()) { + if (game->gameShortName().compare(name, Qt::CaseInsensitive) == 0) + return game; + } + return nullptr; +} + MOBase::IModInterface *OrganizerCore::createMod(GuessedValue &name) { bool merge = false; diff --git a/src/organizercore.h b/src/organizercore.h index 76c286be..28ecef48 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -184,6 +184,7 @@ public: QString basePath() const; MOBase::VersionInfo appVersion() const; MOBase::IModInterface *getMod(const QString &name) const; + MOBase::IPluginGame *getGame(const QString &gameName) const; MOBase::IModInterface *createMod(MOBase::GuessedValue &name); bool removeMod(MOBase::IModInterface *mod); void modDataChanged(MOBase::IModInterface *mod); diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 77d61a52..8e0bc95b 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -60,6 +60,11 @@ IModInterface *OrganizerProxy::getMod(const QString &name) const return m_Proxied->getMod(name); } +IPluginGame *OrganizerProxy::getGame(const QString &gameName) const +{ + return m_Proxied->getGame(gameName); +} + IModInterface *OrganizerProxy::createMod(MOBase::GuessedValue &name) { return m_Proxied->createMod(name); diff --git a/src/organizerproxy.h b/src/organizerproxy.h index cebb98ac..b8eb9b82 100644 --- a/src/organizerproxy.h +++ b/src/organizerproxy.h @@ -22,6 +22,7 @@ public: virtual QString basePath() const; virtual MOBase::VersionInfo appVersion() const; virtual MOBase::IModInterface *getMod(const QString &name) const; + virtual MOBase::IPluginGame *getGame(const QString &gameName) const; virtual MOBase::IModInterface *createMod(MOBase::GuessedValue &name); virtual bool removeMod(MOBase::IModInterface *mod); virtual void modDataChanged(MOBase::IModInterface *mod); -- cgit v1.3.1