From fee39afe38e990ff78659748fc56f5c42cb46cb8 Mon Sep 17 00:00:00 2001 From: Allofich Date: Sun, 13 Nov 2016 18:27:02 +0900 Subject: [PATCH 1/3] Don't allow resting on water with water walking --- apps/openmw/mwworld/worldimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 625ef93a9..fce3d69db 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2183,7 +2183,7 @@ namespace MWWorld if (!actor) 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; if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) || player.getClass().getNpcStats(player).isWerewolf()) From 3420121c3fbbd3f18110b603d270a01ed44774fc Mon Sep 17 00:00:00 2001 From: Allofich Date: Sun, 13 Nov 2016 22:48:33 +0900 Subject: [PATCH 2/3] Fix shadowing warnings --- apps/launcher/maindialog.cpp | 12 +++---- apps/wizard/mainwizard.cpp | 6 ++-- .../contentselector/model/contentmodel.cpp | 32 +++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 15a1a5c2a..94e186db8 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -324,10 +324,10 @@ bool Launcher::MainDialog::setupGameSettings() paths.append(localPath + QString("openmw.cfg")); paths.append(userPath + QString("openmw.cfg")); - foreach (const QString &path, paths) { - qDebug() << "Loading config file:" << path.toUtf8().constData(); + foreach (const QString &path2, paths) { + qDebug() << "Loading config file:" << path2.toUtf8().constData(); - file.setFileName(path); + file.setFileName(path2); if (file.exists()) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { cfgError(tr("Error opening OpenMW configuration file"), @@ -347,13 +347,13 @@ bool Launcher::MainDialog::setupGameSettings() QStringList dataDirs; // Check if the paths actually contain data files - foreach (const QString path, mGameSettings.getDataDirs()) { - QDir dir(path); + foreach (const QString path3, mGameSettings.getDataDirs()) { + QDir dir(path3); QStringList filters; filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon"; if (!dir.entryList(filters).isEmpty()) - dataDirs.append(path); + dataDirs.append(path3); } if (dataDirs.isEmpty()) diff --git a/apps/wizard/mainwizard.cpp b/apps/wizard/mainwizard.cpp index fa934868b..7ef8761dd 100644 --- a/apps/wizard/mainwizard.cpp +++ b/apps/wizard/mainwizard.cpp @@ -162,10 +162,10 @@ void Wizard::MainWizard::setupGameSettings() paths.append(QLatin1String("openmw.cfg")); paths.append(globalPath + QLatin1String("openmw.cfg")); - foreach (const QString &path, paths) { - qDebug() << "Loading config file:" << path.toUtf8().constData(); + foreach (const QString &path2, paths) { + qDebug() << "Loading config file:" << path2.toUtf8().constData(); - file.setFileName(path); + file.setFileName(path2); if (file.exists()) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { QMessageBox msgBox; diff --git a/components/contentselector/model/contentmodel.cpp b/components/contentselector/model/contentmodel.cpp index 26f0a4806..a7ac29b46 100644 --- a/components/contentselector/model/contentmodel.cpp +++ b/components/contentselector/model/contentmodel.cpp @@ -110,26 +110,26 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index bool gamefileChecked = (file->gameFiles().count() == 0); foreach (const QString &fileName, file->gameFiles()) { - foreach (EsmFile *dependency, mFiles) + for (QListIterator dependencyIter(mFiles); dependencyIter.hasNext(); dependencyIter.next()) { //compare filenames only. Multiple instances //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) continue; if (!gamefileChecked) { - if (isChecked (dependency->filePath())) - gamefileChecked = (dependency->isGameFile()); + if (isChecked (dependencyIter.peekNext()->filePath())) + gamefileChecked = (dependencyIter.peekNext()->isGameFile()); } // force it to iterate all files in cases where the current // dependency is a game file to ensure that a later duplicate // game file is / is not checked. // (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; } } @@ -283,12 +283,11 @@ bool ContentSelectorModel::ContentModel::setData(const QModelIndex &index, const else return success; - - foreach (EsmFile *file, mFiles) + foreach (EsmFile *file2, 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); } } @@ -425,9 +424,9 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path) filters << "*.esp" << "*.esm" << "*.omwgame" << "*.omwaddon"; 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) continue; @@ -437,12 +436,13 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path) ToUTF8::Utf8Encoder encoder = ToUTF8::calculateEncoding(mEncoding.toStdString()); fileReader.setEncoder(&encoder); - fileReader.open(std::string(dir.absoluteFilePath(path).toUtf8().constData())); - - EsmFile *file = new EsmFile(path); + fileReader.open(std::string(dir.absoluteFilePath(path2).toUtf8().constData())); - foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles()) - file->addGameFile(QString::fromUtf8(item.name.c_str())); + EsmFile *file = new EsmFile(path2); + + for (std::vector::const_iterator itemIter = fileReader.getGameFiles().begin(); + itemIter != fileReader.getGameFiles().end(); ++itemIter) + file->addGameFile(QString::fromUtf8(itemIter->name.c_str())); file->setAuthor (QString::fromUtf8(fileReader.getAuthor().c_str())); file->setDate (info.lastModified()); From 175cfd4dff2067405ac748f5e9f297f1bad28509 Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sun, 13 Nov 2016 17:22:50 +0100 Subject: [PATCH 3/3] Fix overloaded virtual function warning --- apps/openmw/mwgui/itemchargeview.cpp | 4 ++-- apps/openmw/mwgui/itemchargeview.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/itemchargeview.cpp b/apps/openmw/mwgui/itemchargeview.cpp index 83517e353..522acca26 100644 --- a/apps/openmw/mwgui/itemchargeview.cpp +++ b/apps/openmw/mwgui/itemchargeview.cpp @@ -99,7 +99,7 @@ namespace MWGui line.mIcon->setUserString("ToolTipType", "ItemPtr"); line.mIcon->setUserData(line.mItemPtr); 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("MW_ChargeBar", MyGUI::IntCoord(), MyGUI::Align::Default); line.mCharge->setNeedMouseFocus(false); @@ -202,7 +202,7 @@ namespace MWGui eventItemClicked(this, *sender->getUserData()); } - void ItemChargeView::onMouseWheel(MyGUI::Widget* /*sender*/, int rel) + void ItemChargeView::onMouseWheelMoved(MyGUI::Widget* /*sender*/, int rel) { if (mScrollView->getViewOffset().top + rel*0.3f > 0) mScrollView->setViewOffset(MyGUI::IntPoint(0, 0)); diff --git a/apps/openmw/mwgui/itemchargeview.hpp b/apps/openmw/mwgui/itemchargeview.hpp index 1ff077ef2..0988f655b 100644 --- a/apps/openmw/mwgui/itemchargeview.hpp +++ b/apps/openmw/mwgui/itemchargeview.hpp @@ -64,7 +64,7 @@ namespace MWGui void updateLine(const Line& line); void onIconClicked(MyGUI::Widget* sender); - void onMouseWheel(MyGUI::Widget* sender, int rel); + void onMouseWheelMoved(MyGUI::Widget* sender, int rel); typedef std::vector Lines; Lines mLines;