mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Override launcher file info with higher priority info
This commit is contained in:
parent
a0c0509e3f
commit
521394d67b
@ -121,6 +121,7 @@
|
|||||||
Bug #7712: Casting doesn't support spells and enchantments with no effects
|
Bug #7712: Casting doesn't support spells and enchantments with no effects
|
||||||
Bug #7723: Assaulting vampires and werewolves shouldn't be a crime
|
Bug #7723: Assaulting vampires and werewolves shouldn't be a crime
|
||||||
Bug #7724: Guards don't help vs werewolves
|
Bug #7724: Guards don't help vs werewolves
|
||||||
|
Bug #7733: Launcher shows incorrect data paths when there's two plugins with the same name
|
||||||
Bug #7742: Governing attribute training limit should use the modified attribute
|
Bug #7742: Governing attribute training limit should use the modified attribute
|
||||||
Bug #7758: Water walking is not taken into account to compute path cost on the water
|
Bug #7758: Water walking is not taken into account to compute path cost on the water
|
||||||
Bug #7761: Rain and ambient loop sounds are mutually exclusive
|
Bug #7761: Rain and ambient loop sounds are mutually exclusive
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "esmfile.hpp"
|
#include "esmfile.hpp"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
@ -447,26 +448,37 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
|
|||||||
{
|
{
|
||||||
QFileInfo info(dir.absoluteFilePath(path2));
|
QFileInfo info(dir.absoluteFilePath(path2));
|
||||||
|
|
||||||
if (item(info.fileName()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Enabled by default in system openmw.cfg; shouldn't be shown in content list.
|
// Enabled by default in system openmw.cfg; shouldn't be shown in content list.
|
||||||
if (info.fileName().compare("builtin.omwscripts", Qt::CaseInsensitive) == 0)
|
if (info.fileName().compare("builtin.omwscripts", Qt::CaseInsensitive) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
EsmFile* file = const_cast<EsmFile*>(item(info.fileName()));
|
||||||
|
bool add = file == nullptr;
|
||||||
|
std::unique_ptr<EsmFile> newFile;
|
||||||
|
if (add)
|
||||||
|
{
|
||||||
|
newFile = std::make_unique<EsmFile>(path2);
|
||||||
|
file = newFile.get();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We've found the same file in a higher priority dir, update our existing entry
|
||||||
|
file->setFileName(path2);
|
||||||
|
file->setGameFiles({});
|
||||||
|
}
|
||||||
|
|
||||||
if (info.fileName().endsWith(".omwscripts", Qt::CaseInsensitive))
|
if (info.fileName().endsWith(".omwscripts", Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
EsmFile* file = new EsmFile(path2);
|
|
||||||
file->setDate(info.lastModified());
|
file->setDate(info.lastModified());
|
||||||
file->setFilePath(info.absoluteFilePath());
|
file->setFilePath(info.absoluteFilePath());
|
||||||
addFile(file);
|
if (add)
|
||||||
|
addFile(newFile.release());
|
||||||
setNew(file->fileName(), newfiles);
|
setNew(file->fileName(), newfiles);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EsmFile* file = new EsmFile(path2);
|
|
||||||
file->setDate(info.lastModified());
|
file->setDate(info.lastModified());
|
||||||
file->setFilePath(info.absoluteFilePath());
|
file->setFilePath(info.absoluteFilePath());
|
||||||
std::filesystem::path filepath = Files::pathFromQString(info.absoluteFilePath());
|
std::filesystem::path filepath = Files::pathFromQString(info.absoluteFilePath());
|
||||||
@ -522,14 +534,14 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Put the file in the table
|
// Put the file in the table
|
||||||
addFile(file);
|
if (add)
|
||||||
|
addFile(newFile.release());
|
||||||
setNew(file->fileName(), newfiles);
|
setNew(file->fileName(), newfiles);
|
||||||
}
|
}
|
||||||
catch (std::runtime_error& e)
|
catch (std::runtime_error& e)
|
||||||
{
|
{
|
||||||
// An error occurred while reading the .esp
|
// An error occurred while reading the .esp
|
||||||
qWarning() << "Error reading addon file: " << e.what();
|
qWarning() << "Error reading addon file: " << e.what();
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,11 @@ namespace ContentSelectorModel
|
|||||||
};
|
};
|
||||||
|
|
||||||
EsmFile(const QString& fileName = QString(), ModelItem* parent = nullptr);
|
EsmFile(const QString& fileName = QString(), ModelItem* parent = nullptr);
|
||||||
// EsmFile(const EsmFile &);
|
|
||||||
|
|
||||||
~EsmFile() {}
|
|
||||||
|
|
||||||
void setFileProperty(const FileProperty prop, const QString& value);
|
void setFileProperty(const FileProperty prop, const QString& value);
|
||||||
|
|
||||||
void setFileName(const QString& fileName);
|
void setFileName(const QString& fileName);
|
||||||
void setAuthor(const QString& author);
|
void setAuthor(const QString& author);
|
||||||
void setSize(const int size);
|
|
||||||
void setDate(const QDateTime& modified);
|
void setDate(const QDateTime& modified);
|
||||||
void setFormat(const QString& format);
|
void setFormat(const QString& format);
|
||||||
void setFilePath(const QString& path);
|
void setFilePath(const QString& path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user