From 1286754fb3c8b6f25bb3b8c56b2d1aacd5f2e137 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 18 Mar 2017 08:07:36 +0400 Subject: [PATCH 001/318] Add a new option to show arrow damage (feature #2923) --- apps/openmw/mwclass/weapon.cpp | 7 +++++-- files/settings-default.cfg | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 470c7040d..952464eec 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -1,6 +1,7 @@ #include "weapon.hpp" #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -261,8 +262,8 @@ namespace MWClass std::string text; - // weapon type & damage. arrows / bolts don't have his info. - if (ref->mBase->mData.mType < 12) + // weapon type & damage + if ((ref->mBase->mData.mType < 12 || Settings::Manager::getBool("show projectile damage", "Game")) && ref->mBase->mData.mType < 14) { text += "\n#{sType} "; @@ -279,6 +280,8 @@ namespace MWClass mapping[ESM::Weapon::MarksmanBow] = std::make_pair("sSkillMarksman", ""); mapping[ESM::Weapon::MarksmanCrossbow] = std::make_pair("sSkillMarksman", ""); mapping[ESM::Weapon::MarksmanThrown] = std::make_pair("sSkillMarksman", ""); + mapping[ESM::Weapon::Arrow] = std::make_pair("sSkillMarksman", ""); + mapping[ESM::Weapon::Bolt] = std::make_pair("sSkillMarksman", ""); std::string type = mapping[ref->mBase->mData.mType].first; std::string oneOrTwoHanded = mapping[ref->mBase->mData.mType].second; diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 55f550d5a..472e9c596 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -146,6 +146,9 @@ crosshair = true # no color, 1 is tool tip only, 2 is crosshair only, and 3 is both). show owned = 0 +# Show damage bonus of arrow and bolts. +show projectile damage = false + # Always use the best mode of attack: e.g. chop, slash or thrust. best attack = false From 8d769033929240228713fab782fdd6ce16b44830 Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Sun, 2 Apr 2017 03:15:32 +0200 Subject: [PATCH 002/318] Ini-importer progress bar fills the whole width of the ui element now --- files/ui/settingspage.ui | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/files/ui/settingspage.ui b/files/ui/settingspage.ui index 7f5e4a7de..617e54890 100644 --- a/files/ui/settingspage.ui +++ b/files/ui/settingspage.ui @@ -131,15 +131,18 @@ - - - - 4 - - - + + + + 4 + + + false + + + From 95ce7637f392119e592f8ae9d1ea59c7ec73a8d8 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 10 Apr 2017 10:18:00 +0400 Subject: [PATCH 003/318] Adds persisted pin (feature #2834, bug #2489) --- apps/openmw/mwgui/inventorywindow.cpp | 2 ++ apps/openmw/mwgui/mapwindow.cpp | 11 +++++++++-- apps/openmw/mwgui/spellwindow.cpp | 4 ++++ apps/openmw/mwgui/statswindow.cpp | 4 ++++ apps/openmw/mwgui/windowmanagerimp.cpp | 25 +++++++++++++++++++------ files/settings-default.cfg | 11 +++++++++++ 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 21b90991c..3866c5a96 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -433,6 +433,8 @@ namespace MWGui void InventoryWindow::onPinToggled() { + Settings::Manager::setBool("inventory pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setWeaponVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index 8002dc48a..12d1237b0 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -629,7 +629,7 @@ namespace MWGui , mGlobalMap(0) , mGlobalMapImage(NULL) , mGlobalMapOverlay(NULL) - , mGlobal(false) + , mGlobal(Settings::Manager::getBool("global", "Map")) , mEventBoxGlobal(NULL) , mEventBoxLocal(NULL) , mGlobalMapRender(new MWRender::GlobalMap(localMapRender->getRoot(), workQueue)) @@ -667,7 +667,7 @@ namespace MWGui getWidget(mButton, "WorldButton"); mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked); - mButton->setCaptionWithReplacing("#{sWorld}"); + mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : "#{sWorld}"); getWidget(mEventBoxGlobal, "EventBoxGlobal"); mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag); @@ -680,6 +680,9 @@ namespace MWGui mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked); LocalMapBase::init(mLocalMap, mPlayerArrowLocal, Settings::Manager::getInt("local map widget size", "Map"), Settings::Manager::getInt("local map cell distance", "Map")); + + mGlobalMap->setVisible(mGlobal); + mLocalMap->setVisible(!mGlobal); } void MapWindow::onNoteEditOk() @@ -912,6 +915,8 @@ namespace MWGui mGlobalMap->setVisible(mGlobal); mLocalMap->setVisible(!mGlobal); + Settings::Manager::setBool("global", "Map", mGlobal); + mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : "#{sWorld}"); @@ -921,6 +926,8 @@ namespace MWGui void MapWindow::onPinToggled() { + Settings::Manager::setBool("map pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setMinimapVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index 7c12a8fc2..0c3485e6a 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -4,6 +4,8 @@ #include +#include + #include "../mwbase/windowmanager.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -48,6 +50,8 @@ namespace MWGui void SpellWindow::onPinToggled() { + Settings::Manager::setBool("spells pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setSpellVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index d68c1bcc5..780e4905e 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" @@ -672,6 +674,8 @@ namespace MWGui void StatsWindow::onPinToggled() { + Settings::Manager::setBool("stats pin", "Windows", mPinned); + MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned); } diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 16d1a9c6d..38aa142c4 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -400,6 +400,11 @@ namespace MWGui allow(GW_ALL); mRestAllowed = !newgame; + + mStatsWindow->setPinned(Settings::Manager::getBool("stats pin", "Windows")); + mMap->setPinned(Settings::Manager::getBool("map pin", "Windows")); + mSpellWindow->setPinned(Settings::Manager::getBool("spells pin", "Windows")); + mInventoryWindow->setPinned(Settings::Manager::getBool("inventory pin", "Windows")); } WindowManager::~WindowManager() @@ -550,15 +555,23 @@ namespace MWGui setSpellVisibility((mAllowed & GW_Magic) && (!mSpellWindow->pinned() || (mForceHidden & GW_Magic))); setHMSVisibility((mAllowed & GW_Stats) && (!mStatsWindow->pinned() || (mForceHidden & GW_Stats))); - // If in game mode, show only the pinned windows - if (gameMode) + // If in game mode (or interactive messagebox), show only the pinned windows + if (mGuiModes.empty()) { mInventoryWindow->setGuiMode(GM_None); - mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map)); - mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats)); - mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory)); - mSpellWindow->setVisible(mSpellWindow->pinned() && !(mForceHidden & GW_Magic)); + mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map) && (mAllowed & GW_Map)); + mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats) && (mAllowed & GW_Stats)); + mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory) && (mAllowed & GW_Inventory)); + mSpellWindow->setVisible(mSpellWindow->pinned() && !(mForceHidden & GW_Magic) && (mAllowed & GW_Magic)); + + return; + } + + // No need to check GUI if game mode + if (gameMode) + { + mInventoryWindow->setGuiMode(GM_None); return; } diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 55f550d5a..6756d0e7a 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -107,6 +107,9 @@ local map widget size = 512 # may result in longer loading times. local map cell distance = 1 +# If true, map in world mode, otherwise in local mode +global = false + [GUI] # Scales GUI window and widget size. (<1.0 is smaller, >1.0 is larger). @@ -365,18 +368,24 @@ stats x = 0.0 stats y = 0.0 stats w = 0.375 stats h = 0.4275 +# Stats window pin status +stats pin = false # Spells window displaying powers, spells, and magical items. spells x = 0.625 spells y = 0.5725 spells w = 0.375 spells h = 0.4275 +# Spells window pin status +spells pin = false # Local and world map window. map x = 0.625 map y = 0.0 map w = 0.375 map h = 0.5725 +# Map window pin status +map pin = false # Dialog window for talking with NPCs. dialogue x = 0.095 @@ -401,6 +410,8 @@ inventory x = 0.0 inventory y = 0.4275 inventory w = 0.6225 inventory h = 0.5725 +# Inventory window pin status +inventory pin = false # Player inventory window when searching a container. inventory container x = 0.0 From 13517e723af13cabdadcba4cc0172923b91dd20b Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 11 Apr 2017 10:05:57 +0200 Subject: [PATCH 004/318] increased version number --- CMakeLists.txt | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b4e9ad4b..ec7e2577c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ endif() message(STATUS "Configuring OpenMW...") set(OPENMW_VERSION_MAJOR 0) -set(OPENMW_VERSION_MINOR 41) +set(OPENMW_VERSION_MINOR 42) set(OPENMW_VERSION_RELEASE 0) set(OPENMW_VERSION_COMMITHASH "") diff --git a/README.md b/README.md index d38dfaeb2..1ed377936 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ OpenMW is a recreation of the engine for the popular role-playing game Morrowind OpenMW also comes with OpenMW-CS, a replacement for Morrowind's TES Construction Set. -* Version: 0.41.0 +* Version: 0.42.0 * License: GPLv3 (see [docs/license/GPL3.txt](https://github.com/OpenMW/openmw/blob/master/docs/license/GPL3.txt) for more information) * Website: http://www.openmw.org * IRC: #openmw on irc.freenode.net From 59a9a7aafb458b382cd2f7573ee0d4f083069c0f Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 11 Apr 2017 10:28:08 +0200 Subject: [PATCH 005/318] updated changelog --- CHANGELOG.md | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d826753..b390169c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,82 @@ +0.42.0 +------ + + Bug #1956: Duplicate objects after loading the game, when a mod was edited + Bug #2100: Falling leaves in Vurt's Leafy West Gash II not rendered correctly + Bug #2116: Cant fit through some doorways pressed against staircases + Bug #2289: Some modal dialogs are not centered on the screen when the window resizes + Bug #2409: Softlock when pressing weapon/magic switch keys during chargen, afterwards switches weapons even though a text field is selected + Bug #2483: Previous/Next Weapon hotkeys triggered while typing the name of game save + Bug #2629: centeroncell, coc causes death / fall damage time to time when teleporting from high + Bug #2645: Cycling weapons is possible while console/pause menu is open + Bug #2678: Combat with water creatures do not end upon exiting water + Bug #2759: Light Problems in Therana's Chamber in Tel Branora + Bug #2771: unhandled sdl event of type 0x302 + Bug #2777: (constant/on cast) disintegrate armor/weapon on self is seemingly not working + Bug #2838: Editor: '.' in a record name should be allowed + Bug #2909: NPCs appear floating when standing on a slope + Bug #3093: Controller movement cannot be used while mouse is moving + Bug #3134: Crash possible when using console with open container + Bug #3254: AI enemies hit between them. + Bug #3344: Editor: Verification results sorting by Type is not alphabetical. + Bug #3345: Editor: Cloned and added pathgrids are lost after reopen of saved omwgame file + Bug #3355: [MGSO] Physics maxing out in south cornerclub Balmora + Bug #3484: Editor: camera position is not set when changing cell via drag&drop + Bug #3508: Slowfall kills Jump momentum + Bug #3580: Crash: Error ElementBufferObject::remove BufferData<0> out of range + Bug #3581: NPCs wander too much + Bug #3601: Menu Titles not centered vertically + Bug #3607: [Mac OS] Beginning of NPC speech cut off (same issue as closed bug #3453) + Bug #3613: Can not map "next weapon" or "next spell" to controller + Bug #3617: Enchanted arrows don't explode when hitting the ground + Bug #3645: Unable to use steps in Vivec, Palace of Vivec + Bug #3650: Tamriel Rebuilt 16.09.1 – Hist Cuirass GND nif is rendered inside a Pink Box + Bug #3652: Item icon shadows get stuck in the alchemy GUI + Bug #3653: Incorrect swish sounds + Bug #3666: NPC collision should not be disabled until death animation has finished + Bug #3669: Editor: Text field was missing from book object editing dialogue + Bug #3670: Unhandled SDL event of type 0x304 + Bug #3671: Incorrect local variable value after picking up bittercup + Bug #3686: Travelling followers doesn't increase travel fee + Bug #3689: Problematic greetings from Antares Big Mod that override the appropriate ones. + Bug #3690: Certain summoned creatures do not engage in combat with underwater creatures + Bug #3691: Enemies do not initiate combat with player followers on sight + Bug #3695: [Regression] Dispel does not always dispel spell effects in 0.41 + Bug #3699: Crash on MWWorld::ProjectileManager::moveMagicBolts + Bug #3700: Climbing on rocks and mountains + Bug #3704: Creatures don't auto-equip their shields on creation + Bug #3705: AI combat engagement logic differs from vanilla + Bug #3707: Animation playing does some very odd things if pc comes in contact with the animated mesh + Bug #3712: [Mod] Freeze upon entering Adanumuran with mod Adanumuran Reclaimed + Bug #3713: [Regression] Cancelling dialogue or using travel with creatures throws a (possibly game-breaking) exception + Bug #3719: Dropped identification papers can't be picked up again + Bug #3722: Command spell doesn't bring enemies out of combat + Bug #3727: Using "Activate" mid-script-execution invalidates interpreter context + Bug #3746: Editor: Book records show attribute IDs instead of skill IDs for teached skills entry. + Bug #3755: Followers stop following after loading from savegame + Bug #3772: ModStat lowers attribute to 100 if it was greater + Bug #3781: Guns in Clean Hunter Rifles mod use crossbow sounds + Bug #3797: NPC and creature names don't show up in combat when RMB windows are displayed + Bug #3800: Wrong tooltip maximum width + Bug #3801: Drowning widget is bugged + Bug #3802: BarterOffer shouldn't limit pcMercantile + Bug #3813: Some fatal error + Bug #3816: Expression parser thinks the -> token is unexpected when a given explicit refID clashes with a journal ID + Bug #3822: Custom added creatures are not animated + Feature #451: Water sounds + Feature #2691: Light particles sometimes not shown in inventory character preview + Feature #3523: Light source on magic projectiles + Feature #3644: Nif NiSphericalCollider Unknown Record Type + Feature #3675: ess-Importer: convert mark location + Feature #3693: ess-Importer: convert last known exterior cell + Feature #3748: Editor: Replace "Scroll" check box in Book records with "Book Type" combo box. + Feature #3751: Editor: Replace "Xyz Blood" check boxes in NPC and Creature records with "Blood Type" combo box + Feature #3752: Editor: Replace emitter check boxes in Light records with "Emitter Type" combo box + Feature #3756: Editor: Replace "Female" check box in NPC records with "Gender" combo box + Feature #3757: Editor: Replace "Female" check box in BodyPart records with "Gender" combo box + Task #3092: const version of ContainerStoreIterator + Task #3795: /deps folder not in .gitignore + 0.41.0 ------ From 506cc47c9d9db2a39c9eb2724b48f273d24a3691 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 18 Mar 2017 19:23:19 +0400 Subject: [PATCH 006/318] Add option to show reach and attack speed for melee weapons --- apps/openmw/mwclass/weapon.cpp | 8 ++++++++ apps/openmw/mwgui/tooltips.cpp | 8 ++++++++ apps/openmw/mwgui/tooltips.hpp | 1 + files/settings-default.cfg | 3 +++ 4 files changed, 20 insertions(+) diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 952464eec..575accaba 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -321,6 +321,14 @@ namespace MWClass + MWGui::ToolTips::toString(ref->mBase->mData.mHealth); } + // add reach and attack speed for melee weapon + if (ref->mBase->mData.mType < 9 && Settings::Manager::getBool("show melee info", "Game")) + { + text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mReach, "#{sRange}"); + + text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mSpeed, "#{sAttributeSpeed}"); + } + text += MWGui::ToolTips::getWeightString(ref->mBase->mData.mWeight, "#{sWeight}"); text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}"); diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index b3cc19a64..e25981a62 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -594,6 +594,14 @@ namespace MWGui return "\n" + prefix + ": " + toString(weight); } + std::string ToolTips::getPercentString(const float value, const std::string& prefix) + { + if (value == 0) + return ""; + else + return "\n" + prefix + ": " + toString(value*100) +"%"; + } + std::string ToolTips::getValueString(const int value, const std::string& prefix) { if (value == 0) diff --git a/apps/openmw/mwgui/tooltips.hpp b/apps/openmw/mwgui/tooltips.hpp index de5b89b7f..2db5fce34 100644 --- a/apps/openmw/mwgui/tooltips.hpp +++ b/apps/openmw/mwgui/tooltips.hpp @@ -63,6 +63,7 @@ namespace MWGui ///< set the screen-space position of the tooltip for focused object static std::string getWeightString(const float weight, const std::string& prefix); + static std::string getPercentString(const float value, const std::string& prefix); static std::string getValueString(const int value, const std::string& prefix); ///< @return "prefix: value" or "" if value is 0 diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 472e9c596..da0cbd285 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -149,6 +149,9 @@ show owned = 0 # Show damage bonus of arrow and bolts. show projectile damage = false +# Show additional melee weapon info: reach and attack speed +show melee info = false + # Always use the best mode of attack: e.g. chop, slash or thrust. best attack = false From c3d49d5ca5737534c04acb62baf07cf8b03d17d9 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 12 Apr 2017 22:57:32 +0400 Subject: [PATCH 007/318] Fixed inventory crash and skipmenu launch --- apps/openmw/mwbase/windowmanager.hpp | 1 + apps/openmw/mwgui/mapwindow.cpp | 2 +- apps/openmw/mwgui/windowmanagerimp.cpp | 27 +++++++++++++++++++------ apps/openmw/mwgui/windowmanagerimp.hpp | 2 ++ apps/openmw/mwstate/statemanagerimp.cpp | 5 +++-- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index f103ce191..6a159ea7d 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -104,6 +104,7 @@ namespace MWBase * new dialogs. */ virtual void update() = 0; + virtual void updateVisible() = 0; /// @note This method will block until the video finishes playing /// (and will continually update the window while doing so) diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index 3d342db44..4d4efeecb 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -780,7 +780,7 @@ namespace MWGui void MapWindow::setVisible(bool visible) { WindowBase::setVisible(visible); - mButton->setVisible(visible && MWBase::Environment::get().getWindowManager()->isGuiMode()); + mButton->setVisible(visible && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_None); } void MapWindow::renderGlobalMap() diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 38aa142c4..119c9f551 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -368,6 +368,8 @@ namespace MWGui mPlayerSkillValues.insert(std::make_pair(ESM::Skill::sSkillIds[i], MWMechanics::SkillValue())); } + updatePinnedWindows(); + // Set up visibility updateVisible(); @@ -400,11 +402,6 @@ namespace MWGui allow(GW_ALL); mRestAllowed = !newgame; - - mStatsWindow->setPinned(Settings::Manager::getBool("stats pin", "Windows")); - mMap->setPinned(Settings::Manager::getBool("map pin", "Windows")); - mSpellWindow->setPinned(Settings::Manager::getBool("spells pin", "Windows")); - mInventoryWindow->setPinned(Settings::Manager::getBool("inventory pin", "Windows")); } WindowManager::~WindowManager() @@ -492,7 +489,6 @@ namespace MWGui void WindowManager::update() { cleanupGarbage(); - mHud->update(); } @@ -560,6 +556,12 @@ namespace MWGui { mInventoryWindow->setGuiMode(GM_None); + // If game is not running, we can't be sure that widgets are initialized properly + MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState(); + + if (state != MWBase::StateManager::State_Running) + return; + mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map) && (mAllowed & GW_Map)); mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats) && (mAllowed & GW_Stats)); mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory) && (mAllowed & GW_Inventory)); @@ -1709,6 +1711,8 @@ namespace MWGui mCompanionWindow->resetReference(); mConsole->resetReference(); + mInventoryWindow->rebuildAvatar(); + mSelectedSpell.clear(); mCustomMarkers.clear(); @@ -1868,6 +1872,17 @@ namespace MWGui mVideoWidget->stop(); } + void WindowManager::updatePinnedWindows() + { + mInventoryWindow->setPinned(Settings::Manager::getBool("inventory pin", "Windows")); + + mMap->setPinned(Settings::Manager::getBool("map pin", "Windows")); + + mSpellWindow->setPinned(Settings::Manager::getBool("spells pin", "Windows")); + + mStatsWindow->setPinned(Settings::Manager::getBool("stats pin", "Windows")); + } + void WindowManager::pinWindow(GuiWindow window) { switch (window) diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index a8f6263c2..40ebe8bbd 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -362,6 +362,8 @@ namespace MWGui virtual void pinWindow (MWGui::GuiWindow window); + virtual void updatePinnedWindows (); + /// Fade the screen in, over \a time seconds virtual void fadeScreenIn(const float time, bool clearQueue); /// Fade the screen out to black, over \a time seconds diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 64c543fb1..067cf481f 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -139,8 +139,7 @@ void MWState::StateManager::newGame (bool bypass) { cleanup(); - if (!bypass) - MWBase::Environment::get().getWindowManager()->setNewGame (true); + MWBase::Environment::get().getWindowManager()->setNewGame (!bypass); try { @@ -149,6 +148,8 @@ void MWState::StateManager::newGame (bool bypass) MWBase::Environment::get().getWorld()->startNewGame (bypass); mState = State_Running; + + MWBase::Environment::get().getWindowManager()->updateVisible(); } catch (std::exception& e) { From fe4fb82646102a78d443c96708b8111ad744dbe4 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 13 Apr 2017 01:01:50 +0900 Subject: [PATCH 008/318] Cache allies found while iterating engageCombat (Fixes #3814) --- apps/openmw/mwmechanics/actors.cpp | 47 ++++++++++++++++++++++++------ apps/openmw/mwmechanics/actors.hpp | 4 ++- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 0b398a046..89cff3fa1 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -280,7 +280,7 @@ namespace MWMechanics } } - void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer) + void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, std::map >& cachedAllies, bool againstPlayer) { CreatureStats& creatureStats1 = actor1.getClass().getCreatureStats(actor1); if (creatureStats1.getAiSequence().isInCombat(actor2)) @@ -306,7 +306,8 @@ namespace MWMechanics // Get actors allied with actor1. Includes those following or escorting actor1, actors following or escorting those actors, (recursive) // and any actor currently being followed or escorted by actor1 std::set allies1; - getActorsSidingWith(actor1, allies1); + + getActorsSidingWith(actor1, allies1, cachedAllies); // If an ally of actor1 has been attacked by actor2 or has attacked actor2, start combat between actor1 and actor2 for (std::set::const_iterator it = allies1.begin(); it != allies1.end(); ++it) @@ -328,10 +329,10 @@ namespace MWMechanics aggressive = true; } - std::set playerFollowersAndEscorters; - getActorsSidingWith(MWMechanics::getPlayer(), playerFollowersAndEscorters); + std::set playerAllies; + getActorsSidingWith(MWMechanics::getPlayer(), playerAllies, cachedAllies); - bool isPlayerFollowerOrEscorter = std::find(playerFollowersAndEscorters.begin(), playerFollowersAndEscorters.end(), actor1) != playerFollowersAndEscorters.end(); + bool isPlayerFollowerOrEscorter = std::find(playerAllies.begin(), playerAllies.end(), actor1) != playerAllies.end(); // If actor2 and at least one actor2 are in combat with actor1, actor1 and its allies start combat with them // Doesn't apply for player followers/escorters @@ -341,7 +342,9 @@ namespace MWMechanics if (actor2.getClass().getCreatureStats(actor2).getAiSequence().isInCombat(actor1)) { std::set allies2; - getActorsSidingWith(actor2, allies2); + + getActorsSidingWith(actor2, allies2, cachedAllies); + // Check that an ally of actor2 is also in combat with actor1 for (std::set::const_iterator it = allies2.begin(); it != allies2.end(); ++it) { @@ -383,11 +386,11 @@ namespace MWMechanics // Do aggression check if actor2 is the player or a player follower or escorter if (!aggressive) { - if (againstPlayer || std::find(playerFollowersAndEscorters.begin(), playerFollowersAndEscorters.end(), actor2) != playerFollowersAndEscorters.end()) + if (againstPlayer || std::find(playerAllies.begin(), playerAllies.end(), actor2) != playerAllies.end()) { // Player followers and escorters with high fight should not initiate combat with the player or with // other player followers or escorters - if (std::find(playerFollowersAndEscorters.begin(), playerFollowersAndEscorters.end(), actor1) == playerFollowersAndEscorters.end()) + if (std::find(playerAllies.begin(), playerAllies.end(), actor1) == playerAllies.end()) aggressive = MWBase::Environment::get().getMechanicsManager()->isAggressive(actor1, actor2); } } @@ -1072,6 +1075,8 @@ namespace MWMechanics /// \todo move update logic to Actor class where appropriate + std::map > cachedAllies; // will be filled as engageCombat iterates + // AI and magic effects update for(PtrActorMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter) { @@ -1123,7 +1128,7 @@ namespace MWMechanics { if (it->first == iter->first || iter->first == player) // player is not AI-controlled continue; - engageCombat(iter->first, it->first, it->first == player); + engageCombat(iter->first, it->first, cachedAllies, it->first == player); } } if (timerUpdateHeadTrack == 0) @@ -1588,6 +1593,30 @@ namespace MWMechanics getActorsSidingWith(*it, out); } + void Actors::getActorsSidingWith(const MWWorld::Ptr &actor, std::set& out, std::map >& cachedAllies) { + std::list followers = getActorsSidingWith(actor); + + // If we have already found actor's allies, use the cache + std::map >::const_iterator search = cachedAllies.find(actor); + if (search != cachedAllies.end()) + out = search->second; + else + { + for (std::list::iterator it = followers.begin(); it != followers.end(); ++it) + if (out.insert(*it).second) + getActorsSidingWith(*it, out); + + // Cache ptrs and their sets of allies + cachedAllies.insert(std::make_pair(actor, out)); + for (std::set::const_iterator it = out.begin(); it != out.end(); ++it) + { + search = cachedAllies.find(*it); + if (search == cachedAllies.end()) + cachedAllies.insert(std::make_pair(*it, out)); + } + } + } + std::list Actors::getActorsFollowingIndices(const MWWorld::Ptr &actor) { std::list list; diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index 20aef4c17..362c2f126 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -88,7 +88,7 @@ namespace MWMechanics @Notes: If againstPlayer = true then actor2 should be the Player. If one of the combatants is creature it should be actor1. */ - void engageCombat(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer); + void engageCombat(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, std::map >& cachedAllies, bool againstPlayer); void updateHeadTracking(const MWWorld::Ptr& actor, const MWWorld::Ptr& targetActor, MWWorld::Ptr& headTrackTarget, float& sqrHeadTrackDistance); @@ -127,6 +127,8 @@ namespace MWMechanics void getActorsFollowing(const MWWorld::Ptr &actor, std::set& out); /// Recursive version of getActorsSidingWith void getActorsSidingWith(const MWWorld::Ptr &actor, std::set& out); + /// Recursive version of getActorsSidingWith that takes, adds to and returns a cache of actors mapped to their allies + void getActorsSidingWith(const MWWorld::Ptr &actor, std::set& out, std::map >& cachedAllies); /// Get the list of AiFollow::mFollowIndex for all actors following this target std::list getActorsFollowingIndices(const MWWorld::Ptr& actor); From 56dfa615e1e11539842350e4794f4247f7308135 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 13 Apr 2017 03:57:59 +0900 Subject: [PATCH 009/318] Minor changes to getActorsSidingWith --- apps/openmw/mwmechanics/actors.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 89cff3fa1..80564de9f 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1594,17 +1594,16 @@ namespace MWMechanics } void Actors::getActorsSidingWith(const MWWorld::Ptr &actor, std::set& out, std::map >& cachedAllies) { - std::list followers = getActorsSidingWith(actor); - // If we have already found actor's allies, use the cache std::map >::const_iterator search = cachedAllies.find(actor); if (search != cachedAllies.end()) - out = search->second; + out.insert(search->second.begin(), search->second.end()); else { + std::list followers = getActorsSidingWith(actor); for (std::list::iterator it = followers.begin(); it != followers.end(); ++it) if (out.insert(*it).second) - getActorsSidingWith(*it, out); + getActorsSidingWith(*it, out, cachedAllies); // Cache ptrs and their sets of allies cachedAllies.insert(std::make_pair(actor, out)); From 00e06095c10b2c67fa2e91c299b2ba7f722953a5 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 14 Apr 2017 21:49:15 +0400 Subject: [PATCH 010/318] Updated documentation for new weapon tooltips options --- .../reference/modding/settings/game.rst | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index 1eaa22db4..31ff3dd8c 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -12,6 +12,28 @@ Enable visual clues for items owned by NPCs when the crosshair is on the object. The default value is 0 (no clues). This setting can only be configured by editing the settings configuration file. +show projectile damage +---------------------- + +:Type: boolean +:Range: True/False +:Default: False + +If this setting is true, damage bonus of arrows and bolts will be showed on item tooltip. + +The default value is false. This setting can only be configured by editing the settings configuration file. + +show melee info +--------------- + +:Type: boolean +:Range: True/False +:Default: False + +If this setting is true, melee weapons reach and speed will be showed on item tooltip. + +The default value is false. This setting can only be configured by editing the settings configuration file. + best attack ----------- From 8581d68b8e05ef02d46d213704598c948b33ad99 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 14 Apr 2017 22:46:24 +0400 Subject: [PATCH 011/318] Updated documentation for windows settings --- .../source/reference/modding/settings/map.rst | 11 +++ .../reference/modding/settings/windows.rst | 81 ++++++++++++------- 2 files changed, 61 insertions(+), 31 deletions(-) diff --git a/docs/source/reference/modding/settings/map.rst b/docs/source/reference/modding/settings/map.rst index f3e0a1c53..c120cf020 100644 --- a/docs/source/reference/modding/settings/map.rst +++ b/docs/source/reference/modding/settings/map.rst @@ -51,3 +51,14 @@ local map widget size This setting controls the canvas size of the GUI mode local map window. Larger values result in a larger physical map size on screen, and typically require more panning to see all available portions of the map. This larger size also enables an overall greater level of detail if the local map resolution setting is also increased. The default value for this setting is 512. This setting can not be configured except by editing the settings configuration file. + +global +------ + +:Type: boolean +:Range: True/False +:Default: False + +If this setting is true, a world map on a map window will be displayed, otherwise a local map will be displayed. + +The default value is false. This setting can be toggled with the Local/World map switch button on the map window. diff --git a/docs/source/reference/modding/settings/windows.rst b/docs/source/reference/modding/settings/windows.rst index 8860de983..bafcac295 100644 --- a/docs/source/reference/modding/settings/windows.rst +++ b/docs/source/reference/modding/settings/windows.rst @@ -18,6 +18,21 @@ Each window in the GUI mode remembers it's previous location when exiting the ga .. note:: To scale the windows, making the widgets proportionally larger, see the scaling factor setting instead. +:Type: boolean +:Range: True/False + +This section controls the state of pinnable windows: pinned or not. For example, to pin only the map window, the actual settings will be:: + + inventory pin = false + map pin = true + stats pin = false + spells pin = false + +The pinnable window can be pinned/unpinned by clicking on a button in the right upper corner of the window. + +.. note:: + A world/local map switch button on the map window will be showed only in GUI mode. + stats ----- @@ -25,6 +40,7 @@ stats y = 0.0 h = 0.375 w = 0.4275 + pin = false The stats window, displaying level, race, class, skills and stats. Activated by clicking on any of the three bars in the lower left corner of the HUD. @@ -35,6 +51,7 @@ spells y = 0.5725 h = 0.375 w = 0.4275 + pin = false The spells window, displaying powers, spells, and magical items. Activated by clicking on the spells widget (third from left) in the bottom left corner of the HUD. @@ -45,39 +62,10 @@ map y = 0.0 h = 0.375 w = 0.5725 + pin = false The local and world map window. Activated by clicking on the map widget in the bottom right corner of the HUD. -dialogue --------- - -:Default: x = 0.095 - y = 0.095 - h = 0.810 - w = 0.810 - -The dialog window, for talking with NPCs. Activated by clicking on a NPC. - -alchemy -------- - -:Default: x = 0.25 - y = 0.25 - h = 0.5 - w = 0.5 - -The alchemy window, for crafting potions. Activated by dragging an alchemy tool on to the rag doll. Unlike most other windows, this window hides all other windows when opened. - -console -------- - -:Default: x = 0.0 - y = 0.0 - h = 1.0 - w = 0.5 - -The console command window. Activated by pressing the tilde (~) key. - inventory --------- @@ -85,6 +73,7 @@ inventory y = 0.4275 h = 0.6225 w = 0.5725 + pin = false The inventory window, displaying the paper doll and possessions, when activated by clicking on the inventory widget (second from left) in the bottom left corner of the HUD. @@ -146,4 +135,34 @@ companion h = 0.75 w = 0.375 -The NPC's inventory window while interacting with a companion. The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. \ No newline at end of file +The NPC's inventory window while interacting with a companion. The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. + +dialogue +-------- + +:Default: x = 0.095 + y = 0.095 + h = 0.810 + w = 0.810 + +The dialog window, for talking with NPCs. Activated by clicking on a NPC. + +alchemy +------- + +:Default: x = 0.25 + y = 0.25 + h = 0.5 + w = 0.5 + +The alchemy window, for crafting potions. Activated by dragging an alchemy tool on to the rag doll. Unlike most other windows, this window hides all other windows when opened. + +console +------- + +:Default: x = 0.0 + y = 0.0 + h = 1.0 + w = 0.5 + +The console command window. Activated by pressing the tilde (~) key. From fb0c4700a4a99573279fc2fbd9c0f852b54f8743 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 14 Apr 2017 23:19:48 +0400 Subject: [PATCH 012/318] Save a proto gender in racemenu --- apps/openmw/mwgui/race.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index 184ce0775..c4a27f7ed 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -146,6 +146,7 @@ namespace MWGui const ESM::NPC& proto = mPreview->getPrototype(); setRaceId(proto.mRace); + setGender(proto.isMale() ? GM_Male : GM_Female); recountParts(); for (unsigned int i=0; i Date: Fri, 14 Apr 2017 23:21:20 +0400 Subject: [PATCH 013/318] Reviewmenu: read name, race, class and birthsign from player stats (fixes bug #2628) --- apps/openmw/mwgui/charactercreation.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index 9464daaf6..b2c9f1038 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -13,6 +13,7 @@ #include "../mwworld/class.hpp" #include "../mwworld/esmstore.hpp" +#include "../mwworld/player.hpp" #include "textinput.hpp" #include "race.hpp" @@ -230,10 +231,19 @@ namespace MWGui MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog); mReviewDialog = 0; mReviewDialog = new ReviewDialog(); - mReviewDialog->setPlayerName(mPlayerName); - mReviewDialog->setRace(mPlayerRaceId); - mReviewDialog->setClass(mPlayerClass); - mReviewDialog->setBirthSign(mPlayerBirthSignId); + + MWBase::World *world = MWBase::Environment::get().getWorld(); + + const ESM::NPC *playerNpc = world->getPlayerPtr().get()->mBase; + + const MWWorld::Player player = world->getPlayer(); + + const ESM::Class *playerClass = world->getStore().get().find(playerNpc->mClass); + + mReviewDialog->setPlayerName(playerNpc->mName); + mReviewDialog->setRace(playerNpc->mRace); + mReviewDialog->setClass(*playerClass); + mReviewDialog->setBirthSign(player.getBirthSign()); { MWWorld::Ptr player = MWMechanics::getPlayer(); From aac78d29a4e15a9bccef329cee85fe380d2a9311 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Apr 2017 15:54:42 +0400 Subject: [PATCH 014/318] Service menus layout fixes --- apps/openmw/mwgui/spellbuyingwindow.cpp | 4 +-- apps/openmw/mwgui/travelwindow.cpp | 2 -- files/mygui/openmw_alchemy_window.layout | 6 +++-- files/mygui/openmw_enchanting_dialog.layout | 26 +++++++++++-------- files/mygui/openmw_merchantrepair.layout | 10 +++---- files/mygui/openmw_scroll.skin.xml | 4 +-- files/mygui/openmw_spell_buying_window.layout | 14 +++++----- .../mygui/openmw_spellcreation_dialog.layout | 1 + files/mygui/openmw_travel_window.layout | 18 ++++++------- 9 files changed, 44 insertions(+), 41 deletions(-) diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp index 843731cff..7de4e326e 100644 --- a/apps/openmw/mwgui/spellbuyingwindow.cpp +++ b/apps/openmw/mwgui/spellbuyingwindow.cpp @@ -26,8 +26,6 @@ namespace MWGui , mLastPos(0) , mCurrentY(0) { - setCoord(0, 0, 450, 300); - getWidget(mCancelButton, "CancelButton"); getWidget(mPlayerGold, "PlayerGold"); getWidget(mSpellsView, "SpellsView"); @@ -68,7 +66,7 @@ namespace MWGui toAdd->setUserData(price); toAdd->setCaptionWithReplacing(spell->mName+" - "+MyGUI::utility::toString(price)+"#{sgp}"); - toAdd->setSize(toAdd->getTextSize().width,sLineHeight); + toAdd->setSize(mSpellsView->getWidth(),sLineHeight); toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel); toAdd->setUserString("ToolTipType", "Spell"); toAdd->setUserString("Spell", spellId); diff --git a/apps/openmw/mwgui/travelwindow.cpp b/apps/openmw/mwgui/travelwindow.cpp index 3063b3268..90d3f857a 100644 --- a/apps/openmw/mwgui/travelwindow.cpp +++ b/apps/openmw/mwgui/travelwindow.cpp @@ -28,8 +28,6 @@ namespace MWGui WindowBase("openmw_travel_window.layout") , mCurrentY(0) { - setCoord(0, 0, 450, 300); - getWidget(mCancelButton, "CancelButton"); getWidget(mPlayerGold, "PlayerGold"); getWidget(mSelect, "Select"); diff --git a/files/mygui/openmw_alchemy_window.layout b/files/mygui/openmw_alchemy_window.layout index ef8296980..d578f5506 100644 --- a/files/mygui/openmw_alchemy_window.layout +++ b/files/mygui/openmw_alchemy_window.layout @@ -6,12 +6,14 @@ - + - + + + diff --git a/files/mygui/openmw_enchanting_dialog.layout b/files/mygui/openmw_enchanting_dialog.layout index 88e0ec247..63638418c 100644 --- a/files/mygui/openmw_enchanting_dialog.layout +++ b/files/mygui/openmw_enchanting_dialog.layout @@ -1,9 +1,10 @@ - + - + + @@ -14,6 +15,7 @@ + @@ -23,7 +25,7 @@ - + @@ -35,7 +37,9 @@ - + + + @@ -49,7 +53,7 @@ - + @@ -95,29 +99,29 @@ - + - + - + - - + + - + diff --git a/files/mygui/openmw_merchantrepair.layout b/files/mygui/openmw_merchantrepair.layout index de5d0e316..fc85dc7ae 100644 --- a/files/mygui/openmw_merchantrepair.layout +++ b/files/mygui/openmw_merchantrepair.layout @@ -4,25 +4,25 @@ - + - + - + - + - + diff --git a/files/mygui/openmw_scroll.skin.xml b/files/mygui/openmw_scroll.skin.xml index b0b9dca17..415c2479a 100644 --- a/files/mygui/openmw_scroll.skin.xml +++ b/files/mygui/openmw_scroll.skin.xml @@ -4,12 +4,12 @@ - + - + diff --git a/files/mygui/openmw_spell_buying_window.layout b/files/mygui/openmw_spell_buying_window.layout index 73fb6e869..3481575de 100644 --- a/files/mygui/openmw_spell_buying_window.layout +++ b/files/mygui/openmw_spell_buying_window.layout @@ -1,28 +1,28 @@ - + - + - + - - + + - + - + diff --git a/files/mygui/openmw_spellcreation_dialog.layout b/files/mygui/openmw_spellcreation_dialog.layout index e14674ad6..ba72c6541 100644 --- a/files/mygui/openmw_spellcreation_dialog.layout +++ b/files/mygui/openmw_spellcreation_dialog.layout @@ -13,6 +13,7 @@ + diff --git a/files/mygui/openmw_travel_window.layout b/files/mygui/openmw_travel_window.layout index 2d6b1324a..7dd9df4eb 100644 --- a/files/mygui/openmw_travel_window.layout +++ b/files/mygui/openmw_travel_window.layout @@ -1,29 +1,29 @@ - + - + - - - + + + - - + + - + - + From c3fd327bb29452cd5cc2b977ee79ebc83edc20f4 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Apr 2017 22:15:25 +0400 Subject: [PATCH 015/318] Fixed drowning widget initialization --- apps/openmw/mwmechanics/actors.cpp | 6 ++++++ apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 14 +++++++++----- apps/openmw/mwmechanics/npcstats.cpp | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 88fee8ef1..1ae0e36a9 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -803,6 +803,12 @@ namespace MWMechanics CharacterController* ctrl = it->second->getCharacterController(); NpcStats &stats = ptr.getClass().getNpcStats(ptr); + + // When npc stats are just initialized, mTimeToStartDrowning == -1 and we should get value from GMST + static const int fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get().find("fHoldBreathTime")->getFloat(); + if (stats.getTimeToStartDrowning() == -1.f) + stats.setTimeToStartDrowning(fHoldBreathTime); + MWBase::World *world = MWBase::Environment::get().getWorld(); bool knockedOutUnderwater = (ctrl->isKnockedOut() && world->isUnderwater(ptr.getCell(), osg::Vec3f(ptr.getRefData().getPosition().asVec3()))); if((world->isSubmerged(ptr) || knockedOutUnderwater) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 34269d793..6145e7a29 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -328,12 +328,16 @@ namespace MWMechanics winMgr->setValue(fbar, stats.getFatigue()); } - if(stats.getTimeToStartDrowning() != mWatchedTimeToStartDrowning) - { - const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get() + static const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get() .find("fHoldBreathTime")->getFloat(); - mWatchedTimeToStartDrowning = stats.getTimeToStartDrowning(); - if(stats.getTimeToStartDrowning() >= fHoldBreathTime) + + float timeToDrown = stats.getTimeToStartDrowning(); + + if(timeToDrown != mWatchedTimeToStartDrowning) + { + mWatchedTimeToStartDrowning = timeToDrown; + + if(timeToDrown >= fHoldBreathTime || timeToDrown == -1.0) // -1.0 is a special value during initialization winMgr->setDrowningBarVisibility(false); else { diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index 0b016e69d..41f2a9b51 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -30,7 +30,7 @@ MWMechanics::NpcStats::NpcStats() , mBounty(0) , mWerewolfKills (0) , mLevelProgress(0) -, mTimeToStartDrowning(20.0) +, mTimeToStartDrowning(-1.0) // set breath to special value, it will be replaced during actor update , mIsWerewolf(false) { mSkillIncreases.resize (ESM::Attribute::Length, 0); From 3c4c47d1e604a1c18a990a658229e1b4b4ab3109 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 19 Apr 2017 15:52:15 +0400 Subject: [PATCH 016/318] Reduced scope of fHoldBreathTime variable --- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 6145e7a29..930049ba0 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -328,13 +328,13 @@ namespace MWMechanics winMgr->setValue(fbar, stats.getFatigue()); } - static const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get() - .find("fHoldBreathTime")->getFloat(); - float timeToDrown = stats.getTimeToStartDrowning(); if(timeToDrown != mWatchedTimeToStartDrowning) { + static const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get() + .find("fHoldBreathTime")->getFloat(); + mWatchedTimeToStartDrowning = timeToDrown; if(timeToDrown >= fHoldBreathTime || timeToDrown == -1.0) // -1.0 is a special value during initialization From 04eb4ea6b62632bb0121cb4c1bd991c09ccd918d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 19 Apr 2017 18:38:25 +0400 Subject: [PATCH 017/318] Check for disabled levitation (fixes #3766) --- apps/openmw/mwmechanics/actors.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 1ae0e36a9..2b475e475 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -596,6 +596,21 @@ namespace MWMechanics } } + // purge levitate effect if levitation is disabled + // check only modifier, because base value can be setted from SetFlying console command. + if (MWBase::Environment::get().getWorld()->isLevitationEnabled() == false && effects.get(ESM::MagicEffect::Levitate).getModifier() > 0) + { + creatureStats.getSpells().purgeEffect(ESM::MagicEffect::Levitate); + creatureStats.getActiveSpells().purgeEffect(ESM::MagicEffect::Levitate); + if (ptr.getClass().hasInventoryStore(ptr)) + ptr.getClass().getInventoryStore(ptr).purgeEffect(ESM::MagicEffect::Levitate); + + if (ptr == getPlayer()) + { + MWBase::Environment::get().getWindowManager()->messageBox ("#{sLevitateDisabled}"); + } + } + // attributes for(int i = 0;i < ESM::Attribute::Length;++i) { From c65587558492f0cdd699fea5249149228602a858 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 00:28:27 +0900 Subject: [PATCH 018/318] Change mWaterEnabled from float to bool --- apps/openmw/mwphysics/physicssystem.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 3312f10a0..81385d675 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -211,7 +211,7 @@ namespace MWPhysics float mTimeAccum; float mWaterHeight; - float mWaterEnabled; + bool mWaterEnabled; std::auto_ptr mWaterCollisionObject; std::auto_ptr mWaterCollisionShape; From 5a00b239accf24367860e2217918c861ce9532de Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 00:35:27 +0900 Subject: [PATCH 019/318] Reduce scope of variables --- apps/openmw/mwmechanics/aicombat.cpp | 6 ++++-- apps/openmw/mwrender/animation.cpp | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index 17005f235..d111eb127 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -500,8 +500,7 @@ namespace MWMechanics { // get the range of the target's weapon float rangeAttackOfTarget = 0.f; - bool isRangedCombat = false; - MWWorld::Ptr targetWeapon = MWWorld::Ptr(); + MWWorld::Ptr targetWeapon = MWWorld::Ptr(); const MWWorld::Class& targetClass = target.getClass(); if (targetClass.hasInventoryStore(target)) @@ -516,7 +515,10 @@ namespace MWMechanics boost::shared_ptr targetWeaponAction (new ActionWeapon(targetWeapon)); if (targetWeaponAction.get()) + { + bool isRangedCombat = false; rangeAttackOfTarget = targetWeaponAction->getCombatRange(isRangedCombat); + } // apply sideway movement (kind of dodging) with some probability // if actor is within range of target's weapon diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index ba4307c89..fe20ac437 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1058,11 +1058,9 @@ namespace MWRender float timepassed = duration * state.mSpeedMult; while(state.mPlaying) { - float targetTime; - if (!state.shouldLoop()) { - targetTime = state.getTime() + timepassed; + float targetTime = state.getTime() + timepassed; if(textkey == textkeys.end() || textkey->first > targetTime) { if(mAccumCtrl && state.mTime == mAnimationTimePtr[0]->getTimePtr()) From f299f26720004e2e7b3f8ed0ebb65d29ea60ced4 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 00:42:53 +0900 Subject: [PATCH 020/318] Remove unused variable --- apps/openmw/mwworld/scene.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index e27c0b585..2467af646 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -538,13 +538,9 @@ namespace MWWorld std::cout << "Changing to interior\n"; // unload - int current = 0; CellStoreCollection::iterator active = mActiveCells.begin(); while (active!=mActiveCells.end()) - { unloadCell (active++); - ++current; - } int refsToLoad = cell->count(); loadingListener->setProgressRange(refsToLoad); From 30081393a6fd2e40825b9836e2d086fbeb1ab91d Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 19 Apr 2017 18:28:49 +0200 Subject: [PATCH 021/318] Add InventoryWindow::clear() as part of world cleanup --- apps/openmw/mwgui/inventorywindow.cpp | 25 ++++++++++++++++++------- apps/openmw/mwgui/inventorywindow.hpp | 2 ++ apps/openmw/mwgui/windowmanagerimp.cpp | 2 ++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 21b90991c..b5a1b50d0 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -136,6 +136,18 @@ namespace MWGui dirtyPreview(); updatePreviewSize(); + + updateEncumbranceBar(); + mItemView->update(); + notifyContentChanged(); + } + + void InventoryWindow::clear() + { + mPtr = MWWorld::Ptr(); + mTradeModel = NULL; + mSortModel = NULL; + mItemView->setModel(NULL); } void InventoryWindow::setGuiMode(GuiMode mode) @@ -340,13 +352,12 @@ namespace MWGui void InventoryWindow::open() { - mPtr = MWMechanics::getPlayer(); - - updateEncumbranceBar(); - - mItemView->update(); - - notifyContentChanged(); + if (!mPtr.isEmpty()) + { + updateEncumbranceBar(); + mItemView->update(); + notifyContentChanged(); + } adjustPanes(); } diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp index 651bda590..11091c428 100644 --- a/apps/openmw/mwgui/inventorywindow.hpp +++ b/apps/openmw/mwgui/inventorywindow.hpp @@ -60,6 +60,8 @@ namespace MWGui void updatePlayer(); + void clear(); + void useItem(const MWWorld::Ptr& ptr); void setGuiMode(GuiMode mode); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 16d1a9c6d..9238e5cfd 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1696,6 +1696,8 @@ namespace MWGui mCompanionWindow->resetReference(); mConsole->resetReference(); + mInventoryWindow->clear(); + mSelectedSpell.clear(); mCustomMarkers.clear(); From 60a2625b897cc5d56ab8c7b8b98bef93166efb2e Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 01:32:36 +0900 Subject: [PATCH 022/318] Add parentheses to clarify calculations --- apps/openmw/mwmechanics/alchemy.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/alchemy.cpp b/apps/openmw/mwmechanics/alchemy.cpp index 783bbf573..e6e3b4c4e 100644 --- a/apps/openmw/mwmechanics/alchemy.cpp +++ b/apps/openmw/mwmechanics/alchemy.cpp @@ -171,10 +171,10 @@ void MWMechanics::Alchemy::updateEffects() if (fPotionT1DurMult<=0) throw std::runtime_error ("invalid gmst: fPotionT1DurMult"); - float magnitude = magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude ? - 1 : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost; - float duration = magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration ? - 1 : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost; + float magnitude = (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude) ? + 1.0f : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost; + float duration = (magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration) ? + 1.0f : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost; if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)) applyTools (magicEffect->mData.mFlags, magnitude); From e87d2aa1af635f47e4870605312a9ec693cacffd Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 01:47:30 +0900 Subject: [PATCH 023/318] Remove unused function --- apps/openmw/mwphysics/physicssystem.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 5e79e2a09..40805a4b1 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -230,13 +230,6 @@ namespace MWPhysics return direction - project(direction, planeNormal); } - static inline osg::Vec3f reflect(const osg::Vec3& velocity, const osg::Vec3f& normal) - { - return velocity - (normal * (normal * velocity)) * 2; - // ^ dot product - } - - public: static osg::Vec3f traceDown(const MWWorld::Ptr &ptr, const osg::Vec3f& position, Actor* actor, btCollisionWorld* collisionWorld, float maxHeight) { From 29cf296be5b96fbeb23eba4daef4dcfca129bb4a Mon Sep 17 00:00:00 2001 From: Ryan Tucker Date: Wed, 19 Apr 2017 22:28:18 -0700 Subject: [PATCH 024/318] Added all settings that are in settings.cfg but were not yet documented. --- .../reference/modding/settings/camera.rst | 4 +- .../reference/modding/settings/game.rst | 18 ++++ .../reference/modding/settings/general.rst | 28 +++-- .../reference/modding/settings/index.rst | 37 +++---- .../source/reference/modding/settings/map.rst | 25 ++++- .../reference/modding/settings/shaders.rst | 101 ++++++++++++++++++ .../reference/modding/settings/terrain.rst | 2 +- .../reference/modding/settings/video.rst | 2 +- .../reference/modding/settings/water.rst | 9 ++ 9 files changed, 195 insertions(+), 31 deletions(-) create mode 100644 docs/source/reference/modding/settings/shaders.rst diff --git a/docs/source/reference/modding/settings/camera.rst b/docs/source/reference/modding/settings/camera.rst index 2edc98d02..3480c2e9d 100644 --- a/docs/source/reference/modding/settings/camera.rst +++ b/docs/source/reference/modding/settings/camera.rst @@ -48,8 +48,8 @@ This value controls the maximum visible distance (also called the far clipping p The constant 8192 is the size of a cell, and 1024 is the threshold distance for loading a new cell. Additionally, the field of view setting also interacts with this setting because the view frustrum end is a plane, so you can see further at the edges of the screen than you should be able to. This can be observed in game by looking at distant objects and rotating the camera so the objects are near the edge of the screen. As a result, this setting should further be reduced by a factor that depends on the field of view setting. In the default configuration this reduction is 7%, hence the factor of 0.93 above. Using this factor, approximate values recommended for other exterior cell load distance settings are: ======= ======== - Cells Viewing - Distance +Cells Viewing + Distance ======= ======== 2 14285 3 21903 diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index 31ff3dd8c..edaefae8e 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -66,3 +66,21 @@ show effect duration Show the remaining duration of magic effects and lights if this setting is true. The remaining duration is displayed in the tooltip by hovering over the magical effect. The default value is false. This setting can only be configured by editing the settings configuration file. + +prevent merchant equipping +-------------------------- + +:Type: boolean +:Range: True/False +:Default: False + +Prevents merchants from equipping items that are sold to them. + +followers attack on sight +------------------------- + +:Type: boolean +:Range: True/False +:Default: False + +Makes player followers and escorters start combat with enemies who have started combat with them or the player. Otherwise they wait for the enemies or the player to do an attack first. \ No newline at end of file diff --git a/docs/source/reference/modding/settings/general.rst b/docs/source/reference/modding/settings/general.rst index e71e82977..7d241090a 100644 --- a/docs/source/reference/modding/settings/general.rst +++ b/docs/source/reference/modding/settings/general.rst @@ -23,13 +23,29 @@ Specify the format for screen shots taken by pressing the screen shot key (bound The default value is "png". This setting can only be configured by editing the settings configuration file. -texture filtering ------------------ +texture mag filter +------------------ + +:Type: string +:Range: nearest, linear +:Default: linear + +Set the texture magnification filter type. + +texture min filter +------------------ :Type: string -:Range: bilinear, trilinear -:Default: trilinear +:Range: nearest, linear +:Default: linear + +Set the texture minification filter type. -Set the isotropic texture filtering mode to bilinear or trilinear. Bilinear filtering is a texture filtering method used to smooth textures when displayed larger or smaller than they actually are. Bilinear filtering is reasonably accurate until the scaling of the texture gets below half or above double the original size of the texture. Trilinear filtering is an extension of the bilinear texture filtering method, which also performs linear interpolation between mipmaps. Both methods use mipmaps in OpenMW, and the corresponding OpenGL modes are LINEAR_MIPMAP_NEAREST and LINEAR_MIPMAP_LINEAR. Trilinear filtering produces better texturing at a minimal cost on modern video cards. +texture mipmap +-------------- + +:Type: string +:Range: none, nearest, linear +:Default: nearest -The default value is trilinear. This setting can be changed in game using the Texture filtering pull down in the Detail tab of the Video panel of the Options menu. \ No newline at end of file +Set the texture mipmap type to control the method mipmaps are created. Mipmapping is a way of reducing the processing power needed during minification by pregenerating a series of smaller textures. \ No newline at end of file diff --git a/docs/source/reference/modding/settings/index.rst b/docs/source/reference/modding/settings/index.rst index 0d0c9323d..b0d81e4b0 100644 --- a/docs/source/reference/modding/settings/index.rst +++ b/docs/source/reference/modding/settings/index.rst @@ -2,28 +2,29 @@ Advanced Settings Configuration ############################### -This part of the guide will cover how to make modifications to the more arcane settings in OpenMW, most of which are not available from in-game menus, to optimize or customize your OpenMW experience. If you are familiar with ``.ini`` tweaks in Morrowind or the other games, this will be quite similar. All settings described in this section are changed in ``settings.cfg``, located in your OpenMW user directory. See :doc:`paths` for this location. +This part of the guide will cover how to make modifications to the more arcane settings in OpenMW, most of which are not available from in-game menus, to optimize or customize your OpenMW experience. If you are familiar with ``.ini`` tweaks in Morrowind or the other games, this will be quite similar. All settings described in this section are changed in ``settings.cfg``, located in your OpenMW user directory. See :doc:`../paths` for this location. Although this guide attempts to be comprehensive and up to date, you will always be able to find the full list of settings available and their default values in ``settings-default.cfg`` in your main OpenMW installation directory. The ranges I have included with each setting are the physically possible ranges, not recommendations. .. warning:: - As the title suggests, these are advanced settings. If digging around plain text files and manually editing settings sounds scary to you, you may want to stear clear of altering these files. That being said, this guide should be plenty clear enough that you can find the setting you want to change and safely edit it. + As the title suggests, these are advanced settings. If digging around plain text files and manually editing settings sounds scary to you, you may want to steer clear of altering these files. That being said, this guide should be plenty clear enough that you can find the setting you want to change and safely edit it. .. toctree:: - :caption: Table of Contents - :maxdepth: 2 + :caption: Table of Contents + :maxdepth: 2 - camera - cells - map - GUI - HUD - game - general - input - saves - sound - terrain - video - water - windows + camera + cells + map + GUI + HUD + game + general + shaders + input + saves + sound + terrain + video + water + windows diff --git a/docs/source/reference/modding/settings/map.rst b/docs/source/reference/modding/settings/map.rst index f3e0a1c53..d65f4bd8f 100644 --- a/docs/source/reference/modding/settings/map.rst +++ b/docs/source/reference/modding/settings/map.rst @@ -1,8 +1,8 @@ Map Settings ############ -global map size ---------------- +global map cell size +-------------------- :Type: integer :Range: >= 1 @@ -10,7 +10,8 @@ global map size This setting adjusts the scale of the world map in the GUI mode map window. The value is the width in pixels of each cell in the map, so larger values result in larger more detailed world maps, while smaller values result in smaller less detailed world maps. However, the native resolution of the map source material appears to be 9 pixels per unexplored cell and approximately 18 pixels per explored cell, so values larger than 36 don't produce much additional detail. Similarly, the size of place markers is currently fixed at 12 pixels, so values smaller than this result in overlapping place markers. Values from 12 to 36 are recommended. For reference, Vvardenfell is approximately 41x36 cells. -Warning: Changing this setting affects saved games. The currently explored area is stored as an image in the save file that's overlayed on the default world map in game. When you increase the resolution of the map, the overlay of earlier saved games will be scaled up on load, and appear blurry. When you visit the cell again, the overlay for that cell is regenerated at the new resolution, so the blurry areas can be corrected by revisiting all the cells you've already visited. +.. Warning:: + Changing this setting affects saved games. The currently explored area is stored as an image in the save file that's overlayed on the default world map in game. When you increase the resolution of the map, the overlay of earlier saved games will be scaled up on load, and appear blurry. When you visit the cell again, the overlay for that cell is regenerated at the new resolution, so the blurry areas can be corrected by revisiting all the cells you've already visited. The default value for this setting is 18. This setting can not be configured except by editing the settings configuration file. @@ -27,6 +28,15 @@ Note that the actual size of the widget is always the same on the screen unless The default value for this setting is 256. This setting can not be configured except by editing the settings configuration file. +local map hud fog of war +------------------------ + +:Type: boolean +:Range: True/False +:Default: False + +This setting enables fog of war rendering on the HUD map. Default is Off since with default settings the map is so small that the fog would not obscure anything, just darken the edges slightly. + local map resolution -------------------- @@ -51,3 +61,12 @@ local map widget size This setting controls the canvas size of the GUI mode local map window. Larger values result in a larger physical map size on screen, and typically require more panning to see all available portions of the map. This larger size also enables an overall greater level of detail if the local map resolution setting is also increased. The default value for this setting is 512. This setting can not be configured except by editing the settings configuration file. + +local map cell distance +----------------------- + +:Type: integer +:Range: >= 1 +:Default: 1 + +Similar to "[Cells] exterior cell load distance", controls how many cells are rendered on the local map. Values higher than the default may result in longer loading times. \ No newline at end of file diff --git a/docs/source/reference/modding/settings/shaders.rst b/docs/source/reference/modding/settings/shaders.rst new file mode 100644 index 000000000..7b736f567 --- /dev/null +++ b/docs/source/reference/modding/settings/shaders.rst @@ -0,0 +1,101 @@ +Shader Settings +############### + +force shaders +------------- + +:Type: boolean +:Range: True/False +:Default: False + +Force rendering with shaders. By default, only bump-mapped objects will use shaders. Enabling this option may cause slightly different visuals if the "clamp lighting" option is set to false. Otherwise, there should not be a visual difference. + +force per pixel lighting +------------------------ + +:Type: boolean +:Range: True/False +:Default: False + +Force the use of per pixel lighting. By default, only bump mapped objects use per-pixel lighting. Has no effect if the 'force shaders' option is false. Enabling per-pixel lighting can result in visual differences to the original MW engine. It is not recommended to enable this option when using vanilla Morrowind files, because certain lights in Morrowind rely on vertex lighting to look as intended. + +clamp lighting +-------------- + +:Type: boolean +:Range: True/False +:Default: True + +Restrict the amount of lighting that an object can receive to a maximum of (1,1,1). Only affects objects that render with shaders (see 'force shaders' option). Always affects terrain. Setting this option to 'true' results in fixed-function compatible lighting, but the lighting may appear 'dull' and there might be color shifts. Setting this option to 'false' results in more realistic lighting. + +auto use object normal maps +--------------------------- + +:Type: boolean +:Range: True/False +:Default: False + +If this option is enabled, normal maps are automatically recognized and used if they are named appropriately (see 'normal map pattern', e.g. for a base texture foo.dds, the normal map texture would have to be named foo_n.dds). If this option is disabled, normal maps are only used if they are explicitly listed within the mesh file (.nif or .osg file). Affects objects. + +auto use object specular maps +----------------------------- + +:Type: boolean +:Range: True/False +:Default: False + +If this option is enabled, specular maps are automatically recognized and used if they are named appropriately (see 'specular map pattern', e.g. for a base texture foo.dds, the specular map texture would have to be named foo_spec.dds). If this option is disabled, normal maps are only used if they are explicitly listed within the mesh file (.osg file, not supported in .nif files). Affects objects. + +auto use terrain normal maps +---------------------------- + +:Type: boolean +:Range: True/False +:Default: False + +See 'auto use object normal maps'. Affects terrain. + +auto use terrain specular maps +------------------------------ + +:Type: boolean +:Range: True/False +:Default: False + +If a file with pattern 'terrain specular map pattern' exists, use that file as a 'diffuse specular' map. The texture must contain the layer color in the RGB channel (as usual), and a specular multiplier in the alpha channel. + +normal map pattern +------------------ + +:Type: string +:Range: +:Default: _n + +The filename pattern to probe for when detecting normal maps (see 'auto use object normal maps', 'auto use terrain normal maps') + +normal height map pattern +------------------------- + +:Type: string +:Range: +:Default: _nh + +Alternative filename pattern to probe for when detecting normal maps. Files with this pattern are expected to include 'height' in the alpha channel.This height is used for parallax effects. Works for both terrain and objects. + +specular map pattern +-------------------- + +:Type: string +:Range: +:Default: _spec + +The filename pattern to probe for when detecting object specular maps (see 'auto use object specular maps') + +terrain specular map pattern +---------------------------- + +:Type: string +:Range: +:Default: _diffusespec + +The filename pattern to probe for when detecting terrain specular maps (see 'auto use terrain specular maps') \ No newline at end of file diff --git a/docs/source/reference/modding/settings/terrain.rst b/docs/source/reference/modding/settings/terrain.rst index 8c550b269..75eab27c2 100644 --- a/docs/source/reference/modding/settings/terrain.rst +++ b/docs/source/reference/modding/settings/terrain.rst @@ -1,5 +1,5 @@ Terrain Settings -############### +################ distant terrain --------------- diff --git a/docs/source/reference/modding/settings/video.rst b/docs/source/reference/modding/settings/video.rst index b724611ad..3d0197bfe 100644 --- a/docs/source/reference/modding/settings/video.rst +++ b/docs/source/reference/modding/settings/video.rst @@ -50,7 +50,7 @@ minimize on focus loss :Type: boolean :Range: True/False -:Default: False +:Default: True Minimize the OpenMW window if it loses cursor focus. This setting is primarily useful for single screen configurations, so that the OpenMW screen in full screen mode can be minimized when the operating system regains control of the mouse and keyboard. On multiple screen configurations, disabling this option makes it easier to switch between screens while playing OpenMW. diff --git a/docs/source/reference/modding/settings/water.rst b/docs/source/reference/modding/settings/water.rst index b2d04a416..1c573a5c0 100644 --- a/docs/source/reference/modding/settings/water.rst +++ b/docs/source/reference/modding/settings/water.rst @@ -42,6 +42,15 @@ This setting has no effect if the shader setting is false. The default setting is false. This setting can be toggled with the Refraction button in the Water tab of the Video panel of the Options menu. +reflect actors +-------------- + +:Type: boolean +:Range: True/False +:Default: False + +This setting controls whether or not NPCs and creatures are drawn in water reflections. Setting this to true will enable actors in reflections and increase realism with a likely decrease in performance. This setting is off by default. + small feature culling pixel size -------------------------------- From 2e5fd74db0c3f0b6db9a4aafebcc86b9d991c273 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 19:09:38 +0900 Subject: [PATCH 025/318] Fix invalid iterator warning --- apps/openmw/mwmechanics/actors.cpp | 14 ++------------ apps/openmw/mwmechanics/aisequence.cpp | 8 ++++---- apps/openmw/mwmechanics/aisequence.hpp | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 1ae0e36a9..2e200d6c3 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -114,9 +114,7 @@ void adjustCommandedActor (const MWWorld::Ptr& actor) } if (!check.mCommanded && hasCommandPackage) - { stats.getAiSequence().erase(it); - } } void getRestorationPerHourOfSleep (const MWWorld::Ptr& ptr, float& health, float& magicka) @@ -707,16 +705,8 @@ namespace MWMechanics // any value of calm > 0 will stop the actor from fighting if ((effects.get(ESM::MagicEffect::CalmHumanoid).getMagnitude() > 0 && ptr.getClass().isNpc()) - || (effects.get(ESM::MagicEffect::CalmCreature).getMagnitude() > 0 && !ptr.getClass().isNpc())) - { - for (std::list::const_iterator it = creatureStats.getAiSequence().begin(); it != creatureStats.getAiSequence().end(); ) - { - if ((*it)->getTypeId() == AiPackage::TypeIdCombat) - it = creatureStats.getAiSequence().erase(it); - else - ++it; - } - } + || (effects.get(ESM::MagicEffect::CalmCreature).getMagnitude() > 0 && !ptr.getClass().isNpc())) + creatureStats.getAiSequence().stopCombat(); // Update bound effects // Note: in vanilla MW multiple bound items of the same type can be created by different spells. diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 84c8eca49..125805507 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -96,16 +96,16 @@ std::list::const_iterator AiSequence::end() const return mPackages.end(); } -std::list::const_iterator AiSequence::erase(std::list::const_iterator package) +void AiSequence::erase(std::list::const_iterator package) { // Not sure if manually terminated packages should trigger mDone, probably not? for(std::list::iterator it = mPackages.begin(); it != mPackages.end(); ++it) { if (package == it) { - AiPackage* packagePtr = *it; - delete packagePtr; - return mPackages.erase(it); + delete *it; + mPackages.erase(it); + return; } } throw std::runtime_error("can't find package to erase"); diff --git a/apps/openmw/mwmechanics/aisequence.hpp b/apps/openmw/mwmechanics/aisequence.hpp index 4f8b542a4..4b6ec156a 100644 --- a/apps/openmw/mwmechanics/aisequence.hpp +++ b/apps/openmw/mwmechanics/aisequence.hpp @@ -64,7 +64,7 @@ namespace MWMechanics std::list::const_iterator begin() const; std::list::const_iterator end() const; - std::list::const_iterator erase (std::list::const_iterator package); + void erase (std::list::const_iterator package); /// Returns currently executing AiPackage type /** \see enum AiPackage::TypeId **/ From 90d90b6d8196cf4a09ae9efc46c1bae3fae230ff Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 20 Apr 2017 17:24:34 +0400 Subject: [PATCH 026/318] Fixed dynamic stats tooltips in review menu --- apps/openmw/mwgui/review.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index d2971a093..11d79e307 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -160,22 +160,31 @@ namespace MWGui void ReviewDialog::setHealth(const MWMechanics::DynamicStat& value) { - mHealth->setValue(static_cast(value.getCurrent()), static_cast(value.getModified())); - std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified()); + int current = std::max(0, static_cast(value.getCurrent())); + int modified = static_cast(value.getModified()); + + mHealth->setValue(current, modified); + std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified); mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr); } void ReviewDialog::setMagicka(const MWMechanics::DynamicStat& value) { - mMagicka->setValue(static_cast(value.getCurrent()), static_cast(value.getModified())); - std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified()); + int current = std::max(0, static_cast(value.getCurrent())); + int modified = static_cast(value.getModified()); + + mMagicka->setValue(current, modified); + std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified); mMagicka->setUserString("Caption_HealthDescription", "#{sMagDesc}\n" + valStr); } void ReviewDialog::setFatigue(const MWMechanics::DynamicStat& value) { - mFatigue->setValue(static_cast(value.getCurrent()), static_cast(value.getModified())); - std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified()); + int current = std::max(0, static_cast(value.getCurrent())); + int modified = static_cast(value.getModified()); + + mFatigue->setValue(current, modified); + std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified); mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr); } From 0a90b48e60c0554c23a0e39d5732d0166c06f011 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 20 Apr 2017 17:37:37 +0400 Subject: [PATCH 027/318] Fixed progressbars layout in review menu --- files/mygui/openmw_text.skin.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/mygui/openmw_text.skin.xml b/files/mygui/openmw_text.skin.xml index e442e37ee..163b9d134 100644 --- a/files/mygui/openmw_text.skin.xml +++ b/files/mygui/openmw_text.skin.xml @@ -139,24 +139,24 @@ color_misc=0,205,205 # ???? - + - + - + - + From ff3e307059ace308c2aebb9fbf89329368472583 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 20:36:14 +0900 Subject: [PATCH 028/318] Pass parameters by const reference --- apps/openmw/mwmechanics/actors.cpp | 4 ++-- apps/openmw/mwmechanics/aiwander.cpp | 2 +- apps/openmw/mwmechanics/aiwander.hpp | 2 +- apps/openmw/mwmechanics/character.cpp | 2 +- apps/openmw/mwmechanics/character.hpp | 2 +- apps/openmw/mwmechanics/enchanting.cpp | 8 ++++---- apps/openmw/mwmechanics/enchanting.hpp | 8 ++++---- apps/openmw/mwmechanics/pathfinding.cpp | 2 +- apps/openmw/mwphysics/physicssystem.cpp | 6 +++--- apps/openmw/mwphysics/physicssystem.hpp | 2 +- apps/openmw/mwrender/animation.cpp | 6 +++--- apps/openmw/mwrender/animation.hpp | 2 +- apps/openmw/mwrender/characterpreview.cpp | 4 ++-- apps/openmw/mwrender/characterpreview.hpp | 4 ++-- apps/openmw/mwrender/npcanimation.cpp | 6 +++--- apps/openmw/mwrender/objects.hpp | 2 +- apps/openmw/mwrender/util.cpp | 2 +- apps/openmw/mwscript/interpretercontext.cpp | 2 +- apps/openmw/mwscript/interpretercontext.hpp | 2 +- apps/openmw/mwworld/player.cpp | 2 +- apps/openmw/mwworld/player.hpp | 2 +- apps/openmw/mwworld/worldimp.cpp | 2 +- components/esm/esmwriter.hpp | 2 +- components/nifosg/controller.cpp | 6 +++--- components/nifosg/controller.hpp | 6 +++--- 25 files changed, 44 insertions(+), 44 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 2e200d6c3..3e37408b2 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -78,7 +78,7 @@ class CheckActorCommanded : public MWMechanics::EffectSourceVisitor MWWorld::Ptr mActor; public: bool mCommanded; - CheckActorCommanded(MWWorld::Ptr actor) + CheckActorCommanded(const MWWorld::Ptr& actor) : mActor(actor) , mCommanded(false){} @@ -149,7 +149,7 @@ namespace MWMechanics MWWorld::Ptr mActor; bool mTrapped; public: - SoulTrap(MWWorld::Ptr trappedCreature) + SoulTrap(const MWWorld::Ptr& trappedCreature) : mCreature(trappedCreature) , mTrapped(false) { diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index 5396b5b39..eba37d7a7 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -893,7 +893,7 @@ namespace MWMechanics storage.mAllowedNodes.push_back(PathFinder::MakePathgridPoint(vectorStart + delta)); } - void AiWander::SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos, AiWanderStorage& storage) + void AiWander::SetCurrentNodeToClosestAllowedNode(const osg::Vec3f& npcPos, AiWanderStorage& storage) { float distanceToClosestNode = std::numeric_limits::max(); unsigned int index = 0; diff --git a/apps/openmw/mwmechanics/aiwander.hpp b/apps/openmw/mwmechanics/aiwander.hpp index f9b03ca5e..13a4a1b4a 100644 --- a/apps/openmw/mwmechanics/aiwander.hpp +++ b/apps/openmw/mwmechanics/aiwander.hpp @@ -122,7 +122,7 @@ namespace MWMechanics /// convert point from local (i.e. cell) to world coordinates void ToWorldCoordinates(ESM::Pathgrid::Point& point, const ESM::Cell * cell); - void SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos, AiWanderStorage& storage); + void SetCurrentNodeToClosestAllowedNode(const osg::Vec3f& npcPos, AiWanderStorage& storage); void AddNonPathGridAllowedPoints(osg::Vec3f npcPos, const ESM::Pathgrid * pathGrid, int pointIndex, AiWanderStorage& storage); diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 85749d947..b71f31550 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -2242,7 +2242,7 @@ void CharacterController::setAttackingOrSpell(bool attackingOrSpell) mAttackingOrSpell = attackingOrSpell; } -void CharacterController::setAIAttackType(std::string attackType) +void CharacterController::setAIAttackType(const std::string& attackType) { mAttackType = attackType; } diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 9db127084..a3cdf097d 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -268,7 +268,7 @@ public: bool isSneaking() const; void setAttackingOrSpell(bool attackingOrSpell); - void setAIAttackType(std::string attackType); // set and used by AiCombat + void setAIAttackType(const std::string& attackType); static void setAttackTypeRandomly(std::string& attackType); bool readyToPrepareAttack() const; diff --git a/apps/openmw/mwmechanics/enchanting.cpp b/apps/openmw/mwmechanics/enchanting.cpp index 57ece6a79..714b5a09c 100644 --- a/apps/openmw/mwmechanics/enchanting.cpp +++ b/apps/openmw/mwmechanics/enchanting.cpp @@ -21,7 +21,7 @@ namespace MWMechanics , mSelfEnchanting(false) {} - void Enchanting::setOldItem(MWWorld::Ptr oldItem) + void Enchanting::setOldItem(const MWWorld::Ptr& oldItem) { mOldItemPtr=oldItem; if(!itemEmpty()) @@ -39,7 +39,7 @@ namespace MWMechanics mNewItemName=s; } - void Enchanting::setEffect(ESM::EffectList effectList) + void Enchanting::setEffect(const ESM::EffectList& effectList) { mEffectList=effectList; } @@ -49,7 +49,7 @@ namespace MWMechanics return mCastStyle; } - void Enchanting::setSoulGem(MWWorld::Ptr soulGem) + void Enchanting::setSoulGem(const MWWorld::Ptr& soulGem) { mSoulGemPtr=soulGem; } @@ -269,7 +269,7 @@ namespace MWMechanics mSelfEnchanting = selfEnchanting; } - void Enchanting::setEnchanter(MWWorld::Ptr enchanter) + void Enchanting::setEnchanter(const MWWorld::Ptr& enchanter) { mEnchanter = enchanter; } diff --git a/apps/openmw/mwmechanics/enchanting.hpp b/apps/openmw/mwmechanics/enchanting.hpp index a53027bb9..8e3b00e5a 100644 --- a/apps/openmw/mwmechanics/enchanting.hpp +++ b/apps/openmw/mwmechanics/enchanting.hpp @@ -29,14 +29,14 @@ namespace MWMechanics public: Enchanting(); - void setEnchanter(MWWorld::Ptr enchanter); + void setEnchanter(const MWWorld::Ptr& enchanter); void setSelfEnchanting(bool selfEnchanting); - void setOldItem(MWWorld::Ptr oldItem); + void setOldItem(const MWWorld::Ptr& oldItem); MWWorld::Ptr getOldItem() { return mOldItemPtr; } MWWorld::Ptr getGem() { return mSoulGemPtr; } void setNewItemName(const std::string& s); - void setEffect(ESM::EffectList effectList); - void setSoulGem(MWWorld::Ptr soulGem); + void setEffect(const ESM::EffectList& effectList); + void setSoulGem(const MWWorld::Ptr& soulGem); bool create(); //Return true if created, false if failed. void nextCastStyle(); //Set enchant type to next possible type (for mOldItemPtr object) int getCastStyle() const; diff --git a/apps/openmw/mwmechanics/pathfinding.cpp b/apps/openmw/mwmechanics/pathfinding.cpp index b0bdce8f1..5c0456096 100644 --- a/apps/openmw/mwmechanics/pathfinding.cpp +++ b/apps/openmw/mwmechanics/pathfinding.cpp @@ -15,7 +15,7 @@ namespace // Chooses a reachable end pathgrid point. start is assumed reachable. std::pair getClosestReachablePoint(const ESM::Pathgrid* grid, const MWWorld::CellStore *cell, - const osg::Vec3f pos, int start) + const osg::Vec3f& pos, int start) { assert(grid && !grid->mPoints.empty()); diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 40805a4b1..d209d0d95 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -794,7 +794,7 @@ namespace MWPhysics btVector3 mContactPoint; btScalar mLeastDistSqr; - DeepestNotMeContactTestResultCallback(const btCollisionObject* me, const std::vector targets, const btVector3 &origin) + DeepestNotMeContactTestResultCallback(const btCollisionObject* me, const std::vector& targets, const btVector3 &origin) : mMe(me), mTargets(targets), mOrigin(origin), mObject(NULL), mContactPoint(0,0,0), mLeastDistSqr(std::numeric_limits::max()) { } @@ -912,7 +912,7 @@ namespace MWPhysics class ClosestNotMeRayResultCallback : public btCollisionWorld::ClosestRayResultCallback { public: - ClosestNotMeRayResultCallback(const btCollisionObject* me, const std::vector targets, const btVector3& from, const btVector3& to) + ClosestNotMeRayResultCallback(const btCollisionObject* me, const std::vector& targets, const btVector3& from, const btVector3& to) : btCollisionWorld::ClosestRayResultCallback(from, to) , mMe(me), mTargets(targets) { @@ -938,7 +938,7 @@ namespace MWPhysics const std::vector mTargets; }; - PhysicsSystem::RayResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, MWWorld::ConstPtr ignore, std::vector targets, int mask, int group) const + PhysicsSystem::RayResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore, std::vector targets, int mask, int group) const { btVector3 btFrom = toBullet(from); btVector3 btTo = toBullet(to); diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 81385d675..5351d99dd 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -114,7 +114,7 @@ namespace MWPhysics }; /// @param me Optional, a Ptr to ignore in the list of results. targets are actors to filter for, ignoring all other actors. - RayResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, MWWorld::ConstPtr ignore = MWWorld::ConstPtr(), + RayResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore = MWWorld::ConstPtr(), std::vector targets = std::vector(), int mask = CollisionType_World|CollisionType_HeightMap|CollisionType_Actor|CollisionType_Door, int group=0xff) const; diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index fe20ac437..c825e74f2 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -282,7 +282,7 @@ namespace MWRender class GlowUpdater : public SceneUtil::StateSetUpdater { public: - GlowUpdater(int texUnit, osg::Vec4f color, const std::vector >& textures, + GlowUpdater(int texUnit, const osg::Vec4f& color, const std::vector >& textures, osg::Node* node, float duration, Resource::ResourceSystem* resourcesystem) : mTexUnit(texUnit) , mColor(color) @@ -383,7 +383,7 @@ namespace MWRender return mDone; } - void setColor(osg::Vec4f color) + void setColor(const osg::Vec4f& color) { mColor = color; mColorChanged = true; @@ -1362,7 +1362,7 @@ namespace MWRender useQuadratic, quadraticValue, quadraticRadiusMult, useLinear, linearRadiusMult, linearValue); } - void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, std::string texture) + void Animation::addEffect (const std::string& model, int effectId, bool loop, const std::string& bonename, const std::string& texture) { if (!mObjectRoot.get()) return; diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index 27572544f..202595182 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -362,7 +362,7 @@ public: * @param texture override the texture specified in the model's materials - if empty, do not override * @note Will not add an effect twice. */ - void addEffect (const std::string& model, int effectId, bool loop = false, const std::string& bonename = "", std::string texture = ""); + void addEffect (const std::string& model, int effectId, bool loop = false, const std::string& bonename = "", const std::string& texture = ""); void removeEffect (int effectId); void getLoopingEffects (std::vector& out) const; diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index dfb737d5e..db778e88d 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -105,7 +105,7 @@ namespace MWRender }; CharacterPreview::CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, - MWWorld::Ptr character, int sizeX, int sizeY, const osg::Vec3f& position, const osg::Vec3f& lookAt) + const MWWorld::Ptr& character, int sizeX, int sizeY, const osg::Vec3f& position, const osg::Vec3f& lookAt) : mParent(parent) , mResourceSystem(resourceSystem) , mPosition(position) @@ -244,7 +244,7 @@ namespace MWRender // -------------------------------------------------------------------------------------------------- - InventoryPreview::InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character) + InventoryPreview::InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, const MWWorld::Ptr& character) : CharacterPreview(parent, resourceSystem, character, 512, 1024, osg::Vec3f(0, 700, 71), osg::Vec3f(0,0,71)) { } diff --git a/apps/openmw/mwrender/characterpreview.hpp b/apps/openmw/mwrender/characterpreview.hpp index 273bacedb..f0d5ad0c9 100644 --- a/apps/openmw/mwrender/characterpreview.hpp +++ b/apps/openmw/mwrender/characterpreview.hpp @@ -28,7 +28,7 @@ namespace MWRender class CharacterPreview { public: - CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character, int sizeX, int sizeY, + CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, const MWWorld::Ptr& character, int sizeX, int sizeY, const osg::Vec3f& position, const osg::Vec3f& lookAt); virtual ~CharacterPreview(); @@ -73,7 +73,7 @@ namespace MWRender { public: - InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character); + InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, const MWWorld::Ptr& character); void updatePtr(const MWWorld::Ptr& ptr); diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 87b6ae2bc..6e95ce481 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -99,7 +99,7 @@ private: private: void resetBlinkTimer(); public: - HeadAnimationTime(MWWorld::Ptr reference); + HeadAnimationTime(const MWWorld::Ptr& reference); void updatePtr(const MWWorld::Ptr& updated); @@ -128,7 +128,7 @@ public: { } - void setOffset(osg::Vec3f offset) + void setOffset(const osg::Vec3f& offset) { mOffset = offset; } @@ -155,7 +155,7 @@ private: // -------------------------------------------------------------------------------------------------------------- -HeadAnimationTime::HeadAnimationTime(MWWorld::Ptr reference) +HeadAnimationTime::HeadAnimationTime(const MWWorld::Ptr& reference) : mReference(reference), mTalkStart(0), mTalkStop(0), mBlinkStart(0), mBlinkStop(0), mEnabled(true), mValue(0) { resetBlinkTimer(); diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index 8864e4483..659853763 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -37,7 +37,7 @@ class Animation; class PtrHolder : public osg::Object { public: - PtrHolder(MWWorld::Ptr ptr) + PtrHolder(const MWWorld::Ptr& ptr) : mPtr(ptr) { } diff --git a/apps/openmw/mwrender/util.cpp b/apps/openmw/mwrender/util.cpp index 74047b58b..ed10d86ac 100644 --- a/apps/openmw/mwrender/util.cpp +++ b/apps/openmw/mwrender/util.cpp @@ -14,7 +14,7 @@ namespace MWRender class TextureOverrideVisitor : public osg::NodeVisitor { public: - TextureOverrideVisitor(std::string texture, Resource::ResourceSystem* resourcesystem) + TextureOverrideVisitor(const std::string& texture, Resource::ResourceSystem* resourcesystem) : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) , mTexture(texture) , mResourcesystem(resourcesystem) diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 0c70b6996..2462d72ae 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -137,7 +137,7 @@ namespace MWScript InterpreterContext::InterpreterContext ( - MWScript::Locals *locals, MWWorld::Ptr reference, const std::string& targetId) + MWScript::Locals *locals, const MWWorld::Ptr& reference, const std::string& targetId) : mLocals (locals), mReference (reference), mTargetId (targetId) { // If we run on a reference (local script, dialogue script or console with object diff --git a/apps/openmw/mwscript/interpretercontext.hpp b/apps/openmw/mwscript/interpretercontext.hpp index fdd5aa55f..80861d1a7 100644 --- a/apps/openmw/mwscript/interpretercontext.hpp +++ b/apps/openmw/mwscript/interpretercontext.hpp @@ -51,7 +51,7 @@ namespace MWScript public: - InterpreterContext (MWScript::Locals *locals, MWWorld::Ptr reference, + InterpreterContext (MWScript::Locals *locals, const MWWorld::Ptr& reference, const std::string& targetId = ""); ///< The ownership of \a locals is not transferred. 0-pointer allowed. diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index fe13a4d60..d233fba6f 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -255,7 +255,7 @@ namespace MWWorld return MWBase::Environment::get().getMechanicsManager()->getEnemiesNearby(getPlayer()).size() != 0; } - void Player::markPosition(CellStore *markedCell, ESM::Position markedPosition) + void Player::markPosition(CellStore *markedCell, const ESM::Position& markedPosition) { mMarkedCell = markedCell; mMarkedPosition = markedPosition; diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 157501803..4ba66e37e 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -61,7 +61,7 @@ namespace MWWorld void setWerewolfSkillsAttributes(); // For mark/recall magic effects - void markPosition (CellStore* markedCell, ESM::Position markedPosition); + void markPosition (CellStore* markedCell, const ESM::Position& markedPosition); void getMarkedPosition (CellStore*& markedCell, ESM::Position& markedPosition) const; /// Interiors can not always be mapped to a world position. However diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 6ae348966..1d7e6efba 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2989,7 +2989,7 @@ namespace MWWorld struct AddDetectedReferenceVisitor { - AddDetectedReferenceVisitor(std::vector& out, Ptr detector, World::DetectionType type, float squaredDist) + AddDetectedReferenceVisitor(std::vector& out, const Ptr& detector, World::DetectionType type, float squaredDist) : mOut(out), mDetector(detector), mSquaredDist(squaredDist), mType(type) { } diff --git a/components/esm/esmwriter.hpp b/components/esm/esmwriter.hpp index d11b3c940..5d7aebaf9 100644 --- a/components/esm/esmwriter.hpp +++ b/components/esm/esmwriter.hpp @@ -86,7 +86,7 @@ private: // Prevent using writeHNT with strings. This already happened by accident and results in // state being discarded without any error on writing or reading it. :( // writeHNString and friends must be used instead. - void writeHNT(const std::string &name, std::string data) + void writeHNT(const std::string& name, const std::string& data) { } void writeT(const std::string& data) diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 8d0c73bff..87a0b830e 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -218,7 +218,7 @@ UVController::UVController() { } -UVController::UVController(const Nif::NiUVData *data, std::set textureUnits) +UVController::UVController(const Nif::NiUVData *data, const std::set& textureUnits) : mUTrans(data->mKeyList[0], 0.f) , mVTrans(data->mKeyList[1], 0.f) , mUScale(data->mKeyList[2], 1.f) @@ -381,14 +381,14 @@ void MaterialColorController::apply(osg::StateSet *stateset, osg::NodeVisitor *n } } -FlipController::FlipController(const Nif::NiFlipController *ctrl, std::vector > textures) +FlipController::FlipController(const Nif::NiFlipController *ctrl, const std::vector >& textures) : mTexSlot(ctrl->mTexSlot) , mDelta(ctrl->mDelta) , mTextures(textures) { } -FlipController::FlipController(int texSlot, float delta, std::vector > textures) +FlipController::FlipController(int texSlot, float delta, const std::vector >& textures) : mTexSlot(texSlot) , mDelta(delta) , mTextures(textures) diff --git a/components/nifosg/controller.hpp b/components/nifosg/controller.hpp index ce268f587..e517f9189 100644 --- a/components/nifosg/controller.hpp +++ b/components/nifosg/controller.hpp @@ -223,7 +223,7 @@ namespace NifOsg public: UVController(); UVController(const UVController&,const osg::CopyOp&); - UVController(const Nif::NiUVData *data, std::set textureUnits); + UVController(const Nif::NiUVData *data, const std::set& textureUnits); META_Object(NifOsg,UVController) @@ -297,8 +297,8 @@ namespace NifOsg std::vector > mTextures; public: - FlipController(const Nif::NiFlipController* ctrl, std::vector > textures); - FlipController(int texSlot, float delta, std::vector > textures); + FlipController(const Nif::NiFlipController* ctrl, const std::vector >& textures); + FlipController(int texSlot, float delta, const std::vector >& textures); FlipController(); FlipController(const FlipController& copy, const osg::CopyOp& copyop); From c65c643abe3969a772e71bc849fddb9f021ef70d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 20 Apr 2017 21:30:13 +0400 Subject: [PATCH 029/318] Fixed race menu skills layout --- files/mygui/openmw_chargen_race.layout | 2 +- files/mygui/openmw_resources.xml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/files/mygui/openmw_chargen_race.layout b/files/mygui/openmw_chargen_race.layout index 58eb6f6f7..bddede361 100644 --- a/files/mygui/openmw_chargen_race.layout +++ b/files/mygui/openmw_chargen_race.layout @@ -84,7 +84,7 @@ - + diff --git a/files/mygui/openmw_resources.xml b/files/mygui/openmw_resources.xml index 662d78ab7..ef11d10a0 100644 --- a/files/mygui/openmw_resources.xml +++ b/files/mygui/openmw_resources.xml @@ -68,11 +68,13 @@ - + + - + + From 1ffb9e1bf34068c1bdd46a78811d8d63c2685a47 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 21 Apr 2017 00:50:22 +0200 Subject: [PATCH 030/318] Remove renderWorldMap() --- apps/openmw/engine.cpp | 1 - apps/openmw/mwgui/windowmanagerimp.cpp | 6 +----- apps/openmw/mwgui/windowmanagerimp.hpp | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 2a0bcb108..81fb2e6a7 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -526,7 +526,6 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) window->setStore(mEnvironment.getWorld()->getStore()); window->initUI(); - window->renderWorldMap(); //Load translation data mTranslationDataStorage.setEncoder(mEncoder); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 9238e5cfd..cb5450988 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -289,6 +289,7 @@ namespace MWGui mMenu = new MainMenu(w, h, mResourceSystem->getVFS(), mVersionDescription); mLocalMapRender = new MWRender::LocalMap(mViewer->getSceneData()->asGroup()); mMap = new MapWindow(mCustomMarkers, mDragAndDrop, mLocalMapRender, mWorkQueue); + mMap->renderGlobalMap(); trackWindow(mMap, "map"); mStatsWindow = new StatsWindow(mDragAndDrop); trackWindow(mStatsWindow, "stats"); @@ -374,11 +375,6 @@ namespace MWGui MWBase::Environment::get().getInputManager()->changeInputMode(false); } - void WindowManager::renderWorldMap() - { - mMap->renderGlobalMap(); - } - void WindowManager::setNewGame(bool newgame) { // This method will always be called after loading a savegame or starting a new game diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index a8f6263c2..b1948c1f7 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -137,7 +137,6 @@ namespace MWGui void setStore (const MWWorld::ESMStore& store); void initUI(); - void renderWorldMap(); virtual Loading::Listener* getLoadingScreen(); From c2240e3af1e3870f834eaeccdb7dd6e7f1275071 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 21 Apr 2017 00:51:13 +0200 Subject: [PATCH 031/318] Call the WindowManager::updatePlayer after the startup script is run --- apps/openmw/mwworld/worldimp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 6ae348966..536f5ac76 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -222,8 +222,6 @@ namespace MWWorld renderPlayer(); mRendering->resetCamera(); - MWBase::Environment::get().getWindowManager()->updatePlayer(); - // we don't want old weather to persist on a new game // Note that if reset later, the initial ChangeWeather that the chargen script calls will be lost. delete mWeatherManager; @@ -283,6 +281,8 @@ namespace MWWorld if (!mStartupScript.empty()) MWBase::Environment::get().getWindowManager()->executeInConsole(mStartupScript); + + MWBase::Environment::get().getWindowManager()->updatePlayer(); } void World::clear() From 60c67bc327c24205afff66afe17d7ffafed32760 Mon Sep 17 00:00:00 2001 From: Allofich Date: Fri, 21 Apr 2017 03:55:28 +0900 Subject: [PATCH 032/318] Run scripts for voiced dialogue (Fixes #3787) --- apps/openmw/mwbase/dialoguemanager.hpp | 2 +- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 23 +++++++++++-------- apps/openmw/mwdialogue/dialoguemanagerimp.hpp | 6 ++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwbase/dialoguemanager.hpp b/apps/openmw/mwbase/dialoguemanager.hpp index 1fe63e633..18f249e56 100644 --- a/apps/openmw/mwbase/dialoguemanager.hpp +++ b/apps/openmw/mwbase/dialoguemanager.hpp @@ -50,7 +50,7 @@ namespace MWBase virtual void goodbye() = 0; - virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const = 0; + virtual void say(const MWWorld::Ptr &actor, const std::string &topic) = 0; //calbacks for the GUI virtual void keywordSelected (const std::string& keyword) = 0; diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 254bc7d47..489d726e6 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -171,7 +171,7 @@ namespace MWDialogue MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor); win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext)); - executeScript (info->mResultScript); + executeScript (info->mResultScript, mActor); mLastTopic = Misc::StringUtils::lowerCase(it->mId); // update topics again to accommodate changes resulting from executeScript @@ -190,7 +190,7 @@ namespace MWDialogue MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor); } - bool DialogueManager::compile (const std::string& cmd,std::vector& code) + bool DialogueManager::compile (const std::string& cmd, std::vector& code, const MWWorld::Ptr& actor) { bool success = true; @@ -206,7 +206,7 @@ namespace MWDialogue Compiler::Locals locals; - std::string actorScript = mActor.getClass().getScript (mActor); + std::string actorScript = actor.getClass().getScript (actor); if (!actorScript.empty()) { @@ -246,14 +246,14 @@ namespace MWDialogue return success; } - void DialogueManager::executeScript (const std::string& script) + void DialogueManager::executeScript (const std::string& script, const MWWorld::Ptr& actor) { std::vector code; - if(compile(script,code)) + if(compile(script, code, actor)) { try { - MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor); + MWScript::InterpreterContext interpreterContext(&actor.getRefData().getLocals(), actor); Interpreter::Interpreter interpreter; MWScript::installOpcodes (interpreter); interpreter.run (&code[0], code.size(), interpreterContext); @@ -317,7 +317,7 @@ namespace MWDialogue } } - executeScript (info->mResultScript); + executeScript (info->mResultScript, mActor); mLastTopic = topic; } @@ -500,7 +500,7 @@ namespace MWDialogue } } - executeScript (info->mResultScript); + executeScript (info->mResultScript, mActor); } else { @@ -618,13 +618,13 @@ namespace MWDialogue win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext), gmsts.find ("sServiceRefusal")->getString()); - executeScript (info->mResultScript); + executeScript (info->mResultScript, mActor); return true; } return false; } - void DialogueManager::say(const MWWorld::Ptr &actor, const std::string &topic) const + void DialogueManager::say(const MWWorld::Ptr &actor, const std::string &topic) { MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); if(!sndMgr->sayDone(actor)) @@ -647,6 +647,9 @@ namespace MWDialogue if (!info->mSound.empty()) sndMgr->say(actor, info->mSound); } + + if (!info->mResultScript.empty()) + executeScript(info->mResultScript, actor); } int DialogueManager::countSavedGameRecords() const diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.hpp b/apps/openmw/mwdialogue/dialoguemanagerimp.hpp index bbe42975c..40a24a1f8 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.hpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.hpp @@ -51,8 +51,8 @@ namespace MWDialogue void updateTopics(); void updateGlobals(); - bool compile (const std::string& cmd,std::vector& code); - void executeScript (const std::string& script); + bool compile (const std::string& cmd, std::vector& code, const MWWorld::Ptr& actor); + void executeScript (const std::string& script, const MWWorld::Ptr& actor); void executeTopic (const std::string& topic); @@ -74,7 +74,7 @@ namespace MWDialogue virtual bool checkServiceRefused (); - virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const; + virtual void say(const MWWorld::Ptr &actor, const std::string &topic); //calbacks for the GUI virtual void keywordSelected (const std::string& keyword); From ff3cb18d4f8448f4de82d8de4e0611740e6ed244 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 20 Apr 2017 20:44:42 +0900 Subject: [PATCH 033/318] Fix shadowing warnings --- apps/openmw/mwgui/charactercreation.cpp | 4 ++-- apps/openmw/mwmechanics/actors.cpp | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index b2c9f1038..2deb62215 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -246,8 +246,8 @@ namespace MWGui mReviewDialog->setBirthSign(player.getBirthSign()); { - MWWorld::Ptr player = MWMechanics::getPlayer(); - const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); + MWWorld::Ptr playerPtr = MWMechanics::getPlayer(); + const MWMechanics::CreatureStats& stats = playerPtr.getClass().getCreatureStats(playerPtr); mReviewDialog->setHealth ( stats.getHealth() ); mReviewDialog->setMagicka( stats.getMagicka() ); diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 3e37408b2..4916058f6 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -795,7 +795,7 @@ namespace MWMechanics NpcStats &stats = ptr.getClass().getNpcStats(ptr); // When npc stats are just initialized, mTimeToStartDrowning == -1 and we should get value from GMST - static const int fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get().find("fHoldBreathTime")->getFloat(); + static const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get().find("fHoldBreathTime")->getFloat(); if (stats.getTimeToStartDrowning() == -1.f) stats.setTimeToStartDrowning(fHoldBreathTime); @@ -835,10 +835,7 @@ namespace MWMechanics } } else - { - static const float fHoldBreathTime = world->getStore().get().find("fHoldBreathTime")->getFloat(); stats.setTimeToStartDrowning(fHoldBreathTime); - } } void Actors::updateEquippedLight (const MWWorld::Ptr& ptr, float duration) From f67ec9c9ce13ef0e743b25e8f7e67fc19ef69b26 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 21 Apr 2017 09:40:25 +0400 Subject: [PATCH 034/318] Use sLevel GMST instead of hardcoded text in load game menu --- apps/openmw/mwgui/savegamedialog.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index cbc95e808..ca4d9cdc4 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -168,9 +169,9 @@ namespace MWGui className = "?"; // From an older savegame format that did not support custom classes properly. } - title << " (Level " << it->getSignature().mPlayerLevel << " " << className << ")"; + title << " (#{sLevel} " << it->getSignature().mPlayerLevel << " " << className << ")"; - mCharacterSelection->addItem (title.str()); + mCharacterSelection->addItem (MyGUI::LanguageManager::getInstance().replaceTags(title.str())); if (mCurrentCharacter == &*it || (!mCurrentCharacter && !mSaving && directory==Misc::StringUtils::lowerCase ( From e717d046f24ad33534e7431546f2beed74b0313b Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 21 Apr 2017 17:21:57 +0400 Subject: [PATCH 035/318] Escaped class name string --- apps/openmw/mwgui/savegamedialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index ca4d9cdc4..84d4ca959 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -169,7 +169,7 @@ namespace MWGui className = "?"; // From an older savegame format that did not support custom classes properly. } - title << " (#{sLevel} " << it->getSignature().mPlayerLevel << " " << className << ")"; + title << " (#{sLevel} " << it->getSignature().mPlayerLevel << " " << MyGUI::TextIterator::toTagsString(className) << ")"; mCharacterSelection->addItem (MyGUI::LanguageManager::getInstance().replaceTags(title.str())); From e095817ac2a8c7f8ab7f9f585b4a2d4cb9dcb3e3 Mon Sep 17 00:00:00 2001 From: Allofich Date: Fri, 21 Apr 2017 19:57:30 +0900 Subject: [PATCH 036/318] Treat =< and => as == in scripts (Fixes #3744) --- components/compiler/scanner.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/compiler/scanner.cpp b/components/compiler/scanner.cpp index 720fde9f1..c2ec13b01 100644 --- a/components/compiler/scanner.cpp +++ b/components/compiler/scanner.cpp @@ -408,6 +408,11 @@ namespace Compiler special = S_cmpEQ; else if (c=='=') special = S_cmpEQ; + else if (c == '>' || c == '<') // Treat => and =< as == + { + special = S_cmpEQ; + mErrorHandler.warning (std::string("invalid operator =") + c + ", treating it as ==", mLoc); + } else { special = S_cmpEQ; From 143ee387cc1b820a7c711a8900ff11d848c8604e Mon Sep 17 00:00:00 2001 From: Allofich Date: Fri, 21 Apr 2017 23:22:55 +0900 Subject: [PATCH 037/318] Add enabled check to animation script commands (Fixes #3793) --- apps/openmw/mwscript/animationextensions.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/openmw/mwscript/animationextensions.cpp b/apps/openmw/mwscript/animationextensions.cpp index 347bbca56..e737d8ea1 100644 --- a/apps/openmw/mwscript/animationextensions.cpp +++ b/apps/openmw/mwscript/animationextensions.cpp @@ -42,6 +42,9 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); + if (!ptr.getRefData().isEnabled()) + return; + std::string group = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); @@ -69,6 +72,9 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); + if (!ptr.getRefData().isEnabled()) + return; + std::string group = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); From f986e3fafa63590ff5c4b836b688d336f2c5d45e Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 21 Apr 2017 18:03:23 +0400 Subject: [PATCH 038/318] Remove unused code --- apps/openmw/mwbase/windowmanager.hpp | 1 - apps/openmw/mwgui/windowmanagerimp.cpp | 8 +------- apps/openmw/mwgui/windowmanagerimp.hpp | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index 6a159ea7d..f103ce191 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -104,7 +104,6 @@ namespace MWBase * new dialogs. */ virtual void update() = 0; - virtual void updateVisible() = 0; /// @note This method will block until the video finishes playing /// (and will continually update the window while doing so) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 08d369250..e77281898 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -485,6 +485,7 @@ namespace MWGui void WindowManager::update() { cleanupGarbage(); + mHud->update(); } @@ -559,13 +560,6 @@ namespace MWGui return; } - // No need to check GUI if game mode - if (gameMode) - { - mInventoryWindow->setGuiMode(GM_None); - return; - } - if(mGuiModes.size() != 0) { GuiMode mode = mGuiModes.back(); diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 791ed602e..1b8ceecc2 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -361,7 +361,7 @@ namespace MWGui virtual void pinWindow (MWGui::GuiWindow window); - virtual void updatePinnedWindows (); + void updatePinnedWindows (); /// Fade the screen in, over \a time seconds virtual void fadeScreenIn(const float time, bool clearQueue); From 2b3b6d558fab78107f6cd04783d5348446f3890c Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 21 Apr 2017 19:37:09 +0400 Subject: [PATCH 039/318] Move updatePinnedWindows() function to private section --- apps/openmw/mwgui/windowmanagerimp.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 1b8ceecc2..787c88598 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -361,8 +361,6 @@ namespace MWGui virtual void pinWindow (MWGui::GuiWindow window); - void updatePinnedWindows (); - /// Fade the screen in, over \a time seconds virtual void fadeScreenIn(const float time, bool clearQueue); /// Fade the screen out to black, over \a time seconds @@ -541,6 +539,8 @@ namespace MWGui void createTextures(); void createCursors(); void setMenuTransparency(float value); + + void updatePinnedWindows(); }; } From f34e35eb19ff19cbb9d89c4f404489fa66de2d22 Mon Sep 17 00:00:00 2001 From: Allofich Date: Sat, 22 Apr 2017 07:34:08 +0900 Subject: [PATCH 040/318] Check for NULL before running voice scripts (Fixes #3834) --- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 489d726e6..c853efad2 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -646,10 +646,9 @@ namespace MWDialogue winMgr->messageBox(info->mResponse); if (!info->mSound.empty()) sndMgr->say(actor, info->mSound); + if (!info->mResultScript.empty()) + executeScript(info->mResultScript, actor); } - - if (!info->mResultScript.empty()) - executeScript(info->mResultScript, actor); } int DialogueManager::countSavedGameRecords() const From 45d9e38616c55e408de78a24a7ae2f455c8f0cef Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 22 Apr 2017 14:27:45 +0200 Subject: [PATCH 041/318] Fix check for default material --- components/nifosg/nifloader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index ff986c1f8..2e591619e 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1773,8 +1773,10 @@ namespace NifOsg } if (!hasMatCtrl && mat->getColorMode() == osg::Material::OFF + && mat->getEmission(osg::Material::FRONT_AND_BACK) == osg::Vec4f(0,0,0,1) && mat->getDiffuse(osg::Material::FRONT_AND_BACK) == osg::Vec4f(1,1,1,1) && mat->getAmbient(osg::Material::FRONT_AND_BACK) == osg::Vec4f(1,1,1,1) + && mat->getShininess(osg::Material::FRONT_AND_BACK) == 0 && mat->getSpecular(osg::Material::FRONT_AND_BACK) == osg::Vec4f(0.f, 0.f, 0.f, 0.f)) { // default state, skip From 4544caf7f34f4c510c37c899181f4ee2ebf3b948 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 17 Apr 2017 21:53:35 +0400 Subject: [PATCH 042/318] Improved bodypart select fallback (fixes #2594) --- apps/openmw/mwrender/npcanimation.cpp | 88 ++++++++++++++++++++------- apps/openmw/mwrender/npcanimation.hpp | 3 + 2 files changed, 70 insertions(+), 21 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 87b6ae2bc..f49e72f05 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -726,6 +726,19 @@ void NpcAnimation::removePartGroup(int group) } } +bool NpcAnimation::isFirstPersonPart(const ESM::BodyPart* bodypart) +{ + return (bodypart->mId.size() >= 3) + && bodypart->mId[bodypart->mId.size()-3] == '1' + && bodypart->mId[bodypart->mId.size()-2] == 's' + && bodypart->mId[bodypart->mId.size()-1] == 't'; +} + +bool NpcAnimation::isFemalePart(const ESM::BodyPart* bodypart) +{ + return bodypart->mData.mFlags & ESM::BodyPart::BPF_Female; +} + bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int group, int priority, const std::string &mesh, bool enchantedGlow, osg::Vec4f* glowColor) { if(priority <= mPartPriorities[type]) @@ -1096,46 +1109,79 @@ const std::vector& NpcAnimation::getBodyParts(const std:: if (!Misc::StringUtils::ciEqual(bodypart.mRace, race)) continue; - bool partFirstPerson = (bodypart.mId.size() >= 3) - && bodypart.mId[bodypart.mId.size()-3] == '1' - && bodypart.mId[bodypart.mId.size()-2] == 's' - && bodypart.mId[bodypart.mId.size()-1] == 't'; - if(partFirstPerson != (firstPerson)) + bool partFirstPerson = isFirstPersonPart(&bodypart); + + bool isHand = bodypart.mData.mPart == ESM::BodyPart::MP_Hand || + bodypart.mData.mPart == ESM::BodyPart::MP_Wrist || + bodypart.mData.mPart == ESM::BodyPart::MP_Forearm || + bodypart.mData.mPart == ESM::BodyPart::MP_Upperarm; + + bool isSameGender = isFemalePart(&bodypart) == female; + + /* A fallback for the arms if 1st person is missing: + 1. Try to use 3d person skin for same gender + 2. Try to use 1st person skin for male, if female == true + 3. Try to use 3d person skin for male, if female == true + + A fallback in another cases: allow to use male bodyparts, if female == true + */ + if (firstPerson && isHand && !partFirstPerson) { - if(firstPerson && (bodypart.mData.mPart == ESM::BodyPart::MP_Hand || - bodypart.mData.mPart == ESM::BodyPart::MP_Wrist || - bodypart.mData.mPart == ESM::BodyPart::MP_Forearm || - bodypart.mData.mPart == ESM::BodyPart::MP_Upperarm)) + // Allow 3rd person skins as a fallback for the arms if 1st person is missing + BodyPartMapType::const_iterator bIt = sBodyPartMap.lower_bound(BodyPartMapType::key_type(bodypart.mData.mPart)); + while(bIt != sBodyPartMap.end() && bIt->first == bodypart.mData.mPart) { - /* Allow 3rd person skins as a fallback for the arms if 1st person is missing. */ - BodyPartMapType::const_iterator bIt = sBodyPartMap.lower_bound(BodyPartMapType::key_type(bodypart.mData.mPart)); - while(bIt != sBodyPartMap.end() && bIt->first == bodypart.mData.mPart) - { - if(!parts[bIt->second]) - parts[bIt->second] = &*it; - ++bIt; - } + // If we have no fallback bodypart now and bodypart is for same gender (1) + if(!parts[bIt->second] && isSameGender) + parts[bIt->second] = &bodypart; + + // If we have fallback bodypart for other gender and found fallback for current gender (1) + else if(isSameGender && isFemalePart(parts[bIt->second]) != female) + parts[bIt->second] = &bodypart; + + // If we have no fallback bodypart and searching for female bodyparts (3) + else if(!parts[bIt->second] && female) + parts[bIt->second] = &bodypart; + + ++bIt; } + continue; } - if ((female) != (bodypart.mData.mFlags & ESM::BodyPart::BPF_Female)) + // Don't allow to use podyparts for a different view + if (partFirstPerson != firstPerson) + continue; + + if (female && !isFemalePart(&bodypart)) { - // Allow opposite gender's parts as fallback if parts for our gender are missing + // Allow male parts as fallback for females if female parts are missing BodyPartMapType::const_iterator bIt = sBodyPartMap.lower_bound(BodyPartMapType::key_type(bodypart.mData.mPart)); while(bIt != sBodyPartMap.end() && bIt->first == bodypart.mData.mPart) { + // If we have no fallback bodypart now if(!parts[bIt->second]) - parts[bIt->second] = &*it; + parts[bIt->second] = &bodypart; + + // If we have 3d person fallback bodypart for hand and 1st person fallback found (2) + else if(isHand && !isFirstPersonPart(parts[bIt->second]) && partFirstPerson) + parts[bIt->second] = &bodypart; + ++bIt; } + continue; } + // Don't allow to use podyparts for another gender + if (female != isFemalePart(&bodypart)) + continue; + + // Use properly found bodypart, replacing fallbacks BodyPartMapType::const_iterator bIt = sBodyPartMap.lower_bound(BodyPartMapType::key_type(bodypart.mData.mPart)); while(bIt != sBodyPartMap.end() && bIt->first == bodypart.mData.mPart) { - parts[bIt->second] = &*it; + parts[bIt->second] = &bodypart; ++bIt; } } diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index 427a1baf8..ad4d692c9 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -90,6 +90,9 @@ private: osg::ref_ptr mFirstPersonNeckController; + static bool isFirstPersonPart(const ESM::BodyPart* bodypart); + static bool isFemalePart(const ESM::BodyPart* bodypart); + protected: virtual void addControllers(); From bc9080d9d731cd9557f3fb02560a781e3f2ef5d0 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 23 Apr 2017 08:56:54 +0400 Subject: [PATCH 043/318] Removed 31 symbols cap from service menus --- files/mygui/openmw_alchemy_window.layout | 1 - files/mygui/openmw_enchanting_dialog.layout | 1 - files/mygui/openmw_spellcreation_dialog.layout | 1 - 3 files changed, 3 deletions(-) diff --git a/files/mygui/openmw_alchemy_window.layout b/files/mygui/openmw_alchemy_window.layout index d578f5506..8a1bf1347 100644 --- a/files/mygui/openmw_alchemy_window.layout +++ b/files/mygui/openmw_alchemy_window.layout @@ -12,7 +12,6 @@ - diff --git a/files/mygui/openmw_enchanting_dialog.layout b/files/mygui/openmw_enchanting_dialog.layout index 63638418c..ce9429c67 100644 --- a/files/mygui/openmw_enchanting_dialog.layout +++ b/files/mygui/openmw_enchanting_dialog.layout @@ -15,7 +15,6 @@ - diff --git a/files/mygui/openmw_spellcreation_dialog.layout b/files/mygui/openmw_spellcreation_dialog.layout index ba72c6541..e14674ad6 100644 --- a/files/mygui/openmw_spellcreation_dialog.layout +++ b/files/mygui/openmw_spellcreation_dialog.layout @@ -13,7 +13,6 @@ - From c2706ac3e7e6e040693827b042c1547b7ee7fb04 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 23 Apr 2017 09:14:32 +0400 Subject: [PATCH 044/318] Merchant repair and travel window scroll fix --- apps/openmw/mwgui/merchantrepair.cpp | 7 ++++--- apps/openmw/mwgui/merchantrepair.hpp | 1 + apps/openmw/mwgui/travelwindow.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/merchantrepair.cpp b/apps/openmw/mwgui/merchantrepair.cpp index c4639d602..f3a3e94ed 100644 --- a/apps/openmw/mwgui/merchantrepair.cpp +++ b/apps/openmw/mwgui/merchantrepair.cpp @@ -21,6 +21,7 @@ namespace MWGui { +const int MerchantRepair::sLineHeight = 18; MerchantRepair::MerchantRepair() : WindowBase("openmw_merchantrepair.layout") @@ -79,16 +80,16 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor) 0, currentY, 0, - 18, + sLineHeight, MyGUI::Align::Default ); - currentY += 18; + currentY += sLineHeight; button->setUserString("Price", MyGUI::utility::toString(price)); button->setUserData(MWWorld::Ptr(*iter)); button->setCaptionWithReplacing(name); - button->setSize(button->getTextSize().width,18); + button->setSize(mList->getWidth(),sLineHeight); button->eventMouseWheel += MyGUI::newDelegate(this, &MerchantRepair::onMouseWheel); button->setUserString("ToolTipType", "ItemPtr"); button->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onRepairButtonClick); diff --git a/apps/openmw/mwgui/merchantrepair.hpp b/apps/openmw/mwgui/merchantrepair.hpp index 231d11089..8dcdfee12 100644 --- a/apps/openmw/mwgui/merchantrepair.hpp +++ b/apps/openmw/mwgui/merchantrepair.hpp @@ -30,6 +30,7 @@ protected: void onRepairButtonClick(MyGUI::Widget* sender); void onOkButtonClick(MyGUI::Widget* sender); + static const int sLineHeight; }; } diff --git a/apps/openmw/mwgui/travelwindow.cpp b/apps/openmw/mwgui/travelwindow.cpp index 90d3f857a..59d139e20 100644 --- a/apps/openmw/mwgui/travelwindow.cpp +++ b/apps/openmw/mwgui/travelwindow.cpp @@ -94,7 +94,7 @@ namespace MWGui toAdd->setUserString("price",oss.str()); toAdd->setCaptionWithReplacing("#{sCell=" + name + "} - " + MyGUI::utility::toString(price)+"#{sgp}"); - toAdd->setSize(toAdd->getTextSize().width,sLineHeight); + toAdd->setSize(mDestinationsView->getWidth(),sLineHeight); toAdd->eventMouseWheel += MyGUI::newDelegate(this, &TravelWindow::onMouseWheel); toAdd->setUserString("Destination", name); toAdd->setUserData(pos); From eada8c6822ab2c2cd9b619cb3c6c3015c77119c3 Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sun, 23 Apr 2017 18:05:41 +0200 Subject: [PATCH 045/318] Fix wrong incrementation in InventoryStore::visitEffectSources (Fixes #3838) --- apps/openmw/mwworld/inventorystore.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index 44e62c755..fd7cb5d74 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -824,7 +824,7 @@ void MWWorld::InventoryStore::visitEffectSources(MWMechanics::EffectSourceVisito int i=0; for (std::vector::const_iterator effectIt (enchantment.mEffects.mList.begin()); - effectIt!=enchantment.mEffects.mList.end(); ++effectIt) + effectIt!=enchantment.mEffects.mList.end(); ++effectIt, ++i) { // Don't get spell icon display information for enchantments that weren't actually applied if (mMagicEffects.get(MWMechanics::EffectKey(*effectIt)).getMagnitude() == 0) @@ -834,8 +834,6 @@ void MWWorld::InventoryStore::visitEffectSources(MWMechanics::EffectSourceVisito magnitude *= params.mMultiplier; if (magnitude > 0) visitor.visit(MWMechanics::EffectKey(*effectIt), (**iter).getClass().getName(**iter), (**iter).getCellRef().getRefId(), -1, magnitude); - - ++i; } } } From 1c5c82dd9f27688e053ebe8f70f37ed56cd0afda Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sun, 23 Apr 2017 18:05:41 +0200 Subject: [PATCH 046/318] Fix wrong incrementation in InventoryStore::visitEffectSources (Fixes #3838) --- apps/openmw/mwworld/inventorystore.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index df3f30bea..d251e824c 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -823,7 +823,7 @@ void MWWorld::InventoryStore::visitEffectSources(MWMechanics::EffectSourceVisito int i=0; for (std::vector::const_iterator effectIt (enchantment.mEffects.mList.begin()); - effectIt!=enchantment.mEffects.mList.end(); ++effectIt) + effectIt!=enchantment.mEffects.mList.end(); ++effectIt, ++i) { // Don't get spell icon display information for enchantments that weren't actually applied if (mMagicEffects.get(MWMechanics::EffectKey(*effectIt)).getMagnitude() == 0) @@ -833,8 +833,6 @@ void MWWorld::InventoryStore::visitEffectSources(MWMechanics::EffectSourceVisito magnitude *= params.mMultiplier; if (magnitude > 0) visitor.visit(MWMechanics::EffectKey(*effectIt), (**iter).getClass().getName(**iter), (**iter).getCellRef().getRefId(), -1, magnitude); - - ++i; } } } From 83ff7d162c64b22558839b0d7130e9f62df7d916 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Tue, 25 Apr 2017 16:12:59 +1200 Subject: [PATCH 047/318] Add comment/uncomment actions to the context menu --- apps/opencs/view/world/scriptedit.cpp | 21 +++++++++++++++++++++ apps/opencs/view/world/scriptedit.hpp | 6 ++++++ 2 files changed, 27 insertions(+) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 6f27d5656..2367ede99 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "../../model/doc/document.hpp" @@ -284,6 +285,16 @@ void CSVWorld::ScriptEdit::updateLineNumberArea(const QRect &rect, int dy) updateLineNumberAreaWidth(0); } +void CSVWorld::ScriptEdit::commentSelection() +{ + +} + +void CSVWorld::ScriptEdit::uncommentSelection() +{ + +} + void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) { QPlainTextEdit::resizeEvent(e); @@ -292,6 +303,16 @@ void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) mLineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); } +void CSVWorld::ScriptEdit::contextMenuEvent(QContextMenuEvent *event) +{ + QMenu *menu = createStandardContextMenu(); + menu->addAction("Comment Selection", this, SLOT(commentSelection())); + menu->addAction("Uncomment Selection", this, SLOT(uncommentSelection())); + + menu->exec(event->globalPos()); + delete menu; +} + void CSVWorld::ScriptEdit::lineNumberAreaPaintEvent(QPaintEvent *event) { QPainter painter(mLineNumberArea); diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index 4977ed8e0..27e2cd17e 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -77,6 +77,8 @@ namespace CSVWorld virtual void resizeEvent(QResizeEvent *e); + virtual void contextMenuEvent(QContextMenuEvent *event); + private: QVector mAllowedTypes; @@ -111,6 +113,10 @@ namespace CSVWorld void updateLineNumberAreaWidth(int newBlockCount); void updateLineNumberArea(const QRect &, int); + + void commentSelection(); + + void uncommentSelection(); }; class LineNumberArea : public QWidget From 61e374fdfcfa0b5666977dcd1329b2d2e1cc34d8 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Tue, 25 Apr 2017 19:12:18 +1200 Subject: [PATCH 048/318] Implement commentSelection() and uncommentSelection() --- apps/opencs/view/world/scriptedit.cpp | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 2367ede99..2a2165e1f 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -287,12 +287,50 @@ void CSVWorld::ScriptEdit::updateLineNumberArea(const QRect &rect, int dy) void CSVWorld::ScriptEdit::commentSelection() { + QTextCursor begin = textCursor(); + QTextCursor end = begin; + begin.setPosition(begin.selectionStart()); + begin.movePosition(QTextCursor::StartOfLine); + end.setPosition(end.selectionEnd()); + end.movePosition(QTextCursor::StartOfLine); + + for (; begin <= end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) + { + begin.insertText(";"); + } } void CSVWorld::ScriptEdit::uncommentSelection() { + QTextCursor begin = textCursor(); + QTextCursor end = begin; + begin.setPosition(begin.selectionStart()); + begin.movePosition(QTextCursor::StartOfLine); + + end.setPosition(end.selectionEnd()); + end.movePosition(QTextCursor::StartOfLine); + + for (; begin <= end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) { + // loop through line until a nonspace character is reached + begin.select(QTextCursor::LineUnderCursor); + QString line = begin.selectedText(); + + // get first nonspace character in line + int index; + for (index = 0; index != line.size(); ++index) + { + if (!line[index].isSpace()) + break; + } + if (index != line.size() && line[index] == ';') + { + line.remove(index, 1); + } + + begin.insertText(line); + } } void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) From 1f699552f71f5dd9e0aa96f96e55a508926904ce Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Wed, 26 Apr 2017 15:49:39 +1200 Subject: [PATCH 049/318] Fix infinite recursion bug in uncommentSelection() --- apps/opencs/view/world/scriptedit.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 2a2165e1f..eb9757f60 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -293,9 +293,9 @@ void CSVWorld::ScriptEdit::commentSelection() begin.movePosition(QTextCursor::StartOfLine); end.setPosition(end.selectionEnd()); - end.movePosition(QTextCursor::StartOfLine); + end.movePosition(QTextCursor::EndOfLine); - for (; begin <= end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) + for (; begin < end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) { begin.insertText(";"); } @@ -309,13 +309,15 @@ void CSVWorld::ScriptEdit::uncommentSelection() begin.movePosition(QTextCursor::StartOfLine); end.setPosition(end.selectionEnd()); - end.movePosition(QTextCursor::StartOfLine); + end.movePosition(QTextCursor::EndOfLine); - for (; begin <= end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) { - // loop through line until a nonspace character is reached + for (; begin < end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) { begin.select(QTextCursor::LineUnderCursor); QString line = begin.selectedText(); + if (line.size() == 0) + continue; + // get first nonspace character in line int index; for (index = 0; index != line.size(); ++index) @@ -326,10 +328,11 @@ void CSVWorld::ScriptEdit::uncommentSelection() if (index != line.size() && line[index] == ';') { + // remove the semicolon line.remove(index, 1); + // put the line back + begin.insertText(line); } - - begin.insertText(line); } } From 3d1e640388d4c1260f8c6f8a9f0f5aef4a92f394 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Wed, 26 Apr 2017 19:42:03 +1200 Subject: [PATCH 050/318] Add setting to change keyboard shortcut and fix another crash --- apps/opencs/model/prefs/state.cpp | 4 ++++ apps/opencs/view/world/scriptedit.cpp | 26 ++++++++++++++++++-------- apps/opencs/view/world/scriptedit.hpp | 1 + 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index b8d6102ac..3de90e468 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -326,6 +326,10 @@ void CSMPrefs::State::declare() declareShortcut ("orbit-roll-right", "Roll Right", QKeySequence(Qt::Key_E)); declareShortcut ("orbit-speed-mode", "Toggle Speed Mode", QKeySequence(Qt::Key_F)); declareShortcut ("orbit-center-selection", "Center On Selected", QKeySequence(Qt::Key_C)); + + declareSubcategory ("Script Editor"); + declareShortcut ("script-editor-comment", "Comment Selection", QKeySequence()); + declareShortcut ("script-editor-uncomment", "Uncomment Selection", QKeySequence()); } void CSMPrefs::State::declareCategory (const std::string& key) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index eb9757f60..531c732ea 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -14,6 +14,7 @@ #include "../../model/world/universalid.hpp" #include "../../model/world/tablemimedata.hpp" #include "../../model/prefs/state.hpp" +#include "../../model/prefs/shortcut.hpp" CSVWorld::ScriptEdit::ChangeLock::ChangeLock (ScriptEdit& edit) : mEdit (edit) { @@ -87,6 +88,20 @@ CSVWorld::ScriptEdit::ScriptEdit( <associateAction(comment); + mContextMenu->addAction(comment); + + QAction* uncomment = new QAction (tr ("Uncomment Selection"), this); + connect(uncomment, SIGNAL (triggered()), this, SLOT (uncommentSelection())); + CSMPrefs::Shortcut* uncommentShortcut = new CSMPrefs::Shortcut("script-editor-uncomment", this); + uncommentShortcut->associateAction(uncomment); + mContextMenu->addAction(uncomment); + mHighlighter = new ScriptHighlighter (document.getData(), mode, ScriptEdit::document()); connect (&document.getData(), SIGNAL (idListChanged()), this, SLOT (idListChanged())); @@ -295,7 +310,7 @@ void CSVWorld::ScriptEdit::commentSelection() end.setPosition(end.selectionEnd()); end.movePosition(QTextCursor::EndOfLine); - for (; begin < end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) + for (; begin < end; begin.movePosition(QTextCursor::EndOfLine), begin.movePosition(QTextCursor::Right)) { begin.insertText(";"); } @@ -311,7 +326,7 @@ void CSVWorld::ScriptEdit::uncommentSelection() end.setPosition(end.selectionEnd()); end.movePosition(QTextCursor::EndOfLine); - for (; begin < end; begin.movePosition(QTextCursor::StartOfLine), begin.movePosition(QTextCursor::Down)) { + for (; begin < end; begin.movePosition(QTextCursor::EndOfLine), begin.movePosition(QTextCursor::Right)) { begin.select(QTextCursor::LineUnderCursor); QString line = begin.selectedText(); @@ -346,12 +361,7 @@ void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) void CSVWorld::ScriptEdit::contextMenuEvent(QContextMenuEvent *event) { - QMenu *menu = createStandardContextMenu(); - menu->addAction("Comment Selection", this, SLOT(commentSelection())); - menu->addAction("Uncomment Selection", this, SLOT(uncommentSelection())); - - menu->exec(event->globalPos()); - delete menu; + mContextMenu->exec(event->globalPos()); } void CSVWorld::ScriptEdit::lineNumberAreaPaintEvent(QPaintEvent *event) diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index 27e2cd17e..1ae93b62e 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -54,6 +54,7 @@ namespace CSVWorld QFont mDefaultFont; QFont mMonoFont; int mTabCharCount; + QMenu *mContextMenu; protected: From 61e6b0d03c77efc22136df3a302f8a650cdc22ac Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 26 Apr 2017 15:03:30 +0200 Subject: [PATCH 051/318] improved ScriptErrorTable handling of script errors that don't have line/column associated with them (also avoiding a segfault) --- apps/opencs/view/world/scripterrortable.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/world/scripterrortable.cpp b/apps/opencs/view/world/scripterrortable.cpp index c22bcf199..ca7cbd159 100644 --- a/apps/opencs/view/world/scripterrortable.cpp +++ b/apps/opencs/view/world/scripterrortable.cpp @@ -52,6 +52,13 @@ void CSVWorld::ScriptErrorTable::addMessage (const std::string& message, columnItem->setFlags (columnItem->flags() ^ Qt::ItemIsEditable); setItem (row, 3, columnItem); } + else + { + QTableWidgetItem *lineItem = new QTableWidgetItem; + lineItem->setData (Qt::DisplayRole, "-"); + lineItem->setFlags (lineItem->flags() ^ Qt::ItemIsEditable); + setItem (row, 1, lineItem); + } QTableWidgetItem *messageItem = new QTableWidgetItem (QString::fromUtf8 (message.c_str())); messageItem->setFlags (messageItem->flags() ^ Qt::ItemIsEditable); @@ -141,7 +148,7 @@ void CSVWorld::ScriptErrorTable::settingChanged (const CSMPrefs::Setting *settin void CSVWorld::ScriptErrorTable::cellClicked (int row, int column) { - if (item (row, 1)) + if (item (row, 3)) { int scriptLine = item (row, 1)->data (Qt::DisplayRole).toInt(); int scriptColumn = item (row, 3)->data (Qt::DisplayRole).toInt(); From bba822c014fbc60a3839dc9d7ad4d563dec10758 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 26 Apr 2017 17:18:06 +0400 Subject: [PATCH 052/318] Purge all effects with same ID instead only first (fixes #3839) --- apps/openmw/mwworld/inventorystore.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index fd7cb5d74..a6394757f 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -938,7 +938,6 @@ void MWWorld::InventoryStore::purgeEffect(short effectId, const std::string &sou mMagicEffects.add (*effectIt, -magnitude); params[i].mMultiplier = 0; - break; } } } From f484ef8ffbef38cdff03d39f419d66d527bd3113 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 26 Apr 2017 18:28:59 +0400 Subject: [PATCH 053/318] Fixed jump fatigue loss formula (fixes #3843) --- apps/openmw/mwmechanics/character.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index b71f31550..5981a79c9 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1753,7 +1753,7 @@ void CharacterController::update(float duration) float normalizedEncumbrance = mPtr.getClass().getNormalizedEncumbrance(mPtr); if (normalizedEncumbrance > 1) normalizedEncumbrance = 1; - const float fatigueDecrease = fatigueJumpBase + (1 - normalizedEncumbrance) * fatigueJumpMult; + const float fatigueDecrease = fatigueJumpBase + normalizedEncumbrance * fatigueJumpMult; if (!godmode) { From 6063d8e31b27e52ca12f2cce6088992a386b78ab Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Thu, 27 Apr 2017 16:31:45 +1200 Subject: [PATCH 054/318] Fix existing context menu in script editor --- apps/opencs/view/world/scriptedit.cpp | 27 ++++++++++++++------------- apps/opencs/view/world/scriptedit.hpp | 4 +++- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 531c732ea..8804c960a 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -88,19 +88,15 @@ CSVWorld::ScriptEdit::ScriptEdit( <associateAction(mCommentAction); - QAction* comment = new QAction (tr ("Comment Selection"), this); - connect(comment, SIGNAL (triggered()), this, SLOT (commentSelection())); - CSMPrefs::Shortcut* commentShortcut = new CSMPrefs::Shortcut("script-editor-comment", this); - commentShortcut->associateAction(comment); - mContextMenu->addAction(comment); - - QAction* uncomment = new QAction (tr ("Uncomment Selection"), this); - connect(uncomment, SIGNAL (triggered()), this, SLOT (uncommentSelection())); - CSMPrefs::Shortcut* uncommentShortcut = new CSMPrefs::Shortcut("script-editor-uncomment", this); - uncommentShortcut->associateAction(uncomment); - mContextMenu->addAction(uncomment); + mUncommentAction = new QAction (tr ("Uncomment Selection"), this); + connect(mUncommentAction, SIGNAL (triggered()), this, SLOT (uncommentSelection())); + CSMPrefs::Shortcut *uncommentShortcut = new CSMPrefs::Shortcut("script-editor-uncomment", this); + uncommentShortcut->associateAction(mUncommentAction); mHighlighter = new ScriptHighlighter (document.getData(), mode, ScriptEdit::document()); @@ -361,7 +357,12 @@ void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) void CSVWorld::ScriptEdit::contextMenuEvent(QContextMenuEvent *event) { - mContextMenu->exec(event->globalPos()); + QMenu *menu = createStandardContextMenu(); + menu->addAction(mCommentAction); + menu->addAction(mUncommentAction); + + menu->exec(event->globalPos()); + delete menu; } void CSVWorld::ScriptEdit::lineNumberAreaPaintEvent(QPaintEvent *event) diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index 1ae93b62e..a788eaccf 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "../../model/world/universalid.hpp" @@ -54,7 +55,8 @@ namespace CSVWorld QFont mDefaultFont; QFont mMonoFont; int mTabCharCount; - QMenu *mContextMenu; + QAction *mCommentAction; + QAction *mUncommentAction; protected: From e685de0f8432358c5ec02afc42ae402005035489 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Thu, 27 Apr 2017 19:48:01 +1200 Subject: [PATCH 055/318] Fix script editor undo/redo context menu actions --- apps/opencs/view/world/scriptedit.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 8804c960a..bfd07035c 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -306,10 +306,14 @@ void CSVWorld::ScriptEdit::commentSelection() end.setPosition(end.selectionEnd()); end.movePosition(QTextCursor::EndOfLine); + begin.beginEditBlock(); + for (; begin < end; begin.movePosition(QTextCursor::EndOfLine), begin.movePosition(QTextCursor::Right)) { begin.insertText(";"); } + + begin.endEditBlock(); } void CSVWorld::ScriptEdit::uncommentSelection() @@ -322,6 +326,8 @@ void CSVWorld::ScriptEdit::uncommentSelection() end.setPosition(end.selectionEnd()); end.movePosition(QTextCursor::EndOfLine); + begin.beginEditBlock(); + for (; begin < end; begin.movePosition(QTextCursor::EndOfLine), begin.movePosition(QTextCursor::Right)) { begin.select(QTextCursor::LineUnderCursor); QString line = begin.selectedText(); @@ -345,6 +351,8 @@ void CSVWorld::ScriptEdit::uncommentSelection() begin.insertText(line); } } + + begin.endEditBlock(); } void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) @@ -358,6 +366,16 @@ void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) void CSVWorld::ScriptEdit::contextMenuEvent(QContextMenuEvent *event) { QMenu *menu = createStandardContextMenu(); + + // remove redo/undo since they are disabled + QList menuActions = menu->actions(); + for (QList::iterator i = menuActions.begin(); i < menuActions.end(); ++i) + { + if ((*i)->text().contains("Undo") || (*i)->text().contains("Redo")) + { + (*i)->setVisible(false); + } + } menu->addAction(mCommentAction); menu->addAction(mUncommentAction); From 8299f8677b2bd496b1873e8d13320d2c0a259486 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 28 Apr 2017 08:45:16 +0200 Subject: [PATCH 056/318] updated credits file --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index a37975d24..158e16ee6 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -117,6 +117,7 @@ Programmers Pi03k Pieter van der Kloet (pvdk) pkubik + PlutonicOverkill Radu-Marius Popovici (rpopovici) Rafael Moura (dhustkoder) rdimesio From a8e7628e8301248738a2c2bd9e6f67017a1f2102 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Fri, 28 Apr 2017 19:28:05 +1200 Subject: [PATCH 057/318] Enable highlighting when cursor is placed over a name (script editor) --- apps/opencs/model/prefs/state.cpp | 1 + apps/opencs/view/world/scriptedit.cpp | 23 ++++++++++++++++++++ apps/opencs/view/world/scriptedit.hpp | 3 +++ apps/opencs/view/world/scripthighlighter.cpp | 18 ++++++++++++--- apps/opencs/view/world/scripthighlighter.hpp | 7 +++++- 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index b8d6102ac..6bef55c44 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -156,6 +156,7 @@ void CSMPrefs::State::declare() declareColour ("colour-int", "Highlight Colour: Integer Literals", QColor ("darkmagenta")); declareColour ("colour-float", "Highlight Colour: Float Literals", QColor ("magenta")); declareColour ("colour-name", "Highlight Colour: Names", QColor ("grey")); + declareColour ("colour-highlight", "Highlight Colour: Highlighting", QColor("palegreen")); declareColour ("colour-keyword", "Highlight Colour: Keywords", QColor ("red")); declareColour ("colour-special", "Highlight Colour: Special Characters", QColor ("darkorange")); declareColour ("colour-comment", "Highlight Colour: Comments", QColor ("green")); diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 6f27d5656..1581c3e34 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -49,6 +49,7 @@ CSVWorld::ScriptEdit::ScriptEdit( mDefaultFont(font()), mMonoFont(QFont("Monospace")), mTabCharCount(4), + mMarkOccurrencesRunning(false), mDocument(document), mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive) { @@ -85,6 +86,8 @@ CSVWorld::ScriptEdit::ScriptEdit( <setMarkedWord(word.toStdString()); + mHighlighter->rehighlight(); + + mMarkOccurrencesRunning = false; +} + void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) { QPlainTextEdit::resizeEvent(e); diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index 4977ed8e0..5c78470b3 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -54,6 +54,7 @@ namespace CSVWorld QFont mDefaultFont; QFont mMonoFont; int mTabCharCount; + bool mMarkOccurrencesRunning; protected: @@ -111,6 +112,8 @@ namespace CSVWorld void updateLineNumberAreaWidth(int newBlockCount); void updateLineNumberArea(const QRect &, int); + + void markOccurrences(); }; class LineNumberArea : public QWidget diff --git a/apps/opencs/view/world/scripthighlighter.cpp b/apps/opencs/view/world/scripthighlighter.cpp index 846a61b47..3041eff2d 100644 --- a/apps/opencs/view/world/scripthighlighter.cpp +++ b/apps/opencs/view/world/scripthighlighter.cpp @@ -72,7 +72,11 @@ void CSVWorld::ScriptHighlighter::highlight (const Compiler::TokenLoc& loc, Type // compensate for bug in Compiler::Scanner (position of token is the character after the token) index -= length; - setFormat (index, length, mScheme[type]); + QTextCharFormat scheme = mScheme[type]; + if (loc.mLiteral == mMarkedWord) + scheme.merge(mScheme[Type_Highlight]); + + setFormat (index, length, scheme); } CSVWorld::ScriptHighlighter::ScriptHighlighter (const CSMWorld::Data& data, Mode mode, @@ -105,6 +109,11 @@ void CSVWorld::ScriptHighlighter::highlightBlock (const QString& text) catch (...) {} // ignore syntax errors } +void CSVWorld::ScriptHighlighter::setMarkedWord(const std::string& name) +{ + mMarkedWord = name; +} + void CSVWorld::ScriptHighlighter::invalidateIds() { mContext.invalidateIds(); @@ -117,7 +126,7 @@ bool CSVWorld::ScriptHighlighter::settingChanged (const CSMPrefs::Setting *setti static const char *const colours[Type_Id+2] = { "colour-int", "colour-float", "colour-name", "colour-keyword", - "colour-special", "colour-comment", "colour-id", + "colour-special", "colour-comment", "colour-highlight", "colour-id", 0 }; @@ -125,7 +134,10 @@ bool CSVWorld::ScriptHighlighter::settingChanged (const CSMPrefs::Setting *setti if (setting->getKey()==colours[i]) { QTextCharFormat format; - format.setForeground (setting->toColor()); + if (i == Type_Highlight) + format.setBackground (setting->toColor()); + else + format.setForeground (setting->toColor()); mScheme[static_cast (i)] = format; return true; } diff --git a/apps/opencs/view/world/scripthighlighter.hpp b/apps/opencs/view/world/scripthighlighter.hpp index 33824da0d..d55cf4839 100644 --- a/apps/opencs/view/world/scripthighlighter.hpp +++ b/apps/opencs/view/world/scripthighlighter.hpp @@ -2,6 +2,7 @@ #define CSV_WORLD_SCRIPTHIGHLIGHTER_H #include +#include #include @@ -30,7 +31,8 @@ namespace CSVWorld Type_Keyword = 3, Type_Special = 4, Type_Comment = 5, - Type_Id = 6 + Type_Highlight = 6, + Type_Id = 7 }; enum Mode @@ -47,6 +49,7 @@ namespace CSVWorld CSMWorld::ScriptContext mContext; std::map mScheme; Mode mMode; + std::string mMarkedWord; private: @@ -91,6 +94,8 @@ namespace CSVWorld virtual void highlightBlock (const QString& text); + void setMarkedWord(const std::string& name); + void invalidateIds(); bool settingChanged (const CSMPrefs::Setting *setting); From cbb2b8b119e214123432760c024b234a5d638604 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Fri, 28 Apr 2017 19:57:49 +1200 Subject: [PATCH 058/318] Add setting so feature can be turned off --- apps/opencs/model/prefs/state.cpp | 1 + apps/opencs/view/world/scriptedit.cpp | 25 ++++++++++++++------ apps/opencs/view/world/scriptedit.hpp | 1 + apps/opencs/view/world/scripthighlighter.cpp | 7 +++++- apps/opencs/view/world/scripthighlighter.hpp | 3 +++ 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index 6bef55c44..0d66caba6 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -152,6 +152,7 @@ void CSMPrefs::State::declare() setRange (0, 10000); declareInt ("error-height", "Initial height of the error panel", 100). setRange (100, 10000); + declareBool ("highlight-occurrences", "Highlight other occurrences of selected names", true); declareSeparator(); declareColour ("colour-int", "Highlight Colour: Integer Literals", QColor ("darkmagenta")); declareColour ("colour-float", "Highlight Colour: Float Literals", QColor ("magenta")); diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 1581c3e34..22beb0889 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -49,6 +49,7 @@ CSVWorld::ScriptEdit::ScriptEdit( mDefaultFont(font()), mMonoFont(QFont("Monospace")), mTabCharCount(4), + mMarkOccurrences(true), mMarkOccurrencesRunning(false), mDocument(document), mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive) @@ -233,6 +234,13 @@ void CSVWorld::ScriptEdit::settingChanged(const CSMPrefs::Setting *setting) mTabCharCount = setting->toInt(); setTabWidth(); } + else if (*setting == "Scripts/highlight-occurrences") + { + mMarkOccurrences = setting->isTrue(); + mHighlighter->setMarkedWord(""); + updateHighlighting(); + mHighlighter->setMarkOccurrences(mMarkOccurrences); + } } void CSVWorld::ScriptEdit::idListChanged() @@ -295,16 +303,19 @@ void CSVWorld::ScriptEdit::markOccurrences() if (mMarkOccurrencesRunning) return; - mMarkOccurrencesRunning = true; + if (mMarkOccurrences) + { + mMarkOccurrencesRunning = true; - QTextCursor cursor = textCursor(); - cursor.select(QTextCursor::WordUnderCursor); - QString word = cursor.selectedText(); + QTextCursor cursor = textCursor(); + cursor.select(QTextCursor::WordUnderCursor); + QString word = cursor.selectedText(); - mHighlighter->setMarkedWord(word.toStdString()); - mHighlighter->rehighlight(); + mHighlighter->setMarkedWord(word.toStdString()); + mHighlighter->rehighlight(); - mMarkOccurrencesRunning = false; + mMarkOccurrencesRunning = false; + } } void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e) diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index 5c78470b3..eb57aed1d 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -54,6 +54,7 @@ namespace CSVWorld QFont mDefaultFont; QFont mMonoFont; int mTabCharCount; + bool mMarkOccurrences; bool mMarkOccurrencesRunning; protected: diff --git a/apps/opencs/view/world/scripthighlighter.cpp b/apps/opencs/view/world/scripthighlighter.cpp index 3041eff2d..7e6ea5844 100644 --- a/apps/opencs/view/world/scripthighlighter.cpp +++ b/apps/opencs/view/world/scripthighlighter.cpp @@ -73,7 +73,7 @@ void CSVWorld::ScriptHighlighter::highlight (const Compiler::TokenLoc& loc, Type index -= length; QTextCharFormat scheme = mScheme[type]; - if (loc.mLiteral == mMarkedWord) + if (mMarkOccurrences && loc.mLiteral == mMarkedWord) scheme.merge(mScheme[Type_Highlight]); setFormat (index, length, scheme); @@ -109,6 +109,11 @@ void CSVWorld::ScriptHighlighter::highlightBlock (const QString& text) catch (...) {} // ignore syntax errors } +void CSVWorld::ScriptHighlighter::setMarkOccurrences(bool flag) +{ + mMarkOccurrences = flag; +} + void CSVWorld::ScriptHighlighter::setMarkedWord(const std::string& name) { mMarkedWord = name; diff --git a/apps/opencs/view/world/scripthighlighter.hpp b/apps/opencs/view/world/scripthighlighter.hpp index d55cf4839..a7d0fc2a1 100644 --- a/apps/opencs/view/world/scripthighlighter.hpp +++ b/apps/opencs/view/world/scripthighlighter.hpp @@ -49,6 +49,7 @@ namespace CSVWorld CSMWorld::ScriptContext mContext; std::map mScheme; Mode mMode; + bool mMarkOccurrences; std::string mMarkedWord; private: @@ -94,6 +95,8 @@ namespace CSVWorld virtual void highlightBlock (const QString& text); + void setMarkOccurrences(bool); + void setMarkedWord(const std::string& name); void invalidateIds(); From 6331cc6ab92f6199038ba744bde2c1572260e508 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 30 Apr 2017 19:45:36 +0400 Subject: [PATCH 059/318] Tooltips: level, race, class, specialization layout fixes --- apps/openmw/mwgui/tooltips.cpp | 18 ++++++++--- files/mygui/openmw_stats_window.layout | 4 +-- files/mygui/openmw_tooltips.layout | 45 +++++++++++++++++++------- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 712caea39..9b6a3bb70 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -709,20 +709,28 @@ namespace MWGui void ToolTips::createSpecializationToolTip(MyGUI::Widget* widget, const std::string& name, int specId) { - widget->setUserString("Caption_CenteredCaption", name); + widget->setUserString("Caption_Caption", name); std::string specText; // get all skills of this specialisation const MWWorld::Store &skills = MWBase::Environment::get().getWorld()->getStore().get(); + bool isFirst = true; MWWorld::Store::iterator it = skills.begin(); for (; it != skills.end(); ++it) { if (it->second.mData.mSpecialization == specId) - specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->first] + "}"; + { + if (isFirst) + isFirst = false; + else + specText += "\n"; + + specText += std::string("#{") + ESM::Skill::sSkillNameIds[it->first] + "}"; + } } - widget->setUserString("Caption_CenteredCaptionText", specText); - widget->setUserString("ToolTipLayout", "TextWithCenteredCaptionToolTip"); + widget->setUserString("Caption_ColumnText", specText); + widget->setUserString("ToolTipLayout", "SpecializationToolTip"); widget->setUserString("ToolTipType", "Layout"); } @@ -795,7 +803,7 @@ namespace MWGui widget->setUserString("Caption_CenteredCaption", playerRace->mName); widget->setUserString("Caption_CenteredCaptionText", playerRace->mDescription); widget->setUserString("ToolTipType", "Layout"); - widget->setUserString("ToolTipLayout", "TextWithCenteredCaptionToolTip"); + widget->setUserString("ToolTipLayout", "RaceToolTip"); } void ToolTips::createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playerClass) diff --git a/files/mygui/openmw_stats_window.layout b/files/mygui/openmw_stats_window.layout index d9860ae20..098b3c2d8 100644 --- a/files/mygui/openmw_stats_window.layout +++ b/files/mygui/openmw_stats_window.layout @@ -87,12 +87,12 @@ - + - + diff --git a/files/mygui/openmw_tooltips.layout b/files/mygui/openmw_tooltips.layout index 6d4421702..3a2bce94a 100644 --- a/files/mygui/openmw_tooltips.layout +++ b/files/mygui/openmw_tooltips.layout @@ -29,16 +29,33 @@ - - + + - + + - + + + + + + + + + + + + + + + + + @@ -46,15 +63,16 @@ - + - + + - + @@ -204,15 +222,18 @@ - - + + + + + - - - + + + From d24bcbac152090f4a86148d2e98b70130346f93c Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sun, 30 Apr 2017 18:49:32 +0200 Subject: [PATCH 060/318] Do not apply underwater effects to player's voice (Fixes #3850) --- apps/openmw/mwsound/soundmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 9b5fb1b3d..53c0643f6 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -259,7 +259,7 @@ namespace MWSound float basevol = volumeFromType(Play_TypeVoice); if(playlocal) { - sound.reset(new Stream(1.0f, basevol, 1.0f, Play_Normal|Play_TypeVoice|Play_2D)); + sound.reset(new Stream(1.0f, basevol, 1.0f, Play_NoEnv|Play_TypeVoice|Play_2D)); mOutput->streamSound(decoder, sound); } else From 27181367e29bb90e59c0a0d6c408a66341256c57 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 30 Apr 2017 21:26:13 +0400 Subject: [PATCH 061/318] Tooltips: skills and attributes layout fixes --- files/mygui/openmw_tooltips.layout | 41 ++++++++++++++++++------------ 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/files/mygui/openmw_tooltips.layout b/files/mygui/openmw_tooltips.layout index 3a2bce94a..2d7d514eb 100644 --- a/files/mygui/openmw_tooltips.layout +++ b/files/mygui/openmw_tooltips.layout @@ -123,20 +123,21 @@ - + - + + - + - + @@ -144,9 +145,9 @@ - + - + @@ -154,30 +155,35 @@ - + - + - + + + + - + + + - + @@ -191,9 +197,9 @@ - + - + @@ -202,22 +208,25 @@ - + - + - + + + + From 987677db75c6078207de48f52ca28182ff3b4a53 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 30 Apr 2017 22:39:05 +0400 Subject: [PATCH 062/318] Tooltips: dynamic stats, birthsign and hand-to-hand layout fixes --- apps/openmw/mwgui/hud.cpp | 2 +- apps/openmw/mwgui/review.cpp | 6 +++--- apps/openmw/mwgui/statswindow.cpp | 2 +- apps/openmw/mwgui/tooltips.cpp | 2 +- files/mygui/openmw_tooltips.layout | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 7ce2dfa8b..84e5794e3 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -183,7 +183,7 @@ namespace MWGui int modified = static_cast(value.getModified()); MyGUI::Widget* w; - std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified); + std::string valStr = MyGUI::utility::toString(current) + " / " + MyGUI::utility::toString(modified); if (id == "HBar") { mHealth->setProgressRange(modified); diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index 11d79e307..1a680b801 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -164,7 +164,7 @@ namespace MWGui int modified = static_cast(value.getModified()); mHealth->setValue(current, modified); - std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified); + std::string valStr = MyGUI::utility::toString(current) + " / " + MyGUI::utility::toString(modified); mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr); } @@ -174,7 +174,7 @@ namespace MWGui int modified = static_cast(value.getModified()); mMagicka->setValue(current, modified); - std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified); + std::string valStr = MyGUI::utility::toString(current) + " / " + MyGUI::utility::toString(modified); mMagicka->setUserString("Caption_HealthDescription", "#{sMagDesc}\n" + valStr); } @@ -184,7 +184,7 @@ namespace MWGui int modified = static_cast(value.getModified()); mFatigue->setValue(current, modified); - std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified); + std::string valStr = MyGUI::utility::toString(current) + " / " + MyGUI::utility::toString(modified); mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr); } diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index 780e4905e..ce7ac915c 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -154,7 +154,7 @@ namespace MWGui // health, magicka, fatigue tooltip MyGUI::Widget* w; - std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified); + std::string valStr = MyGUI::utility::toString(current) + " / " + MyGUI::utility::toString(modified); if (id == "HBar") { getWidget(w, "Health"); diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 9b6a3bb70..fad78d9a6 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -785,7 +785,7 @@ namespace MWGui { if (it == categories[category].spells.begin()) { - text += std::string("\n#{fontcolourhtml=header}") + std::string("#{") + categories[category].label + "}"; + text += std::string("\n\n#{fontcolourhtml=header}") + std::string("#{") + categories[category].label + "}"; } const std::string &spellId = *it; diff --git a/files/mygui/openmw_tooltips.layout b/files/mygui/openmw_tooltips.layout index 2d7d514eb..3d40b3260 100644 --- a/files/mygui/openmw_tooltips.layout +++ b/files/mygui/openmw_tooltips.layout @@ -86,7 +86,7 @@ - + @@ -102,9 +102,9 @@ - + - + @@ -115,7 +115,7 @@ - + From 26ec467df07c060154e70460c451bf9acb783497 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 1 May 2017 10:00:51 +0400 Subject: [PATCH 063/318] Tooltips: faction, magic effects layout fixes --- apps/openmw/mwgui/statswindow.cpp | 6 +++--- files/mygui/openmw_tooltips.layout | 28 ++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index ce7ac915c..22140b8b2 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -618,13 +618,13 @@ namespace MWGui if (rankData.mSkill1 > 0) text += "\n#{sNeedOneSkill} " + MyGUI::utility::toString(rankData.mSkill1); if (rankData.mSkill2 > 0) - text += "\n#{sNeedTwoSkills} " + MyGUI::utility::toString(rankData.mSkill2); + text += " #{sand} #{sNeedTwoSkills} " + MyGUI::utility::toString(rankData.mSkill2); } } w->setUserString("ToolTipType", "Layout"); - w->setUserString("ToolTipLayout", "TextToolTip"); - w->setUserString("Caption_Text", text); + w->setUserString("ToolTipLayout", "FactionToolTip"); + w->setUserString("Caption_FactionText", text); } } diff --git a/files/mygui/openmw_tooltips.layout b/files/mygui/openmw_tooltips.layout index 3d40b3260..a7eeabfa5 100644 --- a/files/mygui/openmw_tooltips.layout +++ b/files/mygui/openmw_tooltips.layout @@ -18,11 +18,23 @@ - + - + - + + + + + + + + + + + + + @@ -263,9 +275,9 @@ - + - + @@ -274,13 +286,13 @@ - + - + @@ -288,7 +300,7 @@ - + From 1520a4d7dbe2a29af15ef0fb6bd64e0f9cae4229 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 1 May 2017 20:48:39 +0400 Subject: [PATCH 064/318] Levelup menu layout fixes --- apps/openmw/mwgui/levelupdialog.cpp | 2 +- files/mygui/openmw_levelup_dialog.layout | 38 ++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index 1434455b2..362ad3b1c 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -89,7 +89,7 @@ namespace MWGui void LevelupDialog::resetCoins() { - const int coinSpacing = 10; + const int coinSpacing = 33; int curX = mCoinBox->getWidth()/2 - (coinSpacing*(mCoinCount - 1) + 16*mCoinCount)/2; for (unsigned int i=0; i - + @@ -22,25 +22,25 @@ - + - + - - - - - - - - + + + + + + + + - + @@ -54,7 +54,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -97,7 +97,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -139,7 +139,7 @@ - + From 0e35e6a70060bb3c31bc5718f02483ded473e2fa Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 1 May 2017 20:51:54 +0400 Subject: [PATCH 065/318] Class generation menu layout fixes --- .../mygui/openmw_chargen_create_class.layout | 28 ++++++++++++------- .../openmw_chargen_select_attribute.layout | 22 +++++++-------- .../mygui/openmw_chargen_select_skill.layout | 2 +- files/mygui/openmw_infobox.layout | 2 +- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/files/mygui/openmw_chargen_create_class.layout b/files/mygui/openmw_chargen_create_class.layout index 5f0b02c1b..9ca6c6a31 100644 --- a/files/mygui/openmw_chargen_create_class.layout +++ b/files/mygui/openmw_chargen_create_class.layout @@ -26,22 +26,30 @@ - - - - - - - - + + + + + + + + + + + + + - - + + + + + diff --git a/files/mygui/openmw_chargen_select_attribute.layout b/files/mygui/openmw_chargen_select_attribute.layout index a00577e41..0821d4a57 100644 --- a/files/mygui/openmw_chargen_select_attribute.layout +++ b/files/mygui/openmw_chargen_select_attribute.layout @@ -1,23 +1,23 @@ - - + + - + - - - - - - - - + + + + + + + + diff --git a/files/mygui/openmw_chargen_select_skill.layout b/files/mygui/openmw_chargen_select_skill.layout index b6e90b688..d1061882d 100644 --- a/files/mygui/openmw_chargen_select_skill.layout +++ b/files/mygui/openmw_chargen_select_skill.layout @@ -1,6 +1,6 @@ - + diff --git a/files/mygui/openmw_infobox.layout b/files/mygui/openmw_infobox.layout index ea9f78614..252a237cd 100644 --- a/files/mygui/openmw_infobox.layout +++ b/files/mygui/openmw_infobox.layout @@ -11,6 +11,6 @@ - + From ba78e187c71b41357e5f090561ebdf970d04d56c Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 1 May 2017 21:28:42 +0400 Subject: [PATCH 066/318] Listbox spacing fix --- files/mygui/openmw_chargen_race.layout | 2 +- files/mygui/openmw_list.skin.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/mygui/openmw_chargen_race.layout b/files/mygui/openmw_chargen_race.layout index bddede361..04bd9cc53 100644 --- a/files/mygui/openmw_chargen_race.layout +++ b/files/mygui/openmw_chargen_race.layout @@ -57,7 +57,7 @@ - + diff --git a/files/mygui/openmw_list.skin.xml b/files/mygui/openmw_list.skin.xml index 111d3bf30..8a238879c 100644 --- a/files/mygui/openmw_list.skin.xml +++ b/files/mygui/openmw_list.skin.xml @@ -127,7 +127,7 @@ - + @@ -140,7 +140,7 @@ - + From da828a1089ce4664edb6933b4a576376b7c6a406 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 1 May 2017 21:37:37 +0400 Subject: [PATCH 067/318] Class choice layout fix --- files/mygui/openmw_chargen_class.layout | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/files/mygui/openmw_chargen_class.layout b/files/mygui/openmw_chargen_class.layout index 53a6a6642..35dd57ca3 100644 --- a/files/mygui/openmw_chargen_class.layout +++ b/files/mygui/openmw_chargen_class.layout @@ -27,16 +27,23 @@ - - - - - - - + + + + + + + + + + + + + - - + + + From 829560719e49be50b39da324e5e7ad42a728ad21 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Tue, 2 May 2017 17:28:42 +1200 Subject: [PATCH 068/318] Make name highlighting more consistent and only for variable names --- apps/opencs/view/world/scriptedit.cpp | 21 ++++++++------------ apps/opencs/view/world/scriptedit.hpp | 1 - apps/opencs/view/world/scripthighlighter.cpp | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 8cb4494bb..1105404b3 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -52,7 +52,6 @@ CSVWorld::ScriptEdit::ScriptEdit( mMonoFont(QFont("Monospace")), mTabCharCount(4), mMarkOccurrences(true), - mMarkOccurrencesRunning(false), mDocument(document), mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive) { @@ -90,7 +89,7 @@ CSVWorld::ScriptEdit::ScriptEdit( <setMarkedWord(word.toStdString()); mHighlighter->rehighlight(); - - mMarkOccurrencesRunning = false; } } diff --git a/apps/opencs/view/world/scriptedit.hpp b/apps/opencs/view/world/scriptedit.hpp index b1e70a4c8..b0a4b0577 100644 --- a/apps/opencs/view/world/scriptedit.hpp +++ b/apps/opencs/view/world/scriptedit.hpp @@ -56,7 +56,6 @@ namespace CSVWorld QFont mMonoFont; int mTabCharCount; bool mMarkOccurrences; - bool mMarkOccurrencesRunning; QAction *mCommentAction; QAction *mUncommentAction; diff --git a/apps/opencs/view/world/scripthighlighter.cpp b/apps/opencs/view/world/scripthighlighter.cpp index 7e6ea5844..6aba66053 100644 --- a/apps/opencs/view/world/scripthighlighter.cpp +++ b/apps/opencs/view/world/scripthighlighter.cpp @@ -73,7 +73,7 @@ void CSVWorld::ScriptHighlighter::highlight (const Compiler::TokenLoc& loc, Type index -= length; QTextCharFormat scheme = mScheme[type]; - if (mMarkOccurrences && loc.mLiteral == mMarkedWord) + if (mMarkOccurrences && type == Type_Name && loc.mLiteral == mMarkedWord) scheme.merge(mScheme[Type_Highlight]); setFormat (index, length, scheme); From d598809ac679233b9b9eacdf98dc9baa22181e02 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 3 May 2017 10:35:56 +0400 Subject: [PATCH 069/318] Spell priority: check spell resistance, check if actor is already has a non-magnitude effect --- apps/openmw/mwmechanics/aicombataction.cpp | 63 +++++++++++++++++++--- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index cc1434d52..c9cd8817c 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -266,6 +266,23 @@ namespace MWMechanics case ESM::MagicEffect::Chameleon: return 0.f; + case ESM::MagicEffect::Sound: + { + if (enemy.isEmpty()) + return 0.f; + + // there is no need to cast sound if enemy is not able to cast spells + CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); + + if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude() > 0) + return 0.f; + + if (stats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0) + return 0.f; + + break; + } + case ESM::MagicEffect::RestoreAttribute: return 0.f; // TODO: implement based on attribute damage case ESM::MagicEffect::RestoreSkill: @@ -383,22 +400,52 @@ namespace MWMechanics break; } - // TODO: for non-cumulative effects (e.g. paralyze), check if the enemy is already suffering from them - - // TODO: could take into account enemy's resistance/weakness against the effect - const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); rating *= magicEffect->mData.mBaseCost; - if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)) + if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) + { + rating *= -1.f; + + if (enemy.isEmpty()) + return 0.f; + + // Check resistance for harmful effects + CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); + + float resistance = MWMechanics::getEffectResistanceAttribute(effect.mEffectID, &stats.getMagicEffects()); + + rating *= (1.f - std::min(resistance, 100.f) / 100.f); + } + + // for harmful no-magnitude effects (e.g. silence) check if enemy is already has them + // for non-harmful no-magnitude effects (e.g. bound items) check if actor is already has them + if (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude) + { + if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) + { + CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); + + if (stats.getMagicEffects().get(effect.mEffectID).getMagnitude() > 0) + return 0.f; + } + else + { + CreatureStats& stats = actor.getClass().getCreatureStats(actor); + + if (stats.getMagicEffects().get(effect.mEffectID).getMagnitude() > 0) + return 0.f; + } + } + else + { rating *= (effect.mMagnMin + effect.mMagnMax)/2.f; + } + if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration)) rating *= effect.mDuration; - if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) - rating *= -1.f; - // Currently treating all "on target" or "on touch" effects to target the enemy actor. // Combat AI is egoistic, so doesn't consider applying positive effects to friendly actors. if (effect.mRange != ESM::RT_Self) From 4d927439cade122dfbce912fe995e770d99e7398 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 3 May 2017 11:13:35 +0400 Subject: [PATCH 070/318] Spell priority: item wearing check when disintegrate weapon/armor --- apps/openmw/mwmechanics/aicombataction.cpp | 65 +++++++++++++++++++++- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index c9cd8817c..1082c540b 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -362,9 +362,68 @@ namespace MWMechanics case ESM::MagicEffect::CurePoison: return 1001.f * numEffectsToCure(actor, ESM::MagicEffect::Poison); - case ESM::MagicEffect::DisintegrateArmor: // TODO: check if actor is wearing armor - case ESM::MagicEffect::DisintegrateWeapon: // TODO: check if actor is wearing weapon - break; + case ESM::MagicEffect::DisintegrateArmor: + { + if (enemy.isEmpty()) + return 0.f; + + // Ignore enemy without inventory + if (!enemy.getClass().hasInventoryStore(enemy)) + return 0.f; + + MWWorld::InventoryStore& inv = enemy.getClass().getInventoryStore(enemy); + + // According to UESP + static const int armorSlots[] = { + MWWorld::InventoryStore::Slot_CarriedLeft, + MWWorld::InventoryStore::Slot_Cuirass, + MWWorld::InventoryStore::Slot_LeftPauldron, + MWWorld::InventoryStore::Slot_RightPauldron, + MWWorld::InventoryStore::Slot_LeftGauntlet, + MWWorld::InventoryStore::Slot_RightGauntlet, + MWWorld::InventoryStore::Slot_Helmet, + MWWorld::InventoryStore::Slot_Greaves, + MWWorld::InventoryStore::Slot_Boots + }; + + bool enemyHasArmor = false; + + // Ignore enemy without armor + for (unsigned int i=0; i Date: Fri, 5 May 2017 05:24:52 +0200 Subject: [PATCH 071/318] Fix commit 8f71b65d38f (don't overwrite the previous user data) This resulted in a crash/corruption because the KeyframeController, for performance reasons, does not check that the expected user data is there and of correct type. (Fixes #3829) --- components/sceneutil/attach.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/sceneutil/attach.cpp b/components/sceneutil/attach.cpp index e61b8a6e0..1385f771e 100644 --- a/components/sceneutil/attach.cpp +++ b/components/sceneutil/attach.cpp @@ -81,14 +81,23 @@ namespace SceneUtil std::string mFilter2; }; + void mergeUserData(osg::UserDataContainer* source, osg::Object* target) + { + if (!target->getUserDataContainer()) + target->setUserDataContainer(source); + else + { + for (unsigned int i=0; igetNumUserObjects(); ++i) + target->getUserDataContainer()->addUserObject(source->getUserObject(i)); + } + } + osg::ref_ptr attach(osg::ref_ptr toAttach, osg::Node *master, const std::string &filter, osg::Group* attachNode) { if (dynamic_cast(toAttach.get())) { osg::ref_ptr handle = new osg::Group; - osg::UserDataContainer* udc = toAttach->getUserDataContainer(); - CopyRigVisitor copyVisitor(handle, filter); toAttach->accept(copyVisitor); copyVisitor.doCopy(); @@ -98,13 +107,13 @@ namespace SceneUtil osg::ref_ptr newHandle = handle->getChild(0); handle->removeChild(newHandle); master->asGroup()->addChild(newHandle); - newHandle->setUserDataContainer(udc); + mergeUserData(toAttach->getUserDataContainer(), newHandle); return newHandle; } else { master->asGroup()->addChild(handle); - handle->setUserDataContainer(udc); + handle->setUserDataContainer(toAttach->getUserDataContainer()); return handle; } } From ae05c37a468aa22fd8cdb1bf2d6c3051a4b07651 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sat, 6 May 2017 09:21:02 +0200 Subject: [PATCH 072/318] Update Windows CI scripts to use ffmpeg 3.2.4 --- CI/before_script.msvc.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index aa8c565ba..06ab1fa14 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -305,11 +305,11 @@ if [ -z $SKIP_DOWNLOAD ]; then "Bullet-2.86-msvc${MSVC_YEAR}-win${BITS}.7z" # FFmpeg - download "FFmpeg 3.0.1" \ - "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.0.1-win${BITS}-shared.7z" \ - "ffmpeg-3.0.1-win${BITS}.7z" \ - "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.0.1-win${BITS}-dev.7z" \ - "ffmpeg-3.0.1-dev-win${BITS}.7z" + download "FFmpeg 3.2.4" \ + "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.2.4-win${BITS}-shared.7z" \ + "ffmpeg-3.2.4-win${BITS}.7z" \ + "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.2.4-win${BITS}-dev.7z" \ + "ffmpeg-3.2.4-dev-win${BITS}.7z" # MyGUI download "MyGUI 3.2.3-git" \ @@ -434,21 +434,21 @@ cd $DEPS echo # FFmpeg -printf "FFmpeg 3.0.1... " +printf "FFmpeg 3.2.4... " { cd $DEPS_INSTALL - if [ -d FFmpeg ] && grep "FFmpeg version: 3.0.1" FFmpeg/README.txt > /dev/null; then + if [ -d FFmpeg ] && grep "FFmpeg version: 3.2.4" FFmpeg/README.txt > /dev/null; then printf "Exists. " elif [ -z $SKIP_EXTRACT ]; then rm -rf FFmpeg - eval 7z x -y "${DEPS}/ffmpeg-3.0.1-win${BITS}.7z" $STRIP - eval 7z x -y "${DEPS}/ffmpeg-3.0.1-dev-win${BITS}.7z" $STRIP + eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.7z" $STRIP + eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.7z" $STRIP - mv "ffmpeg-3.0.1-win${BITS}-shared" FFmpeg - cp -r "ffmpeg-3.0.1-win${BITS}-dev/"* FFmpeg/ - rm -rf "ffmpeg-3.0.1-win${BITS}-dev" + mv "ffmpeg-3.2.4-win${BITS}-shared" FFmpeg + cp -r "ffmpeg-3.2.4-win${BITS}-dev/"* FFmpeg/ + rm -rf "ffmpeg-3.2.4-win${BITS}-dev" fi export FFMPEG_HOME="$(real_pwd)/FFmpeg" @@ -755,4 +755,4 @@ if [ -z $CI ]; then echo fi -exit $RET \ No newline at end of file +exit $RET From fd03c76e68d00f9426e1332a35f0d029814a6468 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sat, 6 May 2017 09:38:14 +0200 Subject: [PATCH 073/318] And apparently they're only doing zips now --- CI/before_script.msvc.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 06ab1fa14..5aa76de92 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -306,10 +306,10 @@ if [ -z $SKIP_DOWNLOAD ]; then # FFmpeg download "FFmpeg 3.2.4" \ - "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.2.4-win${BITS}-shared.7z" \ - "ffmpeg-3.2.4-win${BITS}.7z" \ - "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.2.4-win${BITS}-dev.7z" \ - "ffmpeg-3.2.4-dev-win${BITS}.7z" + "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.2.4-win${BITS}-shared.zip" \ + "ffmpeg-3.2.4-win${BITS}.zip" \ + "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.2.4-win${BITS}-dev.zip" \ + "ffmpeg-3.2.4-dev-win${BITS}.zip" # MyGUI download "MyGUI 3.2.3-git" \ @@ -443,8 +443,8 @@ printf "FFmpeg 3.2.4... " elif [ -z $SKIP_EXTRACT ]; then rm -rf FFmpeg - eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.7z" $STRIP - eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.7z" $STRIP + eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.zip" $STRIP + eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.zip" $STRIP mv "ffmpeg-3.2.4-win${BITS}-shared" FFmpeg cp -r "ffmpeg-3.2.4-win${BITS}-dev/"* FFmpeg/ From 64879c03e4a6935c18cad45fefb04e23efce1e56 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sat, 6 May 2017 20:18:31 +1200 Subject: [PATCH 074/318] Add option to reset settings to default --- apps/opencs/model/prefs/state.cpp | 26 +++++++++++++++++++++++ apps/opencs/model/prefs/state.hpp | 2 ++ apps/opencs/view/prefs/keybindingpage.cpp | 6 ++++++ apps/opencs/view/prefs/page.cpp | 6 ++++++ apps/opencs/view/prefs/pagebase.cpp | 6 ++++++ apps/opencs/view/prefs/pagebase.hpp | 4 ++++ 6 files changed, 50 insertions(+) diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index 3921e32f2..7a1889407 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -5,6 +5,8 @@ #include #include +#include + #include "intsetting.hpp" #include "doublesetting.hpp" #include "boolsetting.hpp" @@ -587,6 +589,30 @@ CSMPrefs::State& CSMPrefs::State::get() return *sThis; } +void CSMPrefs::State::resetCategory(const std::string& category) +{ + { + QMutexLocker lock (&mMutex); + for (Settings::CategorySettingValueMap::iterator i = mSettings.mUserSettings.begin(); i != mSettings.mUserSettings.end(); ++i) + { + // if the category matches + if (i->first.first == category) + { + // mark the setting as changed + mSettings.mChangedSettings.insert(std::make_pair(i->first.first, i->first.second)); + // reset the value to the default + i->second = mSettings.mDefaultSettings[i->first]; + } + } + } + + Collection::iterator iter = mCategories.find(category); + if (iter != mCategories.end()) + { + (*iter).second.update(); + } +} + CSMPrefs::State& CSMPrefs::get() { diff --git a/apps/opencs/model/prefs/state.hpp b/apps/opencs/model/prefs/state.hpp index 1e46c68ee..1e0ac8c11 100644 --- a/apps/opencs/model/prefs/state.hpp +++ b/apps/opencs/model/prefs/state.hpp @@ -106,6 +106,8 @@ namespace CSMPrefs static State& get(); + void resetCategory(const std::string& category); + signals: void settingChanged (const CSMPrefs::Setting *setting); diff --git a/apps/opencs/view/prefs/keybindingpage.cpp b/apps/opencs/view/prefs/keybindingpage.cpp index 143665f4a..c70461874 100644 --- a/apps/opencs/view/prefs/keybindingpage.cpp +++ b/apps/opencs/view/prefs/keybindingpage.cpp @@ -6,9 +6,11 @@ #include #include #include +#include #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" +#include "../../model/prefs/state.hpp" namespace CSVPrefs { @@ -22,6 +24,10 @@ namespace CSVPrefs QWidget* topWidget = new QWidget(); QVBoxLayout* topLayout = new QVBoxLayout(topWidget); + QWidget* resetAll = new QPushButton("Reset all to default", this); + connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory())); + topLayout->addWidget(resetAll); + // Allows switching between "pages" QWidget* stackedWidget = new QWidget(); mStackedLayout = new QStackedLayout(stackedWidget); diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index c23e9f64f..7d8644621 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -2,9 +2,11 @@ #include "page.hpp" #include +#include #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" +#include "../../model/prefs/state.hpp" CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) : PageBase (category, parent) @@ -12,6 +14,10 @@ CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) QWidget *widget = new QWidget (parent); mGrid = new QGridLayout (widget); + QWidget* resetAll = new QPushButton("Reset all to default", this); + connect (resetAll, SIGNAL (clicked()), this, SLOT (resetCategory())); + mGrid->addWidget(resetAll, 0, 0, 1, 2); + for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) addSetting (*iter); diff --git a/apps/opencs/view/prefs/pagebase.cpp b/apps/opencs/view/prefs/pagebase.cpp index 16684a69d..344360607 100644 --- a/apps/opencs/view/prefs/pagebase.cpp +++ b/apps/opencs/view/prefs/pagebase.cpp @@ -2,6 +2,7 @@ #include "pagebase.hpp" #include "../../model/prefs/category.hpp" +#include "../../model/prefs/state.hpp" CSVPrefs::PageBase::PageBase (CSMPrefs::Category& category, QWidget *parent) : QScrollArea (parent), mCategory (category) @@ -11,3 +12,8 @@ CSMPrefs::Category& CSVPrefs::PageBase::getCategory() { return mCategory; } + +void CSVPrefs::PageBase::resetCategory() +{ + CSMPrefs::get().resetCategory(getCategory().getKey()); +} diff --git a/apps/opencs/view/prefs/pagebase.hpp b/apps/opencs/view/prefs/pagebase.hpp index affe49f4a..1d83d64d2 100644 --- a/apps/opencs/view/prefs/pagebase.hpp +++ b/apps/opencs/view/prefs/pagebase.hpp @@ -21,6 +21,10 @@ namespace CSVPrefs PageBase (CSMPrefs::Category& category, QWidget *parent); CSMPrefs::Category& getCategory(); + + public slots: + + void resetCategory(); }; } From dff3828710a94b803ae4e7f615e9b934d1d5d52b Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sun, 7 May 2017 16:51:11 +1200 Subject: [PATCH 075/318] Keep the settings page in sync with the real settings --- apps/opencs/model/prefs/shortcutsetting.cpp | 2 + apps/opencs/model/prefs/state.cpp | 18 +++--- apps/opencs/view/prefs/keybindingpage.cpp | 64 +++++++++++++-------- apps/opencs/view/prefs/keybindingpage.hpp | 6 ++ apps/opencs/view/prefs/page.cpp | 36 ++++++++---- apps/opencs/view/prefs/page.hpp | 9 +++ apps/opencs/view/prefs/pagebase.cpp | 1 + apps/opencs/view/prefs/pagebase.hpp | 5 ++ 8 files changed, 95 insertions(+), 46 deletions(-) diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index c56119deb..e1978ba5a 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -10,6 +10,8 @@ #include "state.hpp" #include "shortcutmanager.hpp" +#include + namespace CSMPrefs { const int ShortcutSetting::MaxKeys; diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index 7a1889407..8657044b0 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -591,18 +591,16 @@ CSMPrefs::State& CSMPrefs::State::get() void CSMPrefs::State::resetCategory(const std::string& category) { + for (Settings::CategorySettingValueMap::iterator i = mSettings.mUserSettings.begin(); + i != mSettings.mUserSettings.end(); ++i) { - QMutexLocker lock (&mMutex); - for (Settings::CategorySettingValueMap::iterator i = mSettings.mUserSettings.begin(); i != mSettings.mUserSettings.end(); ++i) + // if the category matches + if (i->first.first == category) { - // if the category matches - if (i->first.first == category) - { - // mark the setting as changed - mSettings.mChangedSettings.insert(std::make_pair(i->first.first, i->first.second)); - // reset the value to the default - i->second = mSettings.mDefaultSettings[i->first]; - } + // mark the setting as changed + mSettings.mChangedSettings.insert(std::make_pair(i->first.first, i->first.second)); + // reset the value to the default + i->second = mSettings.mDefaultSettings[i->first]; } } diff --git a/apps/opencs/view/prefs/keybindingpage.cpp b/apps/opencs/view/prefs/keybindingpage.cpp index c70461874..81e6a4a52 100644 --- a/apps/opencs/view/prefs/keybindingpage.cpp +++ b/apps/opencs/view/prefs/keybindingpage.cpp @@ -16,35 +16,12 @@ namespace CSVPrefs { KeyBindingPage::KeyBindingPage(CSMPrefs::Category& category, QWidget* parent) : PageBase(category, parent) + , mTopWidget(0) , mStackedLayout(0) , mPageLayout(0) , mPageSelector(0) { - // Need one widget for scroll area - QWidget* topWidget = new QWidget(); - QVBoxLayout* topLayout = new QVBoxLayout(topWidget); - - QWidget* resetAll = new QPushButton("Reset all to default", this); - connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory())); - topLayout->addWidget(resetAll); - - // Allows switching between "pages" - QWidget* stackedWidget = new QWidget(); - mStackedLayout = new QStackedLayout(stackedWidget); - - mPageSelector = new QComboBox(); - connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int))); - - topLayout->addWidget(mPageSelector); - topLayout->addWidget(stackedWidget); - topLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); - - // Add each option - for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) - addSetting (*iter); - - setWidgetResizable(true); - setWidget(topWidget); + init(); } void KeyBindingPage::addSetting(CSMPrefs::Setting *setting) @@ -91,4 +68,41 @@ namespace CSVPrefs } } } + + void KeyBindingPage::refresh() + { + delete mTopWidget; + + // reinitialize + init(); + } + + void KeyBindingPage::init() + { + // Need one widget for scroll area + mTopWidget = new QWidget(); + QVBoxLayout* topLayout = new QVBoxLayout(mTopWidget); + + QWidget* resetAll = new QPushButton("Reset all to default", this); + connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory())); + topLayout->addWidget(resetAll); + + // Allows switching between "pages" + QWidget* stackedWidget = new QWidget(); + mStackedLayout = new QStackedLayout(stackedWidget); + + mPageSelector = new QComboBox(); + connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int))); + + topLayout->addWidget(mPageSelector); + topLayout->addWidget(stackedWidget); + topLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); + + // Add each option + for (CSMPrefs::Category::Iterator iter = getCategory().begin(); iter!=getCategory().end(); ++iter) + addSetting (*iter); + + setWidgetResizable(true); + setWidget(mTopWidget); + } } diff --git a/apps/opencs/view/prefs/keybindingpage.hpp b/apps/opencs/view/prefs/keybindingpage.hpp index 8a0cb2952..e00e460b3 100644 --- a/apps/opencs/view/prefs/keybindingpage.hpp +++ b/apps/opencs/view/prefs/keybindingpage.hpp @@ -3,6 +3,7 @@ #include "pagebase.hpp" +class QWidget; class QComboBox; class QGridLayout; class QStackedLayout; @@ -26,6 +27,11 @@ namespace CSVPrefs private: + void refresh(); + + void init(); + + QWidget* mTopWidget; QStackedLayout* mStackedLayout; QGridLayout* mPageLayout; QComboBox* mPageSelector; diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index 7d8644621..281d0d08b 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -10,18 +10,9 @@ CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) : PageBase (category, parent) +, mParent (parent) { - QWidget *widget = new QWidget (parent); - mGrid = new QGridLayout (widget); - - QWidget* resetAll = new QPushButton("Reset all to default", this); - connect (resetAll, SIGNAL (clicked()), this, SLOT (resetCategory())); - mGrid->addWidget(resetAll, 0, 0, 1, 2); - - for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) - addSetting (*iter); - - setWidget (widget); + init(); } void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting) @@ -44,3 +35,26 @@ void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting) mGrid->addWidget (new QWidget (this), next, 0); } } + +void CSVPrefs::Page::refresh() +{ + delete mWidget; + + // reinitialize + init(); +} + +void CSVPrefs::Page::init() +{ + mWidget = new QWidget(mParent); + mGrid = new QGridLayout(mWidget); + + QWidget* resetAll = new QPushButton("Reset all to default", this); + connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory())); + mGrid->addWidget(resetAll, 0, 0, 1, 2); + + for (CSMPrefs::Category::Iterator iter = getCategory().begin(); iter!=getCategory().end(); ++iter) + addSetting (*iter); + + setWidget(mWidget); +} diff --git a/apps/opencs/view/prefs/page.hpp b/apps/opencs/view/prefs/page.hpp index ce13e5d9b..58688bccd 100644 --- a/apps/opencs/view/prefs/page.hpp +++ b/apps/opencs/view/prefs/page.hpp @@ -4,6 +4,7 @@ #include "pagebase.hpp" class QGridLayout; +class QWidget; namespace CSMPrefs { @@ -17,12 +18,20 @@ namespace CSVPrefs Q_OBJECT QGridLayout *mGrid; + QWidget* mParent; + QWidget* mWidget; public: Page (CSMPrefs::Category& category, QWidget *parent); void addSetting (CSMPrefs::Setting *setting); + + private: + + void refresh(); + + void init(); }; } diff --git a/apps/opencs/view/prefs/pagebase.cpp b/apps/opencs/view/prefs/pagebase.cpp index 344360607..38fcc2a70 100644 --- a/apps/opencs/view/prefs/pagebase.cpp +++ b/apps/opencs/view/prefs/pagebase.cpp @@ -16,4 +16,5 @@ CSMPrefs::Category& CSVPrefs::PageBase::getCategory() void CSVPrefs::PageBase::resetCategory() { CSMPrefs::get().resetCategory(getCategory().getKey()); + refresh(); } diff --git a/apps/opencs/view/prefs/pagebase.hpp b/apps/opencs/view/prefs/pagebase.hpp index 1d83d64d2..ac291c4b5 100644 --- a/apps/opencs/view/prefs/pagebase.hpp +++ b/apps/opencs/view/prefs/pagebase.hpp @@ -2,6 +2,7 @@ #define CSV_PREFS_PAGEBASE_H #include +#include namespace CSMPrefs { @@ -25,6 +26,10 @@ namespace CSVPrefs public slots: void resetCategory(); + + private: + + virtual void refresh() {}; }; } From 5fca37d0c8d18b7bd440fb9b3e968f614883cd00 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sun, 7 May 2017 16:54:38 +1200 Subject: [PATCH 076/318] Forgot to remove debugging code --- apps/opencs/model/prefs/shortcutsetting.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index e1978ba5a..c56119deb 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -10,8 +10,6 @@ #include "state.hpp" #include "shortcutmanager.hpp" -#include - namespace CSMPrefs { const int ShortcutSetting::MaxKeys; From 418aeb65f16e0b2dfc26d26a2813f24c60642978 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sun, 7 May 2017 16:58:15 +1200 Subject: [PATCH 077/318] Remove unneeded dependencies --- apps/opencs/model/prefs/state.cpp | 2 -- apps/opencs/view/prefs/keybindingpage.cpp | 1 - apps/opencs/view/prefs/page.cpp | 1 - 3 files changed, 4 deletions(-) diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index 8657044b0..9ce368aa0 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -5,8 +5,6 @@ #include #include -#include - #include "intsetting.hpp" #include "doublesetting.hpp" #include "boolsetting.hpp" diff --git a/apps/opencs/view/prefs/keybindingpage.cpp b/apps/opencs/view/prefs/keybindingpage.cpp index 81e6a4a52..8b2694fb0 100644 --- a/apps/opencs/view/prefs/keybindingpage.cpp +++ b/apps/opencs/view/prefs/keybindingpage.cpp @@ -10,7 +10,6 @@ #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" -#include "../../model/prefs/state.hpp" namespace CSVPrefs { diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index 281d0d08b..77d4f60f3 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -6,7 +6,6 @@ #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" -#include "../../model/prefs/state.hpp" CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) : PageBase (category, parent) From 477af73ad6f46f46ae85ab42e557b2f1b175940c Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sun, 7 May 2017 17:00:26 +1200 Subject: [PATCH 078/318] Missed another one --- apps/opencs/view/prefs/pagebase.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/opencs/view/prefs/pagebase.hpp b/apps/opencs/view/prefs/pagebase.hpp index ac291c4b5..9632890fa 100644 --- a/apps/opencs/view/prefs/pagebase.hpp +++ b/apps/opencs/view/prefs/pagebase.hpp @@ -2,7 +2,6 @@ #define CSV_PREFS_PAGEBASE_H #include -#include namespace CSMPrefs { From d8a711f89f044872cf0a8086ea6bb2c6a15cb5fb Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sun, 7 May 2017 17:05:50 +1200 Subject: [PATCH 079/318] Fix tabs --- apps/opencs/view/prefs/pagebase.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/opencs/view/prefs/pagebase.hpp b/apps/opencs/view/prefs/pagebase.hpp index 9632890fa..c85fd3e11 100644 --- a/apps/opencs/view/prefs/pagebase.hpp +++ b/apps/opencs/view/prefs/pagebase.hpp @@ -21,10 +21,10 @@ namespace CSVPrefs PageBase (CSMPrefs::Category& category, QWidget *parent); CSMPrefs::Category& getCategory(); - - public slots: - - void resetCategory(); + + public slots: + + void resetCategory(); private: From a9760ec80566533cbaf1607577a206580c093403 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sun, 7 May 2017 17:07:58 +1200 Subject: [PATCH 080/318] Fix indenting --- apps/opencs/view/prefs/pagebase.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/opencs/view/prefs/pagebase.hpp b/apps/opencs/view/prefs/pagebase.hpp index c85fd3e11..43dfd42fa 100644 --- a/apps/opencs/view/prefs/pagebase.hpp +++ b/apps/opencs/view/prefs/pagebase.hpp @@ -22,7 +22,7 @@ namespace CSVPrefs CSMPrefs::Category& getCategory(); - public slots: + public slots: void resetCategory(); From 813af876f6508bd2d17cdac6eabc3f5a2f24cda4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 May 2017 23:28:56 +0200 Subject: [PATCH 081/318] Use a partial binary search in isReservedName (Fixes #3835) --- apps/openmw_test_suite/CMakeLists.txt | 2 + .../openmw_test_suite/misc/test_stringops.cpp | 44 +++++++++++++++++++ components/misc/stringops.hpp | 24 ++++++++++ components/resource/scenemanager.cpp | 15 +++++-- 4 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 apps/openmw_test_suite/misc/test_stringops.cpp diff --git a/apps/openmw_test_suite/CMakeLists.txt b/apps/openmw_test_suite/CMakeLists.txt index 24ea1835a..ea4b1209c 100644 --- a/apps/openmw_test_suite/CMakeLists.txt +++ b/apps/openmw_test_suite/CMakeLists.txt @@ -11,6 +11,8 @@ if (GTEST_FOUND) mwdialogue/test_keywordsearch.cpp esm/test_fixed_string.cpp + + misc/test_stringops.cpp ) source_group(apps\\openmw_test_suite FILES openmw_test_suite.cpp ${UNITTEST_SRC_FILES}) diff --git a/apps/openmw_test_suite/misc/test_stringops.cpp b/apps/openmw_test_suite/misc/test_stringops.cpp new file mode 100644 index 000000000..c47e49724 --- /dev/null +++ b/apps/openmw_test_suite/misc/test_stringops.cpp @@ -0,0 +1,44 @@ +#include +#include "components/misc/stringops.hpp" + +struct PartialBinarySearchTest : public ::testing::Test +{ + protected: + std::vector mDataVec; + virtual void SetUp() + { + const char* data[] = { "Head", "Chest", "Tri Head", "Tri Chest", "Bip01" }; + mDataVec = std::vector(data, data+sizeof(data)/sizeof(data[0])); + std::sort(mDataVec.begin(), mDataVec.end(), Misc::StringUtils::ciLess); + } + + virtual void TearDown() + { + } + + bool matches(const std::string& keyword) + { + return Misc::StringUtils::partialBinarySearch(mDataVec.begin(), mDataVec.end(), keyword) != mDataVec.end(); + } +}; + +TEST_F(PartialBinarySearchTest, partial_binary_search_test) +{ + EXPECT_TRUE( matches("Head 01") ); + EXPECT_TRUE( matches("Head") ); + EXPECT_TRUE( matches("Tri Head 01") ); + EXPECT_TRUE( matches("Tri Head") ); + EXPECT_TRUE( matches("tri head") ); + + EXPECT_FALSE( matches(" Head") ); + EXPECT_FALSE( matches("Tri Head") ); +} + +TEST_F (PartialBinarySearchTest, ci_test) +{ + EXPECT_TRUE (Misc::StringUtils::lowerCase("ASD") == "asd"); + + // test to make sure system locale is not used + std::string unicode1 = "\u04151 \u0418"; // CYRILLIC CAPITAL LETTER IE CYRILLIC CAPITAL LETTER I + EXPECT_TRUE( Misc::StringUtils::lowerCase(unicode1) == unicode1 ); +} diff --git a/components/misc/stringops.hpp b/components/misc/stringops.hpp index b14051a81..9acd81710 100644 --- a/components/misc/stringops.hpp +++ b/components/misc/stringops.hpp @@ -114,6 +114,30 @@ public: return ciLess(left, right); } }; + + + /// Performs a binary search on a sorted container for a string that 'key' starts with + template + static Iterator partialBinarySearch(Iterator begin, Iterator end, const T& key) + { + const Iterator notFound = end; + + while(begin < end) + { + const Iterator middle = begin + (std::distance(begin, end) / 2); + + int comp = Misc::StringUtils::ciCompareLen((*middle), key, (*middle).size()); + + if(comp == 0) + return middle; + else if(comp > 0) + end = middle; + else + begin = middle + 1; + } + + return notFound; + } }; } diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 167ab6221..ba8c57c1b 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -383,18 +383,25 @@ namespace Resource public: bool isReservedName(const std::string& name) const { - static std::set reservedNames; + if (name.empty()) + return false; + + static std::vector reservedNames; if (reservedNames.empty()) { const char* reserved[] = {"Head", "Neck", "Chest", "Groin", "Right Hand", "Left Hand", "Right Wrist", "Left Wrist", "Shield Bone", "Right Forearm", "Left Forearm", "Right Upper Arm", "Left Upper Arm", "Right Foot", "Left Foot", "Right Ankle", "Left Ankle", "Right Knee", "Left Knee", "Right Upper Leg", "Left Upper Leg", "Right Clavicle", "Left Clavicle", "Weapon Bone", "Tail", "Bip01 L Hand", "Bip01 R Hand", "Bip01 Head", "Bip01 Spine1", "Bip01 Spine2", "Bip01 L Clavicle", "Bip01 R Clavicle", "bip01", "Root Bone", "Bip01 Neck", "BoneOffset", "AttachLight", "ArrowBone", "Camera"}; - reservedNames = std::set(reserved, reserved + sizeof(reserved)/sizeof(reserved[0])); + reservedNames = std::vector(reserved, reserved + sizeof(reserved)/sizeof(reserved[0])); for (unsigned int i=0; i::iterator it = Misc::StringUtils::partialBinarySearch(reservedNames.begin(), reservedNames.end(), name); + return it != reservedNames.end(); } virtual bool isOperationPermissibleForObjectImplementation(const SceneUtil::Optimizer* optimizer, const osg::Drawable* node,unsigned int option) const From 48c764a580830757e83e5b91c1fbb4fe149114cc Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 May 2017 23:31:06 +0200 Subject: [PATCH 082/318] Update test --- apps/openmw_test_suite/misc/test_stringops.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw_test_suite/misc/test_stringops.cpp b/apps/openmw_test_suite/misc/test_stringops.cpp index c47e49724..3a3fe295c 100644 --- a/apps/openmw_test_suite/misc/test_stringops.cpp +++ b/apps/openmw_test_suite/misc/test_stringops.cpp @@ -30,6 +30,7 @@ TEST_F(PartialBinarySearchTest, partial_binary_search_test) EXPECT_TRUE( matches("Tri Head") ); EXPECT_TRUE( matches("tri head") ); + EXPECT_FALSE( matches("Hea") ); EXPECT_FALSE( matches(" Head") ); EXPECT_FALSE( matches("Tri Head") ); } From f30d1a30753140ef1763d54087aa7a30c3932182 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Mon, 8 May 2017 17:24:28 +1200 Subject: [PATCH 083/318] Revert everything --- apps/opencs/model/prefs/state.cpp | 22 -------- apps/opencs/model/prefs/state.hpp | 2 - apps/opencs/view/prefs/keybindingpage.cpp | 61 ++++++++--------------- apps/opencs/view/prefs/keybindingpage.hpp | 6 --- apps/opencs/view/prefs/page.cpp | 33 +++--------- apps/opencs/view/prefs/page.hpp | 9 ---- apps/opencs/view/prefs/pagebase.cpp | 7 --- apps/opencs/view/prefs/pagebase.hpp | 8 --- 8 files changed, 28 insertions(+), 120 deletions(-) diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index 9ce368aa0..3921e32f2 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -587,28 +587,6 @@ CSMPrefs::State& CSMPrefs::State::get() return *sThis; } -void CSMPrefs::State::resetCategory(const std::string& category) -{ - for (Settings::CategorySettingValueMap::iterator i = mSettings.mUserSettings.begin(); - i != mSettings.mUserSettings.end(); ++i) - { - // if the category matches - if (i->first.first == category) - { - // mark the setting as changed - mSettings.mChangedSettings.insert(std::make_pair(i->first.first, i->first.second)); - // reset the value to the default - i->second = mSettings.mDefaultSettings[i->first]; - } - } - - Collection::iterator iter = mCategories.find(category); - if (iter != mCategories.end()) - { - (*iter).second.update(); - } -} - CSMPrefs::State& CSMPrefs::get() { diff --git a/apps/opencs/model/prefs/state.hpp b/apps/opencs/model/prefs/state.hpp index 1e0ac8c11..1e46c68ee 100644 --- a/apps/opencs/model/prefs/state.hpp +++ b/apps/opencs/model/prefs/state.hpp @@ -106,8 +106,6 @@ namespace CSMPrefs static State& get(); - void resetCategory(const std::string& category); - signals: void settingChanged (const CSMPrefs::Setting *setting); diff --git a/apps/opencs/view/prefs/keybindingpage.cpp b/apps/opencs/view/prefs/keybindingpage.cpp index 8b2694fb0..143665f4a 100644 --- a/apps/opencs/view/prefs/keybindingpage.cpp +++ b/apps/opencs/view/prefs/keybindingpage.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" @@ -15,12 +14,31 @@ namespace CSVPrefs { KeyBindingPage::KeyBindingPage(CSMPrefs::Category& category, QWidget* parent) : PageBase(category, parent) - , mTopWidget(0) , mStackedLayout(0) , mPageLayout(0) , mPageSelector(0) { - init(); + // Need one widget for scroll area + QWidget* topWidget = new QWidget(); + QVBoxLayout* topLayout = new QVBoxLayout(topWidget); + + // Allows switching between "pages" + QWidget* stackedWidget = new QWidget(); + mStackedLayout = new QStackedLayout(stackedWidget); + + mPageSelector = new QComboBox(); + connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int))); + + topLayout->addWidget(mPageSelector); + topLayout->addWidget(stackedWidget); + topLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); + + // Add each option + for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) + addSetting (*iter); + + setWidgetResizable(true); + setWidget(topWidget); } void KeyBindingPage::addSetting(CSMPrefs::Setting *setting) @@ -67,41 +85,4 @@ namespace CSVPrefs } } } - - void KeyBindingPage::refresh() - { - delete mTopWidget; - - // reinitialize - init(); - } - - void KeyBindingPage::init() - { - // Need one widget for scroll area - mTopWidget = new QWidget(); - QVBoxLayout* topLayout = new QVBoxLayout(mTopWidget); - - QWidget* resetAll = new QPushButton("Reset all to default", this); - connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory())); - topLayout->addWidget(resetAll); - - // Allows switching between "pages" - QWidget* stackedWidget = new QWidget(); - mStackedLayout = new QStackedLayout(stackedWidget); - - mPageSelector = new QComboBox(); - connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int))); - - topLayout->addWidget(mPageSelector); - topLayout->addWidget(stackedWidget); - topLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); - - // Add each option - for (CSMPrefs::Category::Iterator iter = getCategory().begin(); iter!=getCategory().end(); ++iter) - addSetting (*iter); - - setWidgetResizable(true); - setWidget(mTopWidget); - } } diff --git a/apps/opencs/view/prefs/keybindingpage.hpp b/apps/opencs/view/prefs/keybindingpage.hpp index e00e460b3..8a0cb2952 100644 --- a/apps/opencs/view/prefs/keybindingpage.hpp +++ b/apps/opencs/view/prefs/keybindingpage.hpp @@ -3,7 +3,6 @@ #include "pagebase.hpp" -class QWidget; class QComboBox; class QGridLayout; class QStackedLayout; @@ -27,11 +26,6 @@ namespace CSVPrefs private: - void refresh(); - - void init(); - - QWidget* mTopWidget; QStackedLayout* mStackedLayout; QGridLayout* mPageLayout; QComboBox* mPageSelector; diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index 77d4f60f3..c23e9f64f 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -2,16 +2,20 @@ #include "page.hpp" #include -#include #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) : PageBase (category, parent) -, mParent (parent) { - init(); + QWidget *widget = new QWidget (parent); + mGrid = new QGridLayout (widget); + + for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) + addSetting (*iter); + + setWidget (widget); } void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting) @@ -34,26 +38,3 @@ void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting) mGrid->addWidget (new QWidget (this), next, 0); } } - -void CSVPrefs::Page::refresh() -{ - delete mWidget; - - // reinitialize - init(); -} - -void CSVPrefs::Page::init() -{ - mWidget = new QWidget(mParent); - mGrid = new QGridLayout(mWidget); - - QWidget* resetAll = new QPushButton("Reset all to default", this); - connect(resetAll, SIGNAL(clicked()), this, SLOT(resetCategory())); - mGrid->addWidget(resetAll, 0, 0, 1, 2); - - for (CSMPrefs::Category::Iterator iter = getCategory().begin(); iter!=getCategory().end(); ++iter) - addSetting (*iter); - - setWidget(mWidget); -} diff --git a/apps/opencs/view/prefs/page.hpp b/apps/opencs/view/prefs/page.hpp index 58688bccd..ce13e5d9b 100644 --- a/apps/opencs/view/prefs/page.hpp +++ b/apps/opencs/view/prefs/page.hpp @@ -4,7 +4,6 @@ #include "pagebase.hpp" class QGridLayout; -class QWidget; namespace CSMPrefs { @@ -18,20 +17,12 @@ namespace CSVPrefs Q_OBJECT QGridLayout *mGrid; - QWidget* mParent; - QWidget* mWidget; public: Page (CSMPrefs::Category& category, QWidget *parent); void addSetting (CSMPrefs::Setting *setting); - - private: - - void refresh(); - - void init(); }; } diff --git a/apps/opencs/view/prefs/pagebase.cpp b/apps/opencs/view/prefs/pagebase.cpp index 38fcc2a70..16684a69d 100644 --- a/apps/opencs/view/prefs/pagebase.cpp +++ b/apps/opencs/view/prefs/pagebase.cpp @@ -2,7 +2,6 @@ #include "pagebase.hpp" #include "../../model/prefs/category.hpp" -#include "../../model/prefs/state.hpp" CSVPrefs::PageBase::PageBase (CSMPrefs::Category& category, QWidget *parent) : QScrollArea (parent), mCategory (category) @@ -12,9 +11,3 @@ CSMPrefs::Category& CSVPrefs::PageBase::getCategory() { return mCategory; } - -void CSVPrefs::PageBase::resetCategory() -{ - CSMPrefs::get().resetCategory(getCategory().getKey()); - refresh(); -} diff --git a/apps/opencs/view/prefs/pagebase.hpp b/apps/opencs/view/prefs/pagebase.hpp index 43dfd42fa..affe49f4a 100644 --- a/apps/opencs/view/prefs/pagebase.hpp +++ b/apps/opencs/view/prefs/pagebase.hpp @@ -21,14 +21,6 @@ namespace CSVPrefs PageBase (CSMPrefs::Category& category, QWidget *parent); CSMPrefs::Category& getCategory(); - - public slots: - - void resetCategory(); - - private: - - virtual void refresh() {}; }; } From de14e9811dda62f8d164c7f4721ff7738cb676c3 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 8 May 2017 11:16:03 +0400 Subject: [PATCH 084/318] Fixed Travis CI build --- apps/openmw_test_suite/misc/test_stringops.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw_test_suite/misc/test_stringops.cpp b/apps/openmw_test_suite/misc/test_stringops.cpp index 3a3fe295c..53a33dbf4 100644 --- a/apps/openmw_test_suite/misc/test_stringops.cpp +++ b/apps/openmw_test_suite/misc/test_stringops.cpp @@ -40,6 +40,6 @@ TEST_F (PartialBinarySearchTest, ci_test) EXPECT_TRUE (Misc::StringUtils::lowerCase("ASD") == "asd"); // test to make sure system locale is not used - std::string unicode1 = "\u04151 \u0418"; // CYRILLIC CAPITAL LETTER IE CYRILLIC CAPITAL LETTER I + std::string unicode1 = "\u04151 \u0418"; // CYRILLIC CAPITAL LETTER IE, CYRILLIC CAPITAL LETTER I EXPECT_TRUE( Misc::StringUtils::lowerCase(unicode1) == unicode1 ); } From 315ad54b29c9e0382db26e541b42940dfff1fa5f Mon Sep 17 00:00:00 2001 From: Allofich Date: Mon, 8 May 2017 19:55:54 +0900 Subject: [PATCH 085/318] Don't make NPCs or player speak while underwater (Fixes #3851) --- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index c853efad2..38ad821cd 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -633,6 +633,12 @@ namespace MWDialogue return; } + if (actor.getClass().isNpc() && MWBase::Environment::get().getWorld()->isSwimming(actor)) + { + // NPCs don't talk while submerged + return; + } + const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Dialogue *dial = store.get().find(topic); From 3545cfa00aacb4c487bc1c6a5c0ed48c9c6a99f6 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Tue, 9 May 2017 19:50:16 +1200 Subject: [PATCH 086/318] Rewrite feature to reset options to default --- apps/opencs/CMakeLists.txt | 2 +- apps/opencs/model/prefs/boolsetting.cpp | 22 ++++++++---- apps/opencs/model/prefs/boolsetting.hpp | 5 +++ apps/opencs/model/prefs/coloursetting.cpp | 20 ++++++++--- apps/opencs/model/prefs/coloursetting.hpp | 8 +++++ apps/opencs/model/prefs/doublesetting.cpp | 24 ++++++++----- apps/opencs/model/prefs/doublesetting.hpp | 5 +++ apps/opencs/model/prefs/enumsetting.cpp | 26 ++++++++++---- apps/opencs/model/prefs/enumsetting.hpp | 5 +++ apps/opencs/model/prefs/intsetting.cpp | 22 ++++++++---- apps/opencs/model/prefs/intsetting.hpp | 5 +++ apps/opencs/model/prefs/modifiersetting.cpp | 13 +++++++ apps/opencs/model/prefs/modifiersetting.hpp | 2 ++ apps/opencs/model/prefs/setting.cpp | 4 +++ apps/opencs/model/prefs/setting.hpp | 5 +++ apps/opencs/model/prefs/shortcutsetting.cpp | 14 ++++++++ apps/opencs/model/prefs/shortcutsetting.hpp | 2 ++ apps/opencs/model/prefs/state.cpp | 35 +++++++++++++++++++ apps/opencs/model/prefs/state.hpp | 4 +++ apps/opencs/view/prefs/contextmenulist.cpp | 32 +++++++++++++++++ apps/opencs/view/prefs/contextmenulist.hpp | 30 ++++++++++++++++ apps/opencs/view/prefs/contextmenuwidget.cpp | 33 ++++++++++++++++++ apps/opencs/view/prefs/contextmenuwidget.hpp | 36 ++++++++++++++++++++ apps/opencs/view/prefs/dialogue.cpp | 17 ++++----- apps/opencs/view/prefs/dialogue.hpp | 1 - apps/opencs/view/prefs/page.cpp | 3 +- 26 files changed, 331 insertions(+), 44 deletions(-) create mode 100644 apps/opencs/view/prefs/contextmenulist.cpp create mode 100644 apps/opencs/view/prefs/contextmenulist.hpp create mode 100644 apps/opencs/view/prefs/contextmenuwidget.cpp create mode 100644 apps/opencs/view/prefs/contextmenuwidget.hpp diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 8a3d3c1c8..d04259b38 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -110,7 +110,7 @@ opencs_units_noqt (view/tools ) opencs_units (view/prefs - dialogue pagebase page keybindingpage + dialogue pagebase page keybindingpage contextmenulist contextmenuwidget ) opencs_units (model/prefs diff --git a/apps/opencs/model/prefs/boolsetting.cpp b/apps/opencs/model/prefs/boolsetting.cpp index 6c0babaf7..6431dc6af 100644 --- a/apps/opencs/model/prefs/boolsetting.cpp +++ b/apps/opencs/model/prefs/boolsetting.cpp @@ -11,7 +11,7 @@ CSMPrefs::BoolSetting::BoolSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, bool default_) -: Setting (parent, values, mutex, key, label), mDefault (default_) +: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0) {} CSMPrefs::BoolSetting& CSMPrefs::BoolSetting::setTooltip (const std::string& tooltip) @@ -22,18 +22,28 @@ CSMPrefs::BoolSetting& CSMPrefs::BoolSetting::setTooltip (const std::string& too std::pair CSMPrefs::BoolSetting::makeWidgets (QWidget *parent) { - QCheckBox *widget = new QCheckBox (QString::fromUtf8 (getLabel().c_str()), parent); - widget->setCheckState (mDefault ? Qt::Checked : Qt::Unchecked); + mWidget = new QCheckBox (QString::fromUtf8 (getLabel().c_str()), parent); + mWidget->setCheckState (mDefault ? Qt::Checked : Qt::Unchecked); if (!mTooltip.empty()) { QString tooltip = QString::fromUtf8 (mTooltip.c_str()); - widget->setToolTip (tooltip); + mWidget->setToolTip (tooltip); } - connect (widget, SIGNAL (stateChanged (int)), this, SLOT (valueChanged (int))); + connect (mWidget, SIGNAL (stateChanged (int)), this, SLOT (valueChanged (int))); - return std::make_pair (static_cast (0), widget); + return std::make_pair (static_cast (0), mWidget); +} + +void CSMPrefs::BoolSetting::updateWidget() +{ + if (mWidget) + { + mWidget->setCheckState(getValues().getBool(getKey(), getParent()->getKey()) + ? Qt::Checked + : Qt::Unchecked); + } } void CSMPrefs::BoolSetting::valueChanged (int value) diff --git a/apps/opencs/model/prefs/boolsetting.hpp b/apps/opencs/model/prefs/boolsetting.hpp index f8a321859..37c018d14 100644 --- a/apps/opencs/model/prefs/boolsetting.hpp +++ b/apps/opencs/model/prefs/boolsetting.hpp @@ -3,6 +3,8 @@ #include "setting.hpp" +class QCheckBox; + namespace CSMPrefs { class BoolSetting : public Setting @@ -11,6 +13,7 @@ namespace CSMPrefs std::string mTooltip; bool mDefault; + QCheckBox* mWidget; public: @@ -22,6 +25,8 @@ namespace CSMPrefs /// Return label, input widget. virtual std::pair makeWidgets (QWidget *parent); + virtual void updateWidget(); + private slots: void valueChanged (int value); diff --git a/apps/opencs/model/prefs/coloursetting.cpp b/apps/opencs/model/prefs/coloursetting.cpp index d51bfad56..1a41621da 100644 --- a/apps/opencs/model/prefs/coloursetting.cpp +++ b/apps/opencs/model/prefs/coloursetting.cpp @@ -3,6 +3,7 @@ #include #include +#include #include @@ -13,7 +14,7 @@ CSMPrefs::ColourSetting::ColourSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, QColor default_) -: Setting (parent, values, mutex, key, label), mDefault (default_) +: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0) {} CSMPrefs::ColourSetting& CSMPrefs::ColourSetting::setTooltip (const std::string& tooltip) @@ -26,18 +27,27 @@ std::pair CSMPrefs::ColourSetting::makeWidgets (QWidget *p { QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent); - CSVWidget::ColorEditor *widget = new CSVWidget::ColorEditor (mDefault, parent); + mWidget = new CSVWidget::ColorEditor (mDefault, parent); if (!mTooltip.empty()) { QString tooltip = QString::fromUtf8 (mTooltip.c_str()); label->setToolTip (tooltip); - widget->setToolTip (tooltip); + mWidget->setToolTip (tooltip); } - connect (widget, SIGNAL (pickingFinished()), this, SLOT (valueChanged())); + connect (mWidget, SIGNAL (pickingFinished()), this, SLOT (valueChanged())); - return std::make_pair (label, widget); + return std::make_pair (label, mWidget); +} + +void CSMPrefs::ColourSetting::updateWidget() +{ + if (mWidget) + { + mWidget->setColor(QString::fromStdString + (getValues().getString(getKey(), getParent()->getKey()))); + } } void CSMPrefs::ColourSetting::valueChanged() diff --git a/apps/opencs/model/prefs/coloursetting.hpp b/apps/opencs/model/prefs/coloursetting.hpp index be58426f2..e892b21d6 100644 --- a/apps/opencs/model/prefs/coloursetting.hpp +++ b/apps/opencs/model/prefs/coloursetting.hpp @@ -5,6 +5,11 @@ #include +namespace CSVWidget +{ + class ColorEditor; +} + namespace CSMPrefs { class ColourSetting : public Setting @@ -13,6 +18,7 @@ namespace CSMPrefs std::string mTooltip; QColor mDefault; + CSVWidget::ColorEditor* mWidget; public: @@ -25,6 +31,8 @@ namespace CSMPrefs /// Return label, input widget. virtual std::pair makeWidgets (QWidget *parent); + virtual void updateWidget(); + private slots: void valueChanged(); diff --git a/apps/opencs/model/prefs/doublesetting.cpp b/apps/opencs/model/prefs/doublesetting.cpp index 531196174..8ae6f4818 100644 --- a/apps/opencs/model/prefs/doublesetting.cpp +++ b/apps/opencs/model/prefs/doublesetting.cpp @@ -16,7 +16,7 @@ CSMPrefs::DoubleSetting::DoubleSetting (Category *parent, Settings::Manager *val QMutex *mutex, const std::string& key, const std::string& label, double default_) : Setting (parent, values, mutex, key, label), mPrecision(2), mMin (0), mMax (std::numeric_limits::max()), - mDefault (default_) + mDefault (default_), mWidget(0) {} CSMPrefs::DoubleSetting& CSMPrefs::DoubleSetting::setPrecision(int precision) @@ -54,21 +54,29 @@ std::pair CSMPrefs::DoubleSetting::makeWidgets (QWidget *p { QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent); - QDoubleSpinBox *widget = new QDoubleSpinBox (parent); - widget->setDecimals(mPrecision); - widget->setRange (mMin, mMax); - widget->setValue (mDefault); + mWidget = new QDoubleSpinBox (parent); + mWidget->setDecimals(mPrecision); + mWidget->setRange (mMin, mMax); + mWidget->setValue (mDefault); if (!mTooltip.empty()) { QString tooltip = QString::fromUtf8 (mTooltip.c_str()); label->setToolTip (tooltip); - widget->setToolTip (tooltip); + mWidget->setToolTip (tooltip); } - connect (widget, SIGNAL (valueChanged (double)), this, SLOT (valueChanged (double))); + connect (mWidget, SIGNAL (valueChanged (double)), this, SLOT (valueChanged (double))); - return std::make_pair (label, widget); + return std::make_pair (label, mWidget); +} + +void CSMPrefs::DoubleSetting::updateWidget() +{ + if (mWidget) + { + mWidget->setValue(getValues().getFloat(getKey(), getParent()->getKey())); + } } void CSMPrefs::DoubleSetting::valueChanged (double value) diff --git a/apps/opencs/model/prefs/doublesetting.hpp b/apps/opencs/model/prefs/doublesetting.hpp index 8fd345f4d..4d297409b 100644 --- a/apps/opencs/model/prefs/doublesetting.hpp +++ b/apps/opencs/model/prefs/doublesetting.hpp @@ -3,6 +3,8 @@ #include "setting.hpp" +class QDoubleSpinBox; + namespace CSMPrefs { class DoubleSetting : public Setting @@ -14,6 +16,7 @@ namespace CSMPrefs double mMax; std::string mTooltip; double mDefault; + QDoubleSpinBox* mWidget; public: @@ -35,6 +38,8 @@ namespace CSMPrefs /// Return label, input widget. virtual std::pair makeWidgets (QWidget *parent); + virtual void updateWidget(); + private slots: void valueChanged (double value); diff --git a/apps/opencs/model/prefs/enumsetting.cpp b/apps/opencs/model/prefs/enumsetting.cpp index e69f717ea..901bbf8e4 100644 --- a/apps/opencs/model/prefs/enumsetting.cpp +++ b/apps/opencs/model/prefs/enumsetting.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -41,7 +42,7 @@ CSMPrefs::EnumValues& CSMPrefs::EnumValues::add (const std::string& value, const CSMPrefs::EnumSetting::EnumSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, const EnumValue& default_) -: Setting (parent, values, mutex, key, label), mDefault (default_) +: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget() {} CSMPrefs::EnumSetting& CSMPrefs::EnumSetting::setTooltip (const std::string& tooltip) @@ -72,7 +73,7 @@ std::pair CSMPrefs::EnumSetting::makeWidgets (QWidget *par { QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent); - QComboBox *widget = new QComboBox (parent); + mWidget = new QComboBox (parent); int index = 0; @@ -81,14 +82,14 @@ std::pair CSMPrefs::EnumSetting::makeWidgets (QWidget *par if (mDefault.mValue==mValues.mValues[i].mValue) index = i; - widget->addItem (QString::fromUtf8 (mValues.mValues[i].mValue.c_str())); + mWidget->addItem (QString::fromUtf8 (mValues.mValues[i].mValue.c_str())); if (!mValues.mValues[i].mTooltip.empty()) - widget->setItemData (i, QString::fromUtf8 (mValues.mValues[i].mTooltip.c_str()), + mWidget->setItemData (i, QString::fromUtf8 (mValues.mValues[i].mTooltip.c_str()), Qt::ToolTipRole); } - widget->setCurrentIndex (index); + mWidget->setCurrentIndex (index); if (!mTooltip.empty()) { @@ -96,9 +97,20 @@ std::pair CSMPrefs::EnumSetting::makeWidgets (QWidget *par label->setToolTip (tooltip); } - connect (widget, SIGNAL (currentIndexChanged (int)), this, SLOT (valueChanged (int))); + connect (mWidget, SIGNAL (currentIndexChanged (int)), this, SLOT (valueChanged (int))); - return std::make_pair (label, widget); + return std::make_pair (label, mWidget); +} + +void CSMPrefs::EnumSetting::updateWidget() +{ + if (mWidget) + { + int index = mWidget->findText(QString::fromStdString + (getValues().getString(getKey(), getParent()->getKey()))); + + mWidget->setCurrentIndex(index); + } } void CSMPrefs::EnumSetting::valueChanged (int value) diff --git a/apps/opencs/model/prefs/enumsetting.hpp b/apps/opencs/model/prefs/enumsetting.hpp index 728de3acd..b01635cdf 100644 --- a/apps/opencs/model/prefs/enumsetting.hpp +++ b/apps/opencs/model/prefs/enumsetting.hpp @@ -5,6 +5,8 @@ #include "setting.hpp" +class QComboBox; + namespace CSMPrefs { struct EnumValue @@ -35,6 +37,7 @@ namespace CSMPrefs std::string mTooltip; EnumValue mDefault; EnumValues mValues; + QComboBox* mWidget; public: @@ -53,6 +56,8 @@ namespace CSMPrefs /// Return label, input widget. virtual std::pair makeWidgets (QWidget *parent); + virtual void updateWidget(); + private slots: void valueChanged (int value); diff --git a/apps/opencs/model/prefs/intsetting.cpp b/apps/opencs/model/prefs/intsetting.cpp index 269a63af4..25dbf78c2 100644 --- a/apps/opencs/model/prefs/intsetting.cpp +++ b/apps/opencs/model/prefs/intsetting.cpp @@ -15,7 +15,7 @@ CSMPrefs::IntSetting::IntSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, int default_) : Setting (parent, values, mutex, key, label), mMin (0), mMax (std::numeric_limits::max()), - mDefault (default_) + mDefault (default_), mWidget(0) {} CSMPrefs::IntSetting& CSMPrefs::IntSetting::setRange (int min, int max) @@ -47,20 +47,28 @@ std::pair CSMPrefs::IntSetting::makeWidgets (QWidget *pare { QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent); - QSpinBox *widget = new QSpinBox (parent); - widget->setRange (mMin, mMax); - widget->setValue (mDefault); + mWidget = new QSpinBox (parent); + mWidget->setRange (mMin, mMax); + mWidget->setValue (mDefault); if (!mTooltip.empty()) { QString tooltip = QString::fromUtf8 (mTooltip.c_str()); label->setToolTip (tooltip); - widget->setToolTip (tooltip); + mWidget->setToolTip (tooltip); } - connect (widget, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int))); + connect (mWidget, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int))); - return std::make_pair (label, widget); + return std::make_pair (label, mWidget); +} + +void CSMPrefs::IntSetting::updateWidget() +{ + if (mWidget) + { + mWidget->setValue(getValues().getInt(getKey(), getParent()->getKey())); + } } void CSMPrefs::IntSetting::valueChanged (int value) diff --git a/apps/opencs/model/prefs/intsetting.hpp b/apps/opencs/model/prefs/intsetting.hpp index 0ee6cf9e3..ee0989d83 100644 --- a/apps/opencs/model/prefs/intsetting.hpp +++ b/apps/opencs/model/prefs/intsetting.hpp @@ -3,6 +3,8 @@ #include "setting.hpp" +class QSpinBox; + namespace CSMPrefs { class IntSetting : public Setting @@ -13,6 +15,7 @@ namespace CSMPrefs int mMax; std::string mTooltip; int mDefault; + QSpinBox* mWidget; public: @@ -31,6 +34,8 @@ namespace CSMPrefs /// Return label, input widget. virtual std::pair makeWidgets (QWidget *parent); + virtual void updateWidget(); + private slots: void valueChanged (int value); diff --git a/apps/opencs/model/prefs/modifiersetting.cpp b/apps/opencs/model/prefs/modifiersetting.cpp index 4f4fac248..b70d39714 100644 --- a/apps/opencs/model/prefs/modifiersetting.cpp +++ b/apps/opencs/model/prefs/modifiersetting.cpp @@ -39,6 +39,19 @@ namespace CSMPrefs return std::make_pair(label, widget); } + void ModifierSetting::updateWidget() + { + if (mButton) + { + std::string shortcut = getValues().getString(getKey(), getParent()->getKey()); + + int modifier; + State::get().getShortcutManager().convertFromString(shortcut, modifier); + State::get().getShortcutManager().setModifier(getKey(), modifier); + resetState(); + } + } + bool ModifierSetting::eventFilter(QObject* target, QEvent* event) { if (event->type() == QEvent::KeyPress) diff --git a/apps/opencs/model/prefs/modifiersetting.hpp b/apps/opencs/model/prefs/modifiersetting.hpp index 95983f66d..2c6a45b5a 100644 --- a/apps/opencs/model/prefs/modifiersetting.hpp +++ b/apps/opencs/model/prefs/modifiersetting.hpp @@ -21,6 +21,8 @@ namespace CSMPrefs virtual std::pair makeWidgets(QWidget* parent); + virtual void updateWidget(); + protected: bool eventFilter(QObject* target, QEvent* event); diff --git a/apps/opencs/model/prefs/setting.cpp b/apps/opencs/model/prefs/setting.cpp index 75b58322d..165062232 100644 --- a/apps/opencs/model/prefs/setting.cpp +++ b/apps/opencs/model/prefs/setting.cpp @@ -30,6 +30,10 @@ std::pair CSMPrefs::Setting::makeWidgets (QWidget *parent) return std::pair (0, 0); } +void CSMPrefs::Setting::updateWidget() +{ +} + const CSMPrefs::Category *CSMPrefs::Setting::getParent() const { return mParent; diff --git a/apps/opencs/model/prefs/setting.hpp b/apps/opencs/model/prefs/setting.hpp index 00bcc638b..7cb2d7acf 100644 --- a/apps/opencs/model/prefs/setting.hpp +++ b/apps/opencs/model/prefs/setting.hpp @@ -47,6 +47,11 @@ namespace CSMPrefs /// widget. virtual std::pair makeWidgets (QWidget *parent); + /// Updates the widget returned by makeWidgets() to the current setting. + /// + /// \note If make_widgets() has not been called yet then nothing happens. + virtual void updateWidget(); + const Category *getParent() const; const std::string& getKey() const; diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index c56119deb..418559475 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "state.hpp" #include "shortcutmanager.hpp" @@ -46,6 +47,19 @@ namespace CSMPrefs return std::make_pair(label, widget); } + void ShortcutSetting::updateWidget() + { + if (mButton) + { + std::string shortcut = getValues().getString(getKey(), getParent()->getKey()); + + QKeySequence sequence; + State::get().getShortcutManager().convertFromString(shortcut, sequence); + State::get().getShortcutManager().setSequence(getKey(), sequence); + resetState(); + } + } + bool ShortcutSetting::eventFilter(QObject* target, QEvent* event) { if (event->type() == QEvent::KeyPress) diff --git a/apps/opencs/model/prefs/shortcutsetting.hpp b/apps/opencs/model/prefs/shortcutsetting.hpp index bb38b580a..c388305a6 100644 --- a/apps/opencs/model/prefs/shortcutsetting.hpp +++ b/apps/opencs/model/prefs/shortcutsetting.hpp @@ -21,6 +21,8 @@ namespace CSMPrefs virtual std::pair makeWidgets(QWidget* parent); + virtual void updateWidget(); + protected: bool eventFilter(QObject* target, QEvent* event); diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index 3921e32f2..618a4bfc9 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -587,6 +587,41 @@ CSMPrefs::State& CSMPrefs::State::get() return *sThis; } +void CSMPrefs::State::resetCategory(const std::string& category) +{ + for (Settings::CategorySettingValueMap::iterator i = mSettings.mUserSettings.begin(); + i != mSettings.mUserSettings.end(); ++i) + { + // if the category matches + if (i->first.first == category) + { + // mark the setting as changed + mSettings.mChangedSettings.insert(std::make_pair(i->first.first, i->first.second)); + // reset the value to the default + i->second = mSettings.mDefaultSettings[i->first]; + } + } + + Collection::iterator container = mCategories.find(category); + if (container != mCategories.end()) + { + Category settings = container->second; + for (Category::Iterator i = settings.begin(); i != settings.end(); ++i) + { + (*i)->updateWidget(); + update(**i); + } + } +} + +void CSMPrefs::State::resetAll() +{ + for (Collection::iterator iter = mCategories.begin(); iter != mCategories.end(); ++iter) + { + resetCategory(iter->first); + } +} + CSMPrefs::State& CSMPrefs::get() { diff --git a/apps/opencs/model/prefs/state.hpp b/apps/opencs/model/prefs/state.hpp index 1e46c68ee..a32583dc5 100644 --- a/apps/opencs/model/prefs/state.hpp +++ b/apps/opencs/model/prefs/state.hpp @@ -106,6 +106,10 @@ namespace CSMPrefs static State& get(); + void resetCategory(const std::string& category); + + void resetAll(); + signals: void settingChanged (const CSMPrefs::Setting *setting); diff --git a/apps/opencs/view/prefs/contextmenulist.cpp b/apps/opencs/view/prefs/contextmenulist.cpp new file mode 100644 index 000000000..71527d8c6 --- /dev/null +++ b/apps/opencs/view/prefs/contextmenulist.cpp @@ -0,0 +1,32 @@ +#include "contextmenulist.hpp" + +#include +#include + +#include "../../model/prefs/state.hpp" + +CSVPrefs::ContextMenuList::ContextMenuList(QWidget* parent) + :QListWidget(parent) +{ +} + +void CSVPrefs::ContextMenuList::contextMenuEvent(QContextMenuEvent* e) +{ + QMenu* menu = new QMenu(); + + menu->addAction("Reset category to default", this, SLOT(resetCategory())); + menu->addAction("Reset all to default", this, SLOT(resetAll())); + + menu->exec(e->globalPos()); + delete menu; +} + +void CSVPrefs::ContextMenuList::resetCategory() +{ + CSMPrefs::State::get().resetCategory(currentItem()->text().toStdString()); +} + +void CSVPrefs::ContextMenuList::resetAll() +{ + CSMPrefs::State::get().resetAll(); +} diff --git a/apps/opencs/view/prefs/contextmenulist.hpp b/apps/opencs/view/prefs/contextmenulist.hpp new file mode 100644 index 000000000..222cfea6b --- /dev/null +++ b/apps/opencs/view/prefs/contextmenulist.hpp @@ -0,0 +1,30 @@ +#ifndef CSV_PREFS_CONTEXTMENULIST_H +#define CSV_PREFS_CONTEXTMENULIST_H + +#include + +class QContextMenuEvent; + +namespace CSVPrefs +{ + class ContextMenuList : public QListWidget + { + Q_OBJECT + + public: + + ContextMenuList(QWidget* parent = 0); + + protected: + + void contextMenuEvent(QContextMenuEvent* e); + + private slots: + + void resetCategory(); + + void resetAll(); + }; +} + +#endif diff --git a/apps/opencs/view/prefs/contextmenuwidget.cpp b/apps/opencs/view/prefs/contextmenuwidget.cpp new file mode 100644 index 000000000..abf3d6edc --- /dev/null +++ b/apps/opencs/view/prefs/contextmenuwidget.cpp @@ -0,0 +1,33 @@ +#include "contextmenuwidget.hpp" + +#include +#include + +#include "../../model/prefs/state.hpp" + +CSVPrefs::ContextMenuWidget::ContextMenuWidget(QWidget* parent, const std::string& category) + :QWidget(parent) + ,mCategory(category) +{ +} + +void CSVPrefs::ContextMenuWidget::contextMenuEvent(QContextMenuEvent* e) +{ + QMenu* menu = new QMenu(); + + menu->addAction("Reset category to default", this, SLOT(resetCategory())); + menu->addAction("Reset all to default", this, SLOT(resetAll())); + + menu->exec(e->globalPos()); + delete menu; +} + +void CSVPrefs::ContextMenuWidget::resetCategory() +{ + CSMPrefs::State::get().resetCategory(mCategory); +} + +void CSVPrefs::ContextMenuWidget::resetAll() +{ + CSMPrefs::State::get().resetAll(); +} diff --git a/apps/opencs/view/prefs/contextmenuwidget.hpp b/apps/opencs/view/prefs/contextmenuwidget.hpp new file mode 100644 index 000000000..0d8d5006c --- /dev/null +++ b/apps/opencs/view/prefs/contextmenuwidget.hpp @@ -0,0 +1,36 @@ +#ifndef CSV_PREFS_CONTEXTMENUWIDGET_H +#define CSV_PREFS_CONTEXTMENUWIDGET_H + +#include + +#include + +class QContextMenuEvent; + +namespace CSVPrefs +{ + class ContextMenuWidget : public QWidget + { + Q_OBJECT + + public: + + ContextMenuWidget(QWidget* parent, const std::string& category); + + protected: + + void contextMenuEvent(QContextMenuEvent* e); + + private slots: + + void resetCategory(); + + void resetAll(); + + private: + + std::string mCategory; + }; +} + +#endif diff --git a/apps/opencs/view/prefs/dialogue.cpp b/apps/opencs/view/prefs/dialogue.cpp index 6848bcaba..7f901c470 100644 --- a/apps/opencs/view/prefs/dialogue.cpp +++ b/apps/opencs/view/prefs/dialogue.cpp @@ -12,16 +12,17 @@ #include "page.hpp" #include "keybindingpage.hpp" +#include "contextmenulist.hpp" void CSVPrefs::Dialogue::buildCategorySelector (QSplitter *main) { - mList = new QListWidget (main); - mList->setMinimumWidth (50); - mList->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); + CSVPrefs::ContextMenuList* list = new CSVPrefs::ContextMenuList (main); + list->setMinimumWidth (50); + list->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding); - mList->setSelectionBehavior (QAbstractItemView::SelectItems); + list->setSelectionBehavior (QAbstractItemView::SelectItems); - main->addWidget (mList); + main->addWidget (list); QFontMetrics metrics (QApplication::font()); @@ -33,12 +34,12 @@ void CSVPrefs::Dialogue::buildCategorySelector (QSplitter *main) QString label = QString::fromUtf8 (iter->second.getKey().c_str()); maxWidth = std::max (maxWidth, metrics.width (label)); - mList->addItem (label); + list->addItem (label); } - mList->setMaximumWidth (maxWidth + 10); + list->setMaximumWidth (maxWidth + 10); - connect (mList, SIGNAL (currentItemChanged (QListWidgetItem *, QListWidgetItem *)), + connect (list, SIGNAL (currentItemChanged (QListWidgetItem *, QListWidgetItem *)), this, SLOT (selectionChanged (QListWidgetItem *, QListWidgetItem *))); } diff --git a/apps/opencs/view/prefs/dialogue.hpp b/apps/opencs/view/prefs/dialogue.hpp index fc66892c8..ce017209a 100644 --- a/apps/opencs/view/prefs/dialogue.hpp +++ b/apps/opencs/view/prefs/dialogue.hpp @@ -16,7 +16,6 @@ namespace CSVPrefs { Q_OBJECT - QListWidget *mList; QStackedWidget *mContent; private: diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index c23e9f64f..c2098af44 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -5,11 +5,12 @@ #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" +#include "../../view/prefs/contextmenuwidget.hpp" CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) : PageBase (category, parent) { - QWidget *widget = new QWidget (parent); + CSVPrefs::ContextMenuWidget *widget = new CSVPrefs::ContextMenuWidget (parent, category.getKey()); mGrid = new QGridLayout (widget); for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) From 487940509734f015065ee044f020bbfb810470a4 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Tue, 9 May 2017 19:58:34 +1200 Subject: [PATCH 087/318] Add reset context menu for key binding pages --- apps/opencs/view/prefs/contextmenuwidget.cpp | 2 +- apps/opencs/view/prefs/contextmenuwidget.hpp | 2 +- apps/opencs/view/prefs/keybindingpage.cpp | 3 ++- apps/opencs/view/prefs/page.cpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/opencs/view/prefs/contextmenuwidget.cpp b/apps/opencs/view/prefs/contextmenuwidget.cpp index abf3d6edc..bb1984e9a 100644 --- a/apps/opencs/view/prefs/contextmenuwidget.cpp +++ b/apps/opencs/view/prefs/contextmenuwidget.cpp @@ -5,7 +5,7 @@ #include "../../model/prefs/state.hpp" -CSVPrefs::ContextMenuWidget::ContextMenuWidget(QWidget* parent, const std::string& category) +CSVPrefs::ContextMenuWidget::ContextMenuWidget(const std::string& category, QWidget* parent) :QWidget(parent) ,mCategory(category) { diff --git a/apps/opencs/view/prefs/contextmenuwidget.hpp b/apps/opencs/view/prefs/contextmenuwidget.hpp index 0d8d5006c..57c231fb6 100644 --- a/apps/opencs/view/prefs/contextmenuwidget.hpp +++ b/apps/opencs/view/prefs/contextmenuwidget.hpp @@ -15,7 +15,7 @@ namespace CSVPrefs public: - ContextMenuWidget(QWidget* parent, const std::string& category); + ContextMenuWidget(const std::string& category, QWidget* parent = 0); protected: diff --git a/apps/opencs/view/prefs/keybindingpage.cpp b/apps/opencs/view/prefs/keybindingpage.cpp index 143665f4a..d7756f7c8 100644 --- a/apps/opencs/view/prefs/keybindingpage.cpp +++ b/apps/opencs/view/prefs/keybindingpage.cpp @@ -9,6 +9,7 @@ #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" +#include "../../view/prefs/contextmenuwidget.hpp" namespace CSVPrefs { @@ -19,7 +20,7 @@ namespace CSVPrefs , mPageSelector(0) { // Need one widget for scroll area - QWidget* topWidget = new QWidget(); + CSVPrefs::ContextMenuWidget* topWidget = new CSVPrefs::ContextMenuWidget(category.getKey()); QVBoxLayout* topLayout = new QVBoxLayout(topWidget); // Allows switching between "pages" diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index c2098af44..cc9b94a04 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -10,7 +10,7 @@ CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) : PageBase (category, parent) { - CSVPrefs::ContextMenuWidget *widget = new CSVPrefs::ContextMenuWidget (parent, category.getKey()); + CSVPrefs::ContextMenuWidget *widget = new CSVPrefs::ContextMenuWidget (category.getKey(), parent); mGrid = new QGridLayout (widget); for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) From 30af92f575486d194bab73b1c5491affb462fe61 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Tue, 9 May 2017 20:58:32 +1200 Subject: [PATCH 088/318] Fix pointer initialisation bug --- apps/opencs/model/prefs/enumsetting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/opencs/model/prefs/enumsetting.cpp b/apps/opencs/model/prefs/enumsetting.cpp index 901bbf8e4..226b17173 100644 --- a/apps/opencs/model/prefs/enumsetting.cpp +++ b/apps/opencs/model/prefs/enumsetting.cpp @@ -42,7 +42,7 @@ CSMPrefs::EnumValues& CSMPrefs::EnumValues::add (const std::string& value, const CSMPrefs::EnumSetting::EnumSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, const EnumValue& default_) -: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget() +: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0) {} CSMPrefs::EnumSetting& CSMPrefs::EnumSetting::setTooltip (const std::string& tooltip) From bd9f657603ea50c565ff250e4fc12ba5f269cce5 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Wed, 10 May 2017 19:51:43 +1200 Subject: [PATCH 089/318] Show context menu when user clicks on empty space --- apps/opencs/view/prefs/page.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index cc9b94a04..418f07ac8 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -16,6 +16,15 @@ CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) addSetting (*iter); + // HACK to get widget to consume all available page space so context menu clicks + // will trigger, but so that setting widgets still only take up the left hand side + QWidget* emptyColumn = new QWidget(); + mGrid->addWidget(emptyColumn, 0, 2, -1, 1); + QWidget* emptyRow = new QWidget(); + emptyRow->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding); + mGrid->addWidget(emptyRow, mGrid->rowCount(), 0, 1, -1); + + setWidgetResizable(true); setWidget (widget); } From 646ff72cdcc3ea5512e22ce979de5e0366e5075e Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Wed, 10 May 2017 20:27:50 +1200 Subject: [PATCH 090/318] Add a more elegant way of showing the context menu --- apps/opencs/view/prefs/page.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index 418f07ac8..09191a436 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -10,22 +10,20 @@ CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) : PageBase (category, parent) { - CSVPrefs::ContextMenuWidget *widget = new CSVPrefs::ContextMenuWidget (category.getKey(), parent); + // topWidget can expand while widget stays the same size + // This is so the context menu triggers over the entire page + // but the user interface looks the same + CSVPrefs::ContextMenuWidget *topWidget = new CSVPrefs::ContextMenuWidget (category.getKey(), parent); + topWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + QWidget* widget = new QWidget(topWidget); mGrid = new QGridLayout (widget); for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) addSetting (*iter); - // HACK to get widget to consume all available page space so context menu clicks - // will trigger, but so that setting widgets still only take up the left hand side - QWidget* emptyColumn = new QWidget(); - mGrid->addWidget(emptyColumn, 0, 2, -1, 1); - QWidget* emptyRow = new QWidget(); - emptyRow->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding); - mGrid->addWidget(emptyRow, mGrid->rowCount(), 0, 1, -1); - setWidgetResizable(true); - setWidget (widget); + setWidget (topWidget); } void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting) From c2f427f48d64721b74a36210d757f9af687fc934 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Wed, 10 May 2017 20:43:52 +1200 Subject: [PATCH 091/318] Prevent context menu appearing when right-clicking shortcut setting --- apps/opencs/model/prefs/shortcutsetting.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index 418559475..4c3931e99 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -40,6 +40,10 @@ namespace CSMPrefs widget->setCheckable(true); widget->installEventFilter(this); + + // right clicking on button sets shortcut to RMB, so context menu should not appear + widget->setContextMenuPolicy(Qt::ContextMenuPolicy::PreventContextMenu); + mButton = widget; connect(widget, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool))); From 16f8341de385521821717857cdcfd03a4276ecd8 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Wed, 10 May 2017 21:24:12 +1200 Subject: [PATCH 092/318] Prevent context menu appearing for modifier settings --- apps/opencs/model/prefs/modifiersetting.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/opencs/model/prefs/modifiersetting.cpp b/apps/opencs/model/prefs/modifiersetting.cpp index b70d39714..6273575e9 100644 --- a/apps/opencs/model/prefs/modifiersetting.cpp +++ b/apps/opencs/model/prefs/modifiersetting.cpp @@ -32,6 +32,10 @@ namespace CSMPrefs widget->setCheckable(true); widget->installEventFilter(this); + + // right clicking on button sets shortcut to RMB, so context menu should not appear + widget->setContextMenuPolicy(Qt::ContextMenuPolicy::PreventContextMenu); + mButton = widget; connect(widget, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool))); From cd75c5618c1158c71cfdadb4d2485550833eb94e Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Thu, 11 May 2017 19:46:51 +1200 Subject: [PATCH 093/318] Move context menu code to PageBase --- apps/opencs/CMakeLists.txt | 2 +- apps/opencs/view/prefs/contextmenuwidget.cpp | 33 ------------------ apps/opencs/view/prefs/contextmenuwidget.hpp | 36 -------------------- apps/opencs/view/prefs/keybindingpage.cpp | 3 +- apps/opencs/view/prefs/page.cpp | 12 ++----- apps/opencs/view/prefs/pagebase.cpp | 25 ++++++++++++++ apps/opencs/view/prefs/pagebase.hpp | 12 +++++++ 7 files changed, 41 insertions(+), 82 deletions(-) delete mode 100644 apps/opencs/view/prefs/contextmenuwidget.cpp delete mode 100644 apps/opencs/view/prefs/contextmenuwidget.hpp diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index d04259b38..0a146dc06 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -110,7 +110,7 @@ opencs_units_noqt (view/tools ) opencs_units (view/prefs - dialogue pagebase page keybindingpage contextmenulist contextmenuwidget + dialogue pagebase page keybindingpage contextmenulist ) opencs_units (model/prefs diff --git a/apps/opencs/view/prefs/contextmenuwidget.cpp b/apps/opencs/view/prefs/contextmenuwidget.cpp deleted file mode 100644 index bb1984e9a..000000000 --- a/apps/opencs/view/prefs/contextmenuwidget.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "contextmenuwidget.hpp" - -#include -#include - -#include "../../model/prefs/state.hpp" - -CSVPrefs::ContextMenuWidget::ContextMenuWidget(const std::string& category, QWidget* parent) - :QWidget(parent) - ,mCategory(category) -{ -} - -void CSVPrefs::ContextMenuWidget::contextMenuEvent(QContextMenuEvent* e) -{ - QMenu* menu = new QMenu(); - - menu->addAction("Reset category to default", this, SLOT(resetCategory())); - menu->addAction("Reset all to default", this, SLOT(resetAll())); - - menu->exec(e->globalPos()); - delete menu; -} - -void CSVPrefs::ContextMenuWidget::resetCategory() -{ - CSMPrefs::State::get().resetCategory(mCategory); -} - -void CSVPrefs::ContextMenuWidget::resetAll() -{ - CSMPrefs::State::get().resetAll(); -} diff --git a/apps/opencs/view/prefs/contextmenuwidget.hpp b/apps/opencs/view/prefs/contextmenuwidget.hpp deleted file mode 100644 index 57c231fb6..000000000 --- a/apps/opencs/view/prefs/contextmenuwidget.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef CSV_PREFS_CONTEXTMENUWIDGET_H -#define CSV_PREFS_CONTEXTMENUWIDGET_H - -#include - -#include - -class QContextMenuEvent; - -namespace CSVPrefs -{ - class ContextMenuWidget : public QWidget - { - Q_OBJECT - - public: - - ContextMenuWidget(const std::string& category, QWidget* parent = 0); - - protected: - - void contextMenuEvent(QContextMenuEvent* e); - - private slots: - - void resetCategory(); - - void resetAll(); - - private: - - std::string mCategory; - }; -} - -#endif diff --git a/apps/opencs/view/prefs/keybindingpage.cpp b/apps/opencs/view/prefs/keybindingpage.cpp index d7756f7c8..143665f4a 100644 --- a/apps/opencs/view/prefs/keybindingpage.cpp +++ b/apps/opencs/view/prefs/keybindingpage.cpp @@ -9,7 +9,6 @@ #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" -#include "../../view/prefs/contextmenuwidget.hpp" namespace CSVPrefs { @@ -20,7 +19,7 @@ namespace CSVPrefs , mPageSelector(0) { // Need one widget for scroll area - CSVPrefs::ContextMenuWidget* topWidget = new CSVPrefs::ContextMenuWidget(category.getKey()); + QWidget* topWidget = new QWidget(); QVBoxLayout* topLayout = new QVBoxLayout(topWidget); // Allows switching between "pages" diff --git a/apps/opencs/view/prefs/page.cpp b/apps/opencs/view/prefs/page.cpp index 09191a436..c23e9f64f 100644 --- a/apps/opencs/view/prefs/page.cpp +++ b/apps/opencs/view/prefs/page.cpp @@ -5,25 +5,17 @@ #include "../../model/prefs/setting.hpp" #include "../../model/prefs/category.hpp" -#include "../../view/prefs/contextmenuwidget.hpp" CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent) : PageBase (category, parent) { - // topWidget can expand while widget stays the same size - // This is so the context menu triggers over the entire page - // but the user interface looks the same - CSVPrefs::ContextMenuWidget *topWidget = new CSVPrefs::ContextMenuWidget (category.getKey(), parent); - topWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - - QWidget* widget = new QWidget(topWidget); + QWidget *widget = new QWidget (parent); mGrid = new QGridLayout (widget); for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter) addSetting (*iter); - setWidgetResizable(true); - setWidget (topWidget); + setWidget (widget); } void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting) diff --git a/apps/opencs/view/prefs/pagebase.cpp b/apps/opencs/view/prefs/pagebase.cpp index 16684a69d..15535b785 100644 --- a/apps/opencs/view/prefs/pagebase.cpp +++ b/apps/opencs/view/prefs/pagebase.cpp @@ -1,7 +1,11 @@ #include "pagebase.hpp" +#include +#include + #include "../../model/prefs/category.hpp" +#include "../../model/prefs/state.hpp" CSVPrefs::PageBase::PageBase (CSMPrefs::Category& category, QWidget *parent) : QScrollArea (parent), mCategory (category) @@ -11,3 +15,24 @@ CSMPrefs::Category& CSVPrefs::PageBase::getCategory() { return mCategory; } + +void CSVPrefs::PageBase::contextMenuEvent(QContextMenuEvent* e) +{ + QMenu* menu = new QMenu(); + + menu->addAction("Reset category to default", this, SLOT(resetCategory())); + menu->addAction("Reset all to default", this, SLOT(resetAll())); + + menu->exec(e->globalPos()); + delete menu; +} + +void CSVPrefs::PageBase::resetCategory() +{ + CSMPrefs::State::get().resetCategory(getCategory().getKey()); +} + +void CSVPrefs::PageBase::resetAll() +{ + CSMPrefs::State::get().resetAll(); +} diff --git a/apps/opencs/view/prefs/pagebase.hpp b/apps/opencs/view/prefs/pagebase.hpp index affe49f4a..91a4dee5b 100644 --- a/apps/opencs/view/prefs/pagebase.hpp +++ b/apps/opencs/view/prefs/pagebase.hpp @@ -3,6 +3,8 @@ #include +class QContextMenuEvent; + namespace CSMPrefs { class Category; @@ -21,6 +23,16 @@ namespace CSVPrefs PageBase (CSMPrefs::Category& category, QWidget *parent); CSMPrefs::Category& getCategory(); + + protected: + + void contextMenuEvent(QContextMenuEvent*); + + private slots: + + void resetCategory(); + + void resetAll(); }; } From 7281e8b888848432f279c88499ce9fc25e0cac57 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Fri, 12 May 2017 12:48:25 +1200 Subject: [PATCH 094/318] Remove C++11 features --- apps/opencs/model/prefs/modifiersetting.cpp | 2 +- apps/opencs/model/prefs/shortcutsetting.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/opencs/model/prefs/modifiersetting.cpp b/apps/opencs/model/prefs/modifiersetting.cpp index 6273575e9..da6b2ccdd 100644 --- a/apps/opencs/model/prefs/modifiersetting.cpp +++ b/apps/opencs/model/prefs/modifiersetting.cpp @@ -34,7 +34,7 @@ namespace CSMPrefs widget->installEventFilter(this); // right clicking on button sets shortcut to RMB, so context menu should not appear - widget->setContextMenuPolicy(Qt::ContextMenuPolicy::PreventContextMenu); + widget->setContextMenuPolicy(Qt::PreventContextMenu); mButton = widget; diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index 4c3931e99..de495b9fc 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -42,7 +42,7 @@ namespace CSMPrefs widget->installEventFilter(this); // right clicking on button sets shortcut to RMB, so context menu should not appear - widget->setContextMenuPolicy(Qt::ContextMenuPolicy::PreventContextMenu); + widget->setContextMenuPolicy(Qt::PreventContextMenu); mButton = widget; From 5ec97811d88f21a191ff09a57e029aeee3991b7f Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Fri, 12 May 2017 20:22:18 +1200 Subject: [PATCH 095/318] Don't switch pages when right-clicking on list --- apps/opencs/view/prefs/contextmenulist.cpp | 12 ++++++++++++ apps/opencs/view/prefs/contextmenulist.hpp | 3 +++ 2 files changed, 15 insertions(+) diff --git a/apps/opencs/view/prefs/contextmenulist.cpp b/apps/opencs/view/prefs/contextmenulist.cpp index 71527d8c6..8115c3ecc 100644 --- a/apps/opencs/view/prefs/contextmenulist.cpp +++ b/apps/opencs/view/prefs/contextmenulist.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "../../model/prefs/state.hpp" @@ -21,6 +22,17 @@ void CSVPrefs::ContextMenuList::contextMenuEvent(QContextMenuEvent* e) delete menu; } +void CSVPrefs::ContextMenuList::mousePressEvent(QMouseEvent* e) +{ + // enable all buttons except right click + // This means that when right-clicking to enable the + // context menu, the page doesn't switch at the same time. + if (!(e->buttons() & Qt::RightButton)) + { + QListWidget::mousePressEvent(e); + } +} + void CSVPrefs::ContextMenuList::resetCategory() { CSMPrefs::State::get().resetCategory(currentItem()->text().toStdString()); diff --git a/apps/opencs/view/prefs/contextmenulist.hpp b/apps/opencs/view/prefs/contextmenulist.hpp index 222cfea6b..6aa187ca4 100644 --- a/apps/opencs/view/prefs/contextmenulist.hpp +++ b/apps/opencs/view/prefs/contextmenulist.hpp @@ -4,6 +4,7 @@ #include class QContextMenuEvent; +class QMouseEvent; namespace CSVPrefs { @@ -18,6 +19,8 @@ namespace CSVPrefs protected: void contextMenuEvent(QContextMenuEvent* e); + + void mousePressEvent(QMouseEvent* e); private slots: From d555c21c28f376997dddf0f1473a6941b71956ab Mon Sep 17 00:00:00 2001 From: Ryan Tucker Date: Sun, 14 May 2017 22:04:20 -0700 Subject: [PATCH 096/318] Converted all settings files to semantic linefeeds. Corrected default segments in Windows settings. Removed all default declarations in the prose of the setting descriptions except where clarification or additional information was also provided. Some minor, but not thorough grammar corrections. --- .../source/reference/modding/settings/GUI.rst | 55 +++-- .../source/reference/modding/settings/HUD.rst | 7 +- .../reference/modding/settings/camera.rst | 61 ++++- .../reference/modding/settings/cells.rst | 70 ++++-- .../reference/modding/settings/game.rst | 30 ++- .../reference/modding/settings/general.rst | 20 +- .../reference/modding/settings/index.rst | 16 +- .../reference/modding/settings/input.rst | 55 +++-- .../source/reference/modding/settings/map.rst | 61 +++-- .../reference/modding/settings/saves.rst | 10 +- .../reference/modding/settings/shaders.rst | 37 ++- .../reference/modding/settings/sound.rst | 50 ++-- .../reference/modding/settings/terrain.rst | 13 +- .../reference/modding/settings/video.rst | 98 ++++++-- .../reference/modding/settings/water.rst | 43 +++- .../reference/modding/settings/windows.rst | 229 ++++++++++++------ docs/source/tutorial-style-guide.txt | 29 ++- 17 files changed, 651 insertions(+), 233 deletions(-) diff --git a/docs/source/reference/modding/settings/GUI.rst b/docs/source/reference/modding/settings/GUI.rst index 0c39cf172..ad3514ffa 100644 --- a/docs/source/reference/modding/settings/GUI.rst +++ b/docs/source/reference/modding/settings/GUI.rst @@ -8,9 +8,13 @@ scaling factor :Range: > 0.0 :Default: 1.0 -This setting scales the GUI interface windows. The value must be greater than 0.0. A value of 1.0 results in the normal scale. Values much larger than 2.0 may result in user interface components being inaccessible. Until a gamepad interface is created, increasing this setting is helpful for simulating the larger interface used in console games. +This setting scales the GUI interface windows. +The value must be greater than 0.0. A value of 1.0 results in the normal scale. +Values much larger than 2.0 may result in user interface components being inaccessible. +Until a gamepad interface is created, +increasing this setting is helpful for simulating the larger interface used in console games. -The default value is 1.0. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. menu transparency ----------------- @@ -19,8 +23,9 @@ menu transparency :Range: 0.0 (transparent) to 1.0 (opaque) :Default: 0.84 -This setting controls the transparency of the GUI windows. The value should be between 0.0 (transparent) and 1.0 (opaque). -The default value is 0.84. This setting can be adjusted in game with the Menu Transparency slider in the Prefs panel of the Options menu. +This setting controls the transparency of the GUI windows. +The value should be between 0.0 (transparent) and 1.0 (opaque). +This setting can be adjusted in game with the Menu Transparency slider in the Prefs panel of the Options menu. tooltip delay ------------- @@ -29,11 +34,15 @@ tooltip delay :Range: > 0.0 :Default: 0.0 -This value determines the number of seconds between when you begin hovering over an item and when its tooltip appears. This setting only affects the tooltip delay for objects under the crosshair in GUI mode windows. There does not appear to be a setting to control the tool tip delay in outside of GUI mode. +This value determines the number of seconds between when you begin hovering over an item and when its tooltip appears. +This setting only affects the tooltip delay for objects under the crosshair in GUI mode windows. +There does not appear to be a setting to control the tool tip delay in outside of GUI mode. -The tooltip displays context sensitive information on the selected GUI element, such as weight, value, damage, armor rating, magical effects, and detailed description. +The tooltip displays context sensitive information on the selected GUI element, +such as weight, value, damage, armor rating, magical effects, and detailed description. -The default value is 0.0. This setting can be adjusted between 0.0 and 1.0 in game with the Menu Help Delay slider in the Prefs panel of the Options menu. +This setting can be adjusted between 0.0 and 1.0 in game +with the Menu Help Delay slider in the Prefs panel of the Options menu. stretch menu background ----------------------- @@ -42,9 +51,13 @@ stretch menu background :Range: True/False :Default: False -Stretch or shrink the main menu screen, loading splash screens, introductory movie, and cut scenes to fill the specified video resolution, distorting their aspect ratio. The Bethesda provided assets have a 4:3 aspect ratio, but other assets are permitted to have other aspect ratios. If this setting is false, the assets will be centered in their correct aspect ratio, with black bars filling the remainder of the screen. +Stretch or shrink the main menu screen, loading splash screens, introductory movie, +and cut scenes to fill the specified video resolution, distorting their aspect ratio. +The Bethesda provided assets have a 4:3 aspect ratio, but other assets are permitted to have other aspect ratios. +If this setting is false, the assets will be centered in their correct aspect ratio, +with black bars filling the remainder of the screen. -The default value is false. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. subtitles --------- @@ -53,9 +66,10 @@ subtitles :Range: True/False :Default: False -Enable or disable subtitles for NPC spoken dialog (and some sound effects). Subtitles will appear in a tool tip box in the lower center of the screen. +Enable or disable subtitles for NPC spoken dialog (and some sound effects). +Subtitles will appear in a tool tip box in the lower center of the screen. -The default value is false. This setting can be toggled in game with the Subtitles button in the Prefs panel of Options menu. +This setting can be toggled in game with the Subtitles button in the Prefs panel of Options menu. hit fader --------- @@ -88,9 +102,15 @@ color background owned :Range: 0.0 to 1.0 :Default: 0.15 0.0 0.0 1.0 -The following two settings determine the background color of the tool tip and the crosshair when hovering over an item owned by an NPC. The color definitions are composed of four floating point values between 0.0 and 1.0 inclusive, representing the red, green, blue and alpha channels. The alpha value is currently ignored. The crosshair color will have no effect if the crosshair setting in the HUD section is disabled. +The following two settings determine the background color of the tool tip and the crosshair +when hovering over an item owned by an NPC. +The color definitions are composed of four floating point values between 0.0 and 1.0 inclusive, +representing the red, green, blue and alpha channels. The alpha value is currently ignored. +The crosshair color will have no effect if the crosshair setting in the HUD section is disabled. -The default value is "0.15 0.0 0.0 1.0", which is a dark red color. This setting can only be configured by editing the settings configuration file. This setting has no effect if the show owned setting in the Game Settings Section is false. +The default value is "0.15 0.0 0.0 1.0", which is a dark red color. +This setting can only be configured by editing the settings configuration file. +This setting has no effect if the show owned setting in the Game Settings Section is false. color crosshair owned --------------------- @@ -99,6 +119,11 @@ color crosshair owned :Range: 0.0 to 1.0 :Default: 1.0 0.15 0.15 1.0 -This setting sets the color of the crosshair when hovering over an item owned by an NPC. The value is composed of four floating point values representing the red, green, blue and alpha channels. The alpha value is currently ignored. +This setting sets the color of the crosshair when hovering over an item owned by an NPC. +The value is composed of four floating point values representing the red, green, blue and alpha channels. +The alpha value is currently ignored. -The default value is "1.0 0.15 0.15 1.0" which is a bright red color. This setting can only be configured by editing the settings configuration file. This setting has no effect if the crosshair setting in the HUD Settings Section is false. This setting has no effect if the show owned setting in the Game Settings Section is false. +The default value is "1.0 0.15 0.15 1.0" which is a bright red color. +This setting can only be configured by editing the settings configuration file. +This setting has no effect if the crosshair setting in the HUD Settings Section is false. +This setting has no effect if the show owned setting in the Game Settings Section is false. diff --git a/docs/source/reference/modding/settings/HUD.rst b/docs/source/reference/modding/settings/HUD.rst index 8ee5267dd..920c4460e 100644 --- a/docs/source/reference/modding/settings/HUD.rst +++ b/docs/source/reference/modding/settings/HUD.rst @@ -8,6 +8,9 @@ crosshair :Range: True/False :Default: True -This setting determines whether the crosshair or reticle is displayed. Some players perceive that disabling the crosshair provides a more immersive experience. Another common use is to disable the crosshair for screen shots. Enabling the crosshair provides more immediate feedback about which object is currently the focus of actions. +This setting determines whether the crosshair or reticle is displayed. +Some players perceive that disabling the crosshair provides a more immersive experience. +Another common use is to disable the crosshair for screen shots. +Enabling the crosshair provides more immediate feedback about which object is currently the focus of actions. -The default value is true. This setting can be toggled with the Crosshair button in the Prefs panel of the Options menu. +This setting can be toggled with the Crosshair button in the Prefs panel of the Options menu. diff --git a/docs/source/reference/modding/settings/camera.rst b/docs/source/reference/modding/settings/camera.rst index 3480c2e9d..222391fa8 100644 --- a/docs/source/reference/modding/settings/camera.rst +++ b/docs/source/reference/modding/settings/camera.rst @@ -8,9 +8,13 @@ near clip :Range: > 0 :Default: 1.0 -This setting controls the distance to the near clipping plane. The value must be greater than zero. Values greater than approximately 18.0 will occasionally clip objects in the world in front of the character. Values greater than approximately 8.0 will clip the character's hands in first person view and/or the back of their head in third person view. +This setting controls the distance to the near clipping plane. The value must be greater than zero. +Values greater than approximately 18.0 will occasionally clip objects in the world in front of the character. +Values greater than approximately 8.0 will clip the character's hands in first person view +and/or the back of their head in third person view. -The default value is 1.0. This setting can only be configured by editing the settings configuration file. The value must be greater than 0.0, but it's unclear if the engine enforces this limitation. +The default value is 1.0. This setting can only be configured by editing the settings configuration file. +The value must be greater than 0.0, but it's unclear if the engine enforces this limitation. small feature culling --------------------- @@ -19,7 +23,10 @@ small feature culling :Range: True/False :Default: True -This setting determines whether objects that render to a few pixels or smaller will be culled (not drawn). It generally improves performance to enable this feature, and by definition the culled objects will be very small on screen. The size in pixels for an object to be considered 'small' is controlled by a separate setting. +This setting determines whether objects that render to a few pixels or smaller will be culled (not drawn). +It generally improves performance to enable this feature, +and by definition the culled objects will be very small on screen. +The size in pixels for an object to be considered 'small' is controlled by a separate setting. The default value is true. This setting can only be configured by editing the settings configuration file. @@ -30,7 +37,8 @@ small feature culling pixel size :Range: > 0 :Default: 2.0 -Controls the cutoff in pixels for the 'small feature culling' setting which will have no effect if 'small feature culling' is disabled. +Controls the cutoff in pixels for the 'small feature culling' setting, +which will have no effect if 'small feature culling' is disabled. This setting can only be configured by editing the settings configuration file. @@ -41,11 +49,24 @@ viewing distance :Range: > 0 :Default: 6666.0 -This value controls the maximum visible distance (also called the far clipping plane). Larger values significantly improve rendering in exterior spaces, but also increase the amount of rendered geometry and significantly reduce the frame rate. This value interacts with the exterior cell load distance setting in that it's probably undesired for this value to provide visibility into cells that have not yet been loaded. When cells are visible before loading, the geometry will "pop-in" suddenly, creating a jarring visual effect. To prevent this effect, this value must be less than:: +This value controls the maximum visible distance (also called the far clipping plane). +Larger values significantly improve rendering in exterior spaces, +but also increase the amount of rendered geometry and significantly reduce the frame rate. +This value interacts with the exterior cell load distance setting +in that it's probably undesired for this value to provide visibility into cells that have not yet been loaded. +When cells are visible before loading, the geometry will "pop-in" suddenly, creating a jarring visual effect. +To prevent this effect, this value must be less than:: (8192 * exterior cell load distance - 1024) * 0.93 -The constant 8192 is the size of a cell, and 1024 is the threshold distance for loading a new cell. Additionally, the field of view setting also interacts with this setting because the view frustrum end is a plane, so you can see further at the edges of the screen than you should be able to. This can be observed in game by looking at distant objects and rotating the camera so the objects are near the edge of the screen. As a result, this setting should further be reduced by a factor that depends on the field of view setting. In the default configuration this reduction is 7%, hence the factor of 0.93 above. Using this factor, approximate values recommended for other exterior cell load distance settings are: +The constant 8192 is the size of a cell, and 1024 is the threshold distance for loading a new cell. +Additionally, the field of view setting also interacts with this setting because the view frustum end is a plane, +so you can see further at the edges of the screen than you should be able to. +This can be observed in game by looking at distant objects +and rotating the camera so the objects are near the edge of the screen. +As a result, this setting should further be reduced by a factor that depends on the field of view setting. +In the default configuration this reduction is 7%, hence the factor of 0.93 above. +Using this factor, approximate values recommended for other exterior cell load distance settings are: ======= ======== Cells Viewing @@ -57,11 +78,19 @@ Cells Viewing 5 35924 ======= ======== -Reductions of up to 25% or more can be required to completely eliminate pop-in for wide fields of view and long viewing distances near the edges of the screen, but such situations are unusual and probably not worth the performance penalty introduced by loading geometry obscured by fog in the center of the screen. See RenderingManager::configureFog for the relevant source code. +Reductions of up to 25% or more can be required to completely eliminate pop-in for wide fields of view +and long viewing distances near the edges of the screen. +Such situations are unusual and probably not worth the performance penalty introduced +by loading geometry obscured by fog in the center of the screen. +See RenderingManager::configureFog for the relevant source code. -Enabling the distant terrain setting is an alternative to increasing exterior cell load distance. Note that the distant land setting does not include rendering of distant static objects, so the resulting visual effect is not the same. +Enabling the distant terrain setting is an alternative to increasing exterior cell load distance. +Note that the distant land setting does not include rendering of distant static objects, +so the resulting visual effect is not the same. -The default value is 6666.0. This setting can be adjusted in game from the ridiculously low value of 2000.0 to a maximum of 6666.0, using the View Distance slider in the Detail tab of the Video panel of the Options menu. +The default value is 6666.0. +This setting can be adjusted in game from the ridiculously low value of 2000.0 to a maximum of 6666.0 +using the View Distance slider in the Detail tab of the Video panel of the Options menu. field of view ------------- @@ -70,9 +99,14 @@ field of view :Range: 0-360 :Default: 55.0 -Sets the camera field of view in degrees. Recommended values range from 30 degrees to 110 degrees. Small values provide a very narrow field of view that creates a "zoomed in" effect, while large values cause distortion at the edges of the screen. The "field of view" setting interacts with aspect ratio of your video resolution in that more square aspect ratios (e.g. 4:3) need a wider field of view to more resemble the same field of view on a widescreen (e.g. 16:9) monitor. +Sets the camera field of view in degrees. Recommended values range from 30 degrees to 110 degrees. +Small values provide a very narrow field of view that creates a "zoomed in" effect, +while large values cause distortion at the edges of the screen. +The "field of view" setting interacts with aspect ratio of your video resolution in that more square aspect ratios +(e.g. 4:3) need a wider field of view to more resemble the same field of view on a widescreen (e.g. 16:9) monitor. -The default value is 55.0. This setting can be changed in game using the Field of View slider from the Video tab of the Video panel of the Options menu. +The default value is 55.0. This setting can be changed in game using the Field of View slider +from the Video tab of the Video panel of the Options menu. first person field of view -------------------------- @@ -81,6 +115,9 @@ first person field of view :Range: 0-360 :Default: 55.0 -This setting controls the field of view for first person meshes such as the player's hands and held objects. It is not recommended to change this value from its default value because the Bethesda provided Morrowind assets do not adapt well to large values, while small values can result in the hands not being visible. +This setting controls the field of view for first person meshes such as the player's hands and held objects. +It is not recommended to change this value from its default value +because the Bethesda provided Morrowind assets do not adapt well to large values, +while small values can result in the hands not being visible. The default value is 55.0. This setting can only be configured by editing the settings configuration file. diff --git a/docs/source/reference/modding/settings/cells.rst b/docs/source/reference/modding/settings/cells.rst index 66baedbee..6cda93194 100644 --- a/docs/source/reference/modding/settings/cells.rst +++ b/docs/source/reference/modding/settings/cells.rst @@ -8,13 +8,17 @@ exterior cell load distance :Range: >= 1 :Default: 1 -This setting determines the number of exterior cells adjacent to the character that will be loaded for rendering. Values greater than one may significantly affect loading times when exiting interior spaces or loading additional exterior cells. Caution is advised when increasing this setting. +This setting determines the number of exterior cells adjacent to the character that will be loaded for rendering. +Values greater than 1 may significantly affect loading times when exiting interior spaces +or loading additional exterior cells. Caution is advised when increasing this setting. This setting interacts with viewing distance and field of view settings. -It is generally very wasteful for this value to load geometry than will almost never be visible due to viewing distance and fog. For low frame rate screen shots of scenic vistas, this setting should be set high, and viewing distances adjusted accordingly. +It is generally very wasteful for this value to load geometry than will almost never be visible +due to viewing distance and fog. For low frame rate screen shots of scenic vistas, +this setting should be set high, and viewing distances adjusted accordingly. -The default value is 1. This value must be greater than or equal to 1. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. preload enabled @@ -24,11 +28,17 @@ preload enabled :Range: True/False :Default: True -Controls whether textures and objects will be pre-loaded in background threads. This setting being enabled should result in a reduced amount of loading screens, no impact on frame rate and a varying amount of additional RAM usage, depending on how the preloader was configured (see the below settings). The default preloading settings with vanilla game files should only use negligible amounts of RAM, however, when using high-res texture and model replacers it may be necessary to tweak these settings to prevent the game from running out of memory. +Controls whether textures and objects will be pre-loaded in background threads. +This setting being enabled should result in a reduced amount of loading screens, no impact on frame rate, +and a varying amount of additional RAM usage, depending on how the preloader was configured (see the below settings). +The default preloading settings with vanilla game files should only use negligible amounts of RAM, however, +when using high-res texture and model replacers +it may be necessary to tweak these settings to prevent the game from running out of memory. The effects of (pre-)loading can be observed on the in-game statistics panel brought up with the 'F4' key. -All settings starting with 'preload' in this section will have no effect if preloading is disabled, and can only be configured by editing the settings configuration file. +All settings starting with 'preload' in this section will have no effect if preloading is disabled, +and can only be configured by editing the settings configuration file. preload num threads @@ -38,9 +48,18 @@ preload num threads :Range: >=1 :Default: 1 -Controls the number of worker threads used for preloading operations. In addition to the preloading threads, OpenMW uses a main thread, a sound streaming thread, and a graphics thread. Therefore, the default setting of one preloading thread will result in a total of 4 threads used which should work well with quad-core CPUs. If you have additional cores to spare, consider increasing the number of preloading threads to 2 or 3 for a boost in preloading performance. Faster preloading will reduce the chance that a cell could not be completely loaded before the player moves into it, and hence reduce the chance of seeing loading screens or frame drops. This may be especially relevant when the player moves at high speed and/or a large number of cells are loaded in via 'exterior cell load distance'. +Controls the number of worker threads used for preloading operations. +In addition to the preloading threads, OpenMW uses a main thread, a sound streaming thread, and a graphics thread. +Therefore, the default setting of one preloading thread will result in a total of 4 threads used, +which should work well with quad-core CPUs. If you have additional cores to spare, +consider increasing the number of preloading threads to 2 or 3 for a boost in preloading performance. +Faster preloading will reduce the chance that a cell could not be completely loaded before the player moves into it, +and hence reduce the chance of seeing loading screens or frame drops. +This may be especially relevant when the player moves at high speed +and/or a large number of cells are loaded in via 'exterior cell load distance'. -A value of 4 or higher is not recommended. With 4 or more threads, improvements will start to diminish due to file reading and synchronization bottlenecks. +A value of 4 or higher is not recommended. +With 4 or more threads, improvements will start to diminish due to file reading and synchronization bottlenecks. preload exterior grid --------------------- @@ -58,7 +77,10 @@ preload fast travel :Range: True/False :Default: False -Controls whether fast travel destinations are preloaded when the player moves close to a travel service. Because the game can not predict the destination that the player will choose, all possible destinations will be preloaded. This setting is disabled by default due to the adverse effect on memory usage caused by the preloading of all possible destinations. +Controls whether fast travel destinations are preloaded when the player moves close to a travel service. +Because the game can not predict the destination that the player will choose, +all possible destinations will be preloaded. This setting is disabled by default +due to the adverse effect on memory usage caused by the preloading of all possible destinations. preload doors ------------- @@ -76,9 +98,11 @@ preload distance :Range: >0 :Default: 1000 -Controls the distance in in-game units that is considered the player being 'close' to a preloading trigger. Used by all the preloading mechanisms i.e. 'preload exterior grid', 'preload fast travel' and 'preload doors'. +Controls the distance in in-game units that is considered the player being 'close' to a preloading trigger. +Used by all the preloading mechanisms i.e. 'preload exterior grid', 'preload fast travel' and 'preload doors'. -For measurement purposes, the distance to an object in-game can be observed by opening the console, clicking on the object and typing 'getdistance player'. +For measurement purposes, the distance to an object in-game can be observed by opening the console, +clicking on the object and typing 'getdistance player'. preload instances ----------------- @@ -87,9 +111,15 @@ preload instances :Range: True/False :Default: True -Controls whether or not objects are also pre-instanced on top of being pre-loaded. Instancing happens when the same object is placed more than once in the cell, and to be sure that any modifications to one instance do not affect the other, the game will create independent copies (instances) of the object. If this setting is enabled, the creation of instances will be done in the preloading thread; otherwise, instancing will only happen in the main thread once the cell is actually loaded. +Controls whether or not objects are also pre-instanced on top of being pre-loaded. +Instancing happens when the same object is placed more than once in the cell, +and to be sure that any modifications to one instance do not affect the other, +the game will create independent copies (instances) of the object. +If this setting is enabled, the creation of instances will be done in the preloading thread; +otherwise, instancing will only happen in the main thread once the cell is actually loaded. -Enabling this setting should reduce the chance of frame drops when transitioning into a preloaded cell, but will also result in some additional memory usage. +Enabling this setting should reduce the chance of frame drops when transitioning into a preloaded cell, +but will also result in some additional memory usage. preload cell cache min ---------------------- @@ -98,7 +128,12 @@ preload cell cache min :Range: >0 :Default: 12 -The minimum number of preloaded cells that will be kept in the cache. Once the number of preloaded cells in the cache exceeds this setting, the game may start to expire preloaded cells, based on the 'preload cell expiry delay' setting, starting with the oldest cell. When a preloaded cell expires, all the assets that were loaded for it will also expire and will have to be loaded again the next time the cell is requested for preloading. +The minimum number of preloaded cells that will be kept in the cache. +Once the number of preloaded cells in the cache exceeds this setting, +the game may start to expire preloaded cells based on the 'preload cell expiry delay' setting, +starting with the oldest cell. +When a preloaded cell expires, all the assets that were loaded for it will also expire +and will have to be loaded again the next time the cell is requested for preloading. preload cell cache max ---------------------- @@ -107,7 +142,8 @@ preload cell cache max :Range: >0 :Default: 20 -The maximum number of cells that will ever be in pre-loaded state simultaneously. This setting is intended to put a cap on the amount of memory that could potentially be used by preload state. +The maximum number of cells that will ever be in pre-loaded state simultaneously. +This setting is intended to put a cap on the amount of memory that could potentially be used by preload state. preload cell expiry delay ------------------------- @@ -116,7 +152,8 @@ preload cell expiry delay :Range: >=0 :Default: 5 -The amount of time (in seconds) that a preloaded cell will stay in cache after it is no longer referenced or required, for example, after the player has moved away from a door without entering it. +The amount of time (in seconds) that a preloaded cell will stay in cache after it is no longer referenced or required, +for example, after the player has moved away from a door without entering it. cache expiry delay ------------------ @@ -125,4 +162,5 @@ cache expiry delay :Range: >=0 :Default: 5 -The amount of time (in seconds) that a preloaded texture or object will stay in cache after it is no longer referenced or required, for example, when all cells containing this texture have been unloaded. +The amount of time (in seconds) that a preloaded texture or object will stay in cache +after it is no longer referenced or required, for example, when all cells containing this texture have been unloaded. diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index edaefae8e..d5828ee12 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -8,7 +8,13 @@ show owned :Range: 0, 1, 2, 3 :Default: 0 -Enable visual clues for items owned by NPCs when the crosshair is on the object. If the setting is 0, no clues are provided which is the default Morrowind behavior. If the setting is 1, the background of the tool tip for the object is highlight in the color specified by the color background owned setting in the GUI Settings Section. If the setting is 2, the crosshair is the color of the color crosshair owned setting in the GUI Settings section. If the setting is 3, both the tool tip background and the crosshair are colored. The crosshair is not visible if crosshair is false. +Enable visual clues for items owned by NPCs when the crosshair is on the object. +If the setting is 0, no clues are provided which is the default Morrowind behavior. +If the setting is 1, the background of the tool tip for the object is highlighted +in the color specified by the color background owned setting in the GUI Settings Section. +If the setting is 2, the crosshair is the color of the color crosshair owned setting in the GUI Settings section. +If the setting is 3, both the tool tip background and the crosshair are colored. +The crosshair is not visible if crosshair is false. The default value is 0 (no clues). This setting can only be configured by editing the settings configuration file. @@ -41,9 +47,12 @@ best attack :Range: True/False :Default: False -If this setting is true, the player character will always use the most powerful attack when striking with a weapon (chop, slash or thrust). If this setting is false, the type of attack is determined by the direction that the character is moving at the time the attack begins. +If this setting is true, the player character will always use the most powerful attack when striking with a weapon +(chop, slash or thrust). If this setting is false, +the type of attack is determined by the direction that the character is moving at the time the attack begins. -The default value is false. This setting can be toggled with the Always Use Best Attack button in the Prefs panel of the Options menu. +The default value is false. +This setting can be toggled with the Always Use Best Attack button in the Prefs panel of the Options menu. difficulty ---------- @@ -52,9 +61,14 @@ difficulty :Range: -500 to 500 :Default: 0 -This setting adjusts the difficulty of the game and is intended to be in the range -100 to 100 inclusive. Given the default game setting for fDifficultyMult of 5.0, a value of -100 results in the player taking 80% of the usual damage, doing 6 times the normal damage. A value of 100 results in the player taking 6 times as much damage, but inflicting only 80% of the usual damage. Values less than -500 will result in the player receiving no damage, and values greater than 500 will result in the player inflicting no damage. +This setting adjusts the difficulty of the game and is intended to be in the range -100 to 100 inclusive. +Given the default game setting for fDifficultyMult of 5.0, +a value of -100 results in the player taking 80% of the usual damage, doing 6 times the normal damage. +A value of 100 results in the player taking 6 times as much damage, but inflicting only 80% of the usual damage. +Values less than -500 will result in the player receiving no damage, +and values greater than 500 will result in the player inflicting no damage. -The default value is 0. This setting can be controlled in game with the Difficulty slider in the Prefs panel of the Options menu. +This setting can be controlled in game with the Difficulty slider in the Prefs panel of the Options menu. show effect duration -------------------- @@ -63,7 +77,8 @@ show effect duration :Range: True/False :Default: False -Show the remaining duration of magic effects and lights if this setting is true. The remaining duration is displayed in the tooltip by hovering over the magical effect. +Show the remaining duration of magic effects and lights if this setting is true. +The remaining duration is displayed in the tooltip by hovering over the magical effect. The default value is false. This setting can only be configured by editing the settings configuration file. @@ -83,4 +98,5 @@ followers attack on sight :Range: True/False :Default: False -Makes player followers and escorters start combat with enemies who have started combat with them or the player. Otherwise they wait for the enemies or the player to do an attack first. \ No newline at end of file +Makes player followers and escorters start combat with enemies who have started combat with them or the player. +Otherwise they wait for the enemies or the player to do an attack first. \ No newline at end of file diff --git a/docs/source/reference/modding/settings/general.rst b/docs/source/reference/modding/settings/general.rst index 7d241090a..be253d613 100644 --- a/docs/source/reference/modding/settings/general.rst +++ b/docs/source/reference/modding/settings/general.rst @@ -8,9 +8,15 @@ anisotropy :Range: 0 to 16 :Default: 4 -Set the maximum anisotropic filtering on textures. Anisotropic filtering is a method of enhancing the image quality of textures on surfaces that are at oblique viewing angles with respect to the camera. Valid values range from 0 to 16. Modern video cards can often perform 8 or 16 anisotropic filtering with a minimal performance impact. This effect of this setting can be seen in the Video panel of the Options menu by finding a location with straight lines (striped rugs and Balmora cobblestones work well) radiating into the distance, and adjusting the anisotropy slider. +Set the maximum anisotropic filtering on textures. +Anisotropic filtering is a method of enhancing the image quality of textures +on surfaces that are at oblique viewing angles with respect to the camera. Valid values range from 0 to 16. +Modern video cards can often perform 8 or 16 anisotropic filtering with a minimal performance impact. +This effect of this setting can be seen in the Video panel of the Options menu by finding a location with straight lines +(striped rugs and Balmora cobblestones work well) radiating into the distance, and adjusting the anisotropy slider. -The default value is 4. This setting can be changed in game using the Anisotropy slider in the Detail tab of the Video panel of the Options menu. +This setting can be changed in game +using the Anisotropy slider in the Detail tab of the Video panel of the Options menu. screenshot format ----------------- @@ -19,9 +25,11 @@ screenshot format :Range: jpg, png, tga :Default: png -Specify the format for screen shots taken by pressing the screen shot key (bound to F12 by default). This setting should be the file extension commonly associated with the desired format. The formats supported will be determined at compilation, but "jpg", "png", and "tga" should be allowed. +Specify the format for screen shots taken by pressing the screen shot key (bound to F12 by default). +This setting should be the file extension commonly associated with the desired format. +The formats supported will be determined at compilation, but "jpg", "png", and "tga" should be allowed. -The default value is "png". This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. texture mag filter ------------------ @@ -48,4 +56,6 @@ texture mipmap :Range: none, nearest, linear :Default: nearest -Set the texture mipmap type to control the method mipmaps are created. Mipmapping is a way of reducing the processing power needed during minification by pregenerating a series of smaller textures. \ No newline at end of file +Set the texture mipmap type to control the method mipmaps are created. +Mipmapping is a way of reducing the processing power needed during minification +by pregenerating a series of smaller textures. \ No newline at end of file diff --git a/docs/source/reference/modding/settings/index.rst b/docs/source/reference/modding/settings/index.rst index b0d81e4b0..56d76a8d1 100644 --- a/docs/source/reference/modding/settings/index.rst +++ b/docs/source/reference/modding/settings/index.rst @@ -2,12 +2,22 @@ Advanced Settings Configuration ############################### -This part of the guide will cover how to make modifications to the more arcane settings in OpenMW, most of which are not available from in-game menus, to optimize or customize your OpenMW experience. If you are familiar with ``.ini`` tweaks in Morrowind or the other games, this will be quite similar. All settings described in this section are changed in ``settings.cfg``, located in your OpenMW user directory. See :doc:`../paths` for this location. +This part of the guide will cover how to make modifications to the more arcane settings in OpenMW, +most of which are not available from in-game menus, to optimize or customize your OpenMW experience. +If you are familiar with ``.ini`` tweaks in Morrowind or the other games, this will be quite similar. +All settings described in this section are changed in ``settings.cfg``, located in your OpenMW user directory. +See :doc:`../paths` for this location. -Although this guide attempts to be comprehensive and up to date, you will always be able to find the full list of settings available and their default values in ``settings-default.cfg`` in your main OpenMW installation directory. The ranges I have included with each setting are the physically possible ranges, not recommendations. +Although this guide attempts to be comprehensive and up to date, +you will always be able to find the full list of settings available and their default values in ``settings-default.cfg`` +in your main OpenMW installation directory. +The ranges I have included with each setting are the physically possible ranges, not recommendations. .. warning:: - As the title suggests, these are advanced settings. If digging around plain text files and manually editing settings sounds scary to you, you may want to steer clear of altering these files. That being said, this guide should be plenty clear enough that you can find the setting you want to change and safely edit it. + As the title suggests, these are advanced settings. + If digging around plain text files and manually editing settings sounds scary to you, + you may want to steer clear of altering these files. That being said, + this guide should be plenty clear enough that you can find the setting you want to change and safely edit it. .. toctree:: :caption: Table of Contents diff --git a/docs/source/reference/modding/settings/input.rst b/docs/source/reference/modding/settings/input.rst index 5d0f8f662..042dba119 100644 --- a/docs/source/reference/modding/settings/input.rst +++ b/docs/source/reference/modding/settings/input.rst @@ -10,13 +10,22 @@ grab cursor OpenMW will capture control of the cursor if this setting is true. -In "look mode", OpenMW will center the cursor regardless of the value of this setting (since the cursor/crosshair is always centered in the OpenMW window). However, in GUI mode, this setting determines the behavior when the cursor is moved outside the OpenMW window. If true, the cursor movement stops at the edge of the window preventing access to other applications. If false, the cursor is allowed to move freely on the desktop. +In "look mode", OpenMW will center the cursor regardless of the value of this setting +(since the cursor/crosshair is always centered in the OpenMW window). +However, in GUI mode, this setting determines the behavior when the cursor is moved outside the OpenMW window. +If true, the cursor movement stops at the edge of the window preventing access to other applications. +If false, the cursor is allowed to move freely on the desktop. -This setting does not apply to the screen where escape has been pressed, where the cursor is never captured. Regardless of this setting "Alt-Tab" or some other operating system dependent key sequence can be used to allow the operating system to regain control of the mouse cursor. This setting interacts with the minimize on focus loss setting by affecting what counts as a focus loss. Specifically on a two-screen configuration it may be more convenient to access the second screen with setting disabled. +This setting does not apply to the screen where escape has been pressed, where the cursor is never captured. +Regardless of this setting "Alt-Tab" or some other operating system dependent key sequence can be used +to allow the operating system to regain control of the mouse cursor. +This setting interacts with the minimize on focus loss setting by affecting what counts as a focus loss. +Specifically on a two-screen configuration it may be more convenient to access the second screen with setting disabled. -Note for developers: it's desirable to have this setting disabled when running the game in a debugger, to prevent the mouse cursor from becoming unusable when the game pauses on a breakpoint. +Note for developers: it's desirable to have this setting disabled when running the game in a debugger, +to prevent the mouse cursor from becoming unusable when the game pauses on a breakpoint. -The default value is true. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. toggle sneak ------------ @@ -25,9 +34,11 @@ toggle sneak :Range: True/False :Default: False -This setting causes the behavior of the sneak key (bound to Ctrl by default) to toggle sneaking on and off rather than requiring the key to be held down while sneaking. Players that spend significant time sneaking may find the character easier to control with this option enabled. +This setting causes the behavior of the sneak key (bound to Ctrl by default) +to toggle sneaking on and off rather than requiring the key to be held down while sneaking. +Players that spend significant time sneaking may find the character easier to control with this option enabled. -The default value is false. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. always run ---------- @@ -36,9 +47,12 @@ always run :Range: True/False :Default: False -If this setting is true, the character is running by default, otherwise the character is walking by default. The shift key will temporarily invert this setting, and the caps lock key will invert this setting while it's "locked". This setting is updated every time you exit the game, based on whether the caps lock key was on or off at the time you exited. +If this setting is true, the character is running by default, otherwise the character is walking by default. +The shift key will temporarily invert this setting, and the caps lock key will invert this setting while it's "locked". +This setting is updated every time you exit the game, +based on whether the caps lock key was on or off at the time you exited. -The default value is false. This settings can be toggled in game by pressing the CapsLock key and exiting. +This settings can be toggled in game by pressing the CapsLock key and exiting. allow third person zoom ----------------------- @@ -47,7 +61,10 @@ allow third person zoom :Range: True/False :Default: False -Allow zooming in and out using the middle mouse wheel in third person view. This feature may not work correctly if the mouse wheel is bound to other actions, and may be triggered accidentally in some cases, so is disabled by default. This setting can only be configured by editing the settings configuration file. +Allow zooming in and out using the middle mouse wheel in third person view. +This feature may not work correctly if the mouse wheel is bound to other actions, +and may be triggered accidentally in some cases, so is disabled by default. +This setting can only be configured by editing the settings configuration file. camera sensitivity ------------------ @@ -56,9 +73,13 @@ camera sensitivity :Range: > 0 :Default: 1.0 -This setting controls the overall camera/mouse sensitivity when not in GUI mode. The default sensitivity is 1.0, with smaller values requiring more mouse movement, and larger values requiring less. This setting is multiplicative in magnitude. This setting does not affect mouse speed in GUI mode, which is instead controlled by your operating system mouse speed setting. +This setting controls the overall camera/mouse sensitivity when not in GUI mode. +The default sensitivity is 1.0, with smaller values requiring more mouse movement, +and larger values requiring less. This setting is multiplicative in magnitude. +This setting does not affect mouse speed in GUI mode, +which is instead controlled by your operating system mouse speed setting. -The default value is 1.0. This setting can be changed with the Camera Sensitivity slider in the Controls panel of the Options menu. +This setting can be changed with the Camera Sensitivity slider in the Controls panel of the Options menu. camera y multiplier ------------------- @@ -67,9 +88,11 @@ camera y multiplier :Range: > 0 :Default: 1.0 -This setting controls the vertical camera/mouse sensitivity relative to the horizontal sensitivity (see camera sensitivity above). It is multiplicative with the previous setting, meaning that it should remain set at 1.0 unless the player desires to have different sensitivities in the two axes. +This setting controls the vertical camera/mouse sensitivity relative to the horizontal sensitivity +(see camera sensitivity above). It is multiplicative with the previous setting, +meaning that it should remain set at 1.0 unless the player desires to have different sensitivities in the two axes. -The default value is 1.0. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. invert y axis ------------- @@ -78,6 +101,8 @@ invert y axis :Range: True/False :Default: False -Invert the vertical axis while not in GUI mode. If this setting is true, moving the mouse away from the player will look down, while moving it towards the player will look up. This setting does not affect cursor movement in GUI mode. +Invert the vertical axis while not in GUI mode. +If this setting is true, moving the mouse away from the player will look down, +while moving it towards the player will look up. This setting does not affect cursor movement in GUI mode. -The default value is false. This setting can be toggled in game with the Invert Y Axis button in the Controls panel of the Options menu. +This setting can be toggled in game with the Invert Y Axis button in the Controls panel of the Options menu. diff --git a/docs/source/reference/modding/settings/map.rst b/docs/source/reference/modding/settings/map.rst index 8bf563da9..e2dc71824 100644 --- a/docs/source/reference/modding/settings/map.rst +++ b/docs/source/reference/modding/settings/map.rst @@ -10,7 +10,7 @@ global If this setting is true, a world map on a map window will be displayed, otherwise a local map will be displayed. -The default value is false. This setting can be toggled with the local/world map switch button on the map window. +This setting can be toggled with the local/world map switch button on the map window. global map cell size -------------------- @@ -19,12 +19,23 @@ global map cell size :Range: >= 1 :Default: 18 -This setting adjusts the scale of the world map in the GUI mode map window. The value is the width in pixels of each cell in the map, so larger values result in larger more detailed world maps, while smaller values result in smaller less detailed world maps. However, the native resolution of the map source material appears to be 9 pixels per unexplored cell and approximately 18 pixels per explored cell, so values larger than 36 don't produce much additional detail. Similarly, the size of place markers is currently fixed at 12 pixels, so values smaller than this result in overlapping place markers. Values from 12 to 36 are recommended. For reference, Vvardenfell is approximately 41x36 cells. +This setting adjusts the scale of the world map in the GUI mode map window. +The value is the width in pixels of each cell in the map, so larger values result in larger more detailed world maps, +while smaller values result in smaller less detailed world maps. +However, the native resolution of the map source material appears to be 9 pixels per unexplored cell +and approximately 18 pixels per explored cell, so values larger than 36 don't produce much additional detail. +Similarly, the size of place markers is currently fixed at 12 pixels, +so values smaller than this result in overlapping place markers. +Values from 12 to 36 are recommended. For reference, Vvardenfell is approximately 41x36 cells. .. Warning:: - Changing this setting affects saved games. The currently explored area is stored as an image in the save file that's overlayed on the default world map in game. When you increase the resolution of the map, the overlay of earlier saved games will be scaled up on load, and appear blurry. When you visit the cell again, the overlay for that cell is regenerated at the new resolution, so the blurry areas can be corrected by revisiting all the cells you've already visited. + Changing this setting affects saved games. The currently explored area is stored as an image + in the save file that's overlayed on the default world map in game. + When you increase the resolution of the map, the overlay of earlier saved games will be scaled up on load, + and appear blurry. When you visit the cell again, the overlay for that cell is regenerated at the new resolution, + so the blurry areas can be corrected by revisiting all the cells you've already visited. -The default value for this setting is 18. This setting can not be configured except by editing the settings configuration file. +This setting can not be configured except by editing the settings configuration file. local map hud widget size ------------------------- @@ -33,11 +44,18 @@ local map hud widget size :Range: >= 1 :Default: 256 -This setting controls the zoom level for the HUD map widget (the map in the lower right corner of the window). A value of 64 results in the HUD map widget displaying one entire exterior cell. Since the GUI mode map displays 3x3 cells, a value of approximately 21 displays the same area as the GUI mode map. Larger values increase the level of zoom, while smaller values are wasteful since there's no map data to display beyond the 3x3 cell grid. +This setting controls the zoom level for the HUD map widget (the map in the lower right corner of the window). +A value of 64 results in the HUD map widget displaying one entire exterior cell. +Since the GUI mode map displays 3x3 cells, a value of approximately 21 displays the same area as the GUI mode map. +Larger values increase the level of zoom, +while smaller values are wasteful since there's no map data to display beyond the 3x3 cell grid. -Note that the actual size of the widget is always the same on the screen unless the scaling factor setting in the "GUI" section is changed. Increasing both the scaling factor of the GUI and this setting does result in a higher resolution HUD map, but unfortunately with a scaled direction pointer on top of it. +Note that the actual size of the widget is always the same on the screen +unless the scaling factor setting in the "GUI" section is changed. +Increasing both the scaling factor of the GUI and this setting does result in a higher resolution HUD map, +unfortunately with a scaled direction pointer on top of it. -The default value for this setting is 256. This setting can not be configured except by editing the settings configuration file. +This setting can not be configured except by editing the settings configuration file. local map hud fog of war ------------------------ @@ -46,7 +64,9 @@ local map hud fog of war :Range: True/False :Default: False -This setting enables fog of war rendering on the HUD map. Default is Off since with default settings the map is so small that the fog would not obscure anything, just darken the edges slightly. +This setting enables fog of war rendering on the HUD map. +Default is Off since with default settings the map is so small that the fog would not obscure anything, +just darken the edges slightly. local map resolution -------------------- @@ -55,12 +75,21 @@ local map resolution :Range: >= 1 :Default: 256 -This setting controls the resolution of the GUI mode local map window. Larger values generally increase the visible detail in map. If this setting is half the local map widget size or smaller, the map will generally be be fairly blurry. Setting both options to the same value results in a map with good detail. Values that exceed the local map widget size setting by more than a factor of two are unlikely to provide much of an improvement in detail since they're subsequently scaled back to the approximately the map widget size before display. The video resolution settings interacts with this setting in that regard. +This setting controls the resolution of the GUI mode local map window. +Larger values generally increase the visible detail in map. +If this setting is half the local map widget size or smaller, the map will generally be be fairly blurry. +Setting both options to the same value results in a map with good detail. +Values that exceed the local map widget size setting by more than a factor of two +are unlikely to provide much of an improvement in detail since they're subsequently scaled back +to the approximately the map widget size before display. +The video resolution settings interacts with this setting in that regard. .. warning:: - Increasing this setting can increase cell load times, because the map is rendered on demand each time you enter a new cell. Large values may exceed video card limits or exhaust VRAM. + Increasing this setting can increase cell load times, + because the map is rendered on demand each time you enter a new cell. + Large values may exceed video card limits or exhaust VRAM. -The default value for this setting is 256. This setting can not be configured except by editing the settings configuration file. +This setting can not be configured except by editing the settings configuration file. local map widget size --------------------- @@ -69,9 +98,12 @@ local map widget size :Range: >= 1 :Default: 512 -This setting controls the canvas size of the GUI mode local map window. Larger values result in a larger physical map size on screen, and typically require more panning to see all available portions of the map. This larger size also enables an overall greater level of detail if the local map resolution setting is also increased. +This setting controls the canvas size of the GUI mode local map window. +Larger values result in a larger physical map size on screen, +and typically require more panning to see all available portions of the map. +This larger size also enables an overall greater level of detail if the local map resolution setting is also increased. -The default value for this setting is 512. This setting can not be configured except by editing the settings configuration file. +This setting can not be configured except by editing the settings configuration file. local map cell distance ----------------------- @@ -80,4 +112,5 @@ local map cell distance :Range: >= 1 :Default: 1 -Similar to "[Cells] exterior cell load distance", controls how many cells are rendered on the local map. Values higher than the default may result in longer loading times. \ No newline at end of file +Similar to "[Cells] exterior cell load distance", controls how many cells are rendered on the local map. +Values higher than the default may result in longer loading times. \ No newline at end of file diff --git a/docs/source/reference/modding/settings/saves.rst b/docs/source/reference/modding/settings/saves.rst index de0c06558..90bd56ca5 100644 --- a/docs/source/reference/modding/settings/saves.rst +++ b/docs/source/reference/modding/settings/saves.rst @@ -10,7 +10,8 @@ character This setting contains the default character name for loading saved games. -The default value is the empty string, which results in no character being selected by default. This setting is automatically updated from the Load menu when a different character is selected. +The default value is the empty string, which results in no character being selected by default. +This setting is automatically updated from the Load menu when a different character is selected. autosave -------- @@ -21,7 +22,7 @@ autosave This setting determines whether the game will be automatically saved when the character rests. -The default value is true. This setting can be toggled in game with the Auto-Save when Rest button in the Prefs panel of the Options menu. +This setting can be toggled in game with the Auto-Save when Rest button in the Prefs panel of the Options menu. timeplayed ---------- @@ -30,6 +31,7 @@ timeplayed :Range: True/False :Default: False -This setting determines whether the amount of the time the player has spent playing will be displayed for each saved game in the Load menu. +This setting determines whether the amount of the time the player has spent playing will be displayed +for each saved game in the Load menu. -The default value is false. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. diff --git a/docs/source/reference/modding/settings/shaders.rst b/docs/source/reference/modding/settings/shaders.rst index 7b736f567..3794c7d9a 100644 --- a/docs/source/reference/modding/settings/shaders.rst +++ b/docs/source/reference/modding/settings/shaders.rst @@ -8,7 +8,9 @@ force shaders :Range: True/False :Default: False -Force rendering with shaders. By default, only bump-mapped objects will use shaders. Enabling this option may cause slightly different visuals if the "clamp lighting" option is set to false. Otherwise, there should not be a visual difference. +Force rendering with shaders. By default, only bump-mapped objects will use shaders. +Enabling this option may cause slightly different visuals if the "clamp lighting" option is set to false. +Otherwise, there should not be a visual difference. force per pixel lighting ------------------------ @@ -17,7 +19,11 @@ force per pixel lighting :Range: True/False :Default: False -Force the use of per pixel lighting. By default, only bump mapped objects use per-pixel lighting. Has no effect if the 'force shaders' option is false. Enabling per-pixel lighting can result in visual differences to the original MW engine. It is not recommended to enable this option when using vanilla Morrowind files, because certain lights in Morrowind rely on vertex lighting to look as intended. +Force the use of per pixel lighting. By default, only bump mapped objects use per-pixel lighting. +Has no effect if the 'force shaders' option is false. +Enabling per-pixel lighting can result in visual differences to the original MW engine. +It is not recommended to enable this option when using vanilla Morrowind files, +because certain lights in Morrowind rely on vertex lighting to look as intended. clamp lighting -------------- @@ -26,7 +32,11 @@ clamp lighting :Range: True/False :Default: True -Restrict the amount of lighting that an object can receive to a maximum of (1,1,1). Only affects objects that render with shaders (see 'force shaders' option). Always affects terrain. Setting this option to 'true' results in fixed-function compatible lighting, but the lighting may appear 'dull' and there might be color shifts. Setting this option to 'false' results in more realistic lighting. +Restrict the amount of lighting that an object can receive to a maximum of (1,1,1). +Only affects objects that render with shaders (see 'force shaders' option). +Always affects terrain. Setting this option to 'true' results in fixed-function compatible lighting, +but the lighting may appear 'dull' and there might be color shifts. +Setting this option to 'false' results in more realistic lighting. auto use object normal maps --------------------------- @@ -35,7 +45,10 @@ auto use object normal maps :Range: True/False :Default: False -If this option is enabled, normal maps are automatically recognized and used if they are named appropriately (see 'normal map pattern', e.g. for a base texture foo.dds, the normal map texture would have to be named foo_n.dds). If this option is disabled, normal maps are only used if they are explicitly listed within the mesh file (.nif or .osg file). Affects objects. +If this option is enabled, normal maps are automatically recognized and used if they are named appropriately +(see 'normal map pattern', e.g. for a base texture foo.dds, the normal map texture would have to be named foo_n.dds). +If this option is disabled, +normal maps are only used if they are explicitly listed within the mesh file (.nif or .osg file). Affects objects. auto use object specular maps ----------------------------- @@ -44,7 +57,11 @@ auto use object specular maps :Range: True/False :Default: False -If this option is enabled, specular maps are automatically recognized and used if they are named appropriately (see 'specular map pattern', e.g. for a base texture foo.dds, the specular map texture would have to be named foo_spec.dds). If this option is disabled, normal maps are only used if they are explicitly listed within the mesh file (.osg file, not supported in .nif files). Affects objects. +If this option is enabled, specular maps are automatically recognized and used if they are named appropriately +(see 'specular map pattern', e.g. for a base texture foo.dds, +the specular map texture would have to be named foo_spec.dds). +If this option is disabled, normal maps are only used if they are explicitly listed within the mesh file +(.osg file, not supported in .nif files). Affects objects. auto use terrain normal maps ---------------------------- @@ -62,7 +79,8 @@ auto use terrain specular maps :Range: True/False :Default: False -If a file with pattern 'terrain specular map pattern' exists, use that file as a 'diffuse specular' map. The texture must contain the layer color in the RGB channel (as usual), and a specular multiplier in the alpha channel. +If a file with pattern 'terrain specular map pattern' exists, use that file as a 'diffuse specular' map. +The texture must contain the layer color in the RGB channel (as usual), and a specular multiplier in the alpha channel. normal map pattern ------------------ @@ -71,7 +89,8 @@ normal map pattern :Range: :Default: _n -The filename pattern to probe for when detecting normal maps (see 'auto use object normal maps', 'auto use terrain normal maps') +The filename pattern to probe for when detecting normal maps +(see 'auto use object normal maps', 'auto use terrain normal maps') normal height map pattern ------------------------- @@ -80,7 +99,9 @@ normal height map pattern :Range: :Default: _nh -Alternative filename pattern to probe for when detecting normal maps. Files with this pattern are expected to include 'height' in the alpha channel.This height is used for parallax effects. Works for both terrain and objects. +Alternative filename pattern to probe for when detecting normal maps. +Files with this pattern are expected to include 'height' in the alpha channel. +This height is used for parallax effects. Works for both terrain and objects. specular map pattern -------------------- diff --git a/docs/source/reference/modding/settings/sound.rst b/docs/source/reference/modding/settings/sound.rst index dec4bb3a2..33185ed66 100644 --- a/docs/source/reference/modding/settings/sound.rst +++ b/docs/source/reference/modding/settings/sound.rst @@ -8,7 +8,8 @@ device :Range: :Default: "" -This setting determines which audio device to use. A blank or missing setting means to use the default device, which should usually be sufficient, but if you need to explicitly specify a device use this setting. +This setting determines which audio device to use. A blank or missing setting means to use the default device, +which should usually be sufficient, but if you need to explicitly specify a device use this setting. The names of detected devices can be found in the openmw.log file in your configuration directory. @@ -21,9 +22,11 @@ master volume :Range: 0.0 to 1.0 :Default: 1.0 -This setting controls the overall volume. The master volume is multiplied with all other volume settings to determine the final volume. +This setting controls the overall volume. +The master volume is multiplied with all other volume settings to determine the final volume. -The default value is 1.0. Valid values range from 0.0 (silent) to 1.0 (maximum volume). This setting can be changed in game using the Master slider from the Audio panel of the Options menu. +The default value is 1.0. Valid values range from 0.0 (silent) to 1.0 (maximum volume). +This setting can be changed in game using the Master slider from the Audio panel of the Options menu. footsteps volume ---------------- @@ -34,7 +37,8 @@ footsteps volume This setting controls the volume of footsteps from the character and other actors. -The default value is 0.2. Valid values range from 0.0 (silent) to 1.0 (maximum volume). This setting can be changed in game using the Footsteps slider from the Audio panel of the Options menu. +Valid values range from 0.0 (silent) to 1.0 (maximum volume). +This setting can be changed in game using the Footsteps slider from the Audio panel of the Options menu. music volume ------------ @@ -45,7 +49,8 @@ music volume This setting controls the volume for music tracks. -The default value is 0.5. Valid values range from 0.0 (silent) to 1.0 (maximum volume). This setting can be changed in game using the Music slider from the Audio panel of the Options menu. +The default value is 0.5. Valid values range from 0.0 (silent) to 1.0 (maximum volume). +This setting can be changed in game using the Music slider from the Audio panel of the Options menu. sfx volume ---------- @@ -56,7 +61,8 @@ sfx volume This setting controls the volume for special sound effects such as combat noises. -The default value is 1.0. Valid values range from 0.0 (silent) to 1.0 (maximum volume). This setting can be changed in game using the Effects slider from the Audio panel of the Options menu. +Valid values range from 0.0 (silent) to 1.0 (maximum volume). +This setting can be changed in game using the Effects slider from the Audio panel of the Options menu. voice volume ------------ @@ -67,7 +73,8 @@ voice volume This setting controls the volume for spoken dialog from NPCs. -The default value is 0.8. Valid values range from 0.0 (silent) to 1.0 (maximum volume). This setting can be changed in game using the Voice slider from the Audio panel of the Options menu. +Valid values range from 0.0 (silent) to 1.0 (maximum volume). +This setting can be changed in game using the Voice slider from the Audio panel of the Options menu. buffer cache min ---------------- @@ -76,9 +83,12 @@ buffer cache min :Range: > 0 :Default: 14 -This setting determines the minimum size of the sound buffer cache in megabytes. When the cache reaches the size specified by the buffer cache max setting, old buffers will be unloaded until it's using no more memory than specified by this setting. This setting must be less than or equal to the buffer cache max setting. +This setting determines the minimum size of the sound buffer cache in megabytes. +When the cache reaches the size specified by the buffer cache max setting, +old buffers will be unloaded until it's using no more memory than specified by this setting. +This setting must be less than or equal to the buffer cache max setting. -The default value is 14. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. buffer cache max ---------------- @@ -87,9 +97,11 @@ buffer cache max :Range: > 0 :Default: 16 -This setting determines the maximum size of the sound buffer cache in megabytes. When the cache reaches this size, old buffers will be unloaded until it reaches the size specified by the buffer cache min setting. This setting must be greater than or equal to the buffer cache min setting. +This setting determines the maximum size of the sound buffer cache in megabytes. When the cache reaches this size, +old buffers will be unloaded until it reaches the size specified by the buffer cache min setting. +This setting must be greater than or equal to the buffer cache min setting. -The default value is 16. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. hrtf enable ----------- @@ -98,8 +110,13 @@ hrtf enable :Range: -1, 0, 1 :Default: -1 -This setting determines whether to enable head-related transfer function (HRTF) audio processing. HRTF audio processing creates the perception of sounds occurring in a three dimensional space when wearing headphones. Enabling HRTF may also require an OpenAL Soft version greater than 1.17.0, and possibly some operating system configuration. A value of 0 disables HRTF processing, while a value of 1 explicitly enables HRTF processing. -The default value is -1, which should enable the feature automatically for most users when possible. This setting can only be configured by editing the settings configuration file. +This setting determines whether to enable head-related transfer function (HRTF) audio processing. +HRTF audio processing creates the perception of sounds occurring in a three dimensional space when wearing headphones. +Enabling HRTF may also require an OpenAL Soft version greater than 1.17.0, +and possibly some operating system configuration. +A value of 0 disables HRTF processing, while a value of 1 explicitly enables HRTF processing. +The default value is -1, which should enable the feature automatically for most users when possible. +This setting can only be configured by editing the settings configuration file. hrtf ---- @@ -108,6 +125,9 @@ hrtf :Range: :Default: "" -This setting specifies which HRTF profile to use when HRTF is enabled. Blank means use the default. This setting has no effect if HRTF is not enabled based on the hrtf enable setting. Allowed values for this field are enumerated in openmw.log file is an HRTF enabled ausio system is installed. +This setting specifies which HRTF profile to use when HRTF is enabled. Blank means use the default. +This setting has no effect if HRTF is not enabled based on the hrtf enable setting. +Allowed values for this field are enumerated in openmw.log file is an HRTF enabled ausio system is installed. -The default value is the empty string, which uses the default profile. This setting can only be configured by editing the settings configuration file. +The default value is the empty string, which uses the default profile. +This setting can only be configured by editing the settings configuration file. diff --git a/docs/source/reference/modding/settings/terrain.rst b/docs/source/reference/modding/settings/terrain.rst index 75eab27c2..6bb87629a 100644 --- a/docs/source/reference/modding/settings/terrain.rst +++ b/docs/source/reference/modding/settings/terrain.rst @@ -8,8 +8,15 @@ distant terrain :Range: True/False :Default: False -Controls whether the engine will use paging and LOD algorithms to render the terrain of the entire world at all times. Otherwise, only the terrain of the loaded cells is displayed. This setting is best used together with the 'viewing distance' setting in the camera section. +Controls whether the engine will use paging and LOD algorithms to render the terrain of the entire world at all times. +Otherwise, only the terrain of the loaded cells is displayed. +This setting is best used together with the 'viewing distance' setting in the camera section. -To avoid frame drops as the player moves around, nearby terrain pages are always preloaded in the background, regardless of the preloading settings in the 'Cells' section, but the preloading of terrain behind a door or a travel destination, for example, will still be controlled by cell preloading settings. +To avoid frame drops as the player moves around, nearby terrain pages are always preloaded in the background, +regardless of the preloading settings in the 'Cells' section, +but the preloading of terrain behind a door or a travel destination, for example, +will still be controlled by cell preloading settings. -The distant terrain engine is currently considered experimental and may receive updates and/or further configuration options in the future. The glaring omission of non-terrain objects in the distance somewhat limits this setting's usefulness. +The distant terrain engine is currently considered experimental +and may receive updates and/or further configuration options in the future. +The glaring omission of non-terrain objects in the distance somewhat limits this setting's usefulness. diff --git a/docs/source/reference/modding/settings/video.rst b/docs/source/reference/modding/settings/video.rst index 3d0197bfe..3581d7226 100644 --- a/docs/source/reference/modding/settings/video.rst +++ b/docs/source/reference/modding/settings/video.rst @@ -8,9 +8,13 @@ resolution x :Range: > 0 :Default: 800 -This setting determines the horizontal resolution of the OpenMW game window. Larger values produce more detailed images within the constraints of your graphics hardware but also significantly reduce the frame rate. +This setting determines the horizontal resolution of the OpenMW game window. +Larger values produce more detailed images within the constraints of your graphics hardware, +but also significantly reduce the frame rate. -The default value is 800. The window resolution can be selected from a menu of common screen sizes in the Video tab of the Video Panel of the Options menu, or in the Graphics tab of the OpenMW Launcher. The horizontal resolution can also be set to a custom value in the Graphics tab of the OpenMW Launcher. +The window resolution can be selected from a menu of common screen sizes +in the Video tab of the Video Panel of the Options menu, or in the Graphics tab of the OpenMW Launcher. +The horizontal resolution can also be set to a custom value in the Graphics tab of the OpenMW Launcher. resolution y ------------ @@ -19,9 +23,13 @@ resolution y :Range: > 0 :Default: 600 -This setting determines the vertical resolution of the OpenMW game window. Larger values produce more detailed images within the constraints of your graphics hardware but also significantly reduce the frame rate. +This setting determines the vertical resolution of the OpenMW game window. +Larger values produce more detailed images within the constraints of your graphics hardware, +but also significantly reduce the frame rate. -The default value is 600. The window resolution can be selected from a menu of common screen sizes in the Video tab of the Video Panel of the Options menu, or in the Graphics tab of the OpenMW Launcher. The vertical resolution can also be set to a custom value in the Graphics tab of the OpenMW Launcher. +The window resolution can be selected from a menu of common screen sizes +in the Video tab of the Video Panel of the Options menu, or in the Graphics tab of the OpenMW Launcher. +The vertical resolution can also be set to a custom value in the Graphics tab of the OpenMW Launcher. fullscreen ---------- @@ -32,7 +40,8 @@ fullscreen This setting determines whether the entire screen is used for the specified resolution. -The default value is false. This setting can be toggled in game using the Fullscreen button in the Video tab of the Video panel in the Options menu. It can also be toggled with the Full Screen check box in the Graphics tab of the OpenMW Launcher. +This setting can be toggled in game using the Fullscreen button in the Video tab of the Video panel in the Options menu. +It can also be toggled with the Full Screen check box in the Graphics tab of the OpenMW Launcher. screen ------ @@ -41,9 +50,14 @@ screen :Range: >= 0 :Default: 0 -This setting determines which screen the game will open on in multi-monitor configurations. This setting is particularly important when the fullscreen setting is true, since this is the only way to control which screen is used, but it can also be used to control which screen a normal window or a borderless window opens on as well. The screens are numbered in increasing order, beginning with 0. +This setting determines which screen the game will open on in multi-monitor configurations. +This setting is particularly important when the fullscreen setting is true, +since this is the only way to control which screen is used, +but it can also be used to control which screen a normal window or a borderless window opens on as well. +The screens are numbered in increasing order, beginning with 0. -The default value is 0. This setting can be selected from a pull down menu in the Graphics tab of the OpenMW Launcher, but cannot be changed during game play. +This setting can be selected from a pull down menu in the Graphics tab of the OpenMW Launcher, +but cannot be changed during game play. minimize on focus loss ---------------------- @@ -52,15 +66,22 @@ minimize on focus loss :Range: True/False :Default: True -Minimize the OpenMW window if it loses cursor focus. This setting is primarily useful for single screen configurations, so that the OpenMW screen in full screen mode can be minimized when the operating system regains control of the mouse and keyboard. On multiple screen configurations, disabling this option makes it easier to switch between screens while playing OpenMW. +Minimize the OpenMW window if it loses cursor focus. This setting is primarily useful for single screen configurations, +so that the OpenMW screen in full screen mode can be minimized +when the operating system regains control of the mouse and keyboard. +On multiple screen configurations, disabling this option makes it easier to switch between screens while playing OpenMW. -Note that a minimized game window consumes less system resources and produces less heat, since the game does not need to render in minimized state. It is therefore advisable to minimize the game during pauses (either via use of this setting, or by minimizing the window manually). +.. Note:: + A minimized game window consumes less system resources and produces less heat, + since the game does not need to render in minimized state. + It is therefore advisable to minimize the game during pauses + (either via use of this setting, or by minimizing the window manually). This setting has no effect if the fullscreen setting is false. Developer note: corresponds to SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS. -The default value is true. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. window border ------------- @@ -69,11 +90,15 @@ window border :Range: True/False :Default: True -This setting determines whether there's an operating system border drawn around the OpenMW window. If this setting is true, the window can be moved and resized with the operating system window controls. If this setting is false, the window has no operating system border. +This setting determines whether there's an operating system border drawn around the OpenMW window. +If this setting is true, the window can be moved and resized with the operating system window controls. +If this setting is false, the window has no operating system border. This setting has no effect if the fullscreen setting is true. -The default value is true. This setting can be toggled in game using the Window Border button in the Video tab of the Video panel in the Options menu. It can also be toggled with the Window Border check box in the OpenMW Launcher. +This setting can be toggled in game using the Window Border button +in the Video tab of the Video panel in the Options menu. +It can also be toggled with the Window Border check box in the OpenMW Launcher. antialiasing ------------ @@ -82,9 +107,16 @@ antialiasing :Range: 0, 2, 4, 8, 16 :Default: 0 -This setting controls anti-aliasing. Anti-aliasing is a technique designed to improve the appearance of polygon edges, so they do not appear to be "jagged". Anti-aliasing can smooth these edges at the cost of a minor reduction in the frame rate. A value of 0 disables anti-aliasing. Other powers of two (e.g. 2, 4, 8, 16) are supported according to the capabilities of your graphics hardware. Higher values do a better job of smoothing out the image but have a greater impact on frame rate. +This setting controls anti-aliasing. Anti-aliasing is a technique designed to improve the appearance of polygon edges, +so they do not appear to be "jagged". +Anti-aliasing can smooth these edges at the cost of a minor reduction in the frame rate. +A value of 0 disables anti-aliasing. +Other powers of two (e.g. 2, 4, 8, 16) are supported according to the capabilities of your graphics hardware. +Higher values do a better job of smoothing out the image but have a greater impact on frame rate. -This setting can be configured from a list of valid choices in the Graphics panel of the OpenMW Launcher, but cannot be changed during game play - due to a technical limitation that may be addressed in a future version of OpenMW. +This setting can be configured from a list of valid choices in the Graphics panel of the OpenMW Launcher, +but cannot be changed during game play +due to a technical limitation that may be addressed in a future version of OpenMW. vsync ----- @@ -93,9 +125,15 @@ vsync :Range: True/False :Default: False -This setting determines whether frame draws are synchronized with the vertical refresh rate of your monitor. Enabling this setting can reduce screen tearing, a visual defect caused by updating the image buffer in the middle of a screen draw. Enabling this option typically implies limiting the framerate to 60 frames per second, but may also introduce additional delays caused by having to wait until the appropriate time (the vertical blanking interval) to draw a frame. +This setting determines whether frame draws are synchronized with the vertical refresh rate of your monitor. +Enabling this setting can reduce screen tearing, +a visual defect caused by updating the image buffer in the middle of a screen draw. +Enabling this option typically implies limiting the framerate to 60 frames per second, +but may also introduce additional delays caused by having to wait until the appropriate time +(the vertical blanking interval) to draw a frame. -The default value is false. This setting can be adjusted in game using the VSync button in the Video tab of the Video panel in the Options menu. It can also be changed by toggling the Vertical Sync check box in the Graphics tab of the OpenMW Launcher. +This setting can be adjusted in game using the VSync button in the Video tab of the Video panel in the Options menu. +It can also be changed by toggling the Vertical Sync check box in the Graphics tab of the OpenMW Launcher. framerate limit --------------- @@ -104,13 +142,24 @@ framerate limit :Range: >= 0.0 :Default: 0.0 -This setting determines the maximum frame rate in frames per second. If this setting is 0.0, the frame rate is unlimited. +This setting determines the maximum frame rate in frames per second. +If this setting is 0.0, the frame rate is unlimited. -There are several reasons to consider capping your frame rate, especially if you're already experiencing a relatively high frame rate (greater than 60 frames per second). Lower frame rates will consume less power and generate less heat and noise. Frame rates above 60 frames per second rarely produce perceptible improvements in visual quality, but may improve input responsiveness. Capping the frame rate may in some situations reduce the perception of choppiness (highly variable frame rates during game play) by lowering the peak frame rates. +There are several reasons to consider capping your frame rate, +especially if you're already experiencing a relatively high frame rate (greater than 60 frames per second). +Lower frame rates will consume less power and generate less heat and noise. +Frame rates above 60 frames per second rarely produce perceptible improvements in visual quality, +but may improve input responsiveness. +Capping the frame rate may in some situations reduce the perception of choppiness +(highly variable frame rates during game play) by lowering the peak frame rates. -This setting interacts with the vsync setting in the Video section in the sense that enabling vertical sync limits the frame rate to the refresh rate of your monitor (often 60 frames per second). Choosing to limit the frame rate using this setting instead of vsync may reduce input lag due to the game not having to wait for the vertical blanking interval. +This setting interacts with the vsync setting in the Video section +in the sense that enabling vertical sync limits the frame rate to the refresh rate of your monitor +(often 60 frames per second). +Choosing to limit the frame rate using this setting instead of vsync may reduce input lag +due to the game not having to wait for the vertical blanking interval. -The default value is 0.0. This setting can only be configured by editing the settings configuration file. +This setting can only be configured by editing the settings configuration file. contrast -------- @@ -121,7 +170,8 @@ contrast This setting controls the contrast correction for all video in the game. -The default value is 1.0. This setting can only be configured by editing the settings configuration file. This setting does not currently work under Linux. +This setting can only be configured by editing the settings configuration file. +This setting does not currently work under Linux. gamma ----- @@ -130,6 +180,8 @@ gamma :Range: > 0.0 :Default: 1.0 -This setting controls the gamma correction for all video in the game. Gamma is an exponent that makes colors brighter if greater than 1.0 and darker if less than 1.0. +This setting controls the gamma correction for all video in the game. +Gamma is an exponent that makes colors brighter if greater than 1.0 and darker if less than 1.0. -The default value is 1.0. This setting can be changed in the Detail tab of the Video panel of the Options menu. This setting does not currently work under Linux, and the in-game setting in the Options menu has been disabled. +This setting can be changed in the Detail tab of the Video panel of the Options menu. +This setting does not currently work under Linux, and the in-game setting in the Options menu has been disabled. diff --git a/docs/source/reference/modding/settings/water.rst b/docs/source/reference/modding/settings/water.rst index 1c573a5c0..2344222e5 100644 --- a/docs/source/reference/modding/settings/water.rst +++ b/docs/source/reference/modding/settings/water.rst @@ -2,7 +2,13 @@ Water Settings ############## .. note:: - The settings for the water shader are difficult to describe, but can be seen immediately in the Water tab of the Video panel in the Options menu. Changes there will be saved to these settings. It is suggested to stand on the shore of a moderately broad body of water with trees or other objects on the far shore to test reflection textures, underwater plants in shallow water near by to test refraction textures, and some deep water visible from your location to test deep water visibility. + The settings for the water shader are difficult to describe, + but can be seen immediately in the Water tab of the Video panel in the Options menu. + Changes there will be saved to these settings. + It is suggested to stand on the shore of a moderately broad body of water with trees or other objects + on the far shore to test reflection textures, + underwater plants in shallow water near by to test refraction textures, + and some deep water visible from your location to test deep water visibility. shader ------ @@ -11,9 +17,10 @@ shader :Range: True/False :Default: False -This setting enables or disables the water shader, which results in much more realistic looking water surfaces, including reflected objects and a more detailed wavy surface. +This setting enables or disables the water shader, which results in much more realistic looking water surfaces, +including reflected objects and a more detailed wavy surface. -The default value is false. This setting can be toggled with the Shader button in the Water tab of the Video panel of the Options menu. +This setting can be toggled with the Shader button in the Water tab of the Video panel of the Options menu. rtt size -------- @@ -22,10 +29,16 @@ rtt size :Range: > 0 :Default: 512 -The setting determines the size of the texture used for reflection and refraction (if enabled). For reflection, the texture size determines the detail of reflected images on the surface of the water. For refraction, the texture size determines the detail of the objects on the other side of the plane of water (which have a wavy appearance caused by the refraction). RTT is an acronym for Render to Texture which allows rendering of the scene to be saved as a texture. +The setting determines the size of the texture used for reflection and refraction (if enabled). +For reflection, the texture size determines the detail of reflected images on the surface of the water. +For refraction, the texture size determines the detail of the objects on the other side of the plane of water +(which have a wavy appearance caused by the refraction). +RTT is an acronym for Render To Texture which allows rendering of the scene to be saved as a texture. Higher values produces better visuals and result in a marginally lower frame rate depending on your graphics hardware. -In the Water tab of the Video panel of the Options menu, the choices are Low (512), Medium (1024) and High (2048). This setting has no effect if the shader setting is false. It is recommended to use values that are a power of two because this results in more efficient use of video hardware. +In the Water tab of the Video panel of the Options menu, the choices are Low (512), Medium (1024) and High (2048). +This setting has no effect if the shader setting is false. +It is recommended to use values that are a power of two because this results in more efficient use of video hardware. This setting has no effect if the shader setting is false. @@ -36,11 +49,14 @@ refraction :Range: True/False :Default: False -This setting enables the refraction rendering feature of the water shader. Refraction causes deep water to be more opaque and objects seen through the plane of the water to have a wavy appearance. Enabling this feature results in better visuals, and a marginally lower frame rate depending on your graphics hardware. +This setting enables the refraction rendering feature of the water shader. +Refraction causes deep water to be more opaque +and objects seen through the plane of the water to have a wavy appearance. +Enabling this feature results in better visuals, and a marginally lower frame rate depending on your graphics hardware. This setting has no effect if the shader setting is false. -The default setting is false. This setting can be toggled with the Refraction button in the Water tab of the Video panel of the Options menu. +This setting can be toggled with the Refraction button in the Water tab of the Video panel of the Options menu. reflect actors -------------- @@ -49,7 +65,8 @@ reflect actors :Range: True/False :Default: False -This setting controls whether or not NPCs and creatures are drawn in water reflections. Setting this to true will enable actors in reflections and increase realism with a likely decrease in performance. This setting is off by default. +This setting controls whether or not NPCs and creatures are drawn in water reflections. +Setting this to true will enable actors in reflections and increase realism with a likely decrease in performance. small feature culling pixel size -------------------------------- @@ -58,10 +75,14 @@ small feature culling pixel size :Range: > 0 :Default: 20.0 -Controls the cutoff in pixels for small feature culling - see the 'Camera' section for more details, however this setting in the 'Water' section applies specifically to objects rendered in water reflection and refraction textures. +Controls the cutoff in pixels for small feature culling - see the 'Camera' section for more details, +however this setting in the 'Water' section applies specifically to objects rendered in water reflection +and refraction textures. -The setting 'rtt size' interacts with this setting because it controls how large a pixel on the water texture (technically called a texel) is in pixels on the screen. +The setting 'rtt size' interacts with this setting +because it controls how large a pixel on the water texture (technically called a texel) is in pixels on the screen. -This setting will have no effect if the shader setting is false, or the 'small feature culling' (in the 'Camera' section) is disabled. +This setting will have no effect if the shader setting is false, +or the 'small feature culling' (in the 'Camera' section) is disabled. This setting can only be configured by editing the settings configuration file. diff --git a/docs/source/reference/modding/settings/windows.rst b/docs/source/reference/modding/settings/windows.rst index bafcac295..170f68381 100644 --- a/docs/source/reference/modding/settings/windows.rst +++ b/docs/source/reference/modding/settings/windows.rst @@ -4,16 +4,25 @@ Windows Settings :Type: floating point :Range: 0.0 to 1.0 -This section controls the location and size of each window in GUI mode. Each setting is a floating point number representing a *fraction* of the resolution x or resolution y setting in the Video Settings Section. The X and Y values locate the top left corner of the window, while the W value determines the width of the window and the H value determines the height of the window. +This section controls the location and size of each window in GUI mode. +Each setting is a floating point number representing a *fraction* +of the resolution x or resolution y setting in the Video Settings Section. +The X and Y values locate the top left corner of the window, +while the W value determines the width of the window and the H value determines the height of the window. -Unlike the documentation for most sections which lists the exact setting name, this page instead lists the names of the windows. For example, to configure the alchemy window, the actual settings would be:: +Unlike the documentation for most sections which lists the exact setting name, +this page instead lists the names of the windows. +For example, to configure the alchemy window, the actual settings would be:: alchemy x = 0.25 alchemy y = 0.25 alchemy h = 0.5 alchemy w = 0.5 -Each window in the GUI mode remembers it's previous location when exiting the game. By far the easiest way to configure these settings is to simply move the windows around in game. Hand editing the configuration file might result in some fine tuning for alignment, but the settings will be overwritten if a window is moved. +Each window in the GUI mode remembers it's previous location when exiting the game. +By far the easiest way to configure these settings is to simply move the windows around in game. +Hand editing the configuration file might result in some fine tuning for alignment, +but the settings will be overwritten if a window is moved. .. note:: To scale the windows, making the widgets proportionally larger, see the scaling factor setting instead. @@ -21,7 +30,8 @@ Each window in the GUI mode remembers it's previous location when exiting the ga :Type: boolean :Range: True/False -This section controls the state of pinnable windows: pinned or not. For example, to pin only the map window, the actual settings will be:: +This section controls the state of pinnable windows: pinned or not. +For example, to pin only the map window, the actual settings will be:: inventory pin = false map pin = true @@ -31,138 +41,209 @@ This section controls the state of pinnable windows: pinned or not. For example, The pinnable window can be pinned/unpinned by clicking on a button in the right upper corner of the window. .. note:: - A world/local map switch button on the map window will be showed only in GUI mode. + A world/local map switch button on the map window will be shown only in GUI mode. stats ----- -:Default: x = 0.0 - y = 0.0 - h = 0.375 - w = 0.4275 - pin = false +:Default: + x = 0.0 -The stats window, displaying level, race, class, skills and stats. Activated by clicking on any of the three bars in the lower left corner of the HUD. + y = 0.0 + + h = 0.375 + + w = 0.4275 + + pin = false + +The stats window, displaying level, race, class, skills and stats. +Activated by clicking on any of the three bars in the lower left corner of the HUD. spells ------ -:Default: x = 0.625 - y = 0.5725 - h = 0.375 - w = 0.4275 - pin = false +:Default: + x = 0.625 + + y = 0.5725 + + h = 0.375 -The spells window, displaying powers, spells, and magical items. Activated by clicking on the spells widget (third from left) in the bottom left corner of the HUD. + w = 0.4275 + + pin = false + +The spells window, displaying powers, spells, and magical items. +Activated by clicking on the spells widget (third from left) in the bottom left corner of the HUD. map --- -:Default: x = 0.625 - y = 0.0 - h = 0.375 - w = 0.5725 - pin = false +:Default: + x = 0.625 + + y = 0.0 + + h = 0.375 + + w = 0.5725 -The local and world map window. Activated by clicking on the map widget in the bottom right corner of the HUD. + pin = false + +The local and world map window. +Activated by clicking on the map widget in the bottom right corner of the HUD. inventory --------- -:Default: x = 0.0 - y = 0.4275 - h = 0.6225 - w = 0.5725 - pin = false +:Default: + x = 0.0 + + y = 0.4275 + + h = 0.6225 -The inventory window, displaying the paper doll and possessions, when activated by clicking on the inventory widget (second from left) in the bottom left corner of the HUD. + w = 0.5725 + + pin = false + +The inventory window, displaying the paper doll and possessions, +when activated by clicking on the inventory widget (second from left) in the bottom left corner of the HUD. inventory container ------------------- -:Default: x = 0.0 - y = 0.4275 - h = 0.6225 - w = 0.5725 +:Default: + x = 0.0 + + y = 0.4275 -The player's inventory window while searching a container, showing the contents of the character's inventory. Activated by clicking on a container. The same window is used for searching dead bodies, and pickpocketing people. + h = 0.6225 + + w = 0.5725 + + +The player's inventory window while searching a container, showing the contents of the character's inventory. +Activated by clicking on a container. The same window is used for searching dead bodies, and pickpocketing people. inventory barter ---------------- -:Default: x = 0.0 - y = 0.4275 - h = 0.6225 - w = 0.5725 +:Default: + x = 0.0 + + y = 0.4275 + + h = 0.6225 -The player's inventory window while bartering. It displays goods owned by the character while bartering. Activated by clicking on the Barter choice in the dialog window for an NPC. + w = 0.5725 + +The player's inventory window while bartering. It displays goods owned by the character while bartering. +Activated by clicking on the Barter choice in the dialog window for an NPC. inventory companion ------------------- -:Default: x = 0.0 - y = 0.4275 - h = 0.6225 - w = 0.5725 +:Default: + x = 0.0 + + y = 0.4275 + + h = 0.6225 -The player's inventory window while interacting with a companion. The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. + w = 0.5725 + +The player's inventory window while interacting with a companion. +The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. container --------- -:Default: x = 0.25 - y = 0.0 - h = 0.75 - w = 0.375 +:Default: + x = 0.25 + + y = 0.0 + + h = 0.75 -The container window, showing the contents of the container. Activated by clicking on a container. The same window is used for searching dead bodies, and pickpocketing people. + w = 0.375 + +The container window, showing the contents of the container. Activated by clicking on a container. +The same window is used for searching dead bodies, and pickpocketing people. barter ------ -:Default: x = 0.25 - y = 0.0 - h = 0.75 - w = 0.375 +:Default: + x = 0.25 + + y = 0.0 + + h = 0.75 -The NPC bartering window, displaying goods owned by the shopkeeper while bartering. Activated by clicking on the Barter choice in the dialog window for an NPC. + w = 0.375 + +The NPC bartering window, displaying goods owned by the shopkeeper while bartering. +Activated by clicking on the Barter choice in the dialog window for an NPC. companion --------- -:Default: x = 0.25 - y = 0.0 - h = 0.75 - w = 0.375 +:Default: + x = 0.25 + + y = 0.0 -The NPC's inventory window while interacting with a companion. The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. + h = 0.75 + + w = 0.375 + +The NPC's inventory window while interacting with a companion. +The companion windows were added in the Tribunal expansion, but are available everywhere in the OpenMW engine. dialogue -------- -:Default: x = 0.095 - y = 0.095 - h = 0.810 - w = 0.810 +:Default: + x = 0.095 + + y = 0.095 -The dialog window, for talking with NPCs. Activated by clicking on a NPC. + h = 0.810 + + w = 0.810 + +The dialog window, for talking with NPCs. +Activated by clicking on a NPC. alchemy ------- -:Default: x = 0.25 - y = 0.25 - h = 0.5 - w = 0.5 +:Default: + x = 0.25 + + y = 0.25 -The alchemy window, for crafting potions. Activated by dragging an alchemy tool on to the rag doll. Unlike most other windows, this window hides all other windows when opened. + h = 0.5 + + w = 0.5 + +The alchemy window, for crafting potions. +Activated by dragging an alchemy tool on to the rag doll. +Unlike most other windows, this window hides all other windows when opened. console ------- -:Default: x = 0.0 - y = 0.0 - h = 1.0 - w = 0.5 +:Default: + x = 0.0 + + y = 0.0 + + h = 1.0 + + w = 0.5 -The console command window. Activated by pressing the tilde (~) key. +The console command window. +Activated by pressing the tilde (~) key. diff --git a/docs/source/tutorial-style-guide.txt b/docs/source/tutorial-style-guide.txt index b37992057..d640d266c 100644 --- a/docs/source/tutorial-style-guide.txt +++ b/docs/source/tutorial-style-guide.txt @@ -7,7 +7,8 @@ Please contact Ravenwing about any questions relating to this guide. Foreword -------- -I shall try to be as brief as possible without sacrificing clarity, just as you should be when writing documentation. The SCOPE of this guide is limited to all non-source code documentation. +I shall try to be as brief as possible without sacrificing clarity, just as you should be when writing documentation. +The SCOPE of this guide is limited to all non-source code documentation. References ---------- @@ -20,27 +21,43 @@ Language -------- British English -Sorry, I'm American and I'll probably have a million relapses, but this seems to have been decided and uniformity is key! +Sorry, I'm American and I'll probably have a million relapses, +but this seems to have been decided and uniformity is key! Text Wrapping ------------- -DO NOT manually decide where each line ends! Enable text wrapping in your text editor! (usually under View) Even Notepad allows automatic text wrapping, so use it. If you program, you may be used to keeping your lines under 80 characters wide and manually pressing enter, but don't. This is because we are writing mostly prose. When someone has to come in and edit portions of text that puts all this out of alignment, it takes FOREVER to readjust everything. Plus, indentation is very important in ReST, and you may forget to indent properly. +After discussing the various benefits of manual and automatic linefeeds, +we've come to the conclusion that we should use semantic linefeeds with a hard max at 120 characters. +Basically this boils down manually inserting a line break where it makes sense within the phrasing. +I prefer to keep it at commas and periods because those are universal places people pause, +even while reading in their head. +It may look a little funny in plain text, but it is readable, +and none of this makes a difference in the final documentation. + +The reason this makes the most sense is GitHub won't text wrap automatically in RST documents, +and it also compares files based on lines. +This means you're less likely to run into conflicts and simply makes it easier to view changes. Indentations ------------ -This isn't as important, especially since Sphinx converts tabs to spaces, but I find it much easier to keep large blocks of things aligned if you just tab. If you can edit your tab width, please set it to 4 spaces. +This isn't as important, especially since Sphinx converts tabs to spaces, +but I find it much easier to keep large blocks of things aligned if you just tab. +If you can edit your tab width, please set it to 4 spaces. Spaces ------ -Use only one space after each sentence. Some people were taught two spaces, but this is a carry-over from typewriters. Even though your text editor is probably using monospaced characters like a typewriter, the formats Sphinx is converting into will make all the adjustments they need to be beautifully legible. +Use only one space after each sentence. Some people were taught two spaces, but this is a carry-over from typewriters. +Even though your text editor is probably using monospaced characters like a typewriter, +the formats Sphinx is converting into will make all the adjustments they need to be beautifully legible. Commas ------ -Oxford comma. Use it. I know this goes against using British English, but this is technical writing. You cannot assume our audience will know from context if the last two items in a list are grouped or not. +Oxford comma. Use it. I know this goes against using British English, but this is technical writing. +You cannot assume our audience will know from context if the last two items in a list are grouped or not. I also prefer parentheticals to commas around gerund phrases. Files and Extensions From 4f41c44cd6038bc98c496dcc29c066a15684f868 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 20 May 2017 18:30:11 +0400 Subject: [PATCH 097/318] Swap enchant type when clean selected soulgem widget (fixes #3878) --- apps/openmw/mwgui/enchantingdialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index e22891c9d..b83e5c0b1 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -273,7 +273,9 @@ namespace MWGui else { setSoulGem(MWWorld::Ptr()); + mEnchanting.nextCastStyle(); updateLabels(); + updateEffectsView(); } } From f17badb3cd9436e984571a332d77f2dd115bffb7 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 25 May 2017 13:09:40 +0400 Subject: [PATCH 098/318] Makes cells cache size configurable --- apps/openmw/mwworld/cells.cpp | 3 ++- docs/source/reference/modding/settings/cells.rst | 9 +++++++++ files/settings-default.cfg | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index 6cd495ee6..752659eb6 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -88,7 +89,7 @@ void MWWorld::Cells::writeCell (ESM::ESMWriter& writer, CellStore& cell) const MWWorld::Cells::Cells (const MWWorld::ESMStore& store, std::vector& reader) : mStore (store), mReader (reader), - mIdCache (40, std::pair ("", (CellStore*)0)), /// \todo make cache size configurable + mIdCache (Settings::Manager::getInt("pointers cache size", "Cells"), std::pair ("", (CellStore*)0)), mIdCacheIndex (0) {} diff --git a/docs/source/reference/modding/settings/cells.rst b/docs/source/reference/modding/settings/cells.rst index 6cda93194..bbde2fc32 100644 --- a/docs/source/reference/modding/settings/cells.rst +++ b/docs/source/reference/modding/settings/cells.rst @@ -164,3 +164,12 @@ cache expiry delay The amount of time (in seconds) that a preloaded texture or object will stay in cache after it is no longer referenced or required, for example, when all cells containing this texture have been unloaded. + +pointers cache size +------------------ + +:Type: integer +:Range: >0 +:Default: 40 + +The count of object pointers, that will be saved for a faster search by object ID. diff --git a/files/settings-default.cfg b/files/settings-default.cfg index ec3c2ade6..e7035af73 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -76,6 +76,9 @@ preload cell expiry delay = 5 # How long to keep models/textures/collision shapes in cache after they're no longer referenced/required (in seconds) cache expiry delay = 5 +# The count of pointers, that will be saved for a faster search by object ID. +pointers cache size = 40 + [Terrain] # If true, use paging and LOD algorithms to display the entire terrain. If false, only display terrain of the loaded cells From 46c88428088b3e2892c5e24a42bc8f3820cc664a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 26 May 2017 23:42:11 +0400 Subject: [PATCH 099/318] Fixed enchant points calculations formula --- apps/openmw/mwmechanics/enchanting.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwmechanics/enchanting.cpp b/apps/openmw/mwmechanics/enchanting.cpp index 714b5a09c..a658c379a 100644 --- a/apps/openmw/mwmechanics/enchanting.cpp +++ b/apps/openmw/mwmechanics/enchanting.cpp @@ -172,14 +172,14 @@ namespace MWMechanics const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); std::vector mEffects = mEffectList.mList; - float enchantmentCost = 0; - int effectsLeftCnt = mEffects.size(); + int enchantmentCost = 0; + float cost = 0; for (std::vector::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it) { float baseCost = (store.get().find(it->mEffectID))->mData.mBaseCost; - int magMin = (it->mMagnMin == 0) ? 1 : it->mMagnMin; - int magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax; - int area = (it->mArea == 0) ? 1 : it->mArea; + int magMin = std::max(1, it->mMagnMin); + int magMax = std::max(1, it->mMagnMax); + int area = std::max(1, it->mArea); float magnitudeCost = (magMin + magMax) * baseCost * 0.05f; if (mCastStyle == ESM::Enchantment::ConstantEffect) @@ -195,16 +195,17 @@ namespace MWMechanics const float fEffectCostMult = store.get().find("fEffectCostMult")->getFloat(); - float cost = (magnitudeCost + areaCost) * fEffectCostMult; + cost += (magnitudeCost + areaCost) * fEffectCostMult; + + cost = std::max(1.f, cost); + if (it->mRange == ESM::RT_Target) cost *= 1.5; - enchantmentCost += cost * effectsLeftCnt; - enchantmentCost = std::max(1.f, enchantmentCost); - --effectsLeftCnt; + enchantmentCost += static_cast(cost); } - return static_cast(enchantmentCost); + return enchantmentCost; } From 5d85fa922075a67a64bf7122dc5d21c2cda60410 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 28 May 2017 17:30:01 +0200 Subject: [PATCH 100/318] Fix build with osg >= 3.5.6 --- components/resource/bulletshapemanager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/resource/bulletshapemanager.cpp b/components/resource/bulletshapemanager.cpp index ef35b31ef..010917572 100644 --- a/components/resource/bulletshapemanager.cpp +++ b/components/resource/bulletshapemanager.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -42,7 +43,11 @@ struct GetTriangleFunctor return btVector3(vec.x(), vec.y(), vec.z()); } +#if OSG_MIN_VERSION_REQUIRED(3,5,6) + void inline operator()( const osg::Vec3 v1, const osg::Vec3 v2, const osg::Vec3 v3 ) +#else void inline operator()( const osg::Vec3 v1, const osg::Vec3 v2, const osg::Vec3 v3, bool _temp ) +#endif { if (mTriMesh) mTriMesh->addTriangle( toBullet(mMatrix.preMult(v1)), toBullet(mMatrix.preMult(v2)), toBullet(mMatrix.preMult(v3))); From 2b28d1a6d245649bc5a0973c2f0b8022148936c2 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 30 May 2017 17:15:10 +0400 Subject: [PATCH 101/318] Select specialization menu layout fix --- files/mygui/openmw_chargen_select_specialization.layout | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/mygui/openmw_chargen_select_specialization.layout b/files/mygui/openmw_chargen_select_specialization.layout index 70c5fdca5..c4fe6c631 100644 --- a/files/mygui/openmw_chargen_select_specialization.layout +++ b/files/mygui/openmw_chargen_select_specialization.layout @@ -1,13 +1,13 @@ - + - + - + From 6c21e4ed31b1c1a03edc7b7c675b5b74f641d8a8 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 31 May 2017 18:41:41 +0400 Subject: [PATCH 102/318] Spell priority: ignore some effects useless in battle --- apps/openmw/mwmechanics/aicombataction.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 1082c540b..4add589b9 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -264,6 +264,13 @@ namespace MWMechanics case ESM::MagicEffect::ResistCorprusDisease: case ESM::MagicEffect::Invisibility: case ESM::MagicEffect::Chameleon: + case ESM::MagicEffect::NightEye: + case ESM::MagicEffect::Vampirism: + case ESM::MagicEffect::StuntedMagicka: + case ESM::MagicEffect::ExtraSpell: + case ESM::MagicEffect::RemoveCurse: + case ESM::MagicEffect::CommandCreature: + case ESM::MagicEffect::CommandHumanoid: return 0.f; case ESM::MagicEffect::Sound: @@ -295,6 +302,8 @@ namespace MWMechanics case ESM::MagicEffect::ResistParalysis: case ESM::MagicEffect::ResistPoison: case ESM::MagicEffect::ResistShock: + case ESM::MagicEffect::SpellAbsorption: + case ESM::MagicEffect::Reflect: return 0.f; // probably useless since we don't know in advance what the enemy will cast // don't cast these for now as they would make the NPC cast the same effect over and over again, especially when they have potions @@ -304,6 +313,7 @@ namespace MWMechanics case ESM::MagicEffect::FortifyFatigue: case ESM::MagicEffect::FortifySkill: case ESM::MagicEffect::FortifyMaximumMagicka: + case ESM::MagicEffect::FortifyAttack: return 0.f; case ESM::MagicEffect::Feather: From 1164c3f16e44d12c8338bec770b99be0df8fceee Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Apr 2017 16:52:56 +0400 Subject: [PATCH 103/318] Improved recharge widget --- apps/openmw/mwgui/recharge.cpp | 37 ++++++++++++++++++++ apps/openmw/mwgui/recharge.hpp | 10 ++++++ files/mygui/openmw_recharge_dialog.layout | 41 ++++++++++++----------- 3 files changed, 68 insertions(+), 20 deletions(-) diff --git a/apps/openmw/mwgui/recharge.cpp b/apps/openmw/mwgui/recharge.cpp index afca12ad9..f97d8dbf8 100644 --- a/apps/openmw/mwgui/recharge.cpp +++ b/apps/openmw/mwgui/recharge.cpp @@ -33,6 +33,7 @@ namespace MWGui Recharge::Recharge() : WindowBase("openmw_recharge_dialog.layout") + , mItemSelectionDialog(NULL) { getWidget(mBox, "Box"); getWidget(mGemBox, "GemBox"); @@ -45,6 +46,8 @@ Recharge::Recharge() mBox->setDisplayMode(ItemChargeView::DisplayMode_EnchantmentCharge); + mGemIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onSelectItem); + setVisible(false); } @@ -87,6 +90,12 @@ void Recharge::updateView() mGemBox->setVisible(toolBoxVisible); mGemBox->setUserString("Hidden", toolBoxVisible ? "false" : "true"); + if (!toolBoxVisible) + { + mGemIcon->setItem(MWWorld::Ptr()); + mGemIcon->clearUserStrings(); + } + mBox->update(); Gui::Box* box = dynamic_cast(mMainWidget); @@ -102,6 +111,34 @@ void Recharge::onCancel(MyGUI::Widget *sender) exit(); } +void Recharge::onSelectItem(MyGUI::Widget *sender) +{ + delete mItemSelectionDialog; + mItemSelectionDialog = new ItemSelectionDialog("#{sSoulGemsWithSouls}"); + mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &Recharge::onItemSelected); + mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &Recharge::onItemCancel); + mItemSelectionDialog->setVisible(true); + mItemSelectionDialog->openContainer(MWMechanics::getPlayer()); + mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyChargedSoulstones); +} + +void Recharge::onItemSelected(MWWorld::Ptr item) +{ + mItemSelectionDialog->setVisible(false); + + mGemIcon->setItem(item); + mGemIcon->setUserString ("ToolTipType", "ItemPtr"); + mGemIcon->setUserData(item); + + MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); + updateView(); +} + +void Recharge::onItemCancel() +{ + mItemSelectionDialog->setVisible(false); +} + void Recharge::onItemClicked(MyGUI::Widget *sender, const MWWorld::Ptr& item) { MWWorld::Ptr gem = *mGemIcon->getUserData(); diff --git a/apps/openmw/mwgui/recharge.hpp b/apps/openmw/mwgui/recharge.hpp index bbcf994dd..cc3db14df 100644 --- a/apps/openmw/mwgui/recharge.hpp +++ b/apps/openmw/mwgui/recharge.hpp @@ -3,6 +3,8 @@ #include "windowbase.hpp" +#include "itemselection.hpp" + namespace MWWorld { class Ptr; @@ -11,6 +13,7 @@ namespace MWWorld namespace MWGui { +class ItemSelectionDialog; class ItemWidget; class ItemChargeView; @@ -32,12 +35,19 @@ protected: ItemWidget* mGemIcon; + ItemSelectionDialog* mItemSelectionDialog; + MyGUI::TextBox* mChargeLabel; MyGUI::Button* mCancelButton; void updateView(); + void onSelectItem(MyGUI::Widget* sender); + + void onItemSelected(MWWorld::Ptr item); + void onItemCancel(); + void onItemClicked (MyGUI::Widget* sender, const MWWorld::Ptr& item); void onCancel (MyGUI::Widget* sender); void onMouseWheel(MyGUI::Widget* _sender, int _rel); diff --git a/files/mygui/openmw_recharge_dialog.layout b/files/mygui/openmw_recharge_dialog.layout index 9301bec92..d620aadab 100644 --- a/files/mygui/openmw_recharge_dialog.layout +++ b/files/mygui/openmw_recharge_dialog.layout @@ -1,22 +1,12 @@ - + - - - - - - - - - - - - + + @@ -26,14 +16,25 @@ - - - - - - + + + + + + + + + + + + + + + + + + - From 10d4cb15ad609389080d77e4dea47cd43e454579 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Apr 2017 23:06:13 +0400 Subject: [PATCH 104/318] Improved repair widget --- apps/openmw/mwgui/repair.cpp | 43 ++++++++++++++- apps/openmw/mwgui/repair.hpp | 10 ++++ apps/openmw/mwgui/sortfilteritemmodel.cpp | 2 + apps/openmw/mwgui/sortfilteritemmodel.hpp | 1 + .../mygui/openmw_itemselection_dialog.layout | 2 +- files/mygui/openmw_repair.layout | 54 ++++++++++--------- 6 files changed, 85 insertions(+), 27 deletions(-) diff --git a/apps/openmw/mwgui/repair.cpp b/apps/openmw/mwgui/repair.cpp index 3acea985b..156f4412b 100644 --- a/apps/openmw/mwgui/repair.cpp +++ b/apps/openmw/mwgui/repair.cpp @@ -30,6 +30,7 @@ namespace MWGui Repair::Repair() : WindowBase("openmw_repair.layout") + , mItemSelectionDialog(NULL) { getWidget(mRepairBox, "RepairBox"); getWidget(mToolBox, "ToolBox"); @@ -39,9 +40,11 @@ Repair::Repair() getWidget(mCancelButton, "CancelButton"); mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onCancel); - mRepairBox->eventItemClicked += MyGUI::newDelegate(this, &Repair::onRepairItem); + mRepairBox->eventItemClicked += MyGUI::newDelegate(this, &Repair::onRepairItem); mRepairBox->setDisplayMode(ItemChargeView::DisplayMode_Health); + + mToolIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onSelectItem); } void Repair::open() @@ -83,6 +86,8 @@ void Repair::updateRepairView() float quality = ref->mBase->mData.mQuality; + mToolIcon->setUserData(mRepair.getTool()); + std::stringstream qualityStr; qualityStr << std::setprecision(3) << quality; @@ -93,6 +98,12 @@ void Repair::updateRepairView() mToolBox->setVisible(toolBoxVisible); mToolBox->setUserString("Hidden", toolBoxVisible ? "false" : "true"); + if (!toolBoxVisible) + { + mToolIcon->setItem(MWWorld::Ptr()); + mToolIcon->clearUserStrings(); + } + mRepairBox->update(); Gui::Box* box = dynamic_cast(mMainWidget); @@ -103,6 +114,36 @@ void Repair::updateRepairView() center(); } +void Repair::onSelectItem(MyGUI::Widget *sender) +{ + delete mItemSelectionDialog; + mItemSelectionDialog = new ItemSelectionDialog("#{sRepair}"); + mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &Repair::onItemSelected); + mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &Repair::onItemCancel); + mItemSelectionDialog->setVisible(true); + mItemSelectionDialog->openContainer(MWMechanics::getPlayer()); + mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyRepairTools); +} + +void Repair::onItemSelected(MWWorld::Ptr item) +{ + mItemSelectionDialog->setVisible(false); + + mToolIcon->setItem(item); + mToolIcon->setUserString ("ToolTipType", "ItemPtr"); + mToolIcon->setUserData(item); + + mRepair.setTool(item); + + MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); + updateRepairView(); +} + +void Repair::onItemCancel() +{ + mItemSelectionDialog->setVisible(false); +} + void Repair::onCancel(MyGUI::Widget* /*sender*/) { exit(); diff --git a/apps/openmw/mwgui/repair.hpp b/apps/openmw/mwgui/repair.hpp index 8746f7dc4..c50ba861a 100644 --- a/apps/openmw/mwgui/repair.hpp +++ b/apps/openmw/mwgui/repair.hpp @@ -3,11 +3,14 @@ #include "windowbase.hpp" +#include "itemselection.hpp" + #include "../mwmechanics/repair.hpp" namespace MWGui { +class ItemSelectionDialog; class ItemWidget; class ItemChargeView; @@ -29,6 +32,8 @@ protected: ItemWidget* mToolIcon; + ItemSelectionDialog* mItemSelectionDialog; + MyGUI::TextBox* mUsesLabel; MyGUI::TextBox* mQualityLabel; @@ -38,6 +43,11 @@ protected: void updateRepairView(); + void onSelectItem(MyGUI::Widget* sender); + + void onItemSelected(MWWorld::Ptr item); + void onItemCancel(); + void onRepairItem(MyGUI::Widget* sender, const MWWorld::Ptr& ptr); void onCancel(MyGUI::Widget* sender); diff --git a/apps/openmw/mwgui/sortfilteritemmodel.cpp b/apps/openmw/mwgui/sortfilteritemmodel.cpp index 09438b950..60111fb79 100644 --- a/apps/openmw/mwgui/sortfilteritemmodel.cpp +++ b/apps/openmw/mwgui/sortfilteritemmodel.cpp @@ -129,6 +129,8 @@ namespace MWGui if ((mFilter & Filter_OnlyChargedSoulstones) && (base.getTypeName() != typeid(ESM::Miscellaneous).name() || base.getCellRef().getSoul() == "")) return false; + if ((mFilter & Filter_OnlyRepairTools) && (base.getTypeName() != typeid(ESM::Repair).name())) + return false; if ((mFilter & Filter_OnlyEnchantable) && (item.mFlags & ItemStack::Flag_Enchanted || (base.getTypeName() != typeid(ESM::Armor).name() && base.getTypeName() != typeid(ESM::Clothing).name() diff --git a/apps/openmw/mwgui/sortfilteritemmodel.hpp b/apps/openmw/mwgui/sortfilteritemmodel.hpp index 3d5396e2a..4731cbb8a 100644 --- a/apps/openmw/mwgui/sortfilteritemmodel.hpp +++ b/apps/openmw/mwgui/sortfilteritemmodel.hpp @@ -41,6 +41,7 @@ namespace MWGui static const int Filter_OnlyUsableItems = (1<<4); // Only items with a Use action static const int Filter_OnlyRepairable = (1<<5); static const int Filter_OnlyRechargable = (1<<6); + static const int Filter_OnlyRepairTools = (1<<7); private: diff --git a/files/mygui/openmw_itemselection_dialog.layout b/files/mygui/openmw_itemselection_dialog.layout index 5ae30563a..b2337b669 100644 --- a/files/mygui/openmw_itemselection_dialog.layout +++ b/files/mygui/openmw_itemselection_dialog.layout @@ -1,6 +1,6 @@ - + diff --git a/files/mygui/openmw_repair.layout b/files/mygui/openmw_repair.layout index 9a349c56b..340711bb1 100644 --- a/files/mygui/openmw_repair.layout +++ b/files/mygui/openmw_repair.layout @@ -1,26 +1,13 @@ - + - - - - - - - - - - - - - - - - + + + @@ -29,14 +16,31 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - From f6c3d4935e28d626805120c5ff9e343cda39e722 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 31 May 2017 19:23:44 +0400 Subject: [PATCH 105/318] Spell priority: feather and burden --- apps/openmw/mwmechanics/aicombataction.cpp | 44 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 4add589b9..d0464418b 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -316,11 +316,47 @@ namespace MWMechanics case ESM::MagicEffect::FortifyAttack: return 0.f; + case ESM::MagicEffect::Burden: + { + if (enemy.isEmpty()) + return 0.f; + + // Ignore enemy without inventory + if (!enemy.getClass().hasInventoryStore(enemy)) + return 0.f; + + // burden makes sense only to overburden an enemy + float burden = enemy.getClass().getEncumbrance(enemy) - enemy.getClass().getCapacity(enemy); + if (burden > 0) + return 0.f; + + if ((effect.mMagnMin + effect.mMagnMax)/2.f > -burden) + rating *= 3; + else + return 0.f; + + break; + } + case ESM::MagicEffect::Feather: - if (actor.getClass().getEncumbrance(actor) - actor.getClass().getCapacity(actor) >= 0) - return 100.f; - else - return 0.f; + { + // Ignore actors without inventory + if (!actor.getClass().hasInventoryStore(actor)) + return 0.f; + + // feather makes sense only for overburden actors + float burden = actor.getClass().getEncumbrance(actor) - actor.getClass().getCapacity(actor); + if (burden <= 0) + return 0.f; + + if ((effect.mMagnMin + effect.mMagnMax)/2.f >= burden) + rating *= 3; + else + return 0.f; + + break; + } + case ESM::MagicEffect::Levitate: return 0.f; // AI isn't designed to take advantage of this, and could be perceived as unfair anyway case ESM::MagicEffect::BoundBoots: From f6f07f549714db617957cbba6328cf317e378825 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Thu, 1 Jun 2017 16:33:52 -0500 Subject: [PATCH 106/318] clear mGoToJail flag on load --- apps/openmw/mwworld/worldimp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 217a06ee1..0421ecb24 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -309,6 +309,7 @@ namespace MWWorld mDoorStates.clear(); + mGoToJail = false; mTeleportEnabled = true; mLevitationEnabled = true; From 224fcc9a4a1883f0719f2f1f38c359f96b1eb176 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 3 Jun 2017 10:42:49 +0200 Subject: [PATCH 107/318] [macOS, CI] Fix dependency installation --- CI/before_install.osx.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CI/before_install.osx.sh b/CI/before_install.osx.sh index 2d20eb9a0..d7ef405bb 100755 --- a/CI/before_install.osx.sh +++ b/CI/before_install.osx.sh @@ -2,10 +2,9 @@ brew update -brew rm cmake || true -brew rm pkgconfig || true -brew rm qt5 || true -brew install cmake pkgconfig $macos_qt_formula +brew outdated cmake || brew upgrade cmake +brew outdated pkgconfig || brew upgrade pkgconfig +brew install $macos_qt_formula curl https://downloads.openmw.org/osx/dependencies/openmw-deps-c79172d.zip -o ~/openmw-deps.zip unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null From 42f3c73c7540006d48d5190d2d1354cfbed1d26e Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 3 Jun 2017 13:16:44 +0400 Subject: [PATCH 108/318] Spell priority: dispel usage improvements --- apps/openmw/mwmechanics/aicombataction.cpp | 59 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index d0464418b..1acf2f041 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -61,7 +61,7 @@ float suggestCombatRange(int rangeTypes) } } -int numEffectsToCure (const MWWorld::Ptr& actor, int effectFilter=-1) +int numEffectsToDispel (const MWWorld::Ptr& actor, int effectFilter=-1, bool negative = true) { int toCure=0; const MWMechanics::ActiveSpells& activeSpells = actor.getClass().getCreatureStats(actor).getActiveSpells(); @@ -75,9 +75,14 @@ int numEffectsToCure (const MWWorld::Ptr& actor, int effectFilter=-1) if (effectFilter != -1 && effectId != effectFilter) continue; const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effectId); - if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful - && effectIt->mDuration > 3 // Don't attempt to cure if effect runs out shortly anyway - ) + + if (effectIt->mDuration <= 3) // Don't attempt to dispel if effect runs out shortly anyway + continue; + + if (negative && magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) + ++toCure; + + if (!negative && !(magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)) ++toCure; } } @@ -400,14 +405,49 @@ namespace MWMechanics } break; - // Prefer Cure effects over Dispel, because Dispel also removes positive effects case ESM::MagicEffect::Dispel: - return 1000.f * numEffectsToCure(actor); + { + int numPositive = 0; + int numNegative = 0; + int diff = 0; + + if (effect.mRange == ESM::RT_Self) + { + numPositive = numEffectsToDispel(actor, -1, false); + numNegative = numEffectsToDispel(actor); + + diff = numNegative - numPositive; + } + else + { + if (enemy.isEmpty()) + return 0.f; + + numPositive = numEffectsToDispel(enemy, -1, false); + numNegative = numEffectsToDispel(enemy); + + diff = numPositive - numNegative; + + // if rating < 0 here, the spell will be considered as negative later + rating *= -1; + } + + if (diff <= 0) + return 0.f; + + int magnitude = (effect.mMagnMin + effect.mMagnMax) / 2; + + rating *= (diff) / 5.f; + + break; + } + + // Prefer Cure effects over Dispel, because Dispel also removes positive effects case ESM::MagicEffect::CureParalyzation: - return 1001.f * numEffectsToCure(actor, ESM::MagicEffect::Paralyze); - case ESM::MagicEffect::CurePoison: - return 1001.f * numEffectsToCure(actor, ESM::MagicEffect::Poison); + return 1001.f * numEffectsToDispel(actor, ESM::MagicEffect::Paralyze); + case ESM::MagicEffect::CurePoison: + return 1001.f * numEffectsToDispel(actor, ESM::MagicEffect::Poison); case ESM::MagicEffect::DisintegrateArmor: { if (enemy.isEmpty()) @@ -555,6 +595,7 @@ namespace MWMechanics // Combat AI is egoistic, so doesn't consider applying positive effects to friendly actors. if (effect.mRange != ESM::RT_Self) rating *= -1.f; + return rating; } From 9a1ba1e559d3fe6630f4e1766534b6b3dc487779 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 1 Jun 2017 10:00:15 +0400 Subject: [PATCH 109/318] Show success chance when self-enchanting (Feature #3492) --- apps/openmw/mwgui/enchantingdialog.cpp | 16 ++++++++++++++++ apps/openmw/mwgui/enchantingdialog.hpp | 3 +++ docs/source/reference/modding/settings/GUI.rst | 11 +++++++++++ files/mygui/openmw_enchanting_dialog.layout | 13 ++++++++++++- files/settings-default.cfg | 3 +++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index b83e5c0b1..8d8440626 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -8,6 +8,7 @@ #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -43,6 +44,8 @@ namespace MWGui getWidget(mEnchantmentPoints, "Enchantment"); getWidget(mCastCost, "CastCost"); getWidget(mCharge, "Charge"); + getWidget(mSuccessChance, "SuccessChance"); + getWidget(mChanceLayout, "ChanceLayout"); getWidget(mTypeButton, "TypeButton"); getWidget(mBuyButton, "BuyButton"); getWidget(mPrice, "PriceLabel"); @@ -115,6 +118,9 @@ namespace MWGui mCharge->setCaption(MyGUI::utility::toString(mEnchanting.getGemCharge())); + int successChance = int(mEnchanting.getEnchantChance()); + mSuccessChance->setCaption(MyGUI::utility::toString(std::max(0, successChance))); + std::stringstream castCost; castCost << mEnchanting.getEffectiveCastCost(); mCastCost->setCaption(castCost.str()); @@ -144,11 +150,15 @@ namespace MWGui void EnchantingDialog::startEnchanting (MWWorld::Ptr actor) { + mName->setCaption(""); + mEnchanting.setSelfEnchanting(false); mEnchanting.setEnchanter(actor); mBuyButton->setCaptionWithReplacing("#{sBuy}"); + mChanceLayout->setVisible(false); + mPtr = actor; setSoulGem(MWWorld::Ptr()); @@ -162,6 +172,8 @@ namespace MWGui void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem) { + mName->setCaption(""); + MWWorld::Ptr player = MWMechanics::getPlayer(); mEnchanting.setSelfEnchanting(true); @@ -169,6 +181,10 @@ namespace MWGui mBuyButton->setCaptionWithReplacing("#{sCreate}"); + bool enabled = Settings::Manager::getBool("show enchant chance","GUI"); + + mChanceLayout->setVisible(enabled); + mPtr = player; startEditing(); diff --git a/apps/openmw/mwgui/enchantingdialog.hpp b/apps/openmw/mwgui/enchantingdialog.hpp index 5b67d199b..cb7c6c0d0 100644 --- a/apps/openmw/mwgui/enchantingdialog.hpp +++ b/apps/openmw/mwgui/enchantingdialog.hpp @@ -49,6 +49,8 @@ namespace MWGui ItemSelectionDialog* mItemSelectionDialog; + MyGUI::Widget* mChanceLayout; + MyGUI::Button* mCancelButton; ItemWidget* mItemBox; ItemWidget* mSoulBox; @@ -60,6 +62,7 @@ namespace MWGui MyGUI::TextBox* mEnchantmentPoints; MyGUI::TextBox* mCastCost; MyGUI::TextBox* mCharge; + MyGUI::TextBox* mSuccessChance; MyGUI::TextBox* mPrice; MyGUI::TextBox* mPriceText; diff --git a/docs/source/reference/modding/settings/GUI.rst b/docs/source/reference/modding/settings/GUI.rst index ad3514ffa..cdc3bd889 100644 --- a/docs/source/reference/modding/settings/GUI.rst +++ b/docs/source/reference/modding/settings/GUI.rst @@ -127,3 +127,14 @@ The default value is "1.0 0.15 0.15 1.0" which is a bright red color. This setting can only be configured by editing the settings configuration file. This setting has no effect if the crosshair setting in the HUD Settings Section is false. This setting has no effect if the show owned setting in the Game Settings Section is false. + +show enchant chance +---------------- + +:Type: boolean +:Range: True/False +:Default: False + +Whether or not the chance of success will be displayed in the enchanting menu. + +The default value is false. This setting can only be configured by editing the settings configuration file. diff --git a/files/mygui/openmw_enchanting_dialog.layout b/files/mygui/openmw_enchanting_dialog.layout index ce9429c67..6a08e6fd0 100644 --- a/files/mygui/openmw_enchanting_dialog.layout +++ b/files/mygui/openmw_enchanting_dialog.layout @@ -52,7 +52,7 @@ - + @@ -95,6 +95,17 @@ + + + + + + + + + + + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index e7035af73..0a1af81b1 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -141,6 +141,9 @@ werewolf overlay = true color background owned = 0.15 0.0 0.0 1.0 color crosshair owned = 1.0 0.15 0.15 1.0 +# Show success probability in self-enchant dialog +show enchant chance = false + [HUD] # Displays the crosshair or reticle when not in GUI mode. From f4a187a9c289b9c1bb7431488b2f1cf2a821d959 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 3 Jun 2017 23:03:24 +0400 Subject: [PATCH 110/318] Move a setting to show enchanting success chance from GUI to Game section --- apps/openmw/mwgui/enchantingdialog.cpp | 2 +- docs/source/reference/modding/settings/GUI.rst | 11 ----------- docs/source/reference/modding/settings/game.rst | 11 +++++++++++ files/settings-default.cfg | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index 8d8440626..e44dc6fcc 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -181,7 +181,7 @@ namespace MWGui mBuyButton->setCaptionWithReplacing("#{sCreate}"); - bool enabled = Settings::Manager::getBool("show enchant chance","GUI"); + bool enabled = Settings::Manager::getBool("show enchant chance","Game"); mChanceLayout->setVisible(enabled); diff --git a/docs/source/reference/modding/settings/GUI.rst b/docs/source/reference/modding/settings/GUI.rst index cdc3bd889..ad3514ffa 100644 --- a/docs/source/reference/modding/settings/GUI.rst +++ b/docs/source/reference/modding/settings/GUI.rst @@ -127,14 +127,3 @@ The default value is "1.0 0.15 0.15 1.0" which is a bright red color. This setting can only be configured by editing the settings configuration file. This setting has no effect if the crosshair setting in the HUD Settings Section is false. This setting has no effect if the show owned setting in the Game Settings Section is false. - -show enchant chance ----------------- - -:Type: boolean -:Range: True/False -:Default: False - -Whether or not the chance of success will be displayed in the enchanting menu. - -The default value is false. This setting can only be configured by editing the settings configuration file. diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index d5828ee12..62fe5a70e 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -40,6 +40,17 @@ If this setting is true, melee weapons reach and speed will be showed on item to The default value is false. This setting can only be configured by editing the settings configuration file. +show enchant chance +------------------- + +:Type: boolean +:Range: True/False +:Default: False + +Whether or not the chance of success will be displayed in the enchanting menu. + +The default value is false. This setting can only be configured by editing the settings configuration file. + best attack ----------- diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 0a1af81b1..9c3667a6e 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -141,9 +141,6 @@ werewolf overlay = true color background owned = 0.15 0.0 0.0 1.0 color crosshair owned = 1.0 0.15 0.15 1.0 -# Show success probability in self-enchant dialog -show enchant chance = false - [HUD] # Displays the crosshair or reticle when not in GUI mode. @@ -161,6 +158,9 @@ show projectile damage = false # Show additional melee weapon info: reach and attack speed show melee info = false +# Show success probability in self-enchant dialog +show enchant chance = false + # Always use the best mode of attack: e.g. chop, slash or thrust. best attack = false From d6b97604ba690c7c78020ca68ac0b5c7e0246f1a Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 4 Jun 2017 11:19:28 +0200 Subject: [PATCH 111/318] Update AUTHORS.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 158e16ee6..d119c9b1a 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -108,6 +108,7 @@ Programmers Narmo Nathan Jeffords (blunted2night) NeveHanter + Nialsy Nikolay Kasyanov (corristo) nobrakal Nolan Poe (nopoe) From 00402b71545c0957eb91cf2cc5c87320c3503111 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 4 Jun 2017 14:09:23 +0400 Subject: [PATCH 112/318] Removed unused variable --- apps/openmw/mwmechanics/aicombataction.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 1acf2f041..37b67c9b2 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -435,8 +435,6 @@ namespace MWMechanics if (diff <= 0) return 0.f; - int magnitude = (effect.mMagnMin + effect.mMagnMax) / 2; - rating *= (diff) / 5.f; break; From 6f878327bf28544e33a90edf3b0ad6da1aa42d7b Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 4 Jun 2017 12:50:25 +0200 Subject: [PATCH 113/318] Fix unused ICS_MAX warning --- extern/oics/ICSInputControlSystem.cpp | 2 ++ extern/oics/ICSInputControlSystem.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/extern/oics/ICSInputControlSystem.cpp b/extern/oics/ICSInputControlSystem.cpp index a8aedfd2e..8bb9c4638 100644 --- a/extern/oics/ICSInputControlSystem.cpp +++ b/extern/oics/ICSInputControlSystem.cpp @@ -28,6 +28,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace ICS { + const float ICS_MAX = std::numeric_limits::max(); + InputControlSystem::InputControlSystem(std::string file, bool active , DetectingBindingListener* detectingBindingListener , InputControlSystemLog* log, size_t channelCount) diff --git a/extern/oics/ICSInputControlSystem.h b/extern/oics/ICSInputControlSystem.h index a82a11d75..691a93725 100644 --- a/extern/oics/ICSInputControlSystem.h +++ b/extern/oics/ICSInputControlSystem.h @@ -236,7 +236,7 @@ namespace ICS }; - static const float ICS_MAX = std::numeric_limits::max(); + extern const float ICS_MAX; } From 7704dcfcce3b43b7a20b4f0452e601b094267ee9 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sun, 28 May 2017 17:30:01 +0200 Subject: [PATCH 114/318] Fix build with osg >= 3.5.6 --- components/resource/bulletshapemanager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/resource/bulletshapemanager.cpp b/components/resource/bulletshapemanager.cpp index ef35b31ef..010917572 100644 --- a/components/resource/bulletshapemanager.cpp +++ b/components/resource/bulletshapemanager.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -42,7 +43,11 @@ struct GetTriangleFunctor return btVector3(vec.x(), vec.y(), vec.z()); } +#if OSG_MIN_VERSION_REQUIRED(3,5,6) + void inline operator()( const osg::Vec3 v1, const osg::Vec3 v2, const osg::Vec3 v3 ) +#else void inline operator()( const osg::Vec3 v1, const osg::Vec3 v2, const osg::Vec3 v3, bool _temp ) +#endif { if (mTriMesh) mTriMesh->addTriangle( toBullet(mMatrix.preMult(v1)), toBullet(mMatrix.preMult(v2)), toBullet(mMatrix.preMult(v3))); From c2962ced907b689811e743bb26cfcca845f7e4d5 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 4 Jun 2017 23:20:43 +0400 Subject: [PATCH 115/318] Removed empty space before dialogue entry (bug #3892) --- apps/openmw/mwgui/dialogue.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 771e1bf95..c03673b90 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -116,10 +116,14 @@ namespace MWGui void Response::write(BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map& topicLinks) const { BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("header")); - typesetter->sectionBreak(9); + if (mTitle != "") + { + typesetter->sectionBreak(9); typesetter->write(title, to_utf8_span(mTitle.c_str())); - typesetter->sectionBreak(9); + } + + typesetter->sectionBreak(); typedef std::pair Range; std::map hyperLinks; From 4bb9622c216933c0746450cf2043aa997ece56ec Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 8 Jun 2017 22:40:31 +0400 Subject: [PATCH 116/318] Handle greetings differently from responses --- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 2 +- apps/openmw/mwgui/dialogue.cpp | 15 +++++++-------- apps/openmw/mwgui/dialogue.hpp | 5 +++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 38ad821cd..fa5bfbe2f 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -170,7 +170,7 @@ namespace MWDialogue parseText (info->mResponse); MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor); - win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext)); + win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext), "", false); executeScript (info->mResultScript, mActor); mLastTopic = Misc::StringUtils::lowerCase(it->mId); diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index c03673b90..11c35c09e 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -107,24 +107,23 @@ namespace MWGui // -------------------------------------------------------------------------------------------------- - Response::Response(const std::string &text, const std::string &title) - : mTitle(title) + Response::Response(const std::string &text, const std::string &title, bool needMargin) + : mTitle(title), mNeedMargin(needMargin) { mText = text; } void Response::write(BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map& topicLinks) const { - BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("header")); + typesetter->sectionBreak(mNeedMargin ? 9 : 0); if (mTitle != "") { - typesetter->sectionBreak(9); + BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("header")); typesetter->write(title, to_utf8_span(mTitle.c_str())); + typesetter->sectionBreak(); } - typesetter->sectionBreak(); - typedef std::pair Range; std::map hyperLinks; @@ -554,7 +553,7 @@ namespace MWGui mHistory->setPosition(0, static_cast(pos) * -1); } - void DialogueWindow::addResponse(const std::string &text, const std::string &title) + void DialogueWindow::addResponse(const std::string &text, const std::string &title, bool needMargin) { // This is called from the dialogue manager, so text is // case-smashed - thus we have to retrieve the correct case @@ -573,7 +572,7 @@ namespace MWGui } } - mHistoryContents.push_back(new Response(text, realTitle)); + mHistoryContents.push_back(new Response(text, realTitle, needMargin)); updateHistory(); } diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index d34574e89..e1e427b3f 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -82,10 +82,11 @@ namespace MWGui struct Response : DialogueText { - Response(const std::string& text, const std::string& title = ""); + Response(const std::string& text, const std::string& title = "", bool needMargin = true); virtual void write (BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map& topicLinks) const; void addTopicLink (BookTypesetter::Ptr typesetter, intptr_t topicId, size_t begin, size_t end) const; std::string mTitle; + bool mNeedMargin; }; struct Message : DialogueText @@ -109,7 +110,7 @@ namespace MWGui void startDialogue(MWWorld::Ptr actor, std::string npcName, bool resetHistory); void setKeywords(std::list keyWord); - void addResponse (const std::string& text, const std::string& title=""); + void addResponse (const std::string& text, const std::string& title="", bool needMargin = true); void addMessageBox(const std::string& text); From 3190f287100ed1a152bd8203ceaaec1d88ed59de Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 9 Jun 2017 10:23:46 +0400 Subject: [PATCH 117/318] Spell priority: make AI do not cast target spells under water --- apps/openmw/mwbase/world.hpp | 1 + apps/openmw/mwmechanics/aicombataction.cpp | 7 +++++++ apps/openmw/mwworld/worldimp.hpp | 4 +--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 86d26d3a7..691891486 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -383,6 +383,7 @@ namespace MWBase ///Is the head of the creature underwater? virtual bool isSubmerged(const MWWorld::ConstPtr &object) const = 0; virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0; + virtual bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const = 0; virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const = 0; virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0; diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 37b67c9b2..358e04d6b 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -545,6 +545,13 @@ namespace MWMechanics const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); + // Underwater casting not possible + if (effect.mRange == ESM::RT_Target) + { + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f)) + return 0; + } + rating *= magicEffect->mData.mBaseCost; if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index ce6e27672..eb35ad031 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -168,9 +168,6 @@ namespace MWWorld float mDistanceToFacedObject; - bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const; - ///< helper function for implementing isSwimming(), isSubmerged(), isWading() - bool mTeleportEnabled; bool mLevitationEnabled; bool mGoToJail; @@ -490,6 +487,7 @@ namespace MWWorld virtual bool isSubmerged(const MWWorld::ConstPtr &object) const; virtual bool isSwimming(const MWWorld::ConstPtr &object) const; virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const; + virtual bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const; virtual bool isWading(const MWWorld::ConstPtr &object) const; virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const; virtual bool isOnGround(const MWWorld::Ptr &ptr) const; From b657517bea48bd5f3ab20ad6c4f1445051d39709 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Thu, 11 Aug 2016 14:18:57 +0200 Subject: [PATCH 118/318] use c++11 and see what happens --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b4e9ad4b..1907cf57e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,7 +343,7 @@ endif() # CXX Compiler settings if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++98 -pedantic -Wno-long-long") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long") if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 3.6) From dbc29854b2a0f9305e562fc4ae8347d548828176 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 13 Aug 2016 13:37:38 +0200 Subject: [PATCH 119/318] try to fix enums --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1907cf57e..d36595915 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,6 +344,7 @@ endif() # CXX Compiler settings if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long") + add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON ) if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 3.6) From b6ee76b77b2a7b98925147c96dfb9a2ea49059a2 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 13 Aug 2016 15:11:46 +0200 Subject: [PATCH 120/318] Switch to latest Qt5 version which is C++11-compatible --- CI/before_script.osx.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/CI/before_script.osx.sh b/CI/before_script.osx.sh index bec26caf1..a0dd1377a 100755 --- a/CI/before_script.osx.sh +++ b/CI/before_script.osx.sh @@ -5,7 +5,6 @@ export CC=clang DEPENDENCIES_ROOT="/private/tmp/openmw-deps/openmw-deps" QT_PATH=`brew --prefix $macos_qt_formula` - mkdir build cd build From 433129e72889399fa5201e5104c6459c297b8660 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 13 Aug 2016 15:53:34 +0200 Subject: [PATCH 121/318] only bundle with Qt5, for now --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d36595915..e0de38330 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -712,7 +712,7 @@ if (WIN32) endif() # Apple bundling -if (APPLE) +if (APPLE AND DESIRED_QT_VERSION MATCHES 5) get_property(QT_COCOA_PLUGIN_PATH TARGET Qt5::QCocoaIntegrationPlugin PROPERTY LOCATION_RELEASE) get_filename_component(QT_COCOA_PLUGIN_DIR "${QT_COCOA_PLUGIN_PATH}" DIRECTORY) get_filename_component(QT_COCOA_PLUGIN_GROUP "${QT_COCOA_PLUGIN_DIR}" NAME) From 5a65d6e18d298dfc816da7e404e0694e970c5bb3 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 13 Aug 2016 16:15:25 +0200 Subject: [PATCH 122/318] fix std::move --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0de38330..9d8b32e75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,7 +344,7 @@ endif() # CXX Compiler settings if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long") - add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON ) + add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON -DBOOST_NO_CXX11_RVALUE_REFERENCES=ON ) if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 3.6) From cb26f52032beae97d9623b780abec79ecc9d8cdc Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 13 Aug 2016 16:21:44 +0200 Subject: [PATCH 123/318] matching ifs --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d8b32e75..5406670d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -797,7 +797,7 @@ if (APPLE AND DESIRED_QT_VERSION MATCHES 5) fixup_bundle(\"${INSTALLED_OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"\") " COMPONENT Runtime) include(CPack) -endif (APPLE) +endif (APPLE AND DESIRED_QT_VERSION MATCHES 5) # Doxygen Target -- simply run 'make doc' or 'make doc_pages' # output directory for 'make doc' is "${OpenMW_BINARY_DIR}/docs/Doxygen" From 26c023efe2b7d90b1f2b4f85f3dcd71d10c17391 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 13 Aug 2016 16:29:49 +0200 Subject: [PATCH 124/318] stdlib to libc++ --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5406670d2..85e204299 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,7 +343,7 @@ endif() # CXX Compiler settings if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -stdlib=libc++ -pedantic -Wno-long-long") add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON -DBOOST_NO_CXX11_RVALUE_REFERENCES=ON ) if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE) From 5fa2f464997dc79a580c879cbc0449bb8fcd8a15 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 13 Aug 2016 16:39:08 +0200 Subject: [PATCH 125/318] only set libc++ for APPLE --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85e204299..614c0d61f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,8 +343,12 @@ endif() # CXX Compiler settings if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -stdlib=libc++ -pedantic -Wno-long-long") - add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON -DBOOST_NO_CXX11_RVALUE_REFERENCES=ON ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long") + add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON ) + + if (APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + endif() if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 3.6) From 231908d9cfcf962194d29dec94fd8b8e22f0ba68 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 17 Sep 2016 13:01:04 +0200 Subject: [PATCH 126/318] [OS X, CI] Use dependencies build against libc++ --- CI/before_install.osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/before_install.osx.sh b/CI/before_install.osx.sh index d7ef405bb..1035cbd22 100755 --- a/CI/before_install.osx.sh +++ b/CI/before_install.osx.sh @@ -6,5 +6,5 @@ brew outdated cmake || brew upgrade cmake brew outdated pkgconfig || brew upgrade pkgconfig brew install $macos_qt_formula -curl https://downloads.openmw.org/osx/dependencies/openmw-deps-c79172d.zip -o ~/openmw-deps.zip +curl http://downloads.openmw.org/osx/dependencies/openmw-deps-c++11.zip -o ~/openmw-deps.zip unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null From 4138723bbfe7f9c5d03a5030d439a49d15837392 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 17 Sep 2016 18:52:58 +0200 Subject: [PATCH 127/318] [OS X] Add libc++ to linker flags --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 614c0d61f..7ea3dde08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -348,6 +348,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) if (APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") endif() if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE) From 6260e1585216e25a945edc89c8182b68e0b43036 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 29 Oct 2016 18:25:59 +0200 Subject: [PATCH 128/318] [OS X] Temporarily disable OpenCS build on CI --- CI/before_script.osx.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/CI/before_script.osx.sh b/CI/before_script.osx.sh index a0dd1377a..e5ec8983b 100755 --- a/CI/before_script.osx.sh +++ b/CI/before_script.osx.sh @@ -17,5 +17,6 @@ cmake \ -D DESIRED_QT_VERSION=5 \ -D BUILD_ESMTOOL=FALSE \ -D BUILD_MYGUI_PLUGIN=FALSE \ +-D BUILD_OPENCS=FALSE \ -G"Unix Makefiles" \ .. From c16506d07cdac1d5ede912a159bfe93809ada36e Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Mon, 31 Oct 2016 17:09:29 +0100 Subject: [PATCH 129/318] [OS X, CI] Use Xcode 8/macOS 10.12 SDK --- .travis.yml | 2 +- CI/before_script.osx.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3f1cdfb6..892ca2ce1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ os: - linux - osx -osx_image: xcode8.2 +osx_image: xcode8 language: cpp sudo: required dist: trusty diff --git a/CI/before_script.osx.sh b/CI/before_script.osx.sh index e5ec8983b..08fbe76d6 100755 --- a/CI/before_script.osx.sh +++ b/CI/before_script.osx.sh @@ -10,9 +10,9 @@ cd build cmake \ -D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH" \ --D CMAKE_OSX_DEPLOYMENT_TARGET="10.8" \ +-D CMAKE_OSX_DEPLOYMENT_TARGET="10.9" \ -D CMAKE_OSX_SYSROOT="macosx10.12" \ --D CMAKE_BUILD_TYPE=Release \ +-D CMAKE_BUILD_TYPE=Debug \ -D OPENMW_OSX_DEPLOYMENT=TRUE \ -D DESIRED_QT_VERSION=5 \ -D BUILD_ESMTOOL=FALSE \ From 27a5c06f04e2866443e962f1b47fba7f32030be4 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Mon, 31 Oct 2016 18:52:29 +0100 Subject: [PATCH 130/318] [OS X, CI] Disable packaging --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 892ca2ce1..5695494c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,7 +63,7 @@ before_script: ./CI/before_script.${TRAVIS_OS_NAME}.sh script: - cd ./build - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE}make -j3; fi - - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi + - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make; fi - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi - cd "${TRAVIS_BUILD_DIR}" From 38a2de3c51edd808e5a3acba9e94c8ed11d227dd Mon Sep 17 00:00:00 2001 From: Ewan Higgs Date: Fri, 28 Apr 2017 17:30:26 +0200 Subject: [PATCH 131/318] convert std::autor_ptr to std::unique_ptr, originally by Ewan Higgs and updated by Bret Curtis --- apps/opencs/editor.hpp | 2 +- apps/opencs/model/doc/document.cpp | 4 ++-- apps/opencs/model/doc/document.hpp | 2 +- apps/opencs/model/tools/mergeoperation.cpp | 4 ++-- apps/opencs/model/tools/mergeoperation.hpp | 2 +- apps/opencs/model/tools/mergestate.hpp | 2 +- apps/opencs/model/tools/tools.cpp | 4 ++-- apps/opencs/model/tools/tools.hpp | 2 +- apps/opencs/model/world/commanddispatcher.cpp | 4 ++-- apps/opencs/model/world/refidcollection.cpp | 2 +- apps/opencs/model/world/refiddata.cpp | 2 +- apps/opencs/view/render/cell.cpp | 2 +- apps/opencs/view/render/cell.hpp | 12 ++++++------ apps/opencs/view/render/instancemode.cpp | 4 ++-- apps/opencs/view/render/pagedworldspacewidget.cpp | 4 ++-- .../opencs/view/render/unpagedworldspacewidget.hpp | 2 +- apps/opencs/view/tools/merge.cpp | 4 ++-- apps/opencs/view/world/creator.hpp | 2 +- apps/opencs/view/world/dialoguesubview.cpp | 2 +- apps/opencs/view/world/dialoguesubview.hpp | 2 +- apps/opencs/view/world/genericcreator.cpp | 6 +++--- apps/opencs/view/world/genericcreator.hpp | 2 +- apps/openmw/engine.hpp | 4 ++-- apps/openmw/main.cpp | 2 +- apps/openmw/mwclass/container.cpp | 4 ++-- apps/openmw/mwclass/creature.cpp | 4 ++-- apps/openmw/mwclass/creaturelevlist.cpp | 2 +- apps/openmw/mwclass/door.cpp | 2 +- apps/openmw/mwclass/npc.cpp | 4 ++-- apps/openmw/mwgui/alchemywindow.hpp | 4 +++- apps/openmw/mwgui/inventorywindow.hpp | 10 +++------- apps/openmw/mwgui/itemchargeview.hpp | 2 +- apps/openmw/mwgui/loadingscreen.hpp | 2 +- apps/openmw/mwgui/mapwindow.hpp | 4 ++-- apps/openmw/mwgui/race.hpp | 5 +++-- apps/openmw/mwgui/savegamedialog.hpp | 2 +- apps/openmw/mwgui/spellview.hpp | 2 +- apps/openmw/mwgui/videowidget.hpp | 4 ++-- apps/openmw/mwgui/windowmanagerimp.hpp | 2 +- apps/openmw/mwmechanics/actor.hpp | 2 +- apps/openmw/mwmechanics/aiactivate.cpp | 2 +- apps/openmw/mwmechanics/aicombat.cpp | 2 +- apps/openmw/mwmechanics/aiescort.cpp | 2 +- apps/openmw/mwmechanics/aifollow.cpp | 2 +- apps/openmw/mwmechanics/aipursue.cpp | 2 +- apps/openmw/mwmechanics/aisequence.cpp | 2 +- apps/openmw/mwmechanics/aitravel.cpp | 2 +- apps/openmw/mwmechanics/aiwander.cpp | 2 +- apps/openmw/mwphysics/actor.cpp | 2 +- apps/openmw/mwphysics/actor.hpp | 4 ++-- apps/openmw/mwphysics/physicssystem.cpp | 2 +- apps/openmw/mwphysics/physicssystem.hpp | 8 ++++---- apps/openmw/mwrender/characterpreview.cpp | 4 ++-- apps/openmw/mwrender/localmap.cpp | 4 ++-- apps/openmw/mwrender/renderingmanager.hpp | 14 +++++++------- apps/openmw/mwrender/sky.hpp | 6 +++--- apps/openmw/mwrender/terrainstorage.hpp | 2 +- apps/openmw/mwrender/water.hpp | 2 +- apps/openmw/mwsound/ffmpeg_decoder.cpp | 1 - apps/openmw/mwsound/openal_output.cpp | 2 +- apps/openmw/mwsound/openal_output.hpp | 2 +- apps/openmw/mwsound/soundmanagerimp.hpp | 6 ++---- apps/openmw/mwworld/scene.hpp | 2 +- components/compiler/lineparser.cpp | 2 +- components/esm/aisequence.cpp | 14 +++++++------- components/myguiplatform/myguidatamanager.cpp | 2 +- components/nifbullet/bulletnifloader.cpp | 2 +- components/resource/resourcesystem.cpp | 2 -- components/resource/resourcesystem.hpp | 8 ++++---- components/resource/scenemanager.hpp | 2 +- components/sceneutil/skeleton.hpp | 2 +- components/terrain/world.hpp | 4 ++-- extern/osg-ffmpeg-videoplayer/audiodecoder.hpp | 2 +- extern/osg-ffmpeg-videoplayer/videoplayer.hpp | 2 +- extern/osg-ffmpeg-videoplayer/videostate.hpp | 4 ++-- 75 files changed, 125 insertions(+), 131 deletions(-) diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index b088e9a44..ff670ba1b 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -47,7 +47,7 @@ namespace CS Q_OBJECT // FIXME: should be moved to document, so we can have different resources for each opened project - std::auto_ptr mVFS; + std::unique_ptr mVFS; Files::ConfigurationManager mCfgMgr; CSMPrefs::State mSettingsState; diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 87fbccb3f..ea32a8457 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -415,9 +415,9 @@ void CSMDoc::Document::runSearch (const CSMWorld::UniversalId& searchId, const C emit stateChanged (getState(), this); } -void CSMDoc::Document::runMerge (std::auto_ptr target) +void CSMDoc::Document::runMerge (std::unique_ptr target) { - mTools.runMerge (target); + mTools.runMerge (std::move(target)); emit stateChanged (getState(), this); } diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 41640f66d..8a9c49a09 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -137,7 +137,7 @@ namespace CSMDoc void runSearch (const CSMWorld::UniversalId& searchId, const CSMTools::Search& search); - void runMerge (std::auto_ptr target); + void runMerge (std::unique_ptr target); void abortOperation (int type); diff --git a/apps/opencs/model/tools/mergeoperation.cpp b/apps/opencs/model/tools/mergeoperation.cpp index 907d742ed..9b595046a 100644 --- a/apps/opencs/model/tools/mergeoperation.cpp +++ b/apps/opencs/model/tools/mergeoperation.cpp @@ -45,9 +45,9 @@ CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::Fr appendStage (new FinishMergedDocumentStage (mState, encoding)); } -void CSMTools::MergeOperation::setTarget (std::auto_ptr document) +void CSMTools::MergeOperation::setTarget (std::unique_ptr document) { - mState.mTarget = document; + mState.mTarget = std::move(document); } void CSMTools::MergeOperation::operationDone() diff --git a/apps/opencs/model/tools/mergeoperation.hpp b/apps/opencs/model/tools/mergeoperation.hpp index bdaeb2ccd..733fc8eba 100644 --- a/apps/opencs/model/tools/mergeoperation.hpp +++ b/apps/opencs/model/tools/mergeoperation.hpp @@ -27,7 +27,7 @@ namespace CSMTools MergeOperation (CSMDoc::Document& document, ToUTF8::FromType encoding); /// \attention Do not call this function while a merge is running. - void setTarget (std::auto_ptr document); + void setTarget (std::unique_ptr document); protected slots: diff --git a/apps/opencs/model/tools/mergestate.hpp b/apps/opencs/model/tools/mergestate.hpp index 29e1bbda7..96e6752e2 100644 --- a/apps/opencs/model/tools/mergestate.hpp +++ b/apps/opencs/model/tools/mergestate.hpp @@ -12,7 +12,7 @@ namespace CSMTools { struct MergeState { - std::auto_ptr mTarget; + std::unique_ptr mTarget; CSMDoc::Document& mSource; bool mCompleted; std::map, int> mTextureIndices; // (texture, content file) -> new texture diff --git a/apps/opencs/model/tools/tools.cpp b/apps/opencs/model/tools/tools.cpp index f538a716e..3b2c80263 100644 --- a/apps/opencs/model/tools/tools.cpp +++ b/apps/opencs/model/tools/tools.cpp @@ -216,7 +216,7 @@ void CSMTools::Tools::runSearch (const CSMWorld::UniversalId& searchId, const Se mSearch.start(); } -void CSMTools::Tools::runMerge (std::auto_ptr target) +void CSMTools::Tools::runMerge (std::unique_ptr target) { // not setting an active report, because merge does not produce messages @@ -230,7 +230,7 @@ void CSMTools::Tools::runMerge (std::auto_ptr target) target->flagAsDirty(); - mMergeOperation->setTarget (target); + mMergeOperation->setTarget (std::move(target)); mMerge.start(); } diff --git a/apps/opencs/model/tools/tools.hpp b/apps/opencs/model/tools/tools.hpp index e16a3854c..f544c8312 100644 --- a/apps/opencs/model/tools/tools.hpp +++ b/apps/opencs/model/tools/tools.hpp @@ -77,7 +77,7 @@ namespace CSMTools void runSearch (const CSMWorld::UniversalId& searchId, const Search& search); - void runMerge (std::auto_ptr target); + void runMerge (std::unique_ptr target); void abortOperation (int type); ///< \attention The operation is not aborted immediately. diff --git a/apps/opencs/model/world/commanddispatcher.cpp b/apps/opencs/model/world/commanddispatcher.cpp index ffbaa3dec..5d6a35cc5 100644 --- a/apps/opencs/model/world/commanddispatcher.cpp +++ b/apps/opencs/model/world/commanddispatcher.cpp @@ -138,7 +138,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons if (mLocked) return; - std::auto_ptr modifyCell; + std::unique_ptr modifyCell; int columnId = model->data (index, ColumnBase::Role_ColumnId).toInt(); @@ -167,7 +167,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons } } - std::auto_ptr modifyData ( + std::unique_ptr modifyData ( new CSMWorld::ModifyCommand (*model, index, new_)); if (modifyCell.get()) diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp index c0ce575b7..31dae256e 100644 --- a/apps/opencs/model/world/refidcollection.cpp +++ b/apps/opencs/model/world/refidcollection.cpp @@ -808,7 +808,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin, const std::string& destination, const CSMWorld::UniversalId::Type type) { - std::auto_ptr newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy()); + std::unique_ptr newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy()); mAdapters.find(type)->second->setId(*newRecord, destination); mData.insertRecord(*newRecord, type, destination); } diff --git a/apps/opencs/model/world/refiddata.cpp b/apps/opencs/model/world/refiddata.cpp index 2d8c9ac10..e2ffbcca6 100644 --- a/apps/opencs/model/world/refiddata.cpp +++ b/apps/opencs/model/world/refiddata.cpp @@ -389,7 +389,7 @@ void CSMWorld::RefIdData::copyTo (int index, RefIdData& target) const std::string id = source->getId (localIndex.first); - std::auto_ptr newRecord (source->getRecord (localIndex.first).modifiedCopy()); + std::unique_ptr newRecord (source->getRecord (localIndex.first).modifiedCopy()); target.insertRecord (*newRecord, localIndex.second, id); } diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 7cf542835..48156359f 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -62,7 +62,7 @@ bool CSVRender::Cell::addObjects (int start, int end) { std::string id = Misc::StringUtils::lowerCase (collection.getRecord (i).get().mId); - std::auto_ptr object (new Object (mData, mCellNode, id, false)); + std::unique_ptr object (new Object (mData, mCellNode, id, false)); if (mSubModeElementMask & Mask_Reference) object->setSubMode (mSubMode); diff --git a/apps/opencs/view/render/cell.hpp b/apps/opencs/view/render/cell.hpp index e8e0d2c63..ca82dd580 100644 --- a/apps/opencs/view/render/cell.hpp +++ b/apps/opencs/view/render/cell.hpp @@ -47,13 +47,13 @@ namespace CSVRender std::string mId; osg::ref_ptr mCellNode; std::map mObjects; - std::auto_ptr mTerrain; + std::unique_ptr mTerrain; CSMWorld::CellCoordinates mCoordinates; - std::auto_ptr mCellArrows[4]; - std::auto_ptr mCellMarker; - std::auto_ptr mCellBorder; - std::auto_ptr mCellWater; - std::auto_ptr mPathgrid; + std::unique_ptr mCellArrows[4]; + std::unique_ptr mCellMarker; + std::unique_ptr mCellBorder; + std::unique_ptr mCellWater; + std::unique_ptr mPathgrid; bool mDeleted; int mSubMode; unsigned int mSubModeElementMask; diff --git a/apps/opencs/view/render/instancemode.cpp b/apps/opencs/view/render/instancemode.cpp index 3373daa4a..fae609af5 100644 --- a/apps/opencs/view/render/instancemode.cpp +++ b/apps/opencs/view/render/instancemode.cpp @@ -559,7 +559,7 @@ void CSVRender::InstanceMode::dropEvent (QDropEvent* event) if (mode=="Create cell and insert") { - std::auto_ptr createCommand ( + std::unique_ptr createCommand ( new CSMWorld::CreateCommand (cellTable, cellId)); int parentIndex = cellTable.findColumnIndex (CSMWorld::Columns::ColumnId_Cell); @@ -610,7 +610,7 @@ void CSVRender::InstanceMode::dropEvent (QDropEvent* event) if (mime->isReferencable (iter->getType())) { // create reference - std::auto_ptr createCommand ( + std::unique_ptr createCommand ( new CSMWorld::CreateCommand ( referencesTable, document.getData().getReferences().getNewId())); diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp index e855f7e41..b5497558a 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.cpp +++ b/apps/opencs/view/render/pagedworldspacewidget.cpp @@ -54,7 +54,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells() { modified = true; - std::auto_ptr cell (new Cell (mDocument.getData(), mRootNode, + std::unique_ptr cell (new Cell (mDocument.getData(), mRootNode, iter->first.getId (mWorldspace), deleted)); delete iter->second; @@ -378,7 +378,7 @@ void CSVRender::PagedWorldspaceWidget::addCellToScene ( bool deleted = index==-1 || cells.getRecord (index).mState==CSMWorld::RecordBase::State_Deleted; - std::auto_ptr cell ( + std::unique_ptr cell ( new Cell (mDocument.getData(), mRootNode, coordinates.getId (mWorldspace), deleted)); EditMode *editMode = getEditMode(); diff --git a/apps/opencs/view/render/unpagedworldspacewidget.hpp b/apps/opencs/view/render/unpagedworldspacewidget.hpp index 57e8d1a19..5283b3a97 100644 --- a/apps/opencs/view/render/unpagedworldspacewidget.hpp +++ b/apps/opencs/view/render/unpagedworldspacewidget.hpp @@ -29,7 +29,7 @@ namespace CSVRender std::string mCellId; CSMWorld::IdTable *mCellsModel; CSMWorld::IdTable *mReferenceablesModel; - std::auto_ptr mCell; + std::unique_ptr mCell; void update(); diff --git a/apps/opencs/view/tools/merge.cpp b/apps/opencs/view/tools/merge.cpp index 566a5ee06..c49044ccd 100644 --- a/apps/opencs/view/tools/merge.cpp +++ b/apps/opencs/view/tools/merge.cpp @@ -127,10 +127,10 @@ void CSVTools::Merge::accept() { std::vector< boost::filesystem::path > files (1, mAdjuster->getPath()); - std::auto_ptr target ( + std::unique_ptr target ( mDocumentManager.makeDocument (files, files[0], true)); - mDocument->runMerge (target); + mDocument->runMerge (std::move(target)); hide(); } diff --git a/apps/opencs/view/world/creator.hpp b/apps/opencs/view/world/creator.hpp index b76348199..320bbf6ae 100644 --- a/apps/opencs/view/world/creator.hpp +++ b/apps/opencs/view/world/creator.hpp @@ -91,7 +91,7 @@ namespace CSVWorld Creator *CreatorFactory::makeCreator (CSMDoc::Document& document, const CSMWorld::UniversalId& id) const { - std::auto_ptr creator (new CreatorT (document.getData(), document.getUndoStack(), id)); + std::unique_ptr creator (new CreatorT (document.getData(), document.getUndoStack(), id)); creator->setScope (scope); diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 87d5b3d7f..7b198056c 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -120,7 +120,7 @@ mIndex(index) CSVWorld::DialogueDelegateDispatcherProxy::DialogueDelegateDispatcherProxy(QWidget* editor, CSMWorld::ColumnBase::Display display) : mEditor(editor), mDisplay(display), -mIndexWrapper(NULL) +mIndexWrapper(nullptr) { } diff --git a/apps/opencs/view/world/dialoguesubview.hpp b/apps/opencs/view/world/dialoguesubview.hpp index bd7116ba2..cbcb9b210 100644 --- a/apps/opencs/view/world/dialoguesubview.hpp +++ b/apps/opencs/view/world/dialoguesubview.hpp @@ -84,7 +84,7 @@ namespace CSVWorld CSMWorld::ColumnBase::Display mDisplay; - std::auto_ptr mIndexWrapper; + std::unique_ptr mIndexWrapper; public: DialogueDelegateDispatcherProxy(QWidget* editor, diff --git a/apps/opencs/view/world/genericcreator.cpp b/apps/opencs/view/world/genericcreator.cpp index dd2bd82df..bf4c4967f 100644 --- a/apps/opencs/view/world/genericcreator.cpp +++ b/apps/opencs/view/world/genericcreator.cpp @@ -63,7 +63,7 @@ std::string CSVWorld::GenericCreator::getIdValidatorResult() const void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const {} -void CSVWorld::GenericCreator::pushCommand (std::auto_ptr command, +void CSVWorld::GenericCreator::pushCommand (std::unique_ptr command, const std::string& id) { mUndoStack.push (command.release()); @@ -224,7 +224,7 @@ void CSVWorld::GenericCreator::create() { std::string id = getId(); - std::auto_ptr command; + std::unique_ptr command; if (mCloneMode) { @@ -239,7 +239,7 @@ void CSVWorld::GenericCreator::create() } configureCreateCommand (*command); - pushCommand (command, id); + pushCommand (std::move(command), id); emit done(); emit requestFocus(id); diff --git a/apps/opencs/view/world/genericcreator.hpp b/apps/opencs/view/world/genericcreator.hpp index f3fc82ec1..60d487bc1 100644 --- a/apps/opencs/view/world/genericcreator.hpp +++ b/apps/opencs/view/world/genericcreator.hpp @@ -71,7 +71,7 @@ namespace CSVWorld /// Allow subclasses to wrap the create command together with additional commands /// into a macro. - virtual void pushCommand (std::auto_ptr command, + virtual void pushCommand (std::unique_ptr command, const std::string& id); CSMWorld::Data& getData() const; diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index d06ca594d..29419a4c2 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -71,8 +71,8 @@ namespace OMW class Engine { SDL_Window* mWindow; - std::auto_ptr mVFS; - std::auto_ptr mResourceSystem; + std::unique_ptr mVFS; + std::unique_ptr mResourceSystem; osg::ref_ptr mWorkQueue; MWBase::Environment mEnvironment; ToUTF8::FromType mEncoding; diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index d0abdad52..420772910 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -310,7 +310,7 @@ int main(int argc, char**argv) boost::filesystem::ofstream logfile; - std::auto_ptr engine; + std::unique_ptr engine; int ret = 0; try diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index fe2899aff..66074306e 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -52,7 +52,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data (new ContainerCustomData); + std::unique_ptr data (new ContainerCustomData); MWWorld::LiveCellRef *ref = ptr.get(); @@ -308,7 +308,7 @@ namespace MWClass if (!ptr.getRefData().getCustomData()) { // Create a CustomData, but don't fill it from ESM records (not needed) - std::auto_ptr data (new ContainerCustomData); + std::unique_ptr data (new ContainerCustomData); ptr.getRefData().setCustomData (data.release()); } diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 7c2e05c77..4513e428b 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -108,7 +108,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data (new CreatureCustomData); + std::unique_ptr data (new CreatureCustomData); MWWorld::LiveCellRef *ref = ptr.get(); @@ -742,7 +742,7 @@ namespace MWClass if (!ptr.getRefData().getCustomData()) { // Create a CustomData, but don't fill it from ESM records (not needed) - std::auto_ptr data (new CreatureCustomData); + std::unique_ptr data (new CreatureCustomData); if (hasInventoryStore(ptr)) data->mContainerStore = new MWWorld::InventoryStore(); diff --git a/apps/openmw/mwclass/creaturelevlist.cpp b/apps/openmw/mwclass/creaturelevlist.cpp index 5941a09f5..95e52b41e 100644 --- a/apps/openmw/mwclass/creaturelevlist.cpp +++ b/apps/openmw/mwclass/creaturelevlist.cpp @@ -132,7 +132,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data (new CreatureLevListCustomData); + std::unique_ptr data (new CreatureLevListCustomData); data->mSpawnActorId = -1; data->mSpawn = true; diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index bc3455c65..5f977174f 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -350,7 +350,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data(new DoorCustomData); + std::unique_ptr data(new DoorCustomData); data->mDoorState = 0; ptr.getRefData().setCustomData(data.release()); diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 855850dfd..277d1691b 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -303,7 +303,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data(new NpcCustomData); + std::unique_ptr data(new NpcCustomData); MWWorld::LiveCellRef *ref = ptr.get(); @@ -1259,7 +1259,7 @@ namespace MWClass if (!ptr.getRefData().getCustomData()) { // Create a CustomData, but don't fill it from ESM records (not needed) - std::auto_ptr data (new NpcCustomData); + std::unique_ptr data (new NpcCustomData); ptr.getRefData().setCustomData (data.release()); } } diff --git a/apps/openmw/mwgui/alchemywindow.hpp b/apps/openmw/mwgui/alchemywindow.hpp index 69fff8c67..e1f48d4a3 100644 --- a/apps/openmw/mwgui/alchemywindow.hpp +++ b/apps/openmw/mwgui/alchemywindow.hpp @@ -3,6 +3,8 @@ #include +#include "../mwmechanics/alchemy.hpp" + #include "widgets.hpp" #include "windowbase.hpp" @@ -48,7 +50,7 @@ namespace MWGui void update(); - std::auto_ptr mAlchemy; + std::unique_ptr mAlchemy; std::vector mApparatus; std::vector mIngredients; diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp index 11091c428..761464540 100644 --- a/apps/openmw/mwgui/inventorywindow.hpp +++ b/apps/openmw/mwgui/inventorywindow.hpp @@ -5,6 +5,7 @@ #include "mode.hpp" #include "../mwworld/ptr.hpp" +#include "../mwrender/characterpreview.hpp" namespace osg { @@ -16,11 +17,6 @@ namespace Resource class ResourceSystem; } -namespace MWRender -{ - class InventoryPreview; -} - namespace MWGui { namespace Widgets @@ -101,8 +97,8 @@ namespace MWGui int mLastXSize; int mLastYSize; - std::auto_ptr mPreviewTexture; - std::auto_ptr mPreview; + std::unique_ptr mPreviewTexture; + std::unique_ptr mPreview; bool mTrading; diff --git a/apps/openmw/mwgui/itemchargeview.hpp b/apps/openmw/mwgui/itemchargeview.hpp index 0988f655b..956272aec 100644 --- a/apps/openmw/mwgui/itemchargeview.hpp +++ b/apps/openmw/mwgui/itemchargeview.hpp @@ -69,7 +69,7 @@ namespace MWGui typedef std::vector Lines; Lines mLines; - std::auto_ptr mModel; + std::unique_ptr mModel; MyGUI::ScrollView* mScrollView; DisplayMode mDisplayMode; }; diff --git a/apps/openmw/mwgui/loadingscreen.hpp b/apps/openmw/mwgui/loadingscreen.hpp index 0b7edbc9e..100c17e11 100644 --- a/apps/openmw/mwgui/loadingscreen.hpp +++ b/apps/openmw/mwgui/loadingscreen.hpp @@ -76,7 +76,7 @@ namespace MWGui // TODO: add releaseGLObjects() for mTexture osg::ref_ptr mTexture; - std::auto_ptr mGuiTexture; + std::unique_ptr mGuiTexture; void changeWallpaper(); diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp index 4e648c4b7..243b1160f 100644 --- a/apps/openmw/mwgui/mapwindow.hpp +++ b/apps/openmw/mwgui/mapwindow.hpp @@ -247,8 +247,8 @@ namespace MWGui void setGlobalMapMarkerTooltip(MyGUI::Widget* widget, int x, int y); MyGUI::ScrollView* mGlobalMap; - std::auto_ptr mGlobalMapTexture; - std::auto_ptr mGlobalMapOverlayTexture; + std::unique_ptr mGlobalMapTexture; + std::unique_ptr mGlobalMapOverlayTexture; MyGUI::ImageBox* mGlobalMapImage; MyGUI::ImageBox* mGlobalMapOverlay; MyGUI::ImageBox* mPlayerArrowLocal; diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index 42e758983..b762745cd 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -2,6 +2,7 @@ #define MWGUI_RACE_H #include "windowbase.hpp" +#include namespace MWGui @@ -115,8 +116,8 @@ namespace MWGui float mCurrentAngle; - std::auto_ptr mPreview; - std::auto_ptr mPreviewTexture; + std::unique_ptr mPreview; + std::unique_ptr mPreviewTexture; bool mPreviewDirty; }; diff --git a/apps/openmw/mwgui/savegamedialog.hpp b/apps/openmw/mwgui/savegamedialog.hpp index 6a9e59cc6..be0e47cab 100644 --- a/apps/openmw/mwgui/savegamedialog.hpp +++ b/apps/openmw/mwgui/savegamedialog.hpp @@ -48,7 +48,7 @@ namespace MWGui void fillSaveList(); - std::auto_ptr mScreenshotTexture; + std::unique_ptr mScreenshotTexture; MyGUI::ImageBox* mScreenshot; bool mSaving; diff --git a/apps/openmw/mwgui/spellview.hpp b/apps/openmw/mwgui/spellview.hpp index a4f8ddf39..7fea95cac 100644 --- a/apps/openmw/mwgui/spellview.hpp +++ b/apps/openmw/mwgui/spellview.hpp @@ -56,7 +56,7 @@ namespace MWGui private: MyGUI::ScrollView* mScrollView; - std::auto_ptr mModel; + std::unique_ptr mModel; /// tracks a row in the spell view struct LineInfo diff --git a/apps/openmw/mwgui/videowidget.hpp b/apps/openmw/mwgui/videowidget.hpp index 6b265628e..ac240e69d 100644 --- a/apps/openmw/mwgui/videowidget.hpp +++ b/apps/openmw/mwgui/videowidget.hpp @@ -51,8 +51,8 @@ namespace MWGui private: const VFS::Manager* mVFS; - std::auto_ptr mTexture; - std::auto_ptr mPlayer; + std::unique_ptr mTexture; + std::unique_ptr mPlayer; }; } diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 787c88598..ea7b4c14c 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -397,7 +397,7 @@ namespace MWGui osgMyGUI::Platform* mGuiPlatform; osgViewer::Viewer* mViewer; - std::auto_ptr mFontLoader; + std::unique_ptr mFontLoader; bool mConsoleOnlyScripts; diff --git a/apps/openmw/mwmechanics/actor.hpp b/apps/openmw/mwmechanics/actor.hpp index 846af1467..b8e114ead 100644 --- a/apps/openmw/mwmechanics/actor.hpp +++ b/apps/openmw/mwmechanics/actor.hpp @@ -32,7 +32,7 @@ namespace MWMechanics AiState& getAiState(); private: - std::auto_ptr mCharacterController; + std::unique_ptr mCharacterController; AiState mAiState; }; diff --git a/apps/openmw/mwmechanics/aiactivate.cpp b/apps/openmw/mwmechanics/aiactivate.cpp index b1426a4c1..d38a1299f 100644 --- a/apps/openmw/mwmechanics/aiactivate.cpp +++ b/apps/openmw/mwmechanics/aiactivate.cpp @@ -55,7 +55,7 @@ namespace MWMechanics void AiActivate::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr activate(new ESM::AiSequence::AiActivate()); + std::unique_ptr activate(new ESM::AiSequence::AiActivate()); activate->mTargetId = mObjectId; ESM::AiSequence::AiPackageContainer package; diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index d111eb127..a7a3d6ad7 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -479,7 +479,7 @@ namespace MWMechanics void AiCombat::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr combat(new ESM::AiSequence::AiCombat()); + std::unique_ptr combat(new ESM::AiSequence::AiCombat()); combat->mTargetActorId = mTargetActorId; ESM::AiSequence::AiPackageContainer package; diff --git a/apps/openmw/mwmechanics/aiescort.cpp b/apps/openmw/mwmechanics/aiescort.cpp index 4c9b5fd4f..103ef32e1 100644 --- a/apps/openmw/mwmechanics/aiescort.cpp +++ b/apps/openmw/mwmechanics/aiescort.cpp @@ -126,7 +126,7 @@ namespace MWMechanics void AiEscort::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr escort(new ESM::AiSequence::AiEscort()); + std::unique_ptr escort(new ESM::AiSequence::AiEscort()); escort->mData.mX = mX; escort->mData.mY = mY; escort->mData.mZ = mZ; diff --git a/apps/openmw/mwmechanics/aifollow.cpp b/apps/openmw/mwmechanics/aifollow.cpp index fd3014298..fe94246c4 100644 --- a/apps/openmw/mwmechanics/aifollow.cpp +++ b/apps/openmw/mwmechanics/aifollow.cpp @@ -188,7 +188,7 @@ bool AiFollow::isCommanded() const void AiFollow::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr follow(new ESM::AiSequence::AiFollow()); + std::unique_ptr follow(new ESM::AiSequence::AiFollow()); follow->mData.mX = mX; follow->mData.mY = mY; follow->mData.mZ = mZ; diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index 2b218de03..f9884eb6d 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -73,7 +73,7 @@ MWWorld::Ptr AiPursue::getTarget() const void AiPursue::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr pursue(new ESM::AiSequence::AiPursue()); + std::unique_ptr pursue(new ESM::AiSequence::AiPursue()); pursue->mTargetActorId = mTargetActorId; ESM::AiSequence::AiPackageContainer package; diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 125805507..64347f161 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -412,7 +412,7 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence) for (std::vector::const_iterator it = sequence.mPackages.begin(); it != sequence.mPackages.end(); ++it) { - std::auto_ptr package (NULL); + std::unique_ptr package (nullptr); switch (it->mType) { case ESM::AiSequence::Ai_Wander: diff --git a/apps/openmw/mwmechanics/aitravel.cpp b/apps/openmw/mwmechanics/aitravel.cpp index 7cef7aff1..36b96101f 100644 --- a/apps/openmw/mwmechanics/aitravel.cpp +++ b/apps/openmw/mwmechanics/aitravel.cpp @@ -79,7 +79,7 @@ namespace MWMechanics void AiTravel::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr travel(new ESM::AiSequence::AiTravel()); + std::unique_ptr travel(new ESM::AiSequence::AiTravel()); travel->mData.mX = mX; travel->mData.mY = mY; travel->mData.mZ = mZ; diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index eba37d7a7..a992bc8d4 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -919,7 +919,7 @@ namespace MWMechanics else remainingDuration = mDuration; - std::auto_ptr wander(new ESM::AiSequence::AiWander()); + std::unique_ptr wander(new ESM::AiSequence::AiWander()); wander->mData.mDistance = mDistance; wander->mData.mDuration = mDuration; wander->mData.mTimeOfDay = mTimeOfDay; diff --git a/apps/openmw/mwphysics/actor.cpp b/apps/openmw/mwphysics/actor.cpp index 2730bf4f0..e5e36def8 100644 --- a/apps/openmw/mwphysics/actor.cpp +++ b/apps/openmw/mwphysics/actor.cpp @@ -18,7 +18,7 @@ namespace MWPhysics Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr shape, btCollisionWorld* world) : mCanWaterWalk(false), mWalkingOnWater(false) - , mCollisionObject(0), mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false) + , mCollisionObject(nullptr), mForce(0.f, 0.f, 0.f), mOnGround(false), mOnSlope(false) , mInternalCollisionMode(true) , mExternalCollisionMode(true) , mCollisionWorld(world) diff --git a/apps/openmw/mwphysics/actor.hpp b/apps/openmw/mwphysics/actor.hpp index 88f7f5537..8ec94200f 100644 --- a/apps/openmw/mwphysics/actor.hpp +++ b/apps/openmw/mwphysics/actor.hpp @@ -162,10 +162,10 @@ namespace MWPhysics bool mRotationallyInvariant; - std::auto_ptr mShape; + std::unique_ptr mShape; btConvexShape* mConvexShape; - std::auto_ptr mCollisionObject; + std::unique_ptr mCollisionObject; osg::Vec3f mMeshTranslation; osg::Vec3f mHalfExtents; diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index d209d0d95..790ae2099 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -667,7 +667,7 @@ namespace MWPhysics } private: - std::auto_ptr mCollisionObject; + std::unique_ptr mCollisionObject; osg::ref_ptr mShapeInstance; std::map mRecIndexToNodePath; bool mSolid; diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 5351d99dd..aaf55e2b6 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -181,7 +181,7 @@ namespace MWPhysics btCollisionDispatcher* mDispatcher; btCollisionWorld* mCollisionWorld; - std::auto_ptr mShapeManager; + std::unique_ptr mShapeManager; Resource::ResourceSystem* mResourceSystem; typedef std::map ObjectMap; @@ -213,10 +213,10 @@ namespace MWPhysics float mWaterHeight; bool mWaterEnabled; - std::auto_ptr mWaterCollisionObject; - std::auto_ptr mWaterCollisionShape; + std::unique_ptr mWaterCollisionObject; + std::unique_ptr mWaterCollisionShape; - std::auto_ptr mDebugDrawer; + std::unique_ptr mDebugDrawer; osg::ref_ptr mParentNode; diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index db778e88d..b0899f47e 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -111,7 +111,7 @@ namespace MWRender , mPosition(position) , mLookAt(lookAt) , mCharacter(character) - , mAnimation(NULL) + , mAnimation(nullptr) , mSizeX(sizeX) , mSizeY(sizeY) { @@ -188,7 +188,7 @@ namespace MWRender mParent->addChild(mCamera); - mCharacter.mCell = NULL; + mCharacter.mCell = nullptr; } CharacterPreview::~CharacterPreview () diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index 02bc5d01f..b78c4dcd2 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -109,7 +109,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell) if (segment.mFogOfWarImage && segment.mHasFogState) { - std::auto_ptr fog (new ESM::FogState()); + std::unique_ptr fog (new ESM::FogState()); fog->mFogTextures.push_back(ESM::FogTexture()); segment.saveFogOfWar(fog->mFogTextures.back()); @@ -126,7 +126,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell) const int segsX = static_cast(std::ceil(length.x() / mMapWorldSize)); const int segsY = static_cast(std::ceil(length.y() / mMapWorldSize)); - std::auto_ptr fog (new ESM::FogState()); + std::unique_ptr fog (new ESM::FogState()); fog->mBounds.mMinX = mBounds.xMin(); fog->mBounds.mMaxX = mBounds.xMax(); diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 075357335..e575456d9 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -224,16 +224,16 @@ namespace MWRender osg::ref_ptr mSunLight; - std::auto_ptr mPathgrid; - std::auto_ptr mObjects; - std::auto_ptr mWater; - std::auto_ptr mTerrain; + std::unique_ptr mPathgrid; + std::unique_ptr mObjects; + std::unique_ptr mWater; + std::unique_ptr mTerrain; TerrainStorage* mTerrainStorage; - std::auto_ptr mSky; - std::auto_ptr mEffectManager; + std::unique_ptr mSky; + std::unique_ptr mEffectManager; osg::ref_ptr mPlayerAnimation; osg::ref_ptr mPlayerNode; - std::auto_ptr mCamera; + std::unique_ptr mCamera; osg::Vec3f mCurrentCameraPos; osg::ref_ptr mStateUpdater; diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index e047a9832..863ecc77d 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -189,9 +189,9 @@ namespace MWRender osg::ref_ptr mAtmosphereUpdater; - std::auto_ptr mSun; - std::auto_ptr mMasser; - std::auto_ptr mSecunda; + std::unique_ptr mSun; + std::unique_ptr mMasser; + std::unique_ptr mSecunda; osg::ref_ptr mRainNode; osg::ref_ptr mRainParticleSystem; diff --git a/apps/openmw/mwrender/terrainstorage.hpp b/apps/openmw/mwrender/terrainstorage.hpp index cf4011d45..6f716e752 100644 --- a/apps/openmw/mwrender/terrainstorage.hpp +++ b/apps/openmw/mwrender/terrainstorage.hpp @@ -29,7 +29,7 @@ namespace MWRender LandManager* getLandManager() const; private: - std::auto_ptr mLandManager; + std::unique_ptr mLandManager; Resource::ResourceSystem* mResourceSystem; }; diff --git a/apps/openmw/mwrender/water.hpp b/apps/openmw/mwrender/water.hpp index 29e78cf52..33b314c51 100644 --- a/apps/openmw/mwrender/water.hpp +++ b/apps/openmw/mwrender/water.hpp @@ -58,7 +58,7 @@ namespace MWRender const Fallback::Map* mFallback; osg::ref_ptr mIncrementalCompileOperation; - std::auto_ptr mSimulation; + std::unique_ptr mSimulation; osg::ref_ptr mRefraction; osg::ref_ptr mReflection; diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 038b2338b..c0a2014b3 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -1,6 +1,5 @@ #include "ffmpeg_decoder.hpp" -// auto_ptr #include #include diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index fb259ff5f..042795a8c 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -217,7 +217,7 @@ private: DecoderPtr mDecoder; - std::auto_ptr mLoudnessAnalyzer; + std::unique_ptr mLoudnessAnalyzer; volatile bool mIsFinished; diff --git a/apps/openmw/mwsound/openal_output.hpp b/apps/openmw/mwsound/openal_output.hpp index 24c8609d6..ea3f393ff 100644 --- a/apps/openmw/mwsound/openal_output.hpp +++ b/apps/openmw/mwsound/openal_output.hpp @@ -33,7 +33,7 @@ namespace MWSound Environment mListenerEnv; struct StreamThread; - std::auto_ptr mStreamThread; + std::unique_ptr mStreamThread; void initCommon2D(ALuint source, const osg::Vec3f &pos, ALfloat gain, ALfloat pitch, bool loop, bool useenv); void initCommon3D(ALuint source, const osg::Vec3f &pos, ALfloat mindist, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool loop, bool useenv); diff --git a/apps/openmw/mwsound/soundmanagerimp.hpp b/apps/openmw/mwsound/soundmanagerimp.hpp index abf5edb97..86e8b2bc7 100644 --- a/apps/openmw/mwsound/soundmanagerimp.hpp +++ b/apps/openmw/mwsound/soundmanagerimp.hpp @@ -47,8 +47,7 @@ namespace MWSound const VFS::Manager* mVFS; Fallback::Map mFallback; - - std::auto_ptr mOutput; + std::unique_ptr mOutput; // Caches available music tracks by std::map > mMusicFiles; @@ -66,8 +65,7 @@ namespace MWSound float mNearWaterOutdoorTolerance; std::string mNearWaterIndoorID; std::string mNearWaterOutdoorID; - - typedef std::auto_ptr > SoundBufferList; + typedef std::unique_ptr > SoundBufferList; // List of sound buffers, grown as needed. New enties are added to the // back, allowing existing Sound_Buffer references/pointers to remain // valid. diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index f3c2d31ca..586ac4f67 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -57,7 +57,7 @@ namespace MWWorld bool mCellChanged; MWPhysics::PhysicsSystem *mPhysics; MWRender::RenderingManager& mRendering; - std::auto_ptr mPreloader; + std::unique_ptr mPreloader; float mPreloadTimer; int mHalfGridSize; float mCellLoadingThreshold; diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index a5b67f58b..c7f82a3d0 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -294,7 +294,7 @@ namespace Compiler { // workaround for broken positioncell instructions. /// \todo add option to disable this - std::auto_ptr errorDowngrade (0); + std::unique_ptr errorDowngrade (nullptr); if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell") errorDowngrade.reset (new ErrorDowngrade (getErrorHandler())); diff --git a/components/esm/aisequence.cpp b/components/esm/aisequence.cpp index 71f87b170..c39ef8269 100644 --- a/components/esm/aisequence.cpp +++ b/components/esm/aisequence.cpp @@ -170,49 +170,49 @@ namespace AiSequence { case Ai_Wander: { - std::auto_ptr ptr (new AiWander()); + std::unique_ptr ptr (new AiWander()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Travel: { - std::auto_ptr ptr (new AiTravel()); + std::unique_ptr ptr (new AiTravel()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Escort: { - std::auto_ptr ptr (new AiEscort()); + std::unique_ptr ptr (new AiEscort()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Follow: { - std::auto_ptr ptr (new AiFollow()); + std::unique_ptr ptr (new AiFollow()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Activate: { - std::auto_ptr ptr (new AiActivate()); + std::unique_ptr ptr (new AiActivate()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Combat: { - std::auto_ptr ptr (new AiCombat()); + std::unique_ptr ptr (new AiCombat()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Pursue: { - std::auto_ptr ptr (new AiPursue()); + std::unique_ptr ptr (new AiPursue()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; diff --git a/components/myguiplatform/myguidatamanager.cpp b/components/myguiplatform/myguidatamanager.cpp index 69bc3878d..485a87ba7 100644 --- a/components/myguiplatform/myguidatamanager.cpp +++ b/components/myguiplatform/myguidatamanager.cpp @@ -18,7 +18,7 @@ void DataManager::setResourcePath(const std::string &path) MyGUI::IDataStream *DataManager::getData(const std::string &name) { std::string fullpath = getDataPath(name); - std::auto_ptr stream; + std::unique_ptr stream; stream.reset(new boost::filesystem::ifstream); stream->open(fullpath, std::ios::binary); if (stream->fail()) diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index 1cfac15eb..e17c96b79 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -75,7 +75,7 @@ osg::ref_ptr BulletNifLoader::load(const Nif::NIFFilePtr if (findBoundingBox(node)) { - std::auto_ptr compound (new btCompoundShape); + std::unique_ptr compound (new btCompoundShape); btBoxShape* boxShape = new btBoxShape(getbtVector(mShape->mCollisionBoxHalfExtents)); btTransform transform = btTransform::getIdentity(); diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index 19b280ff1..74d89ab7a 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -28,8 +28,6 @@ namespace Resource // this has to be defined in the .cpp file as we can't delete incomplete types mResourceManagers.clear(); - - // no delete, all handled by auto_ptr } SceneManager* ResourceSystem::getSceneManager() diff --git a/components/resource/resourcesystem.hpp b/components/resource/resourcesystem.hpp index 6e308fd9b..dc608b875 100644 --- a/components/resource/resourcesystem.hpp +++ b/components/resource/resourcesystem.hpp @@ -57,10 +57,10 @@ namespace Resource void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: - std::auto_ptr mSceneManager; - std::auto_ptr mImageManager; - std::auto_ptr mNifFileManager; - std::auto_ptr mKeyframeManager; + std::unique_ptr mSceneManager; + std::unique_ptr mImageManager; + std::unique_ptr mNifFileManager; + std::unique_ptr mKeyframeManager; // Store the base classes separately to get convenient access to the common interface // Here users can register their own resourcemanager as well diff --git a/components/resource/scenemanager.hpp b/components/resource/scenemanager.hpp index 2da28eaf4..c6ff02acf 100644 --- a/components/resource/scenemanager.hpp +++ b/components/resource/scenemanager.hpp @@ -147,7 +147,7 @@ namespace Resource private: - std::auto_ptr mShaderManager; + std::unique_ptr mShaderManager; bool mForceShaders; bool mClampLighting; bool mForcePerPixelLighting; diff --git a/components/sceneutil/skeleton.hpp b/components/sceneutil/skeleton.hpp index 24dcc6b3f..542471ff1 100644 --- a/components/sceneutil/skeleton.hpp +++ b/components/sceneutil/skeleton.hpp @@ -63,7 +63,7 @@ namespace SceneUtil private: // The root bone is not a "real" bone, it has no corresponding node in the scene graph. // As far as the scene graph goes we support multiple root bones. - std::auto_ptr mRootBone; + std::unique_ptr mRootBone; typedef std::map > BoneCache; BoneCache mBoneCache; diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index 6aac963ce..1eafc8bd7 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -100,8 +100,8 @@ namespace Terrain Resource::ResourceSystem* mResourceSystem; - std::auto_ptr mTextureManager; - std::auto_ptr mChunkManager; + std::unique_ptr mTextureManager; + std::unique_ptr mChunkManager; }; } diff --git a/extern/osg-ffmpeg-videoplayer/audiodecoder.hpp b/extern/osg-ffmpeg-videoplayer/audiodecoder.hpp index a592b02d3..95644ea69 100644 --- a/extern/osg-ffmpeg-videoplayer/audiodecoder.hpp +++ b/extern/osg-ffmpeg-videoplayer/audiodecoder.hpp @@ -55,7 +55,7 @@ private: }; - std::auto_ptr mAudioResampler; + std::unique_ptr mAudioResampler; uint8_t *mDataBuf; uint8_t **mFrameData; diff --git a/extern/osg-ffmpeg-videoplayer/videoplayer.hpp b/extern/osg-ffmpeg-videoplayer/videoplayer.hpp index c118ddb7f..ddb31f306 100644 --- a/extern/osg-ffmpeg-videoplayer/videoplayer.hpp +++ b/extern/osg-ffmpeg-videoplayer/videoplayer.hpp @@ -78,7 +78,7 @@ namespace Video private: VideoState* mState; - std::auto_ptr mAudioFactory; + std::unique_ptr mAudioFactory; }; } diff --git a/extern/osg-ffmpeg-videoplayer/videostate.hpp b/extern/osg-ffmpeg-videoplayer/videostate.hpp index 2f0e8f30a..0bfe9ba50 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.hpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.hpp @@ -152,8 +152,8 @@ struct VideoState { OpenThreads::Mutex pictq_mutex; OpenThreads::Condition pictq_cond; - std::auto_ptr parse_thread; - std::auto_ptr video_thread; + std::unique_ptr parse_thread; + std::unique_ptr video_thread; volatile bool mSeekRequested; uint64_t mSeekPos; From c8b67221d7559306012d7479db26f6e3a56b4af8 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 29 Apr 2017 08:49:48 +0200 Subject: [PATCH 132/318] use nullptr instead of NULL --- apps/openmw/mwgui/bookpage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index c5c4e8d03..4cede0e18 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -1050,7 +1050,7 @@ public: mActiveTextFormats.clear (); - if (newBook != NULL) + if (newBook != nullptr) { createActiveFormats (newBook); From bf630b99faf0d53cf59c84e95c80e4ce8fbd8331 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 29 Apr 2017 14:02:18 +0200 Subject: [PATCH 133/318] Use most recent Xcode --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5695494c2..4dbc7687b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ os: - linux - osx -osx_image: xcode8 +osx_image: xcode8.3 language: cpp sudo: required dist: trusty From 071419db4a3454ce2225dcb31214918be379b777 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Mon, 1 May 2017 11:34:44 +0200 Subject: [PATCH 134/318] [macOS, CI] Enable OpenCS build and see what happens --- CI/before_script.osx.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/CI/before_script.osx.sh b/CI/before_script.osx.sh index 08fbe76d6..930d89efa 100755 --- a/CI/before_script.osx.sh +++ b/CI/before_script.osx.sh @@ -17,6 +17,5 @@ cmake \ -D DESIRED_QT_VERSION=5 \ -D BUILD_ESMTOOL=FALSE \ -D BUILD_MYGUI_PLUGIN=FALSE \ --D BUILD_OPENCS=FALSE \ -G"Unix Makefiles" \ .. From dd882b69c69ce35fb84baaaa8657180737027b76 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Fri, 5 May 2017 13:01:47 +0300 Subject: [PATCH 135/318] [macOS, CI] Use Release configuration --- CI/before_script.osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/before_script.osx.sh b/CI/before_script.osx.sh index 930d89efa..806b545e3 100755 --- a/CI/before_script.osx.sh +++ b/CI/before_script.osx.sh @@ -12,7 +12,7 @@ cmake \ -D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH" \ -D CMAKE_OSX_DEPLOYMENT_TARGET="10.9" \ -D CMAKE_OSX_SYSROOT="macosx10.12" \ --D CMAKE_BUILD_TYPE=Debug \ +-D CMAKE_BUILD_TYPE=Release \ -D OPENMW_OSX_DEPLOYMENT=TRUE \ -D DESIRED_QT_VERSION=5 \ -D BUILD_ESMTOOL=FALSE \ From 07f75e11049f21260ec03c8dfa8b51960268b310 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Fri, 5 May 2017 19:26:09 +0200 Subject: [PATCH 136/318] replace boost::shared_ptr in extern and components --- apps/openmw/mwbase/soundmanager.hpp | 6 +++--- apps/openmw/mwrender/animation.cpp | 12 ++++++------ apps/openmw/mwrender/animation.hpp | 18 +++++++++--------- apps/openmw/mwrender/creatureanimation.cpp | 4 ++-- apps/openmw/mwrender/creatureanimation.hpp | 2 +- apps/openmw/mwrender/effectmanager.hpp | 7 +++---- apps/openmw/mwrender/npcanimation.cpp | 6 +++--- apps/openmw/mwrender/npcanimation.hpp | 4 ++-- apps/openmw/mwrender/ripplesimulation.cpp | 2 +- apps/openmw/mwrender/sky.cpp | 2 +- apps/openmw/mwrender/water.cpp | 2 +- apps/openmw/mwsound/movieaudiofactory.cpp | 6 +++--- apps/openmw/mwsound/movieaudiofactory.hpp | 2 +- apps/openmw/mwworld/projectilemanager.hpp | 2 +- components/files/constrainedfilestream.hpp | 2 +- components/nif/niffile.hpp | 2 +- components/nif/nifkey.hpp | 8 ++++---- components/nifosg/controller.hpp | 4 ++-- components/nifosg/nifloader.cpp | 6 +++--- components/sceneutil/controller.cpp | 10 +++++----- components/sceneutil/controller.hpp | 19 +++++++++---------- .../osg-ffmpeg-videoplayer/audiofactory.hpp | 3 +-- extern/osg-ffmpeg-videoplayer/videoplayer.cpp | 2 +- extern/osg-ffmpeg-videoplayer/videoplayer.hpp | 2 +- extern/osg-ffmpeg-videoplayer/videostate.cpp | 2 +- extern/osg-ffmpeg-videoplayer/videostate.hpp | 6 +++--- 26 files changed, 69 insertions(+), 72 deletions(-) diff --git a/apps/openmw/mwbase/soundmanager.hpp b/apps/openmw/mwbase/soundmanager.hpp index 22582c2b1..ecc056ccb 100644 --- a/apps/openmw/mwbase/soundmanager.hpp +++ b/apps/openmw/mwbase/soundmanager.hpp @@ -17,13 +17,13 @@ namespace MWSound class Sound; class Stream; struct Sound_Decoder; - typedef boost::shared_ptr DecoderPtr; + typedef std::shared_ptr DecoderPtr; } namespace MWBase { - typedef boost::shared_ptr SoundPtr; - typedef boost::shared_ptr SoundStreamPtr; + typedef std::shared_ptr SoundPtr; + typedef std::shared_ptr SoundStreamPtr; /// \brief Interface for sound manager (implemented in MWSound) class SoundManager diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index c825e74f2..98d29bfc9 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -546,7 +546,7 @@ namespace MWRender if(!mResourceSystem->getVFS()->exists(kfname)) return; - boost::shared_ptr animsrc; + std::shared_ptr animsrc; animsrc.reset(new AnimSource); animsrc->mKeyframes = mResourceSystem->getKeyframeManager()->get(kfname); @@ -598,7 +598,7 @@ namespace MWRender mStates.clear(); for(size_t i = 0;i < sNumBlendMasks;i++) - mAnimationTimePtr[i]->setTimePtr(boost::shared_ptr()); + mAnimationTimePtr[i]->setTimePtr(std::shared_ptr()); mAccumCtrl = NULL; @@ -881,12 +881,12 @@ namespace MWRender active = state; } - mAnimationTimePtr[blendMask]->setTimePtr(active == mStates.end() ? boost::shared_ptr() : active->second.mTime); + mAnimationTimePtr[blendMask]->setTimePtr(active == mStates.end() ? std::shared_ptr() : active->second.mTime); // add external controllers for the AnimSource active in this blend mask if (active != mStates.end()) { - boost::shared_ptr animsrc = active->second.mSource; + std::shared_ptr animsrc = active->second.mSource; for (AnimSource::ControllerMap::iterator it = animsrc->mControllerMap[blendMask].begin(); it != animsrc->mControllerMap[blendMask].end(); ++it) { @@ -1406,9 +1406,9 @@ namespace MWRender params.mEffectId = effectId; params.mBoneName = bonename; - params.mAnimTime = boost::shared_ptr(new EffectAnimationTime); + params.mAnimTime = std::shared_ptr(new EffectAnimationTime); - SceneUtil::AssignControllerSourcesVisitor assignVisitor(boost::shared_ptr(params.mAnimTime)); + SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr(params.mAnimTime)); node->accept(assignVisitor); overrideFirstRootTexture(texture, mResourceSystem, node); diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index 202595182..5aec80f5d 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -69,7 +69,7 @@ private: void operator= (const PartHolder&); PartHolder(const PartHolder&); }; -typedef boost::shared_ptr PartHolderPtr; +typedef std::shared_ptr PartHolderPtr; class Animation : public osg::Referenced { @@ -146,13 +146,13 @@ protected: class AnimationTime : public SceneUtil::ControllerSource { private: - boost::shared_ptr mTimePtr; + std::shared_ptr mTimePtr; public: - void setTimePtr(boost::shared_ptr time) + void setTimePtr(std::shared_ptr time) { mTimePtr = time; } - boost::shared_ptr getTimePtr() const + std::shared_ptr getTimePtr() const { return mTimePtr; } virtual float getValue(osg::NodeVisitor* nv); @@ -170,13 +170,13 @@ protected: struct AnimSource; struct AnimState { - boost::shared_ptr mSource; + std::shared_ptr mSource; float mStartTime; float mLoopStartTime; float mLoopStopTime; float mStopTime; - typedef boost::shared_ptr TimePtr; + typedef std::shared_ptr TimePtr; TimePtr mTime; float mSpeedMult; @@ -212,7 +212,7 @@ protected: typedef std::map AnimStateMap; AnimStateMap mStates; - typedef std::vector > AnimSourceList; + typedef std::vector > AnimSourceList; AnimSourceList mAnimSources; osg::ref_ptr mInsert; @@ -234,7 +234,7 @@ protected: typedef std::multimap, osg::ref_ptr > ControllerMap; ControllerMap mActiveControllers; - boost::shared_ptr mAnimationTimePtr[sNumBlendMasks]; + std::shared_ptr mAnimationTimePtr[sNumBlendMasks]; // Stored in all lowercase for a case-insensitive lookup typedef std::map > NodeMap; @@ -251,7 +251,7 @@ protected: { std::string mModelName; // Just here so we don't add the same effect twice PartHolderPtr mObjects; - boost::shared_ptr mAnimTime; + std::shared_ptr mAnimTime; float mMaxControllerLength; int mEffectId; bool mLoop; diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index cb6489ef4..2ad362b33 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -59,7 +59,7 @@ CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const updateParts(); } - mWeaponAnimationTime = boost::shared_ptr(new WeaponAnimationTime(this)); + mWeaponAnimationTime = std::shared_ptr(new WeaponAnimationTime(this)); } void CreatureWeaponAnimation::showWeapons(bool showWeapon) @@ -143,7 +143,7 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot) else mAmmunition.reset(); - boost::shared_ptr source; + std::shared_ptr source; if (slot == MWWorld::InventoryStore::Slot_CarriedRight) source = mWeaponAnimationTime; diff --git a/apps/openmw/mwrender/creatureanimation.hpp b/apps/openmw/mwrender/creatureanimation.hpp index bf813075e..ff959a551 100644 --- a/apps/openmw/mwrender/creatureanimation.hpp +++ b/apps/openmw/mwrender/creatureanimation.hpp @@ -61,7 +61,7 @@ namespace MWRender bool mShowWeapons; bool mShowCarriedLeft; - boost::shared_ptr mWeaponAnimationTime; + std::shared_ptr mWeaponAnimationTime; }; } diff --git a/apps/openmw/mwrender/effectmanager.hpp b/apps/openmw/mwrender/effectmanager.hpp index 83acc4c60..5873c00dd 100644 --- a/apps/openmw/mwrender/effectmanager.hpp +++ b/apps/openmw/mwrender/effectmanager.hpp @@ -1,13 +1,12 @@ #ifndef OPENMW_MWRENDER_EFFECTMANAGER_H #define OPENMW_MWRENDER_EFFECTMANAGER_H -#include #include +#include +#include #include -#include - namespace osg { class Group; @@ -44,7 +43,7 @@ namespace MWRender struct Effect { float mMaxControllerLength; - boost::shared_ptr mAnimTime; + std::shared_ptr mAnimTime; }; typedef std::map, Effect> EffectMap; diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 8805b0e95..73927e0ab 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -286,8 +286,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr par { mNpc = mPtr.get()->mBase; - mHeadAnimationTime = boost::shared_ptr(new HeadAnimationTime(mPtr)); - mWeaponAnimationTime = boost::shared_ptr(new WeaponAnimationTime(this)); + mHeadAnimationTime = std::shared_ptr(new HeadAnimationTime(mPtr)); + mWeaponAnimationTime = std::shared_ptr(new WeaponAnimationTime(this)); for(size_t i = 0;i < ESM::PRT_Count;i++) { @@ -778,7 +778,7 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g osg::Node* node = mObjectParts[type]->getNode(); if (node->getNumChildrenRequiringUpdateTraversal() > 0) { - boost::shared_ptr src; + std::shared_ptr src; if (type == ESM::PRT_Head) { src = mHeadAnimationTime; diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index ad4d692c9..7f3a8da2d 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -64,8 +64,8 @@ private: // Field of view to use when rendering first person meshes float mFirstPersonFieldOfView; - boost::shared_ptr mHeadAnimationTime; - boost::shared_ptr mWeaponAnimationTime; + std::shared_ptr mHeadAnimationTime; + std::shared_ptr mWeaponAnimationTime; bool mSoundsDisabled; diff --git a/apps/openmw/mwrender/ripplesimulation.cpp b/apps/openmw/mwrender/ripplesimulation.cpp index 00082f033..141a3eb87 100644 --- a/apps/openmw/mwrender/ripplesimulation.cpp +++ b/apps/openmw/mwrender/ripplesimulation.cpp @@ -47,7 +47,7 @@ namespace } osg::ref_ptr controller (new NifOsg::FlipController(0, 0.3f/rippleFrameCount, textures)); - controller->setSource(boost::shared_ptr(new SceneUtil::FrameTimeSource)); + controller->setSource(std::shared_ptr(new SceneUtil::FrameTimeSource)); node->addUpdateCallback(controller); osg::ref_ptr stateset (new osg::StateSet); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 09c7af6a2..e6aa013ec 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -1525,7 +1525,7 @@ void SkyManager::setWeather(const WeatherResult& weather) } mParticleEffect = mSceneManager->getInstance(mCurrentParticleEffect, mParticleNode); - SceneUtil::AssignControllerSourcesVisitor assignVisitor(boost::shared_ptr(new SceneUtil::FrameTimeSource)); + SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr(new SceneUtil::FrameTimeSource)); mParticleEffect->accept(assignVisitor); AlphaFader::SetupVisitor alphaFaderSetupVisitor; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index d2ad1f9b5..ac0337af5 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -488,7 +488,7 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha) float fps = mFallback->getFallbackFloat("Water_SurfaceFPS"); osg::ref_ptr controller (new NifOsg::FlipController(0, 1.f/fps, textures)); - controller->setSource(boost::shared_ptr(new SceneUtil::FrameTimeSource)); + controller->setSource(std::shared_ptr(new SceneUtil::FrameTimeSource)); node->setUpdateCallback(controller); stateset->setTextureAttributeAndModes(0, textures[0], osg::StateAttribute::ON); diff --git a/apps/openmw/mwsound/movieaudiofactory.cpp b/apps/openmw/mwsound/movieaudiofactory.cpp index af9932f74..2d7f3a969 100644 --- a/apps/openmw/mwsound/movieaudiofactory.cpp +++ b/apps/openmw/mwsound/movieaudiofactory.cpp @@ -92,7 +92,7 @@ namespace MWSound } MWBase::SoundStreamPtr mAudioTrack; - boost::shared_ptr mDecoderBridge; + std::shared_ptr mDecoderBridge; }; @@ -156,9 +156,9 @@ namespace MWSound - boost::shared_ptr MovieAudioFactory::createDecoder(Video::VideoState* videoState) + std::shared_ptr MovieAudioFactory::createDecoder(Video::VideoState* videoState) { - boost::shared_ptr decoder(new MWSound::MovieAudioDecoder(videoState)); + std::shared_ptr decoder(new MWSound::MovieAudioDecoder(videoState)); decoder->setupFormat(); MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); diff --git a/apps/openmw/mwsound/movieaudiofactory.hpp b/apps/openmw/mwsound/movieaudiofactory.hpp index 1391a0012..6ec49a4d3 100644 --- a/apps/openmw/mwsound/movieaudiofactory.hpp +++ b/apps/openmw/mwsound/movieaudiofactory.hpp @@ -8,7 +8,7 @@ namespace MWSound class MovieAudioFactory : public Video::MovieAudioFactory { - virtual boost::shared_ptr createDecoder(Video::VideoState* videoState); + virtual std::shared_ptr createDecoder(Video::VideoState* videoState); }; } diff --git a/apps/openmw/mwworld/projectilemanager.hpp b/apps/openmw/mwworld/projectilemanager.hpp index 2289706d3..bfa4980e9 100644 --- a/apps/openmw/mwworld/projectilemanager.hpp +++ b/apps/openmw/mwworld/projectilemanager.hpp @@ -73,7 +73,7 @@ namespace MWWorld struct State { osg::ref_ptr mNode; - boost::shared_ptr mEffectAnimationTime; + std::shared_ptr mEffectAnimationTime; int mActorId; diff --git a/components/files/constrainedfilestream.hpp b/components/files/constrainedfilestream.hpp index 069ceec58..6f22e31b8 100644 --- a/components/files/constrainedfilestream.hpp +++ b/components/files/constrainedfilestream.hpp @@ -17,7 +17,7 @@ public: virtual ~ConstrainedFileStream(); }; -typedef boost::shared_ptr IStreamPtr; +typedef std::shared_ptr IStreamPtr; IStreamPtr openConstrainedFileStream(const char *filename, size_t start=0, size_t length=0xFFFFFFFF); diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index 9a2acbb9f..9e39a37ab 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -92,7 +92,7 @@ public: /// Get the name of the file std::string getFilename() const { return filename; } }; -typedef boost::shared_ptr NIFFilePtr; +typedef std::shared_ptr NIFFilePtr; diff --git a/components/nif/nifkey.hpp b/components/nif/nifkey.hpp index 75353044d..5d96f456e 100644 --- a/components/nif/nifkey.hpp +++ b/components/nif/nifkey.hpp @@ -156,10 +156,10 @@ typedef KeyMapT Vector3KeyMap; typedef KeyMapT Vector4KeyMap; typedef KeyMapT QuaternionKeyMap; -typedef boost::shared_ptr FloatKeyMapPtr; -typedef boost::shared_ptr Vector3KeyMapPtr; -typedef boost::shared_ptr Vector4KeyMapPtr; -typedef boost::shared_ptr QuaternionKeyMapPtr; +typedef std::shared_ptr FloatKeyMapPtr; +typedef std::shared_ptr Vector3KeyMapPtr; +typedef std::shared_ptr Vector4KeyMapPtr; +typedef std::shared_ptr QuaternionKeyMapPtr; } // Namespace #endif //#ifndef OPENMW_COMPONENTS_NIF_NIFKEY_HPP diff --git a/components/nifosg/controller.hpp b/components/nifosg/controller.hpp index e517f9189..c2e3abb92 100644 --- a/components/nifosg/controller.hpp +++ b/components/nifosg/controller.hpp @@ -53,7 +53,7 @@ namespace NifOsg { } - ValueInterpolator(boost::shared_ptr keys, ValueT defaultVal = ValueT()) + ValueInterpolator(std::shared_ptr keys, ValueT defaultVal = ValueT()) : mKeys(keys) , mDefaultVal(defaultVal) { @@ -125,7 +125,7 @@ namespace NifOsg mutable typename MapT::MapType::const_iterator mLastLowKey; mutable typename MapT::MapType::const_iterator mLastHighKey; - boost::shared_ptr mKeys; + std::shared_ptr mKeys; ValueT mDefaultVal; }; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 2e591619e..05f6263b7 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -334,7 +334,7 @@ namespace NifOsg continue; osg::ref_ptr callback(new NifOsg::KeyframeController(key->data.getPtr())); - callback->setFunction(boost::shared_ptr(new NifOsg::ControllerFunction(key))); + callback->setFunction(std::shared_ptr(new NifOsg::ControllerFunction(key))); if (target.mKeyframeControllers.find(strdata->string) != target.mKeyframeControllers.end()) std::cerr << "Warning: controller " << strdata->string << " present more than once in " << nif->getFilename() << ", ignoring later version" << std::endl; @@ -411,9 +411,9 @@ namespace NifOsg { bool autoPlay = animflags & Nif::NiNode::AnimFlag_AutoPlay; if (autoPlay) - toSetup->setSource(boost::shared_ptr(new SceneUtil::FrameTimeSource)); + toSetup->setSource(std::shared_ptr(new SceneUtil::FrameTimeSource)); - toSetup->setFunction(boost::shared_ptr(new ControllerFunction(ctrl))); + toSetup->setFunction(std::shared_ptr(new ControllerFunction(ctrl))); } osg::ref_ptr handleLodNode(const Nif::NiLODNode* niLodNode) diff --git a/components/sceneutil/controller.cpp b/components/sceneutil/controller.cpp index 6cd0cb036..ee2715650 100644 --- a/components/sceneutil/controller.cpp +++ b/components/sceneutil/controller.cpp @@ -28,22 +28,22 @@ namespace SceneUtil return mSource->getValue(nv); } - void Controller::setSource(boost::shared_ptr source) + void Controller::setSource(std::shared_ptr source) { mSource = source; } - void Controller::setFunction(boost::shared_ptr function) + void Controller::setFunction(std::shared_ptr function) { mFunction = function; } - boost::shared_ptr Controller::getSource() const + std::shared_ptr Controller::getSource() const { return mSource; } - boost::shared_ptr Controller::getFunction() const + std::shared_ptr Controller::getFunction() const { return mFunction; } @@ -107,7 +107,7 @@ namespace SceneUtil { } - AssignControllerSourcesVisitor::AssignControllerSourcesVisitor(boost::shared_ptr toAssign) + AssignControllerSourcesVisitor::AssignControllerSourcesVisitor(std::shared_ptr toAssign) : ControllerVisitor() , mToAssign(toAssign) { diff --git a/components/sceneutil/controller.hpp b/components/sceneutil/controller.hpp index fd8964ae1..775cb23b0 100644 --- a/components/sceneutil/controller.hpp +++ b/components/sceneutil/controller.hpp @@ -1,8 +1,7 @@ #ifndef OPENMW_COMPONENTS_SCENEUTIL_CONTROLLER_H #define OPENMW_COMPONENTS_SCENEUTIL_CONTROLLER_H -#include - +#include #include namespace SceneUtil @@ -43,17 +42,17 @@ namespace SceneUtil float getInputValue(osg::NodeVisitor* nv); - void setSource(boost::shared_ptr source); - void setFunction(boost::shared_ptr function); + void setSource(std::shared_ptr source); + void setFunction(std::shared_ptr function); - boost::shared_ptr getSource() const; - boost::shared_ptr getFunction() const; + std::shared_ptr getSource() const; + std::shared_ptr getFunction() const; private: - boost::shared_ptr mSource; + std::shared_ptr mSource; // The source value gets passed through this function before it's passed on to the DestValue. - boost::shared_ptr mFunction; + std::shared_ptr mFunction; }; /// Pure virtual base class - visit() all controllers that are attached as UpdateCallbacks in a scene graph. @@ -78,14 +77,14 @@ namespace SceneUtil { public: AssignControllerSourcesVisitor(); - AssignControllerSourcesVisitor(boost::shared_ptr toAssign); + AssignControllerSourcesVisitor(std::shared_ptr toAssign); /// Assign the wanted ControllerSource. May be overridden in derived classes. /// By default assigns the ControllerSource passed to the constructor of this class if no ControllerSource is assigned to that controller yet. virtual void visit(osg::Node& node, Controller& ctrl); private: - boost::shared_ptr mToAssign; + std::shared_ptr mToAssign; }; /// Finds the maximum of all controller functions in the given scene graph diff --git a/extern/osg-ffmpeg-videoplayer/audiofactory.hpp b/extern/osg-ffmpeg-videoplayer/audiofactory.hpp index 06abd6a74..023d536e2 100644 --- a/extern/osg-ffmpeg-videoplayer/audiofactory.hpp +++ b/extern/osg-ffmpeg-videoplayer/audiofactory.hpp @@ -3,7 +3,6 @@ #include "audiodecoder.hpp" -#include namespace Video { @@ -11,7 +10,7 @@ namespace Video class MovieAudioFactory { public: - virtual boost::shared_ptr createDecoder(VideoState* videoState) = 0; + virtual std::shared_ptr createDecoder(VideoState* videoState) = 0; virtual ~MovieAudioFactory() {} }; diff --git a/extern/osg-ffmpeg-videoplayer/videoplayer.cpp b/extern/osg-ffmpeg-videoplayer/videoplayer.cpp index 9ec815130..c6544de9c 100644 --- a/extern/osg-ffmpeg-videoplayer/videoplayer.cpp +++ b/extern/osg-ffmpeg-videoplayer/videoplayer.cpp @@ -27,7 +27,7 @@ void VideoPlayer::setAudioFactory(MovieAudioFactory *factory) mAudioFactory.reset(factory); } -void VideoPlayer::playVideo(boost::shared_ptr inputstream, const std::string& name) +void VideoPlayer::playVideo(std::shared_ptr inputstream, const std::string& name) { if(mState) close(); diff --git a/extern/osg-ffmpeg-videoplayer/videoplayer.hpp b/extern/osg-ffmpeg-videoplayer/videoplayer.hpp index ddb31f306..351bc75b2 100644 --- a/extern/osg-ffmpeg-videoplayer/videoplayer.hpp +++ b/extern/osg-ffmpeg-videoplayer/videoplayer.hpp @@ -44,7 +44,7 @@ namespace Video /// Play the given video. If a video is already playing, the old video is closed first. /// @note The video will be unpaused by default. Use the pause() and play() methods to control pausing. /// @param name A name for the video stream - only used for logging purposes. - void playVideo (boost::shared_ptr inputstream, const std::string& name); + void playVideo (std::shared_ptr inputstream, const std::string& name); /// Get the current playback time position in the video, in seconds double getCurrentTime(); diff --git a/extern/osg-ffmpeg-videoplayer/videostate.cpp b/extern/osg-ffmpeg-videoplayer/videostate.cpp index 6779f2472..aa87069ac 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.cpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.cpp @@ -626,7 +626,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx) return 0; } -void VideoState::init(boost::shared_ptr inputstream, const std::string &name) +void VideoState::init(std::shared_ptr inputstream, const std::string &name) { int video_index = -1; int audio_index = -1; diff --git a/extern/osg-ffmpeg-videoplayer/videostate.hpp b/extern/osg-ffmpeg-videoplayer/videostate.hpp index 0bfe9ba50..a321d07c3 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.hpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.hpp @@ -94,7 +94,7 @@ struct VideoState { void setAudioFactory(MovieAudioFactory* factory); - void init(boost::shared_ptr inputstream, const std::string& name); + void init(std::shared_ptr inputstream, const std::string& name); void deinit(); void setPaused(bool isPaused); @@ -127,11 +127,11 @@ struct VideoState { osg::ref_ptr mTexture; MovieAudioFactory* mAudioFactory; - boost::shared_ptr mAudioDecoder; + std::shared_ptr mAudioDecoder; ExternalClock mExternalClock; - boost::shared_ptr stream; + std::shared_ptr stream; AVFormatContext* format_ctx; int av_sync_type; From d785344fad7eb872b71ab5a174696e8c45dd0261 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Fri, 5 May 2017 21:21:11 +0200 Subject: [PATCH 137/318] purge all instances of , clean up unused headers --- apps/openmw/mwbase/soundmanager.hpp | 2 +- apps/openmw/mwclass/activator.cpp | 8 +++---- apps/openmw/mwclass/activator.hpp | 2 +- apps/openmw/mwclass/apparatus.cpp | 8 +++---- apps/openmw/mwclass/apparatus.hpp | 4 ++-- apps/openmw/mwclass/armor.cpp | 8 +++---- apps/openmw/mwclass/armor.hpp | 4 ++-- apps/openmw/mwclass/bodypart.cpp | 2 +- apps/openmw/mwclass/book.cpp | 12 +++++----- apps/openmw/mwclass/book.hpp | 4 ++-- apps/openmw/mwclass/clothing.cpp | 8 +++---- apps/openmw/mwclass/clothing.hpp | 4 ++-- apps/openmw/mwclass/container.cpp | 14 ++++++------ apps/openmw/mwclass/container.hpp | 2 +- apps/openmw/mwclass/creature.cpp | 12 +++++----- apps/openmw/mwclass/creature.hpp | 2 +- apps/openmw/mwclass/creaturelevlist.cpp | 2 +- apps/openmw/mwclass/door.cpp | 14 ++++++------ apps/openmw/mwclass/door.hpp | 2 +- apps/openmw/mwclass/ingredient.cpp | 8 +++---- apps/openmw/mwclass/ingredient.hpp | 4 ++-- apps/openmw/mwclass/itemlevlist.cpp | 2 +- apps/openmw/mwclass/light.cpp | 12 +++++----- apps/openmw/mwclass/light.hpp | 4 ++-- apps/openmw/mwclass/lockpick.cpp | 8 +++---- apps/openmw/mwclass/lockpick.hpp | 4 ++-- apps/openmw/mwclass/misc.cpp | 10 ++++----- apps/openmw/mwclass/misc.hpp | 4 ++-- apps/openmw/mwclass/npc.cpp | 18 +++++++-------- apps/openmw/mwclass/npc.hpp | 2 +- apps/openmw/mwclass/potion.cpp | 8 +++---- apps/openmw/mwclass/potion.hpp | 4 ++-- apps/openmw/mwclass/probe.cpp | 8 +++---- apps/openmw/mwclass/probe.hpp | 4 ++-- apps/openmw/mwclass/repair.cpp | 8 +++---- apps/openmw/mwclass/repair.hpp | 4 ++-- apps/openmw/mwclass/static.cpp | 2 +- apps/openmw/mwclass/weapon.cpp | 8 +++---- apps/openmw/mwclass/weapon.hpp | 4 ++-- apps/openmw/mwgui/bookpage.cpp | 13 +++++------ apps/openmw/mwgui/bookpage.hpp | 5 ++--- apps/openmw/mwgui/inventorywindow.cpp | 2 +- apps/openmw/mwgui/journalviewmodel.cpp | 2 +- apps/openmw/mwgui/journalviewmodel.hpp | 3 +-- apps/openmw/mwgui/journalwindow.hpp | 4 ++-- apps/openmw/mwgui/mapwindow.cpp | 4 ++-- apps/openmw/mwgui/mapwindow.hpp | 4 +--- apps/openmw/mwgui/screenfader.hpp | 4 +--- apps/openmw/mwgui/sortfilteritemmodel.cpp | 2 +- apps/openmw/mwmechanics/aicombat.cpp | 6 ++--- apps/openmw/mwmechanics/aicombat.hpp | 2 -- apps/openmw/mwmechanics/aicombataction.cpp | 4 ++-- apps/openmw/mwmechanics/aicombataction.hpp | 4 ++-- apps/openmw/mwscript/containerextensions.cpp | 2 +- apps/openmw/mwscript/interpretercontext.cpp | 2 +- apps/openmw/mwscript/interpretercontext.hpp | 2 -- apps/openmw/mwsound/soundmanagerimp.hpp | 2 -- apps/openmw/mwworld/cellstore.hpp | 5 ++--- apps/openmw/mwworld/class.cpp | 22 +++++++++---------- apps/openmw/mwworld/class.hpp | 13 +++++------ apps/openmw/mwworld/worldimp.cpp | 2 +- apps/openmw/mwworld/worldimp.hpp | 4 +--- components/bsa/bsa_file.cpp | 1 + .../contentselector/model/loadordererror.cpp | 2 +- .../contentselector/view/contentselector.cpp | 5 +---- components/esm/npcstats.cpp | 2 ++ components/files/constrainedfilestream.hpp | 3 +-- components/nif/nifkey.hpp | 2 -- components/nif/nifstream.hpp | 1 + components/nifosg/controller.hpp | 4 ---- components/resource/imagemanager.cpp | 2 +- components/resource/resourcesystem.cpp | 2 ++ extern/osg-ffmpeg-videoplayer/videoplayer.hpp | 2 -- extern/osg-ffmpeg-videoplayer/videostate.cpp | 4 +--- extern/osg-ffmpeg-videoplayer/videostate.hpp | 2 -- 75 files changed, 179 insertions(+), 206 deletions(-) diff --git a/apps/openmw/mwbase/soundmanager.hpp b/apps/openmw/mwbase/soundmanager.hpp index ecc056ccb..9aa4bafdf 100644 --- a/apps/openmw/mwbase/soundmanager.hpp +++ b/apps/openmw/mwbase/soundmanager.hpp @@ -1,9 +1,9 @@ #ifndef GAME_MWBASE_SOUNDMANAGER_H #define GAME_MWBASE_SOUNDMANAGER_H +#include #include #include -#include #include "../mwworld/ptr.hpp" diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 3e0ec366f..4910ab932 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -73,7 +73,7 @@ namespace MWClass void Activator::registerSelf() { - boost::shared_ptr instance (new Activator); + std::shared_ptr instance (new Activator); registerClass (typeid (ESM::Activator).name(), instance); } @@ -107,19 +107,19 @@ namespace MWClass return info; } - boost::shared_ptr Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const + std::shared_ptr Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const { if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfActivator"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } - return boost::shared_ptr(new MWWorld::NullAction); + return std::shared_ptr(new MWWorld::NullAction); } diff --git a/apps/openmw/mwclass/activator.hpp b/apps/openmw/mwclass/activator.hpp index 4fe4dda7e..21afa7b8e 100644 --- a/apps/openmw/mwclass/activator.hpp +++ b/apps/openmw/mwclass/activator.hpp @@ -33,7 +33,7 @@ namespace MWClass virtual std::string getScript (const MWWorld::ConstPtr& ptr) const; ///< Return name of the script attached to ptr - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation static void registerSelf(); diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp index 3642a22ed..a271dc5e9 100644 --- a/apps/openmw/mwclass/apparatus.cpp +++ b/apps/openmw/mwclass/apparatus.cpp @@ -51,7 +51,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Apparatus::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Apparatus::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -73,7 +73,7 @@ namespace MWClass void Apparatus::registerSelf() { - boost::shared_ptr instance (new Apparatus); + std::shared_ptr instance (new Apparatus); registerClass (typeid (ESM::Apparatus).name(), instance); } @@ -125,9 +125,9 @@ namespace MWClass } - boost::shared_ptr Apparatus::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Apparatus::use (const MWWorld::Ptr& ptr) const { - return boost::shared_ptr(new MWWorld::ActionAlchemy()); + return std::shared_ptr(new MWWorld::ActionAlchemy()); } MWWorld::Ptr Apparatus::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const diff --git a/apps/openmw/mwclass/apparatus.hpp b/apps/openmw/mwclass/apparatus.hpp index d669b9c2d..539c1068b 100644 --- a/apps/openmw/mwclass/apparatus.hpp +++ b/apps/openmw/mwclass/apparatus.hpp @@ -23,7 +23,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -50,7 +50,7 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::ConstPtr& ptr) const; ///< Return name of inventory icon. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index f652cbd04..460cd517a 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -57,7 +57,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Armor::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Armor::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -165,7 +165,7 @@ namespace MWClass void Armor::registerSelf() { - boost::shared_ptr instance (new Armor); + std::shared_ptr instance (new Armor); registerClass (typeid (ESM::Armor).name(), instance); } @@ -354,9 +354,9 @@ namespace MWClass return std::make_pair(1,""); } - boost::shared_ptr Armor::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Armor::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/armor.hpp b/apps/openmw/mwclass/armor.hpp index 025bc8af1..628ac1b88 100644 --- a/apps/openmw/mwclass/armor.hpp +++ b/apps/openmw/mwclass/armor.hpp @@ -22,7 +22,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -73,7 +73,7 @@ namespace MWClass ///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that. \n /// Second item in the pair specifies the error message - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/bodypart.cpp b/apps/openmw/mwclass/bodypart.cpp index be2b927cc..41a9d998e 100644 --- a/apps/openmw/mwclass/bodypart.cpp +++ b/apps/openmw/mwclass/bodypart.cpp @@ -33,7 +33,7 @@ namespace MWClass void BodyPart::registerSelf() { - boost::shared_ptr instance (new BodyPart); + std::shared_ptr instance (new BodyPart); registerClass (typeid (ESM::BodyPart).name(), instance); } diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index f2c97d770..3d6455dc6 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -54,7 +54,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Book::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Book::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) @@ -62,13 +62,13 @@ namespace MWClass const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfItem"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } - return boost::shared_ptr(new MWWorld::ActionRead(ptr)); + return std::shared_ptr(new MWWorld::ActionRead(ptr)); } std::string Book::getScript (const MWWorld::ConstPtr& ptr) const @@ -87,7 +87,7 @@ namespace MWClass void Book::registerSelf() { - boost::shared_ptr instance (new Book); + std::shared_ptr instance (new Book); registerClass (typeid (ESM::Book).name(), instance); } @@ -162,9 +162,9 @@ namespace MWClass return record->mId; } - boost::shared_ptr Book::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Book::use (const MWWorld::Ptr& ptr) const { - return boost::shared_ptr(new MWWorld::ActionRead(ptr)); + return std::shared_ptr(new MWWorld::ActionRead(ptr)); } MWWorld::Ptr Book::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const diff --git a/apps/openmw/mwclass/book.hpp b/apps/openmw/mwclass/book.hpp index 73bfecacd..82ca08a4d 100644 --- a/apps/openmw/mwclass/book.hpp +++ b/apps/openmw/mwclass/book.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -53,7 +53,7 @@ namespace MWClass virtual std::string applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) const; + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu virtual std::string getModel(const MWWorld::ConstPtr &ptr) const; diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index 1d99ee8e2..b37d1e90b 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -53,7 +53,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Clothing::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Clothing::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -124,7 +124,7 @@ namespace MWClass void Clothing::registerSelf() { - boost::shared_ptr instance (new Clothing); + std::shared_ptr instance (new Clothing); registerClass (typeid (ESM::Clothing).name(), instance); } @@ -243,9 +243,9 @@ namespace MWClass return std::make_pair (1, ""); } - boost::shared_ptr Clothing::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Clothing::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/clothing.hpp b/apps/openmw/mwclass/clothing.hpp index e1c0f63f7..202b6596e 100644 --- a/apps/openmw/mwclass/clothing.hpp +++ b/apps/openmw/mwclass/clothing.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -65,7 +65,7 @@ namespace MWClass ///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that. /// Second item in the pair specifies the error message - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 66074306e..dc4eb844a 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -118,18 +118,18 @@ namespace MWClass return true; } - boost::shared_ptr Container::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Container::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) - return boost::shared_ptr (new MWWorld::NullAction ()); + return std::shared_ptr (new MWWorld::NullAction ()); if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfContainer"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; @@ -181,20 +181,20 @@ namespace MWClass { if(!isTrapped) { - boost::shared_ptr action (new MWWorld::ActionOpen(ptr)); + std::shared_ptr action (new MWWorld::ActionOpen(ptr)); return action; } else { // Activate trap - boost::shared_ptr action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr)); + std::shared_ptr action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr)); action->setSound(trapActivationSound); return action; } } else { - boost::shared_ptr action(new MWWorld::FailedAction(std::string(), ptr)); + std::shared_ptr action(new MWWorld::FailedAction(std::string(), ptr)); action->setSound(lockedSound); return action; } @@ -224,7 +224,7 @@ namespace MWClass void Container::registerSelf() { - boost::shared_ptr instance (new Container); + std::shared_ptr instance (new Container); registerClass (typeid (ESM::Container).name(), instance); } diff --git a/apps/openmw/mwclass/container.hpp b/apps/openmw/mwclass/container.hpp index 04223f264..e38d98b5c 100644 --- a/apps/openmw/mwclass/container.hpp +++ b/apps/openmw/mwclass/container.hpp @@ -23,7 +23,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 4513e428b..ce03af7a1 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -434,7 +434,7 @@ namespace MWClass } } - boost::shared_ptr Creature::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Creature::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) @@ -442,17 +442,17 @@ namespace MWClass const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfCreature"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } if(getCreatureStats(ptr).isDead()) - return boost::shared_ptr(new MWWorld::ActionOpen(ptr, true)); + return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); if(ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat()) - return boost::shared_ptr(new MWWorld::FailedAction("")); - return boost::shared_ptr(new MWWorld::ActionTalk(ptr)); + return std::shared_ptr(new MWWorld::FailedAction("")); + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); } MWWorld::ContainerStore& Creature::getContainerStore (const MWWorld::Ptr& ptr) const @@ -489,7 +489,7 @@ namespace MWClass void Creature::registerSelf() { - boost::shared_ptr instance (new Creature); + std::shared_ptr instance (new Creature); registerClass (typeid (ESM::Creature).name(), instance); } diff --git a/apps/openmw/mwclass/creature.hpp b/apps/openmw/mwclass/creature.hpp index 076bc8572..e3689204a 100644 --- a/apps/openmw/mwclass/creature.hpp +++ b/apps/openmw/mwclass/creature.hpp @@ -60,7 +60,7 @@ namespace MWClass virtual void onHit(const MWWorld::Ptr &ptr, float damage, bool ishealth, const MWWorld::Ptr &object, const MWWorld::Ptr &attacker, const osg::Vec3f &hitPosition, bool successful) const; - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation diff --git a/apps/openmw/mwclass/creaturelevlist.cpp b/apps/openmw/mwclass/creaturelevlist.cpp index 95e52b41e..4a4d9793e 100644 --- a/apps/openmw/mwclass/creaturelevlist.cpp +++ b/apps/openmw/mwclass/creaturelevlist.cpp @@ -70,7 +70,7 @@ namespace MWClass void CreatureLevList::registerSelf() { - boost::shared_ptr instance (new CreatureLevList); + std::shared_ptr instance (new CreatureLevList); registerClass (typeid (ESM::CreatureLevList).name(), instance); } diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 5f977174f..f11f8e9ec 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -99,7 +99,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Door::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Door::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { MWWorld::LiveCellRef *ref = ptr.get(); @@ -166,7 +166,7 @@ namespace MWClass if(isTrapped) { // Trap activation - boost::shared_ptr action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr)); + std::shared_ptr action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr)); action->setSound(trapActivationSound); return action; } @@ -176,12 +176,12 @@ namespace MWClass if (actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getDistanceToFacedObject() > MWBase::Environment::get().getWorld()->getMaxActivationDistance()) { // player activated teleport door with telekinesis - boost::shared_ptr action(new MWWorld::FailedAction); + std::shared_ptr action(new MWWorld::FailedAction); return action; } else { - boost::shared_ptr action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest(), true)); + std::shared_ptr action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest(), true)); action->setSound(openSound); return action; } @@ -189,7 +189,7 @@ namespace MWClass else { // animated door - boost::shared_ptr action(new MWWorld::ActionDoor(ptr)); + std::shared_ptr action(new MWWorld::ActionDoor(ptr)); int doorstate = getDoorState(ptr); bool opening = true; float doorRot = ptr.getRefData().getPosition().rot[2] - ptr.getCellRef().getPosition().rot[2]; @@ -223,7 +223,7 @@ namespace MWClass else { // locked, and we can't open. - boost::shared_ptr action(new MWWorld::FailedAction(std::string(), ptr)); + std::shared_ptr action(new MWWorld::FailedAction(std::string(), ptr)); action->setSound(lockedSound); return action; } @@ -264,7 +264,7 @@ namespace MWClass void Door::registerSelf() { - boost::shared_ptr instance (new Door); + std::shared_ptr instance (new Door); registerClass (typeid (ESM::Door).name(), instance); } diff --git a/apps/openmw/mwclass/door.hpp b/apps/openmw/mwclass/door.hpp index 3760f59c4..a2d129522 100644 --- a/apps/openmw/mwclass/door.hpp +++ b/apps/openmw/mwclass/door.hpp @@ -26,7 +26,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index a9a995f2f..09d149331 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -54,7 +54,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Ingredient::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Ingredient::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -75,9 +75,9 @@ namespace MWClass } - boost::shared_ptr Ingredient::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Ingredient::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action (new MWWorld::ActionEat (ptr)); + std::shared_ptr action (new MWWorld::ActionEat (ptr)); action->setSound ("Swallow"); @@ -86,7 +86,7 @@ namespace MWClass void Ingredient::registerSelf() { - boost::shared_ptr instance (new Ingredient); + std::shared_ptr instance (new Ingredient); registerClass (typeid (ESM::Ingredient).name(), instance); } diff --git a/apps/openmw/mwclass/ingredient.hpp b/apps/openmw/mwclass/ingredient.hpp index 9a8bdacfb..1136eb50f 100644 --- a/apps/openmw/mwclass/ingredient.hpp +++ b/apps/openmw/mwclass/ingredient.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -36,7 +36,7 @@ namespace MWClass virtual int getValue (const MWWorld::ConstPtr& ptr) const; ///< Return trade value of the object. Throws an exception, if the object can't be traded. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/itemlevlist.cpp b/apps/openmw/mwclass/itemlevlist.cpp index 290ac4c26..d2c246a85 100644 --- a/apps/openmw/mwclass/itemlevlist.cpp +++ b/apps/openmw/mwclass/itemlevlist.cpp @@ -12,7 +12,7 @@ namespace MWClass void ItemLevList::registerSelf() { - boost::shared_ptr instance (new ItemLevList); + std::shared_ptr instance (new ItemLevList); registerClass (typeid (ESM::ItemLevList).name(), instance); } diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index ed69ee3ac..172c16c83 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -79,15 +79,15 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Light::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Light::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) - return boost::shared_ptr(new MWWorld::NullAction()); + return std::shared_ptr(new MWWorld::NullAction()); MWWorld::LiveCellRef *ref = ptr.get(); if(!(ref->mBase->mData.mFlags&ESM::Light::Carry)) - return boost::shared_ptr(new MWWorld::FailedAction()); + return std::shared_ptr(new MWWorld::FailedAction()); return defaultItemActivate(ptr, actor); } @@ -120,7 +120,7 @@ namespace MWClass void Light::registerSelf() { - boost::shared_ptr instance (new Light); + std::shared_ptr instance (new Light); registerClass (typeid (ESM::Light).name(), instance); } @@ -186,9 +186,9 @@ namespace MWClass return Class::showsInInventory(ptr); } - boost::shared_ptr Light::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Light::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/light.hpp b/apps/openmw/mwclass/light.hpp index 284a7d817..59085d97e 100644 --- a/apps/openmw/mwclass/light.hpp +++ b/apps/openmw/mwclass/light.hpp @@ -30,7 +30,7 @@ namespace MWClass virtual bool showsInInventory (const MWWorld::ConstPtr& ptr) const; - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -55,7 +55,7 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::ConstPtr& ptr) const; ///< Return name of inventory icon. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index a335415ac..b8f6f5ecb 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -52,7 +52,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Lockpick::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Lockpick::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -83,7 +83,7 @@ namespace MWClass void Lockpick::registerSelf() { - boost::shared_ptr instance (new Lockpick); + std::shared_ptr instance (new Lockpick); registerClass (typeid (ESM::Lockpick).name(), instance); } @@ -139,9 +139,9 @@ namespace MWClass return info; } - boost::shared_ptr Lockpick::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Lockpick::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/lockpick.hpp b/apps/openmw/mwclass/lockpick.hpp index f04674f5c..efa675c95 100644 --- a/apps/openmw/mwclass/lockpick.hpp +++ b/apps/openmw/mwclass/lockpick.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -51,7 +51,7 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::ConstPtr& ptr) const; ///< Return name of inventory icon. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 3e1d750ad..203a7bbc4 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -65,7 +65,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Miscellaneous::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Miscellaneous::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -97,7 +97,7 @@ namespace MWClass void Miscellaneous::registerSelf() { - boost::shared_ptr instance (new Miscellaneous); + std::shared_ptr instance (new Miscellaneous); registerClass (typeid (ESM::Miscellaneous).name(), instance); } @@ -213,12 +213,12 @@ namespace MWClass return newPtr; } - boost::shared_ptr Miscellaneous::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Miscellaneous::use (const MWWorld::Ptr& ptr) const { if (ptr.getCellRef().getSoul().empty()) - return boost::shared_ptr(new MWWorld::NullAction()); + return std::shared_ptr(new MWWorld::NullAction()); else - return boost::shared_ptr(new MWWorld::ActionSoulgem(ptr)); + return std::shared_ptr(new MWWorld::ActionSoulgem(ptr)); } bool Miscellaneous::canSell (const MWWorld::ConstPtr& item, int npcServices) const diff --git a/apps/openmw/mwclass/misc.hpp b/apps/openmw/mwclass/misc.hpp index 2a534f058..37e77860b 100644 --- a/apps/openmw/mwclass/misc.hpp +++ b/apps/openmw/mwclass/misc.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -49,7 +49,7 @@ namespace MWClass virtual std::string getModel(const MWWorld::ConstPtr &ptr) const; - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 277d1691b..f8ff3da19 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -844,12 +844,12 @@ namespace MWClass } } - boost::shared_ptr Npc::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Npc::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { // player got activated by another NPC if(ptr == MWMechanics::getPlayer()) - return boost::shared_ptr(new MWWorld::ActionTalk(actor)); + return std::shared_ptr(new MWWorld::ActionTalk(actor)); // Werewolfs can't activate NPCs if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) @@ -857,23 +857,23 @@ namespace MWClass const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfNPC"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } if(getCreatureStats(ptr).isDead()) - return boost::shared_ptr(new MWWorld::ActionOpen(ptr, true)); + return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); if(ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat()) - return boost::shared_ptr(new MWWorld::FailedAction("#{sActorInCombat}")); + return std::shared_ptr(new MWWorld::FailedAction("#{sActorInCombat}")); if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak) || ptr.getClass().getCreatureStats(ptr).getKnockedDown()) - return boost::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing + return std::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing // Can't talk to werewolfs if(ptr.getClass().isNpc() && ptr.getClass().getNpcStats(ptr).isWerewolf()) - return boost::shared_ptr (new MWWorld::FailedAction("")); - return boost::shared_ptr(new MWWorld::ActionTalk(ptr)); + return std::shared_ptr (new MWWorld::FailedAction("")); + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); } MWWorld::ContainerStore& Npc::getContainerStore (const MWWorld::Ptr& ptr) @@ -1009,7 +1009,7 @@ namespace MWClass void Npc::registerSelf() { - boost::shared_ptr instance (new Npc); + std::shared_ptr instance (new Npc); registerClass (typeid (ESM::NPC).name(), instance); } diff --git a/apps/openmw/mwclass/npc.hpp b/apps/openmw/mwclass/npc.hpp index 3120c498c..e91dc7113 100644 --- a/apps/openmw/mwclass/npc.hpp +++ b/apps/openmw/mwclass/npc.hpp @@ -78,7 +78,7 @@ namespace MWClass virtual void getModelsToPreload(const MWWorld::Ptr& ptr, std::vector& models) const; ///< Get a list of models to preload that this object may use (directly or indirectly). default implementation: list getModel(). - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 225175979..ffdccf438 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -55,7 +55,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Potion::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Potion::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -78,7 +78,7 @@ namespace MWClass void Potion::registerSelf() { - boost::shared_ptr instance (new Potion); + std::shared_ptr instance (new Potion); registerClass (typeid (ESM::Potion).name(), instance); } @@ -139,12 +139,12 @@ namespace MWClass return info; } - boost::shared_ptr Potion::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Potion::use (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef *ref = ptr.get(); - boost::shared_ptr action ( + std::shared_ptr action ( new MWWorld::ActionApply (ptr, ref->mBase->mId)); action->setSound ("Drink"); diff --git a/apps/openmw/mwclass/potion.hpp b/apps/openmw/mwclass/potion.hpp index 9cdd58058..ad9a329c0 100644 --- a/apps/openmw/mwclass/potion.hpp +++ b/apps/openmw/mwclass/potion.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -36,7 +36,7 @@ namespace MWClass virtual int getValue (const MWWorld::ConstPtr& ptr) const; ///< Return trade value of the object. Throws an exception, if the object can't be traded. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) const; + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu static void registerSelf(); diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index 185aa66cb..ecaa056f9 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -51,7 +51,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Probe::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Probe::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -83,7 +83,7 @@ namespace MWClass void Probe::registerSelf() { - boost::shared_ptr instance (new Probe); + std::shared_ptr instance (new Probe); registerClass (typeid (ESM::Probe).name(), instance); } @@ -139,9 +139,9 @@ namespace MWClass return info; } - boost::shared_ptr Probe::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Probe::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/probe.hpp b/apps/openmw/mwclass/probe.hpp index 4fc991a5f..f67d8af86 100644 --- a/apps/openmw/mwclass/probe.hpp +++ b/apps/openmw/mwclass/probe.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -51,7 +51,7 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::ConstPtr& ptr) const; ///< Return name of inventory icon. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index cbdfade2b..566d16106 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -51,7 +51,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Repair::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Repair::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -74,7 +74,7 @@ namespace MWClass void Repair::registerSelf() { - boost::shared_ptr instance (new Repair); + std::shared_ptr instance (new Repair); registerClass (typeid (ESM::Repair).name(), instance); } @@ -149,9 +149,9 @@ namespace MWClass return MWWorld::Ptr(cell.insert(ref), &cell); } - boost::shared_ptr Repair::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Repair::use (const MWWorld::Ptr& ptr) const { - return boost::shared_ptr(new MWWorld::ActionRepair(ptr)); + return std::shared_ptr(new MWWorld::ActionRepair(ptr)); } bool Repair::canSell (const MWWorld::ConstPtr& item, int npcServices) const diff --git a/apps/openmw/mwclass/repair.hpp b/apps/openmw/mwclass/repair.hpp index f0d1292f4..34ba4035b 100644 --- a/apps/openmw/mwclass/repair.hpp +++ b/apps/openmw/mwclass/repair.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -49,7 +49,7 @@ namespace MWClass virtual std::string getModel(const MWWorld::ConstPtr &ptr) const; - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu (default implementation: return a /// null action). diff --git a/apps/openmw/mwclass/static.cpp b/apps/openmw/mwclass/static.cpp index 65e69ea90..40a6b998c 100644 --- a/apps/openmw/mwclass/static.cpp +++ b/apps/openmw/mwclass/static.cpp @@ -43,7 +43,7 @@ namespace MWClass void Static::registerSelf() { - boost::shared_ptr instance (new Static); + std::shared_ptr instance (new Static); registerClass (typeid (ESM::Static).name(), instance); } diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 575accaba..efb6248af 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -54,7 +54,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Weapon::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Weapon::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -143,7 +143,7 @@ namespace MWClass void Weapon::registerSelf() { - boost::shared_ptr instance (new Weapon); + std::shared_ptr instance (new Weapon); registerClass (typeid (ESM::Weapon).name(), instance); } @@ -392,9 +392,9 @@ namespace MWClass return std::make_pair(1, ""); } - boost::shared_ptr Weapon::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Weapon::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/weapon.hpp b/apps/openmw/mwclass/weapon.hpp index 5fc3983f2..c14847363 100644 --- a/apps/openmw/mwclass/weapon.hpp +++ b/apps/openmw/mwclass/weapon.hpp @@ -21,7 +21,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -72,7 +72,7 @@ namespace MWClass ///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that. /// Second item in the pair specifies the error message - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 4cede0e18..24dfe6024 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -235,7 +234,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter }; typedef TypesetBookImpl Book; - typedef boost::shared_ptr BookPtr; + typedef std::shared_ptr BookPtr; typedef std::vector::const_iterator PartialTextConstIterator; int mPageWidth; @@ -259,7 +258,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter mCurrentContent (NULL), mCurrentAlignment (AlignLeft) { - mBook = boost::make_shared (); + mBook = std::make_shared (); } virtual ~Typesetter () @@ -628,7 +627,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter BookTypesetter::Ptr BookTypesetter::create (int pageWidth, int pageHeight) { - return boost::make_shared (pageWidth, pageHeight); + return std::make_shared (pageWidth, pageHeight); } namespace @@ -900,7 +899,7 @@ public: boost::function mLinkClicked; - boost::shared_ptr mBook; + std::shared_ptr mBook; MyGUI::ILayerNode* mNode; ActiveTextFormats mActiveTextFormats; @@ -1034,7 +1033,7 @@ public: void showPage (TypesetBook::Ptr book, size_t newPage) { - boost::shared_ptr newBook = boost::dynamic_pointer_cast (book); + std::shared_ptr newBook = std::dynamic_pointer_cast (book); if (mBook != newBook) { @@ -1123,7 +1122,7 @@ public: } }; - void createActiveFormats (boost::shared_ptr newBook) + void createActiveFormats (std::shared_ptr newBook) { newBook->visitRuns (0, 0x7FFFFFFF, CreateActiveFormat (this)); diff --git a/apps/openmw/mwgui/bookpage.hpp b/apps/openmw/mwgui/bookpage.hpp index c7340ec7c..8800508b4 100644 --- a/apps/openmw/mwgui/bookpage.hpp +++ b/apps/openmw/mwgui/bookpage.hpp @@ -7,7 +7,6 @@ #include #include #include -#include namespace MWGui { @@ -15,7 +14,7 @@ namespace MWGui /// the book page widget. struct TypesetBook { - typedef boost::shared_ptr Ptr; + typedef std::shared_ptr Ptr; typedef intptr_t InteractiveId; /// Returns the number of pages in the document. @@ -33,7 +32,7 @@ namespace MWGui /// A factory class for creating a typeset book instance. struct BookTypesetter { - typedef boost::shared_ptr Ptr; + typedef std::shared_ptr Ptr; typedef TypesetBook::InteractiveId InteractiveId; typedef MyGUI::Colour Colour; typedef uint8_t const * Utf8Point; diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index d52a307c2..a93934ecb 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -493,7 +493,7 @@ namespace MWGui { if (script.empty() || ptr.getRefData().getLocals().getIntVar(script, "pcskipequip") == 0) { - boost::shared_ptr action = ptr.getClass().use(ptr); + std::shared_ptr action = ptr.getClass().use(ptr); action->execute (player); } diff --git a/apps/openmw/mwgui/journalviewmodel.cpp b/apps/openmw/mwgui/journalviewmodel.cpp index 70f1305e0..a2819b749 100644 --- a/apps/openmw/mwgui/journalviewmodel.cpp +++ b/apps/openmw/mwgui/journalviewmodel.cpp @@ -356,7 +356,7 @@ struct JournalViewModelImpl : JournalViewModel JournalViewModel::Ptr JournalViewModel::create () { - return boost::make_shared (); + return std::make_shared (); } } diff --git a/apps/openmw/mwgui/journalviewmodel.hpp b/apps/openmw/mwgui/journalviewmodel.hpp index b3c6b0183..5739a311f 100644 --- a/apps/openmw/mwgui/journalviewmodel.hpp +++ b/apps/openmw/mwgui/journalviewmodel.hpp @@ -6,7 +6,6 @@ #include #include #include -#include namespace MWGui { @@ -18,7 +17,7 @@ namespace MWGui /// game data store. struct JournalViewModel { - typedef boost::shared_ptr Ptr; + typedef std::shared_ptr Ptr; typedef intptr_t QuestId; typedef intptr_t TopicId; diff --git a/apps/openmw/mwgui/journalwindow.hpp b/apps/openmw/mwgui/journalwindow.hpp index 740284e20..cc645ca44 100644 --- a/apps/openmw/mwgui/journalwindow.hpp +++ b/apps/openmw/mwgui/journalwindow.hpp @@ -1,7 +1,7 @@ #ifndef MWGUI_JOURNAL_H #define MWGUI_JOURNAL_H -#include +#include namespace MWBase { class WindowManager; } @@ -12,7 +12,7 @@ namespace MWGui struct JournalWindow { /// construct a new instance of the one JournalWindow implementation - static JournalWindow * create (boost::shared_ptr Model, bool questList); + static JournalWindow * create (std::shared_ptr Model, bool questList); /// destroy this instance of the JournalWindow implementation virtual ~JournalWindow () {}; diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index 4d4efeecb..7d81b6ab3 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -252,7 +252,7 @@ namespace MWGui osg::ref_ptr tex = mLocalMapRender->getFogOfWarTexture(x, y); if (tex) { - boost::shared_ptr myguitex (new osgMyGUI::OSGTexture(tex)); + std::shared_ptr myguitex (new osgMyGUI::OSGTexture(tex)); fog->setRenderItemTexture(myguitex.get()); fog->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 1.f, 1.f, 0.f)); fogTextures.push_back(myguitex); @@ -382,7 +382,7 @@ namespace MWGui osg::ref_ptr texture = mLocalMapRender->getMapTexture(mapX, mapY); if (texture) { - boost::shared_ptr guiTex (new osgMyGUI::OSGTexture(texture)); + std::shared_ptr guiTex (new osgMyGUI::OSGTexture(texture)); textures.push_back(guiTex); box->setRenderItemTexture(guiTex.get()); box->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f, 1.f, 1.f)); diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp index 243b1160f..312447a24 100644 --- a/apps/openmw/mwgui/mapwindow.hpp +++ b/apps/openmw/mwgui/mapwindow.hpp @@ -3,8 +3,6 @@ #include -#include - #include "windowpinnablebase.hpp" #include @@ -130,7 +128,7 @@ namespace MWGui std::vector mMapWidgets; std::vector mFogWidgets; - typedef std::vector > TextureVector; + typedef std::vector > TextureVector; TextureVector mMapTextures; TextureVector mFogTextures; diff --git a/apps/openmw/mwgui/screenfader.hpp b/apps/openmw/mwgui/screenfader.hpp index f87fd8443..b510e133a 100644 --- a/apps/openmw/mwgui/screenfader.hpp +++ b/apps/openmw/mwgui/screenfader.hpp @@ -3,8 +3,6 @@ #include -#include - #include "windowbase.hpp" namespace MWGui @@ -14,7 +12,7 @@ namespace MWGui class FadeOp { public: - typedef boost::shared_ptr Ptr; + typedef std::shared_ptr Ptr; FadeOp(ScreenFader * fader, float time, float targetAlpha); diff --git a/apps/openmw/mwgui/sortfilteritemmodel.cpp b/apps/openmw/mwgui/sortfilteritemmodel.cpp index 60111fb79..68d95fb88 100644 --- a/apps/openmw/mwgui/sortfilteritemmodel.cpp +++ b/apps/openmw/mwgui/sortfilteritemmodel.cpp @@ -143,7 +143,7 @@ namespace MWGui if ((mFilter & Filter_OnlyUsableItems) && base.getClass().getScript(base).empty()) { - boost::shared_ptr actionOnUse = base.getClass().use(base); + std::shared_ptr actionOnUse = base.getClass().use(base); if (!actionOnUse || actionOnUse->isNullAction()) return false; } diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index a7a3d6ad7..a00890cea 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -47,7 +47,7 @@ namespace MWMechanics bool mCombatMove; osg::Vec3f mLastTargetPos; const MWWorld::CellStore* mCell; - boost::shared_ptr mCurrentAction; + std::shared_ptr mCurrentAction; float mActionCooldown; float mStrength; bool mForceNoShortcut; @@ -249,7 +249,7 @@ namespace MWMechanics actorClass.getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, true); float& actionCooldown = storage.mActionCooldown; - boost::shared_ptr& currentAction = storage.mCurrentAction; + std::shared_ptr& currentAction = storage.mCurrentAction; if (!forceFlee) { @@ -512,7 +512,7 @@ namespace MWMechanics targetWeapon = *weaponSlot; } - boost::shared_ptr targetWeaponAction (new ActionWeapon(targetWeapon)); + std::shared_ptr targetWeaponAction (new ActionWeapon(targetWeapon)); if (targetWeaponAction.get()) { diff --git a/apps/openmw/mwmechanics/aicombat.hpp b/apps/openmw/mwmechanics/aicombat.hpp index fbe864ca0..e7d74248b 100644 --- a/apps/openmw/mwmechanics/aicombat.hpp +++ b/apps/openmw/mwmechanics/aicombat.hpp @@ -3,8 +3,6 @@ #include "aipackage.hpp" -#include - #include "../mwworld/cellstore.hpp" // for Doors #include "../mwbase/world.hpp" diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 37b67c9b2..6d879c57d 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -709,14 +709,14 @@ namespace MWMechanics return mWeapon.get()->mBase; } - boost::shared_ptr prepareNextAction(const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy) + std::shared_ptr prepareNextAction(const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy) { Spells& spells = actor.getClass().getCreatureStats(actor).getSpells(); float bestActionRating = 0.f; float antiFleeRating = 0.f; // Default to hand-to-hand combat - boost::shared_ptr bestAction (new ActionWeapon(MWWorld::Ptr())); + std::shared_ptr bestAction (new ActionWeapon(MWWorld::Ptr())); if (actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { bestAction->prepare(actor); diff --git a/apps/openmw/mwmechanics/aicombataction.hpp b/apps/openmw/mwmechanics/aicombataction.hpp index 0f1f7dd5b..3db88269b 100644 --- a/apps/openmw/mwmechanics/aicombataction.hpp +++ b/apps/openmw/mwmechanics/aicombataction.hpp @@ -1,7 +1,7 @@ #ifndef OPENMW_AICOMBAT_ACTION_H #define OPENMW_AICOMBAT_ACTION_H -#include +#include #include @@ -100,7 +100,7 @@ namespace MWMechanics /// @note target may be empty float rateEffects (const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); - boost::shared_ptr prepareNextAction (const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); + std::shared_ptr prepareNextAction (const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); float getDistanceMinusHalfExtents(const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, bool minusZDist=false); float getMaxAttackDistance(const MWWorld::Ptr& actor); diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index b7a7cafe6..a65c275d6 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -199,7 +199,7 @@ namespace MWScript MWBase::Environment::get().getWindowManager()->useItem(*it); else { - boost::shared_ptr action = it->getClass().use(*it); + std::shared_ptr action = it->getClass().use(*it); // No equip sound for actors other than the player action->execute(ptr, true); } diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 2462d72ae..26d7916b1 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -478,7 +478,7 @@ namespace MWScript void InterpreterContext::executeActivation(MWWorld::Ptr ptr, MWWorld::Ptr actor) { - boost::shared_ptr action = (ptr.getClass().activate(ptr, actor)); + std::shared_ptr action = (ptr.getClass().activate(ptr, actor)); action->execute (actor); if (action->getTarget() != MWWorld::Ptr() && action->getTarget() != ptr) { diff --git a/apps/openmw/mwscript/interpretercontext.hpp b/apps/openmw/mwscript/interpretercontext.hpp index 80861d1a7..ac8e1833b 100644 --- a/apps/openmw/mwscript/interpretercontext.hpp +++ b/apps/openmw/mwscript/interpretercontext.hpp @@ -1,8 +1,6 @@ #ifndef GAME_SCRIPT_INTERPRETERCONTEXT_H #define GAME_SCRIPT_INTERPRETERCONTEXT_H -#include - #include #include "../mwworld/ptr.hpp" diff --git a/apps/openmw/mwsound/soundmanagerimp.hpp b/apps/openmw/mwsound/soundmanagerimp.hpp index 86e8b2bc7..bf628b102 100644 --- a/apps/openmw/mwsound/soundmanagerimp.hpp +++ b/apps/openmw/mwsound/soundmanagerimp.hpp @@ -7,8 +7,6 @@ #include #include -#include - #include #include diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index aa7d68d8c..4452ad889 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -6,8 +6,7 @@ #include #include #include - -#include +#include #include "livecellref.hpp" #include "cellreflist.hpp" @@ -67,7 +66,7 @@ namespace MWWorld // Even though fog actually belongs to the player and not cells, // it makes sense to store it here since we need it once for each cell. // Note this is NULL until the cell is explored to save some memory - boost::shared_ptr mFogState; + std::shared_ptr mFogState; const ESM::Cell *mCell; State mState; diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index 72696e209..e59dde7b1 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -24,7 +24,7 @@ namespace MWWorld { - std::map > Class::sClasses; + std::map > Class::sClasses; Class::Class() {} @@ -108,14 +108,14 @@ namespace MWWorld throw std::runtime_error("class cannot be hit"); } - boost::shared_ptr Class::activate (const Ptr& ptr, const Ptr& actor) const + std::shared_ptr Class::activate (const Ptr& ptr, const Ptr& actor) const { - return boost::shared_ptr (new NullAction); + return std::shared_ptr (new NullAction); } - boost::shared_ptr Class::use (const Ptr& ptr) const + std::shared_ptr Class::use (const Ptr& ptr) const { - return boost::shared_ptr (new NullAction); + return std::shared_ptr (new NullAction); } ContainerStore& Class::getContainerStore (const Ptr& ptr) const @@ -233,7 +233,7 @@ namespace MWWorld if (key.empty()) throw std::logic_error ("Class::get(): attempting to get an empty key"); - std::map >::const_iterator iter = sClasses.find (key); + std::map >::const_iterator iter = sClasses.find (key); if (iter==sClasses.end()) throw std::logic_error ("Class::get(): unknown class key: " + key); @@ -246,7 +246,7 @@ namespace MWWorld throw std::runtime_error ("class does not support persistence"); } - void Class::registerClass(const std::string& key, boost::shared_ptr instance) + void Class::registerClass(const std::string& key, std::shared_ptr instance) { instance->mTypeName = key; sClasses.insert(std::make_pair(key, instance)); @@ -330,23 +330,23 @@ namespace MWWorld { } - boost::shared_ptr Class::defaultItemActivate(const Ptr &ptr, const Ptr &actor) const + std::shared_ptr Class::defaultItemActivate(const Ptr &ptr, const Ptr &actor) const { if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) - return boost::shared_ptr(new NullAction()); + return std::shared_ptr(new NullAction()); if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfItem"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } - boost::shared_ptr action(new ActionTake(ptr)); + std::shared_ptr action(new ActionTake(ptr)); action->setSound(getUpSoundId(ptr)); return action; diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 3b1ddb647..42d57ffab 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -2,11 +2,10 @@ #define GAME_MWWORLD_CLASS_H #include +#include #include #include -#include - #include "ptr.hpp" namespace ESM @@ -51,7 +50,7 @@ namespace MWWorld /// \brief Base class for referenceable esm records class Class { - static std::map > sClasses; + static std::map > sClasses; std::string mTypeName; @@ -63,7 +62,7 @@ namespace MWWorld Class(); - boost::shared_ptr defaultItemActivate(const Ptr &ptr, const Ptr &actor) const; + std::shared_ptr defaultItemActivate(const Ptr &ptr, const Ptr &actor) const; ///< Generate default action for activating inventory items virtual Ptr copyToCellImpl(const ConstPtr &ptr, CellStore &cell) const; @@ -139,10 +138,10 @@ namespace MWWorld ///< \return Can the player activate this object? /// (default implementation: true if object's user-readable name is not empty, false otherwise) - virtual boost::shared_ptr activate (const Ptr& ptr, const Ptr& actor) const; + virtual std::shared_ptr activate (const Ptr& ptr, const Ptr& actor) const; ///< Generate action for activation (default implementation: return a null action). - virtual boost::shared_ptr use (const Ptr& ptr) + virtual std::shared_ptr use (const Ptr& ptr) const; ///< Generate action for using via inventory menu (default implementation: return a /// null action). @@ -332,7 +331,7 @@ namespace MWWorld static const Class& get (const std::string& key); ///< If there is no class for this \a key, an exception is thrown. - static void registerClass (const std::string& key, boost::shared_ptr instance); + static void registerClass (const std::string& key, std::shared_ptr instance); virtual int getBaseGold(const MWWorld::ConstPtr& ptr) const; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 0421ecb24..815810d36 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3359,7 +3359,7 @@ namespace MWWorld if (object.getRefData().activate()) { - boost::shared_ptr action = (object.getClass().activate(object, actor)); + std::shared_ptr action = (object.getClass().activate(object, actor)); action->execute (actor); } } diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index ce6e27672..1707d7a4b 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -1,8 +1,6 @@ #ifndef GAME_MWWORLD_WORLDIMP_H #define GAME_MWWORLD_WORLDIMP_H -#include - #include #include @@ -100,7 +98,7 @@ namespace MWWorld std::string mCurrentWorldSpace; - boost::shared_ptr mProjectileManager; + std::shared_ptr mProjectileManager; bool mGodMode; bool mScriptsEnabled; diff --git a/components/bsa/bsa_file.cpp b/components/bsa/bsa_file.cpp index 2b9a3f632..50b3374e5 100644 --- a/components/bsa/bsa_file.cpp +++ b/components/bsa/bsa_file.cpp @@ -24,6 +24,7 @@ #include "bsa_file.hpp" #include +#include #include #include diff --git a/components/contentselector/model/loadordererror.cpp b/components/contentselector/model/loadordererror.cpp index aa69f330e..7177e8ec1 100644 --- a/components/contentselector/model/loadordererror.cpp +++ b/components/contentselector/model/loadordererror.cpp @@ -1,5 +1,5 @@ #include "loadordererror.hpp" -#include +#include QString ContentSelectorModel::LoadOrderError::sErrorToolTips[ErrorCode_LoadOrder] = { diff --git a/components/contentselector/view/contentselector.cpp b/components/contentselector/view/contentselector.cpp index 514a0444a..b98bb667d 100644 --- a/components/contentselector/view/contentselector.cpp +++ b/components/contentselector/view/contentselector.cpp @@ -6,12 +6,9 @@ #include #include - #include -#include -#include #include -#include +#include ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) : QObject(parent) diff --git a/components/esm/npcstats.cpp b/components/esm/npcstats.cpp index 4c1095b6e..a12879109 100644 --- a/components/esm/npcstats.cpp +++ b/components/esm/npcstats.cpp @@ -1,3 +1,5 @@ +#include + #include "npcstats.hpp" #include "esmreader.hpp" diff --git a/components/files/constrainedfilestream.hpp b/components/files/constrainedfilestream.hpp index 6f22e31b8..05ae0fbec 100644 --- a/components/files/constrainedfilestream.hpp +++ b/components/files/constrainedfilestream.hpp @@ -2,8 +2,7 @@ #define OPENMW_CONSTRAINEDFILESTREAM_H #include - -#include +#include namespace Files { diff --git a/components/nif/nifkey.hpp b/components/nif/nifkey.hpp index 5d96f456e..9238a6548 100644 --- a/components/nif/nifkey.hpp +++ b/components/nif/nifkey.hpp @@ -8,8 +8,6 @@ #include #include -#include - #include "niffile.hpp" namespace Nif diff --git a/components/nif/nifstream.hpp b/components/nif/nifstream.hpp index f4163ce47..860c62e64 100644 --- a/components/nif/nifstream.hpp +++ b/components/nif/nifstream.hpp @@ -3,6 +3,7 @@ #ifndef OPENMW_COMPONENTS_NIF_NIFSTREAM_HPP #define OPENMW_COMPONENTS_NIF_NIFSTREAM_HPP +#include #include #include #include diff --git a/components/nifosg/controller.hpp b/components/nifosg/controller.hpp index c2e3abb92..5fbb172f9 100644 --- a/components/nifosg/controller.hpp +++ b/components/nifosg/controller.hpp @@ -9,8 +9,6 @@ #include #include -#include - #include //UVController // FlipController @@ -101,8 +99,6 @@ namespace NifOsg // cache for next time mLastHighKey = it; - assert (it != keys.begin()); // Shouldn't happen, was checked at beginning of this function - typename MapT::MapType::const_iterator last = --it; mLastLowKey = last; float aLastTime = last->first; diff --git a/components/resource/imagemanager.cpp b/components/resource/imagemanager.cpp index db47324fb..441fd8212 100644 --- a/components/resource/imagemanager.cpp +++ b/components/resource/imagemanager.cpp @@ -1,7 +1,7 @@ #include "imagemanager.hpp" +#include #include -#include #include diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index 74d89ab7a..8d05a1b4e 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -1,5 +1,7 @@ #include "resourcesystem.hpp" +#include + #include "scenemanager.hpp" #include "imagemanager.hpp" #include "niffilemanager.hpp" diff --git a/extern/osg-ffmpeg-videoplayer/videoplayer.hpp b/extern/osg-ffmpeg-videoplayer/videoplayer.hpp index 351bc75b2..97ef13032 100644 --- a/extern/osg-ffmpeg-videoplayer/videoplayer.hpp +++ b/extern/osg-ffmpeg-videoplayer/videoplayer.hpp @@ -10,8 +10,6 @@ #include -#include - namespace osg { class Texture2D; diff --git a/extern/osg-ffmpeg-videoplayer/videostate.cpp b/extern/osg-ffmpeg-videoplayer/videostate.cpp index aa87069ac..b7be81629 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.cpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.cpp @@ -1,7 +1,7 @@ #include "videostate.hpp" +#include #include -#include #include @@ -19,8 +19,6 @@ extern "C" #include #endif - #include - #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1) #define av_frame_alloc avcodec_alloc_frame #endif diff --git a/extern/osg-ffmpeg-videoplayer/videostate.hpp b/extern/osg-ffmpeg-videoplayer/videostate.hpp index a321d07c3..e61f4feb7 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.hpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.hpp @@ -5,8 +5,6 @@ #include #include -#include - #include #include #include From 39185e6f8c99851ce99a6cfc3d4e219beea3946a Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Fri, 5 May 2017 21:42:57 +0200 Subject: [PATCH 138/318] purge the rest of boost::shared and any other boost related things that no longer are required put boost system back in, clean others up revert Qt add back boost fstream --- .travis.yml | 2 +- apps/bsatool/bsatool.cpp | 1 - apps/essimporter/importer.cpp | 72 ++++++++--------- apps/opencs/model/doc/document.hpp | 1 - apps/opencs/model/filter/andnode.cpp | 2 +- apps/opencs/model/filter/andnode.hpp | 2 +- apps/opencs/model/filter/narynode.cpp | 4 +- apps/opencs/model/filter/narynode.hpp | 6 +- apps/opencs/model/filter/node.hpp | 5 +- apps/opencs/model/filter/notnode.cpp | 2 +- apps/opencs/model/filter/notnode.hpp | 2 +- apps/opencs/model/filter/ornode.cpp | 2 +- apps/opencs/model/filter/ornode.hpp | 2 +- apps/opencs/model/filter/parser.cpp | 78 +++++++++---------- apps/opencs/model/filter/parser.hpp | 14 ++-- apps/opencs/model/filter/unarynode.cpp | 2 +- apps/opencs/model/filter/unarynode.hpp | 6 +- apps/opencs/model/world/data.cpp | 8 +- apps/opencs/model/world/data.hpp | 8 +- .../model/world/idcompletionmanager.cpp | 4 +- .../model/world/idcompletionmanager.hpp | 7 +- apps/opencs/model/world/idtableproxymodel.cpp | 2 +- apps/opencs/model/world/idtableproxymodel.hpp | 6 +- apps/opencs/view/filter/editwidget.hpp | 4 +- apps/opencs/view/filter/filterbox.cpp | 4 +- apps/opencs/view/filter/filterbox.hpp | 2 +- apps/opencs/view/filter/recordfilterbox.cpp | 4 +- apps/opencs/view/filter/recordfilterbox.hpp | 4 +- apps/opencs/view/render/object.hpp | 2 - apps/opencs/view/render/scenewidget.cpp | 2 +- apps/opencs/view/render/scenewidget.hpp | 6 +- apps/opencs/view/render/worldspacewidget.hpp | 2 - apps/opencs/view/world/table.cpp | 2 +- apps/opencs/view/world/table.hpp | 2 +- apps/opencs/view/world/tablesubview.cpp | 4 +- apps/openmw/mwrender/water.cpp | 2 - .../contentselector/view/contentselector.cpp | 4 +- .../osg-ffmpeg-videoplayer/audiodecoder.cpp | 1 + 38 files changed, 131 insertions(+), 152 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4dbc7687b..86dbdcfd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ addons: # Tests libgtest-dev, google-mock, # Boost - libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev, libboost-thread-dev, + libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev, # FFmpeg libavcodec-dev, libavformat-dev, libavutil-dev, libswscale-dev, # Audio & Video diff --git a/apps/bsatool/bsatool.cpp b/apps/bsatool/bsatool.cpp index 7f305052b..54e946cbc 100644 --- a/apps/bsatool/bsatool.cpp +++ b/apps/bsatool/bsatool.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include diff --git a/apps/essimporter/importer.cpp b/apps/essimporter/importer.cpp index c27e15a3e..2c05f9ecb 100644 --- a/apps/essimporter/importer.cpp +++ b/apps/essimporter/importer.cpp @@ -1,8 +1,8 @@ #include "importer.hpp" #include +#include -#include #include #include @@ -272,37 +272,37 @@ namespace ESSImport const unsigned int recGAME = ESM::FourCC<'G','A','M','E'>::value; const unsigned int recJOUR = ESM::FourCC<'J','O','U','R'>::value; - std::map > converters; - converters[ESM::REC_GLOB] = boost::shared_ptr(new ConvertGlobal()); - converters[ESM::REC_BOOK] = boost::shared_ptr(new ConvertBook()); - converters[ESM::REC_NPC_] = boost::shared_ptr(new ConvertNPC()); - converters[ESM::REC_CREA] = boost::shared_ptr(new ConvertCREA()); - converters[ESM::REC_NPCC] = boost::shared_ptr(new ConvertNPCC()); - converters[ESM::REC_CREC] = boost::shared_ptr(new ConvertCREC()); - converters[recREFR ] = boost::shared_ptr(new ConvertREFR()); - converters[recPCDT ] = boost::shared_ptr(new ConvertPCDT()); - converters[recFMAP ] = boost::shared_ptr(new ConvertFMAP()); - converters[recKLST ] = boost::shared_ptr(new ConvertKLST()); - converters[recSTLN ] = boost::shared_ptr(new ConvertSTLN()); - converters[recGAME ] = boost::shared_ptr(new ConvertGAME()); - converters[ESM::REC_CELL] = boost::shared_ptr(new ConvertCell()); - converters[ESM::REC_ALCH] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_CLAS] = boost::shared_ptr(new ConvertClass()); - converters[ESM::REC_SPEL] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_ARMO] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_WEAP] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_CLOT] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_ENCH] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_WEAP] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_LEVC] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_LEVI] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_CNTC] = boost::shared_ptr(new ConvertCNTC()); - converters[ESM::REC_FACT] = boost::shared_ptr(new ConvertFACT()); - converters[ESM::REC_INFO] = boost::shared_ptr(new ConvertINFO()); - converters[ESM::REC_DIAL] = boost::shared_ptr(new ConvertDIAL()); - converters[ESM::REC_QUES] = boost::shared_ptr(new ConvertQUES()); - converters[recJOUR ] = boost::shared_ptr(new ConvertJOUR()); - converters[ESM::REC_SCPT] = boost::shared_ptr(new ConvertSCPT()); + std::map > converters; + converters[ESM::REC_GLOB] = std::shared_ptr(new ConvertGlobal()); + converters[ESM::REC_BOOK] = std::shared_ptr(new ConvertBook()); + converters[ESM::REC_NPC_] = std::shared_ptr(new ConvertNPC()); + converters[ESM::REC_CREA] = std::shared_ptr(new ConvertCREA()); + converters[ESM::REC_NPCC] = std::shared_ptr(new ConvertNPCC()); + converters[ESM::REC_CREC] = std::shared_ptr(new ConvertCREC()); + converters[recREFR ] = std::shared_ptr(new ConvertREFR()); + converters[recPCDT ] = std::shared_ptr(new ConvertPCDT()); + converters[recFMAP ] = std::shared_ptr(new ConvertFMAP()); + converters[recKLST ] = std::shared_ptr(new ConvertKLST()); + converters[recSTLN ] = std::shared_ptr(new ConvertSTLN()); + converters[recGAME ] = std::shared_ptr(new ConvertGAME()); + converters[ESM::REC_CELL] = std::shared_ptr(new ConvertCell()); + converters[ESM::REC_ALCH] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_CLAS] = std::shared_ptr(new ConvertClass()); + converters[ESM::REC_SPEL] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_ARMO] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_WEAP] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_CLOT] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_ENCH] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_WEAP] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_LEVC] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_LEVI] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_CNTC] = std::shared_ptr(new ConvertCNTC()); + converters[ESM::REC_FACT] = std::shared_ptr(new ConvertFACT()); + converters[ESM::REC_INFO] = std::shared_ptr(new ConvertINFO()); + converters[ESM::REC_DIAL] = std::shared_ptr(new ConvertDIAL()); + converters[ESM::REC_QUES] = std::shared_ptr(new ConvertQUES()); + converters[recJOUR ] = std::shared_ptr(new ConvertJOUR()); + converters[ESM::REC_SCPT] = std::shared_ptr(new ConvertSCPT()); // TODO: // - REGN (weather in certain regions?) @@ -312,7 +312,7 @@ namespace ESSImport std::set unknownRecords; - for (std::map >::const_iterator it = converters.begin(); + for (std::map >::const_iterator it = converters.begin(); it != converters.end(); ++it) { it->second->setContext(context); @@ -323,7 +323,7 @@ namespace ESSImport ESM::NAME n = esm.getRecName(); esm.getRecHeader(); - std::map >::iterator it = converters.find(n.intval); + std::map >::iterator it = converters.find(n.intval); if (it != converters.end()) { it->second->read(esm); @@ -386,7 +386,7 @@ namespace ESSImport // Writing order should be Dynamic Store -> Cells -> Player, // so that references to dynamic records can be recognized when loading - for (std::map >::const_iterator it = converters.begin(); + for (std::map >::const_iterator it = converters.begin(); it != converters.end(); ++it) { if (it->second->getStage() != 0) @@ -399,7 +399,7 @@ namespace ESSImport context.mPlayerBase.save(writer); writer.endRecord(ESM::REC_NPC_); - for (std::map >::const_iterator it = converters.begin(); + for (std::map >::const_iterator it = converters.begin(); it != converters.end(); ++it) { if (it->second->getStage() != 1) diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 8a9c49a09..030a0174e 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -3,7 +3,6 @@ #include -#include #include #include diff --git a/apps/opencs/model/filter/andnode.cpp b/apps/opencs/model/filter/andnode.cpp index 908662799..757865717 100644 --- a/apps/opencs/model/filter/andnode.cpp +++ b/apps/opencs/model/filter/andnode.cpp @@ -2,7 +2,7 @@ #include -CSMFilter::AndNode::AndNode (const std::vector >& nodes) +CSMFilter::AndNode::AndNode (const std::vector >& nodes) : NAryNode (nodes, "and") {} diff --git a/apps/opencs/model/filter/andnode.hpp b/apps/opencs/model/filter/andnode.hpp index 3838b451d..56d1d7948 100644 --- a/apps/opencs/model/filter/andnode.hpp +++ b/apps/opencs/model/filter/andnode.hpp @@ -9,7 +9,7 @@ namespace CSMFilter { public: - AndNode (const std::vector >& nodes); + AndNode (const std::vector >& nodes); virtual bool test (const CSMWorld::IdTableBase& table, int row, const std::map& columns) const; diff --git a/apps/opencs/model/filter/narynode.cpp b/apps/opencs/model/filter/narynode.cpp index f2e0e5cb2..2fa9ac6cc 100644 --- a/apps/opencs/model/filter/narynode.cpp +++ b/apps/opencs/model/filter/narynode.cpp @@ -2,7 +2,7 @@ #include -CSMFilter::NAryNode::NAryNode (const std::vector >& nodes, +CSMFilter::NAryNode::NAryNode (const std::vector >& nodes, const std::string& name) : mNodes (nodes), mName (name) {} @@ -21,7 +21,7 @@ std::vector CSMFilter::NAryNode::getReferencedColumns() const { std::vector columns; - for (std::vector >::const_iterator iter (mNodes.begin()); + for (std::vector >::const_iterator iter (mNodes.begin()); iter!=mNodes.end(); ++iter) { std::vector columns2 = (*iter)->getReferencedColumns(); diff --git a/apps/opencs/model/filter/narynode.hpp b/apps/opencs/model/filter/narynode.hpp index aa501d009..1cd93e62e 100644 --- a/apps/opencs/model/filter/narynode.hpp +++ b/apps/opencs/model/filter/narynode.hpp @@ -4,20 +4,18 @@ #include #include -#include - #include "node.hpp" namespace CSMFilter { class NAryNode : public Node { - std::vector > mNodes; + std::vector > mNodes; std::string mName; public: - NAryNode (const std::vector >& nodes, const std::string& name); + NAryNode (const std::vector >& nodes, const std::string& name); int getSize() const; diff --git a/apps/opencs/model/filter/node.hpp b/apps/opencs/model/filter/node.hpp index 58588bdc5..7295b9018 100644 --- a/apps/opencs/model/filter/node.hpp +++ b/apps/opencs/model/filter/node.hpp @@ -3,10 +3,9 @@ #include #include +#include #include -#include - #include namespace CSMWorld @@ -48,6 +47,6 @@ namespace CSMFilter }; } -Q_DECLARE_METATYPE (boost::shared_ptr) +Q_DECLARE_METATYPE (std::shared_ptr) #endif diff --git a/apps/opencs/model/filter/notnode.cpp b/apps/opencs/model/filter/notnode.cpp index ba5302bbe..81588c754 100644 --- a/apps/opencs/model/filter/notnode.cpp +++ b/apps/opencs/model/filter/notnode.cpp @@ -1,6 +1,6 @@ #include "notnode.hpp" -CSMFilter::NotNode::NotNode (boost::shared_ptr child) : UnaryNode (child, "not") {} +CSMFilter::NotNode::NotNode (std::shared_ptr child) : UnaryNode (child, "not") {} bool CSMFilter::NotNode::test (const CSMWorld::IdTableBase& table, int row, const std::map& columns) const diff --git a/apps/opencs/model/filter/notnode.hpp b/apps/opencs/model/filter/notnode.hpp index 0281d99da..e3c57cede 100644 --- a/apps/opencs/model/filter/notnode.hpp +++ b/apps/opencs/model/filter/notnode.hpp @@ -9,7 +9,7 @@ namespace CSMFilter { public: - NotNode (boost::shared_ptr child); + NotNode (std::shared_ptr child); virtual bool test (const CSMWorld::IdTableBase& table, int row, const std::map& columns) const; diff --git a/apps/opencs/model/filter/ornode.cpp b/apps/opencs/model/filter/ornode.cpp index 41ec7b5cf..9e6d8b2c4 100644 --- a/apps/opencs/model/filter/ornode.cpp +++ b/apps/opencs/model/filter/ornode.cpp @@ -2,7 +2,7 @@ #include -CSMFilter::OrNode::OrNode (const std::vector >& nodes) +CSMFilter::OrNode::OrNode (const std::vector >& nodes) : NAryNode (nodes, "or") {} diff --git a/apps/opencs/model/filter/ornode.hpp b/apps/opencs/model/filter/ornode.hpp index 07ab51a6a..b89da4e75 100644 --- a/apps/opencs/model/filter/ornode.hpp +++ b/apps/opencs/model/filter/ornode.hpp @@ -9,7 +9,7 @@ namespace CSMFilter { public: - OrNode (const std::vector >& nodes); + OrNode (const std::vector >& nodes); virtual bool test (const CSMWorld::IdTableBase& table, int row, const std::map& columns) const; diff --git a/apps/opencs/model/filter/parser.cpp b/apps/opencs/model/filter/parser.cpp index c0c089169..d2bedc666 100644 --- a/apps/opencs/model/filter/parser.cpp +++ b/apps/opencs/model/filter/parser.cpp @@ -235,7 +235,7 @@ CSMFilter::Token CSMFilter::Parser::getNextToken() return Token (Token::Type_None); } -boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot) +std::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot) { if (Token token = getNextToken()) { @@ -247,11 +247,11 @@ boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, { case Token::Type_Keyword_True: - return boost::shared_ptr (new BooleanNode (true)); + return std::shared_ptr (new BooleanNode (true)); case Token::Type_Keyword_False: - return boost::shared_ptr (new BooleanNode (false)); + return std::shared_ptr (new BooleanNode (false)); case Token::Type_Keyword_And: case Token::Type_Keyword_Or: @@ -260,12 +260,12 @@ boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, case Token::Type_Keyword_Not: { - boost::shared_ptr node = parseImp(); + std::shared_ptr node = parseImp(); if (mError) - return boost::shared_ptr(); + return std::shared_ptr(); - return boost::shared_ptr (new NotNode (node)); + return std::shared_ptr (new NotNode (node)); } case Token::Type_Keyword_Text: @@ -281,7 +281,7 @@ boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, if (!allowEmpty) error(); - return boost::shared_ptr(); + return std::shared_ptr(); default: @@ -289,27 +289,27 @@ boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, } } - return boost::shared_ptr(); + return std::shared_ptr(); } -boost::shared_ptr CSMFilter::Parser::parseNAry (const Token& keyword) +std::shared_ptr CSMFilter::Parser::parseNAry (const Token& keyword) { - std::vector > nodes; + std::vector > nodes; Token token = getNextToken(); if (token.mType!=Token::Type_Open) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } for (;;) { - boost::shared_ptr node = parseImp(); + std::shared_ptr node = parseImp(); if (mError) - return boost::shared_ptr(); + return std::shared_ptr(); nodes.push_back (node); @@ -318,7 +318,7 @@ boost::shared_ptr CSMFilter::Parser::parseNAry (const Token& ke if (!token || (token.mType!=Token::Type_Close && token.mType!=Token::Type_Comma)) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } if (token.mType==Token::Type_Close) @@ -328,31 +328,31 @@ boost::shared_ptr CSMFilter::Parser::parseNAry (const Token& ke if (nodes.empty()) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } switch (keyword.mType) { - case Token::Type_Keyword_And: return boost::shared_ptr (new AndNode (nodes)); - case Token::Type_Keyword_Or: return boost::shared_ptr (new OrNode (nodes)); - default: error(); return boost::shared_ptr(); + case Token::Type_Keyword_And: return std::shared_ptr (new AndNode (nodes)); + case Token::Type_Keyword_Or: return std::shared_ptr (new OrNode (nodes)); + default: error(); return std::shared_ptr(); } } -boost::shared_ptr CSMFilter::Parser::parseText() +std::shared_ptr CSMFilter::Parser::parseText() { Token token = getNextToken(); if (token.mType!=Token::Type_Open) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); if (!token) - return boost::shared_ptr(); + return std::shared_ptr(); // parse column ID int columnId = -1; @@ -370,7 +370,7 @@ boost::shared_ptr CSMFilter::Parser::parseText() if (columnId<0) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); @@ -378,7 +378,7 @@ boost::shared_ptr CSMFilter::Parser::parseText() if (token.mType!=Token::Type_Comma) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } // parse text pattern @@ -387,7 +387,7 @@ boost::shared_ptr CSMFilter::Parser::parseText() if (!token.isString()) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } std::string text = token.mString; @@ -397,26 +397,26 @@ boost::shared_ptr CSMFilter::Parser::parseText() if (token.mType!=Token::Type_Close) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } - return boost::shared_ptr (new TextNode (columnId, text)); + return std::shared_ptr (new TextNode (columnId, text)); } -boost::shared_ptr CSMFilter::Parser::parseValue() +std::shared_ptr CSMFilter::Parser::parseValue() { Token token = getNextToken(); if (token.mType!=Token::Type_Open) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); if (!token) - return boost::shared_ptr(); + return std::shared_ptr(); // parse column ID int columnId = -1; @@ -434,7 +434,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() if (columnId<0) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); @@ -442,7 +442,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() if (token.mType!=Token::Type_Comma) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } // parse value @@ -467,7 +467,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() else if (token.mType!=Token::Type_CloseSquare && token.mType!=Token::Type_Open) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); @@ -481,7 +481,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() if (token.mType!=Token::Type_Comma) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } } else if (token.mType==Token::Type_Comma) @@ -491,7 +491,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() else { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); @@ -513,7 +513,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() else if (token.mType!=Token::Type_OpenSquare && token.mType!=Token::Type_Close) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } } @@ -522,10 +522,10 @@ boost::shared_ptr CSMFilter::Parser::parseValue() if (token.mType!=Token::Type_Close) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } - return boost::shared_ptr (new ValueNode (columnId, lowerType, upperType, lower, upper)); + return std::shared_ptr (new ValueNode (columnId, lowerType, upperType, lower, upper)); } void CSMFilter::Parser::error() @@ -556,7 +556,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined) } else if (!allowPredefined || token==Token (Token::Type_OneShot)) { - boost::shared_ptr node = parseImp (true, token!=Token (Token::Type_OneShot)); + std::shared_ptr node = parseImp (true, token!=Token (Token::Type_OneShot)); if (mError) return false; @@ -612,7 +612,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined) } } -boost::shared_ptr CSMFilter::Parser::getFilter() const +std::shared_ptr CSMFilter::Parser::getFilter() const { if (mError) throw std::logic_error ("No filter available"); diff --git a/apps/opencs/model/filter/parser.hpp b/apps/opencs/model/filter/parser.hpp index 5700102cf..344c552ef 100644 --- a/apps/opencs/model/filter/parser.hpp +++ b/apps/opencs/model/filter/parser.hpp @@ -1,8 +1,6 @@ #ifndef CSM_FILTER_PARSER_H #define CSM_FILTER_PARSER_H -#include - #include "node.hpp" namespace CSMWorld @@ -16,7 +14,7 @@ namespace CSMFilter class Parser { - boost::shared_ptr mFilter; + std::shared_ptr mFilter; std::string mInput; int mIndex; bool mError; @@ -31,14 +29,14 @@ namespace CSMFilter Token checkKeywords (const Token& token); ///< Turn string token into keyword token, if possible. - boost::shared_ptr parseImp (bool allowEmpty = false, bool ignoreOneShot = false); + std::shared_ptr parseImp (bool allowEmpty = false, bool ignoreOneShot = false); ///< Will return a null-pointer, if there is nothing more to parse. - boost::shared_ptr parseNAry (const Token& keyword); + std::shared_ptr parseNAry (const Token& keyword); - boost::shared_ptr parseText(); + std::shared_ptr parseText(); - boost::shared_ptr parseValue(); + std::shared_ptr parseValue(); void error(); @@ -51,7 +49,7 @@ namespace CSMFilter /// /// \return Success? - boost::shared_ptr getFilter() const; + std::shared_ptr getFilter() const; ///< Throws an exception if the last call to parse did not return true. }; } diff --git a/apps/opencs/model/filter/unarynode.cpp b/apps/opencs/model/filter/unarynode.cpp index cbdadf6fc..7211f78b0 100644 --- a/apps/opencs/model/filter/unarynode.cpp +++ b/apps/opencs/model/filter/unarynode.cpp @@ -1,6 +1,6 @@ #include "unarynode.hpp" -CSMFilter::UnaryNode::UnaryNode (boost::shared_ptr child, const std::string& name) +CSMFilter::UnaryNode::UnaryNode (std::shared_ptr child, const std::string& name) : mChild (child), mName (name) {} diff --git a/apps/opencs/model/filter/unarynode.hpp b/apps/opencs/model/filter/unarynode.hpp index 6bbc96092..cbee4e0ba 100644 --- a/apps/opencs/model/filter/unarynode.hpp +++ b/apps/opencs/model/filter/unarynode.hpp @@ -1,20 +1,18 @@ #ifndef CSM_FILTER_UNARYNODE_H #define CSM_FILTER_UNARYNODE_H -#include - #include "node.hpp" namespace CSMFilter { class UnaryNode : public Node { - boost::shared_ptr mChild; + std::shared_ptr mChild; std::string mName; public: - UnaryNode (boost::shared_ptr child, const std::string& name); + UnaryNode (std::shared_ptr child, const std::string& name); const Node& getChild() const; diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 5a59f19f7..8b7faf2ed 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -554,12 +554,12 @@ CSMWorld::Data::~Data() delete mReader; } -boost::shared_ptr CSMWorld::Data::getResourceSystem() +std::shared_ptr CSMWorld::Data::getResourceSystem() { return mResourceSystem; } -boost::shared_ptr CSMWorld::Data::getResourceSystem() const +std::shared_ptr CSMWorld::Data::getResourceSystem() const { return mResourceSystem; } @@ -891,7 +891,7 @@ void CSMWorld::Data::merge() int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base, bool project) { // Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading - boost::shared_ptr ptr(mReader); + std::shared_ptr ptr(mReader); mReaders.push_back(ptr); mReader = 0; @@ -945,7 +945,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages) // Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading. // We don't store non-base reader, because everything going into modified will be // fully loaded during the initial loading process. - boost::shared_ptr ptr(mReader); + std::shared_ptr ptr(mReader); mReaders.push_back(ptr); } else diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index dc00a33d2..f96003e44 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -119,9 +119,9 @@ namespace CSMWorld std::map > mRefLoadCache; int mReaderIndex; - boost::shared_ptr mResourceSystem; + std::shared_ptr mResourceSystem; - std::vector > mReaders; + std::vector > mReaders; std::map mContentFileNames; @@ -148,9 +148,9 @@ namespace CSMWorld const Fallback::Map* getFallbackMap() const; - boost::shared_ptr getResourceSystem(); + std::shared_ptr getResourceSystem(); - boost::shared_ptr getResourceSystem() const; + std::shared_ptr getResourceSystem() const; const IdCollection& getGlobals() const; diff --git a/apps/opencs/model/world/idcompletionmanager.cpp b/apps/opencs/model/world/idcompletionmanager.cpp index 7f3221342..a6de2c8f5 100644 --- a/apps/opencs/model/world/idcompletionmanager.cpp +++ b/apps/opencs/model/world/idcompletionmanager.cpp @@ -77,7 +77,7 @@ bool CSMWorld::IdCompletionManager::hasCompleterFor(CSMWorld::ColumnBase::Displa return mCompleters.find(display) != mCompleters.end(); } -boost::shared_ptr CSMWorld::IdCompletionManager::getCompleter(CSMWorld::ColumnBase::Display display) +std::shared_ptr CSMWorld::IdCompletionManager::getCompleter(CSMWorld::ColumnBase::Display display) { if (!hasCompleterFor(display)) { @@ -99,7 +99,7 @@ void CSMWorld::IdCompletionManager::generateCompleters(CSMWorld::Data &data) int idColumn = table->searchColumnIndex(CSMWorld::Columns::ColumnId_Id); if (idColumn != -1) { - boost::shared_ptr completer = boost::make_shared(table); + std::shared_ptr completer = std::make_shared(table); completer->setCompletionColumn(idColumn); // The completion role must be Qt::DisplayRole to get the ID values from the model completer->setCompletionRole(Qt::DisplayRole); diff --git a/apps/opencs/model/world/idcompletionmanager.hpp b/apps/opencs/model/world/idcompletionmanager.hpp index 7944e6777..e48360432 100644 --- a/apps/opencs/model/world/idcompletionmanager.hpp +++ b/apps/opencs/model/world/idcompletionmanager.hpp @@ -3,8 +3,7 @@ #include #include - -#include +#include #include "columnbase.hpp" #include "universalid.hpp" @@ -20,7 +19,7 @@ namespace CSMWorld { static const std::map sCompleterModelTypes; - std::map > mCompleters; + std::map > mCompleters; // Don't allow copying IdCompletionManager(const IdCompletionManager &); @@ -34,7 +33,7 @@ namespace CSMWorld IdCompletionManager(Data &data); bool hasCompleterFor(ColumnBase::Display display) const; - boost::shared_ptr getCompleter(ColumnBase::Display display); + std::shared_ptr getCompleter(ColumnBase::Display display); }; } diff --git a/apps/opencs/model/world/idtableproxymodel.cpp b/apps/opencs/model/world/idtableproxymodel.cpp index fbf7b6cf3..6d50e9edb 100644 --- a/apps/opencs/model/world/idtableproxymodel.cpp +++ b/apps/opencs/model/world/idtableproxymodel.cpp @@ -82,7 +82,7 @@ void CSMWorld::IdTableProxyModel::setSourceModel(QAbstractItemModel *model) SLOT(sourceDataChanged(const QModelIndex &, const QModelIndex &))); } -void CSMWorld::IdTableProxyModel::setFilter (const boost::shared_ptr& filter) +void CSMWorld::IdTableProxyModel::setFilter (const std::shared_ptr& filter) { beginResetModel(); mFilter = filter; diff --git a/apps/opencs/model/world/idtableproxymodel.hpp b/apps/opencs/model/world/idtableproxymodel.hpp index cf31b5c11..dd7ab41eb 100644 --- a/apps/opencs/model/world/idtableproxymodel.hpp +++ b/apps/opencs/model/world/idtableproxymodel.hpp @@ -3,8 +3,6 @@ #include -#include - #include #include @@ -19,7 +17,7 @@ namespace CSMWorld { Q_OBJECT - boost::shared_ptr mFilter; + std::shared_ptr mFilter; std::map mColumnMap; // column ID, column index in this model (or -1) // Cache of enum values for enum columns (e.g. Modified, Record Type). @@ -43,7 +41,7 @@ namespace CSMWorld virtual void setSourceModel(QAbstractItemModel *model); - void setFilter (const boost::shared_ptr& filter); + void setFilter (const std::shared_ptr& filter); void refreshFilter(); diff --git a/apps/opencs/view/filter/editwidget.hpp b/apps/opencs/view/filter/editwidget.hpp index f672877d9..51a36969a 100644 --- a/apps/opencs/view/filter/editwidget.hpp +++ b/apps/opencs/view/filter/editwidget.hpp @@ -1,8 +1,6 @@ #ifndef CSV_FILTER_EDITWIDGET_H #define CSV_FILTER_EDITWIDGET_H -#include - #include #include #include @@ -38,7 +36,7 @@ namespace CSVFilter signals: - void filterChanged (boost::shared_ptr filter); + void filterChanged (std::shared_ptr filter); private: std::string generateFilter(std::pair >& seekedString) const; diff --git a/apps/opencs/view/filter/filterbox.cpp b/apps/opencs/view/filter/filterbox.cpp index 4c252e7d9..461b131db 100644 --- a/apps/opencs/view/filter/filterbox.cpp +++ b/apps/opencs/view/filter/filterbox.cpp @@ -21,8 +21,8 @@ CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent) setLayout (layout); connect (mRecordFilterBox, - SIGNAL (filterChanged (boost::shared_ptr)), - this, SIGNAL (recordFilterChanged (boost::shared_ptr))); + SIGNAL (filterChanged (std::shared_ptr)), + this, SIGNAL (recordFilterChanged (std::shared_ptr))); setAcceptDrops(true); } diff --git a/apps/opencs/view/filter/filterbox.hpp b/apps/opencs/view/filter/filterbox.hpp index c765164e7..e794a9880 100644 --- a/apps/opencs/view/filter/filterbox.hpp +++ b/apps/opencs/view/filter/filterbox.hpp @@ -41,7 +41,7 @@ namespace CSVFilter void dragMoveEvent(QDragMoveEvent *event); signals: - void recordFilterChanged (boost::shared_ptr filter); + void recordFilterChanged (std::shared_ptr filter); void recordDropped (std::vector& types, Qt::DropAction action); }; diff --git a/apps/opencs/view/filter/recordfilterbox.cpp b/apps/opencs/view/filter/recordfilterbox.cpp index 2bf589215..d24465897 100644 --- a/apps/opencs/view/filter/recordfilterbox.cpp +++ b/apps/opencs/view/filter/recordfilterbox.cpp @@ -23,8 +23,8 @@ CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *pare setLayout (layout); connect ( - mEdit, SIGNAL (filterChanged (boost::shared_ptr)), - this, SIGNAL (filterChanged (boost::shared_ptr))); + mEdit, SIGNAL (filterChanged (std::shared_ptr)), + this, SIGNAL (filterChanged (std::shared_ptr))); } void CSVFilter::RecordFilterBox::setFilter (const std::string& filter) diff --git a/apps/opencs/view/filter/recordfilterbox.hpp b/apps/opencs/view/filter/recordfilterbox.hpp index 29d12529a..77a07c92b 100644 --- a/apps/opencs/view/filter/recordfilterbox.hpp +++ b/apps/opencs/view/filter/recordfilterbox.hpp @@ -1,8 +1,6 @@ #ifndef CSV_FILTER_RECORDFILTERBOX_H #define CSV_FILTER_RECORDFILTERBOX_H -#include - #include #include @@ -38,7 +36,7 @@ namespace CSVFilter signals: - void filterChanged (boost::shared_ptr filter); + void filterChanged (std::shared_ptr filter); }; } diff --git a/apps/opencs/view/render/object.hpp b/apps/opencs/view/render/object.hpp index d3cba6c55..e28e2562c 100644 --- a/apps/opencs/view/render/object.hpp +++ b/apps/opencs/view/render/object.hpp @@ -3,8 +3,6 @@ #include -#include - #include #include diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index a072cd0aa..82eebf127 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -172,7 +172,7 @@ void CompositeViewer::update() // --------------------------------------------------- -SceneWidget::SceneWidget(boost::shared_ptr resourceSystem, QWidget *parent, Qt::WindowFlags f, +SceneWidget::SceneWidget(std::shared_ptr resourceSystem, QWidget *parent, Qt::WindowFlags f, bool retrieveInput) : RenderWidget(parent, f) , mResourceSystem(resourceSystem) diff --git a/apps/opencs/view/render/scenewidget.hpp b/apps/opencs/view/render/scenewidget.hpp index c5d9cdfce..cc3191c81 100644 --- a/apps/opencs/view/render/scenewidget.hpp +++ b/apps/opencs/view/render/scenewidget.hpp @@ -10,8 +10,6 @@ #include #include -#include - #include "lightingday.hpp" #include "lightingnight.hpp" #include "lightingbright.hpp" @@ -78,7 +76,7 @@ namespace CSVRender { Q_OBJECT public: - SceneWidget(boost::shared_ptr resourceSystem, QWidget* parent = 0, + SceneWidget(std::shared_ptr resourceSystem, QWidget* parent = 0, Qt::WindowFlags f = 0, bool retrieveInput = true); virtual ~SceneWidget(); @@ -98,7 +96,7 @@ namespace CSVRender virtual void mouseMoveEvent (QMouseEvent *event); virtual void wheelEvent (QWheelEvent *event); - boost::shared_ptr mResourceSystem; + std::shared_ptr mResourceSystem; Lighting* mLighting; diff --git a/apps/opencs/view/render/worldspacewidget.hpp b/apps/opencs/view/render/worldspacewidget.hpp index b30d7de8a..08b97e1be 100644 --- a/apps/opencs/view/render/worldspacewidget.hpp +++ b/apps/opencs/view/render/worldspacewidget.hpp @@ -1,8 +1,6 @@ #ifndef OPENCS_VIEW_WORLDSPACEWIDGET_H #define OPENCS_VIEW_WORLDSPACEWIDGET_H -#include - #include #include diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 07db5b477..30dba4241 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -692,7 +692,7 @@ void CSVWorld::Table::requestFocus (const std::string& id) scrollTo (index, QAbstractItemView::PositionAtTop); } -void CSVWorld::Table::recordFilterChanged (boost::shared_ptr filter) +void CSVWorld::Table::recordFilterChanged (std::shared_ptr filter) { mProxyModel->setFilter (filter); tableSizeUpdate(); diff --git a/apps/opencs/view/world/table.hpp b/apps/opencs/view/world/table.hpp index 768ff185d..26f6e7899 100644 --- a/apps/opencs/view/world/table.hpp +++ b/apps/opencs/view/world/table.hpp @@ -151,7 +151,7 @@ namespace CSVWorld void requestFocus (const std::string& id); - void recordFilterChanged (boost::shared_ptr filter); + void recordFilterChanged (std::shared_ptr filter); void rowAdded(const std::string &id); }; diff --git a/apps/opencs/view/world/tablesubview.cpp b/apps/opencs/view/world/tablesubview.cpp index fcf66ed81..6664a3771 100644 --- a/apps/opencs/view/world/tablesubview.cpp +++ b/apps/opencs/view/world/tablesubview.cpp @@ -78,8 +78,8 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D mTable, SLOT (requestFocus (const std::string&))); connect (mFilterBox, - SIGNAL (recordFilterChanged (boost::shared_ptr)), - mTable, SLOT (recordFilterChanged (boost::shared_ptr))); + SIGNAL (recordFilterChanged (std::shared_ptr)), + mTable, SLOT (recordFilterChanged (std::shared_ptr))); connect(mFilterBox, SIGNAL(recordDropped(std::vector&, Qt::DropAction)), this, SLOT(createFilterRequest(std::vector&, Qt::DropAction))); diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index ac0337af5..02882adbe 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -28,11 +28,9 @@ #include #include -#include #include -#include #include diff --git a/components/contentselector/view/contentselector.cpp b/components/contentselector/view/contentselector.cpp index b98bb667d..f4da7e6ad 100644 --- a/components/contentselector/view/contentselector.cpp +++ b/components/contentselector/view/contentselector.cpp @@ -6,9 +6,11 @@ #include #include + #include +#include +#include #include -#include ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) : QObject(parent) diff --git a/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp b/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp index 096a17a64..09de3bc44 100644 --- a/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp +++ b/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp @@ -1,6 +1,7 @@ #include "audiodecoder.hpp" #include +#include extern "C" { From d97aa9152bdf15eb167e51def6cb5aae4187264c Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 6 May 2017 13:23:44 +0200 Subject: [PATCH 139/318] remove more unused imports, including boost headers --- apps/opencs/model/world/idcompletionmanager.cpp | 2 -- apps/openmw/mwgui/bookpage.cpp | 4 ---- apps/openmw/mwgui/journalviewmodel.cpp | 2 -- 3 files changed, 8 deletions(-) diff --git a/apps/opencs/model/world/idcompletionmanager.cpp b/apps/opencs/model/world/idcompletionmanager.cpp index a6de2c8f5..9fa6e3add 100644 --- a/apps/opencs/model/world/idcompletionmanager.cpp +++ b/apps/opencs/model/world/idcompletionmanager.cpp @@ -1,7 +1,5 @@ #include "idcompletionmanager.hpp" -#include - #include #include "../../view/widget/completerpopup.hpp" diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 24dfe6024..883195f51 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -6,10 +6,6 @@ #include "MyGUI_TextureUtility.h" #include "MyGUI_FactoryManager.h" -#include -#include -#include - #include namespace MWGui diff --git a/apps/openmw/mwgui/journalviewmodel.cpp b/apps/openmw/mwgui/journalviewmodel.cpp index a2819b749..2e0d07787 100644 --- a/apps/openmw/mwgui/journalviewmodel.cpp +++ b/apps/openmw/mwgui/journalviewmodel.cpp @@ -2,7 +2,6 @@ #include #include -#include #include @@ -15,7 +14,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwdialogue/journalentry.hpp" #include "../mwdialogue/keywordsearch.hpp" namespace MWGui { From b7c27e5e9658381b62e1b870dcfef353321a6c2d Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 6 May 2017 13:29:47 +0200 Subject: [PATCH 140/318] remove boost/tuple --- apps/openmw/mwgui/spellview.hpp | 2 +- components/misc/utf8stream.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/spellview.hpp b/apps/openmw/mwgui/spellview.hpp index 7fea95cac..0eb69f6ba 100644 --- a/apps/openmw/mwgui/spellview.hpp +++ b/apps/openmw/mwgui/spellview.hpp @@ -1,7 +1,7 @@ #ifndef OPENMW_GUI_SPELLVIEW_H #define OPENMW_GUI_SPELLVIEW_H -#include +#include #include diff --git a/components/misc/utf8stream.hpp b/components/misc/utf8stream.hpp index 4856d6503..760015902 100644 --- a/components/misc/utf8stream.hpp +++ b/components/misc/utf8stream.hpp @@ -1,7 +1,7 @@ #ifndef MISC_UTF8ITER_HPP #define MISC_UTF8ITER_HPP -#include +#include class Utf8Stream { @@ -60,7 +60,7 @@ public: int octets; UnicodeChar chr; - boost::tie (octets, chr) = octet_count (*cur++); + std::tie (octets, chr) = octet_count (*cur++); if (octets > 5) return std::make_pair (sBadChar(), cur); @@ -104,7 +104,7 @@ private: void next () { - boost::tie (val, nxt) = decode (nxt, end); + std::tie (val, nxt) = decode (nxt, end); } Point cur; From 98752a97029a42640c08ff9abd331e2ce7101e6c Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 6 May 2017 15:12:06 +0200 Subject: [PATCH 141/318] replace boost::bind --- apps/openmw/mwgui/dialogue.cpp | 4 +--- apps/openmw/mwgui/journalwindow.cpp | 5 ++--- components/files/configurationmanager.cpp | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index c03673b90..2c5adfbab 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -1,7 +1,5 @@ #include "dialogue.hpp" -#include - #include #include #include @@ -281,7 +279,7 @@ namespace MWGui mScrollBar->eventScrollChangePosition += MyGUI::newDelegate(this, &DialogueWindow::onScrollbarMoved); mHistory->eventMouseWheel += MyGUI::newDelegate(this, &DialogueWindow::onMouseWheel); - BookPage::ClickCallback callback = boost::bind (&DialogueWindow::notifyLinkClicked, this, _1); + BookPage::ClickCallback callback = std::bind (&DialogueWindow::notifyLinkClicked, this, std::placeholders::_1); mHistory->adviseLinkClicked(callback); mMainWidget->castType()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize); diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 9af87c7ae..5f309f148 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -124,7 +123,7 @@ namespace { MWGui::BookPage::ClickCallback callback; - callback = boost::bind (&JournalWindowImpl::notifyTopicClicked, this, _1); + callback = std::bind (&JournalWindowImpl::notifyTopicClicked, this, std::placeholders::_1); getPage (LeftBookPage)->adviseLinkClicked (callback); getPage (RightBookPage)->adviseLinkClicked (callback); @@ -136,7 +135,7 @@ namespace { MWGui::BookPage::ClickCallback callback; - callback = boost::bind (&JournalWindowImpl::notifyIndexLinkClicked, this, _1); + callback = std::bind(&JournalWindowImpl::notifyIndexLinkClicked, this, std::placeholders::_1); getPage (LeftTopicIndex)->adviseLinkClicked (callback); getPage (RightTopicIndex)->adviseLinkClicked (callback); diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index b53e3834a..46dbca8dc 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -7,7 +7,6 @@ #include -#include #include #include #include @@ -130,7 +129,7 @@ void ConfigurationManager::processPaths(Files::PathContainer& dataDirs, bool cre } dataDirs.erase(std::remove_if(dataDirs.begin(), dataDirs.end(), - boost::bind(&boost::filesystem::path::empty, _1)), dataDirs.end()); + std::bind(&boost::filesystem::path::empty, std::placeholders::_1)), dataDirs.end()); } bool ConfigurationManager::loadConfig(const boost::filesystem::path& path, From d48b829b45eabc34990c990e9698e9d0a99f98b6 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 6 May 2017 23:05:13 +0200 Subject: [PATCH 142/318] replace and purge boost::lexical_cast --- apps/opencs/model/tools/referencecheck.cpp | 14 ++++++-------- apps/opencs/model/world/columnimp.hpp | 2 -- apps/opencs/view/render/cellmarker.cpp | 9 ++------- apps/openmw/mwclass/misc.cpp | 7 +------ apps/openmw/mwgui/enchantingdialog.cpp | 4 ---- apps/openmw/mwgui/spellmodel.cpp | 10 ++++------ apps/openmw/mwinput/inputmanagerimp.cpp | 14 +++++--------- components/esm/loadmgef.cpp | 5 +---- components/fallback/fallback.cpp | 14 ++++++++------ components/shader/shadermanager.cpp | 6 ++---- components/shader/shadervisitor.cpp | 4 +--- components/widgets/numericeditbox.cpp | 6 ++---- extern/oics/ICSInputControlSystem.h | 2 -- 13 files changed, 32 insertions(+), 65 deletions(-) diff --git a/apps/opencs/model/tools/referencecheck.cpp b/apps/opencs/model/tools/referencecheck.cpp index be9663e7a..7f247741c 100644 --- a/apps/opencs/model/tools/referencecheck.cpp +++ b/apps/opencs/model/tools/referencecheck.cpp @@ -1,7 +1,5 @@ #include "referencecheck.hpp" -#include - CSMTools::ReferenceCheckStage::ReferenceCheckStage( const CSMWorld::RefCollection& references, const CSMWorld::RefIdCollection& referencables, @@ -40,9 +38,9 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if ((isLight && cellRef.mChargeFloat < -1) || (!isLight && cellRef.mChargeInt < -1)) { std::string str = " has invalid charge "; if (localIndex.second == CSMWorld::UniversalId::Type_Light) - str += boost::lexical_cast(cellRef.mChargeFloat); + str += std::to_string(cellRef.mChargeFloat); else - str += boost::lexical_cast(cellRef.mChargeInt); + str += std::to_string(cellRef.mChargeInt); messages.push_back(std::make_pair(id, id.getId() + str)); } } @@ -66,9 +64,9 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message // Check item's faction rank if (hasFaction && cellRef.mFactionRank < -1) - messages.push_back(std::make_pair(id, " has faction set but has invalid faction rank " + boost::lexical_cast(cellRef.mFactionRank))); + messages.push_back(std::make_pair(id, " has faction set but has invalid faction rank " + std::to_string(cellRef.mFactionRank))); else if (!hasFaction && cellRef.mFactionRank != -2) - messages.push_back(std::make_pair(id, " has invalid faction rank " + boost::lexical_cast(cellRef.mFactionRank))); + messages.push_back(std::make_pair(id, " has invalid faction rank " + std::to_string(cellRef.mFactionRank))); // If door have destination cell, check if that reference is valid if (!cellRef.mDestCell.empty()) @@ -79,7 +77,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if (cellRef.mScale < 0) { std::string str = " has negative scale "; - str += boost::lexical_cast(cellRef.mScale); + str += std::to_string(cellRef.mScale); messages.push_back(std::make_pair(id, id.getId() + str)); } @@ -87,7 +85,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if (cellRef.mEnchantmentCharge < 0 && cellRef.mEnchantmentCharge != -1) { std::string str = " has negative enchantment points "; - str += boost::lexical_cast(cellRef.mEnchantmentCharge); + str += std::to_string(cellRef.mEnchantmentCharge); messages.push_back(std::make_pair(id, id.getId() + str)); } diff --git a/apps/opencs/model/world/columnimp.hpp b/apps/opencs/model/world/columnimp.hpp index 33a71e97a..154bdab82 100644 --- a/apps/opencs/model/world/columnimp.hpp +++ b/apps/opencs/model/world/columnimp.hpp @@ -5,8 +5,6 @@ #include #include -#include - #include #include diff --git a/apps/opencs/view/render/cellmarker.cpp b/apps/opencs/view/render/cellmarker.cpp index 980ed305a..d0521a7b7 100644 --- a/apps/opencs/view/render/cellmarker.cpp +++ b/apps/opencs/view/render/cellmarker.cpp @@ -1,15 +1,10 @@ #include "cellmarker.hpp" -#include - #include #include #include -#include #include -#include "mask.hpp" - CSVRender::CellMarkerTag::CellMarkerTag(CellMarker *marker) : TagBase(Mask_CellMarker), mMarker(marker) {} @@ -42,8 +37,8 @@ void CSVRender::CellMarker::buildMarker() // Add text containing cell's coordinates. std::string coordinatesText = - boost::lexical_cast(mCoordinates.getX()) + "," + - boost::lexical_cast(mCoordinates.getY()); + std::to_string(mCoordinates.getX()) + "," + + std::to_string(mCoordinates.getY()); markerText->setText(coordinatesText); // Add text to marker node. diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 203a7bbc4..a68176226 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -1,14 +1,11 @@ #include "misc.hpp" -#include - #include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/cellstore.hpp" #include "../mwworld/esmstore.hpp" @@ -22,8 +19,6 @@ #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" -#include - namespace MWClass { bool Miscellaneous::isGold (const MWWorld::ConstPtr& ptr) const @@ -146,7 +141,7 @@ namespace MWClass if (!gold) countString = MWGui::ToolTips::getCountString(count); else // gold displays its count also if it's 1. - countString = " (" + boost::lexical_cast(count) + ")"; + countString = " (" + std::to_string(count) + ")"; info.caption = ref->mBase->mName + countString; info.icon = ref->mBase->mIcon; diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index e44dc6fcc..a4728218a 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -2,16 +2,12 @@ #include -#include - #include #include #include #include -#include "../mwbase/environment.hpp" -#include "../mwbase/world.hpp" #include "../mwbase/soundmanager.hpp" #include "../mwbase/dialoguemanager.hpp" #include "../mwbase/mechanicsmanager.hpp" diff --git a/apps/openmw/mwgui/spellmodel.cpp b/apps/openmw/mwgui/spellmodel.cpp index d4ab552ff..6953d682b 100644 --- a/apps/openmw/mwgui/spellmodel.cpp +++ b/apps/openmw/mwgui/spellmodel.cpp @@ -2,8 +2,6 @@ #include -#include - #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" @@ -61,8 +59,8 @@ namespace MWGui if (spell->mData.mType == ESM::Spell::ST_Spell) { newSpell.mType = Spell::Type_Spell; - std::string cost = boost::lexical_cast(spell->mData.mCost); - std::string chance = boost::lexical_cast(int(MWMechanics::getSpellSuccessChance(spell, mActor))); + std::string cost = std::to_string(spell->mData.mCost); + std::string chance = std::to_string(int(MWMechanics::getSpellSuccessChance(spell, mActor))); newSpell.mCostColumn = cost + "/" + chance; } else @@ -112,11 +110,11 @@ namespace MWGui int castCost = MWMechanics::getEffectiveEnchantmentCastCost(static_cast(enchant->mData.mCost), mActor); - std::string cost = boost::lexical_cast(castCost); + std::string cost = std::to_string(castCost); int currentCharge = int(item.getCellRef().getEnchantmentCharge()); if (currentCharge == -1) currentCharge = enchant->mData.mCharge; - std::string charge = boost::lexical_cast(currentCharge); + std::string charge = std::to_string(currentCharge); newSpell.mCostColumn = cost + "/" + charge; newSpell.mActive = invStore.isEquipped(item); diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 234a17cc3..19b746d5d 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1,9 +1,5 @@ #include "inputmanagerimp.hpp" -#include - -#include - #include #include @@ -1175,7 +1171,7 @@ namespace MWInput bool controlExists = mInputBinder->getChannel(i)->getControlsCount () != 0; if (!controlExists) { - control = new ICS::Control(boost::lexical_cast(i), false, true, 0, ICS::ICS_MAX, ICS::ICS_MAX); + control = new ICS::Control(std::to_string(i), false, true, 0, ICS::ICS_MAX, ICS::ICS_MAX); mInputBinder->addControl(control); control->attachChannel(mInputBinder->getChannel(i), ICS::Channel::DIRECT); } @@ -1247,7 +1243,7 @@ namespace MWInput if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) initial = 0.0f; else initial = 0.5f; - control = new ICS::Control(boost::lexical_cast(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); + control = new ICS::Control(std::to_string(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); mInputBinder->addControl(control); control->attachChannel(mInputBinder->getChannel(i), ICS::Channel::DIRECT); } @@ -1336,7 +1332,7 @@ namespace MWInput if (key != SDL_SCANCODE_UNKNOWN) return MyGUI::TextIterator::toTagsString(mInputBinder->scancodeToString (key)); else if (mouse != ICS_MAX_DEVICE_BUTTONS) - return "#{sMouse} " + boost::lexical_cast(mouse); + return "#{sMouse} " + std::to_string(mouse); else return "#{sNone}"; } @@ -1391,7 +1387,7 @@ namespace MWInput case SDL_CONTROLLER_BUTTON_Y: return "Y Button"; default: - return "Button " + boost::lexical_cast(button); + return "Button " + std::to_string(button); } } std::string InputManager::sdlControllerAxisToString(int axis) @@ -1411,7 +1407,7 @@ namespace MWInput case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: return "Right Trigger"; default: - return "Axis " + boost::lexical_cast(axis); + return "Axis " + std::to_string(axis); } } diff --git a/components/esm/loadmgef.cpp b/components/esm/loadmgef.cpp index dc8266132..3a918cf19 100644 --- a/components/esm/loadmgef.cpp +++ b/components/esm/loadmgef.cpp @@ -1,10 +1,7 @@ #include "loadmgef.hpp" -#include #include -#include - #include "esmreader.hpp" #include "esmwriter.hpp" #include "defs.hpp" @@ -524,7 +521,7 @@ const std::string &MagicEffect::effectIdToString(short effectID) { std::map::const_iterator name = sNames.find(effectID); if(name == sNames.end()) - throw std::runtime_error(std::string("Unimplemented effect ID ")+boost::lexical_cast(effectID)); + throw std::runtime_error(std::string("Unimplemented effect ID ")+std::to_string(effectID)); return name->second; } diff --git a/components/fallback/fallback.cpp b/components/fallback/fallback.cpp index 354595660..9b058f104 100644 --- a/components/fallback/fallback.cpp +++ b/components/fallback/fallback.cpp @@ -1,9 +1,11 @@ #include "fallback.hpp" -#include - namespace Fallback { + bool stob(std::string const& s) { + return s != "0"; + } + Map::Map(const std::map& fallback):mFallbackMap(fallback) {} @@ -22,7 +24,7 @@ namespace Fallback if(fallback.empty()) return 0; else - return boost::lexical_cast(fallback); + return std::stof(fallback); } int Map::getFallbackInt(const std::string& fall) const { @@ -30,7 +32,7 @@ namespace Fallback if(fallback.empty()) return 0; else - return boost::lexical_cast(fallback); + return std::stoi(fallback); } bool Map::getFallbackBool(const std::string& fall) const @@ -39,7 +41,7 @@ namespace Fallback if(fallback.empty()) return false; else - return boost::lexical_cast(fallback); + return stob(fallback); } osg::Vec4f Map::getFallbackColour(const std::string& fall) const { @@ -55,7 +57,7 @@ namespace Fallback else if (sum[i] != ' ') ret[j]+=sum[i]; } - return osg::Vec4f(boost::lexical_cast(ret[0])/255.f,boost::lexical_cast(ret[1])/255.f,boost::lexical_cast(ret[2])/255.f, 1.f); + return osg::Vec4f(std::stoi(ret[0])/255.f,std::stoi(ret[1])/255.f,std::stoi(ret[2])/255.f, 1.f); } } diff --git a/components/shader/shadermanager.cpp b/components/shader/shadermanager.cpp index ce77f46dc..2bfb17b5c 100644 --- a/components/shader/shadermanager.cpp +++ b/components/shader/shadermanager.cpp @@ -3,16 +3,14 @@ #include #include #include +#include #include -#include #include #include #include -#include - namespace Shader { @@ -139,7 +137,7 @@ namespace Shader shader->setShaderSource(shaderSource); // Assign a unique name to allow the SharedStateManager to compare shaders efficiently static unsigned int counter = 0; - shader->setName(boost::lexical_cast(counter++)); + shader->setName(std::to_string(counter++)); shaderIt = mShaders.insert(std::make_pair(std::make_pair(shaderTemplate, defines), shader)).first; } diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index b68d419a3..d85b72203 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -5,11 +5,9 @@ #include #include #include -#include #include -#include #include #include @@ -263,7 +261,7 @@ namespace Shader for (std::map::const_iterator texIt = reqs.mTextures.begin(); texIt != reqs.mTextures.end(); ++texIt) { defineMap[texIt->second] = "1"; - defineMap[texIt->second + std::string("UV")] = boost::lexical_cast(texIt->first); + defineMap[texIt->second + std::string("UV")] = std::to_string(texIt->first); } if (!reqs.mColorMaterial) diff --git a/components/widgets/numericeditbox.cpp b/components/widgets/numericeditbox.cpp index 5361b3127..d59deb378 100644 --- a/components/widgets/numericeditbox.cpp +++ b/components/widgets/numericeditbox.cpp @@ -1,7 +1,5 @@ #include "numericeditbox.hpp" -#include - namespace Gui { @@ -30,7 +28,7 @@ namespace Gui try { - mValue = boost::lexical_cast(newCaption); + mValue = std::stoi(newCaption); int capped = std::min(mMaxValue, std::max(mValue, mMinValue)); if (capped != mValue) { @@ -38,7 +36,7 @@ namespace Gui setCaption(MyGUI::utility::toString(mValue)); } } - catch (boost::bad_lexical_cast&) + catch (...) { setCaption(MyGUI::utility::toString(mValue)); } diff --git a/extern/oics/ICSInputControlSystem.h b/extern/oics/ICSInputControlSystem.h index 691a93725..308b54c3b 100644 --- a/extern/oics/ICSInputControlSystem.h +++ b/extern/oics/ICSInputControlSystem.h @@ -32,8 +32,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "ICSControl.h" #include "ICSChannel.h" -#include "boost/lexical_cast.hpp" - #define ICS_LOG(text) if(mLog) mLog->logMessage( ("ICS: " + std::string(text)).c_str() ); #define ICS_MAX_JOYSTICK_AXIS 16 #define ICS_MOUSE_BINDING_MARGIN 30 From 154d7cffa2b186529551ccb4627811e291f24030 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sun, 7 May 2017 00:04:46 +0200 Subject: [PATCH 143/318] replace and purge boost::function --- apps/openmw/mwgui/bookpage.cpp | 6 +++--- apps/openmw/mwgui/bookpage.hpp | 3 +-- apps/openmw/mwgui/journalviewmodel.cpp | 14 ++++++-------- apps/openmw/mwgui/journalviewmodel.hpp | 13 ++++++------- apps/openmw/mwgui/journalwindow.cpp | 2 -- apps/openmw/mwgui/tradewindow.cpp | 2 ++ components/sceneutil/lightmanager.cpp | 9 ++------- 7 files changed, 20 insertions(+), 29 deletions(-) diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 883195f51..5def91eb8 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -892,7 +892,7 @@ public: Style* mFocusItem; bool mItemActive; MyGUI::MouseButton mLastDown; - boost::function mLinkClicked; + std::function mLinkClicked; std::shared_ptr mBook; @@ -1260,14 +1260,14 @@ public: mPageDisplay->showPage (book, page); } - void adviseLinkClicked (boost::function linkClicked) + void adviseLinkClicked (std::function linkClicked) { mPageDisplay->mLinkClicked = linkClicked; } void unadviseLinkClicked () { - mPageDisplay->mLinkClicked = boost::function (); + mPageDisplay->mLinkClicked = std::function (); } protected: diff --git a/apps/openmw/mwgui/bookpage.hpp b/apps/openmw/mwgui/bookpage.hpp index 8800508b4..e75e1e1d3 100644 --- a/apps/openmw/mwgui/bookpage.hpp +++ b/apps/openmw/mwgui/bookpage.hpp @@ -6,7 +6,6 @@ #include #include -#include namespace MWGui { @@ -101,7 +100,7 @@ namespace MWGui public: typedef TypesetBook::InteractiveId InteractiveId; - typedef boost::function ClickCallback; + typedef std::function ClickCallback; /// Make the widget display the specified page from the specified book. virtual void showPage (TypesetBook::Ptr Book, size_t Page) = 0; diff --git a/apps/openmw/mwgui/journalviewmodel.cpp b/apps/openmw/mwgui/journalviewmodel.cpp index 2e0d07787..b5d08eec6 100644 --- a/apps/openmw/mwgui/journalviewmodel.cpp +++ b/apps/openmw/mwgui/journalviewmodel.cpp @@ -5,8 +5,6 @@ #include -#include - #include #include "../mwbase/world.hpp" @@ -149,7 +147,7 @@ struct JournalViewModelImpl : JournalViewModel return toUtf8Span (utf8text); } - void visitSpans (boost::function < void (TopicId, size_t, size_t)> visitor) const + void visitSpans (std::function < void (TopicId, size_t, size_t)> visitor) const { ensureLoaded (); mModel->ensureKeyWordSearchLoaded (); @@ -193,7 +191,7 @@ struct JournalViewModelImpl : JournalViewModel }; - void visitQuestNames (bool active_only, boost::function visitor) const + void visitQuestNames (bool active_only, std::function visitor) const { MWBase::Journal * journal = MWBase::Environment::get ().getJournal (); @@ -268,7 +266,7 @@ struct JournalViewModelImpl : JournalViewModel } }; - void visitJournalEntries (const std::string& questName, boost::function visitor) const + void visitJournalEntries (const std::string& questName, std::function visitor) const { MWBase::Journal * journal = MWBase::Environment::get().getJournal(); @@ -301,13 +299,13 @@ struct JournalViewModelImpl : JournalViewModel } } - void visitTopicName (TopicId topicId, boost::function visitor) const + void visitTopicName (TopicId topicId, std::function visitor) const { MWDialogue::Topic const & topic = * reinterpret_cast (topicId); visitor (toUtf8Span (topic.getName())); } - void visitTopicNamesStartingWith (char character, boost::function < void (const std::string&) > visitor) const + void visitTopicNamesStartingWith (char character, std::function < void (const std::string&) > visitor) const { MWBase::Journal * journal = MWBase::Environment::get().getJournal(); @@ -341,7 +339,7 @@ struct JournalViewModelImpl : JournalViewModel }; - void visitTopicEntries (TopicId topicId, boost::function visitor) const + void visitTopicEntries (TopicId topicId, std::function visitor) const { typedef MWDialogue::Topic::TEntryIter iterator_t; diff --git a/apps/openmw/mwgui/journalviewmodel.hpp b/apps/openmw/mwgui/journalviewmodel.hpp index 5739a311f..3edde3d31 100644 --- a/apps/openmw/mwgui/journalviewmodel.hpp +++ b/apps/openmw/mwgui/journalviewmodel.hpp @@ -5,7 +5,6 @@ #include #include #include -#include namespace MWGui { @@ -37,7 +36,7 @@ namespace MWGui /// Visits each subset of text in the body, delivering the beginning /// and end of the span relative to the body, and a valid topic ID if /// the span represents a keyword, or zero if not. - virtual void visitSpans (boost::function visitor) const = 0; + virtual void visitSpans (std::function visitor) const = 0; }; /// An interface to topic data. @@ -67,20 +66,20 @@ namespace MWGui virtual bool isEmpty () const = 0; /// walks the active and optionally completed, quests providing the name and completed status - virtual void visitQuestNames (bool active_only, boost::function visitor) const = 0; + virtual void visitQuestNames (bool active_only, std::function visitor) const = 0; /// walks over the journal entries related to all quests with the given name /// If \a questName is empty, simply visits all journal entries - virtual void visitJournalEntries (const std::string& questName, boost::function visitor) const = 0; + virtual void visitJournalEntries (const std::string& questName, std::function visitor) const = 0; /// provides the name of the topic specified by its id - virtual void visitTopicName (TopicId topicId, boost::function visitor) const = 0; + virtual void visitTopicName (TopicId topicId, std::function visitor) const = 0; /// walks over the topics whose names start with the specified character providing the topics name - virtual void visitTopicNamesStartingWith (char character, boost::function < void (const std::string&) > visitor) const = 0; + virtual void visitTopicNamesStartingWith (char character, std::function < void (const std::string&) > visitor) const = 0; /// walks over the topic entries for the topic specified by its identifier - virtual void visitTopicEntries (TopicId topicId, boost::function visitor) const = 0; + virtual void visitTopicEntries (TopicId topicId, std::function visitor) const = 0; // create an instance of the default journal view model implementation static Ptr create (); diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 5f309f148..879f1b417 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -9,8 +9,6 @@ #include #include -#include - #include #include #include diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index e191c16bb..fbdda8395 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -1,5 +1,7 @@ #include "tradewindow.hpp" +#include + #include #include #include diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index 341bc8034..bc042f7d6 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -1,15 +1,9 @@ #include "lightmanager.hpp" -#include - -#include - #include #include -#include - namespace SceneUtil { @@ -220,7 +214,8 @@ namespace SceneUtil // possible optimization: return a StateSet containing all requested lights plus some extra lights (if a suitable one exists) size_t hash = 0; for (unsigned int i=0; imLightSource->getId()); + hash = hash ^ (lightList[i]->mLightSource->getId() << 1); // or use boost::hash_combine + // original: boost::hash_combine(hash, lightList[i]->mLightSource->getId()); LightStateSetMap& stateSetCache = mStateSetCache[frameNum%2]; From d799954ca0a17cba35736dbb07e6457b42ab9ed6 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sun, 7 May 2017 00:19:45 +0200 Subject: [PATCH 144/318] replace and purge boost::math::gcd and other non-used headers --- apps/essimporter/main.cpp | 2 -- apps/launcher/graphicspage.cpp | 8 +------- apps/openmw/main.cpp | 6 ------ apps/openmw/mwgui/settingswindow.cpp | 5 +---- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/apps/essimporter/main.cpp b/apps/essimporter/main.cpp index a4ad114ec..d593669c3 100644 --- a/apps/essimporter/main.cpp +++ b/apps/essimporter/main.cpp @@ -2,8 +2,6 @@ #include #include -#include -#include #include diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 622db4da4..022404ec8 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -12,17 +12,11 @@ #include -#include - #include -#include - -#include - QString getAspect(int x, int y) { - int gcd = boost::math::gcd (x, y); + int gcd = std::__gcd (x, y); int xaspect = x / gcd; int yaspect = y / gcd; // special case: 8 : 5 is usually referred to as 16:10 diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 420772910..be860118e 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -7,13 +6,8 @@ #include #include -#include #include "engine.hpp" -#include -#include -#include - #if defined(_WIN32) // For OutputDebugString #ifndef WIN32_LEAN_AND_MEAN diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index c167164d9..398fe8ae7 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -3,17 +3,14 @@ #include #include #include -#include #include #include #include #include -#include #include -#include #include #include @@ -57,7 +54,7 @@ namespace std::string getAspect (int x, int y) { - int gcd = boost::math::gcd (x, y); + int gcd = std::__gcd (x, y); int xaspect = x / gcd; int yaspect = y / gcd; // special case: 8 : 5 is usually referred to as 16:10 From c781d1f8edee2a27cc1c001103c6333694c5069b Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sun, 7 May 2017 01:04:24 +0200 Subject: [PATCH 145/318] purge unnecessary imports add fstream back add fstream back add fstream back add fstream back add fstream back add fstream back add fstream back --- apps/esmtool/labels.cpp | 1 - apps/essimporter/importer.cpp | 2 +- apps/mwiniimporter/importer.cpp | 7 +------ apps/mwiniimporter/main.cpp | 2 -- apps/opencs/model/doc/document.cpp | 1 + apps/opencs/model/doc/documentmanager.cpp | 3 --- apps/opencs/model/doc/savingstages.cpp | 5 ----- apps/opencs/model/doc/savingstate.cpp | 2 ++ apps/opencs/view/doc/adjusterwidget.cpp | 3 --- apps/openmw/engine.cpp | 2 -- apps/openmw/main.cpp | 3 ++- apps/openmw/mwgui/race.cpp | 3 --- apps/openmw/mwmechanics/npcstats.cpp | 6 ------ apps/openmw/mwrender/water.cpp | 2 -- apps/openmw/mwscript/containerextensions.cpp | 1 - apps/openmw/mwstate/character.cpp | 6 ------ apps/openmw/mwstate/charactermanager.cpp | 2 -- apps/openmw/mwstate/statemanagerimp.cpp | 3 --- components/bsa/bsa_file.cpp | 1 - components/files/configurationmanager.cpp | 5 ----- components/files/escape.cpp | 1 - components/files/linuxpath.cpp | 3 --- components/files/multidircollection.cpp | 6 ------ components/myguiplatform/myguiloglistener.cpp | 3 --- components/settings/settings.cpp | 2 -- components/translation/translation.cpp | 2 -- 26 files changed, 7 insertions(+), 70 deletions(-) diff --git a/apps/esmtool/labels.cpp b/apps/esmtool/labels.cpp index 883a9e728..ea7b50129 100644 --- a/apps/esmtool/labels.cpp +++ b/apps/esmtool/labels.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include diff --git a/apps/essimporter/importer.cpp b/apps/essimporter/importer.cpp index 2c05f9ecb..d38069d89 100644 --- a/apps/essimporter/importer.cpp +++ b/apps/essimporter/importer.cpp @@ -1,8 +1,8 @@ #include "importer.hpp" #include -#include +#include #include #include diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index fb3144814..24646b844 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -1,17 +1,12 @@ #include "importer.hpp" -#include #include -#include -#include -#include -#include #include #include -#include #include #include +#include namespace bfs = boost::filesystem; diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index a3f115fcf..8a2aeb603 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -1,11 +1,9 @@ #include "importer.hpp" -#include #include #include #include -#include #include namespace bpo = boost::program_options; diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index ea32a8457..ef984c0ca 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -5,6 +5,7 @@ #include #include +#include #include "../world/defaultgmsts.hpp" diff --git a/apps/opencs/model/doc/documentmanager.cpp b/apps/opencs/model/doc/documentmanager.cpp index 87fb960c1..098d7bad5 100644 --- a/apps/opencs/model/doc/documentmanager.cpp +++ b/apps/opencs/model/doc/documentmanager.cpp @@ -1,8 +1,5 @@ #include "documentmanager.hpp" -#include -#include - #include #ifndef Q_MOC_RUN diff --git a/apps/opencs/model/doc/savingstages.cpp b/apps/opencs/model/doc/savingstages.cpp index 82a965ae4..f9c028e29 100644 --- a/apps/opencs/model/doc/savingstages.cpp +++ b/apps/opencs/model/doc/savingstages.cpp @@ -1,20 +1,15 @@ #include "savingstages.hpp" -#include - #include #include #include -#include - #include "../world/infocollection.hpp" #include "../world/cellcoordinates.hpp" #include "document.hpp" -#include "savingstate.hpp" CSMDoc::OpenSaveStage::OpenSaveStage (Document& document, SavingState& state, bool projectFile) : mDocument (document), mState (state), mProjectFile (projectFile) diff --git a/apps/opencs/model/doc/savingstate.cpp b/apps/opencs/model/doc/savingstate.cpp index 10539c1b5..7214735f0 100644 --- a/apps/opencs/model/doc/savingstate.cpp +++ b/apps/opencs/model/doc/savingstate.cpp @@ -1,5 +1,7 @@ #include "savingstate.hpp" +#include + #include "operation.hpp" #include "document.hpp" diff --git a/apps/opencs/view/doc/adjusterwidget.cpp b/apps/opencs/view/doc/adjusterwidget.cpp index 620d853ac..06da68ed8 100644 --- a/apps/opencs/view/doc/adjusterwidget.cpp +++ b/apps/opencs/view/doc/adjusterwidget.cpp @@ -1,8 +1,5 @@ #include "adjusterwidget.hpp" -#include -#include - #include #include diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 81fb2e6a7..b1c1311bc 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -1,6 +1,5 @@ #include "engine.hpp" -#include #include #include @@ -28,7 +27,6 @@ #include #include -#include #include diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index be860118e..a7e522acd 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -8,6 +8,8 @@ #include #include "engine.hpp" +#include + #if defined(_WIN32) // For OutputDebugString #ifndef WIN32_LEAN_AND_MEAN @@ -31,7 +33,6 @@ extern int cc_install_handlers(int argc, char **argv, int num_signals, int *sigs extern int is_debugger_attached(void); #endif -#include /** * Workaround for problems with whitespaces in paths in older versions of Boost library */ diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index c4a27f7ed..047f65263 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -2,13 +2,10 @@ #include #include -#include #include #include -#include - #include #include "../mwworld/esmstore.hpp" diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index 41f2a9b51..5f8967cf4 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -1,15 +1,9 @@ #include "npcstats.hpp" -#include -#include -#include -#include - #include #include -#include #include #include #include diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index 02882adbe..0ed389bdf 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -10,8 +10,6 @@ #include #include #include -#include -#include #include diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index a65c275d6..dfc066bcd 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include diff --git a/apps/openmw/mwstate/character.cpp b/apps/openmw/mwstate/character.cpp index 733ac1171..4f7d365b4 100644 --- a/apps/openmw/mwstate/character.cpp +++ b/apps/openmw/mwstate/character.cpp @@ -1,18 +1,12 @@ #include "character.hpp" -#include - #include -#include -#include #include #include #include -#include - bool MWState::operator< (const Slot& left, const Slot& right) { return left.mTimeStamp -#include -#include // std::isalnum #include diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 64c543fb1..68b0e4ecb 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -7,8 +7,6 @@ #include -#include - #include #include @@ -35,7 +33,6 @@ #include "../mwworld/inventorystore.hpp" #include "../mwmechanics/npcstats.hpp" -#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/actorutil.hpp" #include "../mwscript/globalscripts.hpp" diff --git a/components/bsa/bsa_file.cpp b/components/bsa/bsa_file.cpp index 50b3374e5..c4be428b3 100644 --- a/components/bsa/bsa_file.cpp +++ b/components/bsa/bsa_file.cpp @@ -23,7 +23,6 @@ #include "bsa_file.hpp" -#include #include #include diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index 46dbca8dc..5316255ad 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -1,17 +1,12 @@ #include "configurationmanager.hpp" -#include #include -#include -#include #include #include #include #include -#include - /** * \namespace Files */ diff --git a/components/files/escape.cpp b/components/files/escape.cpp index c5d2c041e..f28870c70 100644 --- a/components/files/escape.cpp +++ b/components/files/escape.cpp @@ -1,7 +1,6 @@ #include "escape.hpp" #include -#include namespace Files { diff --git a/components/files/linuxpath.cpp b/components/files/linuxpath.cpp index 89b4bf45a..fce7cd02c 100644 --- a/components/files/linuxpath.cpp +++ b/components/files/linuxpath.cpp @@ -2,10 +2,7 @@ #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) -#include -#include #include -#include #include #include diff --git a/components/files/multidircollection.cpp b/components/files/multidircollection.cpp index b37a95b2f..93db6834d 100644 --- a/components/files/multidircollection.cpp +++ b/components/files/multidircollection.cpp @@ -1,15 +1,9 @@ #include "multidircollection.hpp" -#include - -#include -#include #include #include -#include - namespace Files { struct NameEqual diff --git a/components/myguiplatform/myguiloglistener.cpp b/components/myguiplatform/myguiloglistener.cpp index b36e0d852..a22ac8fc5 100644 --- a/components/myguiplatform/myguiloglistener.cpp +++ b/components/myguiplatform/myguiloglistener.cpp @@ -1,9 +1,6 @@ #include "myguiloglistener.hpp" #include -#include - -#include namespace osgMyGUI { diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index 0c0600cc0..e93642ee2 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -1,13 +1,11 @@ #include "settings.hpp" -#include #include #include #include #include -#include #include namespace diff --git a/components/translation/translation.cpp b/components/translation/translation.cpp index 51947f6f9..14a32f178 100644 --- a/components/translation/translation.cpp +++ b/components/translation/translation.cpp @@ -2,8 +2,6 @@ #include -#include - namespace Translation { Storage::Storage() From 4600f24e27dfa77dffdc966374af976a909086e4 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 9 Jun 2017 22:52:40 +0400 Subject: [PATCH 146/318] Playing sound when AI is opening a door --- apps/openmw/mwmechanics/aipackage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp index abdc57042..08fe0b28c 100644 --- a/apps/openmw/mwmechanics/aipackage.cpp +++ b/apps/openmw/mwmechanics/aipackage.cpp @@ -182,7 +182,7 @@ void MWMechanics::AiPackage::evadeObstacles(const MWWorld::Ptr& actor, float dur if (getTypeId() != TypeIdWander && !door.getCellRef().getTeleport() && door.getCellRef().getTrap().empty() && door.getCellRef().getLockLevel() <= 0 && door.getClass().getDoorState(door) == 0) { - MWBase::Environment::get().getWorld()->activateDoor(door, 1); + MWBase::Environment::get().getWorld()->activate(door, actor); } } else // any other obstacle (NPC, crate, etc.) From dbf149f9b22acc6c984ee7e168f535f2c4d74607 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 10 Jun 2017 00:51:19 +0200 Subject: [PATCH 147/318] gcd is not available in msvc until 2017.3 P2, back to boost::math::gcd for now --- apps/launcher/graphicspage.cpp | 3 ++- apps/openmw/mwgui/settingswindow.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 022404ec8..d3dbfa559 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -1,5 +1,6 @@ #include "graphicspage.hpp" +#include #include #include #include @@ -16,7 +17,7 @@ QString getAspect(int x, int y) { - int gcd = std::__gcd (x, y); + int gcd = boost::math::gcd (x, y); int xaspect = x / gcd; int yaspect = y / gcd; // special case: 8 : 5 is usually referred to as 16:10 diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 398fe8ae7..f46199c80 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -8,6 +8,7 @@ #include #include +#include #include @@ -54,7 +55,7 @@ namespace std::string getAspect (int x, int y) { - int gcd = std::__gcd (x, y); + int gcd = boost::math::gcd (x, y); int xaspect = x / gcd; int yaspect = y / gcd; // special case: 8 : 5 is usually referred to as 16:10 From 11c4aed4e568f0b88d5a0d746351fc90c6ddd15e Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 10 Jun 2017 09:09:30 +0200 Subject: [PATCH 148/318] algo needed for std::min/max in msvc2013 --- extern/osg-ffmpeg-videoplayer/audiodecoder.cpp | 1 + extern/osg-ffmpeg-videoplayer/videostate.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp b/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp index 09de3bc44..ee6400177 100644 --- a/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp +++ b/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp @@ -1,5 +1,6 @@ #include "audiodecoder.hpp" +#include #include #include diff --git a/extern/osg-ffmpeg-videoplayer/videostate.cpp b/extern/osg-ffmpeg-videoplayer/videostate.cpp index b7be81629..9fd209d56 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.cpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.cpp @@ -1,5 +1,6 @@ #include "videostate.hpp" +#include #include #include From 8a5c62de97262c56317ed353880b890791f2eafc Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 10 Jun 2017 14:50:43 +0100 Subject: [PATCH 149/318] needs this head for getuid --- components/files/linuxpath.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/components/files/linuxpath.cpp b/components/files/linuxpath.cpp index fce7cd02c..1f6a3d913 100644 --- a/components/files/linuxpath.cpp +++ b/components/files/linuxpath.cpp @@ -3,6 +3,7 @@ #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) #include +#include #include #include From 188424d5d336151d7363aca49c8b996eec9773e5 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 10 Jun 2017 22:31:17 +0400 Subject: [PATCH 150/318] Allow AI to use keys to open doors --- apps/openmw/mwmechanics/aipackage.cpp | 30 ++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp index 08fe0b28c..62fd56bec 100644 --- a/apps/openmw/mwmechanics/aipackage.cpp +++ b/apps/openmw/mwmechanics/aipackage.cpp @@ -12,6 +12,7 @@ #include "../mwworld/action.hpp" #include "../mwworld/class.hpp" #include "../mwworld/cellstore.hpp" +#include "../mwworld/inventorystore.hpp" #include "creaturestats.hpp" #include "movement.hpp" @@ -179,10 +180,33 @@ void MWMechanics::AiPackage::evadeObstacles(const MWWorld::Ptr& actor, float dur if (door != MWWorld::Ptr()) { // note: AiWander currently does not open doors - if (getTypeId() != TypeIdWander && !door.getCellRef().getTeleport() && door.getCellRef().getTrap().empty() - && door.getCellRef().getLockLevel() <= 0 && door.getClass().getDoorState(door) == 0) + if (getTypeId() != TypeIdWander && !door.getCellRef().getTeleport() && door.getClass().getDoorState(door) == 0) { - MWBase::Environment::get().getWorld()->activate(door, actor); + if ((door.getCellRef().getTrap().empty() && door.getCellRef().getLockLevel() <= 0 )) + MWBase::Environment::get().getWorld()->activate(door, actor); + + std::string keyId = door.getCellRef().getKey(); + if (keyId.empty()) + return; + + bool hasKey = false; + const MWWorld::ContainerStore &invStore = actor.getClass().getContainerStore(actor); + + // make key id lowercase + Misc::StringUtils::lowerCaseInPlace(keyId); + for (MWWorld::ConstContainerStoreIterator it = invStore.cbegin(); it != invStore.cend(); ++it) + { + std::string refId = it->getCellRef().getRefId(); + Misc::StringUtils::lowerCaseInPlace(refId); + if (refId == keyId) + { + hasKey = true; + break; + } + } + + if (hasKey) + MWBase::Environment::get().getWorld()->activate(door, actor); } } else // any other obstacle (NPC, crate, etc.) From cab51d26cc4f106ee5cb516f9655ede6e48357ce Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 10 Jun 2017 22:33:14 +0400 Subject: [PATCH 151/318] Doors: small key search optimizations --- apps/openmw/mwclass/door.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 5f977174f..bbaff6338 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -132,15 +132,19 @@ namespace MWClass // make key id lowercase std::string keyId = ptr.getCellRef().getKey(); - Misc::StringUtils::lowerCaseInPlace(keyId); - for (MWWorld::ConstContainerStoreIterator it = invStore.cbegin(); it != invStore.cend(); ++it) + if (!keyId.empty()) { - std::string refId = it->getCellRef().getRefId(); - Misc::StringUtils::lowerCaseInPlace(refId); - if (refId == keyId) + Misc::StringUtils::lowerCaseInPlace(keyId); + for (MWWorld::ConstContainerStoreIterator it = invStore.cbegin(); it != invStore.cend(); ++it) { - hasKey = true; - keyName = it->getClass().getName(*it); + std::string refId = it->getCellRef().getRefId(); + Misc::StringUtils::lowerCaseInPlace(refId); + if (refId == keyId) + { + hasKey = true; + keyName = it->getClass().getName(*it); + break; + } } } From b0abed00e59aa8472daf0bb55bd6f5096e1d013b Mon Sep 17 00:00:00 2001 From: Siimacore Date: Sat, 10 Jun 2017 21:36:35 +0200 Subject: [PATCH 152/318] Correcting https://bugs.openmw.org/issues/3906 --- apps/launcher/maindialog.cpp | 8 +++++++- apps/launcher/maindialog.hpp | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 94e186db8..46340dd9e 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -172,6 +172,9 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog() } } + if(!setupGameData()) + return FirstRunDialogResultFailure; + return setup() ? FirstRunDialogResultContinue : FirstRunDialogResultFailure; } @@ -344,6 +347,10 @@ bool Launcher::MainDialog::setupGameSettings() file.close(); } + return true; +} + +bool Launcher::MainDialog::setupGameData() { QStringList dataDirs; // Check if the paths actually contain data files @@ -379,7 +386,6 @@ bool Launcher::MainDialog::setupGameSettings() } } } - return true; } diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index 96b5c0b97..8d0d61b8f 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -72,6 +72,7 @@ namespace Launcher bool setupLauncherSettings(); bool setupGameSettings(); bool setupGraphicsSettings(); + bool setupGameData(); void setVersionLabel(); From 9fdfb2a83f488fec895461d1f24b153533effe69 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 11 Jun 2017 10:13:00 +0400 Subject: [PATCH 153/318] Spell priority: make AI do not cast target spells when enemy is under water --- apps/openmw/mwmechanics/aicombataction.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 358e04d6b..f9b793f94 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -549,7 +549,13 @@ namespace MWMechanics if (effect.mRange == ESM::RT_Target) { if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f)) - return 0; + return 0.f; + + if (enemy.isEmpty()) + return 0.f; + + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(enemy), 0.75f)) + return 0.f; } rating *= magicEffect->mData.mBaseCost; From 913601facc5a6a335e5a9f24ed222ec2f113cefb Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 11 Jun 2017 11:18:39 +0200 Subject: [PATCH 154/318] [macOS, CI] reenable packaging to make nightlies work --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 86dbdcfd4..668cfe7e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,7 +63,7 @@ before_script: ./CI/before_script.${TRAVIS_OS_NAME}.sh script: - cd ./build - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE}make -j3; fi - - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make; fi + - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi - if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then cd .. && ./CI/check_tabs.sh; fi - cd "${TRAVIS_BUILD_DIR}" From e9d0bf7c1270652394ac17081a306007d521fbc7 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 11 Jun 2017 15:06:44 +0400 Subject: [PATCH 155/318] Added missed return statement --- apps/openmw/mwmechanics/aipackage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp index 62fd56bec..529e7ca41 100644 --- a/apps/openmw/mwmechanics/aipackage.cpp +++ b/apps/openmw/mwmechanics/aipackage.cpp @@ -183,7 +183,10 @@ void MWMechanics::AiPackage::evadeObstacles(const MWWorld::Ptr& actor, float dur if (getTypeId() != TypeIdWander && !door.getCellRef().getTeleport() && door.getClass().getDoorState(door) == 0) { if ((door.getCellRef().getTrap().empty() && door.getCellRef().getLockLevel() <= 0 )) + { MWBase::Environment::get().getWorld()->activate(door, actor); + return; + } std::string keyId = door.getCellRef().getKey(); if (keyId.empty()) From fb7479c1946609faf5306887fcfc15fa99cb3769 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 11 Jun 2017 23:52:01 +0200 Subject: [PATCH 156/318] Update CONTRIBUTING.md --- CONTRIBUTING.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a9cd6a690..466910ca3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,35 @@ -Description -=========== +How to contribute to OpenMW +======================= -Your pull request description should include (if applicable): +Not sure what to do with all your free time? Pick out a task from here: + +http://bugs.openmw.org/ + +Currently, we are focused on completing the MW game experience and general polishing. Features out of this scope may be approved in some cases, but you should probably start a discussion first. + +Note: +- Tasks set to 'openmw-future' are usually out of the current scope of the project and can't be started yet. +- Bugs that are not 'Confirmed' should be confirmed first. +- Larger Features should have a discussion before you start implementing. +- In many cases, it's best to have a discussion about possible solutions before you jump into coding. + +Aside from coding, you can also help by triaging the issues list. Check for bugs that are 'Unconfirmed' and try to confirm them on your end, working out any details that may be necessary. Check for bugs that do not conform to [Bug reporting guidelines](https://wiki.openmw.org/index.php?title=Bug_Reporting_Guidelines) and improve them to do so! + +There are various [Tools](https://wiki.openmw.org/index.php?title=Tools) to facilitate testing/development. + +Pull Request Guidelines +======================= + +Thought of a change? Great! To facilitate the review process, your pull request description should include the following (if applicable): * A link back to the bug report or forum discussion that prompted the change * Summary of the changes made * Reasoning / motivation behind the change * What testing you have carried out to verify the change -Other notes -=========== +Furthermore, we advise to: * Separate your work into multiple pull requests whenever possible. As a rule of thumb, each feature and each bugfix should go into a separate PR, unless they are closely related or dependent upon each other. Small pull requests are easier to review, and are less likely to require further changes before we can merge them. A "mega" pull request with lots of unrelated commits in it is likely to get held up in review for a long time. * Feel free to submit incomplete pull requests. Even if the work can not be merged yet, pull requests are a great place to collect early feedback. Just make sure to mark it as *[Incomplete]* or *[Do not merge yet]* in the title. * If you plan on contributing often, please read the [Developer Reference](https://wiki.openmw.org/index.php?title=Developer_Reference) on our wiki, especially the [Policies and Standards](https://wiki.openmw.org/index.php?title=Policies_and_Standards). +* Make sure each of your changes has a clear objective. Unnecessary changes may lead to merge conflicts, clutter the commit history and slow down review. Code formatting 'fixes' should be avoided, unless you were already changing that particular line anyway. From f0b21cca228475b1b31edf62ed91d23615d70675 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 10 Jun 2017 23:02:56 +0200 Subject: [PATCH 157/318] use own inline hash_combine function --- components/sceneutil/lightmanager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index bc042f7d6..018abeefc 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -209,13 +209,21 @@ namespace SceneUtil mLights.push_back(l); } + /* similar to the boost::hash_combine */ + template + inline void hash_combine(std::size_t& seed, const T& v) + { + std::hash hasher; + seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + osg::ref_ptr LightManager::getLightListStateSet(const LightList &lightList, unsigned int frameNum) { + // possible optimization: return a StateSet containing all requested lights plus some extra lights (if a suitable one exists) size_t hash = 0; for (unsigned int i=0; imLightSource->getId() << 1); // or use boost::hash_combine - // original: boost::hash_combine(hash, lightList[i]->mLightSource->getId()); + hash_combine(hash, lightList[i]->mLightSource->getId()); LightStateSetMap& stateSetCache = mStateSetCache[frameNum%2]; From 7c758a629363d3a7b8fcd88fd2d40ab618c2591d Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sun, 11 Jun 2017 09:23:19 +0200 Subject: [PATCH 158/318] std::stof can not handle comma in us localization and can not handle period in french localization, using std::replace is not a solution, going back to boost::lexical_cast --- components/fallback/fallback.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/fallback/fallback.cpp b/components/fallback/fallback.cpp index 9b058f104..010e1025c 100644 --- a/components/fallback/fallback.cpp +++ b/components/fallback/fallback.cpp @@ -1,5 +1,8 @@ #include "fallback.hpp" +#include + + namespace Fallback { bool stob(std::string const& s) { @@ -23,8 +26,9 @@ namespace Fallback std::string fallback=getFallbackString(fall); if(fallback.empty()) return 0; - else - return std::stof(fallback); + else { + return boost::lexical_cast(fallback); + } } int Map::getFallbackInt(const std::string& fall) const { From c6805314c22a1837c03faeb2e3a045936ad1b776 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sun, 11 Jun 2017 09:32:30 +0200 Subject: [PATCH 159/318] be explicit about what we are trying to catch instead of catching everything and fixed up formatting use Allman style brackets not K&R style, additional formatting for fallback.cpp which needed some love revert allman formatting changes --- components/fallback/fallback.cpp | 8 +++++--- components/widgets/numericeditbox.cpp | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/components/fallback/fallback.cpp b/components/fallback/fallback.cpp index 010e1025c..11a577a45 100644 --- a/components/fallback/fallback.cpp +++ b/components/fallback/fallback.cpp @@ -21,15 +21,16 @@ namespace Fallback } return it->second; } + float Map::getFallbackFloat(const std::string& fall) const { std::string fallback=getFallbackString(fall); if(fallback.empty()) return 0; - else { - return boost::lexical_cast(fallback); - } + else + return boost::lexical_cast(fallback); } + int Map::getFallbackInt(const std::string& fall) const { std::string fallback=getFallbackString(fall); @@ -47,6 +48,7 @@ namespace Fallback else return stob(fallback); } + osg::Vec4f Map::getFallbackColour(const std::string& fall) const { std::string sum=getFallbackString(fall); diff --git a/components/widgets/numericeditbox.cpp b/components/widgets/numericeditbox.cpp index d59deb378..828a84589 100644 --- a/components/widgets/numericeditbox.cpp +++ b/components/widgets/numericeditbox.cpp @@ -1,3 +1,5 @@ +#include + #include "numericeditbox.hpp" namespace Gui @@ -36,7 +38,11 @@ namespace Gui setCaption(MyGUI::utility::toString(mValue)); } } - catch (...) + catch (std::invalid_argument) + { + setCaption(MyGUI::utility::toString(mValue)); + } + catch (std::out_of_range) { setCaption(MyGUI::utility::toString(mValue)); } From 63f101e0cdfd58e0a88f7676b299a915faae4200 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 12 Jun 2017 23:48:06 +0200 Subject: [PATCH 160/318] Update AUTHORS.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index d119c9b1a..a75c475be 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -133,6 +133,7 @@ Programmers Sebastian Wick (swick) Sergey Shambir ShadowRadiance + Siimacore sir_herrbatka smbas Stefan Galowicz (bogglez) From 016da1f10cf856740cdea348250e17846f3c38b7 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Tue, 13 Jun 2017 08:44:55 +0200 Subject: [PATCH 161/318] [macOS, CI] Use most recent dependencies --- CI/before_install.osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/before_install.osx.sh b/CI/before_install.osx.sh index 1035cbd22..ee2cc9cc9 100755 --- a/CI/before_install.osx.sh +++ b/CI/before_install.osx.sh @@ -6,5 +6,5 @@ brew outdated cmake || brew upgrade cmake brew outdated pkgconfig || brew upgrade pkgconfig brew install $macos_qt_formula -curl http://downloads.openmw.org/osx/dependencies/openmw-deps-c++11.zip -o ~/openmw-deps.zip +curl https://downloads.openmw.org/osx/dependencies/openmw-deps-eaf8112.zip -o ~/openmw-deps.zip unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null From 87939bf3b16e61b2741a6d1ceb4d7ff641ffe7b6 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 13 Jun 2017 11:02:40 +0400 Subject: [PATCH 162/318] Use mRange to check spell range instead of mArea. --- apps/openmw/mwmechanics/aicombataction.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index f9b793f94..f5d6d8357 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -889,7 +889,7 @@ namespace MWMechanics for (std::vector::const_iterator effectIt = spell->mEffects.mList.begin(); effectIt != spell->mEffects.mList.end(); ++effectIt) { - if (effectIt->mArea == ESM::RT_Target) + if (effectIt->mRange == ESM::RT_Target) { const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().get().find(effectIt->mEffectID); dist = effect->mData.mSpeed; @@ -906,7 +906,7 @@ namespace MWMechanics for (std::vector::const_iterator effectIt = ench->mEffects.mList.begin(); effectIt != ench->mEffects.mList.end(); ++effectIt) { - if (effectIt->mArea == ESM::RT_Target) + if (effectIt->mRange == ESM::RT_Target) { const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().get().find(effectIt->mEffectID); dist = effect->mData.mSpeed; @@ -1029,7 +1029,7 @@ namespace MWMechanics for (std::vector::const_iterator effectIt = spell->mEffects.mList.begin(); effectIt != spell->mEffects.mList.end(); ++effectIt) { - if (effectIt->mArea == ESM::RT_Target) + if (effectIt->mRange == ESM::RT_Target) { if (!MWBase::Environment::get().getWorld()->isSwimming(enemy)) mult = fAIRangeMagicSpellMult; From 97c3c45ba8575edc1e4a4453f5bf3f7f22ff3330 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Tue, 13 Jun 2017 09:18:02 +0200 Subject: [PATCH 163/318] [macOS, CI] Use Qt 5.7 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 668cfe7e2..48836b7bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ env: - secure: "MegynKyJpyL7XDwdWVEbypQh7CLjqOqOi9lGF97G7Fq0HosVZTmnwjHhmIPZspTP7ES4UbxM3rs/f3ce7sp9JN2ShRJpduD6UEFc8egQXBte9J3obUBIdUxPTRdhnht7VJ+u+pksK1S/Bm1Cs6l0eEluP3vmcaXWMykVQcZsPhY=" # macOS builds FTP upload password - secure: "jQcAaWAdDy0+vlNu4POMX8322HanCOQEUTdpviWTAUjWQTjMa0UTM4+zVVgrtEaHMpBaVYYbTT3Rg5BQ9oG+2SiVLJBQQ2XoMcos/YrjPVT6inB02Gs0vFjP29LdPAQVrB8CkAcfQr6u+Z2C+RqAtwhE09LsBUMXjRDzPAtr1CM=" - - macos_qt_formula=qt@5.5 + - macos_qt_formula=qt@5.7 addons: apt: sources: From 6af470ff03fd463965b3eb9191c16a8839bce9f2 Mon Sep 17 00:00:00 2001 From: Siimacore Date: Tue, 13 Jun 2017 12:00:55 +0200 Subject: [PATCH 164/318] Stopping the thread in the wizard that prevented it to stop correctly --- apps/wizard/unshield/unshieldworker.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/wizard/unshield/unshieldworker.cpp b/apps/wizard/unshield/unshieldworker.cpp index d3ccfe03a..020de9f80 100644 --- a/apps/wizard/unshield/unshieldworker.cpp +++ b/apps/wizard/unshield/unshieldworker.cpp @@ -46,6 +46,7 @@ Wizard::UnshieldWorker::~UnshieldWorker() void Wizard::UnshieldWorker::stopWorker() { mStopped = true; + mWait.wakeOne(); } void Wizard::UnshieldWorker::setInstallComponent(Wizard::Component component, bool install) @@ -448,6 +449,10 @@ bool Wizard::UnshieldWorker::setupComponent(Component component) QReadLocker readLock(&mLock); emit requestFileDialog(component); mWait.wait(&mLock); + if(mStopped) { + qDebug() << "We are asked to stop !!"; + break; + } disk.setPath(getDiskPath()); } else { disk.setPath(getDiskPath()); From 42402976e3a247ca70b87a806c26777d646f0cef Mon Sep 17 00:00:00 2001 From: Allofich Date: Tue, 13 Jun 2017 18:55:22 +0900 Subject: [PATCH 165/318] Fixes for building in MSVC --- apps/openmw/mwgui/containeritemmodel.cpp | 2 ++ apps/openmw/mwscript/skyextensions.cpp | 2 ++ apps/openmw/mwsound/ffmpeg_decoder.cpp | 1 + apps/openmw/mwsound/loudness.cpp | 1 + apps/openmw/mwsound/sound.hpp | 2 ++ apps/openmw/mwstate/charactermanager.cpp | 2 +- components/files/constrainedfilestream.cpp | 1 + components/sceneutil/controller.cpp | 2 ++ 8 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/containeritemmodel.cpp b/apps/openmw/mwgui/containeritemmodel.cpp index 1e4749695..d62cd16b0 100644 --- a/apps/openmw/mwgui/containeritemmodel.cpp +++ b/apps/openmw/mwgui/containeritemmodel.cpp @@ -1,5 +1,7 @@ #include "containeritemmodel.hpp" +#include + #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" diff --git a/apps/openmw/mwscript/skyextensions.cpp b/apps/openmw/mwscript/skyextensions.cpp index e0fccd16d..479c9d70c 100644 --- a/apps/openmw/mwscript/skyextensions.cpp +++ b/apps/openmw/mwscript/skyextensions.cpp @@ -1,5 +1,7 @@ #include "skyextensions.hpp" +#include + #include #include diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index c0a2014b3..1f1834761 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -4,6 +4,7 @@ #include #include +#include #include diff --git a/apps/openmw/mwsound/loudness.cpp b/apps/openmw/mwsound/loudness.cpp index 19e5cd586..ae31d6094 100644 --- a/apps/openmw/mwsound/loudness.cpp +++ b/apps/openmw/mwsound/loudness.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "soundmanagerimp.hpp" diff --git a/apps/openmw/mwsound/sound.hpp b/apps/openmw/mwsound/sound.hpp index a59027fc1..8c663fb1e 100644 --- a/apps/openmw/mwsound/sound.hpp +++ b/apps/openmw/mwsound/sound.hpp @@ -1,6 +1,8 @@ #ifndef GAME_SOUND_SOUND_H #define GAME_SOUND_SOUND_H +#include + #include "sound_output.hpp" namespace MWSound diff --git a/apps/openmw/mwstate/charactermanager.cpp b/apps/openmw/mwstate/charactermanager.cpp index 62ddd649a..a91bd4e8c 100644 --- a/apps/openmw/mwstate/charactermanager.cpp +++ b/apps/openmw/mwstate/charactermanager.cpp @@ -58,7 +58,7 @@ MWState::Character* MWState::CharacterManager::createCharacter(const std::string // The character name is user-supplied, so we need to escape the path for (std::string::const_iterator it = name.begin(); it != name.end(); ++it) { - if (std::isalnum(*it)) // Ignores multibyte characters and non alphanumeric characters + if (isalnum(*it)) // Ignores multibyte characters and non alphanumeric characters stream << *it; else stream << "_"; diff --git a/components/files/constrainedfilestream.cpp b/components/files/constrainedfilestream.cpp index cd9a3c8f5..4f76139d9 100644 --- a/components/files/constrainedfilestream.cpp +++ b/components/files/constrainedfilestream.cpp @@ -1,6 +1,7 @@ #include "constrainedfilestream.hpp" #include +#include #include "lowlevelfile.hpp" diff --git a/components/sceneutil/controller.cpp b/components/sceneutil/controller.cpp index ee2715650..8fef00333 100644 --- a/components/sceneutil/controller.cpp +++ b/components/sceneutil/controller.cpp @@ -1,5 +1,7 @@ #include "controller.hpp" +#include + #include "statesetupdater.hpp" #include From 028762a7dcbd9c80f8b695cdec606d4a5830e0b3 Mon Sep 17 00:00:00 2001 From: Allofich Date: Sun, 30 Apr 2017 02:40:52 +0900 Subject: [PATCH 166/318] Make guards that are attacked try to arrest player (Fixes #3706) --- apps/openmw/mwmechanics/aisequence.cpp | 10 ++++++++++ apps/openmw/mwmechanics/aisequence.hpp | 3 +++ .../mwmechanics/mechanicsmanagerimp.cpp | 20 ++++++++++++++----- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 64347f161..82a2e2c3d 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -121,6 +121,16 @@ bool AiSequence::isInCombat() const return false; } +bool AiSequence::hasPackage(int typeId) const +{ + for (std::list::const_iterator it = mPackages.begin(); it != mPackages.end(); ++it) + { + if ((*it)->getTypeId() == typeId) + return true; + } + return false; +} + bool AiSequence::isInCombat(const MWWorld::Ptr &actor) const { for(std::list::const_iterator it = mPackages.begin(); it != mPackages.end(); ++it) diff --git a/apps/openmw/mwmechanics/aisequence.hpp b/apps/openmw/mwmechanics/aisequence.hpp index 4b6ec156a..41d204ee2 100644 --- a/apps/openmw/mwmechanics/aisequence.hpp +++ b/apps/openmw/mwmechanics/aisequence.hpp @@ -85,6 +85,9 @@ namespace MWMechanics /// Is there any combat package? bool isInCombat () const; + /// Does this AI sequence have the given package type? + bool hasPackage(int typeId) const; + /// Are we in combat with this particular actor? bool isInCombat (const MWWorld::Ptr& actor) const; diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 930049ba0..62ac9bd40 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1042,7 +1042,13 @@ namespace MWMechanics if (crimeSeen) reportCrime(player, victim, type, arg); else if (type == OT_Assault && !victim.isEmpty()) - startCombat(victim, player); // TODO: combat should be started with an "unaware" flag, which makes the victim flee? + { + if (victim.getClass().isClass(victim, "guard") + && !victim.getClass().getCreatureStats(victim).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + reportCrime(player, victim, type, arg); + else + startCombat(victim, player); // TODO: combat should be started with an "unaware" flag, which makes the victim flee? + } return crimeSeen; } @@ -1145,7 +1151,8 @@ namespace MWMechanics // once the bounty has been paid. it->getClass().getNpcStats(*it).setCrimeId(id); - it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it); + if (!it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it); } else { @@ -1213,7 +1220,8 @@ namespace MWMechanics { // Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back. // Note: accidental or collateral damage attacks are ignored. - startCombat(victim, player); + if (!victim.getClass().getCreatureStats(victim).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + startCombat(victim, player); // Set the crime ID, which we will use to calm down participants // once the bounty has been paid. @@ -1256,7 +1264,8 @@ namespace MWMechanics } if (target.getClass().isNpc() && !attacker.isEmpty() && !seq.isInCombat(attacker) - && !isAggressive(target, attacker) && !isFightingNpc) + && !isAggressive(target, attacker) && !isFightingNpc + && !target.getClass().getCreatureStats(target).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) commitCrime(attacker, target, MWBase::MechanicsManager::OT_Assault); if (!attacker.isEmpty() && (attacker.getClass().getCreatureStats(attacker).getAiSequence().isInCombat(target) @@ -1265,7 +1274,8 @@ namespace MWMechanics { // Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back. // Note: accidental or collateral damage attacks are ignored. - startCombat(target, attacker); + if (!target.getClass().getCreatureStats(target).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + startCombat(target, attacker); } return true; From 4f08084e7921603e2b590a645b1dbaa8d0777d87 Mon Sep 17 00:00:00 2001 From: Allofich Date: Sun, 30 Apr 2017 22:29:59 +0900 Subject: [PATCH 167/318] Make stationary actors return to position on load Also makes wandering actors resume their previous destination when an interrupting combat or pursuit ends. (Fixes #3656) --- apps/openmw/mwmechanics/aisequence.cpp | 15 ----- apps/openmw/mwmechanics/aiwander.cpp | 79 ++++++++++++++------------ apps/openmw/mwmechanics/aiwander.hpp | 16 ++---- 3 files changed, 49 insertions(+), 61 deletions(-) diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 82a2e2c3d..2f33d6e4e 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -295,21 +295,6 @@ void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor) if (actor == getPlayer()) throw std::runtime_error("Can't add AI packages to player"); - if (package.getTypeId() == AiPackage::TypeIdCombat || package.getTypeId() == AiPackage::TypeIdPursue) - { - // Notify AiWander of our current position so we can return to it after combat finished - for (std::list::const_iterator iter (mPackages.begin()); iter!=mPackages.end(); ++iter) - { - if((*iter)->getTypeId() == AiPackage::TypeIdCombat && package.getTypeId() == AiPackage::TypeIdCombat - && (*iter)->getTarget() == (&package)->getTarget()) - { - return; // already in combat with this actor - } - else if ((*iter)->getTypeId() == AiPackage::TypeIdWander) - static_cast(*iter)->setReturnPosition(actor.getRefData().getPosition().asVec3()); - } - } - // Stop combat when a non-combat AI package is added if (isActualAiPackage(package.getTypeId())) stopCombat(); diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index a992bc8d4..ad6db4d01 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -113,7 +113,7 @@ namespace MWMechanics AiWander::AiWander(int distance, int duration, int timeOfDay, const std::vector& idle, bool repeat): mDistance(distance), mDuration(duration), mRemainingDuration(duration), mTimeOfDay(timeOfDay), mIdle(idle), - mRepeat(repeat), mStoredInitialActorPosition(false) + mRepeat(repeat), mStoredInitialActorPosition(false), mInitialActorPosition(osg::Vec3f(0, 0, 0)), mHasDestination(false), mDestination(osg::Vec3f(0, 0, 0)) { mIdle.resize(8, 0); init(); @@ -123,9 +123,6 @@ namespace MWMechanics { // NOTE: mDistance and mDuration must be set already - mHasReturnPosition = false; - mReturnPosition = osg::Vec3f(0,0,0); - if(mDistance < 0) mDistance = 0; if(mDuration < 0) @@ -211,6 +208,19 @@ namespace MWMechanics cStats.setMovementFlag(CreatureStats::Flag_Run, false); ESM::Position pos = actor.getRefData().getPosition(); + + // If there is already a destination due to the package having been interrupted by a combat or pursue package, + // rebuild a path to it + if (!mPathFinder.isPathConstructed() && mHasDestination) + { + ESM::Pathgrid::Point dest(PathFinder::MakePathgridPoint(mDestination)); + ESM::Pathgrid::Point start(PathFinder::MakePathgridPoint(pos)); + + mPathFinder.buildSyncedPath(start, dest, actor.getCell()); + + if (mPathFinder.isPathConstructed()) + storage.setState(Wander_Walking); + } doPerFrameActionsForState(actor, duration, storage, pos); @@ -253,9 +263,8 @@ namespace MWMechanics getAllowedNodes(actor, currentCell->getCell(), storage); } - // Actor becomes stationary - see above URL's for previous research - // If a creature or an NPC with a wander distance and no pathgrid is available, - // randomly idle or wander around near spawn point + // If the package has a wander distance but no pathgrid is available, + // randomly idle or wander near spawn point if(storage.mAllowedNodes.empty() && mDistance > 0 && !storage.mIsWanderingManually) { // Typically want to idle for a short time before the next wander if (Misc::Rng::rollDice(100) >= 96) { @@ -277,10 +286,8 @@ namespace MWMechanics mDistance = 0; // For stationary NPCs, move back to the starting location if another AiPackage moved us elsewhere - if (cellChange) - mHasReturnPosition = false; - if (mDistance == 0 && mHasReturnPosition - && (pos.asVec3() - mReturnPosition).length2() > (DESTINATION_TOLERANCE * DESTINATION_TOLERANCE)) + if (mDistance == 0 && !cellChange + && (pos.asVec3() - mInitialActorPosition).length2() > (DESTINATION_TOLERANCE * DESTINATION_TOLERANCE)) { returnToStartLocation(actor, storage, pos); } @@ -334,7 +341,8 @@ namespace MWMechanics { if (!mPathFinder.isPathConstructed()) { - ESM::Pathgrid::Point dest(PathFinder::MakePathgridPoint(mReturnPosition)); + mDestination = mInitialActorPosition; + ESM::Pathgrid::Point dest(PathFinder::MakePathgridPoint(mDestination)); // actor position is already in world coordinates ESM::Pathgrid::Point start(PathFinder::MakePathgridPoint(pos)); @@ -345,6 +353,7 @@ namespace MWMechanics if (mPathFinder.isPathConstructed()) { storage.setState(Wander_Walking); + mHasDestination = true; } } } @@ -357,7 +366,6 @@ namespace MWMechanics const osg::Vec3f currentPositionVec3f = osg::Vec3f(currentPosition.mX, currentPosition.mY, currentPosition.mZ); std::size_t attempts = 10; // If a unit can't wander out of water, don't want to hang here - osg::Vec3f destination; ESM::Pathgrid::Point destinationPosition; bool isWaterCreature = actor.getClass().isPureWaterCreature(actor); do { @@ -369,17 +377,18 @@ namespace MWMechanics const float destinationY = mInitialActorPosition.y() + wanderRadius * std::sin(randomDirection); const float destinationZ = mInitialActorPosition.z(); destinationPosition = ESM::Pathgrid::Point(destinationX, destinationY, destinationZ); - destination = osg::Vec3f(destinationX, destinationY, destinationZ); + mDestination = osg::Vec3f(destinationX, destinationY, destinationZ); // Check if land creature will walk onto water or if water creature will swim onto land - if ((!isWaterCreature && !destinationIsAtWater(actor, destination)) || - (isWaterCreature && !destinationThroughGround(currentPositionVec3f, destination))) { + if ((!isWaterCreature && !destinationIsAtWater(actor, mDestination)) || + (isWaterCreature && !destinationThroughGround(currentPositionVec3f, mDestination))) { mPathFinder.buildSyncedPath(currentPosition, destinationPosition, actor.getCell()); mPathFinder.addPointToPath(destinationPosition); if (mPathFinder.isPathConstructed()) { storage.setState(Wander_Walking, true); + mHasDestination = true; } return; } @@ -466,7 +475,10 @@ namespace MWMechanics GreetingState& greetingState = storage.mSaidGreeting; if (!checkIdle(actor, storage.mIdleAnimation) && (greetingState == Greet_Done || greetingState == Greet_None)) { - storage.setState(Wander_ChooseAction); + if (mPathFinder.isPathConstructed()) + storage.setState(Wander_Walking); + else + storage.setState(Wander_ChooseAction); } } @@ -478,7 +490,6 @@ namespace MWMechanics { stopWalking(actor, storage); storage.setState(Wander_ChooseAction); - mHasReturnPosition = false; } else { @@ -490,8 +501,8 @@ namespace MWMechanics void AiWander::onChooseActionStatePerFrameActions(const MWWorld::Ptr& actor, AiWanderStorage& storage) { - short unsigned& idleAnimation = storage.mIdleAnimation; - idleAnimation = getRandomIdle(); + unsigned short idleAnimation = getRandomIdle(); + storage.mIdleAnimation = idleAnimation; if (!idleAnimation && mDistance) { @@ -525,7 +536,7 @@ namespace MWMechanics storage.mTrimCurrentNode = true; trimAllowedNodes(storage.mAllowedNodes, mPathFinder); mObstacleCheck.clear(); - mPathFinder.clearPath(); + stopWalking(actor, storage); storage.setState(Wander_MoveNow); } @@ -535,9 +546,7 @@ namespace MWMechanics // if stuck for sufficiently long, act like current location was the destination if (storage.mStuckCount >= COUNT_BEFORE_RESET) // something has gone wrong, reset { - //std::cout << "Reset \""<< cls.getName(actor) << "\"" << std::endl; mObstacleCheck.clear(); - stopWalking(actor, storage); storage.setState(Wander_ChooseAction); storage.mStuckCount = 0; @@ -612,7 +621,7 @@ namespace MWMechanics if (storage.mState == Wander_Walking) { - stopWalking(actor, storage); + stopWalking(actor, storage, false); mObstacleCheck.clear(); storage.setState(Wander_IdleNow); } @@ -657,6 +666,8 @@ namespace MWMechanics if (mPathFinder.isPathConstructed()) { + mDestination = osg::Vec3f(dest.mX, dest.mY, dest.mZ); + mHasDestination = true; // Remove this node as an option and add back the previously used node (stops NPC from picking the same node): ESM::Pathgrid::Point temp = storage.mAllowedNodes[randNode]; storage.mAllowedNodes.erase(storage.mAllowedNodes.begin() + randNode); @@ -710,9 +721,13 @@ namespace MWMechanics return TypeIdWander; } - void AiWander::stopWalking(const MWWorld::Ptr& actor, AiWanderStorage& storage) + void AiWander::stopWalking(const MWWorld::Ptr& actor, AiWanderStorage& storage, bool clearPath) { - mPathFinder.clearPath(); + if (clearPath) + { + mPathFinder.clearPath(); + mHasDestination = false; + } actor.getClass().getMovementSettings(actor).mPosition[1] = 0; } @@ -743,15 +758,6 @@ namespace MWMechanics } } - void AiWander::setReturnPosition(const osg::Vec3f& position) - { - if (!mHasReturnPosition) - { - mHasReturnPosition = true; - mReturnPosition = position; - } - } - short unsigned AiWander::getRandomIdle() { unsigned short idleRoll = 0; @@ -945,6 +951,8 @@ namespace MWMechanics , mTimeOfDay(wander->mData.mTimeOfDay) , mRepeat(wander->mData.mShouldRepeat != 0) , mStoredInitialActorPosition(wander->mStoredInitialActorPosition) + , mHasDestination(false) + , mDestination(osg::Vec3f(0, 0, 0)) { if (mStoredInitialActorPosition) mInitialActorPosition = wander->mInitialActorPosition; @@ -953,7 +961,6 @@ namespace MWMechanics if (mRemainingDuration <= 0 || mRemainingDuration >= 24) mRemainingDuration = mDuration; - init(); } } diff --git a/apps/openmw/mwmechanics/aiwander.hpp b/apps/openmw/mwmechanics/aiwander.hpp index 13a4a1b4a..01d889e2f 100644 --- a/apps/openmw/mwmechanics/aiwander.hpp +++ b/apps/openmw/mwmechanics/aiwander.hpp @@ -44,10 +44,6 @@ namespace MWMechanics virtual int getTypeId() const; - /// Set the position to return to for a stationary (non-wandering) actor - /** In case another AI package moved the actor elsewhere **/ - void setReturnPosition (const osg::Vec3f& position); - virtual void writeState(ESM::AiSequence::AiSequence &sequence) const; virtual void fastForward(const MWWorld::Ptr& actor, AiState& state); @@ -70,7 +66,7 @@ namespace MWMechanics private: // NOTE: mDistance and mDuration must be set already void init(); - void stopWalking(const MWWorld::Ptr& actor, AiWanderStorage& storage); + void stopWalking(const MWWorld::Ptr& actor, AiWanderStorage& storage, bool clearPath = true); /// Have the given actor play an idle animation /// @return Success or error @@ -87,7 +83,7 @@ namespace MWMechanics void onWalkingStatePerFrameActions(const MWWorld::Ptr& actor, float duration, AiWanderStorage& storage, ESM::Position& pos); void onChooseActionStatePerFrameActions(const MWWorld::Ptr& actor, AiWanderStorage& storage); bool reactionTimeActions(const MWWorld::Ptr& actor, AiWanderStorage& storage, - const MWWorld::CellStore*& currentCell, bool cellChange, ESM::Position& pos, float duration); + const MWWorld::CellStore*& currentCell, bool cellChange, ESM::Position& pos, float duration); bool isPackageCompleted(const MWWorld::Ptr& actor, AiWanderStorage& storage); void returnToStartLocation(const MWWorld::Ptr& actor, AiWanderStorage& storage, ESM::Position& pos); void wanderNearStart(const MWWorld::Ptr &actor, AiWanderStorage &storage, int wanderDistance); @@ -102,11 +98,11 @@ namespace MWMechanics std::vector mIdle; bool mRepeat; - bool mHasReturnPosition; // NOTE: Could be removed if mReturnPosition was initialized to actor position, - // if we had the actor in the AiWander constructor... - osg::Vec3f mReturnPosition; - osg::Vec3f mInitialActorPosition; bool mStoredInitialActorPosition; + osg::Vec3f mInitialActorPosition; + + bool mHasDestination; + osg::Vec3f mDestination; void getAllowedNodes(const MWWorld::Ptr& actor, const ESM::Cell* cell, AiWanderStorage& storage); From b277bd782ea5ab5b7e0ac7107b8187d9e98f6bb5 Mon Sep 17 00:00:00 2001 From: Jordan Ayers Date: Thu, 15 Jun 2017 21:59:13 -0500 Subject: [PATCH 168/318] Adjust restock calculations to ignore filled soul gems. Bug #3684 --- apps/openmw/mwworld/containerstore.cpp | 14 ++++++++++++-- apps/openmw/mwworld/containerstore.hpp | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index a4154e125..eef10b905 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -156,6 +156,16 @@ int MWWorld::ContainerStore::count(const std::string &id) return total; } +int MWWorld::ContainerStore::restockCount(const std::string &id) +{ + int total=0; + for (MWWorld::ContainerStoreIterator iter (begin()); iter!=end(); ++iter) + if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefId(), id)) + if (iter->getCellRef().getSoul().empty()) + total += iter->getRefData().getCount(); + return total; +} + MWWorld::ContainerStoreListener* MWWorld::ContainerStore::getContListener() const { return mListener; @@ -512,7 +522,7 @@ void MWWorld::ContainerStore::restock (const ESM::InventoryList& items, const MW for (std::map, int>::iterator it = mLevelledItemMap.begin(); it != mLevelledItemMap.end();) { int spawnedCount = it->second; //How many items should be in shop originally - int itemCount = count(it->first.first); //How many items are there in shop now + int itemCount = restockCount(it->first.first); //How many items are there in shop now //If something was not sold if(itemCount >= spawnedCount) { @@ -578,7 +588,7 @@ void MWWorld::ContainerStore::restock (const ESM::InventoryList& items, const MW else { //Restocking static item - just restock to the max count - int currentCount = count(itemOrList); + int currentCount = restockCount(itemOrList); if (currentCount < std::abs(it->mCount)) addInitialItem(itemOrList, owner, -(std::abs(it->mCount) - currentCount), true); } diff --git a/apps/openmw/mwworld/containerstore.hpp b/apps/openmw/mwworld/containerstore.hpp index 21e126a32..f27ff1db9 100644 --- a/apps/openmw/mwworld/containerstore.hpp +++ b/apps/openmw/mwworld/containerstore.hpp @@ -162,8 +162,12 @@ namespace MWWorld /// If a compatible stack is found, the item's count is added to that stack, then the original is deleted. /// @return If the item was stacked, return the stack, otherwise return the old (untouched) item. - /// @return How many items with refID \a id are in this container? int count (const std::string& id); + ///< @return How many items with refID \a id are in this container? + + int restockCount (const std::string& id); + ///< Item count with restock adjustments (such as ignoring filled soul gems). + /// @return How many items with refID \a id are in this container? ContainerStoreListener* getContListener() const; void setContListener(ContainerStoreListener* listener); From 62b24eb078b4ed4c95e507caed162ff119a0647c Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 16 Jun 2017 12:20:31 +0400 Subject: [PATCH 169/318] Combat AI: do not use range weapons under water --- apps/openmw/mwmechanics/aicombat.cpp | 4 ++++ apps/openmw/mwmechanics/aicombataction.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index a00890cea..68d282d0c 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -535,6 +535,10 @@ namespace MWMechanics // opponent's weapon range, or not backing up if opponent is also using a ranged weapon if (isDistantCombat && distToTarget < rangeAttack / 4) { + // actor should not back up into water + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.5f)) + return; + mMovement.mPosition[1] = -1; } } diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 46d37eb3d..e55ceaeac 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -118,7 +118,19 @@ namespace MWMechanics float bonus=0.f; if (weapon->mData.mType >= ESM::Weapon::MarksmanBow && weapon->mData.mType <= ESM::Weapon::MarksmanThrown) + { + // Range weapon is useless under water + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f)) + return 0.f; + + if (enemy.isEmpty()) + return 0.f; + + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(enemy), 0.75f)) + return 0.f; + bonus+=1.5f; + } if (weapon->mData.mType >= ESM::Weapon::MarksmanBow) { From a2be73295b3c2c8540b38db746ff609df171c5ef Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 16 Jun 2017 13:33:42 +0400 Subject: [PATCH 170/318] Combat AI: take in account enemy weapon resistance --- apps/openmw/mwmechanics/aicombataction.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index e55ceaeac..d07e4dd0a 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -135,6 +135,9 @@ namespace MWMechanics if (weapon->mData.mType >= ESM::Weapon::MarksmanBow) { rating = (weapon->mData.mChop[0] + weapon->mData.mChop[1]) / 2.f; + + if (weapon->mData.mType >= ESM::Weapon::MarksmanThrown) + MWMechanics::resistNormalWeapon(enemy, actor, item, rating); } else { @@ -145,6 +148,8 @@ namespace MWMechanics rating += weapon->mData.mChop[i]; } rating /= 6.f; + + MWMechanics::resistNormalWeapon(enemy, actor, item, rating); } if (item.getClass().hasItemHealth(item)) @@ -182,6 +187,10 @@ namespace MWMechanics if (skill != -1) rating *= actor.getClass().getSkill(actor, skill) / 100.f; + // There is no need to apply bonus if weapon rating == 0 + if (rating == 0.f) + return 0.f; + return rating + bonus; } From 1a8f2bfc11fbc70f75c0a3b187d523957da20401 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 16 Jun 2017 16:11:12 +0400 Subject: [PATCH 171/318] Combat AI: select target by priority --- apps/openmw/mwmechanics/aicombataction.cpp | 73 ++++++++++++++++++++++ apps/openmw/mwmechanics/aicombataction.hpp | 1 + apps/openmw/mwmechanics/aisequence.cpp | 9 ++- 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index d07e4dd0a..624fe3a3d 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -854,6 +854,79 @@ namespace MWMechanics return bestAction; } + float getBestActionRating(const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy) + { + Spells& spells = actor.getClass().getCreatureStats(actor).getSpells(); + + float bestActionRating = 0.f; + // Default to hand-to-hand combat + if (actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) + { + return bestActionRating; + } + + if (actor.getClass().hasInventoryStore(actor)) + { + MWWorld::InventoryStore& store = actor.getClass().getInventoryStore(actor); + + for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) + { + float rating = rateMagicItem(*it, actor, enemy); + if (rating > bestActionRating) + { + bestActionRating = rating; + } + } + + float bestArrowRating = 0; + for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) + { + float rating = rateWeapon(*it, actor, enemy, ESM::Weapon::Arrow); + if (rating > bestArrowRating) + { + bestArrowRating = rating; + } + } + + float bestBoltRating = 0; + for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) + { + float rating = rateWeapon(*it, actor, enemy, ESM::Weapon::Bolt); + if (rating > bestBoltRating) + { + bestBoltRating = rating; + } + } + + for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) + { + std::vector equipmentSlots = it->getClass().getEquipmentSlots(*it).first; + if (std::find(equipmentSlots.begin(), equipmentSlots.end(), (int)MWWorld::InventoryStore::Slot_CarriedRight) + == equipmentSlots.end()) + continue; + + float rating = rateWeapon(*it, actor, enemy, -1, bestArrowRating, bestBoltRating); + if (rating > bestActionRating) + { + bestActionRating = rating; + } + } + } + + for (Spells::TIterator it = spells.begin(); it != spells.end(); ++it) + { + const ESM::Spell* spell = it->first; + + float rating = rateSpell(spell, actor, enemy); + if (rating > bestActionRating) + { + bestActionRating = rating; + } + } + + return bestActionRating; + } + float getDistanceMinusHalfExtents(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool minusZDist) { diff --git a/apps/openmw/mwmechanics/aicombataction.hpp b/apps/openmw/mwmechanics/aicombataction.hpp index 3db88269b..393bd9f5d 100644 --- a/apps/openmw/mwmechanics/aicombataction.hpp +++ b/apps/openmw/mwmechanics/aicombataction.hpp @@ -101,6 +101,7 @@ namespace MWMechanics float rateEffects (const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); std::shared_ptr prepareNextAction (const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); + float getBestActionRating(const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy); float getDistanceMinusHalfExtents(const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, bool minusZDist=false); float getMaxAttackDistance(const MWWorld::Ptr& actor); diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 82a2e2c3d..2b3709b75 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -16,6 +16,7 @@ #include "aifollow.hpp" #include "aiactivate.hpp" #include "aicombat.hpp" +#include "aicombataction.hpp" #include "aipursue.hpp" #include "actorutil.hpp" @@ -208,6 +209,8 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac float nearestDist = std::numeric_limits::max(); osg::Vec3f vActorPos = actor.getRefData().getPosition().asVec3(); + float bestRating = 0.f; + for(std::list::iterator it = mPackages.begin(); it != mPackages.end();) { if ((*it)->getTypeId() != AiPackage::TypeIdCombat) break; @@ -222,6 +225,8 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac } else { + float rating = MWMechanics::getBestActionRating(actor, target); + const ESM::Position &targetPos = target.getRefData().getPosition(); float distTo = (targetPos.asVec3() - vActorPos).length(); @@ -230,10 +235,12 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac if (it == mPackages.begin()) distTo = std::max(0.f, distTo - 50.f); - if (distTo < nearestDist) + // if a target has higher priority than current target or has same priority but closer + if (rating > bestRating || ((distTo < nearestDist) && rating == bestRating)) { nearestDist = distTo; itActualCombat = it; + bestRating = rating; } ++it; } From fad760cc1d667794288e103c86fc381c15eeeca0 Mon Sep 17 00:00:00 2001 From: tlmullis Date: Mon, 19 Jun 2017 05:49:04 -0700 Subject: [PATCH 172/318] msbuild was always defaulting to building the Debug configuration so it was impossible to build any other configurations with build.msvc.sh --- CI/build.msvc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/build.msvc.sh b/CI/build.msvc.sh index f8d5a2f24..eac969b0d 100644 --- a/CI/build.msvc.sh +++ b/CI/build.msvc.sh @@ -77,9 +77,9 @@ if [ $? -ne 0 ]; then fi if [ -z $APPVEYOR ]; then - msbuild OpenMW.sln //t:Build //m:8 + msbuild OpenMW.sln //t:Build //p:Configuration=${CONFIGURATION} //m:8 else - msbuild OpenMW.sln //t:Build //m:8 //logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + msbuild OpenMW.sln //t:Build //p:Configuration=${CONFIGURATION} //m:8 //logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" fi RET=$? From 41fb17f39bd7182a8ef55185c4f524a6df4e3669 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 20 Jun 2017 00:13:32 +0200 Subject: [PATCH 173/318] Revert "Correcting https://bugs.openmw.org/issues/3906" This reverts commit b0abed00e59aa8472daf0bb55bd6f5096e1d013b. --- apps/launcher/maindialog.cpp | 8 +------- apps/launcher/maindialog.hpp | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 46340dd9e..94e186db8 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -172,9 +172,6 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog() } } - if(!setupGameData()) - return FirstRunDialogResultFailure; - return setup() ? FirstRunDialogResultContinue : FirstRunDialogResultFailure; } @@ -347,10 +344,6 @@ bool Launcher::MainDialog::setupGameSettings() file.close(); } - return true; -} - -bool Launcher::MainDialog::setupGameData() { QStringList dataDirs; // Check if the paths actually contain data files @@ -386,6 +379,7 @@ bool Launcher::MainDialog::setupGameData() { } } } + return true; } diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index 8d0d61b8f..96b5c0b97 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -72,7 +72,6 @@ namespace Launcher bool setupLauncherSettings(); bool setupGameSettings(); bool setupGraphicsSettings(); - bool setupGameData(); void setVersionLabel(); From 54bb1b13cb3c6559988ca95c16fd476ee1045eb5 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 20 Jun 2017 00:34:48 +0200 Subject: [PATCH 174/318] Change NCO/NCC flags to NC* (Fixes #3915) --- components/nifbullet/bulletnifloader.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index e17c96b79..3865b17a5 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -203,8 +203,7 @@ void BulletNifLoader::handleNode(const Nif::Node *node, int flags, // affecting the entire subtree of this node Nif::NiStringExtraData *sd = (Nif::NiStringExtraData*)e; - // not sure what the difference between NCO and NCC is, or if there even is one - if (sd->string == "NCO" || sd->string == "NCC") + if (Misc::StringUtils::ciCompareLen(sd->string, "NC", 2) == 0) { // No collision. Use an internal flag setting to mark this. flags |= 0x800; From 534c81976cfeca9755fef872d4a6d1039acb91c4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 12:47:57 +0200 Subject: [PATCH 175/318] Add missing cell update for physics system (Fixes #3917) --- apps/openmw/mwworld/scene.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 2467af646..bec053bc0 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -461,6 +461,8 @@ namespace MWWorld mechMgr->updateCell(old, player); mechMgr->watchActor(player); + mPhysics->updatePtr(old, player); + MWBase::Environment::get().getWorld()->adjustSky(); mLastPlayerPos = pos.asVec3(); From 44e2089098cb520cb292a93515ddafdd8643dd89 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 12:52:59 +0200 Subject: [PATCH 176/318] Don't play 'menu click' sound for right clicks (Fixes #3919) --- apps/openmw/mwinput/inputmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 19b746d5d..242a2cafc 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -710,7 +710,7 @@ namespace MWInput if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0) { MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType(false); - if (b && b->getEnabled()) + if (b && b->getEnabled() && id == SDL_BUTTON_LEFT) { MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); } From 903e59f4956f9eb2c49e57a3de17717facde60eb Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 13:08:55 +0200 Subject: [PATCH 177/318] Don't reset idle time when there is no camera movement (Fixes #3902) --- apps/openmw/mwinput/inputmanagerimp.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 242a2cafc..73e0c6d30 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -413,18 +413,21 @@ namespace MWInput { float xAxis = mInputBinder->getChannel(A_LookLeftRight)->getValue()*2.0f-1.0f; float yAxis = mInputBinder->getChannel(A_LookUpDown)->getValue()*2.0f-1.0f; - resetIdleTime(); + if (xAxis != 0 || yAxis != 0) + { + resetIdleTime(); - float rot[3]; - rot[0] = yAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier; - rot[1] = 0.0f; - rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f); + float rot[3]; + rot[0] = yAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier; + rot[1] = 0.0f; + rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f); - // Only actually turn player when we're not in vanity mode - if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot)) - { - mPlayer->yaw(rot[2]); - mPlayer->pitch(rot[0]); + // Only actually turn player when we're not in vanity mode + if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot)) + { + mPlayer->yaw(rot[2]); + mPlayer->pitch(rot[0]); + } } } From ca5b351eef448c52950be08580014380ff5c49de Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 14:43:03 +0200 Subject: [PATCH 178/318] Fix saved joystick bindings being discarded when running without joystick connected --- extern/oics/ICSInputControlSystem_joystick.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extern/oics/ICSInputControlSystem_joystick.cpp b/extern/oics/ICSInputControlSystem_joystick.cpp index ab219d074..5beaf27c4 100644 --- a/extern/oics/ICSInputControlSystem_joystick.cpp +++ b/extern/oics/ICSInputControlSystem_joystick.cpp @@ -78,6 +78,9 @@ namespace ICS // add bindings void InputControlSystem::addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction) { + if (std::find(mJoystickIDList.begin(), mJoystickIDList.end(), deviceID) == mJoystickIDList.end()) + mJoystickIDList.push_back(deviceID); + ICS_LOG("\tAdding AxisBinder [axis=" + ToString(axis) + ", deviceID=" + ToString(deviceID) + ", direction=" @@ -93,6 +96,9 @@ namespace ICS void InputControlSystem::addJoystickButtonBinding(Control* control, int deviceID, unsigned int button, Control::ControlChangingDirection direction) { + if (std::find(mJoystickIDList.begin(), mJoystickIDList.end(), deviceID) == mJoystickIDList.end()) + mJoystickIDList.push_back(deviceID); // Hack: add the device to the list so bindings are saved in save() even when joystick is not connected + ICS_LOG("\tAdding JoystickButtonBinder [button=" + ToString(button) + ", deviceID=" + ToString(deviceID) + ", direction=" From 8d17565efdacfc6d627b4f4cad2166e20c4f7e9b Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 14:43:56 +0200 Subject: [PATCH 179/318] Fix joystick binding for an action being discarded when default for another action is loaded (Bug #3900) --- apps/openmw/mwinput/inputmanagerimp.cpp | 7 ++++--- extern/oics/ICSInputControlSystem.h | 2 ++ extern/oics/ICSInputControlSystem_joystick.cpp | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 73e0c6d30..283147ca9 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1243,7 +1243,7 @@ namespace MWInput if (!controlExists) { float initial; - if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) + if (defaultAxisBindings.find(i) == defaultAxisBindings.end()) initial = 0.0f; else initial = 0.5f; control = new ICS::Control(std::to_string(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); @@ -1259,12 +1259,13 @@ namespace MWInput { clearAllControllerBindings(control); - if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) + if (defaultButtonBindings.find(i) != defaultButtonBindings.end() + && !mInputBinder->isJoystickButtonBound(mFakeDeviceID, defaultButtonBindings[i])) { control->setInitialValue(0.0f); mInputBinder->addJoystickButtonBinding(control, mFakeDeviceID, defaultButtonBindings[i], ICS::Control::INCREASE); } - else if (defaultAxisBindings.find(i) != defaultAxisBindings.end()) + else if (defaultAxisBindings.find(i) != defaultAxisBindings.end() && !mInputBinder->isJoystickAxisBound(mFakeDeviceID, defaultAxisBindings[i])) { control->setValue(0.5f); control->setInitialValue(0.5f); diff --git a/extern/oics/ICSInputControlSystem.h b/extern/oics/ICSInputControlSystem.h index 308b54c3b..0e8e6ecad 100644 --- a/extern/oics/ICSInputControlSystem.h +++ b/extern/oics/ICSInputControlSystem.h @@ -120,6 +120,8 @@ namespace ICS bool isMouseButtonBound(unsigned int button) const; void addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction); void addJoystickButtonBinding(Control* control, int deviceID, unsigned int button, Control::ControlChangingDirection direction); + bool isJoystickButtonBound(int deviceID, unsigned int button) const; + bool isJoystickAxisBound(int deviceID, unsigned int axis) const; void removeKeyBinding(SDL_Scancode key); void removeMouseAxisBinding(NamedAxis axis); void removeMouseButtonBinding(unsigned int button); diff --git a/extern/oics/ICSInputControlSystem_joystick.cpp b/extern/oics/ICSInputControlSystem_joystick.cpp index 5beaf27c4..ed6e2f664 100644 --- a/extern/oics/ICSInputControlSystem_joystick.cpp +++ b/extern/oics/ICSInputControlSystem_joystick.cpp @@ -110,6 +110,24 @@ namespace ICS mControlsJoystickButtonBinderMap[deviceID][button] = controlJoystickButtonBinderItem; } + bool InputControlSystem::isJoystickButtonBound(int deviceID, unsigned int button) const + { + JoystickButtonBinderMapType::const_iterator found = mControlsJoystickButtonBinderMap.find(deviceID); + if (found == mControlsJoystickButtonBinderMap.end()) + return false; + + return (found->second.find(button) != found->second.end()); + } + + bool InputControlSystem::isJoystickAxisBound(int deviceID, unsigned int axis) const + { + JoystickAxisBinderMapType::const_iterator found = mControlsJoystickAxisBinderMap.find(deviceID); + if (found == mControlsJoystickAxisBinderMap.end()) + return false; + + return (found->second.find(axis) != found->second.end()); + } + // get bindings int InputControlSystem::getJoystickAxisBinding(Control* control, int deviceID, ICS::Control::ControlChangingDirection direction) { From ec458ef385cb49b24f39b916f4e45d92e22b9acb Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 13:08:55 +0200 Subject: [PATCH 180/318] Don't reset idle time when there is no camera movement (Fixes #3902) --- apps/openmw/mwinput/inputmanagerimp.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 234a17cc3..9979bd5d6 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -417,18 +417,21 @@ namespace MWInput { float xAxis = mInputBinder->getChannel(A_LookLeftRight)->getValue()*2.0f-1.0f; float yAxis = mInputBinder->getChannel(A_LookUpDown)->getValue()*2.0f-1.0f; - resetIdleTime(); + if (xAxis != 0 || yAxis != 0) + { + resetIdleTime(); - float rot[3]; - rot[0] = yAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier; - rot[1] = 0.0f; - rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f); + float rot[3]; + rot[0] = yAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier; + rot[1] = 0.0f; + rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f); - // Only actually turn player when we're not in vanity mode - if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot)) - { - mPlayer->yaw(rot[2]); - mPlayer->pitch(rot[0]); + // Only actually turn player when we're not in vanity mode + if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot)) + { + mPlayer->yaw(rot[2]); + mPlayer->pitch(rot[0]); + } } } From 7fcb22b867ce009e319584feab201282348c791f Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 27 Jun 2017 15:54:16 +0400 Subject: [PATCH 181/318] Do not show empty journal entries (fixes #3891) --- apps/openmw/mwdialogue/journalimp.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwdialogue/journalimp.cpp b/apps/openmw/mwdialogue/journalimp.cpp index f11ec651d..27a3b31b5 100644 --- a/apps/openmw/mwdialogue/journalimp.cpp +++ b/apps/openmw/mwdialogue/journalimp.cpp @@ -85,13 +85,15 @@ namespace MWDialogue StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index, actor); - mJournal.push_back (entry); - Quest& quest = getQuest (id); - quest.addEntry (entry); // we are doing slicing on purpose here - MWBase::Environment::get().getWindowManager()->messageBox ("#{sJournalEntry}"); + // there is no need to show empty entries in journal + if (!entry.getText().empty()) + { + mJournal.push_back (entry); + MWBase::Environment::get().getWindowManager()->messageBox ("#{sJournalEntry}"); + } } void Journal::setJournalIndex (const std::string& id, int index) From 143fdae6fea2b69828fdcb6422199731f4d0c6ab Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 28 Jun 2017 11:01:08 +0400 Subject: [PATCH 182/318] Make spell priority calculation close to vanilla (bug #3937). --- apps/openmw/mwmechanics/aicombataction.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 46d37eb3d..3c20179a4 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -558,8 +558,6 @@ namespace MWMechanics return 0.f; } - rating *= magicEffect->mData.mBaseCost; - if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) { rating *= -1.f; @@ -594,13 +592,17 @@ namespace MWMechanics return 0.f; } } - else - { - rating *= (effect.mMagnMin + effect.mMagnMax)/2.f; - } - if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration)) - rating *= effect.mDuration; + rating *= ((effect.mMagnMin + effect.mMagnMax) * (effect.mDuration > 0 ? effect.mDuration : 1) + effect.mArea); + rating *= magicEffect->mData.mBaseCost; + + if (effect.mRange == ESM::RT_Target) + rating *= 1.5f; + + static const float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore().get().find( + "fEffectCostMult")->getFloat(); + + rating *= fEffectCostMult * 0.05; // Currently treating all "on target" or "on touch" effects to target the enemy actor. // Combat AI is egoistic, so doesn't consider applying positive effects to friendly actors. From 951c4e12e070466ebc54cb8e62f44676504dc9f5 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 30 Jun 2017 00:51:26 +0200 Subject: [PATCH 183/318] Fix crash introduced by commit 1d8a9ff62243cb6b8e218840d839e6d554f3e8d9 (Fixes #3940) --- apps/openmw/mwworld/worldimp.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 815810d36..6c9cdb394 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -379,8 +379,11 @@ namespace MWWorld return; case ESM::REC_PLAY: mPlayer->readRecord(reader, type); - mWorldScene->preloadCell(getPlayerPtr().getCell(), true); - mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3()); + if (getPlayerPtr().isInCell()) + { + mWorldScene->preloadCell(getPlayerPtr().getCell(), true); + mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3()); + } break; default: if (!mStore.readRecord (reader, type) && From 9c94244b284562fcd7e152cf0c35abcb99cc6eb1 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 30 Jun 2017 00:51:26 +0200 Subject: [PATCH 184/318] Fix crash introduced by commit 1d8a9ff62243cb6b8e218840d839e6d554f3e8d9 (Fixes #3940) --- apps/openmw/mwworld/worldimp.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index a22075abd..7fbf2965a 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -378,8 +378,11 @@ namespace MWWorld return; case ESM::REC_PLAY: mPlayer->readRecord(reader, type); - mWorldScene->preloadCell(getPlayerPtr().getCell(), true); - mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3()); + if (getPlayerPtr().isInCell()) + { + mWorldScene->preloadCell(getPlayerPtr().getCell(), true); + mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3()); + } break; default: if (!mStore.readRecord (reader, type) && From 37952c9a790ce33bf24078319060cf62407b4cc9 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 14 Jun 2017 12:44:18 +0400 Subject: [PATCH 185/318] Added door detection based by ray casting --- apps/openmw/mwbase/world.hpp | 4 +++ apps/openmw/mwmechanics/aipackage.cpp | 4 ++- apps/openmw/mwmechanics/aiwander.cpp | 9 +++-- apps/openmw/mwmechanics/obstacle.cpp | 52 ++++++++++----------------- apps/openmw/mwmechanics/obstacle.hpp | 9 ++--- apps/openmw/mwworld/worldimp.cpp | 9 +++-- apps/openmw/mwworld/worldimp.hpp | 3 ++ 7 files changed, 45 insertions(+), 45 deletions(-) diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 86d26d3a7..ce6cf38eb 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -10,6 +10,7 @@ #include "../mwworld/ptr.hpp" #include "../mwrender/rendermode.hpp" +#include "../mwphysics/physicssystem.hpp" namespace osg { @@ -299,6 +300,9 @@ namespace MWBase virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2) = 0; ///< cast a Ray and return true if there is an object in the ray path. + virtual MWPhysics::PhysicsSystem::RayResult castRayTest (float x1, float y1, float z1, float x2, float y2, float z2) = 0; + ///< cast a rendering ray and return ray result. + virtual bool toggleCollisionMode() = 0; ///< Toggle collision mode for player. If disabled player object should ignore /// collisions and gravity. diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp index 529e7ca41..f837ad2ee 100644 --- a/apps/openmw/mwmechanics/aipackage.cpp +++ b/apps/openmw/mwmechanics/aipackage.cpp @@ -176,7 +176,9 @@ void MWMechanics::AiPackage::evadeObstacles(const MWWorld::Ptr& actor, float dur if (!mObstacleCheck.check(actor, duration)) return; // first check if obstacle is a door - MWWorld::Ptr door = getNearbyDoor(actor); // NOTE: checks interior cells only + static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance(); + + MWWorld::Ptr door = getNearbyDoor(actor, distance); if (door != MWWorld::Ptr()) { // note: AiWander currently does not open doors diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index a992bc8d4..3888aaf6d 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -440,11 +440,14 @@ namespace MWMechanics { // Check if an idle actor is too close to a door - if so start walking storage.mDoorCheckDuration += duration; + + static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance(); + if (storage.mDoorCheckDuration >= DOOR_CHECK_INTERVAL) { storage.mDoorCheckDuration = 0; // restart timer if (mDistance && // actor is not intended to be stationary - proximityToDoor(actor, MIN_DIST_TO_DOOR_SQUARED*1.6f*1.6f)) // NOTE: checks interior cells only + proximityToDoor(actor, distance*1.6f)) { storage.setState(Wander_MoveNow); storage.mTrimCurrentNode = false; // just in case @@ -516,10 +519,12 @@ namespace MWMechanics void AiWander::evadeObstacles(const MWWorld::Ptr& actor, AiWanderStorage& storage, float duration, ESM::Position& pos) { + static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance(); + if (mObstacleCheck.isEvading()) { // first check if we're walking into a door - if (proximityToDoor(actor)) // NOTE: checks interior cells only + if (proximityToDoor(actor, distance)) { // remove allowed points then select another random destination storage.mTrimCurrentNode = true; diff --git a/apps/openmw/mwmechanics/obstacle.cpp b/apps/openmw/mwmechanics/obstacle.cpp index 5d99fe723..8e932f351 100644 --- a/apps/openmw/mwmechanics/obstacle.cpp +++ b/apps/openmw/mwmechanics/obstacle.cpp @@ -1,8 +1,11 @@ #include "obstacle.hpp" +#include + #include #include "../mwbase/world.hpp" +#include "../mwbase/environment.hpp" #include "../mwworld/class.hpp" #include "../mwworld/cellstore.hpp" @@ -23,51 +26,34 @@ namespace MWMechanics { -1.0f, -1.0f } // move to side and backwards }; - // Proximity check function for interior doors. Given that most interior cells - // do not have many doors performance shouldn't be too much of an issue. - // - // Limitation: there can be false detections, and does not test whether the - // actor is facing the door. - bool proximityToDoor(const MWWorld::Ptr& actor, float minSqr) + bool proximityToDoor(const MWWorld::Ptr& actor, float minDist) { - if(getNearbyDoor(actor, minSqr)!=MWWorld::Ptr()) + if(getNearbyDoor(actor, minDist)!=MWWorld::Ptr()) return true; else return false; } - MWWorld::Ptr getNearbyDoor(const MWWorld::Ptr& actor, float minSqr) + MWWorld::Ptr getNearbyDoor(const MWWorld::Ptr& actor, float minDist) { - MWWorld::CellStore *cell = actor.getCell(); + osg::Vec3f origin = MWBase::Environment::get().getWorld()->getActorHeadTransform(actor).getTrans(); + + osg::Quat orient = osg::Quat(actor.getRefData().getPosition().rot[0], osg::Vec3f(-1,0,0)) + * osg::Quat(actor.getRefData().getPosition().rot[2], osg::Vec3f(0,0,-1)); - if(cell->getCell()->isExterior()) - return MWWorld::Ptr(); // check interior cells only + osg::Vec3f direction = orient * osg::Vec3f(0,1,0); + osg::Vec3f dest = origin + direction * minDist; - // Check all the doors in this cell - const MWWorld::CellRefList& doors = cell->getReadOnlyDoors(); - const MWWorld::CellRefList::List& refList = doors.mList; - MWWorld::CellRefList::List::const_iterator it = refList.begin(); osg::Vec3f pos(actor.getRefData().getPosition().asVec3()); + MWPhysics::PhysicsSystem::RayResult result = MWBase::Environment::get().getWorld()->castRayTest(pos.x(), pos.y(), pos.z(), dest.x(), dest.y(), dest.z()); - /// TODO: How to check whether the actor is facing a door? Below code is for - /// the player, perhaps it can be adapted. - //MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getFacedObject(); - //if(!ptr.isEmpty()) - //std::cout << "faced door " << ptr.getClass().getName(ptr) << std::endl; + if (!result.mHit || result.mHitObject.isEmpty()) + return MWWorld::Ptr(); // none found - /// TODO: The in-game observation of rot[2] value seems to be the - /// opposite of the code in World::activateDoor() ::confused:: - for (; it != refList.end(); ++it) - { - const MWWorld::LiveCellRef& ref = *it; - if((pos - ref.mData.getPosition().asVec3()).length2() < minSqr - && ref.mData.getPosition().rot[2] == ref.mRef.getPosition().rot[2]) - { - // FIXME cast - return MWWorld::Ptr(&const_cast &>(ref), actor.getCell()); // found, stop searching - } - } - return MWWorld::Ptr(); // none found + if (result.mHitObject.getClass().getTypeName() == typeid(ESM::Door).name() && !result.mHitObject.getCellRef().getTeleport()) + return result.mHitObject; + + return MWWorld::Ptr(); } ObstacleCheck::ObstacleCheck(): diff --git a/apps/openmw/mwmechanics/obstacle.hpp b/apps/openmw/mwmechanics/obstacle.hpp index 1d7cf1e0e..f71207346 100644 --- a/apps/openmw/mwmechanics/obstacle.hpp +++ b/apps/openmw/mwmechanics/obstacle.hpp @@ -10,19 +10,14 @@ namespace MWMechanics { struct Movement; - /// NOTE: determined empirically based on in-game behaviour - static const float MIN_DIST_TO_DOOR_SQUARED = 128*128; - static const int NUM_EVADE_DIRECTIONS = 4; /// tests actor's proximity to a closed door by default - bool proximityToDoor(const MWWorld::Ptr& actor, - float minSqr = MIN_DIST_TO_DOOR_SQUARED); + bool proximityToDoor(const MWWorld::Ptr& actor, float minDist); /// Returns door pointer within range. No guarantee is given as to which one /** \return Pointer to the door, or NULL if none exists **/ - MWWorld::Ptr getNearbyDoor(const MWWorld::Ptr& actor, - float minSqr = MIN_DIST_TO_DOOR_SQUARED); + MWWorld::Ptr getNearbyDoor(const MWWorld::Ptr& actor, float minDist); class ObstacleCheck { diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 0421ecb24..86943a7e7 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1451,11 +1451,16 @@ namespace MWWorld } bool World::castRay (float x1, float y1, float z1, float x2, float y2, float z2) + { + MWPhysics::PhysicsSystem::RayResult result = castRayTest(x1, y1, z1, x2, y2, z2); + return result.mHit; + } + + MWPhysics::PhysicsSystem::RayResult World::castRayTest (float x1, float y1, float z1, float x2, float y2, float z2) { osg::Vec3f a(x1,y1,z1); osg::Vec3f b(x2,y2,z2); - MWPhysics::PhysicsSystem::RayResult result = mPhysics->castRay(a, b, MWWorld::Ptr(), std::vector(), MWPhysics::CollisionType_World|MWPhysics::CollisionType_Door); - return result.mHit; + return mPhysics->castRay(a, b, MWWorld::Ptr(), std::vector(), MWPhysics::CollisionType_World|MWPhysics::CollisionType_Door); } void World::processDoors(float duration) diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index ce6e27672..951a837da 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -407,6 +407,9 @@ namespace MWWorld virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2); ///< cast a Ray and return true if there is an object in the ray path. + virtual MWPhysics::PhysicsSystem::RayResult castRayTest (float x1, float y1, float z1, float x2, float y2, float z2); + ///< cast a rendering ray and return ray result. + virtual bool toggleCollisionMode(); ///< Toggle collision mode for player. If disabled player object should ignore /// collisions and gravity. From 54b4d93f795d2ce392c032e990833c1ca5abaaf4 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 10 Jul 2017 15:48:00 +0400 Subject: [PATCH 186/318] Added a special function for GUI sounds playing --- apps/openmw/mwbase/windowmanager.hpp | 2 ++ apps/openmw/mwgui/alchemywindow.cpp | 18 +++++++++--------- apps/openmw/mwgui/bookwindow.cpp | 11 +++++------ apps/openmw/mwgui/container.cpp | 3 +-- apps/openmw/mwgui/dialogue.cpp | 7 +++---- apps/openmw/mwgui/draganddrop.cpp | 5 ++--- apps/openmw/mwgui/enchantingdialog.cpp | 9 ++++----- apps/openmw/mwgui/inventorywindow.cpp | 7 +++---- apps/openmw/mwgui/journalwindow.cpp | 6 +++--- apps/openmw/mwgui/mainmenu.cpp | 15 ++++++++------- apps/openmw/mwgui/merchantrepair.cpp | 4 +--- apps/openmw/mwgui/recharge.cpp | 7 +++---- apps/openmw/mwgui/repair.cpp | 5 ++--- apps/openmw/mwgui/scrollwindow.cpp | 7 +++---- apps/openmw/mwgui/spellbuyingwindow.cpp | 3 +-- apps/openmw/mwgui/spellcreationdialog.cpp | 3 +-- apps/openmw/mwgui/tradewindow.cpp | 7 ++----- apps/openmw/mwgui/travelwindow.cpp | 3 +-- apps/openmw/mwgui/windowmanagerimp.cpp | 7 ++++++- apps/openmw/mwgui/windowmanagerimp.hpp | 2 ++ apps/openmw/mwinput/inputmanagerimp.cpp | 9 ++++----- apps/openmw/mwmechanics/npcstats.cpp | 3 +-- apps/openmw/mwmechanics/repair.cpp | 7 +++---- 23 files changed, 70 insertions(+), 80 deletions(-) diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index f103ce191..dd0e3321c 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -351,6 +351,8 @@ namespace MWBase /// Cycle to next or previous weapon virtual void cycleWeapon(bool next) = 0; + virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f) = 0; + // In WindowManager for now since there isn't a VFS singleton virtual std::string correctIconPath(const std::string& path) = 0; virtual std::string correctBookartPath(const std::string& path, int width, int height) = 0; diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 1d758cccf..7379f3613 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -4,7 +4,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwmechanics/magiceffects.hpp" @@ -66,26 +65,27 @@ namespace MWGui void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender) { MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getCaption ()); + MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager(); switch (result) { case MWMechanics::Alchemy::Result_NoName: - MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage37}"); + winMgr->messageBox("#{sNotifyMessage37}"); break; case MWMechanics::Alchemy::Result_NoMortarAndPestle: - MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage45}"); + winMgr->messageBox("#{sNotifyMessage45}"); break; case MWMechanics::Alchemy::Result_LessThanTwoIngredients: - MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage6a}"); + winMgr->messageBox("#{sNotifyMessage6a}"); break; case MWMechanics::Alchemy::Result_Success: - MWBase::Environment::get().getWindowManager()->messageBox("#{sPotionSuccess}"); - MWBase::Environment::get().getSoundManager()->playSound("potion success", 1.f, 1.f); + winMgr->messageBox("#{sPotionSuccess}"); + winMgr->playSound("potion success"); break; case MWMechanics::Alchemy::Result_NoEffects: case MWMechanics::Alchemy::Result_RandomFailure: - MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage8}"); - MWBase::Environment::get().getSoundManager()->playSound("potion fail", 1.f, 1.f); + winMgr->messageBox("#{sNotifyMessage8}"); + winMgr->playSound("potion fail"); break; } @@ -151,7 +151,7 @@ namespace MWGui update(); std::string sound = item.getClass().getUpSoundId(item); - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound(sound); } } diff --git a/apps/openmw/mwgui/bookwindow.cpp b/apps/openmw/mwgui/bookwindow.cpp index f3cefb787..b3296e7a7 100644 --- a/apps/openmw/mwgui/bookwindow.cpp +++ b/apps/openmw/mwgui/bookwindow.cpp @@ -6,7 +6,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwmechanics/actorutil.hpp" @@ -82,7 +81,7 @@ namespace MWGui clearPages(); mCurrentPage = 0; - MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("book open"); MWWorld::LiveCellRef *ref = mBook.get(); @@ -98,7 +97,7 @@ namespace MWGui void BookWindow::exit() { // no 3d sounds because the object could be in a container. - MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("book close"); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book); } @@ -122,7 +121,7 @@ namespace MWGui void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender) { - MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("Item Book Up"); MWWorld::ActionTake take(mBook); take.execute (MWMechanics::getPlayer()); @@ -195,7 +194,7 @@ namespace MWGui { if ((mCurrentPage+1)*2 < mPages.size()) { - MWBase::Environment::get().getSoundManager()->playSound ("book page2", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("book page2"); ++mCurrentPage; @@ -206,7 +205,7 @@ namespace MWGui { if (mCurrentPage > 0) { - MWBase::Environment::get().getSoundManager()->playSound ("book page", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("book page"); --mCurrentPage; diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 00df18e1d..c9be21322 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -5,7 +5,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwbase/dialoguemanager.hpp" #include "../mwbase/mechanicsmanager.hpp" @@ -224,7 +223,7 @@ namespace MWGui // play the sound of the first object MWWorld::Ptr item = mModel->getItem(i).mBase; std::string sound = item.getClass().getUpSoundId(item); - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound(sound); } const ItemStack& item = mModel->getItem(i); diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 96cf6a2c9..9e20ae71f 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -11,7 +11,6 @@ #include "../mwbase/windowmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/world.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/dialoguemanager.hpp" #include "../mwworld/class.hpp" @@ -228,21 +227,21 @@ namespace MWGui void Choice::activated() { - MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("Menu Click"); MWBase::Environment::get().getDialogueManager()->questionAnswered(mChoiceId); } void Topic::activated() { - MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); + MWBase::Environment::get().getWindowManager()->playSound("Menu Click"); MWBase::Environment::get().getDialogueManager()->keywordSelected(Misc::StringUtils::lowerCase(mTopicId)); } void Goodbye::activated() { - MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); + MWBase::Environment::get().getWindowManager()->playSound("Menu Click"); MWBase::Environment::get().getDialogueManager()->goodbyeSelected(); } diff --git a/apps/openmw/mwgui/draganddrop.cpp b/apps/openmw/mwgui/draganddrop.cpp index 6053a7fb0..fa17d974d 100644 --- a/apps/openmw/mwgui/draganddrop.cpp +++ b/apps/openmw/mwgui/draganddrop.cpp @@ -5,7 +5,6 @@ #include "../mwbase/windowmanager.hpp" #include "../mwbase/environment.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwworld/class.hpp" @@ -64,7 +63,7 @@ void DragAndDrop::startDrag (int index, SortFilterItemModel* sortModel, ItemMode } std::string sound = mItem.mBase.getClass().getUpSoundId(mItem.mBase); - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound (sound); if (mSourceSortModel) { @@ -94,7 +93,7 @@ void DragAndDrop::startDrag (int index, SortFilterItemModel* sortModel, ItemMode void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView) { std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase); - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound(sound); // We can't drop a conjured item to the ground; the target container should always be the source container if (mItem.mFlags & ItemStack::Flag_Bound && targetModel != mSourceModel) diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index a4728218a..643b69532 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -8,7 +8,6 @@ #include #include -#include "../mwbase/soundmanager.hpp" #include "../mwbase/dialoguemanager.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwworld/class.hpp" @@ -237,7 +236,7 @@ namespace MWGui mItemSelectionDialog->setVisible(false); setItem(item); - MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); + MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item)); mEnchanting.nextCastStyle(); updateLabels(); } @@ -259,7 +258,7 @@ namespace MWGui } setSoulGem(item); - MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); + MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item)); updateLabels(); } @@ -374,12 +373,12 @@ namespace MWGui if(result==1) { - MWBase::Environment::get().getSoundManager()->playSound("enchant success", 1.f, 1.f); + MWBase::Environment::get().getWindowManager()->playSound("enchant success"); MWBase::Environment::get().getWindowManager()->messageBox ("#{sEnchantmentMenu12}"); } else { - MWBase::Environment::get().getSoundManager()->playSound("enchant fail", 1.f, 1.f); + MWBase::Environment::get().getWindowManager()->playSound("enchant fail"); MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage34}"); } diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index a93934ecb..c6b8a4bd7 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -18,7 +18,6 @@ #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/scriptmanager.hpp" @@ -239,7 +238,7 @@ namespace MWGui // Can't give conjured items to a merchant if (item.mFlags & ItemStack::Flag_Bound) { - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound(sound); MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog9}"); return; } @@ -248,7 +247,7 @@ namespace MWGui int services = MWBase::Environment::get().getWindowManager()->getTradeWindow()->getMerchantServices(); if (!object.getClass().canSell(object, services)) { - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound(sound); MWBase::Environment::get().getWindowManager()-> messageBox("#{sBarterDialog4}"); return; @@ -322,7 +321,7 @@ namespace MWGui ensureSelectedItemUnequipped(count); const ItemStack& item = mTradeModel->getItem(mSelectedItem); std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound(sound); if (item.mType == ItemStack::Type_Barter) { diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 879f1b417..b5653508d 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -14,7 +14,6 @@ #include #include "../mwbase/environment.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwbase/journal.hpp" @@ -516,8 +515,9 @@ namespace void notifyClose(MyGUI::Widget* _sender) { - MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); - MWBase::Environment::get().getWindowManager ()->popGuiMode (); + MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager(); + winMgr->playSound("book close"); + winMgr->popGuiMode(); } void notifyMouseWheel(MyGUI::Widget* sender, int rel) diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp index 258f0dfb0..5a435b9cf 100644 --- a/apps/openmw/mwgui/mainmenu.cpp +++ b/apps/openmw/mwgui/mainmenu.cpp @@ -10,7 +10,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/world.hpp" #include "../mwbase/statemanager.hpp" @@ -76,23 +75,25 @@ namespace MWGui void MainMenu::onButtonClicked(MyGUI::Widget *sender) { + MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager(); + std::string name = *sender->getUserData(); - MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); + winMgr->playSound("Menu Click"); if (name == "return") { - MWBase::Environment::get().getWindowManager ()->removeGuiMode (GM_MainMenu); + winMgr->removeGuiMode (GM_MainMenu); } else if (name == "options") - MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings); + winMgr->pushGuiMode (GM_Settings); else if (name == "credits") - MWBase::Environment::get().getWindowManager()->playVideo("mw_credits.bik", true); + winMgr->playVideo("mw_credits.bik", true); else if (name == "exitgame") { if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame) onExitConfirmed(); else { - ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog(); + ConfirmationDialog* dialog = winMgr->getConfirmationDialog(); dialog->askForConfirmation("#{sMessage2}"); dialog->eventOkClicked.clear(); dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onExitConfirmed); @@ -105,7 +106,7 @@ namespace MWGui onNewGameConfirmed(); else { - ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog(); + ConfirmationDialog* dialog = winMgr->getConfirmationDialog(); dialog->askForConfirmation("#{sNotifyMessage54}"); dialog->eventOkClicked.clear(); dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onNewGameConfirmed); diff --git a/apps/openmw/mwgui/merchantrepair.cpp b/apps/openmw/mwgui/merchantrepair.cpp index f3a3e94ed..9e27c0154 100644 --- a/apps/openmw/mwgui/merchantrepair.cpp +++ b/apps/openmw/mwgui/merchantrepair.cpp @@ -10,7 +10,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/actorutil.hpp" @@ -138,8 +137,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender) player.getClass().getContainerStore(player).restack(item); - MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1); - + MWBase::Environment::get().getWindowManager()->playSound("Repair"); player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); diff --git a/apps/openmw/mwgui/recharge.cpp b/apps/openmw/mwgui/recharge.cpp index f97d8dbf8..390a1f83c 100644 --- a/apps/openmw/mwgui/recharge.cpp +++ b/apps/openmw/mwgui/recharge.cpp @@ -12,7 +12,6 @@ #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" @@ -130,7 +129,7 @@ void Recharge::onItemSelected(MWWorld::Ptr item) mGemIcon->setUserString ("ToolTipType", "ItemPtr"); mGemIcon->setUserData(item); - MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); + MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item)); updateView(); } @@ -175,7 +174,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender, const MWWorld::Ptr& item) item.getCellRef().setEnchantmentCharge( std::min(item.getCellRef().getEnchantmentCharge() + restored, static_cast(enchantment->mData.mCharge))); - MWBase::Environment::get().getSoundManager()->playSound("Enchant Success",1,1); + MWBase::Environment::get().getWindowManager()->playSound("Enchant Success"); player.getClass().getContainerStore(player).restack(item); @@ -183,7 +182,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender, const MWWorld::Ptr& item) } else { - MWBase::Environment::get().getSoundManager()->playSound("Enchant Fail",1,1); + MWBase::Environment::get().getWindowManager()->playSound("Enchant Fail"); } gem.getContainerStore()->remove(gem, 1, player); diff --git a/apps/openmw/mwgui/repair.cpp b/apps/openmw/mwgui/repair.cpp index 156f4412b..4d6441450 100644 --- a/apps/openmw/mwgui/repair.cpp +++ b/apps/openmw/mwgui/repair.cpp @@ -11,7 +11,6 @@ #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwmechanics/actorutil.hpp" @@ -66,7 +65,7 @@ void Repair::exit() void Repair::startRepairItem(const MWWorld::Ptr &item) { - MWBase::Environment::get().getSoundManager()->playSound("Item Repair Up",1,1); + MWBase::Environment::get().getWindowManager()->playSound("Item Repair Up"); mRepair.setTool(item); @@ -135,7 +134,7 @@ void Repair::onItemSelected(MWWorld::Ptr item) mRepair.setTool(item); - MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); + MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item)); updateRepairView(); } diff --git a/apps/openmw/mwgui/scrollwindow.cpp b/apps/openmw/mwgui/scrollwindow.cpp index ccc07174d..a5d4c3324 100644 --- a/apps/openmw/mwgui/scrollwindow.cpp +++ b/apps/openmw/mwgui/scrollwindow.cpp @@ -7,7 +7,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwmechanics/actorutil.hpp" @@ -53,7 +52,7 @@ namespace MWGui void ScrollWindow::openScroll (MWWorld::Ptr scroll, bool showTakeButton) { // no 3d sounds because the object could be in a container. - MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("scroll"); mScroll = scroll; @@ -78,7 +77,7 @@ namespace MWGui void ScrollWindow::exit() { - MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("scroll"); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll); } @@ -102,7 +101,7 @@ namespace MWGui void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender) { - MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("Item Book Up"); MWWorld::ActionTake take(mScroll); take.execute (MWMechanics::getPlayer()); diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp index 7de4e326e..806b17a90 100644 --- a/apps/openmw/mwgui/spellbuyingwindow.cpp +++ b/apps/openmw/mwgui/spellbuyingwindow.cpp @@ -6,7 +6,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" @@ -146,7 +145,7 @@ namespace MWGui startSpellBuying(mPtr); - MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up"); } void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender) diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 64d4d86c6..7201e64c2 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -7,7 +7,6 @@ #include #include "../mwbase/windowmanager.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -396,7 +395,7 @@ namespace MWGui MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr); npcStats.setGoldPool(npcStats.getGoldPool() + price); - MWBase::Environment::get().getSoundManager()->playSound ("Mysticism Hit", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound ("Mysticism Hit"); const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell); diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index fbdda8395..5f4433a47 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -10,7 +10,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/dialoguemanager.hpp" @@ -211,7 +210,7 @@ namespace MWGui { const ItemStack& item = mTradeModel->getItem(mItemToSell); std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound(sound); TradeItemModel* playerTradeModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel(); @@ -356,9 +355,7 @@ namespace MWGui MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse( MWBase::Environment::get().getWorld()->getStore().get().find("sBarterDialog5")->getString()); - std::string sound = "Item Gold Up"; - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); - + MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up"); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter); } diff --git a/apps/openmw/mwgui/travelwindow.cpp b/apps/openmw/mwgui/travelwindow.cpp index 59d139e20..3a7afe497 100644 --- a/apps/openmw/mwgui/travelwindow.cpp +++ b/apps/openmw/mwgui/travelwindow.cpp @@ -8,7 +8,6 @@ #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwbase/mechanicsmanager.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/dialoguemanager.hpp" #include "../mwmechanics/creaturestats.hpp" @@ -158,7 +157,7 @@ namespace MWGui if (!mPtr.getCell()->isExterior()) // Interior cell -> mages guild transport - MWBase::Environment::get().getSoundManager()->playSound("mysticism cast", 1, 1); + MWBase::Environment::get().getWindowManager()->playSound("mysticism cast"); player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index e77281898..bc77eb069 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -856,7 +856,7 @@ namespace MWGui mRepair->exit(); break; case GM_Journal: - MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); + playSound("book close"); removeGuiMode(GM_Journal); //Simple way to remove it break; default: @@ -1976,6 +1976,11 @@ namespace MWGui mInventoryWindow->cycle(next); } + void WindowManager::playSound(const std::string& soundId, float volume, float pitch) + { + MWBase::Environment::get().getSoundManager()->playSound(soundId, volume, pitch, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_NoEnv); + } + void WindowManager::setConsoleSelectedObject(const MWWorld::Ptr &object) { mConsole->setSelectedObject(object); diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index ea7b4c14c..0d17b7f4f 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -380,6 +380,8 @@ namespace MWGui /// Cycle to next or previous weapon virtual void cycleWeapon(bool next); + virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f); + // In WindowManager for now since there isn't a VFS singleton virtual std::string correctIconPath(const std::string& path); virtual std::string correctBookartPath(const std::string& path, int width, int height); diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 283147ca9..7b2a1560d 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -18,7 +18,6 @@ #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwbase/statemanager.hpp" #include "../mwbase/environment.hpp" @@ -715,7 +714,7 @@ namespace MWInput MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType(false); if (b && b->getEnabled() && id == SDL_BUTTON_LEFT) { - MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); + MWBase::Environment::get().getWindowManager()->playSound("Menu Click"); } } } @@ -810,7 +809,7 @@ namespace MWInput MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType(false); if (b && b->getEnabled()) { - MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); + MWBase::Environment::get().getWindowManager()->playSound("Menu Click"); } } } @@ -1025,12 +1024,12 @@ namespace MWInput if(MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Journal && MWBase::Environment::get().getWindowManager ()->getJournalAllowed()) { - MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound ("book open"); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Journal); } else if(MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Journal)) { - MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); + MWBase::Environment::get().getWindowManager()->playSound ("book close"); MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Journal); } } diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index 5f8967cf4..595635206 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -15,7 +15,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/soundmanager.hpp" MWMechanics::NpcStats::NpcStats() : mDisposition (0) @@ -254,7 +253,7 @@ void MWMechanics::NpcStats::increaseSkill(int skillIndex, const ESM::Class &clas // Play sound & skill progress notification /// \todo check if character is the player, if levelling is ever implemented for NPCs - MWBase::Environment::get().getSoundManager ()->playSound ("skillraise", 1, 1); + MWBase::Environment::get().getWindowManager()->playSound("skillraise"); std::stringstream message; message << boost::format(MWBase::Environment::get().getWindowManager ()->getGameSettingString ("sNotifyMessage39", "")) diff --git a/apps/openmw/mwmechanics/repair.cpp b/apps/openmw/mwmechanics/repair.cpp index a1c79ea23..5c6123e82 100644 --- a/apps/openmw/mwmechanics/repair.cpp +++ b/apps/openmw/mwmechanics/repair.cpp @@ -8,7 +8,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwbase/soundmanager.hpp" #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" @@ -71,12 +70,12 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair) // increase skill player.getClass().skillUsageSucceeded(player, ESM::Skill::Armorer, 0); - MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1); + MWBase::Environment::get().getWindowManager()->playSound("Repair"); MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairSuccess}"); } else { - MWBase::Environment::get().getSoundManager()->playSound("Repair Fail",1,1); + MWBase::Environment::get().getWindowManager()->playSound("Repair Fail"); MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairFailed}"); } @@ -100,7 +99,7 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair) { mTool = *iter; - MWBase::Environment::get().getSoundManager()->playSound("Item Repair Up",1,1); + MWBase::Environment::get().getWindowManager()->playSound("Item Repair Up"); break; } From be940656db8fe667df0b269dc1752f44ab4556d0 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 10 Jul 2017 23:49:42 +0200 Subject: [PATCH 187/318] Add '0' as an alias for 'OFF' for OPENMW_OPTIMIZE --- components/resource/scenemanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index ba8c57c1b..226933760 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -452,7 +452,7 @@ namespace Resource { std::string str(env); - if(str.find("OFF")!=std::string::npos) options = 0; + if(str.find("OFF")!=std::string::npos || str.find("0")!= std::string::npos) options = 0; if(str.find("~FLATTEN_STATIC_TRANSFORMS")!=std::string::npos) options ^= Optimizer::FLATTEN_STATIC_TRANSFORMS; else if(str.find("FLATTEN_STATIC_TRANSFORMS")!=std::string::npos) options |= Optimizer::FLATTEN_STATIC_TRANSFORMS; From 40dc1dd6f5c2acf0f5e4af8356c861b70a16ae31 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 10 Jul 2017 23:50:24 +0200 Subject: [PATCH 188/318] Fix checking a variable before it's assigned (Bug #3950) --- components/nifosg/nifloader.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 05f6263b7..e514cca12 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -623,11 +623,6 @@ namespace NifOsg node->setNodeMask(0x1); } - if (skipMeshes && isAnimated) // make sure the empty node is not optimized away so the physicssystem can find it. - { - node->setDataVariance(osg::Object::DYNAMIC); - } - // We can skip creating meshes for hidden nodes if they don't have a VisController that // might make them visible later if (nifNode->flags & Nif::NiNode::Flag_Hidden) @@ -643,6 +638,11 @@ namespace NifOsg node->setNodeMask(0x1); } + if (skipMeshes && isAnimated) // make sure the empty node is not optimized away so the physicssystem can find it. + { + node->setDataVariance(osg::Object::DYNAMIC); + } + osg::ref_ptr composite = new SceneUtil::CompositeStateSetUpdater; applyNodeProperties(nifNode, node, composite, imageManager, boundTextures, animflags); From 2d7689b978444eef07f8a893b78da2d9cb1214fc Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Fri, 14 Jul 2017 12:07:16 +1200 Subject: [PATCH 189/318] Add Visual Studio 2017 support The new VS2017 configuration uses all the same settings as the VS2015 one, but uses a different generator. CMake by default looks for Boost libraries based on the compiler being used, but Boost only has binaries for VS2015, so a hack is used to make sure it looks for the correct ones. I don't know what TOOLSET and XP_TOOLSET are for but I left them just in case. --- CI/before_script.msvc.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 5aa76de92..35cb2f818 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -75,7 +75,7 @@ Options: Set the build platform, can also be set with environment variable PLATFORM. -u Configure for unity builds. - -v <2013/2015> + -v <2013/2015/2017> Choose the Visual Studio version to use. -V Run verbosely @@ -213,20 +213,34 @@ if [ -z $VS_VERSION ]; then fi case $VS_VERSION in + 15|15.0|2017 ) + GENERATOR="Visual Studio 15 2017" + XP_TOOLSET="v140xp" + TOOLSET="v140" + BOOST_TOOLSET="vc140" + MSVC_VER="14" + MSVC_YEAR="2015" + MSVC_DISPLAY_YEAR="2017" + ;; + 14|14.0|2015 ) GENERATOR="Visual Studio 14 2015" XP_TOOLSET="v140_xp" TOOLSET="v140" + BOOST_TOOLSET="vc140" MSVC_VER="14" MSVC_YEAR="2015" + MSVC_DISPLAY_YEAR="2015" ;; 12|12.0|2013 ) GENERATOR="Visual Studio 12 2013" XP_TOOLSET="v120_xp" TOOLSET="v120" + BOOST_TOOLSET="vc120" MSVC_VER="12" MSVC_YEAR="2013" + MSVC_DISPLAY_YEAR="2013" ;; esac @@ -278,7 +292,7 @@ fi echo echo "===================================" -echo "Starting prebuild on MSVC${MSVC_YEAR} WIN${BITS}" +echo "Starting prebuild on MSVC${MSVC_DISPLAY_YEAR} WIN${BITS}" echo "===================================" echo @@ -350,7 +364,7 @@ fi cd .. #/.. # Set up dependencies -BUILD_DIR="MSVC${MSVC_YEAR}_${BITS}" +BUILD_DIR="MSVC${MSVC_DISPLAY_YEAR}_${BITS}" if [ -z $KEEP ]; then echo echo "(Re)Creating build directory." @@ -395,6 +409,7 @@ fi add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" + add_cmake_opts -DBoost_COMPILER="-${BOOST_TOOLSET}" echo Done. else @@ -406,6 +421,7 @@ fi fi add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" + add_cmake_opts -DBoost_COMPILER="-${BOOST_TOOLSET}" echo Done. fi From 3b163ce6ce8d1bf9195cc4dd38136ec01d41b3e6 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Jul 2017 10:58:19 +0400 Subject: [PATCH 190/318] Disable sound distortion for PlaySound script command --- apps/openmw/mwscript/soundextensions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/soundextensions.cpp b/apps/openmw/mwscript/soundextensions.cpp index 516c58b26..bedc02138 100644 --- a/apps/openmw/mwscript/soundextensions.cpp +++ b/apps/openmw/mwscript/soundextensions.cpp @@ -82,7 +82,7 @@ namespace MWScript std::string sound = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getSoundManager()->playSound(sound, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_NoEnv); } }; @@ -101,7 +101,7 @@ namespace MWScript Interpreter::Type_Float pitch = runtime[0].mFloat; runtime.pop(); - MWBase::Environment::get().getSoundManager()->playSound (sound, volume, pitch); + MWBase::Environment::get().getSoundManager()->playSound(sound, volume, pitch, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_NoEnv); } }; From dca83170831e66a2b0d088b0ee3a8ee63092e0b1 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Jul 2017 10:59:08 +0400 Subject: [PATCH 191/318] Disable sound distortion for player actions in GUI mode --- apps/openmw/mwworld/action.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/action.cpp b/apps/openmw/mwworld/action.cpp index 92e959e41..468207e81 100644 --- a/apps/openmw/mwworld/action.cpp +++ b/apps/openmw/mwworld/action.cpp @@ -4,6 +4,7 @@ #include "../mwbase/world.hpp" #include "../mwbase/soundmanager.hpp" +#include "../mwbase/windowmanager.hpp" #include "../mwmechanics/actorutil.hpp" @@ -26,9 +27,18 @@ void MWWorld::Action::execute (const Ptr& actor, bool noSound) { if(!mSoundId.empty() && !noSound) { + MWBase::SoundManager::PlayMode envType = MWBase::SoundManager::Play_Normal; + + // Action sounds should not have a distortion in GUI mode + // example: take an item or drink a potion underwater + if (actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWindowManager()->isGuiMode()) + { + envType = MWBase::SoundManager::Play_NoEnv; + } + if(mKeepSound && actor == MWMechanics::getPlayer()) MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0, - MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Normal, mSoundOffset + MWBase::SoundManager::Play_TypeSfx, envType, mSoundOffset ); else { @@ -37,12 +47,12 @@ void MWWorld::Action::execute (const Ptr& actor, bool noSound) MWBase::Environment::get().getSoundManager()->playSound3D( (local ? actor : mTarget).getRefData().getPosition().asVec3(), mSoundId, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, - MWBase::SoundManager::Play_Normal, mSoundOffset + envType, mSoundOffset ); else MWBase::Environment::get().getSoundManager()->playSound3D(local ? actor : mTarget, mSoundId, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, - MWBase::SoundManager::Play_Normal, mSoundOffset + envType, mSoundOffset ); } } From 5be1c81913624b62add3db442c7b20fb152f866d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Jul 2017 14:03:36 +0400 Subject: [PATCH 192/318] Fixed Close button handler in EditEffectDialog (fixes #3956) --- apps/openmw/mwgui/spellcreationdialog.cpp | 9 +++++++++ files/mygui/openmw_edit_effect.layout | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 7201e64c2..e22fc3c63 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -170,11 +170,20 @@ namespace MWGui mAreaSlider->setScrollPosition (effect.mArea); mDurationSlider->setScrollPosition (effect.mDuration-1); + if (mEffect.mRange == ESM::RT_Self) + mRangeButton->setCaptionWithReplacing ("#{sRangeSelf}"); + else if (mEffect.mRange == ESM::RT_Target) + mRangeButton->setCaptionWithReplacing ("#{sRangeTarget}"); + else if (mEffect.mRange == ESM::RT_Touch) + mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}"); + onMagnitudeMinChanged (mMagnitudeMinSlider, effect.mMagnMin-1); onMagnitudeMaxChanged (mMagnitudeMinSlider, effect.mMagnMax-1); onAreaChanged (mAreaSlider, effect.mArea); onDurationChanged (mDurationSlider, effect.mDuration-1); eventEffectModified(mEffect); + + updateBoxes(); } void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect) diff --git a/files/mygui/openmw_edit_effect.layout b/files/mygui/openmw_edit_effect.layout index 387c01231..376e87efa 100644 --- a/files/mygui/openmw_edit_effect.layout +++ b/files/mygui/openmw_edit_effect.layout @@ -1,7 +1,7 @@ - + From 9179a019dfc60e457134bf8721c207bac70178d4 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 13:11:34 +0400 Subject: [PATCH 193/318] Quick keys menu fixes --- apps/openmw/mwgui/quickkeysmenu.cpp | 3 ++- files/mygui/openmw_quickkeys_menu_assign.layout | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index 63cc14d98..619540cff 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -370,7 +370,8 @@ namespace MWGui mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onCancelButtonClicked); - int maxWidth = mItemButton->getTextSize ().width + 24; + int maxWidth = mLabel->getTextSize ().width + 24; + maxWidth = std::max(maxWidth, mItemButton->getTextSize ().width + 24); maxWidth = std::max(maxWidth, mMagicButton->getTextSize ().width + 24); maxWidth = std::max(maxWidth, mUnassignButton->getTextSize ().width + 24); maxWidth = std::max(maxWidth, mCancelButton->getTextSize ().width + 24); diff --git a/files/mygui/openmw_quickkeys_menu_assign.layout b/files/mygui/openmw_quickkeys_menu_assign.layout index 4bbd9f1fa..2c80fefcd 100644 --- a/files/mygui/openmw_quickkeys_menu_assign.layout +++ b/files/mygui/openmw_quickkeys_menu_assign.layout @@ -1,6 +1,6 @@ - + From 2b22d10ebc212ae2682f5c1b133c5f1c1b9cbfab Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 13:14:19 +0400 Subject: [PATCH 194/318] Spellview fixes --- apps/openmw/mwgui/spellview.cpp | 4 ++-- files/mygui/openmw_magicselection_dialog.layout | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/spellview.cpp b/apps/openmw/mwgui/spellview.cpp index 9932cddfa..ebda8873c 100644 --- a/apps/openmw/mwgui/spellview.cpp +++ b/apps/openmw/mwgui/spellview.cpp @@ -96,9 +96,9 @@ namespace MWGui if (spell.mType == Spell::Type_Power) addGroup("#{sPowers}", ""); else if (spell.mType == Spell::Type_Spell) - addGroup("#{sSpells}", "#{sCostChance}"); + addGroup("#{sSpells}", mShowCostColumn ? "#{sCostChance}" : ""); else - addGroup("#{sMagicItem}", "#{sCostCharge}"); + addGroup("#{sMagicItem}", mShowCostColumn ? "#{sCostCharge}" : ""); curType = spell.mType; } diff --git a/files/mygui/openmw_magicselection_dialog.layout b/files/mygui/openmw_magicselection_dialog.layout index 5301ecfe9..027250d7a 100644 --- a/files/mygui/openmw_magicselection_dialog.layout +++ b/files/mygui/openmw_magicselection_dialog.layout @@ -1,6 +1,6 @@ - + From 5bb9f1b187d563d48d16bac0abb0baeee35a6e70 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 13:18:59 +0400 Subject: [PATCH 195/318] Make popup in character select menu non-transparent --- files/mygui/openmw_list.skin.xml | 13 +++++++++++++ files/mygui/openmw_resources.xml | 18 ++++++++++++++++++ files/mygui/openmw_savegame_dialog.layout | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/files/mygui/openmw_list.skin.xml b/files/mygui/openmw_list.skin.xml index 8a238879c..5b6f14dd5 100644 --- a/files/mygui/openmw_list.skin.xml +++ b/files/mygui/openmw_list.skin.xml @@ -150,6 +150,19 @@ + + + + + + + + + + + + + diff --git a/files/mygui/openmw_resources.xml b/files/mygui/openmw_resources.xml index ef11d10a0..437c0945b 100644 --- a/files/mygui/openmw_resources.xml +++ b/files/mygui/openmw_resources.xml @@ -114,6 +114,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/files/mygui/openmw_savegame_dialog.layout b/files/mygui/openmw_savegame_dialog.layout index f18218430..28e1e5188 100644 --- a/files/mygui/openmw_savegame_dialog.layout +++ b/files/mygui/openmw_savegame_dialog.layout @@ -16,7 +16,7 @@ - + From 98f161c7fd3077e28708b40f2815ebb46f2e9836 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 22:38:23 +0400 Subject: [PATCH 196/318] Combat AI: avoid enemy hits when casting Self-ranged spells (fixes #3922) --- apps/openmw/mwmechanics/aicombataction.cpp | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 46d37eb3d..aad0baae8 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -45,20 +45,18 @@ int getRangeTypes (const ESM::EffectList& effects) float suggestCombatRange(int rangeTypes) { + static const float fCombatDistance = MWBase::Environment::get().getWorld()->getStore().get().find("fCombatDistance")->getFloat(); + static float fHandToHandReach = MWBase::Environment::get().getWorld()->getStore().get().find("fHandToHandReach")->getFloat(); + + // This distance is a possible distance of melee attack + static float distance = fCombatDistance * std::max(2.f, fHandToHandReach); + if (rangeTypes & Touch) { - static const float fCombatDistance = MWBase::Environment::get().getWorld()->getStore().get().find("fCombatDistance")->getFloat(); return fCombatDistance; } - else if (rangeTypes & Target) - { - return 1000.f; - } - else - { - // For Self spells, distance doesn't matter, so back away slightly to avoid enemy hits - return 600.f; - } + + return distance * 4; } int numEffectsToDispel (const MWWorld::Ptr& actor, int effectFilter=-1, bool negative = true) @@ -640,7 +638,7 @@ namespace MWMechanics const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(mSpellId); int types = getRangeTypes(spell->mEffects); - isRanged = (types & Target); + isRanged = (types & Target) | (types & Self); return suggestCombatRange(types); } @@ -660,7 +658,8 @@ namespace MWMechanics float ActionPotion::getCombatRange(bool& isRanged) const { - // distance doesn't matter, so back away slightly to avoid enemy hits + // Distance doesn't matter since this action has no animation + // If we want to back away slightly to avoid enemy hits, we should set isRanged to "true" return 600.f; } From 679516326595a694a8c53f16ae6e347556f61351 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 23:03:53 +0400 Subject: [PATCH 197/318] Disable transparency for all popup lists --- files/mygui/openmw_resources.xml | 18 ------------------ files/mygui/openmw_savegame_dialog.layout | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/files/mygui/openmw_resources.xml b/files/mygui/openmw_resources.xml index 437c0945b..811fa4f7f 100644 --- a/files/mygui/openmw_resources.xml +++ b/files/mygui/openmw_resources.xml @@ -97,24 +97,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/files/mygui/openmw_savegame_dialog.layout b/files/mygui/openmw_savegame_dialog.layout index 28e1e5188..f18218430 100644 --- a/files/mygui/openmw_savegame_dialog.layout +++ b/files/mygui/openmw_savegame_dialog.layout @@ -16,7 +16,7 @@ - + From 2bd105f5e224d7ddbb1974c18b88bb4c82b614bc Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 18 Jul 2017 11:51:19 +0400 Subject: [PATCH 198/318] Change mValue type for clothes to unsigned short (fixes #3960) --- components/esm/loadclot.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esm/loadclot.hpp b/components/esm/loadclot.hpp index 39e5ea672..a9ea3e70a 100644 --- a/components/esm/loadclot.hpp +++ b/components/esm/loadclot.hpp @@ -39,7 +39,7 @@ struct Clothing { int mType; float mWeight; - short mValue; + unsigned short mValue; short mEnchant; }; CTDTstruct mData; From a629d48df62e9497728efdfae52d27eb4ff5ee4d Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 19 Jul 2017 13:05:51 +0200 Subject: [PATCH 199/318] Update the facedObject after the camera is updated --- apps/openmw/engine.cpp | 3 +++ apps/openmw/mwbase/world.hpp | 2 ++ apps/openmw/mwworld/worldimp.cpp | 6 ++---- apps/openmw/mwworld/worldimp.hpp | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index b1c1311bc..426300149 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -709,6 +709,9 @@ void OMW::Engine::go() { mViewer->eventTraversal(); mViewer->updateTraversal(); + + mEnvironment.getWorld()->updateWindowManager(); + mViewer->renderingTraversals(); } diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 691891486..5e76d82eb 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -358,6 +358,8 @@ namespace MWBase virtual void update (float duration, bool paused) = 0; + virtual void updateWindowManager () = 0; + virtual MWWorld::Ptr placeObject (const MWWorld::ConstPtr& object, float cursorX, float cursorY, int amount) = 0; ///< copy and place an object into the gameworld at the specified cursor position /// @param object diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 6c9cdb394..c6d37b34c 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1624,16 +1624,14 @@ namespace MWWorld if (!paused) doPhysics (duration); + updatePlayer(paused); + mPhysics->debugDraw(); mWorldScene->update (duration, paused); - updateWindowManager (); - updateSoundListener(); - updatePlayer(paused); - mSpellPreloadTimer -= duration; if (mSpellPreloadTimer <= 0.f) { diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 6fa7d897a..a15dcaf3d 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -130,7 +130,6 @@ namespace MWWorld Ptr copyObjectToCell(const ConstPtr &ptr, CellStore* cell, ESM::Position pos, int count, bool adjustPos); void updateSoundListener(); - void updateWindowManager (); void updatePlayer(bool paused); void preloadSpells(); @@ -461,6 +460,8 @@ namespace MWWorld virtual void update (float duration, bool paused); + virtual void updateWindowManager (); + virtual MWWorld::Ptr placeObject (const MWWorld::ConstPtr& object, float cursorX, float cursorY, int amount); ///< copy and place an object into the gameworld at the specified cursor position /// @param object From ac78d01b2b3c93223222b1a4697c726aafed22bf Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 19 Jul 2017 13:11:44 +0200 Subject: [PATCH 200/318] Terrain: use the main camera's viewpoint for intersection tests Fixes lag spikes caused by intersection tests loading/unloading terrain pages. --- apps/openmw/mwrender/renderingmanager.cpp | 1 + components/terrain/quadtreenode.cpp | 19 ++++++++++++---- components/terrain/quadtreeworld.cpp | 5 +++++ components/terrain/quadtreeworld.hpp | 2 ++ components/terrain/viewdata.cpp | 27 +++++++++++++++++++++++ components/terrain/viewdata.hpp | 13 +++++++++++ components/terrain/world.hpp | 4 ++++ 7 files changed, 67 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 6ee9b8ae8..4d4a36f6c 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -222,6 +222,7 @@ namespace MWRender mTerrain.reset(new Terrain::QuadTreeWorld(sceneRoot, mRootNode, mResourceSystem, mTerrainStorage, Mask_Terrain, Mask_PreCompile)); else mTerrain.reset(new Terrain::TerrainGrid(sceneRoot, mRootNode, mResourceSystem, mTerrainStorage, Mask_Terrain, Mask_PreCompile)); + mTerrain->setDefaultViewer(mViewer->getCamera()); mCamera.reset(new Camera(mViewer->getCamera())); diff --git a/components/terrain/quadtreenode.cpp b/components/terrain/quadtreenode.cpp index 438303c27..801cdef5c 100644 --- a/components/terrain/quadtreenode.cpp +++ b/components/terrain/quadtreenode.cpp @@ -99,8 +99,10 @@ void QuadTreeNode::traverse(osg::NodeVisitor &nv) if (!hasValidBounds()) return; - if ((mLodCallback && mLodCallback->isSufficientDetail(this, nv.getEyePoint())) || !getNumChildren()) - getView(nv)->add(this, true); + ViewData* vd = getView(nv); + + if ((mLodCallback && mLodCallback->isSufficientDetail(this, vd->getEyePoint())) || !getNumChildren()) + vd->add(this, true); else osg::Group::traverse(nv); } @@ -130,11 +132,20 @@ ViewData* QuadTreeNode::getView(osg::NodeVisitor &nv) if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR) { osgUtil::CullVisitor* cv = static_cast(&nv); - return mViewDataMap->getViewData(cv->getCurrentCamera(), true); + ViewData* vd = mViewDataMap->getViewData(cv->getCurrentCamera(), true); + vd->setEyePoint(nv.getEyePoint()); + return vd; } else // INTERSECTION_VISITOR { - return mViewDataMap->getViewData(&nv, (nv.referenceCount() > 0)); // if no referenceCount, the visitor was allocated on the stack + static osg::ref_ptr dummyObj = new osg::DummyObject; + ViewData* vd = mViewDataMap->getViewData(dummyObj.get(), true); + ViewData* defaultView = mViewDataMap->getDefaultView(); + if (defaultView->hasEyePoint()) + vd->setEyePoint(defaultView->getEyePoint()); + else + vd->setEyePoint(nv.getEyePoint()); + return vd; } } diff --git a/components/terrain/quadtreeworld.cpp b/components/terrain/quadtreeworld.cpp index f2a80d673..f31064805 100644 --- a/components/terrain/quadtreeworld.cpp +++ b/components/terrain/quadtreeworld.cpp @@ -456,5 +456,10 @@ void QuadTreeWorld::reportStats(unsigned int frameNumber, osg::Stats *stats) stats->setAttribute(frameNumber, "Composite", mCompositeMapRenderer->getCompileSetSize()); } +void QuadTreeWorld::setDefaultViewer(osg::Object *obj) +{ + mViewDataMap->setDefaultViewer(obj); +} + } diff --git a/components/terrain/quadtreeworld.hpp b/components/terrain/quadtreeworld.hpp index 8ec75917b..ef33f158e 100644 --- a/components/terrain/quadtreeworld.hpp +++ b/components/terrain/quadtreeworld.hpp @@ -33,6 +33,8 @@ namespace Terrain void reportStats(unsigned int frameNumber, osg::Stats* stats); + virtual void setDefaultViewer(osg::Object* obj); + private: void ensureQuadTreeBuilt(); diff --git a/components/terrain/viewdata.cpp b/components/terrain/viewdata.cpp index 7b3df56b9..5e16537f4 100644 --- a/components/terrain/viewdata.cpp +++ b/components/terrain/viewdata.cpp @@ -7,6 +7,7 @@ ViewData::ViewData() : mNumEntries(0) , mFrameLastUsed(0) , mChanged(false) + , mHasEyePoint(false) { } @@ -43,6 +44,22 @@ bool ViewData::hasChanged() const return mChanged; } +bool ViewData::hasEyePoint() const +{ + return mHasEyePoint; +} + +void ViewData::setEyePoint(const osg::Vec3f &eye) +{ + mEyePoint = eye; + mHasEyePoint = true; +} + +const osg::Vec3f& ViewData::getEyePoint() const +{ + return mEyePoint; +} + void ViewData::reset(unsigned int frame) { // clear any unused entries @@ -150,5 +167,15 @@ void ViewDataMap::clear() mViewVector.clear(); } +void ViewDataMap::setDefaultViewer(osg::Object *viewer) +{ + mDefaultViewer = viewer; +} + +ViewData* ViewDataMap::getDefaultView() +{ + return getViewData(mDefaultViewer, true); +} + } diff --git a/components/terrain/viewdata.hpp b/components/terrain/viewdata.hpp index 30563d566..e4bfbd10c 100644 --- a/components/terrain/viewdata.hpp +++ b/components/terrain/viewdata.hpp @@ -52,12 +52,19 @@ namespace Terrain /// @return Have any nodes changed since the last frame bool hasChanged() const; + bool hasEyePoint() const; + + void setEyePoint(const osg::Vec3f& eye); + const osg::Vec3f& getEyePoint() const; + private: std::vector mEntries; unsigned int mNumEntries; unsigned int mFrameLastUsed; bool mChanged; osg::ref_ptr mViewer; + osg::Vec3f mEyePoint; + bool mHasEyePoint; }; class ViewDataMap : public osg::Referenced @@ -71,6 +78,10 @@ namespace Terrain void clear(); + void setDefaultViewer(osg::Object* viewer); + + ViewData* getDefaultView(); + private: std::list mViewVector; @@ -78,6 +89,8 @@ namespace Terrain Map mViews; std::deque mUnusedViews; + + osg::ref_ptr mDefaultViewer; }; } diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index 1eafc8bd7..d0576fbd3 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -14,6 +14,7 @@ namespace osg class Group; class Stats; class Node; + class Object; } namespace Resource @@ -87,6 +88,9 @@ namespace Terrain virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) {} + /// Set the default viewer (usually a Camera), used as viewpoint for any viewers that don't use their own viewpoint. + virtual void setDefaultViewer(osg::Object* obj) {} + Storage* getStorage() { return mStorage; } protected: From 3e03a0d7bd6d00253997f5f10e3fff0de449df81 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 19 Jul 2017 13:14:18 +0200 Subject: [PATCH 201/318] Terrain: remove ref argument that is now always true --- components/terrain/quadtreenode.cpp | 4 ++-- components/terrain/viewdata.cpp | 10 ++++------ components/terrain/viewdata.hpp | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/components/terrain/quadtreenode.cpp b/components/terrain/quadtreenode.cpp index 801cdef5c..0394adea7 100644 --- a/components/terrain/quadtreenode.cpp +++ b/components/terrain/quadtreenode.cpp @@ -132,14 +132,14 @@ ViewData* QuadTreeNode::getView(osg::NodeVisitor &nv) if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR) { osgUtil::CullVisitor* cv = static_cast(&nv); - ViewData* vd = mViewDataMap->getViewData(cv->getCurrentCamera(), true); + ViewData* vd = mViewDataMap->getViewData(cv->getCurrentCamera()); vd->setEyePoint(nv.getEyePoint()); return vd; } else // INTERSECTION_VISITOR { static osg::ref_ptr dummyObj = new osg::DummyObject; - ViewData* vd = mViewDataMap->getViewData(dummyObj.get(), true); + ViewData* vd = mViewDataMap->getViewData(dummyObj.get()); ViewData* defaultView = mViewDataMap->getDefaultView(); if (defaultView->hasEyePoint()) vd->setEyePoint(defaultView->getEyePoint()); diff --git a/components/terrain/viewdata.cpp b/components/terrain/viewdata.cpp index 5e16537f4..5c70f65f2 100644 --- a/components/terrain/viewdata.cpp +++ b/components/terrain/viewdata.cpp @@ -112,14 +112,13 @@ bool ViewData::Entry::set(QuadTreeNode *node, bool visible) } } -ViewData *ViewDataMap::getViewData(osg::Object *viewer, bool ref) +ViewData *ViewDataMap::getViewData(osg::Object *viewer) { Map::const_iterator found = mViews.find(viewer); if (found == mViews.end()) { ViewData* vd = createOrReuseView(); - if (ref) - vd->setViewer(viewer); + vd->setViewer(viewer); mViews[viewer] = vd; return vd; } @@ -147,8 +146,7 @@ void ViewDataMap::clearUnusedViews(unsigned int frame) for (Map::iterator it = mViews.begin(); it != mViews.end(); ) { ViewData* vd = it->second; - if ((!vd->getViewer() // if no ref was held, always need to clear to avoid holding a dangling ref. - || vd->getFrameLastUsed() + 2 < frame)) + if (vd->getFrameLastUsed() + 2 < frame) { vd->setViewer(NULL); vd->clear(); @@ -174,7 +172,7 @@ void ViewDataMap::setDefaultViewer(osg::Object *viewer) ViewData* ViewDataMap::getDefaultView() { - return getViewData(mDefaultViewer, true); + return getViewData(mDefaultViewer); } diff --git a/components/terrain/viewdata.hpp b/components/terrain/viewdata.hpp index e4bfbd10c..aaf5b788f 100644 --- a/components/terrain/viewdata.hpp +++ b/components/terrain/viewdata.hpp @@ -70,7 +70,7 @@ namespace Terrain class ViewDataMap : public osg::Referenced { public: - ViewData* getViewData(osg::Object* viewer, bool ref); + ViewData* getViewData(osg::Object* viewer); ViewData* createOrReuseView(); From 20606a2aff2c4226355ba0e2e4721016ddb2204f Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 19 Jul 2017 16:43:29 +0200 Subject: [PATCH 202/318] Add 'prediction time' setting for cell/terrain pre-loading --- apps/openmw/mwworld/scene.cpp | 3 ++- apps/openmw/mwworld/scene.hpp | 1 + docs/source/reference/modding/settings/cells.rst | 13 +++++++++++++ files/settings-default.cfg | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index bec053bc0..8da01cc4b 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -478,6 +478,7 @@ namespace MWWorld , mPreloadExteriorGrid(Settings::Manager::getBool("preload exterior grid", "Cells")) , mPreloadDoors(Settings::Manager::getBool("preload doors", "Cells")) , mPreloadFastTravel(Settings::Manager::getBool("preload fast travel", "Cells")) + , mPredictionTime(Settings::Manager::getFloat("prediction time", "Cells")) { mPreloader.reset(new CellPreloader(rendering.getResourceSystem(), physics->getShapeManager(), rendering.getTerrain(), rendering.getLandManager())); mPreloader->setWorkQueue(mRendering.getWorkQueue()); @@ -685,7 +686,7 @@ namespace MWWorld const MWWorld::ConstPtr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); osg::Vec3f playerPos = player.getRefData().getPosition().asVec3(); osg::Vec3f moved = playerPos - mLastPlayerPos; - osg::Vec3f predictedPos = playerPos + moved / dt; + osg::Vec3f predictedPos = playerPos + moved / dt * mPredictionTime; if (mCurrentCell->isExterior()) exteriorPositions.push_back(predictedPos); diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index 586ac4f67..e2fac6438 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -67,6 +67,7 @@ namespace MWWorld bool mPreloadExteriorGrid; bool mPreloadDoors; bool mPreloadFastTravel; + float mPredictionTime; osg::Vec3f mLastPlayerPos; diff --git a/docs/source/reference/modding/settings/cells.rst b/docs/source/reference/modding/settings/cells.rst index bbde2fc32..d2e7cf5be 100644 --- a/docs/source/reference/modding/settings/cells.rst +++ b/docs/source/reference/modding/settings/cells.rst @@ -155,6 +155,19 @@ preload cell expiry delay The amount of time (in seconds) that a preloaded cell will stay in cache after it is no longer referenced or required, for example, after the player has moved away from a door without entering it. +prediction time +--------------- + +:Type: floating point +:Range: >=0 +:Default: 1 + +The amount of time (in seconds) in the future to predict the player position for. This predicted position is used to preload any cells and/or distant terrain required at that position. + +This setting will only have an effect if 'preload enabled' is set or the 'distant terrain' in the Terrain section is set. + +Increasing this setting from its default may help if your computer/hard disk is too slow to preload in time and you see loading screens and/or lag spikes. + cache expiry delay ------------------ diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 9c3667a6e..40c1ed099 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -73,6 +73,9 @@ preload cell cache max = 20 # How long to keep preloaded cells in cache after they're no longer referenced/required (in seconds) preload cell expiry delay = 5 +# The predicted position of the player N seconds in the future will be used for preloading cells and distant terrain +prediction time = 1 + # How long to keep models/textures/collision shapes in cache after they're no longer referenced/required (in seconds) cache expiry delay = 5 From 7f634514a833ce346a4b2077593fd15e482779b7 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 19 Jul 2017 17:43:15 +0200 Subject: [PATCH 203/318] Fix the viewport of the character preview being set a frame ahead due to a threading issue --- apps/openmw/mwrender/characterpreview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index b0899f47e..877c35bba 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -254,7 +254,10 @@ namespace MWRender sizeX = std::max(sizeX, 0); sizeY = std::max(sizeY, 0); - mCamera->setViewport(0, mSizeY-sizeY, std::min(mSizeX, sizeX), std::min(mSizeY, sizeY)); + // NB Camera::setViewport has threading issues + osg::ref_ptr stateset = new osg::StateSet; + stateset->setAttributeAndModes(new osg::Viewport(0, mSizeY-sizeY, std::min(mSizeX, sizeX), std::min(mSizeY, sizeY))); + mCamera->setStateSet(stateset); redraw(); } From 5049fe4320ee09997fda6498801f4104b8e4167e Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Thu, 20 Jul 2017 21:31:05 +1200 Subject: [PATCH 204/318] Pause game when minimised on Windows --- components/sdlutil/sdlinputwrapper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index c88210b0a..ac172b84b 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -221,10 +221,12 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v case SDL_WINDOWEVENT_CLOSE: break; case SDL_WINDOWEVENT_SHOWN: + case SDL_WINDOWEVENT_RESTORED: if (mWindowListener) mWindowListener->windowVisibilityChange(true); break; case SDL_WINDOWEVENT_HIDDEN: + case SDL_WINDOWEVENT_MINIMIZED: if (mWindowListener) mWindowListener->windowVisibilityChange(false); break; From 0e2e23e9f823520531e9684950d30f057f51e1b8 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 20 Jul 2017 20:59:09 +0200 Subject: [PATCH 205/318] Remove tooltip object as part of WindowManager::clear --- apps/openmw/mwgui/windowmanagerimp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index bc77eb069..0ca378fe7 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1694,6 +1694,8 @@ namespace MWGui mCompanionWindow->resetReference(); mConsole->resetReference(); + mToolTips->setFocusObject(MWWorld::ConstPtr()); + mInventoryWindow->clear(); mSelectedSpell.clear(); From c9f8a220dc39357af4d5117158ae8910f278a81a Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 20 Jul 2017 20:59:36 +0200 Subject: [PATCH 206/318] Update the tooltip when the focusObject is set --- apps/openmw/mwgui/tooltips.cpp | 8 ++++++++ apps/openmw/mwgui/tooltips.hpp | 3 +++ apps/openmw/mwworld/worldimp.cpp | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index fad78d9a6..1e770a60b 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -40,6 +40,7 @@ namespace MWGui , mEnabled(true) , mFullHelp(false) , mShowOwned(0) + , mFrameDuration(0.f) { getWidget(mDynamicToolTipBox, "DynamicToolTipBox"); @@ -67,6 +68,11 @@ namespace MWGui } void ToolTips::onFrame(float frameDuration) + { + mFrameDuration = frameDuration; + } + + void ToolTips::update(float frameDuration) { while (mDynamicToolTipBox->getChildCount()) @@ -320,6 +326,8 @@ namespace MWGui void ToolTips::setFocusObject(const MWWorld::ConstPtr& focus) { mFocusObject = focus; + + update(mFrameDuration); } MyGUI::IntSize ToolTips::getToolTipViaPtr (int count, bool image) diff --git a/apps/openmw/mwgui/tooltips.hpp b/apps/openmw/mwgui/tooltips.hpp index 2db5fce34..bb2affc63 100644 --- a/apps/openmw/mwgui/tooltips.hpp +++ b/apps/openmw/mwgui/tooltips.hpp @@ -50,6 +50,7 @@ namespace MWGui ToolTips(); void onFrame(float frameDuration); + void update(float frameDuration); void setEnabled(bool enabled); @@ -126,6 +127,8 @@ namespace MWGui bool mFullHelp; int mShowOwned; + + float mFrameDuration; }; } #endif diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index c6d37b34c..08b0e7182 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1756,8 +1756,6 @@ namespace MWWorld // inform the GUI about focused object MWWorld::Ptr object = getFacedObject (); - MWBase::Environment::get().getWindowManager()->setFocusObject(object); - // retrieve object dimensions so we know where to place the floating label if (!object.isEmpty ()) { @@ -1766,6 +1764,8 @@ namespace MWWorld MWBase::Environment::get().getWindowManager()->setFocusObjectScreenCoords( screenBounds.x(), screenBounds.y(), screenBounds.z(), screenBounds.w()); } + + MWBase::Environment::get().getWindowManager()->setFocusObject(object); } MWWorld::Ptr World::getFacedObject(float maxDistance, bool ignorePlayer) From 5c11266a4621e5a6368d40380d985e0686a50a33 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 22 Jul 2017 00:06:43 +0200 Subject: [PATCH 207/318] Fix character preview item selection --- apps/openmw/mwrender/characterpreview.cpp | 9 ++++++--- apps/openmw/mwrender/characterpreview.hpp | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index 877c35bba..217a0d1fb 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -256,7 +256,8 @@ namespace MWRender // NB Camera::setViewport has threading issues osg::ref_ptr stateset = new osg::StateSet; - stateset->setAttributeAndModes(new osg::Viewport(0, mSizeY-sizeY, std::min(mSizeX, sizeX), std::min(mSizeY, sizeY))); + mViewport = new osg::Viewport(0, mSizeY-sizeY, std::min(mSizeX, sizeX), std::min(mSizeY, sizeY)); + stateset->setAttributeAndModes(mViewport); mCamera->setStateSet(stateset); redraw(); @@ -334,8 +335,10 @@ namespace MWRender int InventoryPreview::getSlotSelected (int posX, int posY) { - float projX = (posX / mCamera->getViewport()->width()) * 2 - 1.f; - float projY = (posY / mCamera->getViewport()->height()) * 2 - 1.f; + if (!mViewport) + return -1; + float projX = (posX / mViewport->width()) * 2 - 1.f; + float projY = (posY / mViewport->height()) * 2 - 1.f; // With Intersector::WINDOW, the intersection ratios are slightly inaccurate. Seems to be a // precision issue - compiling with OSG_USE_FLOAT_MATRIX=0, Intersector::WINDOW works ok. // Using Intersector::PROJECTION results in better precision because the start/end points and the model matrices diff --git a/apps/openmw/mwrender/characterpreview.hpp b/apps/openmw/mwrender/characterpreview.hpp index f0d5ad0c9..b71bffb62 100644 --- a/apps/openmw/mwrender/characterpreview.hpp +++ b/apps/openmw/mwrender/characterpreview.hpp @@ -17,6 +17,7 @@ namespace osg class Texture2D; class Camera; class Group; + class Viewport; } namespace MWRender @@ -83,6 +84,8 @@ namespace MWRender int getSlotSelected(int posX, int posY); protected: + osg::ref_ptr mViewport; + virtual void onSetup(); }; From 9bc24ab629992959323340bb325024ae68a7635a Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 22 Jul 2017 00:34:36 +0200 Subject: [PATCH 208/318] Fix character preview zNear/zFar not being autocomputed as intended (Bug #3955) --- apps/openmw/mwrender/characterpreview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index 217a0d1fb..f7219959a 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -133,6 +133,7 @@ namespace MWRender mCamera->setRenderOrder(osg::Camera::PRE_RENDER); mCamera->attach(osg::Camera::COLOR_BUFFER, mTexture); mCamera->setName("CharacterPreview"); + mCamera->setComputeNearFarMode(osg::Camera::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES); mCamera->setNodeMask(Mask_RenderToTexture); From 0eb54fa96a5281a770f0f96cf6b6f99871ae4936 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sat, 22 Jul 2017 17:58:04 +1200 Subject: [PATCH 209/318] Remove TOOLSET and XP_TOOLSET --- CI/before_script.msvc.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 35cb2f818..14998a3c6 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -215,9 +215,7 @@ fi case $VS_VERSION in 15|15.0|2017 ) GENERATOR="Visual Studio 15 2017" - XP_TOOLSET="v140xp" - TOOLSET="v140" - BOOST_TOOLSET="vc140" + TOOLSET="vc140" MSVC_VER="14" MSVC_YEAR="2015" MSVC_DISPLAY_YEAR="2017" @@ -225,9 +223,7 @@ case $VS_VERSION in 14|14.0|2015 ) GENERATOR="Visual Studio 14 2015" - XP_TOOLSET="v140_xp" - TOOLSET="v140" - BOOST_TOOLSET="vc140" + TOOLSET="vc140" MSVC_VER="14" MSVC_YEAR="2015" MSVC_DISPLAY_YEAR="2015" @@ -235,9 +231,7 @@ case $VS_VERSION in 12|12.0|2013 ) GENERATOR="Visual Studio 12 2013" - XP_TOOLSET="v120_xp" - TOOLSET="v120" - BOOST_TOOLSET="vc120" + TOOLSET="vc120" MSVC_VER="12" MSVC_YEAR="2013" MSVC_DISPLAY_YEAR="2013" @@ -409,7 +403,7 @@ fi add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" - add_cmake_opts -DBoost_COMPILER="-${BOOST_TOOLSET}" + add_cmake_opts -DBoost_COMPILER="-${TOOLSET}" echo Done. else @@ -421,7 +415,7 @@ fi fi add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" - add_cmake_opts -DBoost_COMPILER="-${BOOST_TOOLSET}" + add_cmake_opts -DBoost_COMPILER="-${TOOLSET}" echo Done. fi From 411b78562e809a552cfb30e281d2c465114e33b7 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 22 Jul 2017 21:25:59 +0200 Subject: [PATCH 210/318] [macOS, CI] Use most recent dependencies Includes a fix for https://bugs.openmw.org/issues/3904. --- CI/before_install.osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/before_install.osx.sh b/CI/before_install.osx.sh index ee2cc9cc9..25e1c9517 100755 --- a/CI/before_install.osx.sh +++ b/CI/before_install.osx.sh @@ -6,5 +6,5 @@ brew outdated cmake || brew upgrade cmake brew outdated pkgconfig || brew upgrade pkgconfig brew install $macos_qt_formula -curl https://downloads.openmw.org/osx/dependencies/openmw-deps-eaf8112.zip -o ~/openmw-deps.zip +curl https://downloads.openmw.org/osx/dependencies/openmw-deps-5e144e2.zip -o ~/openmw-deps.zip unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null From 337f0f876d5b7a8375e8061c0ea6ed5c9a514b79 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 23 Jul 2017 11:04:58 +0400 Subject: [PATCH 211/318] Fade screen in on a new game start --- apps/openmw/mwstate/statemanagerimp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 68b0e4ecb..14ee5adee 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -146,6 +146,9 @@ void MWState::StateManager::newGame (bool bypass) MWBase::Environment::get().getWorld()->startNewGame (bypass); mState = State_Running; + + MWBase::Environment::get().getWindowManager()->fadeScreenOut(0); + MWBase::Environment::get().getWindowManager()->fadeScreenIn(1); } catch (std::exception& e) { From 16be1e1a846c0c1acf062c4130130fe1484acd27 Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Sun, 23 Jul 2017 20:24:18 +1200 Subject: [PATCH 212/318] Fix occurrence highlighting preferences panel --- apps/opencs/model/prefs/state.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index 618a4bfc9..c87e283a8 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -153,11 +153,11 @@ void CSMPrefs::State::declare() declareInt ("error-height", "Initial height of the error panel", 100). setRange (100, 10000); declareBool ("highlight-occurrences", "Highlight other occurrences of selected names", true); + declareColour ("colour-highlight", "Colour of highlighted occurrences", QColor("lightcyan")); declareSeparator(); declareColour ("colour-int", "Highlight Colour: Integer Literals", QColor ("darkmagenta")); declareColour ("colour-float", "Highlight Colour: Float Literals", QColor ("magenta")); declareColour ("colour-name", "Highlight Colour: Names", QColor ("grey")); - declareColour ("colour-highlight", "Highlight Colour: Highlighting", QColor("palegreen")); declareColour ("colour-keyword", "Highlight Colour: Keywords", QColor ("red")); declareColour ("colour-special", "Highlight Colour: Special Characters", QColor ("darkorange")); declareColour ("colour-comment", "Highlight Colour: Comments", QColor ("green")); From 9924e4a35b170c85384547e1d999a793277524dc Mon Sep 17 00:00:00 2001 From: PlutonicOverkill Date: Mon, 24 Jul 2017 17:49:39 +1200 Subject: [PATCH 213/318] Stop VS2017 spamming warnings Disable warning caused by the string and stream-related standard headers. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ea3dde08..56b42ed5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -626,6 +626,7 @@ if (WIN32) 4510 4512 # Unable to generate copy constructor/assignment operator as it's not public in the base 4706 # Assignment in conditional expression 4738 # Storing 32-bit float result in memory, possible loss of performance + 4774 # Format string expected in argument is not a string literal 4986 # Undocumented warning that occurs in the crtdbg.h file 4987 # nonstandard extension used (triggered by setjmp.h) 4996 # Function was declared deprecated From 3ba0a336b7786646346f2bbf921f36366d399201 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 30 Jun 2017 16:27:18 +0400 Subject: [PATCH 214/318] Move spell magicka cost calculation to standalone function --- apps/openmw/mwgui/spellcreationdialog.cpp | 23 +++------- apps/openmw/mwmechanics/aicombataction.cpp | 14 ++---- apps/openmw/mwmechanics/autocalcspell.cpp | 33 +++++++++----- apps/openmw/mwmechanics/spellcasting.cpp | 50 +++++++++++++++++++--- apps/openmw/mwmechanics/spellcasting.hpp | 4 ++ 5 files changed, 83 insertions(+), 41 deletions(-) diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 64d4d86c6..0bb9184d2 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -440,22 +440,11 @@ namespace MWGui for (std::vector::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it) { - float x = 0.5f * (it->mMagnMin + it->mMagnMax); + const ESM::ENAMstruct& effect = *it; - const ESM::MagicEffect* effect = - store.get().find(it->mEffectID); + y += std::max(1.f, MWMechanics::calcEffectCost(effect)); - x *= 0.1f * effect->mData.mBaseCost; - x *= 1 + it->mDuration; - x += 0.05f * std::max(1, it->mArea) * effect->mData.mBaseCost; - - float fEffectCostMult = - store.get().find("fEffectCostMult")->getFloat(); - - y += x * fEffectCostMult; - y = std::max(1.f,y); - - if (it->mRange == ESM::RT_Target) + if (effect.mRange == ESM::RT_Target) y *= 1.5; } @@ -475,8 +464,10 @@ namespace MWGui mPriceLabel->setCaption(MyGUI::utility::toString(int(price))); - float chance = MWMechanics::getSpellSuccessChance(&mSpell, MWMechanics::getPlayer()); - mSuccessChance->setCaption(MyGUI::utility::toString(int(chance))); + float chance = MWMechanics::calcSpellBaseSuccessChance(&mSpell, MWMechanics::getPlayer(), NULL); + + int intChance = std::min(100, int(chance)); + mSuccessChance->setCaption(MyGUI::utility::toString(intChance)); } // ------------------------------------------------------------------------------------------------ diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 3c20179a4..1408dce6b 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -593,16 +593,7 @@ namespace MWMechanics } } - rating *= ((effect.mMagnMin + effect.mMagnMax) * (effect.mDuration > 0 ? effect.mDuration : 1) + effect.mArea); - rating *= magicEffect->mData.mBaseCost; - - if (effect.mRange == ESM::RT_Target) - rating *= 1.5f; - - static const float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore().get().find( - "fEffectCostMult")->getFloat(); - - rating *= fEffectCostMult * 0.05; + rating *= calcEffectCost(effect); // Currently treating all "on target" or "on touch" effects to target the enemy actor. // Combat AI is egoistic, so doesn't consider applying positive effects to friendly actors. @@ -619,6 +610,9 @@ namespace MWMechanics for (std::vector::const_iterator it = list.mList.begin(); it != list.mList.end(); ++it) { rating += rateEffect(*it, actor, enemy); + + if (it->mRange == ESM::RT_Target) + rating *= 1.5f; } return rating; } diff --git a/apps/openmw/mwmechanics/autocalcspell.cpp b/apps/openmw/mwmechanics/autocalcspell.cpp index af814edb0..f655a68b4 100644 --- a/apps/openmw/mwmechanics/autocalcspell.cpp +++ b/apps/openmw/mwmechanics/autocalcspell.cpp @@ -1,4 +1,5 @@ #include "autocalcspell.hpp" +#include "spellcasting.hpp" #include #include @@ -255,27 +256,39 @@ namespace MWMechanics void calcWeakestSchool (const ESM::Spell* spell, const int* actorSkills, int& effectiveSchool, float& skillTerm) { + // Morrowind for some reason uses a formula slightly different from magicka cost calculation float minChance = std::numeric_limits::max(); const ESM::EffectList& effects = spell->mEffects; for (std::vector::const_iterator it = effects.mList.begin(); it != effects.mList.end(); ++it) { const ESM::ENAMstruct& effect = *it; - float x = static_cast(effect.mDuration); - const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); - if (!(magicEffect->mData.mFlags & ESM::MagicEffect::UncappedDamage)) - x = std::max(1.f, x); - x *= 0.1f * magicEffect->mData.mBaseCost; - x *= 0.5f * (effect.mMagnMin + effect.mMagnMax); - x += effect.mArea * 0.05f * magicEffect->mData.mBaseCost; - if (effect.mRange == ESM::RT_Target) - x *= 1.5f; + int minMagn = 1; + int maxMagn = 1; + if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)) + { + minMagn = effect.mMagnMin; + maxMagn = effect.mMagnMax; + } - static const float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore().get().find("fEffectCostMult")->getFloat(); + int duration = 0; + if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration)) + duration = effect.mDuration; + + static const float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore() + .get().find("fEffectCostMult")->getFloat(); + + float x = 0.5 * (std::max(1, minMagn) + std::max(1, maxMagn)); + x *= 0.1 * magicEffect->mData.mBaseCost; + x *= 1 + duration; + x += 0.05 * std::max(1, effect.mArea) * magicEffect->mData.mBaseCost; x *= fEffectCostMult; + if (effect.mRange == ESM::RT_Target) + x *= 1.5f; + float s = 2.f * actorSkills[mapSchoolToSkill(magicEffect->mData.mSchool)]; if (s - x < minChance) { diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 5cfaccb84..7fde66ebe 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -44,8 +44,36 @@ namespace MWMechanics return schoolSkillMap[school]; } - float getSpellSuccessChance (const ESM::Spell* spell, const MWWorld::Ptr& actor, int* effectiveSchool, bool cap) + float calcEffectCost(const ESM::ENAMstruct& effect) + { + const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); + + int minMagn = 1; + int maxMagn = 1; + if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)) + { + minMagn = effect.mMagnMin; + maxMagn = effect.mMagnMax; + } + + int duration = 0; + if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration)) + duration = effect.mDuration; + + static const float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore() + .get().find("fEffectCostMult")->getFloat(); + + float x = 0.5 * (std::max(1, minMagn) + std::max(1, maxMagn)); + x *= 0.1 * magicEffect->mData.mBaseCost; + x *= 1 + duration; + x += 0.05 * std::max(1, effect.mArea) * magicEffect->mData.mBaseCost; + + return x * fEffectCostMult; + } + + float calcSpellBaseSuccessChance (const ESM::Spell* spell, const MWWorld::Ptr& actor, int* effectiveSchool) { + // Morrowind for some reason uses a formula slightly different from magicka cost calculation float y = std::numeric_limits::max(); float lowestSkill = 0; @@ -54,8 +82,10 @@ namespace MWMechanics float x = static_cast(it->mDuration); const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find( it->mEffectID); + if (!(magicEffect->mData.mFlags & ESM::MagicEffect::UncappedDamage)) x = std::max(1.f, x); + x *= 0.1f * magicEffect->mData.mBaseCost; x *= 0.5f * (it->mMagnMin + it->mMagnMax); x *= it->mArea * 0.05f * magicEffect->mData.mBaseCost; @@ -75,6 +105,18 @@ namespace MWMechanics } } + CreatureStats& stats = actor.getClass().getCreatureStats(actor); + + int actorWillpower = stats.getAttribute(ESM::Attribute::Willpower).getModified(); + int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified(); + + float castChance = (lowestSkill - spell->mData.mCost + 0.2f * actorWillpower + 0.1f * actorLuck); + + return castChance; + } + + float getSpellSuccessChance (const ESM::Spell* spell, const MWWorld::Ptr& actor, int* effectiveSchool, bool cap) + { bool godmode = actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState(); CreatureStats& stats = actor.getClass().getCreatureStats(actor); @@ -98,10 +140,8 @@ namespace MWMechanics float castBonus = -stats.getMagicEffects().get(ESM::MagicEffect::Sound).getMagnitude(); - int actorWillpower = stats.getAttribute(ESM::Attribute::Willpower).getModified(); - int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified(); - - float castChance = (lowestSkill - spell->mData.mCost + castBonus + 0.2f * actorWillpower + 0.1f * actorLuck) * stats.getFatigueTerm(); + float castChance = calcSpellBaseSuccessChance(spell, actor, effectiveSchool) + castBonus; + castChance *= stats.getFatigueTerm(); if (!cap) return std::max(0.f, castChance); diff --git a/apps/openmw/mwmechanics/spellcasting.hpp b/apps/openmw/mwmechanics/spellcasting.hpp index 8e48681b6..9991c583d 100644 --- a/apps/openmw/mwmechanics/spellcasting.hpp +++ b/apps/openmw/mwmechanics/spellcasting.hpp @@ -1,6 +1,7 @@ #ifndef MWMECHANICS_SPELLSUCCESS_H #define MWMECHANICS_SPELLSUCCESS_H +#include #include #include "../mwworld/ptr.hpp" @@ -21,6 +22,8 @@ namespace MWMechanics ESM::Skill::SkillEnum spellSchoolToSkill(int school); + float calcEffectCost(const ESM::ENAMstruct& effect); + bool isSummoningEffect(int effectId); /** @@ -62,6 +65,7 @@ namespace MWMechanics bool checkEffectTarget (int effectId, const MWWorld::Ptr& target, const MWWorld::Ptr& caster, bool castByPlayer); int getEffectiveEnchantmentCastCost (float castCost, const MWWorld::Ptr& actor); + float calcSpellBaseSuccessChance (const ESM::Spell* spell, const MWWorld::Ptr& actor, int* effectiveSchool); /// Apply a magic effect that is applied in tick intervals until its remaining time ends or it is removed /// @return Was the effect a tickable effect with a magnitude? From 8ded95201dc07bc471358f304740819e60cd1f4e Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Mon, 24 Jul 2017 22:56:58 -0500 Subject: [PATCH 215/318] Move Morrowind Content Language label to section header --- files/ui/settingspage.ui | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/files/ui/settingspage.ui b/files/ui/settingspage.ui index 7f5e4a7de..bc2abdf2f 100644 --- a/files/ui/settingspage.ui +++ b/files/ui/settingspage.ui @@ -17,20 +17,10 @@ - General + Morrowind Content Language - - - <html><head/><body><p>The language of the original Morrowind installation files (used for the character encoding)</p></body></html> - - - Morrowind content language: - - - - @@ -40,6 +30,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + From 325ea1059438f2eb9f587f300032638953e511f7 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 25 Jul 2017 10:28:33 +0400 Subject: [PATCH 216/318] Fixed encumberance check (bug #3963) --- apps/openmw/mwmechanics/character.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 5981a79c9..c1eb2d056 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1673,9 +1673,10 @@ void CharacterController::update(float duration) static const float fFatigueSneakBase = gmst.find("fFatigueSneakBase")->getFloat(); static const float fFatigueSneakMult = gmst.find("fFatigueSneakMult")->getFloat(); - const float encumbrance = cls.getEncumbrance(mPtr) / cls.getCapacity(mPtr); - if (encumbrance < 1) + if (cls.getEncumbrance(mPtr) <= cls.getCapacity(mPtr)) { + const float encumbrance = cls.getEncumbrance(mPtr) / cls.getCapacity(mPtr); + if (sneak) fatigueLoss = fFatigueSneakBase + encumbrance * fFatigueSneakMult; else From 548814bfbc0e7aacbc8585f6b3e3d10751b96eb8 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 25 Jul 2017 09:51:55 +0400 Subject: [PATCH 217/318] Added AiBreathe package (feature #1374) --- apps/openmw/CMakeLists.txt | 2 +- apps/openmw/mwmechanics/actors.cpp | 11 ++++++ apps/openmw/mwmechanics/aibreathe.cpp | 54 ++++++++++++++++++++++++++ apps/openmw/mwmechanics/aibreathe.hpp | 28 +++++++++++++ apps/openmw/mwmechanics/aipackage.hpp | 5 ++- apps/openmw/mwmechanics/aisequence.cpp | 3 +- 6 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 apps/openmw/mwmechanics/aibreathe.cpp create mode 100644 apps/openmw/mwmechanics/aibreathe.hpp diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index a06678488..1aa311fd2 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -81,7 +81,7 @@ add_openmw_dir (mwclass add_openmw_dir (mwmechanics mechanicsmanagerimp stat creaturestats magiceffects movement actorutil - drawstate spells activespells npcstats aipackage aisequence aipursue alchemy aiwander aitravel aifollow aiavoiddoor + drawstate spells activespells npcstats aipackage aisequence aipursue alchemy aiwander aitravel aifollow aiavoiddoor aibreathe aiescort aiactivate aicombat repair enchanting pathfinding pathgrid security spellsuccess spellcasting disease pickpocket levelledlist combat steering obstacle autocalcspell difficultyscaling aicombataction actor summoning character actors objects aistate coordinateconverter trading aiface diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 431ad09b3..44a457cb6 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -25,6 +25,8 @@ #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/statemanager.hpp" +#include "../mwmechanics/aibreathe.hpp" + #include "spellcasting.hpp" #include "npcstats.hpp" #include "creaturestats.hpp" @@ -814,6 +816,15 @@ namespace MWMechanics if (stats.getTimeToStartDrowning() == -1.f) stats.setTimeToStartDrowning(fHoldBreathTime); + if (ptr.getClass().isNpc() && stats.getTimeToStartDrowning() < fHoldBreathTime / 2) + { + if(ptr != MWMechanics::getPlayer() ) { + MWMechanics::AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence(); + if(seq.getTypeId() != MWMechanics::AiPackage::TypeIdBreathe) //Only add it once + seq.stack(MWMechanics::AiBreathe(), ptr); + } + } + MWBase::World *world = MWBase::Environment::get().getWorld(); bool knockedOutUnderwater = (ctrl->isKnockedOut() && world->isUnderwater(ptr.getCell(), osg::Vec3f(ptr.getRefData().getPosition().asVec3()))); if((world->isSubmerged(ptr) || knockedOutUnderwater) diff --git a/apps/openmw/mwmechanics/aibreathe.cpp b/apps/openmw/mwmechanics/aibreathe.cpp new file mode 100644 index 000000000..4e0076824 --- /dev/null +++ b/apps/openmw/mwmechanics/aibreathe.cpp @@ -0,0 +1,54 @@ +#include "aibreathe.hpp" + +#include "../mwbase/world.hpp" +#include "../mwbase/environment.hpp" + +#include "../mwworld/class.hpp" +#include "../mwworld/esmstore.hpp" + +#include "npcstats.hpp" + +#include "movement.hpp" +#include "steering.hpp" + +MWMechanics::AiBreathe::AiBreathe() +: AiPackage() +{ + +} + +bool MWMechanics::AiBreathe::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) +{ + static const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get().find("fHoldBreathTime")->getFloat(); + + const MWWorld::Class& actorClass = actor.getClass(); + if (actorClass.isNpc()) + { + if (actorClass.getNpcStats(actor).getTimeToStartDrowning() < fHoldBreathTime / 2) + { + actor.getClass().getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, true); + + actor.getClass().getMovementSettings(actor).mPosition[1] = 1; + smoothTurn(actor, -180, 0); + + return false; + } + } + + return true; +} + +MWMechanics::AiBreathe *MWMechanics::AiBreathe::clone() const +{ + return new AiBreathe(*this); +} + +int MWMechanics::AiBreathe::getTypeId() const +{ + return TypeIdBreathe; +} + +unsigned int MWMechanics::AiBreathe::getPriority() const +{ + return 2; +} diff --git a/apps/openmw/mwmechanics/aibreathe.hpp b/apps/openmw/mwmechanics/aibreathe.hpp new file mode 100644 index 000000000..263ab8c2b --- /dev/null +++ b/apps/openmw/mwmechanics/aibreathe.hpp @@ -0,0 +1,28 @@ +#ifndef GAME_MWMECHANICS_AIBREATHE_H +#define GAME_MWMECHANICS_AIBREATHE_H + +#include "aipackage.hpp" + +namespace MWMechanics +{ + /// \brief AiPackage to have an actor resurface to breathe + // The AI will go up if lesser than half breath left + class AiBreathe : public AiPackage + { + public: + AiBreathe(); + + virtual AiBreathe *clone() const; + + virtual bool execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration); + + virtual int getTypeId() const; + + virtual unsigned int getPriority() const; + + virtual bool canCancel() const { return false; } + virtual bool shouldCancelPreviousAi() const { return false; } + }; +} +#endif + diff --git a/apps/openmw/mwmechanics/aipackage.hpp b/apps/openmw/mwmechanics/aipackage.hpp index 5e23e085e..acbd87908 100644 --- a/apps/openmw/mwmechanics/aipackage.hpp +++ b/apps/openmw/mwmechanics/aipackage.hpp @@ -41,12 +41,13 @@ namespace MWMechanics TypeIdFollow = 3, TypeIdActivate = 4, - // These 4 are not really handled as Ai Packages in the MW engine + // These 5 are not really handled as Ai Packages in the MW engine // For compatibility do *not* return these in the getCurrentAiPackage script function.. TypeIdCombat = 5, TypeIdPursue = 6, TypeIdAvoidDoor = 7, - TypeIdFace = 8 + TypeIdFace = 8, + TypeIdBreathe = 9 }; ///Default constructor diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 2f33d6e4e..d9652ef54 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -182,7 +182,8 @@ bool isActualAiPackage(int packageTypeId) return (packageTypeId != AiPackage::TypeIdCombat && packageTypeId != AiPackage::TypeIdPursue && packageTypeId != AiPackage::TypeIdAvoidDoor - && packageTypeId != AiPackage::TypeIdFace); + && packageTypeId != AiPackage::TypeIdFace + && packageTypeId != AiPackage::TypeIdBreathe); } void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration) From 0082f5a2dc27f063de104031706dafb9dcce8ab4 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Mon, 24 Jul 2017 08:33:14 -0400 Subject: [PATCH 218/318] Editor: fix handling of colour columns Colours are stored as ints in the backend but the conversion from QColor to int was broken. --- apps/opencs/view/world/util.cpp | 52 ++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp index e44606652..22d295761 100644 --- a/apps/opencs/view/world/util.cpp +++ b/apps/opencs/view/world/util.cpp @@ -127,22 +127,24 @@ void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemM if (!mCommandDispatcher) return; - QVariant new_; - // Color columns use a custom editor, so we need explicitly extract a data from it + QVariant variant; + + // Color columns use a custom editor, so we need to fetch selected color from it. CSVWidget::ColorEditor *colorEditor = qobject_cast(editor); if (colorEditor != NULL) { - new_ = colorEditor->color(); + QColor color = colorEditor->color(); + variant = (color.blue() << 16) | (color.green() << 8) | (color.red()); } else { NastyTableModelHack hack (*model); QStyledItemDelegate::setModelData (editor, &hack, index); - new_ = hack.getData(); + variant = hack.getData(); } - if ((model->data (index)!=new_) && (model->flags(index) & Qt::ItemIsEditable)) - mCommandDispatcher->executeModify (model, index, new_); + if ((model->data (index)!=variant) && (model->flags(index) & Qt::ItemIsEditable)) + mCommandDispatcher->executeModify (model, index, variant); } CSVWorld::CommandDelegate::CommandDelegate (CSMWorld::CommandDispatcher *commandDispatcher, @@ -179,7 +181,9 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO // (the third parameter of ColorEditor's constructor) else if (display == CSMWorld::ColumnBase::Display_Colour) { - return new CSVWidget::ColorEditor(index.data().value(), parent, true); + int colorInt = index.data().toInt(); + QColor color = QColor(colorInt & 0xff, (colorInt >> 8) & 0xff, (colorInt >> 16) & 0xff); + return new CSVWidget::ColorEditor(color, parent, true); } return createEditor (parent, option, index, display); } @@ -202,9 +206,11 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO switch (display) { case CSMWorld::ColumnBase::Display_Colour: - - return new CSVWidget::ColorEditor(index.data().value(), parent); - + { + int colorInt = variant.toInt(); + QColor color = QColor(colorInt & 0xff, (colorInt >> 8) & 0xff, (colorInt >> 16) & 0xff); + return new CSVWidget::ColorEditor(color, parent); + } case CSMWorld::ColumnBase::Display_Integer: { DialogueSpinBox *sb = new DialogueSpinBox(parent); @@ -291,13 +297,13 @@ void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelInde void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const { - QVariant v = index.data(Qt::EditRole); + QVariant variant = index.data(Qt::EditRole); if (tryDisplay) { - if (!v.isValid()) + if (!variant.isValid()) { - v = index.data(Qt::DisplayRole); - if (!v.isValid()) + variant = index.data(Qt::DisplayRole); + if (!variant.isValid()) { return; } @@ -305,7 +311,7 @@ void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelInde QPlainTextEdit* plainTextEdit = qobject_cast(editor); if(plainTextEdit) //for some reason it is easier to brake the loop here { - if(plainTextEdit->toPlainText() == v.toString()) + if (plainTextEdit->toPlainText() == variant.toString()) { return; } @@ -316,23 +322,27 @@ void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelInde CSVWidget::ColorEditor *colorEditor = qobject_cast(editor); if (colorEditor != NULL) { - colorEditor->setColor(index.data().value()); + int colorInt = variant.toInt(); + QColor color = QColor(colorInt & 0xff, (colorInt >> 8) & 0xff, (colorInt >> 16) & 0xff); + colorEditor->setColor(color); return; } QByteArray n = editor->metaObject()->userProperty().name(); - if (n == "dateTime") { + if (n == "dateTime") + { if (editor->inherits("QTimeEdit")) n = "time"; else if (editor->inherits("QDateEdit")) n = "date"; } - if (!n.isEmpty()) { - if (!v.isValid()) - v = QVariant(editor->property(n).userType(), (const void *)0); - editor->setProperty(n, v); + if (!n.isEmpty()) + { + if (!variant.isValid()) + variant = QVariant(editor->property(n).userType(), (const void *)0); + editor->setProperty(n, variant); } } From 3fb7c42845c4c0d68b4cdf6a69756c364c9f6622 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Mon, 24 Jul 2017 08:38:45 -0400 Subject: [PATCH 219/318] Editor: Use colour field for cell map colour --- apps/opencs/model/world/data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 8b7faf2ed..ee9e4329c 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -327,7 +327,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc mCells.getNestableColumn(index)->addColumn( new NestedChildColumn (Columns::ColumnId_WaterLevel, ColumnBase::Display_Float)); mCells.getNestableColumn(index)->addColumn( - new NestedChildColumn (Columns::ColumnId_MapColor, ColumnBase::Display_Integer)); + new NestedChildColumn (Columns::ColumnId_MapColor, ColumnBase::Display_Colour)); mEnchantments.addColumn (new StringIdColumn); mEnchantments.addColumn (new RecordStateColumn); From 072fbcaee374e9b93c9faaa9cc37b7ea484268d0 Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Tue, 25 Jul 2017 22:12:29 -0500 Subject: [PATCH 220/318] UI adjustments to prevent parchment scroll from being cut off (fixes #3910) --- files/ui/mainwindow.ui | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/files/ui/mainwindow.ui b/files/ui/mainwindow.ui index a9e493926..45578ef9e 100644 --- a/files/ui/mainwindow.ui +++ b/files/ui/mainwindow.ui @@ -7,13 +7,13 @@ 0 0 635 - 575 + 565 635 - 535 + 565 @@ -57,6 +57,18 @@ + + 0 + + + 0 + + + 0 + + + 0 + From d7aa2a882d6e5bc84c01265fd64e35384583a668 Mon Sep 17 00:00:00 2001 From: Julian Date: Mon, 24 Jul 2017 13:25:01 +0200 Subject: [PATCH 221/318] improve dialogue window performance --- apps/openmw/mwbase/windowmanager.hpp | 4 ++ apps/openmw/mwgui/bookpage.cpp | 17 +++++---- apps/openmw/mwgui/bookpage.hpp | 8 +++- apps/openmw/mwgui/dialogue.cpp | 51 ++++++++++++-------------- apps/openmw/mwgui/dialogue.hpp | 2 + apps/openmw/mwgui/journalbooks.cpp | 28 +++++++------- apps/openmw/mwgui/textcolours.hpp | 35 ++++++++++++++++++ apps/openmw/mwgui/windowmanagerimp.cpp | 36 ++++++++++++++++++ apps/openmw/mwgui/windowmanagerimp.hpp | 5 +++ 9 files changed, 134 insertions(+), 52 deletions(-) create mode 100644 apps/openmw/mwgui/textcolours.hpp diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index dd0e3321c..416a7ad87 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -72,6 +72,8 @@ namespace MWGui ShowInDialogueMode_Only, ShowInDialogueMode_Never }; + + struct TextColours; } namespace SFO @@ -361,6 +363,8 @@ namespace MWBase virtual void removeCell(MWWorld::CellStore* cell) = 0; virtual void writeFog(MWWorld::CellStore* cell) = 0; + + virtual const MWGui::TextColours& getTextColours() = 0; }; } diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 5def91eb8..20d3448b5 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -35,22 +35,22 @@ struct TypesetBookImpl : TypesetBook MyGUI::Colour mNormalColour; InteractiveId mInteractiveId; - bool match (MyGUI::IFont* tstFont, MyGUI::Colour tstHotColour, MyGUI::Colour tstActiveColour, - MyGUI::Colour tstNormalColour, intptr_t tstInteractiveId) + bool match (MyGUI::IFont* tstFont, const MyGUI::Colour& tstHotColour, const MyGUI::Colour& tstActiveColour, + const MyGUI::Colour& tstNormalColour, intptr_t tstInteractiveId) { return (mFont == tstFont) && partal_match (tstHotColour, tstActiveColour, tstNormalColour, tstInteractiveId); } - bool match (char const * tstFont, MyGUI::Colour tstHotColour, MyGUI::Colour tstActiveColour, - MyGUI::Colour tstNormalColour, intptr_t tstInteractiveId) + bool match (char const * tstFont, const MyGUI::Colour& tstHotColour, const MyGUI::Colour& tstActiveColour, + const MyGUI::Colour& tstNormalColour, intptr_t tstInteractiveId) { return (mFont->getResourceName () == tstFont) && partal_match (tstHotColour, tstActiveColour, tstNormalColour, tstInteractiveId); } - bool partal_match (MyGUI::Colour tstHotColour, MyGUI::Colour tstActiveColour, - MyGUI::Colour tstNormalColour, intptr_t tstInteractiveId) + bool partal_match (const MyGUI::Colour& tstHotColour, const MyGUI::Colour& tstActiveColour, + const MyGUI::Colour& tstNormalColour, intptr_t tstInteractiveId) { return (mHotColour == tstHotColour ) && @@ -261,7 +261,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter { } - Style * createStyle (char const * fontName, Colour fontColour) + Style * createStyle (char const * fontName, const Colour& fontColour) { if (strcmp(fontName, "") == 0) return createStyle(MyGUI::FontManager::getInstance().getDefaultFont().c_str(), fontColour); @@ -284,7 +284,8 @@ struct TypesetBookImpl::Typesetter : BookTypesetter return &style; } - Style* createHotStyle (Style* baseStyle, Colour normalColour, Colour hoverColour, Colour activeColour, InteractiveId id, bool unique) + Style* createHotStyle (Style* baseStyle, const Colour& normalColour, const Colour& hoverColour, + const Colour& activeColour, InteractiveId id, bool unique) { StyleImpl* BaseStyle = static_cast (baseStyle); diff --git a/apps/openmw/mwgui/bookpage.hpp b/apps/openmw/mwgui/bookpage.hpp index e75e1e1d3..66d1834c7 100644 --- a/apps/openmw/mwgui/bookpage.hpp +++ b/apps/openmw/mwgui/bookpage.hpp @@ -37,6 +37,9 @@ namespace MWGui typedef uint8_t const * Utf8Point; typedef std::pair Utf8Span; + + + enum Alignment { AlignLeft = -1, AlignCenter = 0, @@ -53,12 +56,13 @@ namespace MWGui static Ptr create (int pageWidth, int pageHeight); /// Create a simple text style consisting of a font and a text color. - virtual Style* createStyle (char const * Font, Colour Colour) = 0; + virtual Style* createStyle (char const * Font, const Colour& Colour) = 0; /// Create a hyper-link style with a user-defined identifier based on an /// existing style. The unique flag forces a new instance of this style /// to be created even if an existing instance is present. - virtual Style* createHotStyle (Style * BaseStyle, Colour NormalColour, Colour HoverColour, Colour ActiveColour, InteractiveId Id, bool Unique = true) = 0; + virtual Style* createHotStyle (Style * BaseStyle, const Colour& NormalColour, const Colour& HoverColour, + const Colour& ActiveColour, InteractiveId Id, bool Unique = true) = 0; /// Insert a line break into the document. Newline characters in the input /// text have the same affect. The margin parameter adds additional space diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 9e20ae71f..f478dad7e 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -22,19 +22,10 @@ #include "widgets.hpp" #include "bookpage.hpp" +#include "textcolours.hpp" #include "journalbooks.hpp" // to_utf8_span -namespace -{ - - MyGUI::Colour getDialogueTextColour (const std::string& type) - { - return MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=" + type + "}")); - } - -} - namespace MWGui { @@ -116,7 +107,8 @@ namespace MWGui if (mTitle != "") { - BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("header")); + const MyGUI::Colour& headerColour = MWBase::Environment::get().getWindowManager()->getTextColours().header; + BookTypesetter::Style* title = typesetter->createStyle("", headerColour); typesetter->write(title, to_utf8_span(mTitle.c_str())); typesetter->sectionBreak(); } @@ -159,15 +151,16 @@ namespace MWGui if (hyperLinks.size() && MWBase::Environment::get().getWindowManager()->getTranslationDataStorage().hasTranslation()) { - BookTypesetter::Style* style = typesetter->createStyle("", getDialogueTextColour("normal")); + const TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours(); + + BookTypesetter::Style* style = typesetter->createStyle("", textColours.normal); size_t formatted = 0; // points to the first character that is not laid out yet for (std::map::iterator it = hyperLinks.begin(); it != hyperLinks.end(); ++it) { intptr_t topicId = it->second; - const MyGUI::Colour linkHot(getDialogueTextColour("link_over")); - const MyGUI::Colour linkNormal(getDialogueTextColour("link")); - const MyGUI::Colour linkActive(getDialogueTextColour("link_pressed")); - BookTypesetter::Style* hotStyle = typesetter->createHotStyle (style, linkNormal, linkHot, linkActive, topicId); + BookTypesetter::Style* hotStyle = typesetter->createHotStyle (style, textColours.link, + textColours.linkOver, textColours.linkPressed, + topicId); if (formatted < it->first.first) typesetter->write(style, formatted, it->first.first); typesetter->write(hotStyle, it->first.first, it->first.second); @@ -199,14 +192,13 @@ namespace MWGui void Response::addTopicLink(BookTypesetter::Ptr typesetter, intptr_t topicId, size_t begin, size_t end) const { - BookTypesetter::Style* style = typesetter->createStyle("", getDialogueTextColour("normal")); + const TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours(); + + BookTypesetter::Style* style = typesetter->createStyle("", textColours.normal); - const MyGUI::Colour linkHot(getDialogueTextColour("link_over")); - const MyGUI::Colour linkNormal(getDialogueTextColour("link")); - const MyGUI::Colour linkActive(getDialogueTextColour("link_pressed")); if (topicId) - style = typesetter->createHotStyle (style, linkNormal, linkHot, linkActive, topicId); + style = typesetter->createHotStyle (style, textColours.link, textColours.linkOver, textColours.linkPressed, topicId); typesetter->write (style, begin, end); } @@ -217,7 +209,8 @@ namespace MWGui void Message::write(BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map& topicLinks) const { - BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("notify")); + const MyGUI::Colour& textColour = MWBase::Environment::get().getWindowManager()->getTextColours().notify; + BookTypesetter::Style* title = typesetter->createStyle("", textColour); typesetter->sectionBreak(9); typesetter->write(title, to_utf8_span(mText.c_str())); } @@ -300,8 +293,12 @@ namespace MWGui void DialogueWindow::onWindowResize(MyGUI::Window* _sender) { + // if the window has only been moved, not resized, we don't need to update + if (mCurrentWindowSize == _sender->getSize()) return; + mTopicsList->adjustSize(); updateHistory(); + mCurrentWindowSize = _sender->getSize(); } void DialogueWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel) @@ -486,16 +483,15 @@ namespace MWGui typesetter->sectionBreak(9); // choices - const MyGUI::Colour linkHot(getDialogueTextColour("answer_over")); - const MyGUI::Colour linkNormal(getDialogueTextColour("answer")); - const MyGUI::Colour linkActive(getDialogueTextColour("answer_pressed")); + const TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours(); for (std::vector >::iterator it = mChoices.begin(); it != mChoices.end(); ++it) { Choice* link = new Choice(it->second); mLinks.push_back(link); typesetter->lineBreak(); - BookTypesetter::Style* questionStyle = typesetter->createHotStyle(body, linkNormal, linkHot, linkActive, + BookTypesetter::Style* questionStyle = typesetter->createHotStyle(body, textColours.answer, textColours.answerOver, + textColours.answerPressed, TypesetBook::InteractiveId(link)); typesetter->write(questionStyle, to_utf8_span(it->first.c_str())); } @@ -505,7 +501,8 @@ namespace MWGui Goodbye* link = new Goodbye(); mLinks.push_back(link); std::string goodbye = MWBase::Environment::get().getWorld()->getStore().get().find("sGoodbye")->getString(); - BookTypesetter::Style* questionStyle = typesetter->createHotStyle(body, linkNormal, linkHot, linkActive, + BookTypesetter::Style* questionStyle = typesetter->createHotStyle(body, textColours.answer, textColours.answerOver, + textColours.answerPressed, TypesetBook::InteractiveId(link)); typesetter->lineBreak(); typesetter->write(questionStyle, to_utf8_span(goodbye.c_str())); diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index e1e427b3f..5b5ae5b68 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -171,6 +171,8 @@ namespace MWGui MyGUI::TextBox* mDispositionText; PersuasionDialog mPersuasionDialog; + + MyGUI::IntSize mCurrentWindowSize; }; } #endif diff --git a/apps/openmw/mwgui/journalbooks.cpp b/apps/openmw/mwgui/journalbooks.cpp index f84fb517b..5634eb080 100644 --- a/apps/openmw/mwgui/journalbooks.cpp +++ b/apps/openmw/mwgui/journalbooks.cpp @@ -2,13 +2,14 @@ #include +#include "../mwbase/environment.hpp" +#include "../mwbase/windowmanager.hpp" + +#include "textcolours.hpp" + + namespace { - MyGUI::Colour getTextColour (const std::string& type) - { - return MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=" + type + "}")); - } - struct AddContent { MWGui::BookTypesetter::Ptr mTypesetter; @@ -31,12 +32,10 @@ namespace { MWGui::BookTypesetter::Style* style = mBodyStyle; - static const MyGUI::Colour linkHot (getTextColour("journal_link_over")); - static const MyGUI::Colour linkNormal (getTextColour("journal_link")); - static const MyGUI::Colour linkActive (getTextColour("journal_link_pressed")); - + const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours(); if (topicId) - style = mTypesetter->createHotStyle (mBodyStyle, linkNormal, linkHot, linkActive, topicId); + style = mTypesetter->createHotStyle (mBodyStyle, textColours.journalLink, textColours.journalLinkOver, + textColours.journalLinkPressed, topicId); mTypesetter->write (style, begin, end); } @@ -233,11 +232,10 @@ book JournalBooks::createTopicIndexBook () sprintf (buffer, "( %c )", ch); - MyGUI::Colour linkHot (getTextColour("journal_topic_over")); - MyGUI::Colour linkActive (getTextColour("journal_topic_pressed")); - MyGUI::Colour linkNormal (getTextColour("journal_topic")); - - BookTypesetter::Style* style = typesetter->createHotStyle (body, linkNormal, linkHot, linkActive, ch); + const MWGui::TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours(); + BookTypesetter::Style* style = typesetter->createHotStyle (body, textColours.journalTopic, + textColours.journalTopicOver, + textColours.journalTopicPressed, ch); if (i == 13) typesetter->sectionBreak (); diff --git a/apps/openmw/mwgui/textcolours.hpp b/apps/openmw/mwgui/textcolours.hpp new file mode 100644 index 000000000..3fa55654b --- /dev/null +++ b/apps/openmw/mwgui/textcolours.hpp @@ -0,0 +1,35 @@ +#ifndef MWGUI_TEXTCOLORS_H +#define MWGUI_TEXTCOLORS_H + +#include + +namespace MWGui +{ + + struct TextColours + { + MyGUI::Colour header; + MyGUI::Colour normal; + MyGUI::Colour notify; + + + MyGUI::Colour link; + MyGUI::Colour linkOver; + MyGUI::Colour linkPressed; + + MyGUI::Colour answer; + MyGUI::Colour answerOver; + MyGUI::Colour answerPressed; + + MyGUI::Colour journalLink; + MyGUI::Colour journalLinkOver; + MyGUI::Colour journalLinkPressed; + + MyGUI::Colour journalTopic; + MyGUI::Colour journalTopicOver; + MyGUI::Colour journalTopicPressed; + }; + +} + +#endif diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 0ca378fe7..516da3ab6 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -113,6 +113,16 @@ #include "jailscreen.hpp" #include "itemchargeview.hpp" +namespace +{ + + MyGUI::Colour getTextColour(const std::string& type) + { + return MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=" + type + "}")); + } + +} + namespace MWGui { @@ -283,6 +293,27 @@ namespace MWGui int w = MyGUI::RenderManager::getInstance().getViewSize().width; int h = MyGUI::RenderManager::getInstance().getViewSize().height; + mTextColours.header = getTextColour("header"); + mTextColours.normal = getTextColour("normal"); + mTextColours.notify = getTextColour("notify"); + + mTextColours.link = getTextColour("link"); + mTextColours.linkOver = getTextColour("link_over"); + mTextColours.linkPressed = getTextColour("link_pressed"); + + mTextColours.answer = getTextColour("answer"); + mTextColours.answerOver = getTextColour("answer_over"); + mTextColours.answerPressed = getTextColour("answer_pressed"); + + mTextColours.journalLink = getTextColour("journal_link"); + mTextColours.journalLinkOver = getTextColour("journal_link_over"); + mTextColours.journalLinkPressed = getTextColour("journal_link_pressed"); + + mTextColours.journalTopic = getTextColour("journal_topic"); + mTextColours.journalTopicOver = getTextColour("journal_topic_over"); + mTextColours.journalTopicPressed = getTextColour("journal_topic_pressed"); + + mDragAndDrop = new DragAndDrop(); mRecharge = new Recharge(); @@ -2138,4 +2169,9 @@ namespace MWGui mLocalMapRender->saveFogOfWar(cell); } + const MWGui::TextColours& WindowManager::getTextColours() + { + return mTextColours; + } + } diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 0d17b7f4f..f74ba21a3 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -19,6 +19,7 @@ #include #include "mapwindow.hpp" +#include "textcolours.hpp" #include #include @@ -391,6 +392,8 @@ namespace MWGui void removeCell(MWWorld::CellStore* cell); void writeFog(MWWorld::CellStore* cell); + virtual const MWGui::TextColours& getTextColours(); + private: const MWWorld::ESMStore* mStore; Resource::ResourceSystem* mResourceSystem; @@ -514,6 +517,8 @@ namespace MWGui std::string mVersionDescription; + MWGui::TextColours mTextColours; + /** * Called when MyGUI tries to retrieve a tag's value. Tags must be denoted in #{tag} notation and will be replaced upon setting a user visible text/property. * Supported syntax: From ec6dad99fc9fd2d8e6938968c9df88b15905822b Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Wed, 26 Jul 2017 22:07:23 +0000 Subject: [PATCH 222/318] Update AUTHORS.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index a75c475be..6125ed36d 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -74,6 +74,7 @@ Programmers Jordan Ayers Jordan Milne Jules Blok (Armada651) + julianko Julien Voisin (jvoisin/ap0) Karl-Felix Glatzer (k1ll) Kevin Poitra (PuppyKevin) From c7241c692f61bf37ee52e5a3b49ecfc11b241814 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Wed, 26 Jul 2017 19:43:37 -0400 Subject: [PATCH 223/318] Editor: Do int to color conversion in ColorEditor --- apps/opencs/view/widget/coloreditor.cpp | 23 +++++++++++++++++++++-- apps/opencs/view/widget/coloreditor.hpp | 10 +++++++++- apps/opencs/view/world/util.cpp | 12 +++--------- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/apps/opencs/view/widget/coloreditor.cpp b/apps/opencs/view/widget/coloreditor.cpp index 7ef1ec7b1..4cccf504d 100644 --- a/apps/opencs/view/widget/coloreditor.cpp +++ b/apps/opencs/view/widget/coloreditor.cpp @@ -10,9 +10,20 @@ #include "colorpickerpopup.hpp" -CSVWidget::ColorEditor::ColorEditor(const QColor &color, QWidget *parent, bool popupOnStart) +CSVWidget::ColorEditor::ColorEditor(const QColor &color, QWidget *parent, const bool popupOnStart) + : ColorEditor(parent, popupOnStart) +{ + setColor(color); +} + +CSVWidget::ColorEditor::ColorEditor(const int colorInt, QWidget *parent, const bool popupOnStart) + : ColorEditor(parent, popupOnStart) +{ + setColor(colorInt); +} + +CSVWidget::ColorEditor::ColorEditor(QWidget *parent, const bool popupOnStart) : QPushButton(parent), - mColor(color), mColorPicker(new ColorPickerPopup(this)), mPopupOnStart(popupOnStart) { @@ -59,6 +70,14 @@ void CSVWidget::ColorEditor::setColor(const QColor &color) update(); } +void CSVWidget::ColorEditor::setColor(const int colorInt) +{ + // Color RGB values are stored in given integer. + // First byte is red, second byte is green, third byte is blue. + QColor color = QColor(colorInt & 0xff, (colorInt >> 8) & 0xff, (colorInt >> 16) & 0xff); + setColor(color); +} + void CSVWidget::ColorEditor::showPicker() { if (isChecked()) diff --git a/apps/opencs/view/widget/coloreditor.hpp b/apps/opencs/view/widget/coloreditor.hpp index 61232cb13..850cf6b2f 100644 --- a/apps/opencs/view/widget/coloreditor.hpp +++ b/apps/opencs/view/widget/coloreditor.hpp @@ -22,15 +22,23 @@ namespace CSVWidget QPoint calculatePopupPosition(); public: - ColorEditor(const QColor &color, QWidget *parent = 0, bool popupOnStart = false); + ColorEditor(const QColor &color, QWidget *parent = 0, const bool popupOnStart = false); + ColorEditor(const int colorInt, QWidget *parent = 0, const bool popupOnStart = false); QColor color() const; void setColor(const QColor &color); + /// \brief Set color using given int value. + /// \param colorInt RGB color value encoded as an integer. + void setColor(const int colorInt); + protected: virtual void paintEvent(QPaintEvent *event); virtual void showEvent(QShowEvent *event); + private: + ColorEditor(QWidget *parent = 0, const bool popupOnStart = false); + private slots: void showPicker(); void pickerHid(); diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp index 22d295761..7c1436d26 100644 --- a/apps/opencs/view/world/util.cpp +++ b/apps/opencs/view/world/util.cpp @@ -181,9 +181,7 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO // (the third parameter of ColorEditor's constructor) else if (display == CSMWorld::ColumnBase::Display_Colour) { - int colorInt = index.data().toInt(); - QColor color = QColor(colorInt & 0xff, (colorInt >> 8) & 0xff, (colorInt >> 16) & 0xff); - return new CSVWidget::ColorEditor(color, parent, true); + return new CSVWidget::ColorEditor(index.data().toInt(), parent, true); } return createEditor (parent, option, index, display); } @@ -207,9 +205,7 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO { case CSMWorld::ColumnBase::Display_Colour: { - int colorInt = variant.toInt(); - QColor color = QColor(colorInt & 0xff, (colorInt >> 8) & 0xff, (colorInt >> 16) & 0xff); - return new CSVWidget::ColorEditor(color, parent); + return new CSVWidget::ColorEditor(variant.toInt(), parent); } case CSMWorld::ColumnBase::Display_Integer: { @@ -322,9 +318,7 @@ void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelInde CSVWidget::ColorEditor *colorEditor = qobject_cast(editor); if (colorEditor != NULL) { - int colorInt = variant.toInt(); - QColor color = QColor(colorInt & 0xff, (colorInt >> 8) & 0xff, (colorInt >> 16) & 0xff); - colorEditor->setColor(color); + colorEditor->setColor(variant.toInt()); return; } From 3f2cd9b66994137bce1901be575e4cfbdd5552b7 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Wed, 26 Jul 2017 19:56:54 -0400 Subject: [PATCH 224/318] Editor: Do color to int conversion in ColorEditor --- apps/opencs/view/widget/coloreditor.cpp | 5 +++++ apps/opencs/view/widget/coloreditor.hpp | 4 ++++ apps/opencs/view/world/util.cpp | 3 +-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/opencs/view/widget/coloreditor.cpp b/apps/opencs/view/widget/coloreditor.cpp index 4cccf504d..5f82f8e26 100644 --- a/apps/opencs/view/widget/coloreditor.cpp +++ b/apps/opencs/view/widget/coloreditor.cpp @@ -64,6 +64,11 @@ QColor CSVWidget::ColorEditor::color() const return mColor; } +int CSVWidget::ColorEditor::colorInt() const +{ + return (mColor.blue() << 16) | (mColor.green() << 8) | (mColor.red()); +} + void CSVWidget::ColorEditor::setColor(const QColor &color) { mColor = color; diff --git a/apps/opencs/view/widget/coloreditor.hpp b/apps/opencs/view/widget/coloreditor.hpp index 850cf6b2f..668f22cc9 100644 --- a/apps/opencs/view/widget/coloreditor.hpp +++ b/apps/opencs/view/widget/coloreditor.hpp @@ -26,6 +26,10 @@ namespace CSVWidget ColorEditor(const int colorInt, QWidget *parent = 0, const bool popupOnStart = false); QColor color() const; + + /// \return Color RGB value encoded in an int. + int colorInt() const; + void setColor(const QColor &color); /// \brief Set color using given int value. diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp index 7c1436d26..efba1ea82 100644 --- a/apps/opencs/view/world/util.cpp +++ b/apps/opencs/view/world/util.cpp @@ -133,8 +133,7 @@ void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemM CSVWidget::ColorEditor *colorEditor = qobject_cast(editor); if (colorEditor != NULL) { - QColor color = colorEditor->color(); - variant = (color.blue() << 16) | (color.green() << 8) | (color.red()); + variant = colorEditor->colorInt(); } else { From 6ab36c05399ebcefceb5bec1bffbcc56c8a71697 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 27 Jul 2017 13:20:18 +0400 Subject: [PATCH 225/318] Spellbuying menu improvements --- apps/openmw/mwgui/spellbuyingwindow.cpp | 38 ++++++++++++++++++------- apps/openmw/mwgui/spellbuyingwindow.hpp | 9 ++++-- apps/openmw/mwgui/windowmanagerimp.cpp | 2 +- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp index 806b17a90..6a7376aa0 100644 --- a/apps/openmw/mwgui/spellbuyingwindow.cpp +++ b/apps/openmw/mwgui/spellbuyingwindow.cpp @@ -22,7 +22,6 @@ namespace MWGui SpellBuyingWindow::SpellBuyingWindow() : WindowBase("openmw_spell_buying_window.layout") - , mLastPos(0) , mCurrentY(0) { getWidget(mCancelButton, "CancelButton"); @@ -37,13 +36,20 @@ namespace MWGui MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying); } - void SpellBuyingWindow::addSpell(const std::string& spellId) + bool SpellBuyingWindow::sortSpells (const ESM::Spell* left, const ESM::Spell* right) + { + std::string leftName = Misc::StringUtils::lowerCase(left->mName); + std::string rightName = Misc::StringUtils::lowerCase(right->mName); + + return leftName.compare(rightName) < 0; + } + + void SpellBuyingWindow::addSpell(const ESM::Spell& spell) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); - const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(spellId); - int price = static_cast(spell->mData.mCost*store.get().find("fSpellValueMult")->getFloat()); + int price = static_cast(spell.mData.mCost*store.get().find("fSpellValueMult")->getFloat()); price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true); MWWorld::Ptr player = MWMechanics::getPlayer(); @@ -64,13 +70,13 @@ namespace MWGui mCurrentY += sLineHeight; toAdd->setUserData(price); - toAdd->setCaptionWithReplacing(spell->mName+" - "+MyGUI::utility::toString(price)+"#{sgp}"); + toAdd->setCaptionWithReplacing(spell.mName+" - "+MyGUI::utility::toString(price)+"#{sgp}"); toAdd->setSize(mSpellsView->getWidth(),sLineHeight); toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel); toAdd->setUserString("ToolTipType", "Spell"); - toAdd->setUserString("Spell", spellId); + toAdd->setUserString("Spell", spell.mId); toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onSpellButtonClick); - mSpellsWidgetMap.insert(std::make_pair (toAdd, spellId)); + mSpellsWidgetMap.insert(std::make_pair (toAdd, spell.mId)); } void SpellBuyingWindow::clearSpells() @@ -82,7 +88,7 @@ namespace MWGui mSpellsWidgetMap.clear(); } - void SpellBuyingWindow::startSpellBuying(const MWWorld::Ptr& actor) + void SpellBuyingWindow::startSpellBuying(const MWWorld::Ptr& actor, int startOffset) { center(); mPtr = actor; @@ -90,6 +96,8 @@ namespace MWGui MWMechanics::Spells& merchantSpells = actor.getClass().getCreatureStats (actor).getSpells(); + std::vector spellsToSort; + for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter) { const ESM::Spell* spell = iter->first; @@ -109,15 +117,25 @@ namespace MWGui if (playerHasSpell(iter->first->mId)) continue; - addSpell (iter->first->mId); + spellsToSort.push_back(iter->first); } + std::stable_sort(spellsToSort.begin(), spellsToSort.end(), sortSpells); + + for (std::vector::iterator it = spellsToSort.begin() ; it != spellsToSort.end(); ++it) + { + addSpell(**it); + } + + spellsToSort.clear(); + updateLabels(); // Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden mSpellsView->setVisibleVScroll(false); mSpellsView->setCanvasSize (MyGUI::IntSize(mSpellsView->getWidth(), std::max(mSpellsView->getHeight(), mCurrentY))); mSpellsView->setVisibleVScroll(true); + mSpellsView->setViewOffset(MyGUI::IntPoint(0, startOffset)); } bool SpellBuyingWindow::playerHasSpell(const std::string &id) @@ -143,7 +161,7 @@ namespace MWGui MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr); npcStats.setGoldPool(npcStats.getGoldPool() + price); - startSpellBuying(mPtr); + startSpellBuying(mPtr, mSpellsView->getViewOffset().top); MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up"); } diff --git a/apps/openmw/mwgui/spellbuyingwindow.hpp b/apps/openmw/mwgui/spellbuyingwindow.hpp index 2a6dcfdcc..37210819f 100644 --- a/apps/openmw/mwgui/spellbuyingwindow.hpp +++ b/apps/openmw/mwgui/spellbuyingwindow.hpp @@ -4,6 +4,8 @@ #include "windowbase.hpp" #include "referenceinterface.hpp" +#include "../mwworld/esmstore.hpp" + namespace MyGUI { class Gui; @@ -23,7 +25,7 @@ namespace MWGui public: SpellBuyingWindow(); - void startSpellBuying(const MWWorld::Ptr& actor); + void startSpellBuying(const MWWorld::Ptr& actor, int startOffset); virtual void exit(); @@ -38,7 +40,7 @@ namespace MWGui void onCancelButtonClicked(MyGUI::Widget* _sender); void onSpellButtonClick(MyGUI::Widget* _sender); void onMouseWheel(MyGUI::Widget* _sender, int _rel); - void addSpell(const std::string& spellID); + void addSpell(const ESM::Spell& spell); void clearSpells(); int mLastPos,mCurrentY; @@ -49,6 +51,9 @@ namespace MWGui virtual void onReferenceUnavailable(); bool playerHasSpell (const std::string& id); + + private: + static bool sortSpells (const ESM::Spell* left, const ESM::Spell* right); }; } diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index bc77eb069..21dde4e0a 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -2001,7 +2001,7 @@ namespace MWGui void WindowManager::startSpellBuying(const MWWorld::Ptr &actor) { pushGuiMode(GM_SpellBuying); - mSpellBuyingWindow->startSpellBuying(actor); + mSpellBuyingWindow->startSpellBuying(actor, 0); } void WindowManager::startTrade(const MWWorld::Ptr &actor) From 622e7589095154475cb09a11f9227490209ff441 Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Thu, 27 Jul 2017 16:44:17 -0500 Subject: [PATCH 226/318] Fixing link to bug tracker Bug tracker link was pointing to 0.41 bugs, but the Readme was talking about pre-1.0 features. Pointing to the main page makes more sense. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d38dfaeb2..e866767f4 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Font Licenses: Current Status -------------- -The main quests in Morrowind, Tribunal and Bloodmoon are all completable. Some issues with side quests are to be expected (but rare). Check the [bug tracker](https://bugs.openmw.org/versions/21) for a list of issues we need to resolve before the "1.0" release. Even before the "1.0" release however, OpenMW boasts some new [features](https://wiki.openmw.org/index.php?title=Features), such as improved graphics and user interfaces. +The main quests in Morrowind, Tribunal and Bloodmoon are all completable. Some issues with side quests are to be expected (but rare). Check the [bug tracker](https://bugs.openmw.org/) for a list of issues we need to resolve before the "1.0" release. Even before the "1.0" release however, OpenMW boasts some new [features](https://wiki.openmw.org/index.php?title=Features), such as improved graphics and user interfaces. Pre-existing modifications created for the original Morrowind engine can be hit-and-miss. The OpenMW script compiler performs more thorough error-checking than Morrowind does, meaning that a mod created for Morrowind may not necessarily run in OpenMW. Some mods also rely on quirky behaviour or engine bugs in order to work. We are considering such compatibility issues on a case-by-case basis - in some cases adding a workaround to OpenMW may be feasible, in other cases fixing the mod will be the only option. If you know of any mods that work or don't work, feel free to add them to the [Mod status](https://wiki.openmw.org/index.php?title=Mod_status) wiki page. From f2fc8351bb2b1b3622939c390110f8e6847079aa Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Fri, 28 Jul 2017 10:42:30 +0200 Subject: [PATCH 227/318] remove breath/doxygen autodoc --- docs/requirements.txt | 1 - docs/source/conf.py | 40 +-- docs/source/index.rst | 2 - docs/source/source/index.rst | 8 - docs/source/source/opencs/index.rst | 11 - docs/source/source/opencs/model/index.rst | 358 ---------------------- docs/source/source/opencs/view/index.rst | 340 -------------------- docs/source/source/openmw/index.rst | 24 -- docs/source/source/openmw/mwbase.rst | 32 -- docs/source/source/openmw/mwclass.rst | 68 ---- docs/source/source/openmw/mwdialogue.rst | 32 -- docs/source/source/openmw/mwgui.rst | 227 -------------- docs/source/source/openmw/mwinput.rst | 5 - docs/source/source/openmw/mwmechanics.rst | 137 --------- docs/source/source/openmw/mwphysics.rst | 15 - docs/source/source/openmw/mwrender.rst | 77 ----- docs/source/source/openmw/mwscript.rst | 65 ---- docs/source/source/openmw/mwsound.rst | 29 -- docs/source/source/openmw/mwstate.rst | 11 - docs/source/source/openmw/mwworld.rst | 132 -------- 20 files changed, 1 insertion(+), 1613 deletions(-) delete mode 100644 docs/source/source/index.rst delete mode 100644 docs/source/source/opencs/index.rst delete mode 100644 docs/source/source/opencs/model/index.rst delete mode 100644 docs/source/source/opencs/view/index.rst delete mode 100644 docs/source/source/openmw/index.rst delete mode 100644 docs/source/source/openmw/mwbase.rst delete mode 100644 docs/source/source/openmw/mwclass.rst delete mode 100644 docs/source/source/openmw/mwdialogue.rst delete mode 100644 docs/source/source/openmw/mwgui.rst delete mode 100644 docs/source/source/openmw/mwinput.rst delete mode 100644 docs/source/source/openmw/mwmechanics.rst delete mode 100644 docs/source/source/openmw/mwphysics.rst delete mode 100644 docs/source/source/openmw/mwrender.rst delete mode 100644 docs/source/source/openmw/mwscript.rst delete mode 100644 docs/source/source/openmw/mwsound.rst delete mode 100644 docs/source/source/openmw/mwstate.rst delete mode 100644 docs/source/source/openmw/mwworld.rst diff --git a/docs/requirements.txt b/docs/requirements.txt index 6ee8d6987..72c2aaa12 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,2 @@ -breathe parse_cmake sphinx diff --git a/docs/source/conf.py b/docs/source/conf.py index 273b2f7d5..b18b40c50 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,6 @@ # # All configuration values have a default; values that are commented out # serve to show the default. -import glob import os import sys @@ -21,12 +20,6 @@ import sys project_root = os.path.abspath('../../') sys.path.insert(0, project_root) - -def insensitive_glob(pattern): - def either(c): - return '[%s%s]' % (c.lower(), c.upper()) if c.isalpha() else c - return glob.glob(''.join(map(either, pattern))) - # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -43,37 +36,6 @@ extensions = [ 'sphinx.ext.viewcode', ] -try: - import breathe - extensions.append('breathe') -except ImportError: - print("WARNING: Unable to import breathe, code documentation won't be generated.") - -# Where breathe can find the source files -openmw_path = os.path.join(project_root, "apps", "openmw") -openmw_sub_dirs = os.walk(openmw_path).next()[1] -openmw_headers = insensitive_glob(os.path.join(openmw_path, "*.hpp")) -for dir in openmw_sub_dirs: - openmw_headers += insensitive_glob(os.path.join(openmw_path, dir, "*.hpp")) -# massage the headers to get the relative path needed -openmw_headers = [os.path.relpath(x, openmw_path) for x in openmw_headers] - -opencs_path = os.path.join(project_root, "apps", "opencs") -opencs_sub_dirs = os.walk(opencs_path).next()[1] -opencs_headers = insensitive_glob(os.path.join(opencs_path, "*.hpp")) -opencs_sub_sub_dirs = [] -for dir in opencs_sub_dirs: - opencs_headers += insensitive_glob(os.path.join(opencs_path, dir, "*.hpp")) - opencs_sub_sub_dirs += os.walk(os.path.join(opencs_path, dir)).next()[1] - for sub_dir in opencs_sub_sub_dirs: - opencs_headers += insensitive_glob(os.path.join(opencs_path, dir, sub_dir, "*.hpp")) -opencs_headers = [os.path.relpath(x, opencs_path) for x in opencs_headers] - -breathe_projects_source = { - "openmw": (openmw_path, openmw_headers), - "opencs": (opencs_path, opencs_headers), -} - # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -88,7 +50,7 @@ master_doc = 'index' # General information about the project. project = u'OpenMW' -copyright = u'2016, OpenMW Team' +copyright = u'2017, OpenMW Team' # The version info for the project you're documenting, acts as replacement for diff --git a/docs/source/index.rst b/docs/source/index.rst index f51cda909..0308d88de 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -9,8 +9,6 @@ Sections manuals/index reference/index - source/index - Indices and Tables ================== diff --git a/docs/source/source/index.rst b/docs/source/source/index.rst deleted file mode 100644 index b58bf2b37..000000000 --- a/docs/source/source/index.rst +++ /dev/null @@ -1,8 +0,0 @@ -Project Source Documentation -============================ - -.. toctree:: - :maxdepth: 2 - - openmw/index - opencs/index \ No newline at end of file diff --git a/docs/source/source/opencs/index.rst b/docs/source/source/opencs/index.rst deleted file mode 100644 index b648bc49c..000000000 --- a/docs/source/source/opencs/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -OpenMW-CS Source Documentation -############################## - -.. toctree:: - :maxdepth: 2 - - model/index - view/index - -.. autodoxygenfile:: editor.hpp - :project: opencs \ No newline at end of file diff --git a/docs/source/source/opencs/model/index.rst b/docs/source/source/opencs/model/index.rst deleted file mode 100644 index 38ca0c31c..000000000 --- a/docs/source/source/opencs/model/index.rst +++ /dev/null @@ -1,358 +0,0 @@ -./opencs/model -############## - -doc ---- - .. autodoxygenfile:: model/doc/blacklist.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/document.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/documentmanager.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/loader.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/messages.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/operationholder.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/operation.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/runner.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/saving.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/savingstages.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/savingstate.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/stage.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/state.hpp - :project: opencs - -filter ------- - .. autodoxygenfile:: model/filter/andnode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/booleannode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/leafnode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/narynode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/node.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/notnode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/ornode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/parser.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/textnode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/unarynode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/valuenode.hpp - :project: opencs - -prefs ------ - .. autodoxygenfile:: model/prefs/boolsetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/category.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/coloursetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/doublesetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/enumsetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/intsetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/modifiersetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/setting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/shortcuteventhandler.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/shortcut.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/shortcutmanager.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/shortcutsetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/state.hpp - :project: opencs - -tools ------ - .. autodoxygenfile:: model/tools/birthsigncheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/bodypartcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/classcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/factioncheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/gmstcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/journalcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/magiceffectcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/mandatoryid.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/mergeoperation.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/mergestages.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/mergestate.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/pathgridcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/racecheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/referenceablecheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/referencecheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/regioncheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/reportmodel.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/scriptcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/search.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/searchoperation.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/searchstage.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/skillcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/soundcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/soundgencheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/spellcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/startscriptcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/tools.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/topicinfocheck.hpp - :project: opencs - -world ------ - .. autodoxygenfile:: model/world/cellcoordinates.hpp - :project: opencs - - .. autodoxygenfile:: model/world/cell.hpp - :project: opencs - - .. autodoxygenfile:: model/world/cellselection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/collectionbase.hpp - :project: opencs - - .. autodoxygenfile:: model/world/collection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/columnbase.hpp - :project: opencs - - .. autodoxygenfile:: model/world/columnimp.hpp - :project: opencs - - .. autodoxygenfile:: model/world/columns.hpp - :project: opencs - - .. autodoxygenfile:: model/world/commanddispatcher.hpp - :project: opencs - - .. autodoxygenfile:: model/world/commandmacro.hpp - :project: opencs - - .. autodoxygenfile:: model/world/commands.hpp - :project: opencs - - .. autodoxygenfile:: model/world/data.hpp - :project: opencs - - .. autodoxygenfile:: model/world/defaultgmsts.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idcompletionmanager.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idtablebase.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idtable.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idtableproxymodel.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idtree.hpp - :project: opencs - - .. autodoxygenfile:: model/world/infocollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/info.hpp - :project: opencs - - .. autodoxygenfile:: model/world/infoselectwrapper.hpp - :project: opencs - - .. autodoxygenfile:: model/world/infotableproxymodel.hpp - :project: opencs - - .. autodoxygenfile:: model/world/land.hpp - :project: opencs - - .. autodoxygenfile:: model/world/landtexture.hpp - :project: opencs - - .. autodoxygenfile:: model/world/metadata.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedcoladapterimp.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedcolumnadapter.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedidcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedinfocollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedtableproxymodel.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedtablewrapper.hpp - :project: opencs - - .. autodoxygenfile:: model/world/pathgrid.hpp - :project: opencs - - .. autodoxygenfile:: model/world/record.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/ref.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refidadapter.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refidadapterimp.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refidcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refiddata.hpp - :project: opencs - - .. autodoxygenfile:: model/world/regionmap.hpp - :project: opencs - - .. autodoxygenfile:: model/world/resources.hpp - :project: opencs - - .. autodoxygenfile:: model/world/resourcesmanager.hpp - :project: opencs - - .. autodoxygenfile:: model/world/resourcetable.hpp - :project: opencs - - .. autodoxygenfile:: model/world/scope.hpp - :project: opencs - - .. autodoxygenfile:: model/world/scriptcontext.hpp - :project: opencs - - .. autodoxygenfile:: model/world/subcellcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/tablemimedata.hpp - :project: opencs - - .. autodoxygenfile:: model/world/universalid.hpp - :project: opencs - diff --git a/docs/source/source/opencs/view/index.rst b/docs/source/source/opencs/view/index.rst deleted file mode 100644 index 54d00ccc0..000000000 --- a/docs/source/source/opencs/view/index.rst +++ /dev/null @@ -1,340 +0,0 @@ -./opencs/view -############# - -doc ---- - .. autodoxygenfile:: view/doc/adjusterwidget.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/filedialog.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/filewidget.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/globaldebugprofilemenu.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/loader.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/newgame.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/operation.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/operations.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/runlogsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/sizehint.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/startup.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/subviewfactory.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/subviewfactoryimp.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/subview.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/view.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/viewmanager.hpp - :project: opencs - -filter ------- - .. autodoxygenfile:: view/filter/editwidget.hpp - :project: opencs - - .. autodoxygenfile:: view/filter/filterbox.hpp - :project: opencs - - .. autodoxygenfile:: view/filter/recordfilterbox.hpp - :project: opencs - -prefs ------ - .. autodoxygenfile:: view/prefs/dialogue.hpp - :project: opencs - - .. autodoxygenfile:: view/prefs/keybindingpage.hpp - :project: opencs - - .. autodoxygenfile:: view/prefs/pagebase.hpp - :project: opencs - - .. autodoxygenfile:: view/prefs/page.hpp - :project: opencs - -render ------- - .. autodoxygenfile:: view/render/cameracontroller.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cellarrow.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cellborder.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cell.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cellmarker.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cellwater.hpp - :project: opencs - - .. autodoxygenfile:: view/render/editmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/instancemode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/instancemovemode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/instanceselectionmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/lightingbright.hpp - :project: opencs - - .. autodoxygenfile:: view/render/lightingday.hpp - :project: opencs - - .. autodoxygenfile:: view/render/lighting.hpp - :project: opencs - - .. autodoxygenfile:: view/render/lightingnight.hpp - :project: opencs - - .. autodoxygenfile:: view/render/mask.hpp - :project: opencs - - .. autodoxygenfile:: view/render/object.hpp - :project: opencs - - .. autodoxygenfile:: view/render/orbitcameramode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/pagedworldspacewidget.hpp - :project: opencs - - .. autodoxygenfile:: view/render/pathgrid.hpp - :project: opencs - - .. autodoxygenfile:: view/render/pathgridmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/pathgridselectionmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/previewwidget.hpp - :project: opencs - - .. autodoxygenfile:: view/render/scenewidget.hpp - :project: opencs - - .. autodoxygenfile:: view/render/selectionmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/tagbase.hpp - :project: opencs - - .. autodoxygenfile:: view/render/terrainstorage.hpp - :project: opencs - - .. autodoxygenfile:: view/render/unpagedworldspacewidget.hpp - :project: opencs - - .. autodoxygenfile:: view/render/worldspacewidget.hpp - :project: opencs - -tools ------ - .. autodoxygenfile:: view/tools/merge.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/reportsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/reporttable.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/searchbox.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/searchsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/subviews.hpp - :project: opencs - -widget ------- - .. autodoxygenfile:: view/widget/coloreditor.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/colorpickerpopup.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/completerpopup.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/droplineedit.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/modebutton.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/pushbutton.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetoolbar.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetool.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetoolmode.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetoolrun.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetooltoggle2.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetooltoggle.hpp - :project: opencs - -world ------ - .. autodoxygenfile:: view/world/cellcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/colordelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/creator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/datadisplaydelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dialoguecreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dialoguespinbox.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dialoguesubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dragdroputils.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dragrecordtable.hpp - :project: opencs - - .. autodoxygenfile:: view/world/enumdelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/extendedcommandconfigurator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/genericcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/globalcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/idcompletiondelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/idtypedelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/idvalidator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/infocreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/nestedtable.hpp - :project: opencs - - .. autodoxygenfile:: view/world/pathgridcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/previewsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/recordbuttonbar.hpp - :project: opencs - - .. autodoxygenfile:: view/world/recordstatusdelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/referenceablecreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/referencecreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/regionmap.hpp - :project: opencs - - .. autodoxygenfile:: view/world/regionmapsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scenesubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scriptedit.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scripterrortable.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scripthighlighter.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scriptsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/startscriptcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/subviews.hpp - :project: opencs - - .. autodoxygenfile:: view/world/tablebottombox.hpp - :project: opencs - - .. autodoxygenfile:: view/world/tableeditidaction.hpp - :project: opencs - - .. autodoxygenfile:: view/world/table.hpp - :project: opencs - - .. autodoxygenfile:: view/world/tablesubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/util.hpp - :project: opencs - - .. autodoxygenfile:: view/world/vartypedelegate.hpp - :project: opencs diff --git a/docs/source/source/openmw/index.rst b/docs/source/source/openmw/index.rst deleted file mode 100644 index 5367995de..000000000 --- a/docs/source/source/openmw/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -OpenMW Source Documentation -########################### - -.. toctree:: - :maxdepth: 2 - - mwbase - mwclass - mwdialogue - mwgui - mwinput - mwmechanics - mwphysics - mwrender - mwscript - mwsound - mwstate - mwworld - -.. autodoxygenfile:: engine.hpp - :project: openmw - -.. autodoxygenfile:: doc.hpp - :project: openmw \ No newline at end of file diff --git a/docs/source/source/openmw/mwbase.rst b/docs/source/source/openmw/mwbase.rst deleted file mode 100644 index 8fd7ffc1e..000000000 --- a/docs/source/source/openmw/mwbase.rst +++ /dev/null @@ -1,32 +0,0 @@ -./mwbase -######## - -.. autodoxygenfile:: mwbase/dialoguemanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/environment.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/inputmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/journal.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/mechanicsmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/scriptmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/soundmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/statemanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/windowmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/world.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwclass.rst b/docs/source/source/openmw/mwclass.rst deleted file mode 100644 index 3365d2582..000000000 --- a/docs/source/source/openmw/mwclass.rst +++ /dev/null @@ -1,68 +0,0 @@ -./mwclass -######### - -.. autodoxygenfile:: mwclass/activator.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/actor.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/apparatus.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/armor.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/bodypart.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/book.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/classes.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/clothing.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/container.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/creature.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/creaturelevlist.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/ingredient.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/itemlevlist.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/light.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/lockpick.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/misc.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/npc.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/potion.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/probe.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/repair.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/static.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/weapon.hpp - :project: openmw \ No newline at end of file diff --git a/docs/source/source/openmw/mwdialogue.rst b/docs/source/source/openmw/mwdialogue.rst deleted file mode 100644 index 1f3522f2c..000000000 --- a/docs/source/source/openmw/mwdialogue.rst +++ /dev/null @@ -1,32 +0,0 @@ -./mwdialogue -############ - -.. autodoxygenfile:: mwdialogue/dialoguemanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/filter.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/hypertextparser.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/journalentry.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/journalimp.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/keywordsearch.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/quest.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/scripttest.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/selectwrapper.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/topic.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwgui.rst b/docs/source/source/openmw/mwgui.rst deleted file mode 100644 index 0e3726832..000000000 --- a/docs/source/source/openmw/mwgui.rst +++ /dev/null @@ -1,227 +0,0 @@ -./mwgui -####### - -.. autodoxygenfile:: mwgui/alchemywindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/backgroundimage.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/birth.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/bookpage.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/bookwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/charactercreation.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/class.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/companionitemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/companionwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/confirmationdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/console.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/container.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/containeritemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/controllers.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/countdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/cursor.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/debugwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/dialogue.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/draganddrop.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/enchantingdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/exposedwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/formatting.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/hud.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/inventoryitemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/inventorywindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemchargeview.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemselection.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemview.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemwidget.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/jailscreen.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/journalbooks.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/journalviewmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/journalwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/layout.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/levelupdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/loadingscreen.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/mainmenu.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/mapwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/merchantrepair.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/messagebox.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/mode.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/pickpocketitemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/quickkeysmenu.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/race.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/recharge.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/referenceinterface.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/repair.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/review.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/savegamedialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/screenfader.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/scrollwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/settingswindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/sortfilteritemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/soulgemdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellbuyingwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellcreationdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellicons.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellview.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/statswindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/textinput.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/timeadvancer.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/tooltips.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/tradeitemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/tradewindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/trainingwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/travelwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/videowidget.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/waitdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/widgets.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/windowbase.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/windowmanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/windowpinnablebase.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwinput.rst b/docs/source/source/openmw/mwinput.rst deleted file mode 100644 index b24d8dfdb..000000000 --- a/docs/source/source/openmw/mwinput.rst +++ /dev/null @@ -1,5 +0,0 @@ -./mwinput -######### - -.. autodoxygenfile:: mwinput/inputmanagerimp.hpp - :project: openmw \ No newline at end of file diff --git a/docs/source/source/openmw/mwmechanics.rst b/docs/source/source/openmw/mwmechanics.rst deleted file mode 100644 index 3427b712a..000000000 --- a/docs/source/source/openmw/mwmechanics.rst +++ /dev/null @@ -1,137 +0,0 @@ -./mwmechanics -############# - -.. autodoxygenfile:: mwmechanics/activespells.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/actor.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/actors.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/actorutil.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiactivate.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiavoiddoor.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aicombataction.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aicombat.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiescort.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiface.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aifollow.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aipackage.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aipursue.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aisequence.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aistate.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aitravel.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiwander.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/alchemy.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/autocalcspell.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/character.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/combat.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/coordinateconverter.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/creaturestats.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/difficultyscaling.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/disease.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/drawstate.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/enchanting.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/levelledlist.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/magiceffects.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/mechanicsmanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/movement.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/npcstats.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/objects.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/obstacle.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/pathfinding.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/pathgrid.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/pickpocket.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/repair.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/security.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/spellcasting.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/spells.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/stat.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/steering.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/summoning.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/trading.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwphysics.rst b/docs/source/source/openmw/mwphysics.rst deleted file mode 100644 index 6eebab4d9..000000000 --- a/docs/source/source/openmw/mwphysics.rst +++ /dev/null @@ -1,15 +0,0 @@ -./mwphysics -########### - -.. autodoxygenfile:: mwphysics/actor.hpp - :project: openmw - -.. autodoxygenfile:: mwphysics/collisiontype.hpp - :project: openmw - -.. autodoxygenfile:: mwphysics/convert.hpp - :project: openmw - -.. autodoxygenfile:: mwphysics/physicssystem.hpp - :project: openmw - diff --git a/docs/source/source/openmw/mwrender.rst b/docs/source/source/openmw/mwrender.rst deleted file mode 100644 index d284f6586..000000000 --- a/docs/source/source/openmw/mwrender.rst +++ /dev/null @@ -1,77 +0,0 @@ -./mwrender -########## - -.. autodoxygenfile:: mwrender/actoranimation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/animation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/bulletdebugdraw.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/camera.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/cell.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/characterpreview.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/creatureanimation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/effectmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/globalmap.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/localmap.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/npcanimation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/objects.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/pathgrid.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/renderbin.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/renderinginterface.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/renderingmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/rendermode.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/ripplesimulation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/rotatecontroller.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/sky.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/terrainstorage.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/util.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/vismask.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/water.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/weaponanimation.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwscript.rst b/docs/source/source/openmw/mwscript.rst deleted file mode 100644 index 8db8f40e2..000000000 --- a/docs/source/source/openmw/mwscript.rst +++ /dev/null @@ -1,65 +0,0 @@ -./mwscript -########## - -.. autodoxygenfile:: mwscript/aiextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/animationextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/cellextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/compilercontext.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/consoleextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/containerextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/controlextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/dialogueextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/extensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/globalscripts.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/guiextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/interpretercontext.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/locals.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/miscextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/ref.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/scriptmanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/skyextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/soundextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/statsextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/transformationextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/userextensions.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwsound.rst b/docs/source/source/openmw/mwsound.rst deleted file mode 100644 index d4fcb0e6b..000000000 --- a/docs/source/source/openmw/mwsound.rst +++ /dev/null @@ -1,29 +0,0 @@ -./mwsound -######### - -.. autodoxygenfile:: mwsound/ffmpeg_decoder.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/loudness.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/movieaudiofactory.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/openal_output.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/sound_buffer.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/sound_decoder.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/sound.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/soundmanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/sound_output.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwstate.rst b/docs/source/source/openmw/mwstate.rst deleted file mode 100644 index 2618c6ff0..000000000 --- a/docs/source/source/openmw/mwstate.rst +++ /dev/null @@ -1,11 +0,0 @@ -./mwstate -######### - -.. autodoxygenfile:: mwstate/character.hpp - :project: openmw - -.. autodoxygenfile:: mwstate/charactermanager.hpp - :project: openmw - -.. autodoxygenfile:: mwstate/statemanagerimp.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwworld.rst b/docs/source/source/openmw/mwworld.rst deleted file mode 100644 index 21026b3e2..000000000 --- a/docs/source/source/openmw/mwworld.rst +++ /dev/null @@ -1,132 +0,0 @@ -./mwworld -######### - -.. autodoxygenfile:: mwworld/actionalchemy.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionapply.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actiondoor.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actioneat.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionequip.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/action.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionopen.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionread.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionrepair.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionsoulgem.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actiontake.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actiontalk.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionteleport.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actiontrap.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellpreloader.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellref.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellreflist.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cells.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellstore.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellvisitors.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/class.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/containerstore.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/contentloader.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/customdata.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/esmloader.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/esmstore.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/failedaction.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/globals.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/inventorystore.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/livecellref.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/localscripts.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/manualref.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/nullaction.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/player.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/projectilemanager.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/ptr.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/recordcmp.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/refdata.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/scene.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/store.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/timestamp.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/weather.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/worldimp.hpp - :project: openmw - From 69359b6b4befe26909133febae34318fe0dbc621 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Fri, 28 Jul 2017 13:13:45 +0200 Subject: [PATCH 228/318] expand to max-depth 3 and remove indices and tables --- docs/source/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 0308d88de..3781733cb 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -5,14 +5,7 @@ Sections -------- .. toctree:: - :maxdepth: 2 + :maxdepth: 3 manuals/index reference/index - -Indices and Tables -================== - -* :ref:`genindex` -* :ref:`search` - From 920021c61b52ed6fc7f1393a0522cd5c3d3ef463 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 28 Jul 2017 16:50:52 +0400 Subject: [PATCH 229/318] Update effects during rest (bug #3679) --- apps/openmw/mwmechanics/actors.cpp | 5 +++++ apps/openmw/mwworld/worldimp.cpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 431ad09b3..e13723044 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1447,6 +1447,11 @@ namespace MWMechanics calculateCreatureStatModifiers (iter->first, duration); if (iter->first.getClass().isNpc()) calculateNpcStatModifiers(iter->first, duration); + + MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(iter->first); + if (animation) + animation->updateEffects(duration); + } fastForwardAi(); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 08b0e7182..da1cf1396 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -823,7 +823,10 @@ namespace MWWorld mWeatherManager->advanceTime (hours, incremental); if (!incremental) + { + mRendering->notifyWorldSpaceChanged(); mProjectileManager->clear(); + } hours += mGameHour->getFloat(); From ac7b1bf97db6ef85c14dabad79d606d6638217a4 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Fri, 28 Jul 2017 19:16:32 +0200 Subject: [PATCH 230/318] appstream to new location: https://lintian.debian.org/tags/appstream-metadata-in-legacy-location.html --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56b42ed5d..be0519882 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -413,7 +413,7 @@ IF(NOT WIN32 AND NOT APPLE) # Install icon and desktop file INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "${DATAROOTDIR}/applications" COMPONENT "openmw") INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "${ICONDIR}" COMPONENT "openmw") - INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.appdata.xml" DESTINATION "${DATAROOTDIR}/appdata" COMPONENT "openmw") + INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.appdata.xml" DESTINATION "${DATAROOTDIR}/metainfo" COMPONENT "openmw") IF(BUILD_OPENCS) INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw-cs.desktop" DESTINATION "${DATAROOTDIR}/applications" COMPONENT "opencs") INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/opencs/openmw-cs.png" DESTINATION "${ICONDIR}" COMPONENT "opencs") From 6d4bb9e130f350f905925a3fd1b37684c3435913 Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Fri, 28 Jul 2017 21:58:23 +0000 Subject: [PATCH 231/318] Add policy on original engine "fixes" Since the topic came up again on #1350, I figured to write down this policy. It is what I gathered from many discussions in the past and some "bugs" that we had fixed then later reverted when complaints came in. Do we all agree on this? --- CONTRIBUTING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 466910ca3..df5497885 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,3 +33,25 @@ Furthermore, we advise to: * Feel free to submit incomplete pull requests. Even if the work can not be merged yet, pull requests are a great place to collect early feedback. Just make sure to mark it as *[Incomplete]* or *[Do not merge yet]* in the title. * If you plan on contributing often, please read the [Developer Reference](https://wiki.openmw.org/index.php?title=Developer_Reference) on our wiki, especially the [Policies and Standards](https://wiki.openmw.org/index.php?title=Policies_and_Standards). * Make sure each of your changes has a clear objective. Unnecessary changes may lead to merge conflicts, clutter the commit history and slow down review. Code formatting 'fixes' should be avoided, unless you were already changing that particular line anyway. + +Policy on original engine "fixes" +============================= + +From time to time you may be tempted to "fix" what you think was a "bug" in the original game engine. + +Unfortunately, the definition of what is a "bug" is not so clear. Consider that your "bug" is actually a feature unless proven otherwise: + +* We have no way of knowing what the original developers really intended (short of asking them, good luck with that). +* What may seem like an illogical mechanic can actually be part of an attempt to balance the game. +* Many people will actually like these "bugs" because that is what they remember the game for. +* Exploits may be part of the fun of an open-world game - they reward knowledge with power. There are too many of them to plug them all, anyway. + +OpenMW, in its default configuration, is meant to be a faithful reimplementation of Morrowind, minus things like crash bugs, stability issues and design errors. However, we try to avoid touching anything that affects the core gameplay, the balancing of the game or introduces incompatibilities with existing mod content. + +That said, we may sometimes evaluate such issues on an individual basis. Common exceptions to the above would be: + +* Issues so glaring that they would severely limit the capabilities of the engine in the future (for example, the scripting engine not being allowed to access objects in remote cells) +* Bugs where the intent is very obvious, and that have little to no balancing impact (e.g. the bug were being tired made it easier to repair items, instead of harder) +* Bugs that were fixed in an official patch for Morrowind + +In the future, we may offer additional settings to turn each "bug" or exploit on/off, or allow modders to do so by means of scripting. From cf6f3685604cab05e552ad7e73543f1fab8cdd5a Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sat, 29 Jul 2017 11:52:13 +0200 Subject: [PATCH 232/318] rtd backport fix --- CMakeLists.txt | 2 +- docs/requirements.txt | 1 - docs/source/conf.py | 40 +-- docs/source/index.rst | 11 +- docs/source/source/index.rst | 8 - docs/source/source/opencs/index.rst | 11 - docs/source/source/opencs/model/index.rst | 358 ---------------------- docs/source/source/opencs/view/index.rst | 340 -------------------- docs/source/source/openmw/index.rst | 24 -- docs/source/source/openmw/mwbase.rst | 32 -- docs/source/source/openmw/mwclass.rst | 68 ---- docs/source/source/openmw/mwdialogue.rst | 32 -- docs/source/source/openmw/mwgui.rst | 227 -------------- docs/source/source/openmw/mwinput.rst | 5 - docs/source/source/openmw/mwmechanics.rst | 137 --------- docs/source/source/openmw/mwphysics.rst | 15 - docs/source/source/openmw/mwrender.rst | 77 ----- docs/source/source/openmw/mwscript.rst | 65 ---- docs/source/source/openmw/mwsound.rst | 29 -- docs/source/source/openmw/mwstate.rst | 11 - docs/source/source/openmw/mwworld.rst | 132 -------- 21 files changed, 3 insertions(+), 1622 deletions(-) delete mode 100644 docs/source/source/index.rst delete mode 100644 docs/source/source/opencs/index.rst delete mode 100644 docs/source/source/opencs/model/index.rst delete mode 100644 docs/source/source/opencs/view/index.rst delete mode 100644 docs/source/source/openmw/index.rst delete mode 100644 docs/source/source/openmw/mwbase.rst delete mode 100644 docs/source/source/openmw/mwclass.rst delete mode 100644 docs/source/source/openmw/mwdialogue.rst delete mode 100644 docs/source/source/openmw/mwgui.rst delete mode 100644 docs/source/source/openmw/mwinput.rst delete mode 100644 docs/source/source/openmw/mwmechanics.rst delete mode 100644 docs/source/source/openmw/mwphysics.rst delete mode 100644 docs/source/source/openmw/mwrender.rst delete mode 100644 docs/source/source/openmw/mwscript.rst delete mode 100644 docs/source/source/openmw/mwsound.rst delete mode 100644 docs/source/source/openmw/mwstate.rst delete mode 100644 docs/source/source/openmw/mwworld.rst diff --git a/CMakeLists.txt b/CMakeLists.txt index ec7e2577c..7a2ac34c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -407,7 +407,7 @@ IF(NOT WIN32 AND NOT APPLE) # Install icon and desktop file INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "${DATAROOTDIR}/applications" COMPONENT "openmw") INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "${ICONDIR}" COMPONENT "openmw") - INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.appdata.xml" DESTINATION "${DATAROOTDIR}/appdata" COMPONENT "openmw") + INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.appdata.xml" DESTINATION "${DATAROOTDIR}/metainfo" COMPONENT "openmw") IF(BUILD_OPENCS) INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw-cs.desktop" DESTINATION "${DATAROOTDIR}/applications" COMPONENT "opencs") INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/opencs/openmw-cs.png" DESTINATION "${ICONDIR}" COMPONENT "opencs") diff --git a/docs/requirements.txt b/docs/requirements.txt index 6ee8d6987..72c2aaa12 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,2 @@ -breathe parse_cmake sphinx diff --git a/docs/source/conf.py b/docs/source/conf.py index 273b2f7d5..b18b40c50 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,6 @@ # # All configuration values have a default; values that are commented out # serve to show the default. -import glob import os import sys @@ -21,12 +20,6 @@ import sys project_root = os.path.abspath('../../') sys.path.insert(0, project_root) - -def insensitive_glob(pattern): - def either(c): - return '[%s%s]' % (c.lower(), c.upper()) if c.isalpha() else c - return glob.glob(''.join(map(either, pattern))) - # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -43,37 +36,6 @@ extensions = [ 'sphinx.ext.viewcode', ] -try: - import breathe - extensions.append('breathe') -except ImportError: - print("WARNING: Unable to import breathe, code documentation won't be generated.") - -# Where breathe can find the source files -openmw_path = os.path.join(project_root, "apps", "openmw") -openmw_sub_dirs = os.walk(openmw_path).next()[1] -openmw_headers = insensitive_glob(os.path.join(openmw_path, "*.hpp")) -for dir in openmw_sub_dirs: - openmw_headers += insensitive_glob(os.path.join(openmw_path, dir, "*.hpp")) -# massage the headers to get the relative path needed -openmw_headers = [os.path.relpath(x, openmw_path) for x in openmw_headers] - -opencs_path = os.path.join(project_root, "apps", "opencs") -opencs_sub_dirs = os.walk(opencs_path).next()[1] -opencs_headers = insensitive_glob(os.path.join(opencs_path, "*.hpp")) -opencs_sub_sub_dirs = [] -for dir in opencs_sub_dirs: - opencs_headers += insensitive_glob(os.path.join(opencs_path, dir, "*.hpp")) - opencs_sub_sub_dirs += os.walk(os.path.join(opencs_path, dir)).next()[1] - for sub_dir in opencs_sub_sub_dirs: - opencs_headers += insensitive_glob(os.path.join(opencs_path, dir, sub_dir, "*.hpp")) -opencs_headers = [os.path.relpath(x, opencs_path) for x in opencs_headers] - -breathe_projects_source = { - "openmw": (openmw_path, openmw_headers), - "opencs": (opencs_path, opencs_headers), -} - # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -88,7 +50,7 @@ master_doc = 'index' # General information about the project. project = u'OpenMW' -copyright = u'2016, OpenMW Team' +copyright = u'2017, OpenMW Team' # The version info for the project you're documenting, acts as replacement for diff --git a/docs/source/index.rst b/docs/source/index.rst index f51cda909..3781733cb 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -5,16 +5,7 @@ Sections -------- .. toctree:: - :maxdepth: 2 + :maxdepth: 3 manuals/index reference/index - source/index - - -Indices and Tables -================== - -* :ref:`genindex` -* :ref:`search` - diff --git a/docs/source/source/index.rst b/docs/source/source/index.rst deleted file mode 100644 index b58bf2b37..000000000 --- a/docs/source/source/index.rst +++ /dev/null @@ -1,8 +0,0 @@ -Project Source Documentation -============================ - -.. toctree:: - :maxdepth: 2 - - openmw/index - opencs/index \ No newline at end of file diff --git a/docs/source/source/opencs/index.rst b/docs/source/source/opencs/index.rst deleted file mode 100644 index b648bc49c..000000000 --- a/docs/source/source/opencs/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -OpenMW-CS Source Documentation -############################## - -.. toctree:: - :maxdepth: 2 - - model/index - view/index - -.. autodoxygenfile:: editor.hpp - :project: opencs \ No newline at end of file diff --git a/docs/source/source/opencs/model/index.rst b/docs/source/source/opencs/model/index.rst deleted file mode 100644 index 38ca0c31c..000000000 --- a/docs/source/source/opencs/model/index.rst +++ /dev/null @@ -1,358 +0,0 @@ -./opencs/model -############## - -doc ---- - .. autodoxygenfile:: model/doc/blacklist.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/document.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/documentmanager.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/loader.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/messages.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/operationholder.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/operation.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/runner.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/saving.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/savingstages.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/savingstate.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/stage.hpp - :project: opencs - - .. autodoxygenfile:: model/doc/state.hpp - :project: opencs - -filter ------- - .. autodoxygenfile:: model/filter/andnode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/booleannode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/leafnode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/narynode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/node.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/notnode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/ornode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/parser.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/textnode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/unarynode.hpp - :project: opencs - - .. autodoxygenfile:: model/filter/valuenode.hpp - :project: opencs - -prefs ------ - .. autodoxygenfile:: model/prefs/boolsetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/category.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/coloursetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/doublesetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/enumsetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/intsetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/modifiersetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/setting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/shortcuteventhandler.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/shortcut.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/shortcutmanager.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/shortcutsetting.hpp - :project: opencs - - .. autodoxygenfile:: model/prefs/state.hpp - :project: opencs - -tools ------ - .. autodoxygenfile:: model/tools/birthsigncheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/bodypartcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/classcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/factioncheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/gmstcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/journalcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/magiceffectcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/mandatoryid.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/mergeoperation.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/mergestages.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/mergestate.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/pathgridcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/racecheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/referenceablecheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/referencecheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/regioncheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/reportmodel.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/scriptcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/search.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/searchoperation.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/searchstage.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/skillcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/soundcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/soundgencheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/spellcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/startscriptcheck.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/tools.hpp - :project: opencs - - .. autodoxygenfile:: model/tools/topicinfocheck.hpp - :project: opencs - -world ------ - .. autodoxygenfile:: model/world/cellcoordinates.hpp - :project: opencs - - .. autodoxygenfile:: model/world/cell.hpp - :project: opencs - - .. autodoxygenfile:: model/world/cellselection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/collectionbase.hpp - :project: opencs - - .. autodoxygenfile:: model/world/collection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/columnbase.hpp - :project: opencs - - .. autodoxygenfile:: model/world/columnimp.hpp - :project: opencs - - .. autodoxygenfile:: model/world/columns.hpp - :project: opencs - - .. autodoxygenfile:: model/world/commanddispatcher.hpp - :project: opencs - - .. autodoxygenfile:: model/world/commandmacro.hpp - :project: opencs - - .. autodoxygenfile:: model/world/commands.hpp - :project: opencs - - .. autodoxygenfile:: model/world/data.hpp - :project: opencs - - .. autodoxygenfile:: model/world/defaultgmsts.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idcompletionmanager.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idtablebase.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idtable.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idtableproxymodel.hpp - :project: opencs - - .. autodoxygenfile:: model/world/idtree.hpp - :project: opencs - - .. autodoxygenfile:: model/world/infocollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/info.hpp - :project: opencs - - .. autodoxygenfile:: model/world/infoselectwrapper.hpp - :project: opencs - - .. autodoxygenfile:: model/world/infotableproxymodel.hpp - :project: opencs - - .. autodoxygenfile:: model/world/land.hpp - :project: opencs - - .. autodoxygenfile:: model/world/landtexture.hpp - :project: opencs - - .. autodoxygenfile:: model/world/metadata.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedcoladapterimp.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedcolumnadapter.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedidcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedinfocollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedtableproxymodel.hpp - :project: opencs - - .. autodoxygenfile:: model/world/nestedtablewrapper.hpp - :project: opencs - - .. autodoxygenfile:: model/world/pathgrid.hpp - :project: opencs - - .. autodoxygenfile:: model/world/record.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/ref.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refidadapter.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refidadapterimp.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refidcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/refiddata.hpp - :project: opencs - - .. autodoxygenfile:: model/world/regionmap.hpp - :project: opencs - - .. autodoxygenfile:: model/world/resources.hpp - :project: opencs - - .. autodoxygenfile:: model/world/resourcesmanager.hpp - :project: opencs - - .. autodoxygenfile:: model/world/resourcetable.hpp - :project: opencs - - .. autodoxygenfile:: model/world/scope.hpp - :project: opencs - - .. autodoxygenfile:: model/world/scriptcontext.hpp - :project: opencs - - .. autodoxygenfile:: model/world/subcellcollection.hpp - :project: opencs - - .. autodoxygenfile:: model/world/tablemimedata.hpp - :project: opencs - - .. autodoxygenfile:: model/world/universalid.hpp - :project: opencs - diff --git a/docs/source/source/opencs/view/index.rst b/docs/source/source/opencs/view/index.rst deleted file mode 100644 index 54d00ccc0..000000000 --- a/docs/source/source/opencs/view/index.rst +++ /dev/null @@ -1,340 +0,0 @@ -./opencs/view -############# - -doc ---- - .. autodoxygenfile:: view/doc/adjusterwidget.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/filedialog.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/filewidget.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/globaldebugprofilemenu.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/loader.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/newgame.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/operation.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/operations.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/runlogsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/sizehint.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/startup.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/subviewfactory.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/subviewfactoryimp.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/subview.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/view.hpp - :project: opencs - - .. autodoxygenfile:: view/doc/viewmanager.hpp - :project: opencs - -filter ------- - .. autodoxygenfile:: view/filter/editwidget.hpp - :project: opencs - - .. autodoxygenfile:: view/filter/filterbox.hpp - :project: opencs - - .. autodoxygenfile:: view/filter/recordfilterbox.hpp - :project: opencs - -prefs ------ - .. autodoxygenfile:: view/prefs/dialogue.hpp - :project: opencs - - .. autodoxygenfile:: view/prefs/keybindingpage.hpp - :project: opencs - - .. autodoxygenfile:: view/prefs/pagebase.hpp - :project: opencs - - .. autodoxygenfile:: view/prefs/page.hpp - :project: opencs - -render ------- - .. autodoxygenfile:: view/render/cameracontroller.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cellarrow.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cellborder.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cell.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cellmarker.hpp - :project: opencs - - .. autodoxygenfile:: view/render/cellwater.hpp - :project: opencs - - .. autodoxygenfile:: view/render/editmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/instancemode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/instancemovemode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/instanceselectionmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/lightingbright.hpp - :project: opencs - - .. autodoxygenfile:: view/render/lightingday.hpp - :project: opencs - - .. autodoxygenfile:: view/render/lighting.hpp - :project: opencs - - .. autodoxygenfile:: view/render/lightingnight.hpp - :project: opencs - - .. autodoxygenfile:: view/render/mask.hpp - :project: opencs - - .. autodoxygenfile:: view/render/object.hpp - :project: opencs - - .. autodoxygenfile:: view/render/orbitcameramode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/pagedworldspacewidget.hpp - :project: opencs - - .. autodoxygenfile:: view/render/pathgrid.hpp - :project: opencs - - .. autodoxygenfile:: view/render/pathgridmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/pathgridselectionmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/previewwidget.hpp - :project: opencs - - .. autodoxygenfile:: view/render/scenewidget.hpp - :project: opencs - - .. autodoxygenfile:: view/render/selectionmode.hpp - :project: opencs - - .. autodoxygenfile:: view/render/tagbase.hpp - :project: opencs - - .. autodoxygenfile:: view/render/terrainstorage.hpp - :project: opencs - - .. autodoxygenfile:: view/render/unpagedworldspacewidget.hpp - :project: opencs - - .. autodoxygenfile:: view/render/worldspacewidget.hpp - :project: opencs - -tools ------ - .. autodoxygenfile:: view/tools/merge.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/reportsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/reporttable.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/searchbox.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/searchsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/tools/subviews.hpp - :project: opencs - -widget ------- - .. autodoxygenfile:: view/widget/coloreditor.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/colorpickerpopup.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/completerpopup.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/droplineedit.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/modebutton.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/pushbutton.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetoolbar.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetool.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetoolmode.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetoolrun.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetooltoggle2.hpp - :project: opencs - - .. autodoxygenfile:: view/widget/scenetooltoggle.hpp - :project: opencs - -world ------ - .. autodoxygenfile:: view/world/cellcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/colordelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/creator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/datadisplaydelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dialoguecreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dialoguespinbox.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dialoguesubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dragdroputils.hpp - :project: opencs - - .. autodoxygenfile:: view/world/dragrecordtable.hpp - :project: opencs - - .. autodoxygenfile:: view/world/enumdelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/extendedcommandconfigurator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/genericcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/globalcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/idcompletiondelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/idtypedelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/idvalidator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/infocreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/nestedtable.hpp - :project: opencs - - .. autodoxygenfile:: view/world/pathgridcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/previewsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/recordbuttonbar.hpp - :project: opencs - - .. autodoxygenfile:: view/world/recordstatusdelegate.hpp - :project: opencs - - .. autodoxygenfile:: view/world/referenceablecreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/referencecreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/regionmap.hpp - :project: opencs - - .. autodoxygenfile:: view/world/regionmapsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scenesubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scriptedit.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scripterrortable.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scripthighlighter.hpp - :project: opencs - - .. autodoxygenfile:: view/world/scriptsubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/startscriptcreator.hpp - :project: opencs - - .. autodoxygenfile:: view/world/subviews.hpp - :project: opencs - - .. autodoxygenfile:: view/world/tablebottombox.hpp - :project: opencs - - .. autodoxygenfile:: view/world/tableeditidaction.hpp - :project: opencs - - .. autodoxygenfile:: view/world/table.hpp - :project: opencs - - .. autodoxygenfile:: view/world/tablesubview.hpp - :project: opencs - - .. autodoxygenfile:: view/world/util.hpp - :project: opencs - - .. autodoxygenfile:: view/world/vartypedelegate.hpp - :project: opencs diff --git a/docs/source/source/openmw/index.rst b/docs/source/source/openmw/index.rst deleted file mode 100644 index 5367995de..000000000 --- a/docs/source/source/openmw/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -OpenMW Source Documentation -########################### - -.. toctree:: - :maxdepth: 2 - - mwbase - mwclass - mwdialogue - mwgui - mwinput - mwmechanics - mwphysics - mwrender - mwscript - mwsound - mwstate - mwworld - -.. autodoxygenfile:: engine.hpp - :project: openmw - -.. autodoxygenfile:: doc.hpp - :project: openmw \ No newline at end of file diff --git a/docs/source/source/openmw/mwbase.rst b/docs/source/source/openmw/mwbase.rst deleted file mode 100644 index 8fd7ffc1e..000000000 --- a/docs/source/source/openmw/mwbase.rst +++ /dev/null @@ -1,32 +0,0 @@ -./mwbase -######## - -.. autodoxygenfile:: mwbase/dialoguemanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/environment.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/inputmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/journal.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/mechanicsmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/scriptmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/soundmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/statemanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/windowmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwbase/world.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwclass.rst b/docs/source/source/openmw/mwclass.rst deleted file mode 100644 index 3365d2582..000000000 --- a/docs/source/source/openmw/mwclass.rst +++ /dev/null @@ -1,68 +0,0 @@ -./mwclass -######### - -.. autodoxygenfile:: mwclass/activator.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/actor.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/apparatus.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/armor.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/bodypart.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/book.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/classes.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/clothing.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/container.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/creature.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/creaturelevlist.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/ingredient.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/itemlevlist.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/light.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/lockpick.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/misc.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/npc.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/potion.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/probe.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/repair.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/static.hpp - :project: openmw - -.. autodoxygenfile:: mwclass/weapon.hpp - :project: openmw \ No newline at end of file diff --git a/docs/source/source/openmw/mwdialogue.rst b/docs/source/source/openmw/mwdialogue.rst deleted file mode 100644 index 1f3522f2c..000000000 --- a/docs/source/source/openmw/mwdialogue.rst +++ /dev/null @@ -1,32 +0,0 @@ -./mwdialogue -############ - -.. autodoxygenfile:: mwdialogue/dialoguemanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/filter.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/hypertextparser.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/journalentry.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/journalimp.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/keywordsearch.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/quest.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/scripttest.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/selectwrapper.hpp - :project: openmw - -.. autodoxygenfile:: mwdialogue/topic.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwgui.rst b/docs/source/source/openmw/mwgui.rst deleted file mode 100644 index 0e3726832..000000000 --- a/docs/source/source/openmw/mwgui.rst +++ /dev/null @@ -1,227 +0,0 @@ -./mwgui -####### - -.. autodoxygenfile:: mwgui/alchemywindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/backgroundimage.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/birth.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/bookpage.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/bookwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/charactercreation.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/class.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/companionitemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/companionwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/confirmationdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/console.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/container.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/containeritemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/controllers.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/countdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/cursor.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/debugwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/dialogue.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/draganddrop.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/enchantingdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/exposedwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/formatting.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/hud.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/inventoryitemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/inventorywindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemchargeview.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemselection.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemview.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/itemwidget.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/jailscreen.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/journalbooks.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/journalviewmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/journalwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/layout.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/levelupdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/loadingscreen.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/mainmenu.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/mapwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/merchantrepair.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/messagebox.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/mode.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/pickpocketitemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/quickkeysmenu.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/race.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/recharge.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/referenceinterface.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/repair.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/review.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/savegamedialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/screenfader.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/scrollwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/settingswindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/sortfilteritemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/soulgemdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellbuyingwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellcreationdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellicons.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellview.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/spellwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/statswindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/textinput.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/timeadvancer.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/tooltips.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/tradeitemmodel.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/tradewindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/trainingwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/travelwindow.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/videowidget.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/waitdialog.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/widgets.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/windowbase.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/windowmanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwgui/windowpinnablebase.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwinput.rst b/docs/source/source/openmw/mwinput.rst deleted file mode 100644 index b24d8dfdb..000000000 --- a/docs/source/source/openmw/mwinput.rst +++ /dev/null @@ -1,5 +0,0 @@ -./mwinput -######### - -.. autodoxygenfile:: mwinput/inputmanagerimp.hpp - :project: openmw \ No newline at end of file diff --git a/docs/source/source/openmw/mwmechanics.rst b/docs/source/source/openmw/mwmechanics.rst deleted file mode 100644 index 3427b712a..000000000 --- a/docs/source/source/openmw/mwmechanics.rst +++ /dev/null @@ -1,137 +0,0 @@ -./mwmechanics -############# - -.. autodoxygenfile:: mwmechanics/activespells.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/actor.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/actors.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/actorutil.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiactivate.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiavoiddoor.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aicombataction.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aicombat.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiescort.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiface.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aifollow.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aipackage.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aipursue.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aisequence.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aistate.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aitravel.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/aiwander.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/alchemy.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/autocalcspell.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/character.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/combat.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/coordinateconverter.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/creaturestats.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/difficultyscaling.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/disease.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/drawstate.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/enchanting.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/levelledlist.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/magiceffects.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/mechanicsmanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/movement.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/npcstats.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/objects.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/obstacle.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/pathfinding.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/pathgrid.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/pickpocket.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/repair.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/security.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/spellcasting.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/spells.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/stat.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/steering.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/summoning.hpp - :project: openmw - -.. autodoxygenfile:: mwmechanics/trading.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwphysics.rst b/docs/source/source/openmw/mwphysics.rst deleted file mode 100644 index 6eebab4d9..000000000 --- a/docs/source/source/openmw/mwphysics.rst +++ /dev/null @@ -1,15 +0,0 @@ -./mwphysics -########### - -.. autodoxygenfile:: mwphysics/actor.hpp - :project: openmw - -.. autodoxygenfile:: mwphysics/collisiontype.hpp - :project: openmw - -.. autodoxygenfile:: mwphysics/convert.hpp - :project: openmw - -.. autodoxygenfile:: mwphysics/physicssystem.hpp - :project: openmw - diff --git a/docs/source/source/openmw/mwrender.rst b/docs/source/source/openmw/mwrender.rst deleted file mode 100644 index d284f6586..000000000 --- a/docs/source/source/openmw/mwrender.rst +++ /dev/null @@ -1,77 +0,0 @@ -./mwrender -########## - -.. autodoxygenfile:: mwrender/actoranimation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/animation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/bulletdebugdraw.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/camera.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/cell.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/characterpreview.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/creatureanimation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/effectmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/globalmap.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/localmap.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/npcanimation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/objects.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/pathgrid.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/renderbin.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/renderinginterface.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/renderingmanager.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/rendermode.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/ripplesimulation.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/rotatecontroller.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/sky.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/terrainstorage.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/util.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/vismask.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/water.hpp - :project: openmw - -.. autodoxygenfile:: mwrender/weaponanimation.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwscript.rst b/docs/source/source/openmw/mwscript.rst deleted file mode 100644 index 8db8f40e2..000000000 --- a/docs/source/source/openmw/mwscript.rst +++ /dev/null @@ -1,65 +0,0 @@ -./mwscript -########## - -.. autodoxygenfile:: mwscript/aiextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/animationextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/cellextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/compilercontext.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/consoleextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/containerextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/controlextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/dialogueextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/extensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/globalscripts.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/guiextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/interpretercontext.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/locals.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/miscextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/ref.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/scriptmanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/skyextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/soundextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/statsextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/transformationextensions.hpp - :project: openmw - -.. autodoxygenfile:: mwscript/userextensions.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwsound.rst b/docs/source/source/openmw/mwsound.rst deleted file mode 100644 index d4fcb0e6b..000000000 --- a/docs/source/source/openmw/mwsound.rst +++ /dev/null @@ -1,29 +0,0 @@ -./mwsound -######### - -.. autodoxygenfile:: mwsound/ffmpeg_decoder.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/loudness.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/movieaudiofactory.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/openal_output.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/sound_buffer.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/sound_decoder.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/sound.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/soundmanagerimp.hpp - :project: openmw - -.. autodoxygenfile:: mwsound/sound_output.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwstate.rst b/docs/source/source/openmw/mwstate.rst deleted file mode 100644 index 2618c6ff0..000000000 --- a/docs/source/source/openmw/mwstate.rst +++ /dev/null @@ -1,11 +0,0 @@ -./mwstate -######### - -.. autodoxygenfile:: mwstate/character.hpp - :project: openmw - -.. autodoxygenfile:: mwstate/charactermanager.hpp - :project: openmw - -.. autodoxygenfile:: mwstate/statemanagerimp.hpp - :project: openmw diff --git a/docs/source/source/openmw/mwworld.rst b/docs/source/source/openmw/mwworld.rst deleted file mode 100644 index 21026b3e2..000000000 --- a/docs/source/source/openmw/mwworld.rst +++ /dev/null @@ -1,132 +0,0 @@ -./mwworld -######### - -.. autodoxygenfile:: mwworld/actionalchemy.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionapply.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actiondoor.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actioneat.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionequip.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/action.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionopen.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionread.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionrepair.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionsoulgem.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actiontake.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actiontalk.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actionteleport.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/actiontrap.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellpreloader.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellref.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellreflist.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cells.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellstore.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/cellvisitors.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/class.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/containerstore.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/contentloader.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/customdata.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/esmloader.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/esmstore.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/failedaction.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/globals.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/inventorystore.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/livecellref.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/localscripts.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/manualref.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/nullaction.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/player.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/projectilemanager.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/ptr.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/recordcmp.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/refdata.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/scene.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/store.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/timestamp.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/weather.hpp - :project: openmw - -.. autodoxygenfile:: mwworld/worldimp.hpp - :project: openmw - From dae19412f239c255128c40f237e695e7898e574b Mon Sep 17 00:00:00 2001 From: Allofich Date: Sat, 29 Jul 2017 20:41:12 +0900 Subject: [PATCH 233/318] Fix problem with animations not looping Fixes #3804 --- apps/openmw/mwmechanics/character.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index c1eb2d056..661df35b0 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -2043,13 +2043,13 @@ bool CharacterController::playGroup(const std::string &groupname, int mode, int } else { - // If the given animation is a looped animation, is already playing - // and has not yet reached its Loop Stop key, make it the only animation - // in the queue, and retain the loop count from the animation that was - // already playing. This emulates observed behavior from the original - // engine and allows banners to animate correctly. + // If this animation is a looped animation (has a "loop start" key) that is already playing + // and has not yet reached the end of the loop, allow it to continue animating with its existing loop count + // and remove any other animations that were queued. + // This emulates observed behavior from the original allows the script "OutsideBanner" to animate banners correctly. if (!mAnimQueue.empty() && mAnimQueue.front().mGroup == groupname && - mAnimation->getTextKeyTime(mAnimQueue.front().mGroup+": loop start") >= 0) + mAnimation->getTextKeyTime(mAnimQueue.front().mGroup + ": loop start") >= 0 && + mAnimation->isPlaying(groupname)) { float endOfLoop = mAnimation->getTextKeyTime(mAnimQueue.front().mGroup+": loop stop"); @@ -2058,8 +2058,7 @@ bool CharacterController::playGroup(const std::string &groupname, int mode, int if (endOfLoop > 0 && (mAnimation->getCurrentTime(mAnimQueue.front().mGroup) < endOfLoop)) { - mAnimation->setLoopingEnabled(mAnimQueue.front().mGroup, true); - mAnimQueue.resize(1); + mAnimQueue.resize(1); return true; } } From deaeda464e65661281219c9dcb50c3e13c2d818c Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Sat, 29 Jul 2017 14:19:15 +0000 Subject: [PATCH 234/318] Update CONTRIBUTING.md --- CONTRIBUTING.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df5497885..e87ddafa7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,8 +34,8 @@ Furthermore, we advise to: * If you plan on contributing often, please read the [Developer Reference](https://wiki.openmw.org/index.php?title=Developer_Reference) on our wiki, especially the [Policies and Standards](https://wiki.openmw.org/index.php?title=Policies_and_Standards). * Make sure each of your changes has a clear objective. Unnecessary changes may lead to merge conflicts, clutter the commit history and slow down review. Code formatting 'fixes' should be avoided, unless you were already changing that particular line anyway. -Policy on original engine "fixes" -============================= +Guidelines for original engine "fixes" +================================= From time to time you may be tempted to "fix" what you think was a "bug" in the original game engine. @@ -52,6 +52,4 @@ That said, we may sometimes evaluate such issues on an individual basis. Common * Issues so glaring that they would severely limit the capabilities of the engine in the future (for example, the scripting engine not being allowed to access objects in remote cells) * Bugs where the intent is very obvious, and that have little to no balancing impact (e.g. the bug were being tired made it easier to repair items, instead of harder) -* Bugs that were fixed in an official patch for Morrowind - -In the future, we may offer additional settings to turn each "bug" or exploit on/off, or allow modders to do so by means of scripting. +* Bugs that were fixed in an official patch for Morrowind From 99b5f21a469fc4fdfb5cf378612189d11c5acc0a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 29 Jul 2017 19:41:46 +0400 Subject: [PATCH 235/318] Add missing journal sounds (bug #3974) --- apps/openmw/mwgui/journalwindow.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index b5653508d..bb8d5fd4e 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -292,6 +292,8 @@ namespace // If in quest mode, ensure the quest list is updated if (mQuestMode) notifyQuests(getWidget(QuestsList)); + else + notifyTopics(getWidget(TopicsList)); } void pushBook (Book book, unsigned int page) @@ -370,6 +372,8 @@ namespace setVisible (JournalBTN, true); mOptionsMode = false; + + MWBase::Environment::get().getWindowManager()->playSound("book page"); } void notifyTopicSelected (const std::string& topic, int id) @@ -399,6 +403,8 @@ namespace setVisible (JournalBTN, true); mOptionsMode = false; + + MWBase::Environment::get().getWindowManager()->playSound("book page"); } void notifyOptions(MyGUI::Widget* _sender) @@ -416,6 +422,8 @@ namespace { assert (mStates.size () > 1); popBook (); + + MWBase::Environment::get().getWindowManager()->playSound("book page"); } void notifyIndexLinkClicked (MWGui::TypesetBook::InteractiveId character) @@ -432,6 +440,8 @@ namespace mModel->visitTopicNamesStartingWith((char) character, add); list->adjustSize(); + + MWBase::Environment::get().getWindowManager()->playSound("book page"); } void notifyTopics(MyGUI::Widget* _sender) @@ -443,6 +453,8 @@ namespace setVisible (QuestsList, false); setVisible (ShowAllBTN, false); setVisible (ShowActiveBTN, false); + + MWBase::Environment::get().getWindowManager()->playSound("book page"); } struct AddNamesToList @@ -494,6 +506,8 @@ namespace SetNamesInactive setInactive(list); mModel->visitQuestNames(!mAllQuests, setInactive); } + + MWBase::Environment::get().getWindowManager()->playSound("book page"); } void notifyShowAll(MyGUI::Widget* _sender) @@ -510,7 +524,9 @@ namespace void notifyCancel(MyGUI::Widget* _sender) { - setBookMode (); + setBookMode(); + + MWBase::Environment::get().getWindowManager()->playSound("book page"); } void notifyClose(MyGUI::Widget* _sender) @@ -539,6 +555,8 @@ namespace if (page+2 < book->pageCount()) { + MWBase::Environment::get().getWindowManager()->playSound("book page"); + page += 2; updateShowingPages (); } @@ -555,6 +573,8 @@ namespace if(page >= 2) { + MWBase::Environment::get().getWindowManager()->playSound("book page"); + page -= 2; updateShowingPages (); } From fd0be7008d249b99cac842a4d9cb47323b2f7be5 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 30 Jul 2017 15:42:16 +0200 Subject: [PATCH 236/318] [macOS] Fixes accidental loading of plugins from system-wide Qt install I was too eager to remove the workaround in 014a2fc0e924b9229e8da812eddf85b883cd8a8e. Actually, config-based solution seems cleaner. Respective Qt documentation: http://doc.qt.io/qt-5/qt-conf.html. Also, moves Qt plugins from Contents/MacOS to Contents/PlugIns for consistency. --- CMakeLists.txt | 14 ++++++++------ files/mac/qt.conf | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 files/mac/qt.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index be0519882..5df3b27d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -718,17 +718,19 @@ if (WIN32) endif() # Apple bundling -if (APPLE AND DESIRED_QT_VERSION MATCHES 5) +if (OPENMW_OSX_DEPLOYMENT AND APPLE AND DESIRED_QT_VERSION MATCHES 5) get_property(QT_COCOA_PLUGIN_PATH TARGET Qt5::QCocoaIntegrationPlugin PROPERTY LOCATION_RELEASE) get_filename_component(QT_COCOA_PLUGIN_DIR "${QT_COCOA_PLUGIN_PATH}" DIRECTORY) get_filename_component(QT_COCOA_PLUGIN_GROUP "${QT_COCOA_PLUGIN_DIR}" NAME) get_filename_component(QT_COCOA_PLUGIN_NAME "${QT_COCOA_PLUGIN_PATH}" NAME) - configure_file("${QT_COCOA_PLUGIN_PATH}" "${APP_BUNDLE_DIR}/Contents/MacOS/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY) + configure_file("${QT_COCOA_PLUGIN_PATH}" "${APP_BUNDLE_DIR}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY) + configure_file("${OpenMW_SOURCE_DIR}/files/mac/qt.conf" "${APP_BUNDLE_DIR}/Contents/Resources/qt.conf" COPYONLY) if (BUILD_OPENCS) get_property(OPENCS_BUNDLE_NAME_TMP TARGET openmw-cs PROPERTY OUTPUT_NAME) set(OPENCS_BUNDLE_NAME "${OPENCS_BUNDLE_NAME_TMP}.app") - configure_file("${QT_COCOA_PLUGIN_PATH}" "${OPENCS_BUNDLE_NAME}/Contents/MacOS/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY) + configure_file("${QT_COCOA_PLUGIN_PATH}" "${OPENCS_BUNDLE_NAME}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY) + configure_file("${OpenMW_SOURCE_DIR}/files/mac/qt.conf" "${OPENCS_BUNDLE_NAME}/Contents/Resources/qt.conf" COPYONLY) endif () install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION "." COMPONENT Runtime) @@ -787,8 +789,8 @@ if (APPLE AND DESIRED_QT_VERSION MATCHES 5) install_plugins_for_bundle("${APP_BUNDLE_NAME}" PLUGINS) install_plugins_for_bundle("${OPENCS_BUNDLE_NAME}" OPENCS_PLUGINS) - set(PLUGINS ${PLUGINS} "${INSTALLED_OPENMW_APP}/Contents/MacOS/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}") - set(OPENCS_PLUGINS ${OPENCS_PLUGINS} "${INSTALLED_OPENCS_APP}/Contents/MacOS/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}") + set(PLUGINS ${PLUGINS} "${INSTALLED_OPENMW_APP}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}") + set(OPENCS_PLUGINS ${OPENCS_PLUGINS} "${INSTALLED_OPENCS_APP}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}") install(CODE " function(gp_item_default_embedded_path_override item default_embedded_path_var) @@ -803,7 +805,7 @@ if (APPLE AND DESIRED_QT_VERSION MATCHES 5) fixup_bundle(\"${INSTALLED_OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"\") " COMPONENT Runtime) include(CPack) -endif (APPLE AND DESIRED_QT_VERSION MATCHES 5) +endif () # Doxygen Target -- simply run 'make doc' or 'make doc_pages' # output directory for 'make doc' is "${OpenMW_BINARY_DIR}/docs/Doxygen" diff --git a/files/mac/qt.conf b/files/mac/qt.conf new file mode 100644 index 000000000..64d729736 --- /dev/null +++ b/files/mac/qt.conf @@ -0,0 +1,2 @@ +[Paths] +Plugins = PlugIns From 49b02a1bf48ecc2486d354d07ae4b19c1844822e Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 30 Jul 2017 15:48:00 +0200 Subject: [PATCH 237/318] [macOS] remove use of deprecated CMake policy --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df3b27d2..f274875c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -800,7 +800,6 @@ if (OPENMW_OSX_DEPLOYMENT AND APPLE AND DESIRED_QT_VERSION MATCHES 5) endif() endfunction() - cmake_policy(SET CMP0009 OLD) fixup_bundle(\"${INSTALLED_OPENMW_APP}\" \"${PLUGINS}\" \"\") fixup_bundle(\"${INSTALLED_OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"\") " COMPONENT Runtime) From ccae2325639bc54d0231b4a85af4b29f44b3cb0b Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 30 Jul 2017 16:34:49 +0200 Subject: [PATCH 238/318] [macOS, CI] Use most recent available Qt --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 48836b7bb..467900ff9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ env: - secure: "MegynKyJpyL7XDwdWVEbypQh7CLjqOqOi9lGF97G7Fq0HosVZTmnwjHhmIPZspTP7ES4UbxM3rs/f3ce7sp9JN2ShRJpduD6UEFc8egQXBte9J3obUBIdUxPTRdhnht7VJ+u+pksK1S/Bm1Cs6l0eEluP3vmcaXWMykVQcZsPhY=" # macOS builds FTP upload password - secure: "jQcAaWAdDy0+vlNu4POMX8322HanCOQEUTdpviWTAUjWQTjMa0UTM4+zVVgrtEaHMpBaVYYbTT3Rg5BQ9oG+2SiVLJBQQ2XoMcos/YrjPVT6inB02Gs0vFjP29LdPAQVrB8CkAcfQr6u+Z2C+RqAtwhE09LsBUMXjRDzPAtr1CM=" - - macos_qt_formula=qt@5.7 + - macos_qt_formula=qt addons: apt: sources: From 196eedf1b044e7bf07611fbc49847420aa182cfd Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Sun, 30 Jul 2017 23:51:07 +0200 Subject: [PATCH 239/318] Fix key focus issue with the journal hotkey --- files/mygui/openmw_journal.layout | 1 + 1 file changed, 1 insertion(+) diff --git a/files/mygui/openmw_journal.layout b/files/mygui/openmw_journal.layout index 9b530b379..c53f39578 100644 --- a/files/mygui/openmw_journal.layout +++ b/files/mygui/openmw_journal.layout @@ -3,6 +3,7 @@ + From 43279c49b50a4a13218bc6c8930d958244b440a7 Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Sun, 30 Jul 2017 23:51:32 +0200 Subject: [PATCH 240/318] Go back to index when selecting 'cancel' on topics list --- apps/openmw/mwgui/journalwindow.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index bb8d5fd4e..105f95085 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -58,6 +58,7 @@ namespace Book mTopicIndexBook; bool mQuestMode; bool mOptionsMode; + bool mTopicsMode; bool mAllQuests; template @@ -196,6 +197,7 @@ namespace mQuestMode = false; mAllQuests = false; mOptionsMode = false; + mTopicsMode = false; } void adjustButton (char const * name) @@ -259,6 +261,7 @@ namespace void setBookMode () { mOptionsMode = false; + mTopicsMode = false; setVisible (OptionsBTN, true); setVisible (OptionsOverlay, false); @@ -269,6 +272,7 @@ namespace void setOptionsMode () { mOptionsMode = true; + mTopicsMode = false; setVisible (OptionsBTN, false); setVisible (OptionsOverlay, true); @@ -372,6 +376,7 @@ namespace setVisible (JournalBTN, true); mOptionsMode = false; + mTopicsMode = false; MWBase::Environment::get().getWindowManager()->playSound("book page"); } @@ -432,6 +437,8 @@ namespace setVisible (RightTopicIndex, false); setVisible (TopicsList, true); + mTopicsMode = true; + Gui::MWList* list = getWidget(TopicsList); list->clear(); @@ -447,6 +454,7 @@ namespace void notifyTopics(MyGUI::Widget* _sender) { mQuestMode = false; + mTopicsMode = false; setVisible (LeftTopicIndex, true); setVisible (RightTopicIndex, true); setVisible (TopicsList, false); @@ -524,9 +532,16 @@ namespace void notifyCancel(MyGUI::Widget* _sender) { - setBookMode(); + if (mTopicsMode) + { + notifyTopics(_sender); + } + else + { + setBookMode(); + MWBase::Environment::get().getWindowManager()->playSound("book page"); + } - MWBase::Environment::get().getWindowManager()->playSound("book page"); } void notifyClose(MyGUI::Widget* _sender) From b98e175161d8355eb6925a2548b3c9ab51d7f8af Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Sun, 30 Jul 2017 17:40:56 -0500 Subject: [PATCH 241/318] Renaming duplicate horizontalSpacer variable --- files/ui/settingspage.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/ui/settingspage.ui b/files/ui/settingspage.ui index bc2abdf2f..4607d35cb 100644 --- a/files/ui/settingspage.ui +++ b/files/ui/settingspage.ui @@ -53,7 +53,7 @@ - + Qt::Horizontal @@ -115,7 +115,7 @@ - + Qt::Horizontal From e7e875081622b2f90f53d0c89456055949664bd5 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Mon, 31 Jul 2017 09:41:23 +0200 Subject: [PATCH 242/318] [macOS, CI] Remove encrypted FTP credentials from repo It seems more convenient to keep them in Travis settings. --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 467900ff9..6606b0290 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,10 +15,6 @@ env: # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created # via the "travis encrypt" command using the project repo's public key - secure: "jybGzAdUbqt9vWR/GEnRd96BgAi/7Zd1+2HK68j/i/8+/1YH2XxLOy4Jv/DUBhBlJIkxs/Xv8dRcUlFOclZDHX1d/9Qnsqd3oUVkD7k1y7cTOWy9TBQaE/v/kZo3LpzA3xPwwthrb0BvqIbOfIELi5fS5s8ba85WFRg3AX70wWE=" - # macOS builds FTP upload login - - secure: "MegynKyJpyL7XDwdWVEbypQh7CLjqOqOi9lGF97G7Fq0HosVZTmnwjHhmIPZspTP7ES4UbxM3rs/f3ce7sp9JN2ShRJpduD6UEFc8egQXBte9J3obUBIdUxPTRdhnht7VJ+u+pksK1S/Bm1Cs6l0eEluP3vmcaXWMykVQcZsPhY=" - # macOS builds FTP upload password - - secure: "jQcAaWAdDy0+vlNu4POMX8322HanCOQEUTdpviWTAUjWQTjMa0UTM4+zVVgrtEaHMpBaVYYbTT3Rg5BQ9oG+2SiVLJBQQ2XoMcos/YrjPVT6inB02Gs0vFjP29LdPAQVrB8CkAcfQr6u+Z2C+RqAtwhE09LsBUMXjRDzPAtr1CM=" - macos_qt_formula=qt addons: apt: From 308ddabe90fba83bd902645957ffc4c3fabdf3e0 Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Mon, 31 Jul 2017 12:39:33 +0000 Subject: [PATCH 243/318] Add feature additions policy --- CONTRIBUTING.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e87ddafa7..b5a7423d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,3 +53,18 @@ That said, we may sometimes evaluate such issues on an individual basis. Common * Issues so glaring that they would severely limit the capabilities of the engine in the future (for example, the scripting engine not being allowed to access objects in remote cells) * Bugs where the intent is very obvious, and that have little to no balancing impact (e.g. the bug were being tired made it easier to repair items, instead of harder) * Bugs that were fixed in an official patch for Morrowind + +Feature additions policy +===================== + +We get it, you have waited so long for feature XYZ to be available in Morrowind and now that OpenMW is here you can not wait to implement your ingenious idea and share it with the world. + +Unfortunately, since maintaining features comes at a cost and our resources are limited, we have to be a little selective in what features we allow into the main repository. Generally: + +- Features should be as generic and non-redundant as possible. +- Any feature that is also possible with modding should be done as a mod instead. +- In the future, OpenMW plans to expand the scope of what is possible with modding, e.g. by moving certain game logic into editable scripts. +- Currently, modders can edit OpenMW's GUI skins and layout XML files, although there are still a few missing hooks (e.g. scripting support) in order to make this into a powerful way of modding. +- If a feature introduces new game UI strings, that reduces its chance of being accepted because we do not currently have any way of localizing these to the user's Morrowind installation language. + +If you are in doubt of your feature being within our scope, it is probably best to start a forum discussion first. See the [settings documentation](https://openmw.readthedocs.io/en/stable/reference/modding/settings/index.html) and [Features list](https://wiki.openmw.org/index.php?title=Features) for some examples of features that were deemed acceptable. From c9d9461d3e84b60024d0800bd23413c41f82ee73 Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Mon, 31 Jul 2017 16:13:50 +0200 Subject: [PATCH 244/318] Add Spacer class derived from AutoSizedWidget Using a normal widget as a spacer with HStretch/VStretch may not work properly because for widgets not derived from AutoSizedWidget, the HBox/VBox treat the widget's current size as the requested minimum size. This leads the layout to break when resized more than once. The new class sets HStretch and VStretch to true by default to save some typing. --- components/widgets/box.cpp | 6 ++++++ components/widgets/box.hpp | 9 +++++++++ components/widgets/widgets.cpp | 1 + files/mygui/openmw_container_window.layout | 4 +--- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/widgets/box.cpp b/components/widgets/box.cpp index 0ac2ff7fd..0ce8ce951 100644 --- a/components/widgets/box.cpp +++ b/components/widgets/box.cpp @@ -422,4 +422,10 @@ namespace Gui align(); } + Spacer::Spacer() + { + setUserString("HStretch", "true"); + setUserString("VStretch", "true"); + } + } diff --git a/components/widgets/box.hpp b/components/widgets/box.hpp index ccdc5784b..70f73ce42 100644 --- a/components/widgets/box.hpp +++ b/components/widgets/box.hpp @@ -81,6 +81,15 @@ namespace Gui bool mAutoResize; // auto resize the box so that it exactly fits all elements }; + class Spacer : public AutoSizedWidget, public MyGUI::Widget + { + MYGUI_RTTI_DERIVED( Spacer ) + public: + Spacer(); + + virtual MyGUI::IntSize getRequestedSize() { return MyGUI::IntSize(0,0); } + }; + class HBox : public Box, public MyGUI::Widget { MYGUI_RTTI_DERIVED( HBox ) diff --git a/components/widgets/widgets.cpp b/components/widgets/widgets.cpp index 3b6361cf8..92f2084df 100644 --- a/components/widgets/widgets.cpp +++ b/components/widgets/widgets.cpp @@ -16,6 +16,7 @@ namespace Gui { MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); + MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); diff --git a/files/mygui/openmw_container_window.layout b/files/mygui/openmw_container_window.layout index 87651b0f2..6bb585e50 100644 --- a/files/mygui/openmw_container_window.layout +++ b/files/mygui/openmw_container_window.layout @@ -10,9 +10,7 @@ - - - + From a03cc8216e2ce46ac15477e2ffd41dcf33ca32c0 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 31 Jul 2017 18:51:44 +0400 Subject: [PATCH 245/318] Fixed count widget buttons alignment --- files/mygui/openmw_count_window.layout | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/files/mygui/openmw_count_window.layout b/files/mygui/openmw_count_window.layout index a3234c405..520d49fa3 100644 --- a/files/mygui/openmw_count_window.layout +++ b/files/mygui/openmw_count_window.layout @@ -16,13 +16,15 @@ - - + + + - + + From 10eb6ec75f9eec6df9c6fee9b40f4b99732b1dd4 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 31 Jul 2017 19:28:02 +0400 Subject: [PATCH 246/318] AI: Check angle between actor and door --- apps/openmw/mwbase/world.hpp | 4 --- apps/openmw/mwmechanics/obstacle.cpp | 43 ++++++++++++++++++---------- apps/openmw/mwworld/worldimp.cpp | 10 ++----- apps/openmw/mwworld/worldimp.hpp | 3 -- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index ce6cf38eb..86d26d3a7 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -10,7 +10,6 @@ #include "../mwworld/ptr.hpp" #include "../mwrender/rendermode.hpp" -#include "../mwphysics/physicssystem.hpp" namespace osg { @@ -300,9 +299,6 @@ namespace MWBase virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2) = 0; ///< cast a Ray and return true if there is an object in the ray path. - virtual MWPhysics::PhysicsSystem::RayResult castRayTest (float x1, float y1, float z1, float x2, float y2, float z2) = 0; - ///< cast a rendering ray and return ray result. - virtual bool toggleCollisionMode() = 0; ///< Toggle collision mode for player. If disabled player object should ignore /// collisions and gravity. diff --git a/apps/openmw/mwmechanics/obstacle.cpp b/apps/openmw/mwmechanics/obstacle.cpp index 8e932f351..3c6f14bfd 100644 --- a/apps/openmw/mwmechanics/obstacle.cpp +++ b/apps/openmw/mwmechanics/obstacle.cpp @@ -1,11 +1,9 @@ #include "obstacle.hpp" -#include - #include +#include #include "../mwbase/world.hpp" -#include "../mwbase/environment.hpp" #include "../mwworld/class.hpp" #include "../mwworld/cellstore.hpp" @@ -36,24 +34,39 @@ namespace MWMechanics MWWorld::Ptr getNearbyDoor(const MWWorld::Ptr& actor, float minDist) { - osg::Vec3f origin = MWBase::Environment::get().getWorld()->getActorHeadTransform(actor).getTrans(); + MWWorld::CellStore *cell = actor.getCell(); - osg::Quat orient = osg::Quat(actor.getRefData().getPosition().rot[0], osg::Vec3f(-1,0,0)) - * osg::Quat(actor.getRefData().getPosition().rot[2], osg::Vec3f(0,0,-1)); + // Check all the doors in this cell + const MWWorld::CellRefList& doors = cell->getReadOnlyDoors(); + const MWWorld::CellRefList::List& refList = doors.mList; + MWWorld::CellRefList::List::const_iterator it = refList.begin(); + osg::Vec3f pos(actor.getRefData().getPosition().asVec3()); + pos.z() = 0; - osg::Vec3f direction = orient * osg::Vec3f(0,1,0); - osg::Vec3f dest = origin + direction * minDist; + osg::Vec3f actorDir = (actor.getRefData().getBaseNode()->getAttitude() * osg::Vec3f(0,1,0)); - osg::Vec3f pos(actor.getRefData().getPosition().asVec3()); - MWPhysics::PhysicsSystem::RayResult result = MWBase::Environment::get().getWorld()->castRayTest(pos.x(), pos.y(), pos.z(), dest.x(), dest.y(), dest.z()); + for (; it != refList.end(); ++it) + { + const MWWorld::LiveCellRef& ref = *it; - if (!result.mHit || result.mHitObject.isEmpty()) - return MWWorld::Ptr(); // none found + osg::Vec3f doorPos(ref.mData.getPosition().asVec3()); + doorPos.z() = 0; - if (result.mHitObject.getClass().getTypeName() == typeid(ESM::Door).name() && !result.mHitObject.getCellRef().getTeleport()) - return result.mHitObject; + float angle = std::acos(actorDir * (doorPos - pos) / (actorDir.length() * (doorPos - pos).length())); + + // Allow 60 degrees angle between actor and door + if (angle < -osg::PI / 3 || angle > osg::PI / 3) + continue; + + // Door is not close enough + if ((pos - doorPos).length2() > minDist*minDist) + continue; + + // FIXME cast + return MWWorld::Ptr(&const_cast &>(ref), actor.getCell()); // found, stop searching + } - return MWWorld::Ptr(); + return MWWorld::Ptr(); // none found } ObstacleCheck::ObstacleCheck(): diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 86943a7e7..91a3c4a8f 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1451,16 +1451,12 @@ namespace MWWorld } bool World::castRay (float x1, float y1, float z1, float x2, float y2, float z2) - { - MWPhysics::PhysicsSystem::RayResult result = castRayTest(x1, y1, z1, x2, y2, z2); - return result.mHit; - } - - MWPhysics::PhysicsSystem::RayResult World::castRayTest (float x1, float y1, float z1, float x2, float y2, float z2) { osg::Vec3f a(x1,y1,z1); osg::Vec3f b(x2,y2,z2); - return mPhysics->castRay(a, b, MWWorld::Ptr(), std::vector(), MWPhysics::CollisionType_World|MWPhysics::CollisionType_Door); + + MWPhysics::PhysicsSystem::RayResult result = mPhysics->castRay(a, b, MWWorld::Ptr(), std::vector(), MWPhysics::CollisionType_World|MWPhysics::CollisionType_Door); + return result.mHit; } void World::processDoors(float duration) diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 951a837da..ce6e27672 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -407,9 +407,6 @@ namespace MWWorld virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2); ///< cast a Ray and return true if there is an object in the ray path. - virtual MWPhysics::PhysicsSystem::RayResult castRayTest (float x1, float y1, float z1, float x2, float y2, float z2); - ///< cast a rendering ray and return ray result. - virtual bool toggleCollisionMode(); ///< Toggle collision mode for player. If disabled player object should ignore /// collisions and gravity. From b7cfb1aaf42312bfcd51375c0d29604b21e34bf0 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 31 Jul 2017 23:05:19 +0400 Subject: [PATCH 247/318] Fixed DamageHealth and AbsorbHealth effects applying --- apps/openmw/mwmechanics/spellcasting.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 7fde66ebe..a6ae5ca65 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -1131,6 +1131,9 @@ namespace MWMechanics receivedMagicDamage = true; adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::DamageHealth, -magnitude); } + + break; + case ESM::MagicEffect::DamageMagicka: case ESM::MagicEffect::DamageFatigue: if (!godmode) @@ -1147,6 +1150,9 @@ namespace MWMechanics receivedMagicDamage = true; adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::AbsorbHealth, -magnitude); } + + break; + case ESM::MagicEffect::AbsorbMagicka: case ESM::MagicEffect::AbsorbFatigue: if (!godmode) From d24286273b68c0d1d3cd3d79bbfbc0e17dceff67 Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Wed, 28 Jun 2017 22:40:13 +0200 Subject: [PATCH 248/318] Prevent respawned references from being added to the scene twice in certain cases (Fixes #3864) --- apps/openmw/mwrender/objects.cpp | 16 +++++++++------- apps/openmw/mwworld/scene.cpp | 6 ++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index d4cbf25fe..f0a3d2e38 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -38,6 +38,8 @@ Objects::~Objects() void Objects::insertBegin(const MWWorld::Ptr& ptr) { + assert(mObjects.find(ptr) == mObjects.end()); + osg::ref_ptr cellnode; CellMap::iterator found = mCellSceneNodes.find(ptr.getCell()); @@ -90,9 +92,8 @@ void Objects::insertCreature(const MWWorld::Ptr &ptr, const std::string &mesh, b else anim = new CreatureAnimation(ptr, mesh, mResourceSystem); - ptr.getClass().getContainerStore(ptr).setContListener(static_cast(anim.get())); - - mObjects.insert(std::make_pair(ptr, anim)); + if (mObjects.insert(std::make_pair(ptr, anim)).second) + ptr.getClass().getContainerStore(ptr).setContListener(static_cast(anim.get())); } void Objects::insertNPC(const MWWorld::Ptr &ptr) @@ -102,10 +103,11 @@ void Objects::insertNPC(const MWWorld::Ptr &ptr) osg::ref_ptr anim (new NpcAnimation(ptr, osg::ref_ptr(ptr.getRefData().getBaseNode()), mResourceSystem)); - ptr.getClass().getInventoryStore(ptr).setInvListener(anim.get(), ptr); - ptr.getClass().getInventoryStore(ptr).setContListener(anim.get()); - - mObjects.insert(std::make_pair(ptr, anim)); + if (mObjects.insert(std::make_pair(ptr, anim)).second) + { + ptr.getClass().getInventoryStore(ptr).setInvListener(anim.get(), ptr); + ptr.getClass().getInventoryStore(ptr).setContListener(anim.get()); + } } bool Objects::removeObject (const MWWorld::Ptr& ptr) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 8da01cc4b..c83165239 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -54,6 +54,12 @@ namespace void addObject(const MWWorld::Ptr& ptr, MWPhysics::PhysicsSystem& physics, MWRender::RenderingManager& rendering) { + if (ptr.getRefData().getBaseNode() || physics.getActor(ptr)) + { + std::cerr << "Warning: Tried to add " << ptr.getCellRef().getRefId() << " to the scene twice" << std::endl; + return; + } + bool useAnim = ptr.getClass().useAnim(); std::string model = ptr.getClass().getModel(ptr); if (useAnim) From 604f9ee32396387677b021d0a8981fa8c09c0057 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 1 Aug 2017 09:05:35 +0400 Subject: [PATCH 249/318] Split weapons and spells rating code from combat actions --- apps/openmw/CMakeLists.txt | 2 +- apps/openmw/mwmechanics/aicombataction.cpp | 683 +-------------------- apps/openmw/mwmechanics/aicombataction.hpp | 15 - apps/openmw/mwmechanics/spellpriority.cpp | 545 ++++++++++++++++ apps/openmw/mwmechanics/spellpriority.hpp | 32 + apps/openmw/mwmechanics/weaponpriority.cpp | 146 +++++ apps/openmw/mwmechanics/weaponpriority.hpp | 14 + 7 files changed, 749 insertions(+), 688 deletions(-) create mode 100644 apps/openmw/mwmechanics/spellpriority.cpp create mode 100644 apps/openmw/mwmechanics/spellpriority.hpp create mode 100644 apps/openmw/mwmechanics/weaponpriority.cpp create mode 100644 apps/openmw/mwmechanics/weaponpriority.hpp diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 1aa311fd2..89b94ce12 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -84,7 +84,7 @@ add_openmw_dir (mwmechanics drawstate spells activespells npcstats aipackage aisequence aipursue alchemy aiwander aitravel aifollow aiavoiddoor aibreathe aiescort aiactivate aicombat repair enchanting pathfinding pathgrid security spellsuccess spellcasting disease pickpocket levelledlist combat steering obstacle autocalcspell difficultyscaling aicombataction actor summoning - character actors objects aistate coordinateconverter trading aiface + character actors objects aistate coordinateconverter trading aiface weaponpriority spellpriority ) add_openmw_dir (mwstate diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 3e61b7463..1bfeff074 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -16,624 +16,25 @@ #include "npcstats.hpp" #include "spellcasting.hpp" #include "combat.hpp" - -namespace -{ - -// RangeTypes using bitflags to allow multiple range types, as can be the case with spells having multiple effects. -enum RangeTypes -{ - Self = 0x1, - Touch = 0x10, - Target = 0x100 -}; - -int getRangeTypes (const ESM::EffectList& effects) -{ - int types = 0; - for (std::vector::const_iterator it = effects.mList.begin(); it != effects.mList.end(); ++it) - { - if (it->mRange == ESM::RT_Self) - types |= Self; - else if (it->mRange == ESM::RT_Touch) - types |= Touch; - else if (it->mRange == ESM::RT_Target) - types |= Target; - } - return types; -} - -float suggestCombatRange(int rangeTypes) -{ - static const float fCombatDistance = MWBase::Environment::get().getWorld()->getStore().get().find("fCombatDistance")->getFloat(); - static float fHandToHandReach = MWBase::Environment::get().getWorld()->getStore().get().find("fHandToHandReach")->getFloat(); - - // This distance is a possible distance of melee attack - static float distance = fCombatDistance * std::max(2.f, fHandToHandReach); - - if (rangeTypes & Touch) - { - return fCombatDistance; - } - - return distance * 4; -} - -int numEffectsToDispel (const MWWorld::Ptr& actor, int effectFilter=-1, bool negative = true) -{ - int toCure=0; - const MWMechanics::ActiveSpells& activeSpells = actor.getClass().getCreatureStats(actor).getActiveSpells(); - for (MWMechanics::ActiveSpells::TIterator it = activeSpells.begin(); it != activeSpells.end(); ++it) - { - const MWMechanics::ActiveSpells::ActiveSpellParams& params = it->second; - for (std::vector::const_iterator effectIt = params.mEffects.begin(); - effectIt != params.mEffects.end(); ++effectIt) - { - int effectId = effectIt->mEffectId; - if (effectFilter != -1 && effectId != effectFilter) - continue; - const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effectId); - - if (effectIt->mDuration <= 3) // Don't attempt to dispel if effect runs out shortly anyway - continue; - - if (negative && magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) - ++toCure; - - if (!negative && !(magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)) - ++toCure; - } - } - return toCure; -} - -} +#include "weaponpriority.hpp" +#include "spellpriority.hpp" namespace MWMechanics { - - float ratePotion (const MWWorld::Ptr &item, const MWWorld::Ptr& actor) - { - if (item.getTypeName() != typeid(ESM::Potion).name()) - return 0.f; - - const ESM::Potion* potion = item.get()->mBase; - return rateEffects(potion->mEffects, actor, MWWorld::Ptr()); - } - - float rateWeapon (const MWWorld::Ptr &item, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, int type, - float arrowRating, float boltRating) - { - if (item.getTypeName() != typeid(ESM::Weapon).name()) - return 0.f; - - const ESM::Weapon* weapon = item.get()->mBase; - - if (type != -1 && weapon->mData.mType != type) - return 0.f; - - float rating=0.f; - float bonus=0.f; - - if (weapon->mData.mType >= ESM::Weapon::MarksmanBow && weapon->mData.mType <= ESM::Weapon::MarksmanThrown) - { - // Range weapon is useless under water - if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f)) - return 0.f; - - if (enemy.isEmpty()) - return 0.f; - - if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(enemy), 0.75f)) - return 0.f; - - bonus+=1.5f; - } - - if (weapon->mData.mType >= ESM::Weapon::MarksmanBow) - { - rating = (weapon->mData.mChop[0] + weapon->mData.mChop[1]) / 2.f; - - if (weapon->mData.mType >= ESM::Weapon::MarksmanThrown) - MWMechanics::resistNormalWeapon(enemy, actor, item, rating); - } - else - { - for (int i=0; i<2; ++i) - { - rating += weapon->mData.mSlash[i]; - rating += weapon->mData.mThrust[i]; - rating += weapon->mData.mChop[i]; - } - rating /= 6.f; - - MWMechanics::resistNormalWeapon(enemy, actor, item, rating); - } - - if (item.getClass().hasItemHealth(item)) - { - if (item.getClass().getItemHealth(item) == 0) - return 0.f; - rating *= item.getClass().getItemHealth(item) / float(item.getClass().getItemMaxHealth(item)); - } - - if (weapon->mData.mType == ESM::Weapon::MarksmanBow) - { - if (arrowRating <= 0.f) - rating = 0.f; - else - rating += arrowRating; - } - else if (weapon->mData.mType == ESM::Weapon::MarksmanCrossbow) - { - if (boltRating <= 0.f) - rating = 0.f; - else - rating += boltRating; - } - - if (!weapon->mEnchant.empty()) - { - const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get().find(weapon->mEnchant); - if (enchantment->mData.mType == ESM::Enchantment::WhenStrikes - && (item.getCellRef().getEnchantmentCharge() == -1 - || item.getCellRef().getEnchantmentCharge() >= enchantment->mData.mCost)) - rating += rateEffects(enchantment->mEffects, actor, enemy); - } - - int skill = item.getClass().getEquipmentSkill(item); - if (skill != -1) - rating *= actor.getClass().getSkill(actor, skill) / 100.f; - - // There is no need to apply bonus if weapon rating == 0 - if (rating == 0.f) - return 0.f; - - return rating + bonus; - } - - float rateSpell(const ESM::Spell *spell, const MWWorld::Ptr &actor, const MWWorld::Ptr& enemy) - { - const CreatureStats& stats = actor.getClass().getCreatureStats(actor); - - float successChance = MWMechanics::getSpellSuccessChance(spell, actor); - if (successChance == 0.f) - return 0.f; - - if (spell->mData.mType != ESM::Spell::ST_Spell) - return 0.f; - - // Don't make use of racial bonus spells, like MW. Can be made optional later - if (actor.getClass().isNpc()) - { - std::string raceid = actor.get()->mBase->mRace; - const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get().find(raceid); - if (race->mPowers.exists(spell->mId)) - return 0.f; - } - - if (spell->mData.mCost > stats.getMagicka().getCurrent()) - return 0.f; - - // Spells don't stack, so early out if the spell is still active on the target - int types = getRangeTypes(spell->mEffects); - if ((types & Self) && stats.getActiveSpells().isSpellActive(spell->mId)) - return 0.f; - if ( ((types & Touch) || (types & Target)) && enemy.getClass().getCreatureStats(enemy).getActiveSpells().isSpellActive(spell->mId)) - return 0.f; - - return rateEffects(spell->mEffects, actor, enemy) * (successChance / 100.f); - } - - float rateMagicItem(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor, const MWWorld::Ptr& enemy) - { - if (ptr.getClass().getEnchantment(ptr).empty()) - return 0.f; - - const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get().find(ptr.getClass().getEnchantment(ptr)); - - if (enchantment->mData.mType == ESM::Enchantment::CastOnce) - { - return rateEffects(enchantment->mEffects, actor, enemy); - } - else - { - //if (!ptr.getClass().canBeEquipped(ptr, actor)) - return 0.f; - } - } - - float rateEffect(const ESM::ENAMstruct &effect, const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy) + float suggestCombatRange(int rangeTypes) { - // NOTE: enemy may be empty - - float rating = 1; - switch (effect.mEffectID) - { - case ESM::MagicEffect::Soultrap: - case ESM::MagicEffect::AlmsiviIntervention: - case ESM::MagicEffect::DivineIntervention: - case ESM::MagicEffect::CalmHumanoid: - case ESM::MagicEffect::CalmCreature: - case ESM::MagicEffect::FrenzyHumanoid: - case ESM::MagicEffect::FrenzyCreature: - case ESM::MagicEffect::DemoralizeHumanoid: - case ESM::MagicEffect::DemoralizeCreature: - case ESM::MagicEffect::RallyHumanoid: - case ESM::MagicEffect::RallyCreature: - case ESM::MagicEffect::Charm: - case ESM::MagicEffect::DetectAnimal: - case ESM::MagicEffect::DetectEnchantment: - case ESM::MagicEffect::DetectKey: - case ESM::MagicEffect::Telekinesis: - case ESM::MagicEffect::Mark: - case ESM::MagicEffect::Recall: - case ESM::MagicEffect::Jump: - case ESM::MagicEffect::WaterBreathing: - case ESM::MagicEffect::SwiftSwim: - case ESM::MagicEffect::WaterWalking: - case ESM::MagicEffect::SlowFall: - case ESM::MagicEffect::Light: - case ESM::MagicEffect::Lock: - case ESM::MagicEffect::Open: - case ESM::MagicEffect::TurnUndead: - case ESM::MagicEffect::WeaknessToCommonDisease: - case ESM::MagicEffect::WeaknessToBlightDisease: - case ESM::MagicEffect::WeaknessToCorprusDisease: - case ESM::MagicEffect::CureCommonDisease: - case ESM::MagicEffect::CureBlightDisease: - case ESM::MagicEffect::CureCorprusDisease: - case ESM::MagicEffect::ResistBlightDisease: - case ESM::MagicEffect::ResistCommonDisease: - case ESM::MagicEffect::ResistCorprusDisease: - case ESM::MagicEffect::Invisibility: - case ESM::MagicEffect::Chameleon: - case ESM::MagicEffect::NightEye: - case ESM::MagicEffect::Vampirism: - case ESM::MagicEffect::StuntedMagicka: - case ESM::MagicEffect::ExtraSpell: - case ESM::MagicEffect::RemoveCurse: - case ESM::MagicEffect::CommandCreature: - case ESM::MagicEffect::CommandHumanoid: - return 0.f; - - case ESM::MagicEffect::Sound: - { - if (enemy.isEmpty()) - return 0.f; - - // there is no need to cast sound if enemy is not able to cast spells - CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); - - if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude() > 0) - return 0.f; - - if (stats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0) - return 0.f; - - break; - } - - case ESM::MagicEffect::RestoreAttribute: - return 0.f; // TODO: implement based on attribute damage - case ESM::MagicEffect::RestoreSkill: - return 0.f; // TODO: implement based on skill damage - - case ESM::MagicEffect::ResistFire: - case ESM::MagicEffect::ResistFrost: - case ESM::MagicEffect::ResistMagicka: - case ESM::MagicEffect::ResistNormalWeapons: - case ESM::MagicEffect::ResistParalysis: - case ESM::MagicEffect::ResistPoison: - case ESM::MagicEffect::ResistShock: - case ESM::MagicEffect::SpellAbsorption: - case ESM::MagicEffect::Reflect: - return 0.f; // probably useless since we don't know in advance what the enemy will cast - - // don't cast these for now as they would make the NPC cast the same effect over and over again, especially when they have potions - case ESM::MagicEffect::FortifyAttribute: - case ESM::MagicEffect::FortifyHealth: - case ESM::MagicEffect::FortifyMagicka: - case ESM::MagicEffect::FortifyFatigue: - case ESM::MagicEffect::FortifySkill: - case ESM::MagicEffect::FortifyMaximumMagicka: - case ESM::MagicEffect::FortifyAttack: - return 0.f; - - case ESM::MagicEffect::Burden: - { - if (enemy.isEmpty()) - return 0.f; - - // Ignore enemy without inventory - if (!enemy.getClass().hasInventoryStore(enemy)) - return 0.f; - - // burden makes sense only to overburden an enemy - float burden = enemy.getClass().getEncumbrance(enemy) - enemy.getClass().getCapacity(enemy); - if (burden > 0) - return 0.f; - - if ((effect.mMagnMin + effect.mMagnMax)/2.f > -burden) - rating *= 3; - else - return 0.f; - - break; - } - - case ESM::MagicEffect::Feather: - { - // Ignore actors without inventory - if (!actor.getClass().hasInventoryStore(actor)) - return 0.f; - - // feather makes sense only for overburden actors - float burden = actor.getClass().getEncumbrance(actor) - actor.getClass().getCapacity(actor); - if (burden <= 0) - return 0.f; - - if ((effect.mMagnMin + effect.mMagnMax)/2.f >= burden) - rating *= 3; - else - return 0.f; - - break; - } - - case ESM::MagicEffect::Levitate: - return 0.f; // AI isn't designed to take advantage of this, and could be perceived as unfair anyway - case ESM::MagicEffect::BoundBoots: - case ESM::MagicEffect::BoundHelm: - if (actor.getClass().isNpc()) - { - // Beast races can't wear helmets or boots - std::string raceid = actor.get()->mBase->mRace; - const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get().find(raceid); - if (race->mData.mFlags & ESM::Race::Beast) - return 0.f; - } - // Intended fall-through - // Creatures can not wear armor - case ESM::MagicEffect::BoundCuirass: - case ESM::MagicEffect::BoundGloves: - if (!actor.getClass().isNpc()) - return 0.f; - break; - - case ESM::MagicEffect::RestoreHealth: - case ESM::MagicEffect::RestoreMagicka: - case ESM::MagicEffect::RestoreFatigue: - if (effect.mRange == ESM::RT_Self) - { - int priority = 1; - if (effect.mEffectID == ESM::MagicEffect::RestoreHealth) - priority = 10; - const DynamicStat& current = actor.getClass().getCreatureStats(actor). - getDynamic(effect.mEffectID - ESM::MagicEffect::RestoreHealth); - float toHeal = (effect.mMagnMin + effect.mMagnMax)/2.f * effect.mDuration; - // Effect doesn't heal more than we need, *or* we are below 1/2 health - if (current.getModified() - current.getCurrent() > toHeal - || current.getCurrent() < current.getModified()*0.5) - { - return 10000.f * priority - - (toHeal - (current.getModified()-current.getCurrent())); // prefer the most fitting potion - } - else - return -10000.f * priority; // Save for later - } - break; - - case ESM::MagicEffect::Dispel: - { - int numPositive = 0; - int numNegative = 0; - int diff = 0; - - if (effect.mRange == ESM::RT_Self) - { - numPositive = numEffectsToDispel(actor, -1, false); - numNegative = numEffectsToDispel(actor); - - diff = numNegative - numPositive; - } - else - { - if (enemy.isEmpty()) - return 0.f; - - numPositive = numEffectsToDispel(enemy, -1, false); - numNegative = numEffectsToDispel(enemy); - - diff = numPositive - numNegative; - - // if rating < 0 here, the spell will be considered as negative later - rating *= -1; - } - - if (diff <= 0) - return 0.f; - - rating *= (diff) / 5.f; - - break; - } - - // Prefer Cure effects over Dispel, because Dispel also removes positive effects - case ESM::MagicEffect::CureParalyzation: - return 1001.f * numEffectsToDispel(actor, ESM::MagicEffect::Paralyze); - - case ESM::MagicEffect::CurePoison: - return 1001.f * numEffectsToDispel(actor, ESM::MagicEffect::Poison); - case ESM::MagicEffect::DisintegrateArmor: - { - if (enemy.isEmpty()) - return 0.f; - - // Ignore enemy without inventory - if (!enemy.getClass().hasInventoryStore(enemy)) - return 0.f; - - MWWorld::InventoryStore& inv = enemy.getClass().getInventoryStore(enemy); - - // According to UESP - static const int armorSlots[] = { - MWWorld::InventoryStore::Slot_CarriedLeft, - MWWorld::InventoryStore::Slot_Cuirass, - MWWorld::InventoryStore::Slot_LeftPauldron, - MWWorld::InventoryStore::Slot_RightPauldron, - MWWorld::InventoryStore::Slot_LeftGauntlet, - MWWorld::InventoryStore::Slot_RightGauntlet, - MWWorld::InventoryStore::Slot_Helmet, - MWWorld::InventoryStore::Slot_Greaves, - MWWorld::InventoryStore::Slot_Boots - }; - - bool enemyHasArmor = false; - - // Ignore enemy without armor - for (unsigned int i=0; i= 0 && effect.mAttribute < ESM::Attribute::Length) - { - const float attributePriorities[ESM::Attribute::Length] = { - 1.0f, // Strength - 0.5f, // Intelligence - 0.6f, // Willpower - 0.7f, // Agility - 0.5f, // Speed - 0.8f, // Endurance - 0.7f, // Personality - 0.3f // Luck - }; - rating *= attributePriorities[effect.mAttribute]; - } - } - break; - - case ESM::MagicEffect::DamageSkill: - case ESM::MagicEffect::DrainSkill: - if (enemy.isEmpty() || !enemy.getClass().isNpc()) - return 0.f; - if (enemy.getClass().getNpcStats(enemy).getSkill(effect.mSkill).getModified() <= 0) - return 0.f; - break; - - default: - break; - } - - const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); - - // Underwater casting not possible - if (effect.mRange == ESM::RT_Target) - { - if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f)) - return 0.f; - - if (enemy.isEmpty()) - return 0.f; - - if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(enemy), 0.75f)) - return 0.f; - } - - if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) - { - rating *= -1.f; - - if (enemy.isEmpty()) - return 0.f; - - // Check resistance for harmful effects - CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); - - float resistance = MWMechanics::getEffectResistanceAttribute(effect.mEffectID, &stats.getMagicEffects()); + static const float fCombatDistance = MWBase::Environment::get().getWorld()->getStore().get().find("fCombatDistance")->getFloat(); + static float fHandToHandReach = MWBase::Environment::get().getWorld()->getStore().get().find("fHandToHandReach")->getFloat(); - rating *= (1.f - std::min(resistance, 100.f) / 100.f); - } + // This distance is a possible distance of melee attack + static float distance = fCombatDistance * std::max(2.f, fHandToHandReach); - // for harmful no-magnitude effects (e.g. silence) check if enemy is already has them - // for non-harmful no-magnitude effects (e.g. bound items) check if actor is already has them - if (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude) + if (rangeTypes & RangeTypes::Touch) { - if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) - { - CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); - - if (stats.getMagicEffects().get(effect.mEffectID).getMagnitude() > 0) - return 0.f; - } - else - { - CreatureStats& stats = actor.getClass().getCreatureStats(actor); - - if (stats.getMagicEffects().get(effect.mEffectID).getMagnitude() > 0) - return 0.f; - } + return fCombatDistance; } - rating *= calcEffectCost(effect); - - // Currently treating all "on target" or "on touch" effects to target the enemy actor. - // Combat AI is egoistic, so doesn't consider applying positive effects to friendly actors. - if (effect.mRange != ESM::RT_Self) - rating *= -1.f; - - return rating; - } - - float rateEffects(const ESM::EffectList &list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy) - { - // NOTE: enemy may be empty - float rating = 0.f; - for (std::vector::const_iterator it = list.mList.begin(); it != list.mList.end(); ++it) - { - rating += rateEffect(*it, actor, enemy); - - if (it->mRange == ESM::RT_Target) - rating *= 1.5f; - } - return rating; + return distance * 4; } void ActionSpell::prepare(const MWWorld::Ptr &actor) @@ -655,7 +56,7 @@ namespace MWMechanics const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(mSpellId); int types = getRangeTypes(spell->mEffects); - isRanged = (types & Target) | (types & Self); + isRanged = (types & RangeTypes::Target) | (types & RangeTypes::Self); return suggestCombatRange(types); } @@ -1106,67 +507,6 @@ namespace MWMechanics return true; } - float vanillaRateSpell(const ESM::Spell* spell, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy) - { - const MWWorld::Store& gmst = MWBase::Environment::get().getWorld()->getStore().get(); - - static const float fAIMagicSpellMult = gmst.find("fAIMagicSpellMult")->getFloat(); - static const float fAIRangeMagicSpellMult = gmst.find("fAIRangeMagicSpellMult")->getFloat(); - - float mult = fAIMagicSpellMult; - - for (std::vector::const_iterator effectIt = - spell->mEffects.mList.begin(); effectIt != spell->mEffects.mList.end(); ++effectIt) - { - if (effectIt->mRange == ESM::RT_Target) - { - if (!MWBase::Environment::get().getWorld()->isSwimming(enemy)) - mult = fAIRangeMagicSpellMult; - else - mult = 0.0f; - break; - } - } - - return MWMechanics::getSpellSuccessChance(spell, actor) * mult; - } - - float vanillaRateWeaponAndAmmo(const MWWorld::Ptr& weapon, const MWWorld::Ptr& ammo, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy) - { - const MWWorld::Store& gmst = MWBase::Environment::get().getWorld()->getStore().get(); - - static const float fAIMeleeWeaponMult = gmst.find("fAIMeleeWeaponMult")->getFloat(); - static const float fAIMeleeArmorMult = gmst.find("fAIMeleeArmorMult")->getFloat(); - static const float fAIRangeMeleeWeaponMult = gmst.find("fAIRangeMeleeWeaponMult")->getFloat(); - - if (weapon.isEmpty()) - return 0.f; - - float skillMult = actor.getClass().getSkill(actor, weapon.getClass().getEquipmentSkill(weapon)) * 0.01f; - float chopMult = fAIMeleeWeaponMult; - float bonusDamage = 0.f; - - const ESM::Weapon* esmWeap = weapon.get()->mBase; - - if (esmWeap->mData.mType >= ESM::Weapon::MarksmanBow) - { - if (!ammo.isEmpty() && !MWBase::Environment::get().getWorld()->isSwimming(enemy)) - { - bonusDamage = ammo.get()->mBase->mData.mChop[1]; - chopMult = fAIRangeMeleeWeaponMult; - } - else - chopMult = 0.f; - } - - float chopRating = (esmWeap->mData.mChop[1] + bonusDamage) * skillMult * chopMult; - float slashRating = esmWeap->mData.mSlash[1] * skillMult * fAIMeleeWeaponMult; - float thrustRating = esmWeap->mData.mThrust[1] * skillMult * fAIMeleeWeaponMult; - - return actor.getClass().getArmorRating(actor) * fAIMeleeArmorMult - + std::max(std::max(chopRating, slashRating), thrustRating); - } - float vanillaRateFlee(const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy) { const CreatureStats& stats = actor.getClass().getCreatureStats(actor); @@ -1212,5 +552,4 @@ namespace MWMechanics return false; } - } diff --git a/apps/openmw/mwmechanics/aicombataction.hpp b/apps/openmw/mwmechanics/aicombataction.hpp index 393bd9f5d..dc6f359d6 100644 --- a/apps/openmw/mwmechanics/aicombataction.hpp +++ b/apps/openmw/mwmechanics/aicombataction.hpp @@ -10,7 +10,6 @@ namespace MWMechanics { - class Action { public: @@ -88,18 +87,6 @@ namespace MWMechanics virtual const ESM::Weapon* getWeapon() const; }; - float rateSpell (const ESM::Spell* spell, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); - float rateMagicItem (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); - float ratePotion (const MWWorld::Ptr& item, const MWWorld::Ptr &actor); - /// @param type Skip all weapons that are not of this type (i.e. return rating 0) - float rateWeapon (const MWWorld::Ptr& item, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, - int type=-1, float arrowRating=0.f, float boltRating=0.f); - - /// @note target may be empty - float rateEffect (const ESM::ENAMstruct& effect, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); - /// @note target may be empty - float rateEffects (const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); - std::shared_ptr prepareNextAction (const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); float getBestActionRating(const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy); @@ -107,8 +94,6 @@ namespace MWMechanics float getMaxAttackDistance(const MWWorld::Ptr& actor); bool canFight(const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); - float vanillaRateSpell(const ESM::Spell* spell, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); - float vanillaRateWeaponAndAmmo(const MWWorld::Ptr& weapon, const MWWorld::Ptr& ammo, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); float vanillaRateFlee(const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); bool makeFleeDecision(const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, float antiFleeRating); } diff --git a/apps/openmw/mwmechanics/spellpriority.cpp b/apps/openmw/mwmechanics/spellpriority.cpp new file mode 100644 index 000000000..a73e4fd89 --- /dev/null +++ b/apps/openmw/mwmechanics/spellpriority.cpp @@ -0,0 +1,545 @@ +#include "spellpriority.hpp" + +#include +#include + +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" +#include "../mwbase/mechanicsmanager.hpp" + +#include "../mwworld/class.hpp" +#include "../mwworld/esmstore.hpp" +#include "../mwworld/inventorystore.hpp" +#include "../mwworld/actionequip.hpp" +#include "../mwworld/cellstore.hpp" + +#include "npcstats.hpp" +#include "spellcasting.hpp" +#include "combat.hpp" + +namespace +{ + int numEffectsToDispel (const MWWorld::Ptr& actor, int effectFilter=-1, bool negative = true) + { + int toCure=0; + const MWMechanics::ActiveSpells& activeSpells = actor.getClass().getCreatureStats(actor).getActiveSpells(); + for (MWMechanics::ActiveSpells::TIterator it = activeSpells.begin(); it != activeSpells.end(); ++it) + { + const MWMechanics::ActiveSpells::ActiveSpellParams& params = it->second; + for (std::vector::const_iterator effectIt = params.mEffects.begin(); + effectIt != params.mEffects.end(); ++effectIt) + { + int effectId = effectIt->mEffectId; + if (effectFilter != -1 && effectId != effectFilter) + continue; + const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effectId); + + if (effectIt->mDuration <= 3) // Don't attempt to dispel if effect runs out shortly anyway + continue; + + if (negative && magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) + ++toCure; + + if (!negative && !(magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)) + ++toCure; + } + } + return toCure; + } +} + +namespace MWMechanics +{ + int getRangeTypes (const ESM::EffectList& effects) + { + int types = 0; + for (std::vector::const_iterator it = effects.mList.begin(); it != effects.mList.end(); ++it) + { + if (it->mRange == ESM::RT_Self) + types |= RangeTypes::Self; + else if (it->mRange == ESM::RT_Touch) + types |= RangeTypes::Touch; + else if (it->mRange == ESM::RT_Target) + types |= RangeTypes::Target; + } + return types; + } + + float ratePotion (const MWWorld::Ptr &item, const MWWorld::Ptr& actor) + { + if (item.getTypeName() != typeid(ESM::Potion).name()) + return 0.f; + + const ESM::Potion* potion = item.get()->mBase; + return rateEffects(potion->mEffects, actor, MWWorld::Ptr()); + } + + float rateSpell(const ESM::Spell *spell, const MWWorld::Ptr &actor, const MWWorld::Ptr& enemy) + { + const CreatureStats& stats = actor.getClass().getCreatureStats(actor); + + float successChance = MWMechanics::getSpellSuccessChance(spell, actor); + if (successChance == 0.f) + return 0.f; + + if (spell->mData.mType != ESM::Spell::ST_Spell) + return 0.f; + + // Don't make use of racial bonus spells, like MW. Can be made optional later + if (actor.getClass().isNpc()) + { + std::string raceid = actor.get()->mBase->mRace; + const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get().find(raceid); + if (race->mPowers.exists(spell->mId)) + return 0.f; + } + + if (spell->mData.mCost > stats.getMagicka().getCurrent()) + return 0.f; + + // Spells don't stack, so early out if the spell is still active on the target + int types = getRangeTypes(spell->mEffects); + if ((types & Self) && stats.getActiveSpells().isSpellActive(spell->mId)) + return 0.f; + if ( ((types & Touch) || (types & Target)) && enemy.getClass().getCreatureStats(enemy).getActiveSpells().isSpellActive(spell->mId)) + return 0.f; + + return rateEffects(spell->mEffects, actor, enemy) * (successChance / 100.f); + } + + float rateMagicItem(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor, const MWWorld::Ptr& enemy) + { + if (ptr.getClass().getEnchantment(ptr).empty()) + return 0.f; + + const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get().find(ptr.getClass().getEnchantment(ptr)); + + if (enchantment->mData.mType == ESM::Enchantment::CastOnce) + { + return rateEffects(enchantment->mEffects, actor, enemy); + } + else + { + //if (!ptr.getClass().canBeEquipped(ptr, actor)) + return 0.f; + } + } + + float rateEffect(const ESM::ENAMstruct &effect, const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy) + { + // NOTE: enemy may be empty + + float rating = 1; + switch (effect.mEffectID) + { + case ESM::MagicEffect::Soultrap: + case ESM::MagicEffect::AlmsiviIntervention: + case ESM::MagicEffect::DivineIntervention: + case ESM::MagicEffect::CalmHumanoid: + case ESM::MagicEffect::CalmCreature: + case ESM::MagicEffect::FrenzyHumanoid: + case ESM::MagicEffect::FrenzyCreature: + case ESM::MagicEffect::DemoralizeHumanoid: + case ESM::MagicEffect::DemoralizeCreature: + case ESM::MagicEffect::RallyHumanoid: + case ESM::MagicEffect::RallyCreature: + case ESM::MagicEffect::Charm: + case ESM::MagicEffect::DetectAnimal: + case ESM::MagicEffect::DetectEnchantment: + case ESM::MagicEffect::DetectKey: + case ESM::MagicEffect::Telekinesis: + case ESM::MagicEffect::Mark: + case ESM::MagicEffect::Recall: + case ESM::MagicEffect::Jump: + case ESM::MagicEffect::WaterBreathing: + case ESM::MagicEffect::SwiftSwim: + case ESM::MagicEffect::WaterWalking: + case ESM::MagicEffect::SlowFall: + case ESM::MagicEffect::Light: + case ESM::MagicEffect::Lock: + case ESM::MagicEffect::Open: + case ESM::MagicEffect::TurnUndead: + case ESM::MagicEffect::WeaknessToCommonDisease: + case ESM::MagicEffect::WeaknessToBlightDisease: + case ESM::MagicEffect::WeaknessToCorprusDisease: + case ESM::MagicEffect::CureCommonDisease: + case ESM::MagicEffect::CureBlightDisease: + case ESM::MagicEffect::CureCorprusDisease: + case ESM::MagicEffect::ResistBlightDisease: + case ESM::MagicEffect::ResistCommonDisease: + case ESM::MagicEffect::ResistCorprusDisease: + case ESM::MagicEffect::Invisibility: + case ESM::MagicEffect::Chameleon: + case ESM::MagicEffect::NightEye: + case ESM::MagicEffect::Vampirism: + case ESM::MagicEffect::StuntedMagicka: + case ESM::MagicEffect::ExtraSpell: + case ESM::MagicEffect::RemoveCurse: + case ESM::MagicEffect::CommandCreature: + case ESM::MagicEffect::CommandHumanoid: + return 0.f; + + case ESM::MagicEffect::Sound: + { + if (enemy.isEmpty()) + return 0.f; + + // there is no need to cast sound if enemy is not able to cast spells + CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); + + if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude() > 0) + return 0.f; + + if (stats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0) + return 0.f; + + break; + } + + case ESM::MagicEffect::RestoreAttribute: + return 0.f; // TODO: implement based on attribute damage + case ESM::MagicEffect::RestoreSkill: + return 0.f; // TODO: implement based on skill damage + + case ESM::MagicEffect::ResistFire: + case ESM::MagicEffect::ResistFrost: + case ESM::MagicEffect::ResistMagicka: + case ESM::MagicEffect::ResistNormalWeapons: + case ESM::MagicEffect::ResistParalysis: + case ESM::MagicEffect::ResistPoison: + case ESM::MagicEffect::ResistShock: + case ESM::MagicEffect::SpellAbsorption: + case ESM::MagicEffect::Reflect: + return 0.f; // probably useless since we don't know in advance what the enemy will cast + + // don't cast these for now as they would make the NPC cast the same effect over and over again, especially when they have potions + case ESM::MagicEffect::FortifyAttribute: + case ESM::MagicEffect::FortifyHealth: + case ESM::MagicEffect::FortifyMagicka: + case ESM::MagicEffect::FortifyFatigue: + case ESM::MagicEffect::FortifySkill: + case ESM::MagicEffect::FortifyMaximumMagicka: + case ESM::MagicEffect::FortifyAttack: + return 0.f; + + case ESM::MagicEffect::Burden: + { + if (enemy.isEmpty()) + return 0.f; + + // Ignore enemy without inventory + if (!enemy.getClass().hasInventoryStore(enemy)) + return 0.f; + + // burden makes sense only to overburden an enemy + float burden = enemy.getClass().getEncumbrance(enemy) - enemy.getClass().getCapacity(enemy); + if (burden > 0) + return 0.f; + + if ((effect.mMagnMin + effect.mMagnMax)/2.f > -burden) + rating *= 3; + else + return 0.f; + + break; + } + + case ESM::MagicEffect::Feather: + { + // Ignore actors without inventory + if (!actor.getClass().hasInventoryStore(actor)) + return 0.f; + + // feather makes sense only for overburden actors + float burden = actor.getClass().getEncumbrance(actor) - actor.getClass().getCapacity(actor); + if (burden <= 0) + return 0.f; + + if ((effect.mMagnMin + effect.mMagnMax)/2.f >= burden) + rating *= 3; + else + return 0.f; + + break; + } + + case ESM::MagicEffect::Levitate: + return 0.f; // AI isn't designed to take advantage of this, and could be perceived as unfair anyway + case ESM::MagicEffect::BoundBoots: + case ESM::MagicEffect::BoundHelm: + if (actor.getClass().isNpc()) + { + // Beast races can't wear helmets or boots + std::string raceid = actor.get()->mBase->mRace; + const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get().find(raceid); + if (race->mData.mFlags & ESM::Race::Beast) + return 0.f; + } + // Intended fall-through + // Creatures can not wear armor + case ESM::MagicEffect::BoundCuirass: + case ESM::MagicEffect::BoundGloves: + if (!actor.getClass().isNpc()) + return 0.f; + break; + + case ESM::MagicEffect::RestoreHealth: + case ESM::MagicEffect::RestoreMagicka: + case ESM::MagicEffect::RestoreFatigue: + if (effect.mRange == ESM::RT_Self) + { + int priority = 1; + if (effect.mEffectID == ESM::MagicEffect::RestoreHealth) + priority = 10; + const DynamicStat& current = actor.getClass().getCreatureStats(actor). + getDynamic(effect.mEffectID - ESM::MagicEffect::RestoreHealth); + float toHeal = (effect.mMagnMin + effect.mMagnMax)/2.f * effect.mDuration; + // Effect doesn't heal more than we need, *or* we are below 1/2 health + if (current.getModified() - current.getCurrent() > toHeal + || current.getCurrent() < current.getModified()*0.5) + { + return 10000.f * priority + - (toHeal - (current.getModified()-current.getCurrent())); // prefer the most fitting potion + } + else + return -10000.f * priority; // Save for later + } + break; + + case ESM::MagicEffect::Dispel: + { + int numPositive = 0; + int numNegative = 0; + int diff = 0; + + if (effect.mRange == ESM::RT_Self) + { + numPositive = numEffectsToDispel(actor, -1, false); + numNegative = numEffectsToDispel(actor); + + diff = numNegative - numPositive; + } + else + { + if (enemy.isEmpty()) + return 0.f; + + numPositive = numEffectsToDispel(enemy, -1, false); + numNegative = numEffectsToDispel(enemy); + + diff = numPositive - numNegative; + + // if rating < 0 here, the spell will be considered as negative later + rating *= -1; + } + + if (diff <= 0) + return 0.f; + + rating *= (diff) / 5.f; + + break; + } + + // Prefer Cure effects over Dispel, because Dispel also removes positive effects + case ESM::MagicEffect::CureParalyzation: + return 1001.f * numEffectsToDispel(actor, ESM::MagicEffect::Paralyze); + + case ESM::MagicEffect::CurePoison: + return 1001.f * numEffectsToDispel(actor, ESM::MagicEffect::Poison); + case ESM::MagicEffect::DisintegrateArmor: + { + if (enemy.isEmpty()) + return 0.f; + + // Ignore enemy without inventory + if (!enemy.getClass().hasInventoryStore(enemy)) + return 0.f; + + MWWorld::InventoryStore& inv = enemy.getClass().getInventoryStore(enemy); + + // According to UESP + static const int armorSlots[] = { + MWWorld::InventoryStore::Slot_CarriedLeft, + MWWorld::InventoryStore::Slot_Cuirass, + MWWorld::InventoryStore::Slot_LeftPauldron, + MWWorld::InventoryStore::Slot_RightPauldron, + MWWorld::InventoryStore::Slot_LeftGauntlet, + MWWorld::InventoryStore::Slot_RightGauntlet, + MWWorld::InventoryStore::Slot_Helmet, + MWWorld::InventoryStore::Slot_Greaves, + MWWorld::InventoryStore::Slot_Boots + }; + + bool enemyHasArmor = false; + + // Ignore enemy without armor + for (unsigned int i=0; i= 0 && effect.mAttribute < ESM::Attribute::Length) + { + const float attributePriorities[ESM::Attribute::Length] = { + 1.0f, // Strength + 0.5f, // Intelligence + 0.6f, // Willpower + 0.7f, // Agility + 0.5f, // Speed + 0.8f, // Endurance + 0.7f, // Personality + 0.3f // Luck + }; + rating *= attributePriorities[effect.mAttribute]; + } + } + break; + + case ESM::MagicEffect::DamageSkill: + case ESM::MagicEffect::DrainSkill: + if (enemy.isEmpty() || !enemy.getClass().isNpc()) + return 0.f; + if (enemy.getClass().getNpcStats(enemy).getSkill(effect.mSkill).getModified() <= 0) + return 0.f; + break; + + default: + break; + } + + const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); + + // Underwater casting not possible + if (effect.mRange == ESM::RT_Target) + { + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f)) + return 0.f; + + if (enemy.isEmpty()) + return 0.f; + + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(enemy), 0.75f)) + return 0.f; + } + + if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) + { + rating *= -1.f; + + if (enemy.isEmpty()) + return 0.f; + + // Check resistance for harmful effects + CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); + + float resistance = MWMechanics::getEffectResistanceAttribute(effect.mEffectID, &stats.getMagicEffects()); + + rating *= (1.f - std::min(resistance, 100.f) / 100.f); + } + + // for harmful no-magnitude effects (e.g. silence) check if enemy is already has them + // for non-harmful no-magnitude effects (e.g. bound items) check if actor is already has them + if (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude) + { + if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) + { + CreatureStats& stats = enemy.getClass().getCreatureStats(enemy); + + if (stats.getMagicEffects().get(effect.mEffectID).getMagnitude() > 0) + return 0.f; + } + else + { + CreatureStats& stats = actor.getClass().getCreatureStats(actor); + + if (stats.getMagicEffects().get(effect.mEffectID).getMagnitude() > 0) + return 0.f; + } + } + + rating *= calcEffectCost(effect); + + // Currently treating all "on target" or "on touch" effects to target the enemy actor. + // Combat AI is egoistic, so doesn't consider applying positive effects to friendly actors. + if (effect.mRange != ESM::RT_Self) + rating *= -1.f; + + return rating; + } + + float rateEffects(const ESM::EffectList &list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy) + { + // NOTE: enemy may be empty + float rating = 0.f; + for (std::vector::const_iterator it = list.mList.begin(); it != list.mList.end(); ++it) + { + rating += rateEffect(*it, actor, enemy); + + if (it->mRange == ESM::RT_Target) + rating *= 1.5f; + } + return rating; + } + + float vanillaRateSpell(const ESM::Spell* spell, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy) + { + const MWWorld::Store& gmst = MWBase::Environment::get().getWorld()->getStore().get(); + + static const float fAIMagicSpellMult = gmst.find("fAIMagicSpellMult")->getFloat(); + static const float fAIRangeMagicSpellMult = gmst.find("fAIRangeMagicSpellMult")->getFloat(); + + float mult = fAIMagicSpellMult; + + for (std::vector::const_iterator effectIt = + spell->mEffects.mList.begin(); effectIt != spell->mEffects.mList.end(); ++effectIt) + { + if (effectIt->mRange == ESM::RT_Target) + { + if (!MWBase::Environment::get().getWorld()->isSwimming(enemy)) + mult = fAIRangeMagicSpellMult; + else + mult = 0.0f; + break; + } + } + + return MWMechanics::getSpellSuccessChance(spell, actor) * mult; + } +} diff --git a/apps/openmw/mwmechanics/spellpriority.hpp b/apps/openmw/mwmechanics/spellpriority.hpp new file mode 100644 index 000000000..4e5ff5c71 --- /dev/null +++ b/apps/openmw/mwmechanics/spellpriority.hpp @@ -0,0 +1,32 @@ +#ifndef OPENMW_SPELL_PRIORITY_H +#define OPENMW_SPELL_PRIORITY_H + +#include + +#include "../mwworld/ptr.hpp" + +namespace MWMechanics +{ + // RangeTypes using bitflags to allow multiple range types, as can be the case with spells having multiple effects. + enum RangeTypes + { + Self = 0x1, + Touch = 0x10, + Target = 0x100 + }; + + int getRangeTypes (const ESM::EffectList& effects); + + float rateSpell (const ESM::Spell* spell, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); + float rateMagicItem (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); + float ratePotion (const MWWorld::Ptr& item, const MWWorld::Ptr &actor); + + /// @note target may be empty + float rateEffect (const ESM::ENAMstruct& effect, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); + /// @note target may be empty + float rateEffects (const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); + + float vanillaRateSpell(const ESM::Spell* spell, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); +} + +#endif diff --git a/apps/openmw/mwmechanics/weaponpriority.cpp b/apps/openmw/mwmechanics/weaponpriority.cpp new file mode 100644 index 000000000..07cf6ff5f --- /dev/null +++ b/apps/openmw/mwmechanics/weaponpriority.cpp @@ -0,0 +1,146 @@ +#include "weaponpriority.hpp" + +#include +#include + +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + +#include "../mwworld/class.hpp" +#include "../mwworld/esmstore.hpp" + +#include "npcstats.hpp" +#include "combat.hpp" +#include "aicombataction.hpp" +#include "spellpriority.hpp" + +namespace MWMechanics +{ + float rateWeapon (const MWWorld::Ptr &item, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, int type, + float arrowRating, float boltRating) + { + if (item.getTypeName() != typeid(ESM::Weapon).name()) + return 0.f; + + const ESM::Weapon* weapon = item.get()->mBase; + + if (type != -1 && weapon->mData.mType != type) + return 0.f; + + float rating=0.f; + float bonus=0.f; + + if (weapon->mData.mType >= ESM::Weapon::MarksmanBow && weapon->mData.mType <= ESM::Weapon::MarksmanThrown) + { + // Range weapon is useless under water + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f)) + return 0.f; + + if (enemy.isEmpty()) + return 0.f; + + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(enemy), 0.75f)) + return 0.f; + + bonus+=1.5f; + } + + if (weapon->mData.mType >= ESM::Weapon::MarksmanBow) + { + rating = (weapon->mData.mChop[0] + weapon->mData.mChop[1]) / 2.f; + + if (weapon->mData.mType >= ESM::Weapon::MarksmanThrown) + MWMechanics::resistNormalWeapon(enemy, actor, item, rating); + } + else + { + for (int i=0; i<2; ++i) + { + rating += weapon->mData.mSlash[i]; + rating += weapon->mData.mThrust[i]; + rating += weapon->mData.mChop[i]; + } + rating /= 6.f; + + MWMechanics::resistNormalWeapon(enemy, actor, item, rating); + } + + if (item.getClass().hasItemHealth(item)) + { + if (item.getClass().getItemHealth(item) == 0) + return 0.f; + rating *= item.getClass().getItemHealth(item) / float(item.getClass().getItemMaxHealth(item)); + } + + if (weapon->mData.mType == ESM::Weapon::MarksmanBow) + { + if (arrowRating <= 0.f) + rating = 0.f; + else + rating += arrowRating; + } + else if (weapon->mData.mType == ESM::Weapon::MarksmanCrossbow) + { + if (boltRating <= 0.f) + rating = 0.f; + else + rating += boltRating; + } + + if (!weapon->mEnchant.empty()) + { + const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get().find(weapon->mEnchant); + if (enchantment->mData.mType == ESM::Enchantment::WhenStrikes + && (item.getCellRef().getEnchantmentCharge() == -1 + || item.getCellRef().getEnchantmentCharge() >= enchantment->mData.mCost)) + rating += rateEffects(enchantment->mEffects, actor, enemy); + } + + int skill = item.getClass().getEquipmentSkill(item); + if (skill != -1) + rating *= actor.getClass().getSkill(actor, skill) / 100.f; + + // There is no need to apply bonus if weapon rating == 0 + if (rating == 0.f) + return 0.f; + + return rating + bonus; + } + + float vanillaRateWeaponAndAmmo(const MWWorld::Ptr& weapon, const MWWorld::Ptr& ammo, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy) + { + const MWWorld::Store& gmst = MWBase::Environment::get().getWorld()->getStore().get(); + + static const float fAIMeleeWeaponMult = gmst.find("fAIMeleeWeaponMult")->getFloat(); + static const float fAIMeleeArmorMult = gmst.find("fAIMeleeArmorMult")->getFloat(); + static const float fAIRangeMeleeWeaponMult = gmst.find("fAIRangeMeleeWeaponMult")->getFloat(); + + if (weapon.isEmpty()) + return 0.f; + + float skillMult = actor.getClass().getSkill(actor, weapon.getClass().getEquipmentSkill(weapon)) * 0.01f; + float chopMult = fAIMeleeWeaponMult; + float bonusDamage = 0.f; + + const ESM::Weapon* esmWeap = weapon.get()->mBase; + + if (esmWeap->mData.mType >= ESM::Weapon::MarksmanBow) + { + if (!ammo.isEmpty() && !MWBase::Environment::get().getWorld()->isSwimming(enemy)) + { + bonusDamage = ammo.get()->mBase->mData.mChop[1]; + chopMult = fAIRangeMeleeWeaponMult; + } + else + chopMult = 0.f; + } + + float chopRating = (esmWeap->mData.mChop[1] + bonusDamage) * skillMult * chopMult; + float slashRating = esmWeap->mData.mSlash[1] * skillMult * fAIMeleeWeaponMult; + float thrustRating = esmWeap->mData.mThrust[1] * skillMult * fAIMeleeWeaponMult; + + return actor.getClass().getArmorRating(actor) * fAIMeleeArmorMult + + std::max(std::max(chopRating, slashRating), thrustRating); + } + +} diff --git a/apps/openmw/mwmechanics/weaponpriority.hpp b/apps/openmw/mwmechanics/weaponpriority.hpp new file mode 100644 index 000000000..90a767c4a --- /dev/null +++ b/apps/openmw/mwmechanics/weaponpriority.hpp @@ -0,0 +1,14 @@ +#ifndef OPENMW_WEAPON_PRIORITY_H +#define OPENMW_WEAPON_PRIORITY_H + +#include "../mwworld/ptr.hpp" + +namespace MWMechanics +{ + float rateWeapon (const MWWorld::Ptr& item, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, + int type=-1, float arrowRating=0.f, float boltRating=0.f); + + float vanillaRateWeaponAndAmmo(const MWWorld::Ptr& weapon, const MWWorld::Ptr& ammo, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); +} + +#endif From ffcdedced346871a444830ac9234a0ec8db83c37 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Tue, 1 Aug 2017 20:35:10 +0200 Subject: [PATCH 250/318] [macOS, CI] Use FTP URL from environment This URL is also subject to change, moving to Travis settings. --- CI/deploy.osx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/deploy.osx.sh b/CI/deploy.osx.sh index 1ff6f89c3..53bfa18b5 100755 --- a/CI/deploy.osx.sh +++ b/CI/deploy.osx.sh @@ -6,4 +6,4 @@ DATE=`date +'%d%m%Y'` SHORT_COMMIT=`git rev-parse --short ${TRAVIS_COMMIT}` TARGET_FILENAME="OpenMW-${DATE}-${SHORT_COMMIT}.dmg" -curl --ssl --ftp-create-dirs -T *.dmg -u $OSX_FTP_USER:$OSX_FTP_PASSWORD "ftp://s3.mydevil.net:21/nightly/${TARGET_FILENAME}" +curl --ssl --ftp-create-dirs -T *.dmg -u $OSX_FTP_USER:$OSX_FTP_PASSWORD "${OSX_FTP_URL}${TARGET_FILENAME}" From 748f5225a914907db2e918ef9a07153b002a0207 Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 2 Aug 2017 02:20:27 +0300 Subject: [PATCH 251/318] Copy PathFinder::mPath back value when pass to MWMechanics::AiPackage::pathTo as dest May become dangling reference because method may remove all elements from mPath. --- apps/openmw/mwmechanics/aiwander.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index baf4efc03..b44b187ad 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -489,7 +489,7 @@ namespace MWMechanics float duration, AiWanderStorage& storage, ESM::Position& pos) { // Is there no destination or are we there yet? - if ((!mPathFinder.isPathConstructed()) || pathTo(actor, mPathFinder.getPath().back(), duration, DESTINATION_TOLERANCE)) + if ((!mPathFinder.isPathConstructed()) || pathTo(actor, ESM::Pathgrid::Point(mPathFinder.getPath().back()), duration, DESTINATION_TOLERANCE)) { stopWalking(actor, storage); storage.setState(Wander_ChooseAction); From cb32f1d60ada705ce25151ea1a36538a4ccfc34c Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Wed, 2 Aug 2017 16:05:05 +0000 Subject: [PATCH 252/318] Update AUTHORS.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 6125ed36d..8aaa6cf73 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -50,6 +50,7 @@ Programmers Edmondo Tommasina (edmondo) Eduard Cot (trombonecot) Eli2 + elsid Emanuel Guével (potatoesmaster) eroen escondida From 3cfd9af94591bf00386c70c32fdafe2d31fa2d06 Mon Sep 17 00:00:00 2001 From: Julian Date: Wed, 2 Aug 2017 18:54:16 +0200 Subject: [PATCH 253/318] merge redundant input events --- components/sdlutil/sdlinputwrapper.cpp | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index ac172b84b..56411ca88 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -49,17 +49,42 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v SDL_PumpEvents(); - SDL_Event evt; + SDL_Event event; if (windowEventsOnly) { // During loading, just handle window events, and keep others for later - while (SDL_PeepEvents(&evt, 1, SDL_GETEVENT, SDL_WINDOWEVENT, SDL_WINDOWEVENT)) - handleWindowEvent(evt); + while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_WINDOWEVENT, SDL_WINDOWEVENT)) + handleWindowEvent(event); return; } - while(SDL_PollEvent(&evt)) + // Merge redundant events to avoid unnecessary listener calls + std::vector events; + while(SDL_PollEvent(&event)) { + if (events.empty() || events.back().type != event.type) + { + events.emplace_back(event); + continue; + } + + SDL_Event& previousEvent = events.back(); + + switch (event.type) + { + case SDL_MOUSEMOTION: + previousEvent.motion.x = event.motion.x; + previousEvent.motion.y = event.motion.y; + previousEvent.motion.xrel += event.motion.xrel; + previousEvent.motion.yrel += event.motion.yrel; + break; + default: + events.emplace_back(event); + } + } + + + for (const SDL_Event& evt : events) { switch(evt.type) { From 2fdffb1995ae920c0dfa800b270fce1417ac83ce Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Wed, 2 Aug 2017 18:05:33 -0500 Subject: [PATCH 254/318] Adding myself to Authors.md I've had a few pull requests merged, so I assume I'm ready to be added. --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 8aaa6cf73..95c741eab 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -146,6 +146,7 @@ Programmers t6 terrorfisch Thomas Luppi (Digmaster) + Will Herrmann (Thunderforge) Tom Mason (wheybags) Torben Leif Carrington (TorbenC) viadanna From 487e72fd23f527cd3288a18bb60a6a4f17647147 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 3 Aug 2017 18:39:59 +0400 Subject: [PATCH 255/318] Play Up sounds instead of Down ones in trade window (bug #3982) --- apps/openmw/mwgui/inventorywindow.cpp | 2 +- apps/openmw/mwgui/tradewindow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index c6b8a4bd7..8b0f895d1 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -320,7 +320,7 @@ namespace MWGui { ensureSelectedItemUnequipped(count); const ItemStack& item = mTradeModel->getItem(mSelectedItem); - std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); + std::string sound = item.mBase.getClass().getUpSoundId(item.mBase); MWBase::Environment::get().getWindowManager()->playSound(sound); if (item.mType == ItemStack::Type_Barter) diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index 5f4433a47..e05848ef8 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -209,7 +209,7 @@ namespace MWGui void TradeWindow::sellItem(MyGUI::Widget* sender, int count) { const ItemStack& item = mTradeModel->getItem(mItemToSell); - std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); + std::string sound = item.mBase.getClass().getUpSoundId(item.mBase); MWBase::Environment::get().getWindowManager()->playSound(sound); TradeItemModel* playerTradeModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel(); From 35beede0658c3993def9bc2099af529b0019fc07 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 3 Aug 2017 18:41:13 +0400 Subject: [PATCH 256/318] Restock items after trade deal instead of trade window opening --- apps/openmw/mwgui/tradewindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index e05848ef8..f82d2f68d 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -122,8 +122,6 @@ namespace MWGui mCurrentBalance = 0; mCurrentMerchantOffer = 0; - restock(); - std::vector itemSources; MWBase::Environment::get().getWorld()->getContainersOwnedBy(actor, itemSources); @@ -357,6 +355,8 @@ namespace MWGui MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up"); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter); + + restock(); } void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender) From d1489f5b42a59c8d0d8fb9112b481409bb6a36d8 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 3 Aug 2017 19:12:21 +0400 Subject: [PATCH 257/318] Take in account a temporary disposition in isAggressive check (bug #3987) --- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 62ac9bd40..751f8d164 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1490,7 +1490,7 @@ namespace MWMechanics { int disposition = 50; if (ptr.getClass().isNpc()) - disposition = getDerivedDisposition(ptr, false); + disposition = getDerivedDisposition(ptr, true); int fight = std::max(0, ptr.getClass().getCreatureStats(ptr).getAiSetting(CreatureStats::AI_Fight).getModified() + static_cast(getFightDistanceBias(ptr, target) + getFightDispositionBias(static_cast(disposition)))); From 56a30d7aeccefe15a6172089d47f648bc75995bb Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 3 Aug 2017 20:27:14 +0400 Subject: [PATCH 258/318] Journalbook layout fixes --- apps/openmw/mwgui/journalbooks.cpp | 10 +++++----- apps/openmw/mwgui/journalwindow.cpp | 8 ++++---- files/mygui/openmw_journal.layout | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwgui/journalbooks.cpp b/apps/openmw/mwgui/journalbooks.cpp index 5634eb080..a1d74fab6 100644 --- a/apps/openmw/mwgui/journalbooks.cpp +++ b/apps/openmw/mwgui/journalbooks.cpp @@ -82,7 +82,7 @@ namespace AddEntry::operator () (entry); - mTypesetter->sectionBreak (10); + mTypesetter->sectionBreak (30); } }; @@ -107,7 +107,7 @@ namespace mTypesetter->selectContent (mContentId); mTypesetter->write (mBodyStyle, 2, 3);// end quote - mTypesetter->sectionBreak (10); + mTypesetter->sectionBreak (30); } }; @@ -121,7 +121,7 @@ namespace void operator () (MWGui::JournalViewModel::Utf8Span topicName) { mTypesetter->write (mBodyStyle, topicName); - mTypesetter->sectionBreak (10); + mTypesetter->sectionBreak (); } }; @@ -135,7 +135,7 @@ namespace void operator () (MWGui::JournalViewModel::Utf8Span topicName) { mTypesetter->write (mBodyStyle, topicName); - mTypesetter->sectionBreak (10); + mTypesetter->sectionBreak (); } }; } @@ -250,7 +250,7 @@ book JournalBooks::createTopicIndexBook () BookTypesetter::Ptr JournalBooks::createTypesetter () { //TODO: determine page size from layout... - return BookTypesetter::create (240, 300); + return BookTypesetter::create (240, 320); } } diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 105f95085..e96cc8b70 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -187,12 +187,12 @@ namespace } adjustButton(TopicsBTN); - int width = getWidget(TopicsBTN)->getSize().width + getWidget(QuestsBTN)->getSize().width; int topicsWidth = getWidget(TopicsBTN)->getSize().width; - int pageWidth = getWidget(RightBookPage)->getSize().width; + int cancelLeft = getWidget(CancelBTN)->getPosition().left; + int cancelRight = getWidget(CancelBTN)->getPosition().left + getWidget(CancelBTN)->getSize().width; - getWidget(TopicsBTN)->setPosition((pageWidth - width)/2, getWidget(TopicsBTN)->getPosition().top); - getWidget(QuestsBTN)->setPosition((pageWidth - width)/2 + topicsWidth, getWidget(QuestsBTN)->getPosition().top); + getWidget(TopicsBTN)->setPosition(cancelLeft - topicsWidth, getWidget(TopicsBTN)->getPosition().top); + getWidget(QuestsBTN)->setPosition(cancelRight, getWidget(QuestsBTN)->getPosition().top); mQuestMode = false; mAllQuests = false; diff --git a/files/mygui/openmw_journal.layout b/files/mygui/openmw_journal.layout index c53f39578..1131b1bbc 100644 --- a/files/mygui/openmw_journal.layout +++ b/files/mygui/openmw_journal.layout @@ -49,33 +49,33 @@ - - + + - + - + - + - + - + @@ -88,7 +88,7 @@ - + From c920d083e421f947a33c04203dbb49556ef88aaf Mon Sep 17 00:00:00 2001 From: Siimacore Date: Thu, 3 Aug 2017 23:15:26 +0200 Subject: [PATCH 259/318] Correcting https://bugs.openmw.org/issues/3906. --- apps/launcher/maindialog.cpp | 10 +++++++++- apps/launcher/maindialog.hpp | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 94e186db8..31da90d2f 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -172,7 +172,10 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog() } } - return setup() ? FirstRunDialogResultContinue : FirstRunDialogResultFailure; + if (!setup() || !setupGameData()) { + return FirstRunDialogResultFailure; + } + return FirstRunDialogResultContinue; } void Launcher::MainDialog::setVersionLabel() @@ -344,6 +347,11 @@ bool Launcher::MainDialog::setupGameSettings() file.close(); } + return true; +} + +bool Launcher::MainDialog::setupGameData() +{ QStringList dataDirs; // Check if the paths actually contain data files diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index 96b5c0b97..8d0d61b8f 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -72,6 +72,7 @@ namespace Launcher bool setupLauncherSettings(); bool setupGameSettings(); bool setupGraphicsSettings(); + bool setupGameData(); void setVersionLabel(); From 23bda7613beb1257a01690d4462d0d7375b0f63a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 4 Aug 2017 07:31:41 +0400 Subject: [PATCH 260/318] Do not allow to use journal in a main menu (bug #3991) --- apps/openmw/mwinput/inputmanagerimp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 7b2a1560d..a823ae0fd 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1022,6 +1022,7 @@ namespace MWInput return; if(MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Journal + && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_MainMenu && MWBase::Environment::get().getWindowManager ()->getJournalAllowed()) { MWBase::Environment::get().getWindowManager()->playSound ("book open"); From 63343b6241de45a6db433d33aa2788ac78eb6aea Mon Sep 17 00:00:00 2001 From: Jake Westrip Date: Sat, 5 Aug 2017 06:15:15 +1000 Subject: [PATCH 261/318] Ensure jail does not decrease a skill past zero --- apps/openmw/mwgui/jailscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/jailscreen.cpp b/apps/openmw/mwgui/jailscreen.cpp index 211e0c5f9..8ac133d76 100644 --- a/apps/openmw/mwgui/jailscreen.cpp +++ b/apps/openmw/mwgui/jailscreen.cpp @@ -93,7 +93,7 @@ namespace MWGui if (skill == ESM::Skill::Security || skill == ESM::Skill::Sneak) value.setBase(std::min(100, value.getBase()+1)); else - value.setBase(value.getBase()-1); + value.setBase(std::max(0, value.getBase()-1)); } const MWWorld::Store& gmst = MWBase::Environment::get().getWorld()->getStore().get(); From bf70b97f899730db4bba06b270cbf52f9ab48a98 Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Fri, 4 Aug 2017 21:44:20 +0000 Subject: [PATCH 262/318] Update AUTHORS.md --- AUTHORS.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 95c741eab..2a10cbc2b 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -62,8 +62,8 @@ Programmers Hallfaer Tuilinn hristoast Internecine - Jacob Essex (Yacoby) - Jannik Heller (scrawl) + Jacob Essex (Yacoby) + Jake Westrip (16bitint) Jason Hooks (jhooks) jeaye Jeffrey Haines (Jyby) @@ -132,6 +132,7 @@ Programmers Roman Proskuryakov (kpp) Sandy Carter (bwrsandman) Scott Howard + scrawl Sebastian Wick (swick) Sergey Shambir ShadowRadiance From cf7a6232d021050d327b905ea16c2ef8995c488e Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 1 Aug 2017 21:42:49 +0400 Subject: [PATCH 263/318] Combat AI: use WhenUsed enchantments --- apps/openmw/mwmechanics/aicombataction.cpp | 2 + apps/openmw/mwmechanics/aicombataction.hpp | 4 +- apps/openmw/mwmechanics/spellpriority.cpp | 50 ++++++++++++++++++++-- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 1bfeff074..d44498966 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -71,6 +71,8 @@ namespace MWMechanics { const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get().find(mItem->getClass().getEnchantment(*mItem)); int types = getRangeTypes(enchantment->mEffects); + + isRanged = (types & RangeTypes::Target) | (types & RangeTypes::Self); return suggestCombatRange(types); } diff --git a/apps/openmw/mwmechanics/aicombataction.hpp b/apps/openmw/mwmechanics/aicombataction.hpp index dc6f359d6..466ae2dc4 100644 --- a/apps/openmw/mwmechanics/aicombataction.hpp +++ b/apps/openmw/mwmechanics/aicombataction.hpp @@ -54,7 +54,7 @@ namespace MWMechanics virtual float getCombatRange (bool& isRanged) const; /// Since this action has no animation, apply a small cool down for using it - virtual float getActionCooldown() { return 1.f; } + virtual float getActionCooldown() { return 0.75f; } }; class ActionPotion : public Action @@ -68,7 +68,7 @@ namespace MWMechanics virtual bool isAttackingOrSpell() const { return false; } /// Since this action has no animation, apply a small cool down for using it - virtual float getActionCooldown() { return 1.f; } + virtual float getActionCooldown() { return 0.75f; } }; class ActionWeapon : public Action diff --git a/apps/openmw/mwmechanics/spellpriority.cpp b/apps/openmw/mwmechanics/spellpriority.cpp index a73e4fd89..a56f430c6 100644 --- a/apps/openmw/mwmechanics/spellpriority.cpp +++ b/apps/openmw/mwmechanics/spellpriority.cpp @@ -46,6 +46,26 @@ namespace } return toCure; } + + float getSpellDuration (const MWWorld::Ptr& actor, const std::string& spellId) + { + float duration = 0; + const MWMechanics::ActiveSpells& activeSpells = actor.getClass().getCreatureStats(actor).getActiveSpells(); + for (MWMechanics::ActiveSpells::TIterator it = activeSpells.begin(); it != activeSpells.end(); ++it) + { + if (it->first != spellId) + continue; + + const MWMechanics::ActiveSpells::ActiveSpellParams& params = it->second; + for (std::vector::const_iterator effectIt = params.mEffects.begin(); + effectIt != params.mEffects.end(); ++effectIt) + { + if (effectIt->mDuration > duration) + duration = effectIt->mDuration; + } + } + return duration; + } } namespace MWMechanics @@ -114,15 +134,39 @@ namespace MWMechanics const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get().find(ptr.getClass().getEnchantment(ptr)); + // Spells don't stack, so early out if the spell is still active on the target + int types = getRangeTypes(enchantment->mEffects); + if ((types & Self) && actor.getClass().getCreatureStats(actor).getActiveSpells().isSpellActive(ptr.getCellRef().getRefId())) + return 0.f; + + if (types & (Touch|Target) && getSpellDuration(enemy, ptr.getCellRef().getRefId()) > 3) + return 0.f; + if (enchantment->mData.mType == ESM::Enchantment::CastOnce) { return rateEffects(enchantment->mEffects, actor, enemy); } - else + else if (enchantment->mData.mType == ESM::Enchantment::WhenUsed) { - //if (!ptr.getClass().canBeEquipped(ptr, actor)) - return 0.f; + MWWorld::InventoryStore& store = actor.getClass().getInventoryStore(actor); + + // Creatures can not wear armor/clothing, so allow creatures to use non-equipped items, + if (actor.getClass().isNpc() && !store.isEquipped(ptr)) + return 0.f; + + int castCost = getEffectiveEnchantmentCastCost(static_cast(enchantment->mData.mCost), actor); + + if (ptr.getCellRef().getEnchantmentCharge() != -1 + && ptr.getCellRef().getEnchantmentCharge() < castCost) + return 0.f; + + float rating = rateEffects(enchantment->mEffects, actor, enemy); + + rating *= 2; // prefer rechargable magic items over spells + return rating; } + + return 0.f; } float rateEffect(const ESM::ENAMstruct &effect, const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy) From 72ce118d02ee3691be45eab187d85b16311136f3 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 5 Aug 2017 12:38:26 +0400 Subject: [PATCH 264/318] Disable AiPursue package for player's followers --- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 62ac9bd40..2f217ab12 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1152,7 +1152,19 @@ namespace MWMechanics it->getClass().getNpcStats(*it).setCrimeId(id); if (!it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + { + // Player's followers should not try to arrest player + if (it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdFollow)) + { + std::set playerFollowers; + getActorsSidingWith(player, playerFollowers); + + if (playerFollowers.find(*it) != playerFollowers.end()) + continue; + } + it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it); + } } else { From 393f4ab75834e41a1f1c0652ba21031cbb1d2d82 Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sun, 6 Aug 2017 13:02:22 +0200 Subject: [PATCH 265/318] Add missing include for isatty function (Fixes #4002) --- apps/openmw/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index a7e522acd..9e44f237e 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -20,6 +20,9 @@ #include #endif +#if (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix)) +#include +#endif #if (defined(__APPLE__) || (defined(__linux) && !defined(ANDROID)) || (defined(__unix) && !defined(ANDROID)) || defined(__posix)) #define USE_CRASH_CATCHER 1 From 60a7d3d6e0af503f81e3e5ec9b1b0c007f2cf000 Mon Sep 17 00:00:00 2001 From: Lennart Bernhardt Date: Sun, 6 Aug 2017 20:10:56 +0200 Subject: [PATCH 266/318] Fade out music before change occurs --- apps/openmw/mwsound/soundmanagerimp.cpp | 40 +++++++++++++++++++++++-- apps/openmw/mwsound/soundmanagerimp.hpp | 6 ++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 53c0643f6..97030643f 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -34,7 +34,7 @@ namespace MWSound { - SoundManager::SoundManager(const VFS::Manager* vfs, const std::map& fallbackMap, bool useSound) + SoundManager::SoundManager(const VFS::Manager* vfs, const std::map& fallbackMap, bool useSound) : mVFS(vfs) , mFallback(fallbackMap) , mOutput(new DEFAULT_OUTPUT(*this)) @@ -328,9 +328,23 @@ namespace MWSound } } + void SoundManager::advanceMusic(const std::string& filename) + { + if (!isMusicPlaying()) + { + streamMusicFull(filename); + return; + } + + mMusicFader = 0.5f; + mNextMusic = filename; + + mMusic->setFadeout(mMusicFader); + } + void SoundManager::streamMusic(const std::string& filename) { - streamMusicFull("Music/"+filename); + advanceMusic("Music/"+filename); } void SoundManager::startRandomTitle() @@ -370,7 +384,7 @@ namespace MWSound i = (i+1) % filelist.size(); } - streamMusicFull(filelist[i]); + advanceMusic(filelist[i]); } bool SoundManager::isMusicPlaying() @@ -1029,6 +1043,25 @@ namespace MWSound } + void SoundManager::updateMusic(float duration) + { + if (!mNextMusic.empty()) + { + mMusic->updateFade(duration); + + mOutput->startUpdate(); + mOutput->updateStream(mMusic); + mOutput->finishUpdate(); + + if (mMusic->getRealVolume() <= 0.f) + { + streamMusicFull(mNextMusic); + mNextMusic.clear(); + } + } + } + + void SoundManager::update(float duration) { if(!mOutput->isInitialized()) @@ -1040,6 +1073,7 @@ namespace MWSound updateSounds(duration); updateRegionSound(duration); updateWaterSound(duration); + updateMusic(duration); } } diff --git a/apps/openmw/mwsound/soundmanagerimp.hpp b/apps/openmw/mwsound/soundmanagerimp.hpp index bf628b102..1c5348e65 100644 --- a/apps/openmw/mwsound/soundmanagerimp.hpp +++ b/apps/openmw/mwsound/soundmanagerimp.hpp @@ -114,9 +114,15 @@ namespace MWSound MWBase::SoundStreamPtr playVoice(DecoderPtr decoder, const osg::Vec3f &pos, bool playlocal); void streamMusicFull(const std::string& filename); + void advanceMusic(const std::string& filename); + void updateSounds(float duration); void updateRegionSound(float duration); void updateWaterSound(float duration); + void updateMusic(float duration); + + float mMusicFader; + std::string mNextMusic; float volumeFromType(PlayType type) const; From 632d39ca767978620100d83052a6dedd9067157c Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 6 Aug 2017 15:03:48 +0200 Subject: [PATCH 267/318] Allow starting at an (unnamed) exterior cell using --start (Feature #3941) --- apps/openmw/engine.cpp | 3 +-- apps/openmw/engine.hpp | 2 +- apps/openmw/mwworld/worldimp.cpp | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 426300149..c921e17d0 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -278,8 +278,7 @@ void OMW::Engine::setResourceDir (const boost::filesystem::path& parResDir) mResDir = parResDir; } -// Set start cell name (only interiors for now) - +// Set start cell name void OMW::Engine::setCell (const std::string& cellName) { mCellName = cellName; diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index 29419a4c2..bf144bfed 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -148,7 +148,7 @@ namespace OMW /// Set resource dir void setResourceDir(const boost::filesystem::path& parResDir); - /// Set start cell name (only interiors for now) + /// Set start cell name void setCell(const std::string& cellName); /** diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index f8d44292e..a9506385d 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2582,7 +2582,25 @@ namespace MWWorld { pos.rot[0] = pos.rot[1] = pos.rot[2] = 0; - if (const ESM::Cell *ext = getExterior(name)) { + const ESM::Cell *ext = getExterior(name); + + if (!ext && name.find(',') != std::string::npos) { + try { + int x = std::stoi(name.substr(0, name.find(','))); + int y = std::stoi(name.substr(name.find(',')+1)); + ext = getExterior(x, y)->getCell(); + } + catch (std::invalid_argument) + { + // This exception can be ignored, as this means that name probably refers to a interior cell instead of comma separated coordinates + } + catch (std::out_of_range) + { + throw std::runtime_error("Cell coordinates out of range."); + } + } + + if (ext) { int x = ext->getGridX(); int y = ext->getGridY(); indexToPosition(x, y, pos.pos[0], pos.pos[1], true); @@ -2592,6 +2610,7 @@ namespace MWWorld return true; } + return false; } From cef415509f9db64c7eea93bf1ba6f799215f2a9f Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Sun, 6 Aug 2017 20:54:20 +0000 Subject: [PATCH 268/318] Revert "Merge redundant input events" --- components/sdlutil/sdlinputwrapper.cpp | 33 ++++---------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index 56411ca88..ac172b84b 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -49,42 +49,17 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v SDL_PumpEvents(); - SDL_Event event; + SDL_Event evt; if (windowEventsOnly) { // During loading, just handle window events, and keep others for later - while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_WINDOWEVENT, SDL_WINDOWEVENT)) - handleWindowEvent(event); + while (SDL_PeepEvents(&evt, 1, SDL_GETEVENT, SDL_WINDOWEVENT, SDL_WINDOWEVENT)) + handleWindowEvent(evt); return; } - // Merge redundant events to avoid unnecessary listener calls - std::vector events; - while(SDL_PollEvent(&event)) { - if (events.empty() || events.back().type != event.type) - { - events.emplace_back(event); - continue; - } - - SDL_Event& previousEvent = events.back(); - - switch (event.type) - { - case SDL_MOUSEMOTION: - previousEvent.motion.x = event.motion.x; - previousEvent.motion.y = event.motion.y; - previousEvent.motion.xrel += event.motion.xrel; - previousEvent.motion.yrel += event.motion.yrel; - break; - default: - events.emplace_back(event); - } - } - - - for (const SDL_Event& evt : events) + while(SDL_PollEvent(&evt)) { switch(evt.type) { From bf8d10587ec8e3954b61764773162dba6d9ac76f Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Sun, 6 Aug 2017 21:09:29 +0000 Subject: [PATCH 269/318] Update AUTHORS.md --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 2a10cbc2b..c48647f4e 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -139,6 +139,7 @@ Programmers Siimacore sir_herrbatka smbas + spycrab Stefan Galowicz (bogglez) Stanislav Bobrov (Jiub) stil-t From dd919b9f2cb2e1e546e0e0ef899f051782cfebb3 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 26 Jul 2017 14:42:01 +0400 Subject: [PATCH 270/318] Do not allow to loot fighting actors during death animation (bug #3528) --- apps/openmw/mwclass/creature.cpp | 30 +++++++++++++--- apps/openmw/mwclass/npc.cpp | 36 +++++++++++++------ .../reference/modding/settings/game.rst | 18 +++++++++- files/settings-default.cfg | 3 ++ 4 files changed, 72 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index ce03af7a1..65f8c80d8 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/magiceffects.hpp" @@ -448,10 +449,27 @@ namespace MWClass return action; } - if(getCreatureStats(ptr).isDead()) - return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); - if(ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat()) + const MWMechanics::CreatureStats& stats = getCreatureStats(ptr); + + if(stats.isDead()) + { + bool canLoot = Settings::Manager::getBool ("can loot during death animation", "Game"); + + // by default user can loot friendly actors during death animation + if (canLoot && !stats.getAiSequence().isInCombat()) + return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); + + // otherwise wait until death animation + if(stats.isDeathAnimationFinished()) + return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); + + // death animation is not finished, do nothing + return std::shared_ptr (new MWWorld::FailedAction("")); + } + + if(stats.getAiSequence().isInCombat()) return std::shared_ptr(new MWWorld::FailedAction("")); + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); } @@ -558,7 +576,11 @@ namespace MWClass return true; const CreatureCustomData& customData = ptr.getRefData().getCustomData()->asCreatureCustomData(); - return !customData.mCreatureStats.getAiSequence().isInCombat() || customData.mCreatureStats.isDead(); + + if (customData.mCreatureStats.isDead() && customData.mCreatureStats.isDeathAnimationFinished()) + return true; + + return !customData.mCreatureStats.getAiSequence().isInCombat(); } MWGui::ToolTipInfo Creature::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index f8ff3da19..ed1f12b31 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -863,16 +864,27 @@ namespace MWClass return action; } - if(getCreatureStats(ptr).isDead()) - return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); - if(ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat()) - return std::shared_ptr(new MWWorld::FailedAction("#{sActorInCombat}")); - if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak) - || ptr.getClass().getCreatureStats(ptr).getKnockedDown()) - return std::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing - // Can't talk to werewolfs - if(ptr.getClass().isNpc() && ptr.getClass().getNpcStats(ptr).isWerewolf()) + const MWMechanics::CreatureStats& stats = getCreatureStats(ptr); + + if(stats.isDead()) + { + bool canLoot = Settings::Manager::getBool ("can loot during death animation", "Game"); + + // by default user can loot friendly actors during death animation + if (canLoot && !stats.getAiSequence().isInCombat()) + return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); + + // otherwise wait until death animation + if(stats.isDeathAnimationFinished()) + return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); + + // death animation is not finished, do nothing return std::shared_ptr (new MWWorld::FailedAction("")); + } + + if(stats.getAiSequence().isInCombat()) + return std::shared_ptr(new MWWorld::FailedAction("")); + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); } @@ -1019,7 +1031,11 @@ namespace MWClass return true; const NpcCustomData& customData = ptr.getRefData().getCustomData()->asNpcCustomData(); - return !customData.mNpcStats.getAiSequence().isInCombat() || customData.mNpcStats.isDead(); + + if (customData.mNpcStats.isDead() && customData.mNpcStats.isDeathAnimationFinished()) + return true; + + return !customData.mNpcStats.getAiSequence().isInCombat(); } MWGui::ToolTipInfo Npc::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index 62fe5a70e..e1d5d75f6 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -65,6 +65,22 @@ the type of attack is determined by the direction that the character is moving a The default value is false. This setting can be toggled with the Always Use Best Attack button in the Prefs panel of the Options menu. +can loot during death animation +------------------------------- + +:Type: boolean +:Range: True/False +:Default: True + +If this setting is true, the player is allowed to loot actors (e.g. summoned creatures) during death animation, if they are not in combat. +However disposing corpses during death animation is not recommended - death counter may not be incremented, and this behaviour can break quests. +This is how original Morrowind behaves. + +If this setting is false, player has to wait until end of death animation in all cases. +This case is more safe, but makes using of summoned creatures exploit (looting summoned Dremoras and Golden Saints for expensive weapons) a lot harder. + +The default value is true. This setting can only be configured by editing the settings configuration file. + difficulty ---------- @@ -110,4 +126,4 @@ followers attack on sight :Default: False Makes player followers and escorters start combat with enemies who have started combat with them or the player. -Otherwise they wait for the enemies or the player to do an attack first. \ No newline at end of file +Otherwise they wait for the enemies or the player to do an attack first. diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 40c1ed099..a0460326b 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -180,6 +180,9 @@ prevent merchant equipping = false # or the player. Otherwise they wait for the enemies or the player to do an attack first. followers attack on sight = false +# Can loot non-fighting actors during death animation +can loot during death animation = true + [General] # Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16). From ab391f17dbcd06ecfbe7829503e96d37b4cd0069 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 7 Aug 2017 12:12:57 +0400 Subject: [PATCH 271/318] Fixes regression in spell school detection (bug #4007) --- apps/openmw/mwmechanics/spellcasting.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index a6ae5ca65..ecd4ba48a 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -121,6 +121,11 @@ namespace MWMechanics CreatureStats& stats = actor.getClass().getCreatureStats(actor); + float castBonus = -stats.getMagicEffects().get(ESM::MagicEffect::Sound).getMagnitude(); + + float castChance = calcSpellBaseSuccessChance(spell, actor, effectiveSchool) + castBonus; + castChance *= stats.getFatigueTerm(); + if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude()&& !godmode) return 0; @@ -138,11 +143,6 @@ namespace MWMechanics return 100; } - float castBonus = -stats.getMagicEffects().get(ESM::MagicEffect::Sound).getMagnitude(); - - float castChance = calcSpellBaseSuccessChance(spell, actor, effectiveSchool) + castBonus; - castChance *= stats.getFatigueTerm(); - if (!cap) return std::max(0.f, castChance); else From 7b8278ae45941226a555a5c9dd4840d9fc57eca1 Mon Sep 17 00:00:00 2001 From: Lennart Bernhardt Date: Tue, 8 Aug 2017 03:17:40 +0200 Subject: [PATCH 272/318] remove redundant mMusicFader variable --- apps/openmw/mwsound/soundmanagerimp.cpp | 3 +-- apps/openmw/mwsound/soundmanagerimp.hpp | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 97030643f..88ee42b01 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -336,10 +336,9 @@ namespace MWSound return; } - mMusicFader = 0.5f; mNextMusic = filename; - mMusic->setFadeout(mMusicFader); + mMusic->setFadeout(0.5f); } void SoundManager::streamMusic(const std::string& filename) diff --git a/apps/openmw/mwsound/soundmanagerimp.hpp b/apps/openmw/mwsound/soundmanagerimp.hpp index 1c5348e65..5d911d4be 100644 --- a/apps/openmw/mwsound/soundmanagerimp.hpp +++ b/apps/openmw/mwsound/soundmanagerimp.hpp @@ -121,7 +121,6 @@ namespace MWSound void updateWaterSound(float duration); void updateMusic(float duration); - float mMusicFader; std::string mNextMusic; float volumeFromType(PlayType type) const; From 546352dbe311a11cbd1e2da9335ef38b9197d59f Mon Sep 17 00:00:00 2001 From: Lennart Bernhardt Date: Tue, 8 Aug 2017 03:31:01 +0200 Subject: [PATCH 273/318] avoid starting sound updates more than necessary --- apps/openmw/mwsound/soundmanagerimp.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 88ee42b01..c6f663059 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -938,6 +938,8 @@ namespace MWSound env ); + updateMusic(duration); + // Check if any sounds are finished playing, and trash them SoundMap::iterator snditer = mActiveSounds.begin(); while(snditer != mActiveSounds.end()) @@ -1048,9 +1050,7 @@ namespace MWSound { mMusic->updateFade(duration); - mOutput->startUpdate(); mOutput->updateStream(mMusic); - mOutput->finishUpdate(); if (mMusic->getRealVolume() <= 0.f) { @@ -1072,7 +1072,6 @@ namespace MWSound updateSounds(duration); updateRegionSound(duration); updateWaterSound(duration); - updateMusic(duration); } } From 6cb3c832488acbcf43b8fecdc1f98da064b29c84 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 8 Aug 2017 20:36:50 +0400 Subject: [PATCH 274/318] Add transparency for interactive messageboxes in game mode --- apps/openmw/mwgui/messagebox.cpp | 2 +- files/mygui/CMakeLists.txt | 1 + ...openmw_interactive_messagebox_notransp.layout | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 files/mygui/openmw_interactive_messagebox_notransp.layout diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp index f8ddeba3e..ab43df0f1 100644 --- a/apps/openmw/mwgui/messagebox.cpp +++ b/apps/openmw/mwgui/messagebox.cpp @@ -196,7 +196,7 @@ namespace MWGui InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector& buttons) - : WindowModal("openmw_interactive_messagebox.layout") + : WindowModal(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "openmw_interactive_messagebox_notransp.layout" : "openmw_interactive_messagebox.layout") , mMessageBoxManager(parMessageBoxManager) , mButtonPressed(-1) { diff --git a/files/mygui/CMakeLists.txt b/files/mygui/CMakeLists.txt index 6592de56e..ed673c5d6 100644 --- a/files/mygui/CMakeLists.txt +++ b/files/mygui/CMakeLists.txt @@ -38,6 +38,7 @@ set(MYGUI_FILES openmw_hud.layout openmw_infobox.layout openmw_interactive_messagebox.layout + openmw_interactive_messagebox_notransp.layout openmw_inventory_window.layout openmw_journal.layout openmw_journal.skin.xml diff --git a/files/mygui/openmw_interactive_messagebox_notransp.layout b/files/mygui/openmw_interactive_messagebox_notransp.layout new file mode 100644 index 000000000..6b79b9417 --- /dev/null +++ b/files/mygui/openmw_interactive_messagebox_notransp.layout @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + From 4cc8afd25da2aca12995c4801a3d034381903972 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 8 Aug 2017 20:38:15 +0400 Subject: [PATCH 275/318] Add transparency for tooltips in game mode --- apps/openmw/mwgui/tooltips.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 1e770a60b..798eb1d6a 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -378,17 +378,11 @@ namespace MWGui { mDynamicToolTipBox->setVisible(true); - if(mShowOwned == 1 || mShowOwned == 3) - { - if(isFocusObject && checkOwned()) - { - mDynamicToolTipBox->changeWidgetSkin("HUD_Box_NoTransp_Owned"); - } - else - { - mDynamicToolTipBox->changeWidgetSkin("HUD_Box_NoTransp"); - } - } + // TODO: apply alpha to "owned" background + if((mShowOwned == 1 || mShowOwned == 3) && isFocusObject && checkOwned()) + mDynamicToolTipBox->changeWidgetSkin("HUD_Box_NoTransp_Owned"); + else + mDynamicToolTipBox->changeWidgetSkin(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "HUD_Box_NoTransp" : "HUD_Box"); std::string caption = info.caption; std::string image = info.icon; From 8c1c80ab9143900e8c527678c92bfe0b62e50481 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 8 Aug 2017 20:39:25 +0400 Subject: [PATCH 276/318] Disable transparency for persuation dialogue menu --- files/mygui/openmw_persuasion_dialog.layout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/mygui/openmw_persuasion_dialog.layout b/files/mygui/openmw_persuasion_dialog.layout index d9a673ec2..c66f9d0ad 100644 --- a/files/mygui/openmw_persuasion_dialog.layout +++ b/files/mygui/openmw_persuasion_dialog.layout @@ -1,7 +1,7 @@ - + From 56f5a5dee385eb2d1c3c97439d81447ba0885a07 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 8 Aug 2017 22:57:39 +0400 Subject: [PATCH 277/318] Added transparency to 'owned' tooltip --- apps/openmw/mwgui/tooltips.cpp | 3 +-- files/mygui/openmw_hud_box.skin.xml | 12 ++++++++++++ files/mygui/openmw_windows.skin.xml | 9 ++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 798eb1d6a..81a3d864c 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -378,9 +378,8 @@ namespace MWGui { mDynamicToolTipBox->setVisible(true); - // TODO: apply alpha to "owned" background if((mShowOwned == 1 || mShowOwned == 3) && isFocusObject && checkOwned()) - mDynamicToolTipBox->changeWidgetSkin("HUD_Box_NoTransp_Owned"); + mDynamicToolTipBox->changeWidgetSkin(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "HUD_Box_NoTransp_Owned" : "HUD_Box_Owned"); else mDynamicToolTipBox->changeWidgetSkin(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "HUD_Box_NoTransp" : "HUD_Box"); diff --git a/files/mygui/openmw_hud_box.skin.xml b/files/mygui/openmw_hud_box.skin.xml index 33199d6ae..e53493bb1 100644 --- a/files/mygui/openmw_hud_box.skin.xml +++ b/files/mygui/openmw_hud_box.skin.xml @@ -36,6 +36,18 @@ + + + + + + + + + + + + diff --git a/files/mygui/openmw_windows.skin.xml b/files/mygui/openmw_windows.skin.xml index 00e6f9148..a272ae84a 100644 --- a/files/mygui/openmw_windows.skin.xml +++ b/files/mygui/openmw_windows.skin.xml @@ -158,13 +158,20 @@ - + + + + + + + + From f41a4bb93794de0e76665486ec13a06a589785f7 Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Wed, 9 Aug 2017 00:20:49 -0500 Subject: [PATCH 278/318] Changing "New Installation" to "Retail CD/DVD" for clarity --- apps/wizard/componentselectionpage.cpp | 7 +++---- apps/wizard/conclusionpage.cpp | 6 +++--- apps/wizard/installationpage.cpp | 7 +++---- apps/wizard/languageselectionpage.cpp | 2 +- apps/wizard/mainwizard.cpp | 5 ++--- apps/wizard/methodselectionpage.cpp | 7 +++---- files/ui/wizard/methodselectionpage.ui | 18 +++++++++--------- 7 files changed, 24 insertions(+), 28 deletions(-) diff --git a/apps/wizard/componentselectionpage.cpp b/apps/wizard/componentselectionpage.cpp index 161e51515..d99884966 100644 --- a/apps/wizard/componentselectionpage.cpp +++ b/apps/wizard/componentselectionpage.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include "mainwizard.hpp" @@ -26,7 +25,7 @@ Wizard::ComponentSelectionPage::ComponentSelectionPage(QWidget *parent) : void Wizard::ComponentSelectionPage::updateButton(QListWidgetItem*) { - if (field(QLatin1String("installation.new")).toBool() == true) + if (field(QLatin1String("installation.retailDisc")).toBool() == true) return; // Morrowind is always checked here bool unchecked = true; @@ -60,7 +59,7 @@ void Wizard::ComponentSelectionPage::initializePage() QListWidgetItem *tribunalItem = new QListWidgetItem(QLatin1String("Tribunal")); QListWidgetItem *bloodmoonItem = new QListWidgetItem(QLatin1String("Bloodmoon")); - if (field(QLatin1String("installation.new")).toBool() == true) + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { morrowindItem->setFlags((morrowindItem->flags() & ~Qt::ItemIsEnabled) | Qt::ItemIsUserCheckable); morrowindItem->setData(Qt::CheckStateRole, Qt::Checked); @@ -117,7 +116,7 @@ bool Wizard::ComponentSelectionPage::validatePage() // qDebug() << components << path << mWizard->mInstallations[path]; - if (field(QLatin1String("installation.new")).toBool() == false) { + if (field(QLatin1String("installation.retailDisc")).toBool() == false) { if (components.contains(QLatin1String("Tribunal")) && !components.contains(QLatin1String("Bloodmoon"))) { if (mWizard->mInstallations[path].hasBloodmoon) diff --git a/apps/wizard/conclusionpage.cpp b/apps/wizard/conclusionpage.cpp index 87154732a..f6a6015b8 100644 --- a/apps/wizard/conclusionpage.cpp +++ b/apps/wizard/conclusionpage.cpp @@ -16,14 +16,14 @@ Wizard::ConclusionPage::ConclusionPage(QWidget *parent) : void Wizard::ConclusionPage::initializePage() { // Write the path to openmw.cfg - if (field(QLatin1String("installation.new")).toBool() == true) { + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { QString path(field(QLatin1String("installation.path")).toString()); mWizard->addInstallation(path); } if (!mWizard->mError) { - if ((field(QLatin1String("installation.new")).toBool() == true) + if ((field(QLatin1String("installation.retailDisc")).toBool() == true) || (field(QLatin1String("installation.import-settings")).toBool() == true)) { qDebug() << "IMPORT SETTINGS"; @@ -33,7 +33,7 @@ void Wizard::ConclusionPage::initializePage() if (!mWizard->mError) { - if (field(QLatin1String("installation.new")).toBool() == true) + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { textLabel->setText(tr("

The OpenMW Wizard successfully installed Morrowind on your computer.

\

Click Finish to close the Wizard.

")); diff --git a/apps/wizard/installationpage.cpp b/apps/wizard/installationpage.cpp index 2f0af88c9..7a4dcbf10 100644 --- a/apps/wizard/installationpage.cpp +++ b/apps/wizard/installationpage.cpp @@ -7,7 +7,6 @@ #include #include "mainwizard.hpp" -#include "inisettings.hpp" Wizard::InstallationPage::InstallationPage(QWidget *parent) : QWizardPage(parent) @@ -76,7 +75,7 @@ void Wizard::InstallationPage::initializePage() // That way installing all three components would yield 300% // When one component is done the bar will be filled by 33% - if (field(QLatin1String("installation.new")).toBool() == true) { + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { installProgressBar->setMaximum((components.count() * 100)); } else { if (components.contains(QLatin1String("Tribunal")) @@ -96,7 +95,7 @@ void Wizard::InstallationPage::startInstallation() QStringList components(field(QLatin1String("installation.components")).toStringList()); QString path(field(QLatin1String("installation.path")).toString()); - if (field(QLatin1String("installation.new")).toBool() == true) + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { // Always install Morrowind mUnshield->setInstallComponent(Wizard::Component_Morrowind, true); @@ -227,7 +226,7 @@ bool Wizard::InstallationPage::isComplete() const int Wizard::InstallationPage::nextId() const { - if (field(QLatin1String("installation.new")).toBool() == true) { + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { return MainWizard::Page_Conclusion; } else { if (!mWizard->mError) { diff --git a/apps/wizard/languageselectionpage.cpp b/apps/wizard/languageselectionpage.cpp index 0d5132f5b..4c10bf38c 100644 --- a/apps/wizard/languageselectionpage.cpp +++ b/apps/wizard/languageselectionpage.cpp @@ -30,7 +30,7 @@ void Wizard::LanguageSelectionPage::initializePage() int Wizard::LanguageSelectionPage::nextId() const { - if (field(QLatin1String("installation.new")).toBool() == true) { + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { return MainWizard::Page_ComponentSelection; } else { QString path(field(QLatin1String("installation.path")).toString()); diff --git a/apps/wizard/mainwizard.cpp b/apps/wizard/mainwizard.cpp index 7ef8761dd..b99f151aa 100644 --- a/apps/wizard/mainwizard.cpp +++ b/apps/wizard/mainwizard.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -258,7 +257,7 @@ void Wizard::MainWizard::runSettingsImporter() QStringList arguments; // Import plugin selection? - if (field(QLatin1String("installation.new")).toBool() == true + if (field(QLatin1String("installation.retailDisc")).toBool() == true || field(QLatin1String("installation.import-addons")).toBool() == true) arguments.append(QLatin1String("--game-files")); @@ -278,7 +277,7 @@ void Wizard::MainWizard::runSettingsImporter() // Now the paths arguments.append(QLatin1String("--ini")); - if (field(QLatin1String("installation.new")).toBool() == true) { + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { arguments.append(path + QDir::separator() + QLatin1String("Morrowind.ini")); } else { arguments.append(mInstallations[path].iniPath); diff --git a/apps/wizard/methodselectionpage.cpp b/apps/wizard/methodselectionpage.cpp index 5f3917bd5..e00344af9 100644 --- a/apps/wizard/methodselectionpage.cpp +++ b/apps/wizard/methodselectionpage.cpp @@ -1,5 +1,4 @@ #include "methodselectionpage.hpp" -#include #include "mainwizard.hpp" Wizard::MethodSelectionPage::MethodSelectionPage(QWidget *parent) : @@ -10,16 +9,16 @@ Wizard::MethodSelectionPage::MethodSelectionPage(QWidget *parent) : setupUi(this); #ifndef OPENMW_USE_UNSHIELD - newLocationRadioButton->setEnabled(false); + retailDiscRadioButton->setEnabled(false); existingLocationRadioButton->setChecked(true); #endif - registerField(QLatin1String("installation.new"), newLocationRadioButton); + registerField(QLatin1String("installation.retailDisc"), retailDiscRadioButton); } int Wizard::MethodSelectionPage::nextId() const { - if (field(QLatin1String("installation.new")).toBool() == true) { + if (field(QLatin1String("installation.retailDisc")).toBool() == true) { return MainWizard::Page_InstallationTarget; } else { return MainWizard::Page_ExistingInstallation; diff --git a/files/ui/wizard/methodselectionpage.ui b/files/ui/wizard/methodselectionpage.ui index 531d093af..4d4d66bad 100644 --- a/files/ui/wizard/methodselectionpage.ui +++ b/files/ui/wizard/methodselectionpage.ui @@ -17,16 +17,16 @@ Select Installation Method
- Select how OpenMW should get the required Morrowind installation files. + <html><head/><body><p>Select how you would like to install <i>The Elder Scrolls III: Morrowind</i>.</p></body></html> - + font-weight:bold; - Install Morrowind to a new location + Retail CD/DVD true @@ -34,7 +34,7 @@ - + @@ -72,14 +72,14 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - newLocationRadioButton + retailDiscRadioButton
- + - Install Morrowind from a retail disk to a new location for OpenMW to use. + Install from a retail disc to a new location. true @@ -94,7 +94,7 @@ font-weight:bold - Select an existing Morrowind installation + Existing Installation @@ -138,7 +138,7 @@ - Select an existing Morrowind installation for OpenMW to use. + Select an existing installation. true From 464c64a306bb79ca76fc0bdc3de0324e6982c37a Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Wed, 9 Aug 2017 20:03:27 -0500 Subject: [PATCH 279/318] Swap the OIS Ctrl and Meta keys on macOS to match Qt --- components/sdlutil/sdlinputwrapper.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index ac172b84b..f622f2166 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -1,7 +1,6 @@ #include "sdlinputwrapper.hpp" #include -#include #include @@ -423,7 +422,6 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v mKeyMap.insert( KeyMap::value_type(SDLK_o, OIS::KC_O) ); mKeyMap.insert( KeyMap::value_type(SDLK_p, OIS::KC_P) ); mKeyMap.insert( KeyMap::value_type(SDLK_RETURN, OIS::KC_RETURN) ); - mKeyMap.insert( KeyMap::value_type(SDLK_LCTRL, OIS::KC_LCONTROL)); mKeyMap.insert( KeyMap::value_type(SDLK_a, OIS::KC_A) ); mKeyMap.insert( KeyMap::value_type(SDLK_s, OIS::KC_S) ); mKeyMap.insert( KeyMap::value_type(SDLK_d, OIS::KC_D) ); @@ -499,9 +497,19 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v mKeyMap.insert( KeyMap::value_type(SDLK_INSERT, OIS::KC_INSERT) ); mKeyMap.insert( KeyMap::value_type(SDLK_DELETE, OIS::KC_DELETE) ); mKeyMap.insert( KeyMap::value_type(SDLK_KP_ENTER, OIS::KC_NUMPADENTER) ); - mKeyMap.insert( KeyMap::value_type(SDLK_RCTRL, OIS::KC_RCONTROL) ); + mKeyMap.insert( KeyMap::value_type(SDLK_APPLICATION, OIS::KC_APPS) ); + +//Qt switches the Ctrl and Meta keys on macOS. See http://doc.qt.io/qt-5/qkeysequence.html +#if defined(__APPLE__) + mKeyMap.insert( KeyMap::value_type(SDLK_LGUI, OIS::KC_LCONTROL) ); + mKeyMap.insert( KeyMap::value_type(SDLK_RGUI, OIS::KC_RCONTROL) ); + mKeyMap.insert( KeyMap::value_type(SDLK_LCTRL, OIS::KC_LWIN)); + mKeyMap.insert( KeyMap::value_type(SDLK_RCTRL, OIS::KC_RWIN) ); +#else mKeyMap.insert( KeyMap::value_type(SDLK_LGUI, OIS::KC_LWIN) ); mKeyMap.insert( KeyMap::value_type(SDLK_RGUI, OIS::KC_RWIN) ); - mKeyMap.insert( KeyMap::value_type(SDLK_APPLICATION, OIS::KC_APPS) ); + mKeyMap.insert( KeyMap::value_type(SDLK_LCTRL, OIS::KC_LCONTROL)); + mKeyMap.insert( KeyMap::value_type(SDLK_RCTRL, OIS::KC_RCONTROL) ); +#endif } } From 54fe6457031080a806985c6d41d5bc5a9ac0bda7 Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Wed, 9 Aug 2017 23:12:43 -0500 Subject: [PATCH 280/318] Removing erroneous comment since Qt is not relevant here --- components/sdlutil/sdlinputwrapper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index f622f2166..a76de00d1 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -499,7 +499,8 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v mKeyMap.insert( KeyMap::value_type(SDLK_KP_ENTER, OIS::KC_NUMPADENTER) ); mKeyMap.insert( KeyMap::value_type(SDLK_APPLICATION, OIS::KC_APPS) ); -//Qt switches the Ctrl and Meta keys on macOS. See http://doc.qt.io/qt-5/qkeysequence.html +//The function of the Ctrl and Meta keys are switched on macOS compared to other platforms. +//For instance, Cmd+C versus Ctrl+C to copy from the system clipboard #if defined(__APPLE__) mKeyMap.insert( KeyMap::value_type(SDLK_LGUI, OIS::KC_LCONTROL) ); mKeyMap.insert( KeyMap::value_type(SDLK_RGUI, OIS::KC_RCONTROL) ); From e4df17ccafbdfe897bcd9ef912a9467594ca8b93 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 11 Aug 2017 09:02:50 +0400 Subject: [PATCH 281/318] Make inventory avatar to fit within border (bug #4003) --- files/mygui/openmw_inventory_window.layout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/mygui/openmw_inventory_window.layout b/files/mygui/openmw_inventory_window.layout index 09e5ed9c7..bb707fa0d 100644 --- a/files/mygui/openmw_inventory_window.layout +++ b/files/mygui/openmw_inventory_window.layout @@ -12,7 +12,7 @@ - + From c542ae6875c8e913f8824cdc4fca303d0e893b45 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 12 Aug 2017 09:06:31 +0400 Subject: [PATCH 282/318] Create autosave when waiting (bug #1452) --- apps/openmw/mwgui/waitdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp index 8685475a4..ba58a9c69 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -134,7 +134,7 @@ namespace MWGui void WaitDialog::startWaiting(int hoursToWait) { - if(Settings::Manager::getBool("autosave","Saves") && mSleeping) //autosaves when enabled and sleeping + if(Settings::Manager::getBool("autosave","Saves")) //autosaves when enabled MWBase::Environment::get().getStateManager()->quickSave("Autosave"); MWBase::World* world = MWBase::Environment::get().getWorld(); From b3b7d6aa9f48fb4924737b8b682219e26db5957b Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 12 Aug 2017 09:36:09 +0400 Subject: [PATCH 283/318] Do not make target reference unavailable on cell change (bug #3898) --- apps/openmw/mwgui/referenceinterface.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/referenceinterface.cpp b/apps/openmw/mwgui/referenceinterface.cpp index 76bb4f53f..9aaa98f19 100644 --- a/apps/openmw/mwgui/referenceinterface.cpp +++ b/apps/openmw/mwgui/referenceinterface.cpp @@ -20,9 +20,8 @@ namespace MWGui { MWWorld::CellStore* playerCell = MWMechanics::getPlayer().getCell(); - // check if player has changed cell, or count of the reference has become 0 - if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL) - || (!mPtr.isEmpty() && mPtr.getRefData().getCount() == 0)) + // check if count of the reference has become 0 + if (!mPtr.isEmpty() && mPtr.getRefData().getCount() == 0) { if (!mPtr.isEmpty()) { From 3f159960b7f430b6e8ecc6e0ac2da4d1a348ecac Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 12 Aug 2017 21:18:05 +0400 Subject: [PATCH 284/318] Restored pickpocket and werewolf check --- apps/openmw/mwclass/npc.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index ed1f12b31..ca6c85aba 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -885,6 +885,14 @@ namespace MWClass if(stats.getAiSequence().isInCombat()) return std::shared_ptr(new MWWorld::FailedAction("")); + if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak) + || ptr.getClass().getCreatureStats(ptr).getKnockedDown()) + return std::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing + + // Can't talk to werewolfs + if(ptr.getClass().isNpc() && ptr.getClass().getNpcStats(ptr).isWerewolf()) + return std::shared_ptr (new MWWorld::FailedAction("")); + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); } From 249c1ae95a6c70acd2f2b13af9a5bb863e6044f1 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sun, 13 Aug 2017 19:26:32 -0400 Subject: [PATCH 285/318] Fix orbit camera jumping back to old position --- apps/opencs/view/render/scenewidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index 82eebf127..3a801ffc3 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -393,6 +393,7 @@ void SceneWidget::selectNavigationMode (const std::string& mode) mCurrentCamControl->setCamera(NULL); mCurrentCamControl = mOrbitCamControl; mOrbitCamControl->setCamera(getCamera()); + mOrbitCamControl->reset(); } } From f84eb68b3d1e173b84c41618ebe21e0dbe474f9d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 14 Aug 2017 10:41:37 +0400 Subject: [PATCH 286/318] Confiscate an item when you try to sell it to its owner (bug #3944) --- apps/openmw/mwbase/mechanicsmanager.hpp | 2 + apps/openmw/mwgui/tradewindow.cpp | 6 +-- .../mwmechanics/mechanicsmanagerimp.cpp | 37 +++++++++++++++++++ .../mwmechanics/mechanicsmanagerimp.hpp | 2 + 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp index bd0d2ea4a..9cb004107 100644 --- a/apps/openmw/mwbase/mechanicsmanager.hpp +++ b/apps/openmw/mwbase/mechanicsmanager.hpp @@ -241,6 +241,8 @@ namespace MWBase virtual void applyWerewolfAcrobatics(const MWWorld::Ptr& actor) = 0; virtual void cleanupSummonedCreature(const MWWorld::Ptr& caster, int creatureActorId) = 0; + + virtual void confiscateStolenItemToOwner(const MWWorld::Ptr &player, const MWWorld::Ptr &item, const MWWorld::Ptr& victim, int count) = 0; }; } diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index f82d2f68d..ca0bb48e8 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -311,9 +311,9 @@ namespace MWGui if (msg.find("%s") != std::string::npos) msg.replace(msg.find("%s"), 2, it->mBase.getClass().getName(it->mBase)); MWBase::Environment::get().getWindowManager()->messageBox(msg); - MWBase::Environment::get().getMechanicsManager()->commitCrime(player, mPtr, MWBase::MechanicsManager::OT_Theft, - it->mBase.getClass().getValue(it->mBase) - * it->mCount, true); + + MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, it->mBase, mPtr, it->mCount); + onCancelButtonClicked(mCancelButton); MWBase::Environment::get().getDialogueManager()->goodbyeSelected(); return; diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 8460a1473..b174e87cd 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -907,6 +907,43 @@ namespace MWMechanics return ownerFound != owners.end(); } + void MechanicsManager::confiscateStolenItemToOwner(const MWWorld::Ptr &player, const MWWorld::Ptr &item, const MWWorld::Ptr& victim, int count) + { + if (player != getPlayer()) + return; + + const std::string itemId = Misc::StringUtils::lowerCase(item.getCellRef().getRefId()); + + StolenItemsMap::iterator stolenIt = mStolenItems.find(itemId); + if (stolenIt == mStolenItems.end()) + return; + + Owner owner; + owner.first = victim.getCellRef().getRefId(); + owner.second = false; + + Misc::StringUtils::lowerCaseInPlace(owner.first); + + // decrease count of stolen items + int toRemove = std::min(count, mStolenItems[itemId][owner]); + mStolenItems[itemId][owner] -= toRemove; + if (mStolenItems[itemId][owner] == 0) + { + // erase owner from stolen items owners + OwnerMap& owners = stolenIt->second; + OwnerMap::iterator ownersIt = owners.find(owner); + if (ownersIt != owners.end()) + owners.erase(ownersIt); + } + + MWWorld::ContainerStore& store = player.getClass().getContainerStore(player); + + // move items from player to owner and report about theft + victim.getClass().getContainerStore(victim).add(item, toRemove, victim); + store.remove(item, toRemove, player); + commitCrime(player, victim, OT_Theft, item.getClass().getValue(item) * toRemove); + } + void MechanicsManager::confiscateStolenItems(const MWWorld::Ptr &player, const MWWorld::Ptr &targetContainer) { MWWorld::ContainerStore& store = player.getClass().getContainerStore(player); diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp index ed06f58c5..a5598252f 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp @@ -206,6 +206,8 @@ namespace MWMechanics virtual void cleanupSummonedCreature(const MWWorld::Ptr& caster, int creatureActorId); + virtual void confiscateStolenItemToOwner(const MWWorld::Ptr &player, const MWWorld::Ptr &item, const MWWorld::Ptr& victim, int count); + private: void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, OffenseType type, int arg=0); From 7a5645b35d8ae2ff3ecf15efc0eddcccfaf271aa Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 14 Aug 2017 18:42:19 +0400 Subject: [PATCH 287/318] Prevent followers from attacking player if crime was reported --- .../mwmechanics/mechanicsmanagerimp.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 8460a1473..e5f1d73dc 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1030,11 +1030,6 @@ namespace MWMechanics if (playerFollowers.find(*it) != playerFollowers.end()) continue; - if (type == OT_Theft || type == OT_Pickpocket) - MWBase::Environment::get().getDialogueManager()->say(*it, "thief"); - else if (type == OT_Trespassing) - MWBase::Environment::get().getDialogueManager()->say(*it, "intruder"); - crimeSeen = true; } } @@ -1136,10 +1131,25 @@ namespace MWMechanics if (it->getClass().getCreatureStats(*it).getAiSequence().isInCombat(victim)) continue; + // Player's followers should not attack player, or try to arrest him + if (it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdFollow)) + { + std::set playerFollowers; + getActorsSidingWith(player, playerFollowers); + + if (playerFollowers.find(*it) != playerFollowers.end()) + continue; + } + // Will the witness report the crime? if (it->getClass().getCreatureStats(*it).getAiSetting(CreatureStats::AI_Alarm).getBase() >= 100) { reported = true; + + if (type == OT_Theft || type == OT_Pickpocket) + MWBase::Environment::get().getDialogueManager()->say(*it, "thief"); + else if (type == OT_Trespassing) + MWBase::Environment::get().getDialogueManager()->say(*it, "intruder"); } if (it->getClass().isClass(*it, "guard")) @@ -1153,16 +1163,6 @@ namespace MWMechanics if (!it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) { - // Player's followers should not try to arrest player - if (it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdFollow)) - { - std::set playerFollowers; - getActorsSidingWith(player, playerFollowers); - - if (playerFollowers.find(*it) != playerFollowers.end()) - continue; - } - it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it); } } From ec640341608b0b68c1fe47a1900ae4b125449d6e Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 14 Aug 2017 19:29:34 +0400 Subject: [PATCH 288/318] Confiscate stolen item/gem when enchanting --- apps/openmw/mwgui/enchantingdialog.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index 643b69532..c7d2ef7de 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -360,8 +360,9 @@ namespace MWGui if (msg.find("%s") != std::string::npos) msg.replace(msg.find("%s"), 2, item.getClass().getName(item)); MWBase::Environment::get().getWindowManager()->messageBox(msg); - MWBase::Environment::get().getMechanicsManager()->commitCrime(player, mPtr, MWBase::MechanicsManager::OT_Theft, - item.getClass().getValue(item), true); + + MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, item, mPtr, 1); + MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting); MWBase::Environment::get().getDialogueManager()->goodbyeSelected(); return; From 1e983604db7c5e6ec2f1a129cf0281044b763cb5 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 14 Aug 2017 20:39:04 +0400 Subject: [PATCH 289/318] Dispel only effects from spells (bug #3995) --- apps/openmw/mwmechanics/activespells.cpp | 15 ++++++++++++++- apps/openmw/mwmechanics/activespells.hpp | 2 +- apps/openmw/mwmechanics/spellcasting.cpp | 2 +- apps/openmw/mwmechanics/spellpriority.cpp | 8 ++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index 52c05fdfa..90d29f686 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -222,10 +222,23 @@ namespace MWMechanics } } - void ActiveSpells::purgeAll(float chance) + void ActiveSpells::purgeAll(float chance, bool spellOnly) { for (TContainer::iterator it = mSpells.begin(); it != mSpells.end(); ) { + const std::string spellId = it->first; + + // if spellOnly is true, dispell only spells. Leave potions, enchanted items etc. + if (spellOnly) + { + const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().search(spellId); + if (!spell || spell->mData.mType != ESM::Spell::ST_Spell) + { + ++it; + continue; + } + } + if (Misc::Rng::roll0to99() < chance) mSpells.erase(it++); else diff --git a/apps/openmw/mwmechanics/activespells.hpp b/apps/openmw/mwmechanics/activespells.hpp index 0f1f803b7..a19c8a51d 100644 --- a/apps/openmw/mwmechanics/activespells.hpp +++ b/apps/openmw/mwmechanics/activespells.hpp @@ -89,7 +89,7 @@ namespace MWMechanics void purgeEffect (short effectId, const std::string& sourceId); /// Remove all active effects, if roll succeeds (for each effect) - void purgeAll (float chance); + void purgeAll(float chance, bool spellOnly = false); /// Remove all effects with CASTER_LINKED flag that were cast by \a casterActorId void purge (int casterActorId); diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index ecd4ba48a..f7ee15bf4 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -673,7 +673,7 @@ namespace MWMechanics } else if (target.getClass().isActor() && effectId == ESM::MagicEffect::Dispel) { - target.getClass().getCreatureStats(target).getActiveSpells().purgeAll(magnitude); + target.getClass().getCreatureStats(target).getActiveSpells().purgeAll(magnitude, true); return true; } else if (target.getClass().isActor() && target == getPlayer()) diff --git a/apps/openmw/mwmechanics/spellpriority.cpp b/apps/openmw/mwmechanics/spellpriority.cpp index a73e4fd89..0b86b9494 100644 --- a/apps/openmw/mwmechanics/spellpriority.cpp +++ b/apps/openmw/mwmechanics/spellpriority.cpp @@ -25,6 +25,14 @@ namespace const MWMechanics::ActiveSpells& activeSpells = actor.getClass().getCreatureStats(actor).getActiveSpells(); for (MWMechanics::ActiveSpells::TIterator it = activeSpells.begin(); it != activeSpells.end(); ++it) { + // if the effect filter is not specified, take in account only spells effects. Leave potions, enchanted items etc. + if (effectFilter == -1) + { + const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().search(it->first); + if (!spell || spell->mData.mType != ESM::Spell::ST_Spell) + continue; + } + const MWMechanics::ActiveSpells::ActiveSpellParams& params = it->second; for (std::vector::const_iterator effectIt = params.mEffects.begin(); effectIt != params.mEffects.end(); ++effectIt) From 67d59bead51ce4948c0e0256ee014bdab3bc8b5f Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 16 Aug 2017 15:03:04 +0400 Subject: [PATCH 290/318] Get only text from input fields (bug #4025) --- apps/openmw/mwgui/alchemywindow.cpp | 2 +- apps/openmw/mwgui/class.cpp | 2 +- apps/openmw/mwgui/enchantingdialog.cpp | 5 +++-- apps/openmw/mwgui/enchantingdialog.hpp | 2 +- apps/openmw/mwgui/savegamedialog.cpp | 4 ++-- apps/openmw/mwgui/spellcreationdialog.cpp | 4 ++-- apps/openmw/mwgui/textinput.cpp | 4 ++-- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 7379f3613..95dc8cc4d 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -64,7 +64,7 @@ namespace MWGui void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender) { - MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getCaption ()); + MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getOnlyText()); MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager(); switch (result) diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index e1f5a165e..ac61041c3 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -483,7 +483,7 @@ namespace MWGui std::string CreateClassDialog::getName() const { - return mEditName->getCaption(); + return mEditName->getOnlyText(); } std::string CreateClassDialog::getDescription() const diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index c7d2ef7de..5dc1f3454 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -312,7 +313,7 @@ namespace MWGui return; } - if (mName->getCaption ().empty()) + if (mName->getOnlyText().empty()) { MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage10}"); return; @@ -336,7 +337,7 @@ namespace MWGui return; } - mEnchanting.setNewItemName(mName->getCaption()); + mEnchanting.setNewItemName(mName->getOnlyText()); mEnchanting.setEffect(mEffectList); MWWorld::Ptr player = MWMechanics::getPlayer(); diff --git a/apps/openmw/mwgui/enchantingdialog.hpp b/apps/openmw/mwgui/enchantingdialog.hpp index cb7c6c0d0..6391f8597 100644 --- a/apps/openmw/mwgui/enchantingdialog.hpp +++ b/apps/openmw/mwgui/enchantingdialog.hpp @@ -58,7 +58,7 @@ namespace MWGui MyGUI::Button* mTypeButton; MyGUI::Button* mBuyButton; - MyGUI::TextBox* mName; + MyGUI::EditBox* mName; MyGUI::TextBox* mEnchantmentPoints; MyGUI::TextBox* mCastCost; MyGUI::TextBox* mCharge; diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index 84d4ca959..4d1a490aa 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -248,7 +248,7 @@ namespace MWGui dialog->eventCancelClicked.clear(); return; } - if (mSaveNameEdit->getCaption().empty()) + if (mSaveNameEdit->getOnlyText().empty()) { MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage65}"); return; @@ -275,7 +275,7 @@ namespace MWGui if (mSaving) { - MWBase::Environment::get().getStateManager()->saveGame (mSaveNameEdit->getCaption(), mCurrentSlot); + MWBase::Environment::get().getStateManager()->saveGame (mSaveNameEdit->getOnlyText(), mCurrentSlot); } else { diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 354253fa4..cd2d2cd1d 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -373,7 +373,7 @@ namespace MWGui return; } - if (mNameEdit->getCaption () == "") + if (mNameEdit->getOnlyText() == "") { MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage10}"); return; @@ -394,7 +394,7 @@ namespace MWGui return; } - mSpell.mName = mNameEdit->getCaption(); + mSpell.mName = mNameEdit->getOnlyText(); int price = MyGUI::utility::parseInt(mPriceLabel->getCaption()); diff --git a/apps/openmw/mwgui/textinput.cpp b/apps/openmw/mwgui/textinput.cpp index 958b52dc0..9ddfac612 100644 --- a/apps/openmw/mwgui/textinput.cpp +++ b/apps/openmw/mwgui/textinput.cpp @@ -53,7 +53,7 @@ namespace MWGui void TextInputDialog::onOkClicked(MyGUI::Widget* _sender) { - if (mTextEdit->getCaption() == "") + if (mTextEdit->getOnlyText() == "") { MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage37}"); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget (mTextEdit); @@ -69,7 +69,7 @@ namespace MWGui std::string TextInputDialog::getTextInput() const { - return mTextEdit->getCaption(); + return mTextEdit->getOnlyText(); } void TextInputDialog::setTextInput(const std::string &text) From bc7353f100f1bdfbce0630da949bf25906771cde Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 16 Aug 2017 20:30:47 +0400 Subject: [PATCH 291/318] Check animation state for GetPCRunning and GetPCSneaking --- apps/openmw/mwbase/mechanicsmanager.hpp | 5 ++++- apps/openmw/mwmechanics/actors.cpp | 20 +++++++++++++++++++ apps/openmw/mwmechanics/actors.hpp | 3 +++ apps/openmw/mwmechanics/character.cpp | 16 +++++++++++++-- apps/openmw/mwmechanics/character.hpp | 1 + .../mwmechanics/mechanicsmanagerimp.cpp | 10 ++++++++++ .../mwmechanics/mechanicsmanagerimp.hpp | 4 +++- apps/openmw/mwscript/controlextensions.cpp | 16 ++++++++++++--- 8 files changed, 68 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp index 9cb004107..2daaf9711 100644 --- a/apps/openmw/mwbase/mechanicsmanager.hpp +++ b/apps/openmw/mwbase/mechanicsmanager.hpp @@ -230,7 +230,7 @@ namespace MWBase /// Has the player stolen this item from the given owner? virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid) = 0; - + virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim) = 0; /// Turn actor into werewolf or normal form. @@ -243,6 +243,9 @@ namespace MWBase virtual void cleanupSummonedCreature(const MWWorld::Ptr& caster, int creatureActorId) = 0; virtual void confiscateStolenItemToOwner(const MWWorld::Ptr &player, const MWWorld::Ptr &item, const MWWorld::Ptr& victim, int count) = 0; + + virtual bool isRunning(const MWWorld::Ptr& ptr) = 0; + virtual bool isSneaking(const MWWorld::Ptr& ptr) = 0; }; } diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 00f8899de..9a23526f7 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -802,6 +802,26 @@ namespace MWMechanics } } + bool Actors::isRunning(const MWWorld::Ptr& ptr) + { + PtrActorMap::iterator it = mActors.find(ptr); + if (it == mActors.end()) + return false; + CharacterController* ctrl = it->second->getCharacterController(); + + return ctrl->isRunning(); + } + + bool Actors::isSneaking(const MWWorld::Ptr& ptr) + { + PtrActorMap::iterator it = mActors.find(ptr); + if (it == mActors.end()) + return false; + CharacterController* ctrl = it->second->getCharacterController(); + + return ctrl->isSneaking(); + } + void Actors::updateDrowning(const MWWorld::Ptr& ptr, float duration) { PtrActorMap::iterator it = mActors.find(ptr); diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index 362c2f126..cd949696b 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -107,6 +107,9 @@ namespace MWMechanics int countDeaths (const std::string& id) const; ///< Return the number of deaths for actors with the given ID. + bool isRunning(const MWWorld::Ptr& ptr); + bool isSneaking(const MWWorld::Ptr& ptr); + void forceStateUpdate(const MWWorld::Ptr &ptr); bool playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number, bool persist=false); diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 661df35b0..25d04d176 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1650,7 +1650,7 @@ void CharacterController::update(float duration) mSecondsOfSwimming -= 1; } } - else if(isrunning) + else if(isrunning && !sneak) { mSecondsOfRunning += duration; while(mSecondsOfRunning > 1) @@ -1688,7 +1688,7 @@ void CharacterController::update(float duration) else fatigueLoss = fFatigueSwimRunBase + encumbrance * fFatigueSwimRunMult; } - if (isrunning) + else if (isrunning) fatigueLoss = fFatigueRunBase + encumbrance * fFatigueRunMult; } } @@ -2237,6 +2237,18 @@ bool CharacterController::isSneaking() const mMovementState == CharState_SneakRight; } +bool CharacterController::isRunning() const +{ + return mMovementState == CharState_RunForward || + mMovementState == CharState_RunBack || + mMovementState == CharState_RunLeft || + mMovementState == CharState_RunRight || + mMovementState == CharState_SwimRunForward || + mMovementState == CharState_SwimRunBack || + mMovementState == CharState_SwimRunLeft || + mMovementState == CharState_SwimRunRight; +} + void CharacterController::setAttackingOrSpell(bool attackingOrSpell) { mAttackingOrSpell = attackingOrSpell; diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index a3cdf097d..66039bf5d 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -266,6 +266,7 @@ public: bool isReadyToBlock() const; bool isKnockedOut() const; bool isSneaking() const; + bool isRunning() const; void setAttackingOrSpell(bool attackingOrSpell); void setAIAttackType(const std::string& attackType); diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index f4b4cec91..d182e40d7 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -422,6 +422,16 @@ namespace MWMechanics mObjects.update(duration, paused); } + bool MechanicsManager::isRunning(const MWWorld::Ptr& ptr) + { + return mActors.isRunning(ptr); + } + + bool MechanicsManager::isSneaking(const MWWorld::Ptr& ptr) + { + return mActors.isSneaking(ptr); + } + void MechanicsManager::rest(bool sleep) { mActors.rest(sleep); diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp index a5598252f..af0377a33 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp @@ -197,7 +197,7 @@ namespace MWMechanics /// Has the player stolen this item from the given owner? virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid); - + /// @return is \a ptr allowed to take/use \a cellref or is it a crime? virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim); @@ -208,6 +208,8 @@ namespace MWMechanics virtual void confiscateStolenItemToOwner(const MWWorld::Ptr &player, const MWWorld::Ptr &item, const MWWorld::Ptr& victim, int count); + virtual bool isRunning(const MWWorld::Ptr& ptr); + virtual bool isSneaking(const MWWorld::Ptr& ptr); private: void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim, OffenseType type, int arg=0); diff --git a/apps/openmw/mwscript/controlextensions.cpp b/apps/openmw/mwscript/controlextensions.cpp index 626fafb5a..21b3b5587 100644 --- a/apps/openmw/mwscript/controlextensions.cpp +++ b/apps/openmw/mwscript/controlextensions.cpp @@ -9,12 +9,14 @@ #include "../mwbase/environment.hpp" #include "../mwbase/inputmanager.hpp" +#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/world.hpp" #include "../mwworld/class.hpp" #include "../mwworld/ptr.hpp" #include "../mwmechanics/npcstats.hpp" +#include "../mwmechanics/movement.hpp" #include "interpretercontext.hpp" #include "ref.hpp" @@ -167,7 +169,11 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - runtime.push (ptr.getClass().getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Run)); + const MWWorld::Class &cls = ptr.getClass(); + + bool isRunning = MWBase::Environment::get().getMechanicsManager()->isRunning(ptr); + + runtime.push (isRunning && cls.getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Run)); } }; @@ -177,8 +183,12 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - runtime.push (ptr.getClass().getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Sneak)); + MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr(); + const MWWorld::Class &cls = ptr.getClass(); + + bool isSneaking = MWBase::Environment::get().getMechanicsManager()->isSneaking(ptr); + + runtime.push (isSneaking && cls.getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Sneak)); } }; From d8d47f081bda51d254b25df98e126677a054f950 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 13 Aug 2017 18:05:35 +0400 Subject: [PATCH 292/318] AiFollow: add a threshold when turning to target --- apps/openmw/mwmechanics/aifollow.cpp | 48 ++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwmechanics/aifollow.cpp b/apps/openmw/mwmechanics/aifollow.cpp index fe94246c4..fd5f9c7fe 100644 --- a/apps/openmw/mwmechanics/aifollow.cpp +++ b/apps/openmw/mwmechanics/aifollow.cpp @@ -22,8 +22,15 @@ struct AiFollowStorage : AiTemporaryBase { float mTimer; bool mMoving; - - AiFollowStorage() : mTimer(0.f), mMoving(false) {} + float mTargetAngleRadians; + bool mTurnActorToTarget; + + AiFollowStorage() : + mTimer(0.f), + mMoving(false), + mTargetAngleRadians(0.f), + mTurnActorToTarget(false) + {} }; int AiFollow::mFollowIndexCounter = 0; @@ -73,6 +80,15 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte AiFollowStorage& storage = state.get(); + bool& rotate = storage.mTurnActorToTarget; + if (rotate) + { + if (zTurn(actor, storage.mTargetAngleRadians)) + rotate = false; + + return false; + } + // AiFollow requires the target to be in range and within sight for the initial activation if (!mActive) { @@ -144,13 +160,33 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte //Set the target destination from the actor ESM::Pathgrid::Point dest = target.getRefData().getPosition().pos; - if (!storage.mMoving) - { - const short threshold = 10; // to avoid constant switching between moving/stopping + short baseFollowDistance = followDistance; + short threshold = 30; // to avoid constant switching between moving/stopping + if (storage.mMoving) + followDistance -= threshold; + else followDistance += threshold; + + osg::Vec3f targetPos(target.getRefData().getPosition().asVec3()); + osg::Vec3f actorPos(actor.getRefData().getPosition().asVec3()); + + osg::Vec3f dir = targetPos - actorPos; + float targetDistSqr = dir.length2(); + + if (targetDistSqr <= followDistance * followDistance) + { + float faceAngleRadians = std::atan2(dir.x(), dir.y()); + + if (!zTurn(actor, faceAngleRadians, osg::DegreesToRadians(45.f))) + { + storage.mTargetAngleRadians = faceAngleRadians; + storage.mTurnActorToTarget = true; + } + + return false; } - storage.mMoving = !pathTo(actor, dest, duration, followDistance); // Go to the destination + storage.mMoving = !pathTo(actor, dest, duration, baseFollowDistance); // Go to the destination if (storage.mMoving) { From 6c8c883dc07bd98df19fdbb6e6d5369b5631600f Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Fri, 18 Aug 2017 00:47:28 +0300 Subject: [PATCH 293/318] Making knownEffect aware that there can be more than 4 potion effects --- apps/openmw/mwmechanics/alchemy.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/alchemy.cpp b/apps/openmw/mwmechanics/alchemy.cpp index e6e3b4c4e..124468641 100644 --- a/apps/openmw/mwmechanics/alchemy.cpp +++ b/apps/openmw/mwmechanics/alchemy.cpp @@ -457,7 +457,9 @@ bool MWMechanics::Alchemy::knownEffect(unsigned int potionEffectIndex, const MWW static const float fWortChanceValue = MWBase::Environment::get().getWorld()->getStore().get().find("fWortChanceValue")->getFloat(); return (potionEffectIndex <= 1 && alchemySkill >= fWortChanceValue) - || (potionEffectIndex <= 3 && alchemySkill >= fWortChanceValue*2); + || (potionEffectIndex <= 3 && alchemySkill >= fWortChanceValue*2) + || (potionEffectIndex <= 5 && alchemySkill >= fWortChanceValue*3) + || (potionEffectIndex <= 7 && alchemySkill >= fWortChanceValue*4); } MWMechanics::Alchemy::Result MWMechanics::Alchemy::create (const std::string& name) From 641a6cd842d0d39b597ecb1d5a5770e2cd0f0904 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 18 Aug 2017 11:58:28 +0400 Subject: [PATCH 294/318] Added a delay before summoned creature corpse despawning --- apps/openmw/mwmechanics/actors.cpp | 8 +++- apps/openmw/mwmechanics/actors.hpp | 1 + apps/openmw/mwmechanics/summoning.cpp | 53 ++++++++++++++------------- apps/openmw/mwmechanics/summoning.hpp | 2 +- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 431ad09b3..e701336fe 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -781,7 +781,7 @@ namespace MWMechanics creatureStats.getActiveSpells().visitEffectSources(updateSummonedCreatures); if (ptr.getClass().hasInventoryStore(ptr)) ptr.getClass().getInventoryStore(ptr).visitEffectSources(updateSummonedCreatures); - updateSummonedCreatures.process(); + updateSummonedCreatures.process(mTimerDisposeSummonsCorpses == 0.f); } } @@ -1009,7 +1009,9 @@ namespace MWMechanics } } - Actors::Actors() {} + Actors::Actors() { + mTimerDisposeSummonsCorpses = 0.2f; // We should add a delay between summoned creature death and its corpse despawning + } Actors::~Actors() { @@ -1078,6 +1080,7 @@ namespace MWMechanics // target lists get updated once every 1.0 sec if (timerUpdateAITargets >= 1.0f) timerUpdateAITargets = 0; if (timerUpdateHeadTrack >= 0.3f) timerUpdateHeadTrack = 0; + if (mTimerDisposeSummonsCorpses >= 0.2f) mTimerDisposeSummonsCorpses = 0; if (timerUpdateEquippedLight >= updateEquippedLightInterval) timerUpdateEquippedLight = 0; MWWorld::Ptr player = getPlayer(); @@ -1182,6 +1185,7 @@ namespace MWMechanics timerUpdateAITargets += duration; timerUpdateHeadTrack += duration; timerUpdateEquippedLight += duration; + mTimerDisposeSummonsCorpses += duration; // Looping magic VFX update // Note: we need to do this before any of the animations are updated. diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index 362c2f126..8228284a7 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -150,6 +150,7 @@ namespace MWMechanics private: PtrActorMap mActors; + float mTimerDisposeSummonsCorpses; }; } diff --git a/apps/openmw/mwmechanics/summoning.cpp b/apps/openmw/mwmechanics/summoning.cpp index e4a825efc..fad7bc96d 100644 --- a/apps/openmw/mwmechanics/summoning.cpp +++ b/apps/openmw/mwmechanics/summoning.cpp @@ -38,26 +38,10 @@ namespace MWMechanics } } - void UpdateSummonedCreatures::process() + void UpdateSummonedCreatures::process(bool cleanup) { - - MWMechanics::CreatureStats& creatureStats = mActor.getClass().getCreatureStats(mActor); - - // Update summon effects std::map& creatureMap = creatureStats.getSummonedCreatureMap(); - for (std::map::iterator it = creatureMap.begin(); it != creatureMap.end(); ) - { - bool found = mActiveEffects.find(it->first) != mActiveEffects.end(); - if (!found) - { - // Effect has ended - MWBase::Environment::get().getMechanicsManager()->cleanupSummonedCreature(mActor, it->second); - creatureMap.erase(it++); - continue; - } - ++it; - } for (std::set >::iterator it = mActiveEffects.begin(); it != mActiveEffects.end(); ++it) { @@ -101,21 +85,18 @@ namespace MWMechanics } } + // Update summon effects for (std::map::iterator it = creatureMap.begin(); it != creatureMap.end(); ) { - MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->searchPtrViaActorId(it->second); - if (!ptr.isEmpty() && ptr.getClass().getCreatureStats(ptr).isDead() && ptr.getClass().getCreatureStats(ptr).isDeathAnimationFinished()) + bool found = mActiveEffects.find(it->first) != mActiveEffects.end(); + if (!found) { - // Purge the magic effect so a new creature can be summoned if desired - creatureStats.getActiveSpells().purgeEffect(it->first.first, it->first.second); - if (mActor.getClass().hasInventoryStore(ptr)) - mActor.getClass().getInventoryStore(mActor).purgeEffect(it->first.first, it->first.second); - + // Effect has ended MWBase::Environment::get().getMechanicsManager()->cleanupSummonedCreature(mActor, it->second); creatureMap.erase(it++); + continue; } - else - ++it; + ++it; } std::vector& graveyard = creatureStats.getSummonedCreatureGraveyard(); @@ -137,6 +118,26 @@ namespace MWMechanics else ++it; } + + if (!cleanup) + return; + + for (std::map::iterator it = creatureMap.begin(); it != creatureMap.end(); ) + { + MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->searchPtrViaActorId(it->second); + if (ptr.isEmpty() || (ptr.getClass().getCreatureStats(ptr).isDead() && ptr.getClass().getCreatureStats(ptr).isDeathAnimationFinished())) + { + // Purge the magic effect so a new creature can be summoned if desired + creatureStats.getActiveSpells().purgeEffect(it->first.first, it->first.second); + if (mActor.getClass().hasInventoryStore(mActor)) + mActor.getClass().getInventoryStore(mActor).purgeEffect(it->first.first, it->first.second); + + MWBase::Environment::get().getMechanicsManager()->cleanupSummonedCreature(mActor, it->second); + creatureMap.erase(it++); + } + else + ++it; + } } } diff --git a/apps/openmw/mwmechanics/summoning.hpp b/apps/openmw/mwmechanics/summoning.hpp index b2a3c60ea..9329dcb83 100644 --- a/apps/openmw/mwmechanics/summoning.hpp +++ b/apps/openmw/mwmechanics/summoning.hpp @@ -22,7 +22,7 @@ namespace MWMechanics float magnitude, float remainingTime = -1, float totalTime = -1); /// To call after all effect sources have been visited - void process(); + void process(bool cleanup); private: MWWorld::Ptr mActor; From 7c80ddc9de385996c9e331aaffe433c330a56f62 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 18 Aug 2017 17:06:47 +0400 Subject: [PATCH 295/318] Owned crosshair improvements (bug #2789) --- apps/openmw/mwbase/mechanicsmanager.hpp | 4 +++- apps/openmw/mwclass/activator.cpp | 5 +++++ apps/openmw/mwclass/activator.hpp | 2 ++ apps/openmw/mwclass/door.cpp | 5 +++++ apps/openmw/mwclass/door.hpp | 2 ++ apps/openmw/mwgui/tooltips.cpp | 3 +-- .../openmw/mwmechanics/mechanicsmanagerimp.cpp | 18 ++++++++++++++---- .../openmw/mwmechanics/mechanicsmanagerimp.hpp | 2 +- apps/openmw/mwworld/class.hpp | 8 ++++++++ 9 files changed, 41 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp index 2daaf9711..f5013a8f3 100644 --- a/apps/openmw/mwbase/mechanicsmanager.hpp +++ b/apps/openmw/mwbase/mechanicsmanager.hpp @@ -7,6 +7,8 @@ #include #include +#include "../mwworld/ptr.hpp" + namespace osg { class Vec3f; @@ -231,7 +233,7 @@ namespace MWBase /// Has the player stolen this item from the given owner? virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid) = 0; - virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim) = 0; + virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::ConstPtr& item, MWWorld::Ptr& victim) = 0; /// Turn actor into werewolf or normal form. virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf) = 0; diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 4910ab932..8df262f24 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -51,6 +51,11 @@ namespace MWClass return ""; } + bool Activator::isActivator() const + { + return true; + } + bool Activator::useAnim() const { return true; diff --git a/apps/openmw/mwclass/activator.hpp b/apps/openmw/mwclass/activator.hpp index 21afa7b8e..3f333f4cb 100644 --- a/apps/openmw/mwclass/activator.hpp +++ b/apps/openmw/mwclass/activator.hpp @@ -42,6 +42,8 @@ namespace MWClass virtual bool useAnim() const; ///< Whether or not to use animated variant of model (default false) + + virtual bool isActivator() const; }; } diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 3801cd261..07e6cc9db 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -76,6 +76,11 @@ namespace MWClass } } + bool Door::isDoor() const + { + return true; + } + bool Door::useAnim() const { return true; diff --git a/apps/openmw/mwclass/door.hpp b/apps/openmw/mwclass/door.hpp index a2d129522..57e475382 100644 --- a/apps/openmw/mwclass/door.hpp +++ b/apps/openmw/mwclass/door.hpp @@ -20,6 +20,8 @@ namespace MWClass virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const; + virtual bool isDoor() const; + virtual bool useAnim() const; virtual std::string getName (const MWWorld::ConstPtr& ptr) const; diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 81a3d864c..9b89c3957 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -359,12 +359,11 @@ namespace MWGui { if(!mFocusObject.isEmpty()) { - const MWWorld::CellRef& cellref = mFocusObject.getCellRef(); MWWorld::Ptr ptr = MWMechanics::getPlayer(); MWWorld::Ptr victim; MWBase::MechanicsManager* mm = MWBase::Environment::get().getMechanicsManager(); - bool allowed = mm->isAllowedToUse(ptr, cellref, victim); + bool allowed = mm->isAllowedToUse(ptr, mFocusObject, victim); return !allowed; } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index d182e40d7..68115301f 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -13,6 +13,7 @@ #include "../mwworld/inventorystore.hpp" #include "../mwworld/class.hpp" #include "../mwworld/player.hpp" +#include "../mwworld/ptr.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -829,8 +830,17 @@ namespace MWMechanics mAI = true; } - bool MechanicsManager::isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim) + bool MechanicsManager::isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::ConstPtr& item, MWWorld::Ptr& victim) { + const MWWorld::CellRef& cellref = item.getCellRef(); + // there is no harm to use unlocked doors + if (item.getClass().isDoor() && cellref.getLockLevel() <= 0 && ptr.getCellRef().getTrap().empty()) + return true; + + // TODO: implement a better check to check if item is owned bed + if (item.getClass().isActivator() && item.getClass().getScript(item).compare(0, 3, "Bed") != 0) + return true; + const std::string& owner = cellref.getOwner(); bool isOwned = !owner.empty() && owner != "player"; @@ -872,7 +882,7 @@ namespace MWMechanics } MWWorld::Ptr victim; - if (isAllowedToUse(ptr, bed.getCellRef(), victim)) + if (isAllowedToUse(ptr, bed, victim)) return false; if(commitCrime(ptr, victim, OT_SleepingInOwnedBed)) @@ -887,7 +897,7 @@ namespace MWMechanics void MechanicsManager::objectOpened(const MWWorld::Ptr &ptr, const MWWorld::Ptr &item) { MWWorld::Ptr victim; - if (isAllowedToUse(ptr, item.getCellRef(), victim)) + if (isAllowedToUse(ptr, item, victim)) return; commitCrime(ptr, victim, OT_Trespassing); } @@ -1007,7 +1017,7 @@ namespace MWMechanics } } - if (isAllowedToUse(ptr, *ownerCellRef, victim)) + if (isAllowedToUse(ptr, item, victim)) return; Owner owner; diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp index af0377a33..bba2c55d6 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.hpp @@ -199,7 +199,7 @@ namespace MWMechanics virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid); /// @return is \a ptr allowed to take/use \a cellref or is it a crime? - virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim); + virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::ConstPtr& item, MWWorld::Ptr& victim); virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf); virtual void applyWerewolfAcrobatics(const MWWorld::Ptr& actor); diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 42d57ffab..097ec0faa 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -301,6 +301,10 @@ namespace MWWorld virtual Ptr copyToCell(const ConstPtr &ptr, CellStore &cell, const ESM::Position &pos, int count) const; + virtual bool isActivator() const { + return false; + } + virtual bool isActor() const { return false; } @@ -309,6 +313,10 @@ namespace MWWorld return false; } + virtual bool isDoor() const { + return false; + } + virtual bool isBipedal(const MWWorld::ConstPtr& ptr) const; virtual bool canFly(const MWWorld::ConstPtr& ptr) const; virtual bool canSwim(const MWWorld::ConstPtr& ptr) const; From d31ed83b54383fbb669297e094c3fc66a740305f Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sat, 19 Aug 2017 03:43:31 -0400 Subject: [PATCH 296/318] Preliminary asset reloading --- apps/opencs/model/doc/document.cpp | 4 +-- apps/opencs/model/doc/document.hpp | 6 ++-- apps/opencs/model/doc/documentmanager.cpp | 2 +- apps/opencs/model/doc/documentmanager.hpp | 4 +-- apps/opencs/model/prefs/state.cpp | 1 + apps/opencs/model/world/data.cpp | 33 +++++++++++++++++++- apps/opencs/model/world/data.hpp | 6 ++-- apps/opencs/model/world/resources.cpp | 8 +++++ apps/opencs/model/world/resources.hpp | 2 ++ apps/opencs/model/world/resourcesmanager.cpp | 19 +++++++++-- apps/opencs/model/world/resourcesmanager.hpp | 8 +++-- apps/opencs/model/world/resourcetable.cpp | 10 ++++++ apps/opencs/model/world/resourcetable.hpp | 7 ++++- apps/opencs/view/doc/view.cpp | 8 +++++ components/vfs/archive.hpp | 3 ++ components/vfs/filesystemarchive.cpp | 6 ++++ components/vfs/filesystemarchive.hpp | 2 ++ components/vfs/manager.cpp | 8 +++++ components/vfs/manager.hpp | 3 ++ 19 files changed, 123 insertions(+), 17 deletions(-) diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index ef984c0ca..a7809f3e3 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -269,11 +269,11 @@ void CSMDoc::Document::createBase() } } -CSMDoc::Document::Document (const VFS::Manager* vfs, const Files::ConfigurationManager& configuration, +CSMDoc::Document::Document (VFS::Manager* vfs, const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, bool new_, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, const Fallback::Map* fallback, - ToUTF8::FromType encoding, const CSMWorld::ResourcesManager& resourcesManager, + ToUTF8::FromType encoding, CSMWorld::ResourcesManager& resourcesManager, const std::vector& blacklistedScripts) : mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, resourcesManager, fallback, resDir), mTools (*this, encoding), diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 030a0174e..ad0201407 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -59,7 +59,7 @@ namespace CSMDoc private: - const VFS::Manager* mVFS; + VFS::Manager* mVFS; boost::filesystem::path mSavePath; std::vector mContentFiles; bool mNew; @@ -102,11 +102,11 @@ namespace CSMDoc public: - Document (const VFS::Manager* vfs, const Files::ConfigurationManager& configuration, + Document (VFS::Manager* vfs, const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, bool new_, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, const Fallback::Map* fallback, - ToUTF8::FromType encoding, const CSMWorld::ResourcesManager& resourcesManager, + ToUTF8::FromType encoding, CSMWorld::ResourcesManager& resourcesManager, const std::vector& blacklistedScripts); ~Document(); diff --git a/apps/opencs/model/doc/documentmanager.cpp b/apps/opencs/model/doc/documentmanager.cpp index 098d7bad5..11378cab4 100644 --- a/apps/opencs/model/doc/documentmanager.cpp +++ b/apps/opencs/model/doc/documentmanager.cpp @@ -127,7 +127,7 @@ void CSMDoc::DocumentManager::documentNotLoaded (Document *document, const std:: removeDocument (document); } -void CSMDoc::DocumentManager::setVFS(const VFS::Manager *vfs) +void CSMDoc::DocumentManager::setVFS(VFS::Manager *vfs) { mResourcesManager.setVFS(vfs); mVFS = vfs; diff --git a/apps/opencs/model/doc/documentmanager.hpp b/apps/opencs/model/doc/documentmanager.hpp index ed8e327d7..771afe8e5 100644 --- a/apps/opencs/model/doc/documentmanager.hpp +++ b/apps/opencs/model/doc/documentmanager.hpp @@ -41,7 +41,7 @@ namespace CSMDoc ToUTF8::FromType mEncoding; CSMWorld::ResourcesManager mResourcesManager; std::vector mBlacklistedScripts; - const VFS::Manager* mVFS; + VFS::Manager* mVFS; DocumentManager (const DocumentManager&); DocumentManager& operator= (const DocumentManager&); @@ -74,7 +74,7 @@ namespace CSMDoc void setBlacklistedScripts (const std::vector& scriptIds); - void setVFS(const VFS::Manager* vfs); + void setVFS(VFS::Manager* vfs); bool isEmpty(); diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index c87e283a8..5c0b2e282 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -259,6 +259,7 @@ void CSMPrefs::State::declare() declareShortcut ("document-character-topicinfos", "Open Topic Info List", QKeySequence()); declareShortcut ("document-character-journalinfos", "Open Journal Info List", QKeySequence()); declareShortcut ("document-character-bodyparts", "Open Body Part List", QKeySequence()); + declareShortcut ("document-assets-reload", "Reload Assets", QKeySequence(Qt::Key_F5)); declareShortcut ("document-assets-sounds", "Open Sound Asset List", QKeySequence()); declareShortcut ("document-assets-soundgens", "Open Sound Generator List", QKeySequence()); declareShortcut ("document-assets-meshes", "Open Mesh Asset List", QKeySequence()); diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index ee9e4329c..8c25faaa5 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -11,6 +11,7 @@ #include #include +#include #include "idtable.hpp" #include "idtree.hpp" @@ -61,7 +62,7 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec return number; } -CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir) +CSMWorld::Data::Data (ToUTF8::FromType encoding, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir) : mEncoder (encoding), mPathgrids (mCells), mRefs (mCells), mResourcesManager (resourcesManager), mFallbackMap(fallback), mReader (0), mDialogue (0), mReaderIndex(1), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS())) @@ -1215,6 +1216,36 @@ std::vector CSMWorld::Data::getIds (bool listDeleted) const return ids; } +void CSMWorld::Data::assetsChanged() +{ + VFS::Manager* vfs = mResourcesManager.getVFS(); + vfs->rebuildIndex(); + + ResourceTable* meshTable = static_cast(getTableModel(UniversalId::Type_Meshes)); + ResourceTable* iconTable = static_cast(getTableModel(UniversalId::Type_Icons)); + ResourceTable* musicTable = static_cast(getTableModel(UniversalId::Type_Musics)); + ResourceTable* soundResTable = static_cast(getTableModel(UniversalId::Type_SoundsRes)); + ResourceTable* texTable = static_cast(getTableModel(UniversalId::Type_Textures)); + ResourceTable* vidTable = static_cast(getTableModel(UniversalId::Type_Videos)); + + meshTable->beginReset(); + iconTable->beginReset(); + musicTable->beginReset(); + soundResTable->beginReset(); + texTable->beginReset(); + vidTable->beginReset(); + + // Trigger recreation + mResourcesManager.recreateResources(); + + meshTable->endReset(); + iconTable->endReset(); + musicTable->endReset(); + soundResTable->endReset(); + texTable->endReset(); + vidTable->endReset(); +} + void CSMWorld::Data::dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight) { if (topLeft.column()<=0) diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index f96003e44..8bc1c4271 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -108,7 +108,7 @@ namespace CSMWorld RefCollection mRefs; IdCollection mFilters; Collection mMetaData; - const ResourcesManager& mResourcesManager; + ResourcesManager& mResourcesManager; const Fallback::Map* mFallbackMap; std::vector mModels; std::map mModelIndex; @@ -140,7 +140,7 @@ namespace CSMWorld public: - Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir); + Data (ToUTF8::FromType encoding, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir); virtual ~Data(); @@ -306,6 +306,8 @@ namespace CSMWorld private slots: + void assetsChanged(); + void dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight); void rowsChanged (const QModelIndex& parent, int start, int end); diff --git a/apps/opencs/model/world/resources.cpp b/apps/opencs/model/world/resources.cpp index 5fe9194d7..5bf0267bb 100644 --- a/apps/opencs/model/world/resources.cpp +++ b/apps/opencs/model/world/resources.cpp @@ -12,6 +12,14 @@ CSMWorld::Resources::Resources (const VFS::Manager* vfs, const std::string& base const char * const *extensions) : mBaseDirectory (baseDirectory), mType (type) { + recreate(vfs, extensions); +} + +void CSMWorld::Resources::recreate(const VFS::Manager* vfs, const char * const *extensions) +{ + mFiles.clear(); + mIndex.clear(); + int baseSize = mBaseDirectory.size(); const std::map& index = vfs->getIndex(); diff --git a/apps/opencs/model/world/resources.hpp b/apps/opencs/model/world/resources.hpp index d6998da9f..5e9872ea8 100644 --- a/apps/opencs/model/world/resources.hpp +++ b/apps/opencs/model/world/resources.hpp @@ -27,6 +27,8 @@ namespace CSMWorld Resources (const VFS::Manager* vfs, const std::string& baseDirectory, UniversalId::Type type, const char * const *extensions = 0); + void recreate(const VFS::Manager* vfs, const char * const *extensions = 0); + int getSize() const; std::string getId (int index) const; diff --git a/apps/opencs/model/world/resourcesmanager.cpp b/apps/opencs/model/world/resourcesmanager.cpp index 016799be3..6b271c276 100644 --- a/apps/opencs/model/world/resourcesmanager.cpp +++ b/apps/opencs/model/world/resourcesmanager.cpp @@ -14,7 +14,7 @@ void CSMWorld::ResourcesManager::addResources (const Resources& resources) resources)); } -void CSMWorld::ResourcesManager::setVFS(const VFS::Manager *vfs) +void CSMWorld::ResourcesManager::setVFS(VFS::Manager *vfs) { mVFS = vfs; mResources.clear(); @@ -31,11 +31,26 @@ void CSMWorld::ResourcesManager::setVFS(const VFS::Manager *vfs) addResources (Resources (vfs, "videos", UniversalId::Type_Video)); } -const VFS::Manager* CSMWorld::ResourcesManager::getVFS() const +VFS::Manager* CSMWorld::ResourcesManager::getVFS() const { return mVFS; } +void CSMWorld::ResourcesManager::recreateResources() +{ + // TODO make this shared with setVFS function + static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 }; + + std::map::iterator it = mResources.begin(); + for ( ; it != mResources.end(); ++it) + { + if (it->first == UniversalId::Type_Mesh) + it->second.recreate(mVFS, sMeshTypes); + else + it->second.recreate(mVFS); + } +} + const CSMWorld::Resources& CSMWorld::ResourcesManager::get (UniversalId::Type type) const { std::map::const_iterator iter = mResources.find (type); diff --git a/apps/opencs/model/world/resourcesmanager.hpp b/apps/opencs/model/world/resourcesmanager.hpp index 1ce06f2d3..969666856 100644 --- a/apps/opencs/model/world/resourcesmanager.hpp +++ b/apps/opencs/model/world/resourcesmanager.hpp @@ -16,7 +16,7 @@ namespace CSMWorld class ResourcesManager { std::map mResources; - const VFS::Manager* mVFS; + VFS::Manager* mVFS; private: @@ -26,9 +26,11 @@ namespace CSMWorld ResourcesManager(); - const VFS::Manager* getVFS() const; + VFS::Manager* getVFS() const; - void setVFS(const VFS::Manager* vfs); + void setVFS(VFS::Manager* vfs); + + void recreateResources(); const Resources& get (UniversalId::Type type) const; }; diff --git a/apps/opencs/model/world/resourcetable.cpp b/apps/opencs/model/world/resourcetable.cpp index 5227ec3e6..f55f87873 100644 --- a/apps/opencs/model/world/resourcetable.cpp +++ b/apps/opencs/model/world/resourcetable.cpp @@ -154,3 +154,13 @@ int CSMWorld::ResourceTable::getColumnId (int column) const return -1; } + +void CSMWorld::ResourceTable::beginReset() +{ + beginResetModel(); +} + +void CSMWorld::ResourceTable::endReset() +{ + endResetModel(); +} diff --git a/apps/opencs/model/world/resourcetable.hpp b/apps/opencs/model/world/resourcetable.hpp index 88dcc24b0..7d538df53 100644 --- a/apps/opencs/model/world/resourcetable.hpp +++ b/apps/opencs/model/world/resourcetable.hpp @@ -52,7 +52,12 @@ namespace CSMWorld /// Is \a id flagged as deleted? virtual bool isDeleted (const std::string& id) const; - virtual int getColumnId (int column) const; + virtual int getColumnId (int column) const; + + /// Signal Qt that the data is about to change. + void beginReset(); + /// Signal Qt that the data has been changed. + void endReset(); }; } diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index ff49a90fd..92ed07daf 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -284,6 +284,13 @@ void CSVDoc::View::setupAssetsMenu() { QMenu *assets = menuBar()->addMenu (tr ("Assets")); + QAction *reload = new QAction (tr ("Reload"), this); + connect (reload, SIGNAL (triggered()), &mDocument->getData(), SLOT (assetsChanged())); + setupShortcut("document-assets-reload", reload); + assets->addAction (reload); + + assets->addSeparator(); + QAction *sounds = new QAction (tr ("Sounds"), this); connect (sounds, SIGNAL (triggered()), this, SLOT (addSoundsSubView())); setupShortcut("document-assets-sounds", sounds); @@ -889,6 +896,7 @@ void CSVDoc::View::addMetaDataSubView() addSubView (CSMWorld::UniversalId (CSMWorld::UniversalId::Type_MetaData, "sys::meta")); } + void CSVDoc::View::abortOperation (int type) { mDocument->abortOperation (type); diff --git a/components/vfs/archive.hpp b/components/vfs/archive.hpp index b36c7117b..9bdf12c23 100644 --- a/components/vfs/archive.hpp +++ b/components/vfs/archive.hpp @@ -21,6 +21,9 @@ namespace VFS public: virtual ~Archive() {} + /// Clears cached data for archives that may change. + virtual void resetIfNotStatic(){}; + /// List all resources contained in this archive, and run the resource names through the given normalize function. virtual void listResources(std::map& out, char (*normalize_function) (char)) = 0; }; diff --git a/components/vfs/filesystemarchive.cpp b/components/vfs/filesystemarchive.cpp index ad5150a44..9240909ad 100644 --- a/components/vfs/filesystemarchive.cpp +++ b/components/vfs/filesystemarchive.cpp @@ -12,6 +12,12 @@ namespace VFS } + void FileSystemArchive::resetIfNotStatic() + { + mIndex.clear(); + mBuiltIndex = false; + } + void FileSystemArchive::listResources(std::map &out, char (*normalize_function)(char)) { if (!mBuiltIndex) diff --git a/components/vfs/filesystemarchive.hpp b/components/vfs/filesystemarchive.hpp index 6c8e1b82b..16c2d65ea 100644 --- a/components/vfs/filesystemarchive.hpp +++ b/components/vfs/filesystemarchive.hpp @@ -23,6 +23,8 @@ namespace VFS public: FileSystemArchive(const std::string& path); + virtual void resetIfNotStatic(); + virtual void listResources(std::map& out, char (*normalize_function) (char)); diff --git a/components/vfs/manager.cpp b/components/vfs/manager.cpp index 457947d40..037fef325 100644 --- a/components/vfs/manager.cpp +++ b/components/vfs/manager.cpp @@ -57,6 +57,14 @@ namespace VFS (*it)->listResources(mIndex, mStrict ? &strict_normalize_char : &nonstrict_normalize_char); } + void Manager::rebuildIndex() + { + for (std::vector::const_iterator it = mArchives.begin(); it != mArchives.end(); ++it) + (*it)->resetIfNotStatic(); + + buildIndex(); + } + Files::IStreamPtr Manager::get(const std::string &name) const { std::string normalized = name; diff --git a/components/vfs/manager.hpp b/components/vfs/manager.hpp index 6592a65a8..2ad7cf643 100644 --- a/components/vfs/manager.hpp +++ b/components/vfs/manager.hpp @@ -33,6 +33,9 @@ namespace VFS /// Build the file index. Should be called when all archives have been registered. void buildIndex(); + /// Rebuild the file index. New/deleted files (actual files, not bsa's) will be reflected. + void rebuildIndex(); + /// Does a file with this name exist? /// @note May be called from any thread once the index has been built. bool exists(const std::string& name) const; From e0bb9c089bcc7459de77609a9d2c2df0245a0b39 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 19 Aug 2017 14:31:25 +0400 Subject: [PATCH 297/318] Revert commit 67d59bead51ce4948c0e0256ee014bdab3bc8b5f (a better implementation found) --- apps/openmw/mwgui/alchemywindow.cpp | 2 +- apps/openmw/mwgui/class.cpp | 2 +- apps/openmw/mwgui/enchantingdialog.cpp | 5 ++--- apps/openmw/mwgui/enchantingdialog.hpp | 2 +- apps/openmw/mwgui/savegamedialog.cpp | 4 ++-- apps/openmw/mwgui/spellcreationdialog.cpp | 4 ++-- apps/openmw/mwgui/textinput.cpp | 4 ++-- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 95dc8cc4d..7379f3613 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -64,7 +64,7 @@ namespace MWGui void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender) { - MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getOnlyText()); + MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getCaption ()); MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager(); switch (result) diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index ac61041c3..e1f5a165e 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -483,7 +483,7 @@ namespace MWGui std::string CreateClassDialog::getName() const { - return mEditName->getOnlyText(); + return mEditName->getCaption(); } std::string CreateClassDialog::getDescription() const diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index 5dc1f3454..c7d2ef7de 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -313,7 +312,7 @@ namespace MWGui return; } - if (mName->getOnlyText().empty()) + if (mName->getCaption ().empty()) { MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage10}"); return; @@ -337,7 +336,7 @@ namespace MWGui return; } - mEnchanting.setNewItemName(mName->getOnlyText()); + mEnchanting.setNewItemName(mName->getCaption()); mEnchanting.setEffect(mEffectList); MWWorld::Ptr player = MWMechanics::getPlayer(); diff --git a/apps/openmw/mwgui/enchantingdialog.hpp b/apps/openmw/mwgui/enchantingdialog.hpp index 6391f8597..cb7c6c0d0 100644 --- a/apps/openmw/mwgui/enchantingdialog.hpp +++ b/apps/openmw/mwgui/enchantingdialog.hpp @@ -58,7 +58,7 @@ namespace MWGui MyGUI::Button* mTypeButton; MyGUI::Button* mBuyButton; - MyGUI::EditBox* mName; + MyGUI::TextBox* mName; MyGUI::TextBox* mEnchantmentPoints; MyGUI::TextBox* mCastCost; MyGUI::TextBox* mCharge; diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index 4d1a490aa..84d4ca959 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -248,7 +248,7 @@ namespace MWGui dialog->eventCancelClicked.clear(); return; } - if (mSaveNameEdit->getOnlyText().empty()) + if (mSaveNameEdit->getCaption().empty()) { MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage65}"); return; @@ -275,7 +275,7 @@ namespace MWGui if (mSaving) { - MWBase::Environment::get().getStateManager()->saveGame (mSaveNameEdit->getOnlyText(), mCurrentSlot); + MWBase::Environment::get().getStateManager()->saveGame (mSaveNameEdit->getCaption(), mCurrentSlot); } else { diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index cd2d2cd1d..354253fa4 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -373,7 +373,7 @@ namespace MWGui return; } - if (mNameEdit->getOnlyText() == "") + if (mNameEdit->getCaption () == "") { MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage10}"); return; @@ -394,7 +394,7 @@ namespace MWGui return; } - mSpell.mName = mNameEdit->getOnlyText(); + mSpell.mName = mNameEdit->getCaption(); int price = MyGUI::utility::parseInt(mPriceLabel->getCaption()); diff --git a/apps/openmw/mwgui/textinput.cpp b/apps/openmw/mwgui/textinput.cpp index 9ddfac612..958b52dc0 100644 --- a/apps/openmw/mwgui/textinput.cpp +++ b/apps/openmw/mwgui/textinput.cpp @@ -53,7 +53,7 @@ namespace MWGui void TextInputDialog::onOkClicked(MyGUI::Widget* _sender) { - if (mTextEdit->getOnlyText() == "") + if (mTextEdit->getCaption() == "") { MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage37}"); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget (mTextEdit); @@ -69,7 +69,7 @@ namespace MWGui std::string TextInputDialog::getTextInput() const { - return mTextEdit->getOnlyText(); + return mTextEdit->getCaption(); } void TextInputDialog::setTextInput(const std::string &text) From 65d05ee1cd5abe81456537fa75b6b326c1de9370 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 19 Aug 2017 14:30:04 +0400 Subject: [PATCH 298/318] Get only text from clipboard (bug #4025) --- apps/openmw/mwgui/windowmanagerimp.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 97aedab81..e4f6eafde 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1983,12 +1983,8 @@ namespace MWGui char* text=0; text = SDL_GetClipboardText(); if (text) - { - // MyGUI's clipboard might still have color information, to retain that information, only set the new text - // if it actually changed (clipboard inserted by an external application) - if (MyGUI::TextIterator::getOnlyText(_data) != text) - _data = text; - } + _data = MyGUI::TextIterator::toTagsString(text); + SDL_free(text); } From f3361ed085ba47d4e33f10dffe1c9674998a7263 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sat, 19 Aug 2017 18:28:40 +0100 Subject: [PATCH 299/318] Add an EditorConfig file --- .editorconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..25cc3fffc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*.cpp] +indent_style = space +indent_size = 4 +insert_final_newline = true + +[*.hpp] +indent_style = space +indent_size = 4 +insert_final_newline = true \ No newline at end of file From 91597af051d012df6897c9afaf7170e4f70366b2 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sat, 19 Aug 2017 18:48:29 +0100 Subject: [PATCH 300/318] Add VS2017 aps files to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ca2c6502e..9fbb82dba 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ Doxygen .settings .directory .idea +files/windows/*.aps ## qt-creator CMakeLists.txt.user* From 2a85c5f011ad4381460d8ded00cdec6052b4f99b Mon Sep 17 00:00:00 2001 From: Harry Date: Sat, 19 Aug 2017 14:48:00 -0400 Subject: [PATCH 301/318] Implement a Fisher-Yates shuffle on background music This fixes sometimes getting repetitive background music --- apps/openmw/mwsound/soundmanagerimp.cpp | 26 ++++++++++++++++--------- apps/openmw/mwsound/soundmanagerimp.hpp | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index c6f663059..1cba2e13a 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -271,7 +271,6 @@ namespace MWSound return sound; } - // Gets the combined volume settings for the given sound type float SoundManager::volumeFromType(PlayType type) const { @@ -298,7 +297,6 @@ namespace MWSound return volume; } - void SoundManager::stopMusic() { if(mMusic) @@ -367,7 +365,9 @@ namespace MWSound } mMusicFiles[mCurrentPlaylist] = filelist; - + mMusicToPlay.reserve(mMusicToPlay.size() + filelist.size()); + for(int it = 0; it < filelist.size(); it++) + mMusicToPlay.push_back(it); } else filelist = mMusicFiles[mCurrentPlaylist]; @@ -375,15 +375,23 @@ namespace MWSound if(filelist.empty()) return; - int i = Misc::Rng::rollDice(filelist.size()); - - // Don't play the same music track twice in a row - if (filelist[i] == mLastPlayedMusic) + // Do a Fisher-Yates shuffle + if(mMusicFiles.size() == 0) { - i = (i+1) % filelist.size(); + mMusicToPlay.reserve(filelist.size()); + for (int it = 0; it < filelist.size(); it++) + mMusicToPlay.push_back(it); } - advanceMusic(filelist[i]); + int i = Misc::Rng::rollDice(mMusicToPlay.size()); + + // Fix last played music being the same after another shuffle + if(filelist[mMusicToPlay[i]] == mLastPlayedMusic) + i = (i+1) % mMusicToPlay.size(); + + advanceMusic(filelist[mMusicToPlay[i]]); + mMusicToPlay[i] = mMusicToPlay.back(); + mMusicToPlay.pop_back(); } bool SoundManager::isMusicPlaying() diff --git a/apps/openmw/mwsound/soundmanagerimp.hpp b/apps/openmw/mwsound/soundmanagerimp.hpp index 5d911d4be..46a03818b 100644 --- a/apps/openmw/mwsound/soundmanagerimp.hpp +++ b/apps/openmw/mwsound/soundmanagerimp.hpp @@ -49,6 +49,7 @@ namespace MWSound // Caches available music tracks by std::map > mMusicFiles; + std::vector mMusicToPlay; // The list of music files not played yet std::string mLastPlayedMusic; // The music file that was last played float mMasterVolume; From 742bd00ec6e7b1802f8bf8a78d76a400885f0b25 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sat, 19 Aug 2017 15:26:46 -0400 Subject: [PATCH 302/318] Clear cached resources --- apps/opencs/model/world/data.cpp | 3 +++ components/resource/resourcemanager.cpp | 5 +++++ components/resource/resourcemanager.hpp | 3 +++ components/resource/resourcesystem.cpp | 10 ++++++++++ components/resource/resourcesystem.hpp | 3 +++ 5 files changed, 24 insertions(+) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 8c25faaa5..633b1ae20 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -1244,6 +1244,9 @@ void CSMWorld::Data::assetsChanged() soundResTable->endReset(); texTable->endReset(); vidTable->endReset(); + + // Get rid of potentially old cached assets + mResourceSystem->clearCache(); } void CSMWorld::Data::dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight) diff --git a/components/resource/resourcemanager.cpp b/components/resource/resourcemanager.cpp index d19d9cf80..4e48d9745 100644 --- a/components/resource/resourcemanager.cpp +++ b/components/resource/resourcemanager.cpp @@ -23,6 +23,11 @@ namespace Resource mCache->removeExpiredObjectsInCache(referenceTime - mExpiryDelay); } + void ResourceManager::clearCache() + { + mCache->clear(); + } + void ResourceManager::setExpiryDelay(double expiryDelay) { mExpiryDelay = expiryDelay; diff --git a/components/resource/resourcemanager.hpp b/components/resource/resourcemanager.hpp index 61599cd5e..58200993b 100644 --- a/components/resource/resourcemanager.hpp +++ b/components/resource/resourcemanager.hpp @@ -28,6 +28,9 @@ namespace Resource /// Clear cache entries that have not been referenced for longer than expiryDelay. virtual void updateCache(double referenceTime); + /// Clear all cache entries. + virtual void clearCache(); + /// How long to keep objects in cache after no longer being referenced. void setExpiryDelay (double expiryDelay); diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index 8d05a1b4e..a9686e5db 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -2,6 +2,8 @@ #include +#include + #include "scenemanager.hpp" #include "imagemanager.hpp" #include "niffilemanager.hpp" @@ -68,6 +70,14 @@ namespace Resource (*it)->updateCache(referenceTime); } + void ResourceSystem::clearCache() + { + for (std::vector::iterator it = mResourceManagers.begin(); it != mResourceManagers.end(); ++it) + (*it)->clearCache(); + + osgDB::Registry::instance()->clearObjectCache(); + } + void ResourceSystem::addResourceManager(ResourceManager *resourceMgr) { mResourceManagers.push_back(resourceMgr); diff --git a/components/resource/resourcesystem.hpp b/components/resource/resourcesystem.hpp index dc608b875..ef9ac9647 100644 --- a/components/resource/resourcesystem.hpp +++ b/components/resource/resourcesystem.hpp @@ -41,6 +41,9 @@ namespace Resource /// @note May be called from any thread if you do not add or remove resource managers at that point. void updateCache(double referenceTime); + /// Indicates to each resource manager to clear the entire cache. + void clearCache(); + /// Add this ResourceManager to be handled by the ResourceSystem. /// @note Does not transfer ownership. void addResourceManager(ResourceManager* resourceMgr); From 5950b26912893b40333586c32e49c737a232d148 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sat, 19 Aug 2017 19:36:45 -0400 Subject: [PATCH 303/318] Update scene assets --- apps/opencs/model/world/data.cpp | 2 ++ apps/opencs/model/world/data.hpp | 2 ++ apps/opencs/view/render/cell.cpp | 9 +++++++++ apps/opencs/view/render/cell.hpp | 2 ++ apps/opencs/view/render/object.cpp | 6 ++++++ apps/opencs/view/render/object.hpp | 3 +++ apps/opencs/view/render/pagedworldspacewidget.cpp | 14 +++++++++++++- apps/opencs/view/render/pagedworldspacewidget.hpp | 4 +++- apps/opencs/view/render/previewwidget.cpp | 8 ++++++++ apps/opencs/view/render/previewwidget.hpp | 2 ++ .../opencs/view/render/unpagedworldspacewidget.cpp | 9 +++++++++ .../opencs/view/render/unpagedworldspacewidget.hpp | 2 ++ components/resource/resourcesystem.cpp | 2 -- 13 files changed, 61 insertions(+), 4 deletions(-) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 633b1ae20..61db4ff77 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -1247,6 +1247,8 @@ void CSMWorld::Data::assetsChanged() // Get rid of potentially old cached assets mResourceSystem->clearCache(); + + emit assetTablesChanged(); } void CSMWorld::Data::dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight) diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index 8bc1c4271..8fe5eeff9 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -304,6 +304,8 @@ namespace CSMWorld void idListChanged(); + void assetTablesChanged(); + private slots: void assetsChanged(); diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 48156359f..4b06432d6 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -283,6 +283,15 @@ void CSVRender::Cell::pathgridRemoved() mPathgrid->removeGeometry(); } +void CSVRender::Cell::reloadAssets() +{ + for (std::map::const_iterator iter (mObjects.begin()); + iter != mObjects.end(); ++iter) + { + iter->second->reloadAssets(); + } +} + void CSVRender::Cell::setSelection (int elementMask, Selection mode) { if (elementMask & Mask_Reference) diff --git a/apps/opencs/view/render/cell.hpp b/apps/opencs/view/render/cell.hpp index ca82dd580..f53f61973 100644 --- a/apps/opencs/view/render/cell.hpp +++ b/apps/opencs/view/render/cell.hpp @@ -118,6 +118,8 @@ namespace CSVRender void pathgridRemoved(); + void reloadAssets(); + void setSelection (int elementMask, Selection mode); // Select everything that references the same ID as at least one of the elements diff --git a/apps/opencs/view/render/object.cpp b/apps/opencs/view/render/object.cpp index eb90e9db3..522057097 100644 --- a/apps/opencs/view/render/object.cpp +++ b/apps/opencs/view/render/object.cpp @@ -532,6 +532,12 @@ bool CSVRender::Object::referenceDataChanged (const QModelIndex& topLeft, return false; } +void CSVRender::Object::reloadAssets() +{ + update(); + updateMarker(); +} + std::string CSVRender::Object::getReferenceId() const { return mReferenceId; diff --git a/apps/opencs/view/render/object.hpp b/apps/opencs/view/render/object.hpp index e28e2562c..e14697e62 100644 --- a/apps/opencs/view/render/object.hpp +++ b/apps/opencs/view/render/object.hpp @@ -151,6 +151,9 @@ namespace CSVRender /// this object? bool referenceDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight); + /// Reloads the underlying asset + void reloadAssets(); + /// Returns an empty string if this is a refereceable-type object. std::string getReferenceId() const; diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp index b5497558a..b1077139c 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.cpp +++ b/apps/opencs/view/render/pagedworldspacewidget.cpp @@ -472,6 +472,9 @@ CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc connect (cells, SIGNAL (rowsInserted (const QModelIndex&, int, int)), this, SLOT (cellAdded (const QModelIndex&, int, int))); + connect (&document.getData(), SIGNAL (assetTablesChanged ()), + this, SLOT (assetTablesChanged ())); + // Shortcuts CSMPrefs::Shortcut* loadCameraCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-cell", this); connect(loadCameraCellShortcut, SIGNAL(activated()), this, SLOT(loadCameraCell())); @@ -520,7 +523,7 @@ void CSVRender::PagedWorldspaceWidget::useViewHint (const std::string& hint) // Loop through all the coordinates to add them to selection while (stream >> ignore1 >> ignore2 >> x >> y) selection.add (CSMWorld::CellCoordinates (x, y)); - + // Mark that camera needs setup mCamPositionSet=false; } @@ -763,6 +766,15 @@ void CSVRender::PagedWorldspaceWidget::cellAdded (const QModelIndex& index, int flagAsModified(); } +void CSVRender::PagedWorldspaceWidget::assetTablesChanged() +{ + std::map::iterator iter = mCells.begin(); + for ( ; iter != mCells.end(); ++iter) + { + iter->second->reloadAssets(); + } +} + void CSVRender::PagedWorldspaceWidget::loadCameraCell() { addCellToSceneFromCamera(0, 0); diff --git a/apps/opencs/view/render/pagedworldspacewidget.hpp b/apps/opencs/view/render/pagedworldspacewidget.hpp index 0663d3424..8c41df51e 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.hpp +++ b/apps/opencs/view/render/pagedworldspacewidget.hpp @@ -84,7 +84,7 @@ namespace CSVRender /// hint system. virtual ~PagedWorldspaceWidget(); - + /// Decodes the the hint string to set of cell that are rendered. void useViewHint (const std::string& hint); @@ -155,6 +155,8 @@ namespace CSVRender virtual void cellAdded (const QModelIndex& index, int start, int end); + void assetTablesChanged (); + void loadCameraCell(); void loadEastCell(); diff --git a/apps/opencs/view/render/previewwidget.cpp b/apps/opencs/view/render/previewwidget.cpp index 2f3510317..972fb556d 100644 --- a/apps/opencs/view/render/previewwidget.cpp +++ b/apps/opencs/view/render/previewwidget.cpp @@ -17,6 +17,9 @@ CSVRender::PreviewWidget::PreviewWidget (CSMWorld::Data& data, connect (referenceables, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), this, SLOT (referenceableAboutToBeRemoved (const QModelIndex&, int, int))); + connect (&mData, SIGNAL (assetTablesChanged ()), + this, SLOT (assetTablesChanged ())); + if (!referenceable) { QAbstractItemModel *references = @@ -119,3 +122,8 @@ void CSVRender::PreviewWidget::referenceAboutToBeRemoved (const QModelIndex& par if (index.row()>=start && index.row()<=end) emit closeRequest(); } + +void CSVRender::PreviewWidget::assetTablesChanged () +{ + mObject.reloadAssets(); +} diff --git a/apps/opencs/view/render/previewwidget.hpp b/apps/opencs/view/render/previewwidget.hpp index 73f7dc810..630ccf293 100644 --- a/apps/opencs/view/render/previewwidget.hpp +++ b/apps/opencs/view/render/previewwidget.hpp @@ -47,6 +47,8 @@ namespace CSVRender void referenceDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight); void referenceAboutToBeRemoved (const QModelIndex& parent, int start, int end); + + void assetTablesChanged (); }; } diff --git a/apps/opencs/view/render/unpagedworldspacewidget.cpp b/apps/opencs/view/render/unpagedworldspacewidget.cpp index b82aa45b2..3201f7303 100644 --- a/apps/opencs/view/render/unpagedworldspacewidget.cpp +++ b/apps/opencs/view/render/unpagedworldspacewidget.cpp @@ -47,6 +47,9 @@ CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& connect (mCellsModel, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), this, SLOT (cellRowsAboutToBeRemoved (const QModelIndex&, int, int))); + connect (&document.getData(), SIGNAL (assetTablesChanged ()), + this, SLOT (assetTablesChanged ())); + update(); mCell.reset (new Cell (document.getData(), mRootNode, mCellId)); @@ -82,6 +85,12 @@ void CSVRender::UnpagedWorldspaceWidget::cellRowsAboutToBeRemoved (const QModelI emit closeRequest(); } +void CSVRender::UnpagedWorldspaceWidget::assetTablesChanged() +{ + if (mCell) + mCell->reloadAssets(); +} + bool CSVRender::UnpagedWorldspaceWidget::handleDrop (const std::vector& universalIdData, DropType type) { if (WorldspaceWidget::handleDrop (universalIdData, type)) diff --git a/apps/opencs/view/render/unpagedworldspacewidget.hpp b/apps/opencs/view/render/unpagedworldspacewidget.hpp index 5283b3a97..527463990 100644 --- a/apps/opencs/view/render/unpagedworldspacewidget.hpp +++ b/apps/opencs/view/render/unpagedworldspacewidget.hpp @@ -108,6 +108,8 @@ namespace CSVRender void cellRowsAboutToBeRemoved (const QModelIndex& parent, int start, int end); + void assetTablesChanged (); + signals: void cellChanged(const CSMWorld::UniversalId& id); diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index a9686e5db..b1061adcd 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -74,8 +74,6 @@ namespace Resource { for (std::vector::iterator it = mResourceManagers.begin(); it != mResourceManagers.end(); ++it) (*it)->clearCache(); - - osgDB::Registry::instance()->clearObjectCache(); } void ResourceSystem::addResourceManager(ResourceManager *resourceMgr) From 765f982123c3e13c027345c354c9e95dce907c34 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 20 Aug 2017 20:48:14 +0400 Subject: [PATCH 304/318] Removed cursor from Favorite Attributes label --- files/mygui/openmw_chargen_class.layout | 1 + files/mygui/openmw_chargen_create_class.layout | 1 + 2 files changed, 2 insertions(+) diff --git a/files/mygui/openmw_chargen_class.layout b/files/mygui/openmw_chargen_class.layout index 35dd57ca3..d875fae22 100644 --- a/files/mygui/openmw_chargen_class.layout +++ b/files/mygui/openmw_chargen_class.layout @@ -34,6 +34,7 @@ + diff --git a/files/mygui/openmw_chargen_create_class.layout b/files/mygui/openmw_chargen_create_class.layout index 9ca6c6a31..e2920c742 100644 --- a/files/mygui/openmw_chargen_create_class.layout +++ b/files/mygui/openmw_chargen_create_class.layout @@ -33,6 +33,7 @@ + From 6ef5d1408f7dbec911b14c8d6f13838ae80e19b9 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 20 Aug 2017 21:25:36 +0400 Subject: [PATCH 305/318] Disabled transparency for description edit fields --- files/mygui/openmw_chargen_class_description.layout | 2 +- files/mygui/openmw_edit_note.layout | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/mygui/openmw_chargen_class_description.layout b/files/mygui/openmw_chargen_class_description.layout index 3d341eee5..43b0518fd 100644 --- a/files/mygui/openmw_chargen_class_description.layout +++ b/files/mygui/openmw_chargen_class_description.layout @@ -1,7 +1,7 @@ - + diff --git a/files/mygui/openmw_edit_note.layout b/files/mygui/openmw_edit_note.layout index eb2a2789d..7039c719e 100644 --- a/files/mygui/openmw_edit_note.layout +++ b/files/mygui/openmw_edit_note.layout @@ -1,7 +1,7 @@ - + From f0dea8b8e6797bb8f4ee4cbfe2c03c988522bfa5 Mon Sep 17 00:00:00 2001 From: scrawl <720642+scrawl@users.noreply.github.com> Date: Sun, 20 Aug 2017 20:20:27 +0000 Subject: [PATCH 306/318] Revert "Implement a Fisher-Yates shuffle on background music" --- apps/openmw/mwsound/soundmanagerimp.cpp | 26 +++++++++---------------- apps/openmw/mwsound/soundmanagerimp.hpp | 1 - 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 1cba2e13a..c6f663059 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -271,6 +271,7 @@ namespace MWSound return sound; } + // Gets the combined volume settings for the given sound type float SoundManager::volumeFromType(PlayType type) const { @@ -297,6 +298,7 @@ namespace MWSound return volume; } + void SoundManager::stopMusic() { if(mMusic) @@ -365,9 +367,7 @@ namespace MWSound } mMusicFiles[mCurrentPlaylist] = filelist; - mMusicToPlay.reserve(mMusicToPlay.size() + filelist.size()); - for(int it = 0; it < filelist.size(); it++) - mMusicToPlay.push_back(it); + } else filelist = mMusicFiles[mCurrentPlaylist]; @@ -375,23 +375,15 @@ namespace MWSound if(filelist.empty()) return; - // Do a Fisher-Yates shuffle - if(mMusicFiles.size() == 0) + int i = Misc::Rng::rollDice(filelist.size()); + + // Don't play the same music track twice in a row + if (filelist[i] == mLastPlayedMusic) { - mMusicToPlay.reserve(filelist.size()); - for (int it = 0; it < filelist.size(); it++) - mMusicToPlay.push_back(it); + i = (i+1) % filelist.size(); } - int i = Misc::Rng::rollDice(mMusicToPlay.size()); - - // Fix last played music being the same after another shuffle - if(filelist[mMusicToPlay[i]] == mLastPlayedMusic) - i = (i+1) % mMusicToPlay.size(); - - advanceMusic(filelist[mMusicToPlay[i]]); - mMusicToPlay[i] = mMusicToPlay.back(); - mMusicToPlay.pop_back(); + advanceMusic(filelist[i]); } bool SoundManager::isMusicPlaying() diff --git a/apps/openmw/mwsound/soundmanagerimp.hpp b/apps/openmw/mwsound/soundmanagerimp.hpp index 46a03818b..5d911d4be 100644 --- a/apps/openmw/mwsound/soundmanagerimp.hpp +++ b/apps/openmw/mwsound/soundmanagerimp.hpp @@ -49,7 +49,6 @@ namespace MWSound // Caches available music tracks by std::map > mMusicFiles; - std::vector mMusicToPlay; // The list of music files not played yet std::string mLastPlayedMusic; // The music file that was last played float mMasterVolume; From d7744e8b16a1f4887abbc036b755d3356eada244 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sun, 20 Aug 2017 19:07:23 -0400 Subject: [PATCH 307/318] A bit of cleanup --- apps/opencs/model/doc/document.cpp | 2 +- apps/opencs/model/world/data.cpp | 9 ++++---- apps/opencs/model/world/data.hpp | 3 ++- apps/opencs/model/world/resourcesmanager.cpp | 22 ++++++++++---------- apps/opencs/model/world/resourcesmanager.hpp | 8 ++++--- components/resource/resourcesystem.cpp | 2 -- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index a7809f3e3..d9f86cdde 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -275,7 +275,7 @@ CSMDoc::Document::Document (VFS::Manager* vfs, const Files::ConfigurationManager const Fallback::Map* fallback, ToUTF8::FromType encoding, CSMWorld::ResourcesManager& resourcesManager, const std::vector& blacklistedScripts) -: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, resourcesManager, fallback, resDir), +: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, vfs, resourcesManager, fallback, resDir), mTools (*this, encoding), mProjectPath ((configuration.getUserDataPath() / "projects") / (savePath.filename().string() + ".project")), diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 61db4ff77..d7f42d027 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -62,9 +62,9 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec return number; } -CSMWorld::Data::Data (ToUTF8::FromType encoding, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir) +CSMWorld::Data::Data (ToUTF8::FromType encoding, VFS::Manager* vfs, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir) : mEncoder (encoding), mPathgrids (mCells), mRefs (mCells), - mResourcesManager (resourcesManager), mFallbackMap(fallback), + mVFS(vfs), mResourcesManager (resourcesManager), mFallbackMap(fallback), mReader (0), mDialogue (0), mReaderIndex(1), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS())) { mResourceSystem->getSceneManager()->setShaderPath((resDir / "shaders").string()); @@ -1218,8 +1218,7 @@ std::vector CSMWorld::Data::getIds (bool listDeleted) const void CSMWorld::Data::assetsChanged() { - VFS::Manager* vfs = mResourcesManager.getVFS(); - vfs->rebuildIndex(); + mVFS->rebuildIndex(); ResourceTable* meshTable = static_cast(getTableModel(UniversalId::Type_Meshes)); ResourceTable* iconTable = static_cast(getTableModel(UniversalId::Type_Icons)); @@ -1264,7 +1263,7 @@ void CSMWorld::Data::rowsChanged (const QModelIndex& parent, int start, int end) const VFS::Manager* CSMWorld::Data::getVFS() const { - return mResourcesManager.getVFS(); + return mVFS; } const Fallback::Map* CSMWorld::Data::getFallbackMap() const diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index 8fe5eeff9..771a706b3 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -108,6 +108,7 @@ namespace CSMWorld RefCollection mRefs; IdCollection mFilters; Collection mMetaData; + VFS::Manager* mVFS; ResourcesManager& mResourcesManager; const Fallback::Map* mFallbackMap; std::vector mModels; @@ -140,7 +141,7 @@ namespace CSMWorld public: - Data (ToUTF8::FromType encoding, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir); + Data (ToUTF8::FromType encoding, VFS::Manager* vfs, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir); virtual ~Data(); diff --git a/apps/opencs/model/world/resourcesmanager.cpp b/apps/opencs/model/world/resourcesmanager.cpp index 6b271c276..c50b86682 100644 --- a/apps/opencs/model/world/resourcesmanager.cpp +++ b/apps/opencs/model/world/resourcesmanager.cpp @@ -14,16 +14,19 @@ void CSMWorld::ResourcesManager::addResources (const Resources& resources) resources)); } -void CSMWorld::ResourcesManager::setVFS(VFS::Manager *vfs) +const char * const * CSMWorld::ResourcesManager::getMeshExtensions() { - mVFS = vfs; - mResources.clear(); - // maybe we could go over the osgDB::Registry to list all supported node formats - static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 }; + return sMeshTypes; +} - addResources (Resources (vfs, "meshes", UniversalId::Type_Mesh, sMeshTypes)); +void CSMWorld::ResourcesManager::setVFS(const VFS::Manager *vfs) +{ + mVFS = vfs; + mResources.clear(); + + addResources (Resources (vfs, "meshes", UniversalId::Type_Mesh, getMeshExtensions())); addResources (Resources (vfs, "icons", UniversalId::Type_Icon)); addResources (Resources (vfs, "music", UniversalId::Type_Music)); addResources (Resources (vfs, "sound", UniversalId::Type_SoundRes)); @@ -31,21 +34,18 @@ void CSMWorld::ResourcesManager::setVFS(VFS::Manager *vfs) addResources (Resources (vfs, "videos", UniversalId::Type_Video)); } -VFS::Manager* CSMWorld::ResourcesManager::getVFS() const +const VFS::Manager* CSMWorld::ResourcesManager::getVFS() const { return mVFS; } void CSMWorld::ResourcesManager::recreateResources() { - // TODO make this shared with setVFS function - static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 }; - std::map::iterator it = mResources.begin(); for ( ; it != mResources.end(); ++it) { if (it->first == UniversalId::Type_Mesh) - it->second.recreate(mVFS, sMeshTypes); + it->second.recreate(mVFS, getMeshExtensions()); else it->second.recreate(mVFS); } diff --git a/apps/opencs/model/world/resourcesmanager.hpp b/apps/opencs/model/world/resourcesmanager.hpp index 969666856..0e8385300 100644 --- a/apps/opencs/model/world/resourcesmanager.hpp +++ b/apps/opencs/model/world/resourcesmanager.hpp @@ -16,19 +16,21 @@ namespace CSMWorld class ResourcesManager { std::map mResources; - VFS::Manager* mVFS; + const VFS::Manager* mVFS; private: void addResources (const Resources& resources); + const char * const * getMeshExtensions(); + public: ResourcesManager(); - VFS::Manager* getVFS() const; + const VFS::Manager* getVFS() const; - void setVFS(VFS::Manager* vfs); + void setVFS(const VFS::Manager* vfs); void recreateResources(); diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index b1061adcd..d7a6771c4 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -2,8 +2,6 @@ #include -#include - #include "scenemanager.hpp" #include "imagemanager.hpp" #include "niffilemanager.hpp" From 7914fd5c9c42ea4c678a925253d495429c049248 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sun, 20 Aug 2017 19:36:21 -0400 Subject: [PATCH 308/318] Re-index BSAs --- components/vfs/archive.hpp | 4 ++-- components/vfs/bsaarchive.cpp | 24 ++++++++++++++++++------ components/vfs/bsaarchive.hpp | 5 +++++ components/vfs/filesystemarchive.cpp | 2 +- components/vfs/filesystemarchive.hpp | 2 +- components/vfs/manager.cpp | 2 +- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/components/vfs/archive.hpp b/components/vfs/archive.hpp index 9bdf12c23..f2082f750 100644 --- a/components/vfs/archive.hpp +++ b/components/vfs/archive.hpp @@ -21,8 +21,8 @@ namespace VFS public: virtual ~Archive() {} - /// Clears cached data for archives that may change. - virtual void resetIfNotStatic(){}; + /// Clears cached data. + virtual void reset() = 0; /// List all resources contained in this archive, and run the resource names through the given normalize function. virtual void listResources(std::map& out, char (*normalize_function) (char)) = 0; diff --git a/components/vfs/bsaarchive.cpp b/components/vfs/bsaarchive.cpp index a527a6ad9..88e6bf2c7 100644 --- a/components/vfs/bsaarchive.cpp +++ b/components/vfs/bsaarchive.cpp @@ -5,14 +5,15 @@ namespace VFS BsaArchive::BsaArchive(const std::string &filename) + : mFileName(filename) { - mFile.open(filename); + load(); +} - const Bsa::BSAFile::FileList &filelist = mFile.getList(); - for(Bsa::BSAFile::FileList::const_iterator it = filelist.begin();it != filelist.end();++it) - { - mResources.push_back(BsaArchiveFile(&*it, &mFile)); - } +void BsaArchive::reset() +{ + mResources.clear(); + load(); } void BsaArchive::listResources(std::map &out, char (*normalize_function)(char)) @@ -26,6 +27,17 @@ void BsaArchive::listResources(std::map &out, char (*normal } } +void BsaArchive::load() +{ + mFile.open(mFileName); + + const Bsa::BSAFile::FileList &filelist = mFile.getList(); + for(Bsa::BSAFile::FileList::const_iterator it = filelist.begin();it != filelist.end();++it) + { + mResources.push_back(BsaArchiveFile(&*it, &mFile)); + } +} + // ------------------------------------------------------------------------------ BsaArchiveFile::BsaArchiveFile(const Bsa::BSAFile::FileStruct *info, Bsa::BSAFile* bsa) diff --git a/components/vfs/bsaarchive.hpp b/components/vfs/bsaarchive.hpp index a6e274037..92204f90c 100644 --- a/components/vfs/bsaarchive.hpp +++ b/components/vfs/bsaarchive.hpp @@ -24,9 +24,14 @@ namespace VFS public: BsaArchive(const std::string& filename); + virtual void reset(); + virtual void listResources(std::map& out, char (*normalize_function) (char)); private: + void load(); + + std::string mFileName; Bsa::BSAFile mFile; std::vector mResources; diff --git a/components/vfs/filesystemarchive.cpp b/components/vfs/filesystemarchive.cpp index 9240909ad..8fb992e76 100644 --- a/components/vfs/filesystemarchive.cpp +++ b/components/vfs/filesystemarchive.cpp @@ -12,7 +12,7 @@ namespace VFS } - void FileSystemArchive::resetIfNotStatic() + void FileSystemArchive::reset() { mIndex.clear(); mBuiltIndex = false; diff --git a/components/vfs/filesystemarchive.hpp b/components/vfs/filesystemarchive.hpp index 16c2d65ea..5843bf871 100644 --- a/components/vfs/filesystemarchive.hpp +++ b/components/vfs/filesystemarchive.hpp @@ -23,7 +23,7 @@ namespace VFS public: FileSystemArchive(const std::string& path); - virtual void resetIfNotStatic(); + virtual void reset(); virtual void listResources(std::map& out, char (*normalize_function) (char)); diff --git a/components/vfs/manager.cpp b/components/vfs/manager.cpp index 037fef325..9b1798e8f 100644 --- a/components/vfs/manager.cpp +++ b/components/vfs/manager.cpp @@ -60,7 +60,7 @@ namespace VFS void Manager::rebuildIndex() { for (std::vector::const_iterator it = mArchives.begin(); it != mArchives.end(); ++it) - (*it)->resetIfNotStatic(); + (*it)->reset(); buildIndex(); } From b62cb0e2a47d5252d686ee2770ddc6fb6711a194 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sun, 20 Aug 2017 19:55:16 -0400 Subject: [PATCH 309/318] Clear out GPU texture/stateset cache --- components/resource/scenemanager.cpp | 16 ++++++++++++++++ components/resource/scenemanager.hpp | 2 ++ 2 files changed, 18 insertions(+) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 226933760..2f04aa7c2 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -122,6 +122,13 @@ namespace Resource { return _sharedStateSetList.size(); } + + void clearCache() + { + OpenThreads::ScopedLock lock(_listMutex); + _sharedTextureList.clear(); + _sharedStateSetList.clear(); + } }; /// Set texture filtering settings on textures contained in a FlipController. @@ -710,6 +717,15 @@ namespace Resource mSharedStateMutex.unlock(); } + void SceneManager::clearCache() + { + ResourceManager::clearCache(); + + mSharedStateMutex.lock(); + mSharedStateManager->clearCache(); + mSharedStateMutex.unlock(); + } + void SceneManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { { diff --git a/components/resource/scenemanager.hpp b/components/resource/scenemanager.hpp index c6ff02acf..14032df77 100644 --- a/components/resource/scenemanager.hpp +++ b/components/resource/scenemanager.hpp @@ -143,6 +143,8 @@ namespace Resource /// @see ResourceManager::updateCache virtual void updateCache(double referenceTime); + virtual void clearCache(); + virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: From d4a722067db0aeeac725ea654ab70f36a8eee968 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sun, 20 Aug 2017 20:55:56 -0400 Subject: [PATCH 310/318] Reload water --- apps/opencs/view/render/cell.cpp | 2 ++ apps/opencs/view/render/cellwater.cpp | 5 +++++ apps/opencs/view/render/cellwater.hpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 4b06432d6..ebc383ff2 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -290,6 +290,8 @@ void CSVRender::Cell::reloadAssets() { iter->second->reloadAssets(); } + + mCellWater->reloadAssets(); } void CSVRender::Cell::setSelection (int elementMask, Selection mode) diff --git a/apps/opencs/view/render/cellwater.cpp b/apps/opencs/view/render/cellwater.cpp index 15ea15cc4..d7e8669ef 100644 --- a/apps/opencs/view/render/cellwater.cpp +++ b/apps/opencs/view/render/cellwater.cpp @@ -92,6 +92,11 @@ namespace CSVRender } } + void CellWater::reloadAssets() + { + recreate(); + } + void CellWater::cellDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) { const CSMWorld::Collection& cells = mData.getCells(); diff --git a/apps/opencs/view/render/cellwater.hpp b/apps/opencs/view/render/cellwater.hpp index d2ed9b458..47e586707 100644 --- a/apps/opencs/view/render/cellwater.hpp +++ b/apps/opencs/view/render/cellwater.hpp @@ -42,6 +42,8 @@ namespace CSVRender void updateCellData(const CSMWorld::Record& cellRecord); + void reloadAssets(); + private slots: void cellDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); From 3b9326d238f0dd2da0afd47e0a96dda8aa401e0b Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Sun, 20 Aug 2017 22:34:41 -0400 Subject: [PATCH 311/318] Clear terrain cache and reload terrain --- apps/opencs/view/render/cell.cpp | 7 +++++++ components/terrain/buffercache.cpp | 12 ++++++++++++ components/terrain/buffercache.hpp | 2 ++ components/terrain/chunkmanager.cpp | 7 +++++++ components/terrain/chunkmanager.hpp | 2 ++ components/terrain/world.cpp | 6 ++++++ components/terrain/world.hpp | 3 +++ 7 files changed, 39 insertions(+) diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index ebc383ff2..5aa534232 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -291,6 +291,13 @@ void CSVRender::Cell::reloadAssets() iter->second->reloadAssets(); } + if (mTerrain) + { + mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY()); + mTerrain->clearCache(); + mTerrain->loadCell(mCoordinates.getX(), mCoordinates.getY()); + } + mCellWater->reloadAssets(); } diff --git a/components/terrain/buffercache.cpp b/components/terrain/buffercache.cpp index 470655539..361dd6c04 100644 --- a/components/terrain/buffercache.cpp +++ b/components/terrain/buffercache.cpp @@ -231,4 +231,16 @@ namespace Terrain return buffer; } + void BufferCache::clearCache() + { + { + OpenThreads::ScopedLock lock(mIndexBufferMutex); + mIndexBufferMap.clear(); + } + { + OpenThreads::ScopedLock lock(mUvBufferMutex); + mUvBufferMap.clear(); + } + } + } diff --git a/components/terrain/buffercache.hpp b/components/terrain/buffercache.hpp index e8963354b..bfdf558bc 100644 --- a/components/terrain/buffercache.hpp +++ b/components/terrain/buffercache.hpp @@ -22,6 +22,8 @@ namespace Terrain /// @note Thread safe. osg::ref_ptr getUVBuffer(unsigned int numVerts); + void clearCache(); + // TODO: add releaseGLObjects() for our vertex/element buffer objects private: diff --git a/components/terrain/chunkmanager.cpp b/components/terrain/chunkmanager.cpp index e4a7c2d68..ea71c726f 100644 --- a/components/terrain/chunkmanager.cpp +++ b/components/terrain/chunkmanager.cpp @@ -55,6 +55,13 @@ void ChunkManager::reportStats(unsigned int frameNumber, osg::Stats *stats) cons stats->setAttribute(frameNumber, "Terrain Chunk", mCache->getCacheSize()); } +void ChunkManager::clearCache() +{ + ResourceManager::clearCache(); + + mBufferCache.clearCache(); +} + void ChunkManager::setCullingActive(bool active) { mCullingActive = active; diff --git a/components/terrain/chunkmanager.hpp b/components/terrain/chunkmanager.hpp index 553e06d97..2f92fa836 100644 --- a/components/terrain/chunkmanager.hpp +++ b/components/terrain/chunkmanager.hpp @@ -34,6 +34,8 @@ namespace Terrain virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const; + virtual void clearCache(); + void setCullingActive(bool active); private: diff --git a/components/terrain/world.cpp b/components/terrain/world.cpp index b7cc0ae01..9bbb585a8 100644 --- a/components/terrain/world.cpp +++ b/components/terrain/world.cpp @@ -70,6 +70,12 @@ float World::getHeightAt(const osg::Vec3f &worldPos) return mStorage->getHeightAt(worldPos); } +void World::clearCache() +{ + mTextureManager->clearCache(); + mChunkManager->clearCache(); +} + void World::updateTextureFiltering() { mTextureManager->updateTextureFiltering(); diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index d0576fbd3..2fb669494 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -67,6 +67,9 @@ namespace Terrain /// @note Thread safe. virtual void cacheCell(View* view, int x, int y) {} + /// Clears cached texture and chunk data. + virtual void clearCache(); + /// Load the cell into the scene graph. /// @note Not thread safe. /// @note May be ignored by derived implementations that don't organize the terrain into cells. From 679a2847355e722bd1bd600a246985828c36f79d Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Mon, 21 Aug 2017 13:33:11 -0400 Subject: [PATCH 312/318] Use scoped lock instead of directly locking/unlocking mutex --- components/resource/scenemanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 2f04aa7c2..aba1d454e 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -721,9 +721,8 @@ namespace Resource { ResourceManager::clearCache(); - mSharedStateMutex.lock(); + OpenThreads::ScopedLock lock(mSharedStateMutex); mSharedStateManager->clearCache(); - mSharedStateMutex.unlock(); } void SceneManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const From 979b0d7211ab0a8db8dd27bb7a69db3c70bf2ad3 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Mon, 21 Aug 2017 18:58:38 -0400 Subject: [PATCH 313/318] Code cleanup and more cache clearing --- apps/opencs/model/world/data.cpp | 40 ++++++++++++---------- apps/opencs/view/doc/view.cpp | 1 - apps/opencs/view/render/cell.cpp | 1 - components/resource/bulletshapemanager.cpp | 7 ++++ components/resource/bulletshapemanager.hpp | 2 ++ components/resource/multiobjectcache.cpp | 6 ++++ components/resource/multiobjectcache.hpp | 3 ++ components/resource/resourcesystem.hpp | 1 + components/resource/scenemanager.cpp | 1 + components/terrain/world.cpp | 6 ---- components/terrain/world.hpp | 3 -- 11 files changed, 41 insertions(+), 30 deletions(-) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index d7f42d027..39c0291fc 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -1220,29 +1220,31 @@ void CSMWorld::Data::assetsChanged() { mVFS->rebuildIndex(); - ResourceTable* meshTable = static_cast(getTableModel(UniversalId::Type_Meshes)); - ResourceTable* iconTable = static_cast(getTableModel(UniversalId::Type_Icons)); - ResourceTable* musicTable = static_cast(getTableModel(UniversalId::Type_Musics)); - ResourceTable* soundResTable = static_cast(getTableModel(UniversalId::Type_SoundsRes)); - ResourceTable* texTable = static_cast(getTableModel(UniversalId::Type_Textures)); - ResourceTable* vidTable = static_cast(getTableModel(UniversalId::Type_Videos)); - - meshTable->beginReset(); - iconTable->beginReset(); - musicTable->beginReset(); - soundResTable->beginReset(); - texTable->beginReset(); - vidTable->beginReset(); + const UniversalId assetTableIds[] = { + UniversalId::Type_Meshes, + UniversalId::Type_Icons, + UniversalId::Type_Musics, + UniversalId::Type_SoundsRes, + UniversalId::Type_Textures, + UniversalId::Type_Videos + }; + + size_t numAssetTables = sizeof(assetTableIds) / sizeof(UniversalId); + + for (size_t i = 0; i < numAssetTables; ++i) + { + ResourceTable* table = static_cast(getTableModel(assetTableIds[i])); + table->beginReset(); + } // Trigger recreation mResourcesManager.recreateResources(); - meshTable->endReset(); - iconTable->endReset(); - musicTable->endReset(); - soundResTable->endReset(); - texTable->endReset(); - vidTable->endReset(); + for (size_t i = 0; i < numAssetTables; ++i) + { + ResourceTable* table = static_cast(getTableModel(assetTableIds[i])); + table->endReset(); + } // Get rid of potentially old cached assets mResourceSystem->clearCache(); diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 92ed07daf..dfbeea031 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -896,7 +896,6 @@ void CSVDoc::View::addMetaDataSubView() addSubView (CSMWorld::UniversalId (CSMWorld::UniversalId::Type_MetaData, "sys::meta")); } - void CSVDoc::View::abortOperation (int type) { mDocument->abortOperation (type); diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 5aa534232..a10e38397 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -294,7 +294,6 @@ void CSVRender::Cell::reloadAssets() if (mTerrain) { mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY()); - mTerrain->clearCache(); mTerrain->loadCell(mCoordinates.getX(), mCoordinates.getY()); } diff --git a/components/resource/bulletshapemanager.cpp b/components/resource/bulletshapemanager.cpp index 010917572..c1a7eb8f3 100644 --- a/components/resource/bulletshapemanager.cpp +++ b/components/resource/bulletshapemanager.cpp @@ -190,6 +190,13 @@ void BulletShapeManager::updateCache(double referenceTime) mInstanceCache->removeUnreferencedObjectsInCache(); } +void BulletShapeManager::clearCache() +{ + ResourceManager::clearCache(); + + mInstanceCache->clear(); +} + void BulletShapeManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { stats->setAttribute(frameNumber, "Shape", mCache->getCacheSize()); diff --git a/components/resource/bulletshapemanager.hpp b/components/resource/bulletshapemanager.hpp index fec7251ac..8ae2b531f 100644 --- a/components/resource/bulletshapemanager.hpp +++ b/components/resource/bulletshapemanager.hpp @@ -42,6 +42,8 @@ namespace Resource /// @see ResourceManager::updateCache virtual void updateCache(double referenceTime); + virtual void clearCache(); + void reportStats(unsigned int frameNumber, osg::Stats *stats) const; private: diff --git a/components/resource/multiobjectcache.cpp b/components/resource/multiobjectcache.cpp index fcda455cc..266139f3c 100644 --- a/components/resource/multiobjectcache.cpp +++ b/components/resource/multiobjectcache.cpp @@ -43,6 +43,12 @@ namespace Resource objectsToRemove.clear(); } + void MultiObjectCache::clear() + { + OpenThreads::ScopedLock lock(_objectCacheMutex); + _objectCache.clear(); + } + void MultiObjectCache::addEntryToObjectCache(const std::string &filename, osg::Object *object) { OpenThreads::ScopedLock lock(_objectCacheMutex); diff --git a/components/resource/multiobjectcache.hpp b/components/resource/multiobjectcache.hpp index a314a9e4b..527247bf9 100644 --- a/components/resource/multiobjectcache.hpp +++ b/components/resource/multiobjectcache.hpp @@ -25,6 +25,9 @@ namespace Resource void removeUnreferencedObjectsInCache(); + /** Remove all objects from the cache. */ + void clear(); + void addEntryToObjectCache(const std::string& filename, osg::Object* object); /** Take an Object from cache. Return NULL if no object found. */ diff --git a/components/resource/resourcesystem.hpp b/components/resource/resourcesystem.hpp index ef9ac9647..efce50b97 100644 --- a/components/resource/resourcesystem.hpp +++ b/components/resource/resourcesystem.hpp @@ -42,6 +42,7 @@ namespace Resource void updateCache(double referenceTime); /// Indicates to each resource manager to clear the entire cache. + /// @note May be called from any thread if you do not add or remove resource managers at that point. void clearCache(); /// Add this ResourceManager to be handled by the ResourceSystem. diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index aba1d454e..69a54bf17 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -723,6 +723,7 @@ namespace Resource OpenThreads::ScopedLock lock(mSharedStateMutex); mSharedStateManager->clearCache(); + mInstanceCache->clear(); } void SceneManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const diff --git a/components/terrain/world.cpp b/components/terrain/world.cpp index 9bbb585a8..b7cc0ae01 100644 --- a/components/terrain/world.cpp +++ b/components/terrain/world.cpp @@ -70,12 +70,6 @@ float World::getHeightAt(const osg::Vec3f &worldPos) return mStorage->getHeightAt(worldPos); } -void World::clearCache() -{ - mTextureManager->clearCache(); - mChunkManager->clearCache(); -} - void World::updateTextureFiltering() { mTextureManager->updateTextureFiltering(); diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index 2fb669494..d0576fbd3 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -67,9 +67,6 @@ namespace Terrain /// @note Thread safe. virtual void cacheCell(View* view, int x, int y) {} - /// Clears cached texture and chunk data. - virtual void clearCache(); - /// Load the cell into the scene graph. /// @note Not thread safe. /// @note May be ignored by derived implementations that don't organize the terrain into cells. From 8c4b12a6035588e1e9dfdcc2d4475ac6babd57e8 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Mon, 21 Aug 2017 22:31:19 -0400 Subject: [PATCH 314/318] VFS changes, one VFS and resource system per document. Added ability to reset a VFS::Manager. Removed ability to rebuild the index for a VFS::Manager. Moved VFS creation to CSM::Data. --- apps/opencs/editor.cpp | 9 +-------- apps/opencs/editor.hpp | 10 ---------- apps/opencs/model/doc/document.cpp | 16 ++++++---------- apps/opencs/model/doc/document.hpp | 12 +++++------- apps/opencs/model/doc/documentmanager.cpp | 11 ++++++----- apps/opencs/model/doc/documentmanager.hpp | 20 ++++++++++---------- apps/opencs/model/world/data.cpp | 19 ++++++++++++++----- apps/opencs/model/world/data.hpp | 13 ++++++++++--- components/vfs/archive.hpp | 3 --- components/vfs/bsaarchive.cpp | 6 ------ components/vfs/bsaarchive.hpp | 2 -- components/vfs/filesystemarchive.cpp | 6 ------ components/vfs/filesystemarchive.hpp | 2 -- components/vfs/manager.cpp | 14 ++++++-------- components/vfs/manager.hpp | 6 +++--- 15 files changed, 61 insertions(+), 88 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 54e323956..86c87962d 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -5,9 +5,6 @@ #include #include -#include -#include - #include #include @@ -33,11 +30,7 @@ CS::Editor::Editor () NifOsg::Loader::setShowMarkers(true); - mVFS.reset(new VFS::Manager(mFsStrict)); - - VFS::registerArchives(mVFS.get(), Files::Collections(config.first, !mFsStrict), config.second, true); - - mDocumentManager.setVFS(mVFS.get()); + mDocumentManager.setFileData(mFsStrict, config.first, config.second); mNewGame.setLocalData (mLocal); mFileDialog.setLocalData (mLocal); diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index ff670ba1b..b60f5c6a8 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -1,8 +1,6 @@ #ifndef CS_EDITOR_H #define CS_EDITOR_H -#include - #include #include @@ -30,11 +28,6 @@ #include "view/tools/merge.hpp" -namespace VFS -{ - class Manager; -} - namespace CSMDoc { class Document; @@ -46,9 +39,6 @@ namespace CS { Q_OBJECT - // FIXME: should be moved to document, so we can have different resources for each opened project - std::unique_ptr mVFS; - Files::ConfigurationManager mCfgMgr; CSMPrefs::State mSettingsState; CSMDoc::DocumentManager mDocumentManager; diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index d9f86cdde..7257b2fe3 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -269,13 +269,14 @@ void CSMDoc::Document::createBase() } } -CSMDoc::Document::Document (VFS::Manager* vfs, const Files::ConfigurationManager& configuration, - const std::vector< boost::filesystem::path >& files, bool new_, +CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, + const std::vector< boost::filesystem::path >& files,bool new_, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, const Fallback::Map* fallback, - ToUTF8::FromType encoding, CSMWorld::ResourcesManager& resourcesManager, - const std::vector& blacklistedScripts) -: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, vfs, resourcesManager, fallback, resDir), + ToUTF8::FromType encoding, + const std::vector& blacklistedScripts, + bool fsStrict, const Files::PathContainer& dataPaths, const std::vector& archives) +: mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, fsStrict, dataPaths, archives, fallback, resDir), mTools (*this, encoding), mProjectPath ((configuration.getUserDataPath() / "projects") / (savePath.filename().string() + ".project")), @@ -337,11 +338,6 @@ CSMDoc::Document::~Document() { } -const VFS::Manager *CSMDoc::Document::getVFS() const -{ - return mVFS; -} - QUndoStack& CSMDoc::Document::getUndoStack() { return mUndoStack; diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index ad0201407..d31fd5aca 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -9,6 +9,7 @@ #include #include +#include #include #include "../world/data.hpp" @@ -59,7 +60,6 @@ namespace CSMDoc private: - VFS::Manager* mVFS; boost::filesystem::path mSavePath; std::vector mContentFiles; bool mNew; @@ -102,17 +102,15 @@ namespace CSMDoc public: - Document (VFS::Manager* vfs, const Files::ConfigurationManager& configuration, + Document (const Files::ConfigurationManager& configuration, const std::vector< boost::filesystem::path >& files, bool new_, const boost::filesystem::path& savePath, const boost::filesystem::path& resDir, - const Fallback::Map* fallback, - ToUTF8::FromType encoding, CSMWorld::ResourcesManager& resourcesManager, - const std::vector& blacklistedScripts); + const Fallback::Map* fallback, ToUTF8::FromType encoding, + const std::vector& blacklistedScripts, + bool fsStrict, const Files::PathContainer& dataPaths, const std::vector& archives); ~Document(); - const VFS::Manager* getVFS() const; - QUndoStack& getUndoStack(); int getState() const; diff --git a/apps/opencs/model/doc/documentmanager.cpp b/apps/opencs/model/doc/documentmanager.cpp index 11378cab4..531cfd267 100644 --- a/apps/opencs/model/doc/documentmanager.cpp +++ b/apps/opencs/model/doc/documentmanager.cpp @@ -9,7 +9,7 @@ #include "document.hpp" CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& configuration) -: mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252), mVFS(NULL) +: mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252) { boost::filesystem::path projectPath = configuration.getUserDataPath() / "projects"; @@ -62,7 +62,7 @@ CSMDoc::Document *CSMDoc::DocumentManager::makeDocument ( const std::vector< boost::filesystem::path >& files, const boost::filesystem::path& savePath, bool new_) { - return new Document (mVFS, mConfiguration, files, new_, savePath, mResDir, &mFallbackMap, mEncoding, mResourcesManager, mBlacklistedScripts); + return new Document (mConfiguration, files, new_, savePath, mResDir, &mFallbackMap, mEncoding, mBlacklistedScripts, mFsStrict, mDataPaths, mArchives); } void CSMDoc::DocumentManager::insertDocument (CSMDoc::Document *document) @@ -127,8 +127,9 @@ void CSMDoc::DocumentManager::documentNotLoaded (Document *document, const std:: removeDocument (document); } -void CSMDoc::DocumentManager::setVFS(VFS::Manager *vfs) +void CSMDoc::DocumentManager::setFileData(bool strict, const Files::PathContainer& dataPaths, const std::vector& archives) { - mResourcesManager.setVFS(vfs); - mVFS = vfs; + mFsStrict = strict; + mDataPaths = dataPaths; + mArchives = archives; } diff --git a/apps/opencs/model/doc/documentmanager.hpp b/apps/opencs/model/doc/documentmanager.hpp index 771afe8e5..ae6d9481a 100644 --- a/apps/opencs/model/doc/documentmanager.hpp +++ b/apps/opencs/model/doc/documentmanager.hpp @@ -11,8 +11,7 @@ #include #include - -#include "../world/resourcesmanager.hpp" +#include #include "loader.hpp" @@ -39,9 +38,14 @@ namespace CSMDoc QThread mLoaderThread; Loader mLoader; ToUTF8::FromType mEncoding; - CSMWorld::ResourcesManager mResourcesManager; std::vector mBlacklistedScripts; - VFS::Manager* mVFS; + + boost::filesystem::path mResDir; + Fallback::Map mFallbackMap; + + bool mFsStrict; + Files::PathContainer mDataPaths; + std::vector mArchives; DocumentManager (const DocumentManager&); DocumentManager& operator= (const DocumentManager&); @@ -74,15 +78,11 @@ namespace CSMDoc void setBlacklistedScripts (const std::vector& scriptIds); - void setVFS(VFS::Manager* vfs); + /// Sets the file data that gets passed to newly created documents. + void setFileData(bool strict, const Files::PathContainer& dataPaths, const std::vector& archives); bool isEmpty(); - private: - - boost::filesystem::path mResDir; - Fallback::Map mFallbackMap; - private slots: void documentLoaded (Document *document); diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 39c0291fc..007190e4a 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -12,6 +12,7 @@ #include #include +#include #include "idtable.hpp" #include "idtree.hpp" @@ -62,11 +63,18 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec return number; } -CSMWorld::Data::Data (ToUTF8::FromType encoding, VFS::Manager* vfs, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir) +CSMWorld::Data::Data (ToUTF8::FromType encoding, bool fsStrict, const Files::PathContainer& dataPaths, + const std::vector& archives, const Fallback::Map* fallback, const boost::filesystem::path& resDir) : mEncoder (encoding), mPathgrids (mCells), mRefs (mCells), - mVFS(vfs), mResourcesManager (resourcesManager), mFallbackMap(fallback), - mReader (0), mDialogue (0), mReaderIndex(1), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS())) + mFallbackMap(fallback), mReader (0), mDialogue (0), mReaderIndex(1), + mFsStrict(fsStrict), mDataPaths(dataPaths), mArchives(archives) { + mVFS.reset(new VFS::Manager(mFsStrict)); + VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths, !mFsStrict), mArchives, true); + + mResourcesManager.setVFS(mVFS.get()); + mResourceSystem.reset(new Resource::ResourceSystem(mVFS.get())); + mResourceSystem->getSceneManager()->setShaderPath((resDir / "shaders").string()); int index = 0; @@ -1218,7 +1226,8 @@ std::vector CSMWorld::Data::getIds (bool listDeleted) const void CSMWorld::Data::assetsChanged() { - mVFS->rebuildIndex(); + mVFS.get()->reset(); + VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths, !mFsStrict), mArchives, true); const UniversalId assetTableIds[] = { UniversalId::Type_Meshes, @@ -1265,7 +1274,7 @@ void CSMWorld::Data::rowsChanged (const QModelIndex& parent, int start, int end) const VFS::Manager* CSMWorld::Data::getVFS() const { - return mVFS; + return mVFS.get(); } const Fallback::Map* CSMWorld::Data::getFallbackMap() const diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index 771a706b3..8a3667ea1 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -31,6 +31,7 @@ #include +#include #include #include "../doc/stage.hpp" @@ -46,6 +47,7 @@ #include "infocollection.hpp" #include "nestedinfocollection.hpp" #include "pathgrid.hpp" +#include "resourcesmanager.hpp" #include "metadata.hpp" #ifndef Q_MOC_RUN #include "subcellcollection.hpp" @@ -108,8 +110,6 @@ namespace CSMWorld RefCollection mRefs; IdCollection mFilters; Collection mMetaData; - VFS::Manager* mVFS; - ResourcesManager& mResourcesManager; const Fallback::Map* mFallbackMap; std::vector mModels; std::map mModelIndex; @@ -120,6 +120,11 @@ namespace CSMWorld std::map > mRefLoadCache; int mReaderIndex; + bool mFsStrict; + Files::PathContainer mDataPaths; + std::vector mArchives; + std::unique_ptr mVFS; + ResourcesManager mResourcesManager; std::shared_ptr mResourceSystem; std::vector > mReaders; @@ -141,7 +146,9 @@ namespace CSMWorld public: - Data (ToUTF8::FromType encoding, VFS::Manager* vfs, ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir); + Data (ToUTF8::FromType encoding, bool fsStrict, const Files::PathContainer& dataPaths, + const std::vector& archives, const Fallback::Map* fallback, + const boost::filesystem::path& resDir); virtual ~Data(); diff --git a/components/vfs/archive.hpp b/components/vfs/archive.hpp index f2082f750..b36c7117b 100644 --- a/components/vfs/archive.hpp +++ b/components/vfs/archive.hpp @@ -21,9 +21,6 @@ namespace VFS public: virtual ~Archive() {} - /// Clears cached data. - virtual void reset() = 0; - /// List all resources contained in this archive, and run the resource names through the given normalize function. virtual void listResources(std::map& out, char (*normalize_function) (char)) = 0; }; diff --git a/components/vfs/bsaarchive.cpp b/components/vfs/bsaarchive.cpp index 88e6bf2c7..9b686049f 100644 --- a/components/vfs/bsaarchive.cpp +++ b/components/vfs/bsaarchive.cpp @@ -10,12 +10,6 @@ BsaArchive::BsaArchive(const std::string &filename) load(); } -void BsaArchive::reset() -{ - mResources.clear(); - load(); -} - void BsaArchive::listResources(std::map &out, char (*normalize_function)(char)) { for (std::vector::iterator it = mResources.begin(); it != mResources.end(); ++it) diff --git a/components/vfs/bsaarchive.hpp b/components/vfs/bsaarchive.hpp index 92204f90c..217594abd 100644 --- a/components/vfs/bsaarchive.hpp +++ b/components/vfs/bsaarchive.hpp @@ -24,8 +24,6 @@ namespace VFS public: BsaArchive(const std::string& filename); - virtual void reset(); - virtual void listResources(std::map& out, char (*normalize_function) (char)); private: diff --git a/components/vfs/filesystemarchive.cpp b/components/vfs/filesystemarchive.cpp index 8fb992e76..ad5150a44 100644 --- a/components/vfs/filesystemarchive.cpp +++ b/components/vfs/filesystemarchive.cpp @@ -12,12 +12,6 @@ namespace VFS } - void FileSystemArchive::reset() - { - mIndex.clear(); - mBuiltIndex = false; - } - void FileSystemArchive::listResources(std::map &out, char (*normalize_function)(char)) { if (!mBuiltIndex) diff --git a/components/vfs/filesystemarchive.hpp b/components/vfs/filesystemarchive.hpp index 5843bf871..6c8e1b82b 100644 --- a/components/vfs/filesystemarchive.hpp +++ b/components/vfs/filesystemarchive.hpp @@ -23,8 +23,6 @@ namespace VFS public: FileSystemArchive(const std::string& path); - virtual void reset(); - virtual void listResources(std::map& out, char (*normalize_function) (char)); diff --git a/components/vfs/manager.cpp b/components/vfs/manager.cpp index 9b1798e8f..4f3994bac 100644 --- a/components/vfs/manager.cpp +++ b/components/vfs/manager.cpp @@ -39,6 +39,12 @@ namespace VFS Manager::~Manager() { + reset(); + } + + void Manager::reset() + { + mIndex.clear(); for (std::vector::iterator it = mArchives.begin(); it != mArchives.end(); ++it) delete *it; mArchives.clear(); @@ -57,14 +63,6 @@ namespace VFS (*it)->listResources(mIndex, mStrict ? &strict_normalize_char : &nonstrict_normalize_char); } - void Manager::rebuildIndex() - { - for (std::vector::const_iterator it = mArchives.begin(); it != mArchives.end(); ++it) - (*it)->reset(); - - buildIndex(); - } - Files::IStreamPtr Manager::get(const std::string &name) const { std::string normalized = name; diff --git a/components/vfs/manager.hpp b/components/vfs/manager.hpp index 2ad7cf643..c5f0a8fec 100644 --- a/components/vfs/manager.hpp +++ b/components/vfs/manager.hpp @@ -26,6 +26,9 @@ namespace VFS ~Manager(); + // Empty the file index and unregister archives. + void reset(); + /// Register the given archive. All files contained in it will be added to the index on the next buildIndex() call. /// @note Takes ownership of the given pointer. void addArchive(Archive* archive); @@ -33,9 +36,6 @@ namespace VFS /// Build the file index. Should be called when all archives have been registered. void buildIndex(); - /// Rebuild the file index. New/deleted files (actual files, not bsa's) will be reflected. - void rebuildIndex(); - /// Does a file with this name exist? /// @note May be called from any thread once the index has been built. bool exists(const std::string& name) const; From e799cbdb51c2a3d0a74df24951eb59405a3a9740 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 22 Aug 2017 09:18:49 +0400 Subject: [PATCH 315/318] Combat AI: allow only one summoned creature at time --- apps/openmw/mwmechanics/spellpriority.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/openmw/mwmechanics/spellpriority.cpp b/apps/openmw/mwmechanics/spellpriority.cpp index 9c57a2a7f..3a730fbeb 100644 --- a/apps/openmw/mwmechanics/spellpriority.cpp +++ b/apps/openmw/mwmechanics/spellpriority.cpp @@ -496,6 +496,15 @@ namespace MWMechanics break; } + // Allow only one summoned creature at time + if (isSummoningEffect(effect.mEffectID)) + { + MWMechanics::CreatureStats& creatureStats = actor.getClass().getCreatureStats(actor); + + if (!creatureStats.getSummonedCreatureMap().empty()) + return 0.f; + } + const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); // Underwater casting not possible From d3d04171f9f1c80cfce59ed99a3e66da8fa57770 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Tue, 22 Aug 2017 15:06:56 -0400 Subject: [PATCH 316/318] Fix seg fault, undo changes BsaArchive --- apps/opencs/view/render/cell.cpp | 3 ++- components/vfs/bsaarchive.cpp | 20 +++++++------------- components/vfs/bsaarchive.hpp | 3 --- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index a10e38397..153de773c 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -297,7 +297,8 @@ void CSVRender::Cell::reloadAssets() mTerrain->loadCell(mCoordinates.getX(), mCoordinates.getY()); } - mCellWater->reloadAssets(); + if (mCellWater) + mCellWater->reloadAssets(); } void CSVRender::Cell::setSelection (int elementMask, Selection mode) diff --git a/components/vfs/bsaarchive.cpp b/components/vfs/bsaarchive.cpp index 9b686049f..a527a6ad9 100644 --- a/components/vfs/bsaarchive.cpp +++ b/components/vfs/bsaarchive.cpp @@ -5,9 +5,14 @@ namespace VFS BsaArchive::BsaArchive(const std::string &filename) - : mFileName(filename) { - load(); + mFile.open(filename); + + const Bsa::BSAFile::FileList &filelist = mFile.getList(); + for(Bsa::BSAFile::FileList::const_iterator it = filelist.begin();it != filelist.end();++it) + { + mResources.push_back(BsaArchiveFile(&*it, &mFile)); + } } void BsaArchive::listResources(std::map &out, char (*normalize_function)(char)) @@ -21,17 +26,6 @@ void BsaArchive::listResources(std::map &out, char (*normal } } -void BsaArchive::load() -{ - mFile.open(mFileName); - - const Bsa::BSAFile::FileList &filelist = mFile.getList(); - for(Bsa::BSAFile::FileList::const_iterator it = filelist.begin();it != filelist.end();++it) - { - mResources.push_back(BsaArchiveFile(&*it, &mFile)); - } -} - // ------------------------------------------------------------------------------ BsaArchiveFile::BsaArchiveFile(const Bsa::BSAFile::FileStruct *info, Bsa::BSAFile* bsa) diff --git a/components/vfs/bsaarchive.hpp b/components/vfs/bsaarchive.hpp index 217594abd..a6e274037 100644 --- a/components/vfs/bsaarchive.hpp +++ b/components/vfs/bsaarchive.hpp @@ -27,9 +27,6 @@ namespace VFS virtual void listResources(std::map& out, char (*normalize_function) (char)); private: - void load(); - - std::string mFileName; Bsa::BSAFile mFile; std::vector mResources; From 0177fe6602f5550538be170ce18a09fd8bb90eae Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 22 Aug 2017 23:08:06 +0400 Subject: [PATCH 317/318] Display large entries in journal correctly --- apps/openmw/mwgui/bookpage.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 20d3448b5..137594076 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -435,9 +435,15 @@ struct TypesetBookImpl::Typesetter : BookTypesetter } else { + // The section won't completely fit on the current page. Finish the current page and start a new one. + mBook->mPages.push_back (Page (curPageStart, curPageStop)); + + curPageStart = i->mRect.top; + curPageStop = i->mRect.bottom; + //split section int sectionHeightLeft = sectionHeight; - while (sectionHeightLeft > mPageHeight) + while (sectionHeightLeft >= mPageHeight) { // Adjust to the top of the first line that does not fit on the current page anymore int splitPos = curPageStop; From 157ecb166ce406bed76698a1fc55b4a86506d9c6 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Wed, 23 Aug 2017 00:02:02 -0400 Subject: [PATCH 318/318] Fix wrong folder name --- apps/opencs/model/world/resourcesmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/opencs/model/world/resourcesmanager.cpp b/apps/opencs/model/world/resourcesmanager.cpp index c50b86682..62dfe53a9 100644 --- a/apps/opencs/model/world/resourcesmanager.cpp +++ b/apps/opencs/model/world/resourcesmanager.cpp @@ -31,7 +31,7 @@ void CSMWorld::ResourcesManager::setVFS(const VFS::Manager *vfs) addResources (Resources (vfs, "music", UniversalId::Type_Music)); addResources (Resources (vfs, "sound", UniversalId::Type_SoundRes)); addResources (Resources (vfs, "textures", UniversalId::Type_Texture)); - addResources (Resources (vfs, "videos", UniversalId::Type_Video)); + addResources (Resources (vfs, "video", UniversalId::Type_Video)); } const VFS::Manager* CSMWorld::ResourcesManager::getVFS() const