1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 23:23:52 +00:00

Merge pull request #103 from OpenMW/master

Add OpenMW commits up to 13 Nov
This commit is contained in:
David Cernat 2016-11-14 14:08:16 +02:00 committed by GitHub
commit 8d2793401e
6 changed files with 29 additions and 29 deletions

View file

@ -324,10 +324,10 @@ bool Launcher::MainDialog::setupGameSettings()
paths.append(localPath + QString("openmw.cfg")); paths.append(localPath + QString("openmw.cfg"));
paths.append(userPath + QString("openmw.cfg")); paths.append(userPath + QString("openmw.cfg"));
foreach (const QString &path, paths) { foreach (const QString &path2, paths) {
qDebug() << "Loading config file:" << path.toUtf8().constData(); qDebug() << "Loading config file:" << path2.toUtf8().constData();
file.setFileName(path); file.setFileName(path2);
if (file.exists()) { if (file.exists()) {
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
cfgError(tr("Error opening OpenMW configuration file"), cfgError(tr("Error opening OpenMW configuration file"),
@ -347,13 +347,13 @@ bool Launcher::MainDialog::setupGameSettings()
QStringList dataDirs; QStringList dataDirs;
// Check if the paths actually contain data files // Check if the paths actually contain data files
foreach (const QString path, mGameSettings.getDataDirs()) { foreach (const QString path3, mGameSettings.getDataDirs()) {
QDir dir(path); QDir dir(path3);
QStringList filters; QStringList filters;
filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon"; filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon";
if (!dir.entryList(filters).isEmpty()) if (!dir.entryList(filters).isEmpty())
dataDirs.append(path); dataDirs.append(path3);
} }
if (dataDirs.isEmpty()) if (dataDirs.isEmpty())

View file

@ -99,7 +99,7 @@ namespace MWGui
line.mIcon->setUserString("ToolTipType", "ItemPtr"); line.mIcon->setUserString("ToolTipType", "ItemPtr");
line.mIcon->setUserData(line.mItemPtr); line.mIcon->setUserData(line.mItemPtr);
line.mIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemChargeView::onIconClicked); line.mIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemChargeView::onIconClicked);
line.mIcon->eventMouseWheel += MyGUI::newDelegate(this, &ItemChargeView::onMouseWheel); line.mIcon->eventMouseWheel += MyGUI::newDelegate(this, &ItemChargeView::onMouseWheelMoved);
line.mCharge = mScrollView->createWidget<Widgets::MWDynamicStat>("MW_ChargeBar", MyGUI::IntCoord(), MyGUI::Align::Default); line.mCharge = mScrollView->createWidget<Widgets::MWDynamicStat>("MW_ChargeBar", MyGUI::IntCoord(), MyGUI::Align::Default);
line.mCharge->setNeedMouseFocus(false); line.mCharge->setNeedMouseFocus(false);
@ -202,7 +202,7 @@ namespace MWGui
eventItemClicked(this, *sender->getUserData<MWWorld::Ptr>()); eventItemClicked(this, *sender->getUserData<MWWorld::Ptr>());
} }
void ItemChargeView::onMouseWheel(MyGUI::Widget* /*sender*/, int rel) void ItemChargeView::onMouseWheelMoved(MyGUI::Widget* /*sender*/, int rel)
{ {
if (mScrollView->getViewOffset().top + rel*0.3f > 0) if (mScrollView->getViewOffset().top + rel*0.3f > 0)
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0)); mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));

View file

@ -64,7 +64,7 @@ namespace MWGui
void updateLine(const Line& line); void updateLine(const Line& line);
void onIconClicked(MyGUI::Widget* sender); void onIconClicked(MyGUI::Widget* sender);
void onMouseWheel(MyGUI::Widget* sender, int rel); void onMouseWheelMoved(MyGUI::Widget* sender, int rel);
typedef std::vector<Line> Lines; typedef std::vector<Line> Lines;
Lines mLines; Lines mLines;

View file

@ -2207,7 +2207,7 @@ namespace MWWorld
if (!actor) if (!actor)
throw std::runtime_error("can't find player"); throw std::runtime_error("can't find player");
if ((actor->getCollisionMode() && !mPhysics->isOnSolidGround(player)) || isUnderwater(currentCell, playerPos)) if ((actor->getCollisionMode() && !mPhysics->isOnSolidGround(player)) || isUnderwater(currentCell, playerPos) || isWalkingOnWater(player))
return 2; return 2;
if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) || player.getClass().getNpcStats(player).isWerewolf()) if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) || player.getClass().getNpcStats(player).isWerewolf())

View file

@ -162,10 +162,10 @@ void Wizard::MainWizard::setupGameSettings()
paths.append(QLatin1String("openmw.cfg")); paths.append(QLatin1String("openmw.cfg"));
paths.append(globalPath + QLatin1String("openmw.cfg")); paths.append(globalPath + QLatin1String("openmw.cfg"));
foreach (const QString &path, paths) { foreach (const QString &path2, paths) {
qDebug() << "Loading config file:" << path.toUtf8().constData(); qDebug() << "Loading config file:" << path2.toUtf8().constData();
file.setFileName(path); file.setFileName(path2);
if (file.exists()) { if (file.exists()) {
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox msgBox; QMessageBox msgBox;

View file

@ -110,26 +110,26 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
bool gamefileChecked = (file->gameFiles().count() == 0); bool gamefileChecked = (file->gameFiles().count() == 0);
foreach (const QString &fileName, file->gameFiles()) foreach (const QString &fileName, file->gameFiles())
{ {
foreach (EsmFile *dependency, mFiles) for (QListIterator<EsmFile *> dependencyIter(mFiles); dependencyIter.hasNext(); dependencyIter.next())
{ {
//compare filenames only. Multiple instances //compare filenames only. Multiple instances
//of the filename (with different paths) is not relevant here. //of the filename (with different paths) is not relevant here.
bool depFound = (dependency->fileName().compare(fileName, Qt::CaseInsensitive) == 0); bool depFound = (dependencyIter.peekNext()->fileName().compare(fileName, Qt::CaseInsensitive) == 0);
if (!depFound) if (!depFound)
continue; continue;
if (!gamefileChecked) if (!gamefileChecked)
{ {
if (isChecked (dependency->filePath())) if (isChecked (dependencyIter.peekNext()->filePath()))
gamefileChecked = (dependency->isGameFile()); gamefileChecked = (dependencyIter.peekNext()->isGameFile());
} }
// force it to iterate all files in cases where the current // force it to iterate all files in cases where the current
// dependency is a game file to ensure that a later duplicate // dependency is a game file to ensure that a later duplicate
// game file is / is not checked. // game file is / is not checked.
// (i.e., break only if it's not a gamefile or the game file has been checked previously) // (i.e., break only if it's not a gamefile or the game file has been checked previously)
if (gamefileChecked || !(dependency->isGameFile())) if (gamefileChecked || !(dependencyIter.peekNext()->isGameFile()))
break; break;
} }
} }
@ -283,12 +283,11 @@ bool ContentSelectorModel::ContentModel::setData(const QModelIndex &index, const
else else
return success; return success;
foreach (EsmFile *file2, mFiles)
foreach (EsmFile *file, mFiles)
{ {
if (file->gameFiles().contains(fileName, Qt::CaseInsensitive)) if (file2->gameFiles().contains(fileName, Qt::CaseInsensitive))
{ {
QModelIndex idx = indexFromItem(file); QModelIndex idx = indexFromItem(file2);
emit dataChanged(idx, idx); emit dataChanged(idx, idx);
} }
} }
@ -425,9 +424,9 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon"; filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon";
dir.setNameFilters(filters); dir.setNameFilters(filters);
foreach (const QString &path, dir.entryList()) foreach (const QString &path2, dir.entryList())
{ {
QFileInfo info(dir.absoluteFilePath(path)); QFileInfo info(dir.absoluteFilePath(path2));
if (item(info.absoluteFilePath()) != 0) if (item(info.absoluteFilePath()) != 0)
continue; continue;
@ -437,12 +436,13 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
ToUTF8::Utf8Encoder encoder = ToUTF8::Utf8Encoder encoder =
ToUTF8::calculateEncoding(mEncoding.toStdString()); ToUTF8::calculateEncoding(mEncoding.toStdString());
fileReader.setEncoder(&encoder); fileReader.setEncoder(&encoder);
fileReader.open(std::string(dir.absoluteFilePath(path).toUtf8().constData())); fileReader.open(std::string(dir.absoluteFilePath(path2).toUtf8().constData()));
EsmFile *file = new EsmFile(path); EsmFile *file = new EsmFile(path2);
foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles()) for (std::vector<ESM::Header::MasterData>::const_iterator itemIter = fileReader.getGameFiles().begin();
file->addGameFile(QString::fromUtf8(item.name.c_str())); itemIter != fileReader.getGameFiles().end(); ++itemIter)
file->addGameFile(QString::fromUtf8(itemIter->name.c_str()));
file->setAuthor (QString::fromUtf8(fileReader.getAuthor().c_str())); file->setAuthor (QString::fromUtf8(fileReader.getAuthor().c_str()));
file->setDate (info.lastModified()); file->setDate (info.lastModified());