diff --git a/.travis.yml b/.travis.yml
index 51b1720c4..d87b0f01c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,6 +9,10 @@ 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="
+cache:
+ ccache: true
+ directories:
+ - ${HOME}/.ccache
addons:
apt:
sources:
@@ -17,7 +21,7 @@ addons:
- llvm-toolchain-xenial-7
packages: [
# Dev
- cmake, clang-7, clang-tools-7, gcc-8, g++-8,
+ cmake, clang-7, clang-tools-7, gcc-8, g++-8, ccache,
# Boost
libboost-filesystem-dev, libboost-iostreams-dev, libboost-program-options-dev, libboost-system-dev,
# FFmpeg
diff --git a/AUTHORS.md b/AUTHORS.md
index 074081876..c3a27dea2 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -26,17 +26,21 @@ Programmers
Allofich
Andrei Kortunov (akortunov)
AnyOldName3
- Aussiemon
- Austin Salgat (Salgat)
+ Ardekantur
+ Armin Preiml
Artem Kotsynyak (greye)
artemutin
Arthur Moore (EmperorArthur)
Assumeru
athile
+ Aussiemon
+ Austin Salgat (Salgat)
Ben Shealy (bentsherman)
+ Berulacks
Bret Curtis (psi29a)
Britt Mathis (galdor557)
Capostrophic
+ Carl Maxwell
cc9cii
Cédric Mocquillon
Chris Boyce (slothlife)
@@ -47,6 +51,7 @@ Programmers
DanielVukelich
darkf
David Cernat (davidcernat)
+ Declan Millar (declan-millar)
devnexen
Dieho
Dmitry Shkurskiy (endorph)
@@ -54,10 +59,11 @@ Programmers
Douglas Mencken (dougmencken)
dreamer-dead
David Teviotdale (dteviot)
+ Diggory Hardy
+ Dmitry Marakasov (AMDmi3)
Edmondo Tommasina (edmondo)
Eduard Cot (trombonecot)
Eli2
- elsid
Emanuel Guével (potatoesmaster)
eroen
escondida
@@ -67,13 +73,19 @@ Programmers
Finbar Crago (finbar-crago)
Florian Weber (Florianjw)
Gašper Sedej
+ Gohan1989
gugus/gus
+ guidoj
Hallfaer Tuilinn
Haoda Wang (h313)
hristoast
Internecine
- Jacob Essex (Yacoby)
+ Jackerty
+ Jacob Essex (Yacoby)
Jake Westrip (16bitint)
+ James Carty (MrTopCat)
+ Jan-Peter Nilsson (peppe)
+ Jan Borsodi (am0s)
Jason Hooks (jhooks)
jeaye
Jeffrey Haines (Jyby)
@@ -84,6 +96,7 @@ Programmers
John Blomberg (fstp)
Jordan Ayers
Jordan Milne
+ Josua Grawitter
Jules Blok (Armada651)
julianko
Julien Voisin (jvoisin/ap0)
@@ -95,9 +108,10 @@ Programmers
lazydev
Leon Krieg (lkrieg)
Leon Saunders (emoose)
- Łukasz Gołębiewski (lukago)
logzero
lohikaarme
+ Lordrea
+ Łukasz Gołębiewski (lukago)
Lukasz Gromanowski (lgro)
Manuel Edelmann (vorenon)
Marc Bouvier (CramitDeFrog)
@@ -112,6 +126,7 @@ Programmers
Michael Hogan (Xethik)
Michael Mc Donnell
Michael Papageorgiou (werdanith)
+ Michał Ściubidło (mike-sc)
Michał Bień (Glorf)
Michał Moroz (dragonee)
Miloslav Číž (drummyfish)
@@ -123,15 +138,20 @@ Programmers
Nathan Jeffords (blunted2night)
NeveHanter
Nialsy
+ Nicolay Korslund
Nikolay Kasyanov (corristo)
nobrakal
Nolan Poe (nopoe)
Oleg Chkan (mrcheko)
Paul Cercueil (pcercuei)
Paul McElroy (Greendogo)
+ pchan3
+ Perry Hugh
+ Phillip Andrews (PhillipAnd)
Pi03k
Pieter van der Kloet (pvdk)
pkubik
+ PLkolek
PlutonicOverkill
Radu-Marius Popovici (rpopovici)
Rafael Moura (dhustkoder)
@@ -145,11 +165,12 @@ Programmers
Roman Proskuryakov (kpp)
Roman Siromakha (elsid)
Sandy Carter (bwrsandman)
- Scott Howard
+ Scott Howard (maqifrnswa)
scrawl
Sebastian Wick (swick)
Sergey Fukanchik
- Sergey Shambir
+ Sergey Shambir (sergey-shambir)
+ sergoz
ShadowRadiance
Siimacore
sir_herrbatka
@@ -158,24 +179,33 @@ Programmers
spycrab
Stefan Galowicz (bogglez)
Stanislav Bobrov (Jiub)
+ Stanislaw Halik (sthalik)
+ Star-Demon
stil-t
+ Stomy
svaante
Sylvain Thesnieres (Garvek)
t6
terrorfisch
thegriglat
Thomas Luppi (Digmaster)
+ tlmullis
tri4ng1e
- unelsson
- Will Herrmann (Thunderforge)
+ Thoronador
Tom Mason (wheybags)
Torben Leif Carrington (TorbenC)
+ unelsson
+ uramer
viadanna
Vincent Heuken
+ Vladimir Panteleev (CyberShadow)
+ Wang Ryu (bzzt)
+ Will Herrmann (Thunderforge)
vocollapse
+ xyzz
Yohaulticetl
+ Yuri Krupenin
zelurker
- James Carty (MrTopCat)
Documentation
-------------
@@ -184,11 +214,12 @@ Documentation
Alejandro Sanchez (HiPhish)
Bodillium
Bret Curtis (psi29a)
- David Walley (Loriel)
Cramal
+ David Walley (Loriel)
+ Diego Crespo
+ Joakim Berg (lysol90)
Ryan Tucker (Ravenwing)
sir_herrbatka
- Diego Crespo
Packagers
---------
@@ -207,13 +238,19 @@ Public Relations and Translations
Artem Kotsynyak (greye) - Russian News Writer
Dawid Lakomy (Vedyimyn) - Polish News Writer
+ ElderTroll - Release Manager
Jim Clauwaert (Zedd) - Public Outreach
+ juanmnzsk8 - Spanish News Writer
Julien Voisin (jvoisin/ap0) - French News Writer
+ Kingpix - Italian News Writer
Lukasz Gromanowski (lgro) - English News Writer
Martin Otto (Atahualpa) - Podcaster, Public Outreach, German Translator
Mickey Lyle (raevol) - Release Manager
+ Nekochan - English News Writer
+ penguinroad - Indonesian News Writer
Pithorn - Chinese News Writer
sir_herrbatka - Polish News Writer
+ spyboot - German Translator
Tom Koenderink (Okulo) - English News Writer
Website
@@ -243,34 +280,6 @@ Artwork
Mickey Lyle (raevol) - Wordpress Theme
Tom Koenderink (Okulo), SirHerrbatka, crysthala, Shnatsel, Lamoot - OpenMW Editor Icons
-Inactive Contributors
----------------------
-
- Ardekantur
- Armin Preiml
- Berulacks
- Carl Maxwell
- Diggory Hardy
- Dmitry Marakasov (AMDmi3)
- ElderTroll
- guidoj
- Jan-Peter Nilsson (peppe)
- Jan Borsodi
- Josua Grawitter
- juanmnzsk8
- Kingpix
- Lordrea
- Michal Sciubidlo
- Nicolay Korslund
- Nekochan
- pchan3
- penguinroad
- sergoz
- spyboot
- Star-Demon
- Thoronador
- Yuri Krupenin
-
Additional Credits
------------------
In this section we would like to thank people not part of OpenMW for their work.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eaa44cc67..27e2ae157 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,11 +1,17 @@
0.46.0
------
+ Bug #2969: Scripted items can stack
Bug #2987: Editor: some chance and AI data fields can overflow
+ Bug #3006: 'else if' operator breaks script compilation
+ Bug #3282: Unintended behaviour when assigning F3 and Windows keys
Bug #3623: Fix HiDPI on Windows
Bug #3733: Normal maps are inverted on mirrored UVs
+ Bug #3765: DisableTeleporting makes Mark/Recall/Intervention effects undetectable
+ Bug #3778: [Mod] Improved Thrown Weapon Projectiles - weapons have wrong transformation during throw animation
Bug #4329: Removed birthsign abilities are restored after reloading the save
Bug #4383: Bow model obscures crosshair when arrow is drawn
+ Bug #4384: Resist Normal Weapons only checks ammunition for ranged weapons
Bug #4411: Reloading a saved game while falling prevents damage in some cases
Bug #4540: Rain delay when exiting water
Bug #4701: PrisonMarker record is not hardcoded like other markers
@@ -14,28 +20,51 @@
Bug #4720: Inventory avatar has shield with two-handed weapon during [un]equipping animation
Bug #4723: ResetActors command works incorrectly
Bug #4745: Editor: Interior cell lighting field values are not displayed as colors
+ Bug #4736: LandTexture records overrides do not work
Bug #4746: Non-solid player can't run or sneak
+ Bug #4747: Bones are not read from X.NIF file for NPC animation
Bug #4750: Sneaking doesn't work in first person view if the player is in attack ready state
Bug #4768: Fallback numerical value recovery chokes on invalid arguments
Bug #4775: Slowfall effect resets player jumping flag
Bug #4778: Interiors of Illusion puzzle in Sotha Sil Expanded mod is broken
+ Bug #4797: Player sneaking and running stances are not accounted for when in air
Bug #4800: Standing collisions are not updated immediately when an object is teleported without a cell change
Bug #4803: Stray special characters before begin statement break script compilation
Bug #4804: Particle system with the "Has Sizes = false" causes an exception
+ Bug #4810: Raki creature broken in OpenMW
Bug #4813: Creatures with known file but no "Sound Gen Creature" assigned use default sounds
+ Bug #4815: "Finished" journal entry with lower index doesn't close journal, SetJournalIndex closes journal
Bug #4820: Spell absorption is broken
+ Bug #4823: Jail progress bar works incorrectly
Bug #4827: NiUVController is handled incorrectly
Bug #4828: Potion looping effects VFX are not shown for NPCs
- Bug #4841: Russian localization ignores implicit keywords
+ Bug #4837: CTD when a mesh with NiLODNode root node with particles is loaded
+ Bug #4841: Russian localization ignores implicit keywords
+ Bug #4860: Actors outside of processing range visible for one frame after spawning
+ Bug #4867: Arbitrary text after local variable declarations breaks script compilation
+ Bug #4876: AI ratings handling inconsistencies
+ Bug #4877: Startup script executes only on a new game start
+ Bug #4888: Global variable stray explicit reference calls break script compilation
+ Bug #4896: Title screen music doesn't loop
+ Bug #4911: Editor: QOpenGLContext::swapBuffers() warning with Qt5
+ Bug #4916: Specular power (shininess) material parameter is ignored when shaders are used.
+ Bug #4922: Werewolves can not attack if the transformation happens during attack
Feature #2229: Improve pathfinding AI
Feature #3442: Default values for fallbacks from ini file
Feature #3610: Option to invert X axis
+ Feature #3893: Implicit target for "set" function in console
+ Feature #3980: In-game option to disable controller
Feature #4209: Editor: Faction rank sub-table
Feature #4673: Weapon sheathing
+ Feature #4675: Support for NiRollController
Feature #4730: Native animated containers support
Feature #4812: Support NiSwitchNode
Feature #4836: Daytime node switch
+ Feature #4859: Make water reflections more configurable
+ Feature #4887: Add openmw command option to set initial random seed
+ Feature #4890: Make Distant Terrain configurable
Task #4686: Upgrade media decoder to a more current FFmpeg API
+ Task #4695: Optimize Distant Terrain memory consumption
0.45.0
------
diff --git a/CI/before_script.linux.sh b/CI/before_script.linux.sh
index 3ce005874..250955e49 100755
--- a/CI/before_script.linux.sh
+++ b/CI/before_script.linux.sh
@@ -14,6 +14,10 @@ if [[ -z "${BUILD_OPENMW}" ]]; then export BUILD_OPENMW=ON; fi
if [[ -z "${BUILD_OPENMW_CS}" ]]; then export BUILD_OPENMW_CS=ON; fi
${ANALYZE} cmake \
+ -DCMAKE_C_COMPILER="${CC}" \
+ -DCMAKE_CXX_COMPILER="${CXX}" \
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_OPENMW=${BUILD_OPENMW} \
-DBUILD_OPENCS=${BUILD_OPENMW_CS} \
-DBUILD_LAUNCHER=${BUILD_OPENMW_CS} \
diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh
index b5bf0b632..5ed7283fd 100644
--- a/CI/before_script.msvc.sh
+++ b/CI/before_script.msvc.sh
@@ -82,7 +82,7 @@ while [ $# -gt 0 ]; do
t )
TEST_FRAMEWORK=true ;;
-
+
h )
cat <
Set the build platform, can also be set with environment variable PLATFORM.
- -t
- Build unit tests / Google test
+ -t
+ Build unit tests / Google test
-u
Configure for unity builds.
-v <2013/2015/2017>
@@ -402,7 +402,7 @@ if [ -z $SKIP_DOWNLOAD ]; then
download "SDL 2.0.7" \
"https://www.libsdl.org/release/SDL2-devel-2.0.7-VC.zip" \
"SDL2-2.0.7.zip"
-
+
# Google test and mock
if [ ! -z $TEST_FRAMEWORK ]; then
echo "Google test 1.8.1..."
@@ -446,7 +446,7 @@ echo
if [ -z $APPVEYOR ]; then
printf "Boost 1.67.0... "
else
- if [ $MSVC_VER -eq 12.0 ]; then
+ if [ "${MSVC_VER}" -eq 12.0 ]; then
printf "Boost 1.58.0 AppVeyor... "
else
printf "Boost 1.67.0 AppVeyor... "
@@ -608,9 +608,9 @@ printf "OSG 3.4.1-scrawl... "
SUFFIX=""
fi
add_runtime_dlls "$(pwd)/OSG/bin/"{OpenThreads,zlib,libpng*}${SUFFIX}.dll \
- "$(pwd)/OSG/bin/osg"{,Animation,DB,FX,GA,Particle,Text,Util,Viewer}${SUFFIX}.dll
- add_osg_dlls "$(pwd)/OSG/bin/osgPlugins-3.4.1/osgdb_"{bmp,dds,jpeg,osg,png,tga}${SUFFIX}.dll
- add_osg_dlls "$(pwd)/OSG/bin/osgPlugins-3.4.1/osgdb_serializers_osg"{,animation,fx,ga,particle,text,util,viewer}${SUFFIX}.dll
+ "$(pwd)/OSG/bin/osg"{,Animation,DB,FX,GA,Particle,Text,Util,Viewer,Shadow}${SUFFIX}.dll
+ add_osg_dlls "$(pwd)/OSG/bin/osgPlugins-3.4.1/osgdb_"{bmp,dds,freetype,jpeg,osg,png,tga}${SUFFIX}.dll
+ add_osg_dlls "$(pwd)/OSG/bin/osgPlugins-3.4.1/osgdb_serializers_osg"{,animation,fx,ga,particle,text,util,viewer,shadow}${SUFFIX}.dll
echo Done.
}
cd $DEPS
@@ -692,33 +692,33 @@ echo
# Google Test and Google Mock
if [ ! -z $TEST_FRAMEWORK ]; then
printf "Google test 1.8.1 ..."
-
+
cd googletest
if [ ! -d build ]; then
mkdir build
fi
-
+
cd build
-
+
GOOGLE_INSTALL_ROOT="${DEPS_INSTALL}/GoogleTest"
if [ $CONFIGURATION == "Debug" ]; then
DEBUG_SUFFIX="d"
else
DEBUG_SUFFIX=""
fi
-
+
if [ ! -d $GOOGLE_INSTALL_ROOT ]; then
-
+
cmake .. -DCMAKE_BUILD_TYPE="${CONFIGURATION}" -DCMAKE_INSTALL_PREFIX="${GOOGLE_INSTALL_ROOT}" -DCMAKE_USE_WIN32_THREADS_INIT=1 -G "${GENERATOR}" -DBUILD_SHARED_LIBS=1
cmake --build . --config "${CONFIGURATION}"
cmake --build . --target install --config "${CONFIGURATION}"
-
+
add_runtime_dlls "${GOOGLE_INSTALL_ROOT}\bin\gtest_main${DEBUG_SUFFIX}.dll"
add_runtime_dlls "${GOOGLE_INSTALL_ROOT}\bin\gtest${DEBUG_SUFFIX}.dll"
add_runtime_dlls "${GOOGLE_INSTALL_ROOT}\bin\gmock_main${DEBUG_SUFFIX}.dll"
add_runtime_dlls "${GOOGLE_INSTALL_ROOT}\bin\gmock${DEBUG_SUFFIX}.dll"
fi
-
+
add_cmake_opts -DBUILD_UNITTESTS=yes
# FindGTest and FindGMock do not work perfectly on Windows
# but we can help them by telling them everything we know about installation
@@ -730,7 +730,7 @@ if [ ! -z $TEST_FRAMEWORK ]; then
add_cmake_opts -DGMOCK_MAIN_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gmock_main${DEBUG_SUFFIX}.lib"
add_cmake_opts -DGTEST_LINKED_AS_SHARED_LIBRARY=True
echo Done.
-
+
fi
echo
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aaf269eef..bf489d99c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,12 +256,13 @@ if(NOT HAVE_STDINT_H)
endif()
-find_package(OpenSceneGraph 3.3.4 REQUIRED osgDB osgViewer osgText osgGA osgParticle osgUtil osgFX)
-include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
+find_package(OpenSceneGraph 3.3.4 REQUIRED osgDB osgViewer osgText osgGA osgParticle osgUtil osgFX osgShadow)
+include_directories(SYSTEM ${OPENSCENEGRAPH_INCLUDE_DIRS})
set(USED_OSG_PLUGINS
osgdb_bmp
osgdb_dds
+ osgdb_freetype
osgdb_jpeg
osgdb_osg
osgdb_png
@@ -795,8 +796,8 @@ endif()
# Apple bundling
if (OPENMW_OSX_DEPLOYMENT AND APPLE AND DESIRED_QT_VERSION MATCHES 5)
- if (${CMAKE_MAJOR_VERSION} STREQUAL "3" AND ${CMAKE_MINOR_VERSION} STREQUAL "13")
- message(FATAL_ERROR "macOS packaging is broken in CMake 3.13.*, see https://gitlab.com/OpenMW/openmw/issues/4767. Please use an older version like 3.12.4")
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 AND CMAKE_VERSION VERSION_LESS 3.13.4)
+ message(FATAL_ERROR "macOS packaging is broken in early CMake 3.13 releases, see https://gitlab.com/OpenMW/openmw/issues/4767. Please use at least 3.13.4 or an older version like 3.12.4")
endif ()
get_property(QT_COCOA_PLUGIN_PATH TARGET Qt5::QCocoaIntegrationPlugin PROPERTY LOCATION_RELEASE)
diff --git a/README.md b/README.md
index 9fbfc0178..6f453a741 100644
--- a/README.md
+++ b/README.md
@@ -105,3 +105,4 @@ Command line options
--export-fonts [=arg(=1)] (=0) Export Morrowind .fnt fonts to PNG
image and XML file in current directory
--activate-dist arg (=-1) activation distance override
+ --random-seed arg (=) seed value for random number generator
diff --git a/apps/esmtool/record.cpp b/apps/esmtool/record.cpp
index 6cd32077c..c5153dadb 100644
--- a/apps/esmtool/record.cpp
+++ b/apps/esmtool/record.cpp
@@ -660,7 +660,7 @@ void Record::print()
printTransport(mData.getTransport());
- std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
+ std::cout << " Artificial Intelligence: " << std::endl;
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
std::cout << " AI Fight:" << (int)mData.mAiData.mFight << std::endl;
std::cout << " AI Flee:" << (int)mData.mAiData.mFlee << std::endl;
@@ -668,7 +668,6 @@ void Record::print()
std::cout << " AI U1:" << (int)mData.mAiData.mU1 << std::endl;
std::cout << " AI U2:" << (int)mData.mAiData.mU2 << std::endl;
std::cout << " AI U3:" << (int)mData.mAiData.mU3 << std::endl;
- std::cout << " AI U4:" << (int)mData.mAiData.mU4 << std::endl;
std::cout << " AI Services:" << boost::format("0x%08X") % mData.mAiData.mServices << std::endl;
for (const ESM::AIPackage &package : mData.mAiPackage.mList)
@@ -740,7 +739,7 @@ void Record::print()
std::cout << " Faction Reaction: "
<< mData.mData.mRankData[i].mFactReaction << std::endl;
}
- for (const std::pair &reaction : mData.mReactions)
+ for (const auto &reaction : mData.mReactions)
std::cout << " Reaction: " << reaction.second << " = " << reaction.first << std::endl;
std::cout << " Deleted: " << mIsDeleted << std::endl;
}
@@ -1079,7 +1078,7 @@ void Record::print()
printTransport(mData.getTransport());
- std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
+ std::cout << " Artificial Intelligence: " << std::endl;
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
std::cout << " AI Fight:" << (int)mData.mAiData.mFight << std::endl;
std::cout << " AI Flee:" << (int)mData.mAiData.mFlee << std::endl;
@@ -1087,7 +1086,6 @@ void Record::print()
std::cout << " AI U1:" << (int)mData.mAiData.mU1 << std::endl;
std::cout << " AI U2:" << (int)mData.mAiData.mU2 << std::endl;
std::cout << " AI U3:" << (int)mData.mAiData.mU3 << std::endl;
- std::cout << " AI U4:" << (int)mData.mAiData.mU4 << std::endl;
std::cout << " AI Services:" << boost::format("0x%08X") % mData.mAiData.mServices << std::endl;
for (const ESM::AIPackage &package : mData.mAiPackage.mList)
diff --git a/apps/essimporter/importercontext.hpp b/apps/essimporter/importercontext.hpp
index 86501b3cb..1a91b7cea 100644
--- a/apps/essimporter/importercontext.hpp
+++ b/apps/essimporter/importercontext.hpp
@@ -84,6 +84,8 @@ namespace ESSImport
mGlobalMapState.mBounds.mMaxX = 0;
mGlobalMapState.mBounds.mMinY = 0;
mGlobalMapState.mBounds.mMaxY = 0;
+
+ mPlayerBase.blank();
}
int generateActorId()
diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp
index 41f546af4..68fe235ce 100644
--- a/apps/launcher/advancedpage.cpp
+++ b/apps/launcher/advancedpage.cpp
@@ -80,6 +80,7 @@ bool Launcher::AdvancedPage::loadSettings()
int unarmedFactorsStrengthIndex = mEngineSettings.getInt("strength influences hand to hand", "Game");
if (unarmedFactorsStrengthIndex >= 0 && unarmedFactorsStrengthIndex <= 2)
unarmedFactorsStrengthComboBox->setCurrentIndex(unarmedFactorsStrengthIndex);
+ loadSettingBool(requireAppropriateAmmunitionCheckBox, "only appropriate ammunition bypasses resistance", "Game");
// Input Settings
loadSettingBool(allowThirdPersonZoomCheckBox, "allow third person zoom", "Input");
@@ -139,6 +140,7 @@ void Launcher::AdvancedPage::saveSettings()
int unarmedFactorsStrengthIndex = unarmedFactorsStrengthComboBox->currentIndex();
if (unarmedFactorsStrengthIndex != mEngineSettings.getInt("strength influences hand to hand", "Game"))
mEngineSettings.setInt("strength influences hand to hand", "Game", unarmedFactorsStrengthIndex);
+ saveSettingBool(requireAppropriateAmmunitionCheckBox, "only appropriate ammunition bypasses resistance", "Game");
// Input Settings
saveSettingBool(allowThirdPersonZoomCheckBox, "allow third person zoom", "Input");
diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp
index 072f1f36f..56cd08680 100644
--- a/apps/launcher/graphicspage.cpp
+++ b/apps/launcher/graphicspage.cpp
@@ -1,6 +1,5 @@
#include "graphicspage.hpp"
-#include
#include
#include
#include
@@ -15,10 +14,11 @@
#include
#include
+#include
QString getAspect(int x, int y)
{
- int gcd = boost::math::gcd (x, y);
+ int gcd = Misc::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/niftest/niftest.cpp b/apps/niftest/niftest.cpp
index e3f2b89f8..f848ae330 100644
--- a/apps/niftest/niftest.cpp
+++ b/apps/niftest/niftest.cpp
@@ -102,6 +102,17 @@ bool parseOptions (int argc, char** argv, std::vector& files)
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv).
options(desc).positional(p).run();
bpo::store(valid_opts, variables);
+ bpo::notify(variables);
+ if (variables.count ("help"))
+ {
+ std::cout << desc << std::endl;
+ return false;
+ }
+ if (variables.count("input-file"))
+ {
+ files = variables["input-file"].as< std::vector >();
+ return true;
+ }
}
catch(std::exception &e)
{
@@ -110,18 +121,6 @@ bool parseOptions (int argc, char** argv, std::vector& files)
return false;
}
- bpo::notify(variables);
- if (variables.count ("help"))
- {
- std::cout << desc << std::endl;
- return false;
- }
- if (variables.count("input-file"))
- {
- files = variables["input-file"].as< std::vector >();
- return true;
- }
-
std::cout << "No input files or directories specified!" << std::endl;
std::cout << desc << std::endl;
return false;
diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp
index 233b3e439..76511f535 100644
--- a/apps/opencs/model/doc/document.cpp
+++ b/apps/opencs/model/doc/document.cpp
@@ -364,6 +364,11 @@ int CSMDoc::Document::getState() const
return state;
}
+const boost::filesystem::path& CSMDoc::Document::getResourceDir() const
+{
+ return mResDir;
+}
+
const boost::filesystem::path& CSMDoc::Document::getSavePath() const
{
return mSavePath;
diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp
index 4c442428e..a2579af4c 100644
--- a/apps/opencs/model/doc/document.hpp
+++ b/apps/opencs/model/doc/document.hpp
@@ -115,6 +115,8 @@ namespace CSMDoc
int getState() const;
+ const boost::filesystem::path& getResourceDir() const;
+
const boost::filesystem::path& getSavePath() const;
const boost::filesystem::path& getProjectPath() const;
diff --git a/apps/opencs/model/prefs/shortcuteventhandler.cpp b/apps/opencs/model/prefs/shortcuteventhandler.cpp
index e42cb5da1..07c48fcaa 100644
--- a/apps/opencs/model/prefs/shortcuteventhandler.cpp
+++ b/apps/opencs/model/prefs/shortcuteventhandler.cpp
@@ -195,7 +195,7 @@ namespace CSMPrefs
// Only activate the best match; in exact conflicts, this will favor the first shortcut added.
if (!potentials.empty())
{
- std::sort(potentials.begin(), potentials.end(), ShortcutEventHandler::sort);
+ std::stable_sort(potentials.begin(), potentials.end(), ShortcutEventHandler::sort);
Shortcut* shortcut = potentials.front().second;
if (shortcut->getModifierStatus() && shortcut->getSecondaryMode() == Shortcut::SM_Replace)
@@ -325,7 +325,7 @@ namespace CSMPrefs
if (left.first == Matches_WithMod && right.first == Matches_NoMod)
return true;
else
- return left.second->getPosition() >= right.second->getPosition();
+ return left.second->getPosition() > right.second->getPosition();
}
void ShortcutEventHandler::widgetDestroyed()
diff --git a/apps/opencs/model/tools/scriptcheck.cpp b/apps/opencs/model/tools/scriptcheck.cpp
index d3d9d1503..952127edf 100644
--- a/apps/opencs/model/tools/scriptcheck.cpp
+++ b/apps/opencs/model/tools/scriptcheck.cpp
@@ -30,11 +30,11 @@ void CSMTools::ScriptCheckStage::report (const std::string& message, const Compi
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Script, mId);
- stream << "line " << loc.mLine << ", column " << loc.mColumn << ": " << message << " (" << loc.mLiteral << ")";
+ stream << message << " (" << loc.mLiteral << ")" << " @ line " << loc.mLine+1 << ", column " << loc.mColumn;
std::ostringstream hintStream;
- hintStream << "l:" << loc.mLine << " " << loc.mColumn;
+ hintStream << "l:" << loc.mLine+1 << " " << loc.mColumn;
mMessages->add (id, stream.str(), hintStream.str(), getSeverity (type));
}
diff --git a/apps/opencs/model/world/columnbase.hpp b/apps/opencs/model/world/columnbase.hpp
index 94ebbef55..b4eee8630 100644
--- a/apps/opencs/model/world/columnbase.hpp
+++ b/apps/opencs/model/world/columnbase.hpp
@@ -87,6 +87,7 @@ namespace CSMWorld
//CONCRETE TYPES ENDS HERE
Display_UnsignedInteger8,
+ Display_UnsignedInteger16,
Display_Integer,
Display_Float,
Display_Double,
diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp
index da46ea876..8fa449b8f 100644
--- a/apps/opencs/model/world/data.cpp
+++ b/apps/opencs/model/world/data.cpp
@@ -1006,7 +1006,7 @@ void CSMWorld::Data::loadFallbackEntries()
std::make_pair("PrisonMarker", "marker_prison.nif")
};
- for (const std::pair &marker : staticMarkers)
+ for (const auto &marker : staticMarkers)
{
if (mReferenceables.searchId (marker.first)==-1)
{
@@ -1020,7 +1020,7 @@ void CSMWorld::Data::loadFallbackEntries()
}
}
- for (const std::pair &marker : doorMarkers)
+ for (const auto &marker : doorMarkers)
{
if (mReferenceables.searchId (marker.first)==-1)
{
diff --git a/apps/opencs/model/world/refidadapterimp.hpp b/apps/opencs/model/world/refidadapterimp.hpp
index c05a20d07..16b7739f7 100644
--- a/apps/opencs/model/world/refidadapterimp.hpp
+++ b/apps/opencs/model/world/refidadapterimp.hpp
@@ -627,12 +627,12 @@ namespace CSMWorld
RecordT record2 = record.get();
if (column==mActors.mHello)
record2.mAiData.mHello = value.toInt();
- else if (column==mActors.mFlee)
- record2.mAiData.mFlee = value.toInt();
+ else if (column==mActors.mFlee) // Flee, Fight and Alarm ratings are probabilities.
+ record2.mAiData.mFlee = std::min(100, value.toInt());
else if (column==mActors.mFight)
- record2.mAiData.mFight = value.toInt();
+ record2.mAiData.mFight = std::min(100, value.toInt());
else if (column==mActors.mAlarm)
- record2.mAiData.mAlarm = value.toInt();
+ record2.mAiData.mAlarm = std::min(100, value.toInt());
else
{
typename std::map::const_iterator iter =
diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp
index 89d346204..bd6849492 100644
--- a/apps/opencs/model/world/refidcollection.cpp
+++ b/apps/opencs/model/world/refidcollection.cpp
@@ -128,7 +128,7 @@ CSMWorld::RefIdCollection::RefIdCollection()
ActorColumns actorsColumns (nameColumns);
- mColumns.push_back (RefIdColumn (Columns::ColumnId_AiHello, ColumnBase::Display_UnsignedInteger8));
+ mColumns.push_back (RefIdColumn (Columns::ColumnId_AiHello, ColumnBase::Display_UnsignedInteger16));
actorsColumns.mHello = &mColumns.back();
mColumns.push_back (RefIdColumn (Columns::ColumnId_AiFlee, ColumnBase::Display_UnsignedInteger8));
actorsColumns.mFlee = &mColumns.back();
diff --git a/apps/opencs/view/doc/adjusterwidget.cpp b/apps/opencs/view/doc/adjusterwidget.cpp
index 06da68ed8..509e656c3 100644
--- a/apps/opencs/view/doc/adjusterwidget.cpp
+++ b/apps/opencs/view/doc/adjusterwidget.cpp
@@ -1,7 +1,8 @@
#include "adjusterwidget.hpp"
+#include
+
#include
-#include
#include
#include
@@ -70,8 +71,7 @@ void CSVDoc::AdjusterWidget::setName (const QString& name, bool addon)
{
boost::filesystem::path path (name.toUtf8().data());
- std::string extension = path.extension().string();
- boost::algorithm::to_lower(extension);
+ std::string extension = Misc::StringUtils::lowerCase(path.extension().string());
bool isLegacyPath = (extension == ".esm" ||
extension == ".esp");
diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp
index ed4dcff76..42dbe51ac 100644
--- a/apps/opencs/view/doc/view.cpp
+++ b/apps/opencs/view/doc/view.cpp
@@ -5,6 +5,7 @@
#include
#include
+#include
#include
#include
#include
@@ -25,6 +26,8 @@
#include "../tools/subviews.hpp"
+#include
+
#include "viewmanager.hpp"
#include "operations.hpp"
#include "subview.hpp"
@@ -303,6 +306,17 @@ void CSVDoc::View::setupDebugMenu()
connect (runLog, SIGNAL (triggered()), this, SLOT (addRunLogSubView()));
}
+void CSVDoc::View::setupHelpMenu()
+{
+ QMenu *help = menuBar()->addMenu (tr ("Help"));
+
+ QAction* about = createMenuEntry("About OpenMW-CS", ":./info.png", help, "document-help-about");
+ connect (about, SIGNAL (triggered()), this, SLOT (infoAbout()));
+
+ QAction* aboutQt = createMenuEntry("About Qt", ":./qt.png", help, "document-help-qt");
+ connect (aboutQt, SIGNAL (triggered()), this, SLOT (infoAboutQt()));
+}
+
QAction* CSVDoc::View::createMenuEntry(CSMWorld::UniversalId::Type type, QMenu* menu, const char* shortcutName)
{
const std::string title = CSMWorld::UniversalId (type).getTypeName();
@@ -339,6 +353,7 @@ void CSVDoc::View::setupUi()
setupCharacterMenu();
setupAssetsMenu();
setupDebugMenu();
+ setupHelpMenu();
}
void CSVDoc::View::setupShortcut(const char* name, QAction* action)
@@ -674,6 +689,52 @@ void CSVDoc::View::save()
mDocument->save();
}
+void CSVDoc::View::infoAbout()
+{
+ // Get current OpenMW version
+ QString versionInfo = (Version::getOpenmwVersionDescription(mDocument->getResourceDir().string())+
+#if defined(__x86_64__) || defined(_M_X64)
+ " (64-bit)").c_str();
+#else
+ " (32-bit)").c_str();
+#endif
+
+ // Get current year
+ time_t now = time(NULL);
+ struct tm tstruct;
+ char copyrightInfo[40];
+ tstruct = *localtime(&now);
+ strftime(copyrightInfo, sizeof(copyrightInfo), "Copyright © 2008-%Y OpenMW Team", &tstruct);
+
+ QString aboutText = QString(
+ ""
+ "OpenMW Construction Set
"
+ "%1\n\n"
+ "%2\n\n"
+ "%3\n\n"
+ "
"
+ "
")
+ .arg(versionInfo
+ , tr("OpenMW-CS is a content file editor for OpenMW, a modern, free and open source game engine.")
+ , tr(copyrightInfo)
+ , tr("Home Page:")
+ , tr("Forum:")
+ , tr("Bug Tracker:")
+ , tr("IRC:"));
+
+ QMessageBox::about(this, "About OpenMW-CS", aboutText);
+}
+
+void CSVDoc::View::infoAboutQt()
+{
+ QMessageBox::aboutQt(this);
+}
+
void CSVDoc::View::verify()
{
addSubView (mDocument->verify());
diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp
index 7a9a48b0f..c4046a7a1 100644
--- a/apps/opencs/view/doc/view.hpp
+++ b/apps/opencs/view/doc/view.hpp
@@ -85,6 +85,8 @@ namespace CSVDoc
void setupDebugMenu();
+ void setupHelpMenu();
+
void setupUi();
void setupShortcut(const char* name, QAction* action);
@@ -165,6 +167,10 @@ namespace CSVDoc
void exit();
+ void infoAbout();
+
+ void infoAboutQt();
+
void verify();
void addGlobalsSubView();
diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp
index ff69656a2..7f31373ee 100644
--- a/apps/opencs/view/render/pagedworldspacewidget.cpp
+++ b/apps/opencs/view/render/pagedworldspacewidget.cpp
@@ -2,6 +2,7 @@
#include
#include
+#include
#include
#include
@@ -615,7 +616,39 @@ void CSVRender::PagedWorldspaceWidget::useViewHint (const std::string& hint)
}
else if (hint[0]=='r')
{
- /// \todo implement 'r' type hints
+ // syntax r:ref#number (e.g. r:ref#100)
+ char ignore;
+
+ std::istringstream stream (hint.c_str());
+ if (stream >> ignore) // ignore r
+ {
+ char ignore1; // : or ;
+
+ std::string refCode; // ref#number (e.g. ref#100)
+
+ while (stream >> ignore1 >> refCode) {}
+
+ //Find out cell coordinate
+ CSMWorld::IdTable& references = dynamic_cast (
+ *mDocument.getData().getTableModel (CSMWorld::UniversalId::Type_References));
+ int cellColumn = references.findColumnIndex(CSMWorld::Columns::ColumnId_Cell);
+ QVariant cell = references.data(references.getModelIndex(refCode, cellColumn)).value();
+ QString cellqs = cell.toString();
+ std::istringstream streamCellCoord (cellqs.toStdString().c_str());
+
+ if (streamCellCoord >> ignore) //ignore #
+ {
+ // Current coordinate
+ int x, y;
+
+ // Loop through all the coordinates to add them to selection
+ while (streamCellCoord >> x >> y)
+ selection.add (CSMWorld::CellCoordinates (x, y));
+
+ // Mark that camera needs setup
+ mCamPositionSet=false;
+ }
+ }
}
setCellSelection (selection);
diff --git a/apps/opencs/view/render/terrainstorage.hpp b/apps/opencs/view/render/terrainstorage.hpp
index 949311248..6c3151e8d 100644
--- a/apps/opencs/view/render/terrainstorage.hpp
+++ b/apps/opencs/view/render/terrainstorage.hpp
@@ -18,10 +18,10 @@ namespace CSVRender
private:
const CSMWorld::Data& mData;
- virtual osg::ref_ptr getLand (int cellX, int cellY);
- virtual const ESM::LandTexture* getLandTexture(int index, short plugin);
+ virtual osg::ref_ptr getLand (int cellX, int cellY) override;
+ virtual const ESM::LandTexture* getLandTexture(int index, short plugin) override;
- virtual void getBounds(float& minX, float& maxX, float& minY, float& maxY);
+ virtual void getBounds(float& minX, float& maxX, float& minY, float& maxY) override;
};
}
diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp
index 14df4658d..eb7b8e334 100644
--- a/apps/opencs/view/world/table.cpp
+++ b/apps/opencs/view/world/table.cpp
@@ -141,13 +141,16 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
if (mModel->getFeatures() & CSMWorld::IdTableBase::Feature_Preview)
{
+ const CSMWorld::UniversalId id = getUniversalId(currentRow);
+ const CSMWorld::UniversalId::Type type = id.getType();
+
QModelIndex index = mModel->index (row,
mModel->findColumnIndex (CSMWorld::Columns::ColumnId_Modification));
CSMWorld::RecordBase::State state = static_cast (
mModel->data (index).toInt());
- if (state!=CSMWorld::RecordBase::State_Deleted)
+ if (state!=CSMWorld::RecordBase::State_Deleted && type != CSMWorld::UniversalId::Type_ItemLevelledList)
menu.addAction (mPreviewAction);
}
}
diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp
index fef805d56..3aee51e98 100644
--- a/apps/opencs/view/world/util.cpp
+++ b/apps/opencs/view/world/util.cpp
@@ -219,6 +219,13 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO
return sb;
}
+ case CSMWorld::ColumnBase::Display_UnsignedInteger16:
+ {
+ DialogueSpinBox *sb = new DialogueSpinBox(parent);
+ sb->setRange(0, std::numeric_limits::max());
+ return sb;
+ }
+
case CSMWorld::ColumnBase::Display_Var:
return new QLineEdit(parent);
diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt
index 0bb6e900d..554a3ac86 100644
--- a/apps/openmw/CMakeLists.txt
+++ b/apps/openmw/CMakeLists.txt
@@ -126,6 +126,7 @@ target_link_libraries(openmw
${OSGDB_LIBRARIES}
${OSGVIEWER_LIBRARIES}
${OSGGA_LIBRARIES}
+ ${OSGSHADOW_LIBRARIES}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp
index 15a8f0f32..181ebd822 100644
--- a/apps/openmw/engine.cpp
+++ b/apps/openmw/engine.cpp
@@ -32,12 +32,13 @@
#include
+#include
+
#include "mwinput/inputmanagerimp.hpp"
#include "mwgui/windowmanagerimp.hpp"
#include "mwscript/scriptmanagerimp.hpp"
-#include "mwscript/extensions.hpp"
#include "mwscript/interpretercontext.hpp"
#include "mwsound/soundmanagerimp.hpp"
@@ -199,6 +200,8 @@ bool OMW::Engine::frame(float frametime)
stats->setAttribute(frameNumber, "WorkQueue", mWorkQueue->getNumItems());
stats->setAttribute(frameNumber, "WorkThread", mWorkQueue->getNumActiveThreads());
+
+ mEnvironment.getWorld()->getNavigator()->reportStats(frameNumber, *stats);
}
}
@@ -223,13 +226,13 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
, mActivationDistanceOverride(-1)
, mGrab(true)
, mExportFonts(false)
+ , mRandomSeed(0)
, mScriptContext (0)
, mFSStrict (false)
, mScriptBlacklistUse (true)
, mNewGame (false)
, mCfgMgr(configurationManager)
{
- Misc::Rng::init();
MWClass::registerClasses();
Uint32 flags = SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE|SDL_INIT_GAMECONTROLLER|SDL_INIT_JOYSTICK;
@@ -258,6 +261,9 @@ OMW::Engine::~Engine()
mViewer = nullptr;
+ delete mEncoder;
+ mEncoder = nullptr;
+
if (mWindow)
{
SDL_DestroyWindow(mWindow);
@@ -545,7 +551,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
// Create the world
mEnvironment.setWorld( new MWWorld::World (mViewer, rootNode, mResourceSystem.get(), mWorkQueue.get(),
mFileCollections, mContentFiles, mEncoder, mFallbackMap,
- mActivationDistanceOverride, mCellName, mStartupScript, mResDir.string(), mCfgMgr.getUserDataPath().string()));
+ mActivationDistanceOverride, mCellName, mResDir.string(), mCfgMgr.getUserDataPath().string()));
mEnvironment.getWorld()->setupPlayer();
input->setPlayer(&mEnvironment.getWorld()->getPlayer());
@@ -650,6 +656,11 @@ void OMW::Engine::go()
assert (!mContentFiles.empty());
Log(Debug::Info) << "OSG version: " << osgGetVersion();
+ SDL_version sdlVersion;
+ SDL_GetVersion(&sdlVersion);
+ Log(Debug::Info) << "SDL version: " << (int)sdlVersion.major << "." << (int)sdlVersion.minor << "." << (int)sdlVersion.patch;
+
+ Misc::Rng::init(mRandomSeed);
// Load settings
Settings::Manager settings;
@@ -657,8 +668,7 @@ void OMW::Engine::go()
settingspath = loadSettings (settings);
// Create encoder
- ToUTF8::Utf8Encoder encoder (mEncoding);
- mEncoder = &encoder;
+ mEncoder = new ToUTF8::Utf8Encoder(mEncoding);
// Setup viewer
mViewer = new osgViewer::Viewer;
@@ -701,22 +711,21 @@ void OMW::Engine::go()
{
// start in main menu
mEnvironment.getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
- try
- {
- // Is there an ini setting for this filename or something?
- mEnvironment.getSoundManager()->streamMusic("Special/morrowind title.mp3");
-
- std::string logo = mFallbackMap["Movies_Morrowind_Logo"];
- if (!logo.empty())
- mEnvironment.getWindowManager()->playVideo(logo, true);
- }
- catch (...) {}
+ mEnvironment.getSoundManager()->playTitleMusic();
+ std::string logo = mFallbackMap["Movies_Morrowind_Logo"];
+ if (!logo.empty())
+ mEnvironment.getWindowManager()->playVideo(logo, true);
}
else
{
mEnvironment.getStateManager()->newGame (!mNewGame);
}
+ if (!mStartupScript.empty() && mEnvironment.getStateManager()->getState() == MWState::StateManager::State_Running)
+ {
+ mEnvironment.getWindowManager()->executeInConsole(mStartupScript);
+ }
+
// Start the main rendering loop
osg::Timer frameTimer;
double simulationTime = 0.0;
@@ -820,3 +829,8 @@ void OMW::Engine::setSaveGameFile(const std::string &savegame)
{
mSaveGameFile = savegame;
}
+
+void OMW::Engine::setRandomSeed(unsigned int seed)
+{
+ mRandomSeed = seed;
+}
diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp
index e42a5c94f..bfe9759cd 100644
--- a/apps/openmw/engine.hpp
+++ b/apps/openmw/engine.hpp
@@ -100,6 +100,7 @@ namespace OMW
bool mGrab;
bool mExportFonts;
+ unsigned int mRandomSeed;
Compiler::Extensions mExtensions;
Compiler::Context *mScriptContext;
@@ -203,6 +204,8 @@ namespace OMW
/// Set the save game file to load after initialising the engine.
void setSaveGameFile(const std::string& savegame);
+ void setRandomSeed(unsigned int seed);
+
private:
Files::ConfigurationManager& mCfgMgr;
};
diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp
index 7c39a785e..a56cbfe8a 100644
--- a/apps/openmw/main.cpp
+++ b/apps/openmw/main.cpp
@@ -3,6 +3,7 @@
#include
#include
#include
+#include
#include "engine.hpp"
@@ -131,7 +132,12 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
("export-fonts", bpo::value()->implicit_value(true)
->default_value(false), "Export Morrowind .fnt fonts to PNG image and XML file in current directory")
- ("activate-dist", bpo::value ()->default_value (-1), "activation distance override");
+ ("activate-dist", bpo::value ()->default_value (-1), "activation distance override")
+
+ ("random-seed", bpo::value ()
+ ->default_value(Misc::Rng::generateDefaultSeed()),
+ "seed value for random number generator")
+ ;
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv)
.options(desc).allow_unregistered().run();
@@ -231,6 +237,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
engine.setFallbackValues(variables["fallback"].as().mMap);
engine.setActivationDistanceOverride (variables["activate-dist"].as());
engine.enableFontExport(variables["export-fonts"].as());
+ engine.setRandomSeed(variables["random-seed"].as());
return true;
}
diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp
index 1bdd8f8b5..5c5821bca 100644
--- a/apps/openmw/mwbase/mechanicsmanager.hpp
+++ b/apps/openmw/mwbase/mechanicsmanager.hpp
@@ -90,9 +90,9 @@ namespace MWBase
virtual void setPlayerClass (const ESM::Class& class_) = 0;
///< Set player class to custom class.
- virtual void restoreDynamicStats(MWWorld::Ptr actor, bool sleep) = 0;
+ virtual void restoreDynamicStats(MWWorld::Ptr actor, double hours, bool sleep) = 0;
- virtual void rest(bool sleep) = 0;
+ virtual void rest(double hours, bool sleep) = 0;
///< If the player is sleeping or waiting, this should be called every hour.
/// @param sleep is the player sleeping or waiting?
diff --git a/apps/openmw/mwbase/soundmanager.hpp b/apps/openmw/mwbase/soundmanager.hpp
index 2b3cf1f0d..bad80d6bd 100644
--- a/apps/openmw/mwbase/soundmanager.hpp
+++ b/apps/openmw/mwbase/soundmanager.hpp
@@ -89,6 +89,9 @@ namespace MWBase
///< Start playing music from the selected folder
/// \param name of the folder that contains the playlist
+ virtual void playTitleMusic() = 0;
+ ///< Start playing title music
+
virtual void say(const MWWorld::ConstPtr &reference, const std::string& filename) = 0;
///< Make an actor say some text.
/// \param filename name of a sound file in "Sound/" in the data directory.
diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp
index 1728af659..d3bdb419e 100644
--- a/apps/openmw/mwbase/world.hpp
+++ b/apps/openmw/mwbase/world.hpp
@@ -57,7 +57,7 @@ namespace MWMechanics
namespace DetourNavigator
{
- class Navigator;
+ struct Navigator;
}
namespace MWWorld
@@ -134,6 +134,7 @@ namespace MWBase
virtual MWWorld::Player& getPlayer() = 0;
virtual MWWorld::Ptr getPlayerPtr() = 0;
+ virtual MWWorld::ConstPtr getPlayerConstPtr() const = 0;
virtual const MWWorld::ESMStore& getStore() const = 0;
@@ -587,7 +588,7 @@ namespace MWBase
virtual bool isPlayerInJail() const = 0;
- virtual void rest() = 0;
+ virtual void rest(double hours) = 0;
virtual void setPlayerTraveling(bool traveling) = 0;
virtual bool isPlayerTraveling() const = 0;
@@ -615,6 +616,9 @@ namespace MWBase
virtual void removeActorPath(const MWWorld::ConstPtr& actor) const = 0;
virtual void setNavMeshNumberToRender(const std::size_t value) = 0;
+
+ /// Return physical half extents of the given actor to be used in pathfinding
+ virtual osg::Vec3f getPathfindingHalfExtents(const MWWorld::ConstPtr& actor) const = 0;
};
}
diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp
index 42ea99b00..eabac1644 100644
--- a/apps/openmw/mwclass/activator.cpp
+++ b/apps/openmw/mwclass/activator.cpp
@@ -2,10 +2,10 @@
#include
#include
+#include
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
-#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/cellstore.hpp"
@@ -19,6 +19,7 @@
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
+#include "../mwrender/vismask.hpp"
#include "../mwgui/tooltips.hpp"
@@ -30,8 +31,10 @@ namespace MWClass
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
- if (!model.empty()) {
+ if (!model.empty())
+ {
renderingInterface.getObjects().insertModel(ptr, model, true);
+ ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
}
}
diff --git a/apps/openmw/mwclass/actor.cpp b/apps/openmw/mwclass/actor.cpp
index 73a4d37d7..aa356f62d 100644
--- a/apps/openmw/mwclass/actor.cpp
+++ b/apps/openmw/mwclass/actor.cpp
@@ -4,7 +4,6 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
-#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwmechanics/creaturestats.hpp"
diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp
index e151e39c5..5e7c1b933 100644
--- a/apps/openmw/mwclass/apparatus.cpp
+++ b/apps/openmw/mwclass/apparatus.cpp
@@ -3,11 +3,9 @@
#include
#include "../mwbase/environment.hpp"
-#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionalchemy.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwphysics/physicssystem.hpp"
diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp
index 0a4958eb9..7ab1d49fe 100644
--- a/apps/openmw/mwclass/armor.cpp
+++ b/apps/openmw/mwclass/armor.cpp
@@ -9,7 +9,6 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/cellstore.hpp"
diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp
index 21c0d89c2..7e3e77d58 100644
--- a/apps/openmw/mwclass/clothing.cpp
+++ b/apps/openmw/mwclass/clothing.cpp
@@ -7,7 +7,6 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/cellstore.hpp"
diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp
index e1784d593..3a501a93f 100644
--- a/apps/openmw/mwclass/container.cpp
+++ b/apps/openmw/mwclass/container.cpp
@@ -6,7 +6,6 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
-#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwworld/ptr.hpp"
@@ -241,8 +240,8 @@ namespace MWClass
std::string text;
int lockLevel = ptr.getCellRef().getLockLevel();
if (lockLevel > 0 && lockLevel != ESM::UnbreakableLock)
- text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ptr.getCellRef().getLockLevel());
- else if (ptr.getCellRef().getLockLevel() < 0)
+ text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(lockLevel);
+ else if (lockLevel < 0)
text += "\n#{sUnlocked}";
if (ptr.getCellRef().getTrap() != "")
text += "\n#{sTrapped}";
diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp
index 962a5bab5..8f17a3038 100644
--- a/apps/openmw/mwclass/creature.cpp
+++ b/apps/openmw/mwclass/creature.cpp
@@ -308,6 +308,7 @@ namespace MWClass
{
damage = attack[0] + ((attack[1]-attack[0])*attackStrength);
MWMechanics::adjustWeaponDamage(damage, weapon, ptr);
+ MWMechanics::resistNormalWeapon(victim, ptr, weapon, damage);
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
}
@@ -382,9 +383,6 @@ namespace MWClass
if (!object.isEmpty())
stats.setLastHitObject(object.getCellRef().getRefId());
- if (damage > 0.0f && !object.isEmpty())
- MWMechanics::resistNormalWeapon(ptr, attacker, object, damage);
-
if (damage < 0.001f)
damage = 0;
@@ -610,11 +608,7 @@ namespace MWClass
int Creature::getServices(const MWWorld::ConstPtr &actor) const
{
- const MWWorld::LiveCellRef* ref = actor.get();
- if (ref->mBase->mHasAI)
- return ref->mBase->mAiData.mServices;
- else
- return 0;
+ return actor.get()->mBase->mAiData.mServices;
}
bool Creature::isPersistent(const MWWorld::ConstPtr &actor) const
diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp
index a26118029..c47399fe7 100644
--- a/apps/openmw/mwclass/door.cpp
+++ b/apps/openmw/mwclass/door.cpp
@@ -2,15 +2,14 @@
#include
#include
+#include
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
-#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/nullaction.hpp"
#include "../mwworld/failedaction.hpp"
#include "../mwworld/actionteleport.hpp"
#include "../mwworld/actiondoor.hpp"
@@ -26,6 +25,7 @@
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwrender/animation.hpp"
+#include "../mwrender/vismask.hpp"
#include "../mwmechanics/actorutil.hpp"
@@ -55,8 +55,10 @@ namespace MWClass
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
- if (!model.empty()) {
+ if (!model.empty())
+ {
renderingInterface.getObjects().insertModel(ptr, model, true);
+ ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
}
}
diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp
index 70339564c..84117f59d 100644
--- a/apps/openmw/mwclass/ingredient.cpp
+++ b/apps/openmw/mwclass/ingredient.cpp
@@ -7,7 +7,6 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwphysics/physicssystem.hpp"
diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp
index ea0abd6f6..38b7137f3 100644
--- a/apps/openmw/mwclass/light.cpp
+++ b/apps/openmw/mwclass/light.cpp
@@ -5,20 +5,16 @@
#include
#include "../mwbase/environment.hpp"
-#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
-#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/nullaction.hpp"
#include "../mwworld/failedaction.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwphysics/physicssystem.hpp"
-#include "../mwworld/customdata.hpp"
#include "../mwgui/tooltips.hpp"
diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp
index 5673465a0..013808bb2 100644
--- a/apps/openmw/mwclass/lockpick.cpp
+++ b/apps/openmw/mwclass/lockpick.cpp
@@ -4,11 +4,9 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"
-#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/cellstore.hpp"
diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp
index 40ec2b34b..51b641d4d 100644
--- a/apps/openmw/mwclass/misc.cpp
+++ b/apps/openmw/mwclass/misc.cpp
@@ -7,7 +7,6 @@
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwphysics/physicssystem.hpp"
diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp
index 317764e0c..5e03477c4 100644
--- a/apps/openmw/mwclass/npc.cpp
+++ b/apps/openmw/mwclass/npc.cpp
@@ -619,6 +619,8 @@ namespace MWClass
damage = attack[0] + ((attack[1]-attack[0])*attackStrength);
}
MWMechanics::adjustWeaponDamage(damage, weapon, ptr);
+ MWMechanics::resistNormalWeapon(victim, ptr, weapon, damage);
+ MWMechanics::applyWerewolfDamageMult(victim, weapon, damage);
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
healthdmg = true;
}
@@ -780,7 +782,7 @@ namespace MWClass
MWWorld::Ptr armor = ((armorslot != inv.end()) ? *armorslot : MWWorld::Ptr());
if(!armor.isEmpty() && armor.getTypeName() == typeid(ESM::Armor).name())
{
- if (attacker.isEmpty() || (!attacker.isEmpty() && !(object.isEmpty() && !attacker.getClass().isNpc()))) // Unarmed creature attacks don't affect armor condition
+ if (!object.isEmpty() || attacker.isEmpty() || attacker.getClass().isNpc()) // Unarmed creature attacks don't affect armor condition
{
int armorhealth = armor.getClass().getItemHealth(armor);
armorhealth -= std::min(damageDiff, armorhealth);
@@ -935,8 +937,12 @@ namespace MWClass
const float normalizedEncumbrance = getNormalizedEncumbrance(ptr);
- bool sneaking = MWBase::Environment::get().getMechanicsManager()->isSneaking(ptr) && stats.getStance(MWMechanics::CreatureStats::Stance_Sneak);
- bool running = MWBase::Environment::get().getMechanicsManager()->isRunning(ptr) && stats.getStance(MWMechanics::CreatureStats::Stance_Run);
+ bool swimming = world->isSwimming(ptr);
+ bool inair = !world->isOnGround(ptr) && !swimming && !world->isFlying(ptr);
+ bool sneaking = stats.getStance(MWMechanics::CreatureStats::Stance_Sneak);
+ sneaking = sneaking && (inair || MWBase::Environment::get().getMechanicsManager()->isSneaking(ptr));
+ bool running = stats.getStance(MWMechanics::CreatureStats::Stance_Run);
+ running = running && (inair || MWBase::Environment::get().getMechanicsManager()->isRunning(ptr));
float walkSpeed = gmst.fMinWalkSpeed->mValue.getFloat() + 0.01f*npcdata->mNpcStats.getAttribute(ESM::Attribute::Speed).getModified()*
(gmst.fMaxWalkSpeed->mValue.getFloat() - gmst.fMinWalkSpeed->mValue.getFloat());
@@ -961,7 +967,7 @@ namespace MWClass
flySpeed = std::max(0.0f, flySpeed);
moveSpeed = flySpeed;
}
- else if (world->isSwimming(ptr))
+ else if (swimming)
{
float swimSpeed = walkSpeed;
if(running)
@@ -971,7 +977,7 @@ namespace MWClass
gmst.fSwimRunAthleticsMult->mValue.getFloat();
moveSpeed = swimSpeed;
}
- else if (running)
+ else if (running && !sneaking)
moveSpeed = runSpeed;
else
moveSpeed = walkSpeed;
@@ -1199,11 +1205,7 @@ namespace MWClass
int Npc::getServices(const MWWorld::ConstPtr &actor) const
{
- const MWWorld::LiveCellRef* ref = actor.get();
- if (ref->mBase->mHasAI)
- return ref->mBase->mAiData.mServices;
- else
- return 0;
+ return actor.get()->mBase->mAiData.mServices;
}
diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp
index 39b1cc6c2..4e95c6294 100644
--- a/apps/openmw/mwclass/potion.cpp
+++ b/apps/openmw/mwclass/potion.cpp
@@ -7,11 +7,9 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionapply.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/esmstore.hpp"
-#include "../mwworld/containerstore.hpp"
#include "../mwphysics/physicssystem.hpp"
#include "../mwworld/nullaction.hpp"
diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp
index 734b6b1fd..b53e2418a 100644
--- a/apps/openmw/mwclass/probe.cpp
+++ b/apps/openmw/mwclass/probe.cpp
@@ -4,11 +4,9 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"
-#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/cellstore.hpp"
diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp
index 7cd7ef10d..922858623 100644
--- a/apps/openmw/mwclass/repair.cpp
+++ b/apps/openmw/mwclass/repair.cpp
@@ -3,14 +3,11 @@
#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 "../mwphysics/physicssystem.hpp"
-#include "../mwworld/nullaction.hpp"
#include "../mwworld/actionrepair.hpp"
#include "../mwgui/tooltips.hpp"
diff --git a/apps/openmw/mwclass/static.cpp b/apps/openmw/mwclass/static.cpp
index 40a6b998c..a6e4fe5e7 100644
--- a/apps/openmw/mwclass/static.cpp
+++ b/apps/openmw/mwclass/static.cpp
@@ -1,6 +1,7 @@
#include "static.hpp"
#include
+#include
#include "../mwworld/ptr.hpp"
#include "../mwphysics/physicssystem.hpp"
@@ -8,14 +9,17 @@
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
+#include "../mwrender/vismask.hpp"
namespace MWClass
{
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
- if (!model.empty()) {
+ if (!model.empty())
+ {
renderingInterface.getObjects().insertModel(ptr, model);
+ ptr.getRefData().getBaseNode()->setNodeMask(MWRender::Mask_Static);
}
}
diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp
index 508cf47ae..dd6d63166 100644
--- a/apps/openmw/mwclass/weapon.cpp
+++ b/apps/openmw/mwclass/weapon.cpp
@@ -10,7 +10,6 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
-#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/cellstore.hpp"
diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp
index 9d2e3e288..ef9a3708a 100644
--- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp
+++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp
@@ -1,9 +1,6 @@
#include "dialoguemanagerimp.hpp"
-#include
-#include
#include
-#include
#include
#include
diff --git a/apps/openmw/mwdialogue/quest.cpp b/apps/openmw/mwdialogue/quest.cpp
index 846597886..5f20a8abb 100644
--- a/apps/openmw/mwdialogue/quest.cpp
+++ b/apps/openmw/mwdialogue/quest.cpp
@@ -41,19 +41,6 @@ namespace MWDialogue
void Quest::setIndex (int index)
{
- const ESM::Dialogue *dialogue =
- MWBase::Environment::get().getWorld()->getStore().get().find (mTopic);
-
- for (ESM::Dialogue::InfoContainer::const_iterator iter (dialogue->mInfo.begin());
- iter!=dialogue->mInfo.end(); ++iter)
- if (iter->mData.mDisposition==index && iter->mQuestStatus!=ESM::DialInfo::QS_Name)
- {
- if (iter->mQuestStatus==ESM::DialInfo::QS_Finished)
- mFinished = true;
- else if (iter->mQuestStatus==ESM::DialInfo::QS_Restart)
- mFinished = false;
- }
-
// The index must be set even if no related journal entry was found
mIndex = index;
}
@@ -81,8 +68,18 @@ namespace MWDialogue
if (index==-1)
throw std::runtime_error ("unknown journal entry for topic " + mTopic);
+ for (auto &info : dialogue->mInfo)
+ {
+ if (info.mData.mJournalIndex == index
+ && (info.mQuestStatus == ESM::DialInfo::QS_Finished || info.mQuestStatus == ESM::DialInfo::QS_Restart))
+ {
+ mFinished = (info.mQuestStatus == ESM::DialInfo::QS_Finished);
+ break;
+ }
+ }
+
if (index > mIndex)
- setIndex (index);
+ mIndex = index;
for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter)
if (iter->mInfoId==entry.mInfoId)
diff --git a/apps/openmw/mwdialogue/scripttest.cpp b/apps/openmw/mwdialogue/scripttest.cpp
index 4f0b7422c..791a4da7e 100644
--- a/apps/openmw/mwdialogue/scripttest.cpp
+++ b/apps/openmw/mwdialogue/scripttest.cpp
@@ -15,7 +15,6 @@
#include
#include
#include
-#include
#include
#include "filter.hpp"
diff --git a/apps/openmw/mwdialogue/selectwrapper.cpp b/apps/openmw/mwdialogue/selectwrapper.cpp
index 793963e48..28dbd214b 100644
--- a/apps/openmw/mwdialogue/selectwrapper.cpp
+++ b/apps/openmw/mwdialogue/selectwrapper.cpp
@@ -1,9 +1,6 @@
#include "selectwrapper.hpp"
-#include
-
#include
-#include
#include
#include
diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp
index fa8a96185..9db7a055b 100644
--- a/apps/openmw/mwgui/alchemywindow.cpp
+++ b/apps/openmw/mwgui/alchemywindow.cpp
@@ -3,6 +3,7 @@
#include
#include
#include
+#include
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
@@ -237,15 +238,15 @@ namespace MWGui
std::set effectIds = mAlchemy->listEffects();
Widgets::SpellEffectList list;
unsigned int effectIndex=0;
- for (std::set::iterator it2 = effectIds.begin(); it2 != effectIds.end(); ++it2)
+ for (const MWMechanics::EffectKey& effectKey : effectIds)
{
Widgets::SpellEffectParams params;
- params.mEffectID = it2->mId;
- const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(it2->mId);
+ params.mEffectID = effectKey.mId;
+ const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effectKey.mId);
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill)
- params.mSkill = it2->mArg;
+ params.mSkill = effectKey.mArg;
else if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
- params.mAttribute = it2->mArg;
+ params.mAttribute = effectKey.mArg;
params.mIsConstant = true;
params.mNoTarget = true;
diff --git a/apps/openmw/mwgui/alchemywindow.hpp b/apps/openmw/mwgui/alchemywindow.hpp
index aa23fbaa5..c6eb00792 100644
--- a/apps/openmw/mwgui/alchemywindow.hpp
+++ b/apps/openmw/mwgui/alchemywindow.hpp
@@ -1,12 +1,9 @@
#ifndef MWGUI_ALCHEMY_H
#define MWGUI_ALCHEMY_H
+#include
#include
-#include
-
-#include "../mwmechanics/alchemy.hpp"
-
#include
#include "controllers.hpp"
diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp
index c1867541b..6f6a621ad 100644
--- a/apps/openmw/mwgui/birth.cpp
+++ b/apps/openmw/mwgui/birth.cpp
@@ -145,35 +145,35 @@ namespace MWGui
// sort by name
std::vector < std::pair > birthSigns;
- MWWorld::Store::iterator it = signs.begin();
- for (; it != signs.end(); ++it)
+ for (const ESM::BirthSign& sign : signs)
{
- birthSigns.push_back(std::make_pair(it->mId, &(*it)));
+ birthSigns.push_back(std::make_pair(sign.mId, &sign));
}
std::sort(birthSigns.begin(), birthSigns.end(), sortBirthSigns);
int index = 0;
- for (std::vector >::const_iterator it2 = birthSigns.begin();
- it2 != birthSigns.end(); ++it2, ++index)
+ for (auto& birthsignPair : birthSigns)
{
- mBirthList->addItem(it2->second->mName, it2->first);
+ mBirthList->addItem(birthsignPair.second->mName, birthsignPair.first);
if (mCurrentBirthId.empty())
{
mBirthList->setIndexSelected(index);
- mCurrentBirthId = it2->first;
+ mCurrentBirthId = birthsignPair.first;
}
- else if (Misc::StringUtils::ciEqual(it2->first, mCurrentBirthId))
+ else if (Misc::StringUtils::ciEqual(birthsignPair.first, mCurrentBirthId))
{
mBirthList->setIndexSelected(index);
}
+
+ index++;
}
}
void BirthDialog::updateSpells()
{
- for (std::vector::iterator it = mSpellItems.begin(); it != mSpellItems.end(); ++it)
+ for (MyGUI::Widget* widget : mSpellItems)
{
- MyGUI::Gui::getInstance().destroyWidget(*it);
+ MyGUI::Gui::getInstance().destroyWidget(widget);
}
mSpellItems.clear();
diff --git a/apps/openmw/mwgui/bookpage.hpp b/apps/openmw/mwgui/bookpage.hpp
index 4ea59414d..7f7dfd20a 100644
--- a/apps/openmw/mwgui/bookpage.hpp
+++ b/apps/openmw/mwgui/bookpage.hpp
@@ -6,6 +6,7 @@
#include "MyGUI_FontManager.h"
#include
+#include
#include
#include
diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp
index e3effa995..64b8cb7c6 100644
--- a/apps/openmw/mwgui/charactercreation.cpp
+++ b/apps/openmw/mwgui/charactercreation.cpp
@@ -257,19 +257,17 @@ namespace MWGui
{
std::map attributes = MWBase::Environment::get().getWindowManager()->getPlayerAttributeValues();
- for (std::map::iterator it = attributes.begin();
- it != attributes.end(); ++it)
+ for (auto& attributePair : attributes)
{
- mReviewDialog->setAttribute(static_cast (it->first), it->second);
+ mReviewDialog->setAttribute(static_cast (attributePair.first), attributePair.second);
}
}
{
std::map skills = MWBase::Environment::get().getWindowManager()->getPlayerSkillValues();
- for (std::map::iterator it = skills.begin();
- it != skills.end(); ++it)
+ for (auto& skillPair : skills)
{
- mReviewDialog->setSkillValue(static_cast (it->first), it->second);
+ mReviewDialog->setSkillValue(static_cast (skillPair.first), skillPair.second);
}
mReviewDialog->configureSkills(MWBase::Environment::get().getWindowManager()->getPlayerMajorSkills(), MWBase::Environment::get().getWindowManager()->getPlayerMinorSkills());
}
@@ -554,7 +552,7 @@ namespace MWGui
{
if (mGenerateClassStep == 10)
{
- static boost::array classes = { {
+ static std::array classes = { {
{"Acrobat", {6, 2, 2}},
{"Agent", {6, 1, 3}},
{"Archer", {3, 5, 2}},
diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp
index 45abe889e..a92ad934c 100644
--- a/apps/openmw/mwgui/class.cpp
+++ b/apps/openmw/mwgui/class.cpp
@@ -207,25 +207,25 @@ namespace MWGui
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
- std::vector > items; // class id, class name
- for (MWWorld::Store::iterator it = store.get().begin(); it != store.get().end(); ++it)
+ std::vector > items; // class id, class name
+ for (const ESM::Class& classInfo : store.get())
{
- bool playable = (it->mData.mIsPlayable != 0);
+ bool playable = (classInfo.mData.mIsPlayable != 0);
if (!playable) // Only display playable classes
continue;
- if (store.get().isDynamic(it->mId))
+ if (store.get().isDynamic(classInfo.mId))
continue; // custom-made class not relevant for this dialog
- items.push_back(std::make_pair(it->mId, it->mName));
+ items.push_back(std::make_pair(classInfo.mId, classInfo.mName));
}
std::sort(items.begin(), items.end(), sortClasses);
int index = 0;
- for (std::vector >::const_iterator it = items.begin(); it != items.end(); ++it)
+ for (auto& itemPair : items)
{
- const std::string &id = it->first;
- mClassList->addItem(it->second, id);
+ const std::string &id = itemPair.first;
+ mClassList->addItem(itemPair.second, id);
if (mCurrentClassId.empty())
{
mCurrentClassId = id;
@@ -332,19 +332,17 @@ namespace MWGui
void InfoBoxDialog::setButtons(ButtonList &buttons)
{
- for (std::vector::iterator it = this->mButtons.begin(); it != this->mButtons.end(); ++it)
+ for (MyGUI::Button* button : this->mButtons)
{
- MyGUI::Gui::getInstance().destroyWidget(*it);
+ MyGUI::Gui::getInstance().destroyWidget(button);
}
this->mButtons.clear();
// TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget
MyGUI::Button* button;
MyGUI::IntCoord coord = MyGUI::IntCoord(0, 0, mButtonBar->getWidth(), 10);
- ButtonList::const_iterator end = buttons.end();
- for (ButtonList::const_iterator it = buttons.begin(); it != end; ++it)
+ for (const std::string &text : buttons)
{
- const std::string &text = *it;
button = mButtonBar->createWidget("MW_Button", coord, MyGUI::Align::Top | MyGUI::Align::HCenter, "");
button->getSubWidgetText()->setWordWrap(true);
button->setCaption(text);
@@ -368,11 +366,10 @@ namespace MWGui
void InfoBoxDialog::onButtonClicked(MyGUI::Widget* _sender)
{
- std::vector::const_iterator end = mButtons.end();
int i = 0;
- for (std::vector::const_iterator it = mButtons.begin(); it != end; ++it)
+ for (MyGUI::Button* button : mButtons)
{
- if (*it == _sender)
+ if (button == _sender)
{
eventButtonSelected(i);
return;
@@ -430,10 +427,9 @@ namespace MWGui
mSkills.push_back(mMinorSkill[i]);
}
- std::vector::const_iterator end = mSkills.end();
- for (std::vector::const_iterator it = mSkills.begin(); it != end; ++it)
+ for (Widgets::MWSkillPtr& skill : mSkills)
{
- (*it)->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onSkillClicked);
+ skill->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onSkillClicked);
}
setText("LabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sName", ""));
@@ -642,14 +638,13 @@ namespace MWGui
ESM::Skill::SkillEnum id = mSkillDialog->getSkillId();
// Avoid duplicate skills by swapping any skill field that matches the selected one
- std::vector::const_iterator end = mSkills.end();
- for (std::vector::const_iterator it = mSkills.begin(); it != end; ++it)
+ for (Widgets::MWSkillPtr& skill : mSkills)
{
- if (*it == mAffectedSkill)
+ if (skill == mAffectedSkill)
continue;
- if ((*it)->getSkillId() == id)
+ if (skill->getSkillId() == id)
{
- (*it)->setSkillId(mAffectedSkill->getSkillId());
+ skill->setSkillId(mAffectedSkill->getSkillId());
break;
}
}
diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp
index dc22e4193..899bc0d90 100644
--- a/apps/openmw/mwgui/console.cpp
+++ b/apps/openmw/mwgui/console.cpp
@@ -11,10 +11,12 @@
#include "../mwscript/extensions.hpp"
#include "../mwbase/environment.hpp"
+#include "../mwbase/scriptmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/esmstore.hpp"
+#include "../mwworld/class.hpp"
namespace MWGui
{
@@ -173,6 +175,12 @@ namespace MWGui
print("> " + command + "\n");
Compiler::Locals locals;
+ if (!mPtr.isEmpty())
+ {
+ std::string script = mPtr.getClass().getScript(mPtr);
+ if (!script.empty())
+ locals = MWBase::Environment::get().getScriptManager()->getLocals(script);
+ }
Compiler::Output output (locals);
if (compile (command + "\n", output))
@@ -231,11 +239,13 @@ namespace MWGui
{
int i = 0;
printOK("");
- for(std::vector::iterator it=matches.begin(); it < matches.end(); ++it,++i )
+ for(std::string& match : matches)
{
- printOK( *it );
- if( i == 50 )
+ if(i == 50)
break;
+
+ printOK(match);
+ i++;
}
}
}
@@ -352,15 +362,16 @@ namespace MWGui
}
/* Iterate through the vector. */
- for(std::vector::iterator it=mNames.begin(); it < mNames.end();++it) {
+ for(std::string& name : mNames)
+ {
bool string_different=false;
/* Is the string shorter than the input string? If yes skip it. */
- if( (*it).length() < tmp.length() )
+ if(name.length() < tmp.length())
continue;
/* Is the beginning of the string different from the input string? If yes skip it. */
- for( std::string::iterator iter=tmp.begin(), iter2=(*it).begin(); iter < tmp.end();++iter, ++iter2) {
+ for( std::string::iterator iter=tmp.begin(), iter2=name.begin(); iter < tmp.end();++iter, ++iter2) {
if( Misc::StringUtils::toLower(*iter) != Misc::StringUtils::toLower(*iter2) ) {
string_different=true;
break;
@@ -371,7 +382,7 @@ namespace MWGui
continue;
/* The beginning of the string matches the input string, save it for the next test. */
- matches.push_back(*it);
+ matches.push_back(name);
}
/* There are no matches. Return the unchanged input. */
@@ -399,11 +410,14 @@ namespace MWGui
/* Check if all matching strings match further than input. If yes complete to this match. */
int i = tmp.length();
- for(std::string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); ++iter, ++i) {
- for(std::vector::iterator it=matches.begin(); it < matches.end();++it) {
- if( Misc::StringUtils::toLower((*it)[i]) != Misc::StringUtils::toLower(*iter) ) {
+ for(std::string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); ++iter, ++i)
+ {
+ for(std::string& match : matches)
+ {
+ if(Misc::StringUtils::toLower(match[i]) != Misc::StringUtils::toLower(*iter))
+ {
/* Append the longest match to the end of the output string*/
- output.append(matches.front().substr( 0, i));
+ output.append(matches.front().substr(0, i));
return output;
}
}
diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp
index 51c0603ca..f89cd4ff3 100644
--- a/apps/openmw/mwgui/container.cpp
+++ b/apps/openmw/mwgui/container.cpp
@@ -6,7 +6,6 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
-#include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/class.hpp"
@@ -18,7 +17,6 @@
#include "inventorywindow.hpp"
#include "itemview.hpp"
-#include "itemwidget.hpp"
#include "inventoryitemmodel.hpp"
#include "containeritemmodel.hpp"
#include "sortfilteritemmodel.hpp"
diff --git a/apps/openmw/mwgui/containeritemmodel.cpp b/apps/openmw/mwgui/containeritemmodel.cpp
index 24e7f8d00..5ba5bb0eb 100644
--- a/apps/openmw/mwgui/containeritemmodel.cpp
+++ b/apps/openmw/mwgui/containeritemmodel.cpp
@@ -13,8 +13,6 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"
-#include "../mwmechanics/actorutil.hpp"
-
namespace
{
@@ -84,9 +82,9 @@ size_t ContainerItemModel::getItemCount()
ItemModel::ModelIndex ContainerItemModel::getIndex (ItemStack item)
{
size_t i = 0;
- for (std::vector::iterator it = mItems.begin(); it != mItems.end(); ++it)
+ for (ItemStack& itemStack : mItems)
{
- if (*it == item)
+ if (itemStack == item)
return i;
++i;
}
@@ -105,29 +103,29 @@ void ContainerItemModel::removeItem (const ItemStack& item, size_t count)
{
int toRemove = count;
- for (std::vector::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source)
+ for (MWWorld::Ptr& source : mItemSources)
{
- MWWorld::ContainerStore& store = source->getClass().getContainerStore(*source);
+ MWWorld::ContainerStore& store = source.getClass().getContainerStore(source);
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
{
if (stacks(*it, item.mBase))
{
- toRemove -= store.remove(*it, toRemove, *source);
+ toRemove -= store.remove(*it, toRemove, source);
if (toRemove <= 0)
return;
}
}
}
- for (std::vector::iterator source = mWorldItems.begin(); source != mWorldItems.end(); ++source)
+ for (MWWorld::Ptr& source : mWorldItems)
{
- if (stacks(*source, item.mBase))
+ if (stacks(source, item.mBase))
{
- int refCount = source->getRefData().getCount();
+ int refCount = source.getRefData().getCount();
if (refCount - toRemove <= 0)
- MWBase::Environment::get().getWorld()->deleteObject(*source);
+ MWBase::Environment::get().getWorld()->deleteObject(source);
else
- source->getRefData().setCount(std::max(0, refCount - toRemove));
+ source.getRefData().setCount(std::max(0, refCount - toRemove));
toRemove -= refCount;
if (toRemove <= 0)
return;
@@ -140,27 +138,28 @@ void ContainerItemModel::removeItem (const ItemStack& item, size_t count)
void ContainerItemModel::update()
{
mItems.clear();
- for (std::vector::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source)
+ for (MWWorld::Ptr& source : mItemSources)
{
- MWWorld::ContainerStore& store = source->getClass().getContainerStore(*source);
+ MWWorld::ContainerStore& store = source.getClass().getContainerStore(source);
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
{
if (!(*it).getClass().showsInInventory(*it))
continue;
- std::vector::iterator itemStack = mItems.begin();
- for (; itemStack != mItems.end(); ++itemStack)
+ bool found = false;
+ for (ItemStack& itemStack : mItems)
{
- if (stacks(*it, itemStack->mBase))
+ if (stacks(*it, itemStack.mBase))
{
// we already have an item stack of this kind, add to it
- itemStack->mCount += it->getRefData().getCount();
+ itemStack.mCount += it->getRefData().getCount();
+ found = true;
break;
}
}
- if (itemStack == mItems.end())
+ if (!found)
{
// no stack yet, create one
ItemStack newItem (*it, this, it->getRefData().getCount());
@@ -168,23 +167,24 @@ void ContainerItemModel::update()
}
}
}
- for (std::vector::iterator source = mWorldItems.begin(); source != mWorldItems.end(); ++source)
+ for (MWWorld::Ptr& source : mWorldItems)
{
- std::vector::iterator itemStack = mItems.begin();
- for (; itemStack != mItems.end(); ++itemStack)
+ bool found = false;
+ for (ItemStack& itemStack : mItems)
{
- if (stacks(*source, itemStack->mBase))
+ if (stacks(source, itemStack.mBase))
{
// we already have an item stack of this kind, add to it
- itemStack->mCount += source->getRefData().getCount();
+ itemStack.mCount += source.getRefData().getCount();
+ found = true;
break;
}
}
- if (itemStack == mItems.end())
+ if (!found)
{
// no stack yet, create one
- ItemStack newItem (*source, this, source->getRefData().getCount());
+ ItemStack newItem (source, this, source.getRefData().getCount());
mItems.push_back(newItem);
}
}
diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp
index dfb2b15b9..6b400c172 100644
--- a/apps/openmw/mwgui/dialogue.cpp
+++ b/apps/openmw/mwgui/dialogue.cpp
@@ -184,16 +184,16 @@ namespace MWGui
BookTypesetter::Style* style = typesetter->createStyle("", textColours.normal, false);
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)
+ for (auto& hyperLink : hyperLinks)
{
- intptr_t topicId = it->second;
+ intptr_t topicId = hyperLink.second;
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);
- formatted = it->first.second;
+ if (formatted < hyperLink.first.first)
+ typesetter->write(style, formatted, hyperLink.first.first);
+ typesetter->write(hotStyle, hyperLink.first.first, hyperLink.first.second);
+ formatted = hyperLink.first.second;
}
if (formatted < text.size())
typesetter->write(style, formatted, text.size());
@@ -204,9 +204,8 @@ namespace MWGui
keywordSearch->highlightKeywords(text.begin(), text.end(), matches);
std::string::const_iterator i = text.begin ();
- for (std::vector::iterator it = matches.begin(); it != matches.end(); ++it)
+ for (KeywordSearchT::Match& match : matches)
{
- KeywordSearchT::Match match = *it;
if (i != match.mBeg)
addTopicLink (typesetter, 0, i - text.begin (), match.mBeg - text.begin ());
@@ -419,13 +418,13 @@ namespace MWGui
bool sameActor = (mPtr == actor);
if (!sameActor)
{
- for (std::vector::iterator it = mHistoryContents.begin(); it != mHistoryContents.end(); ++it)
- delete (*it);
+ for (DialogueText* text : mHistoryContents)
+ delete text;
mHistoryContents.clear();
mKeywords.clear();
mTopicsList->clear();
- for (std::vector::iterator it = mLinks.begin(); it != mLinks.end(); ++it)
- mDeleteLater.push_back(*it); // Links are not deleted right away to prevent issues with event handlers
+ for (Link* link : mLinks)
+ mDeleteLater.push_back(link); // Links are not deleted right away to prevent issues with event handlers
mLinks.clear();
}
@@ -489,8 +488,8 @@ namespace MWGui
void DialogueWindow::updateTopicsPane()
{
mTopicsList->clear();
- for (std::map::iterator it = mTopicLinks.begin(); it != mTopicLinks.end(); ++it)
- mDeleteLater.push_back(it->second);
+ for (auto& linkPair : mTopicLinks)
+ mDeleteLater.push_back(linkPair.second);
mTopicLinks.clear();
mKeywordSearch.clear();
@@ -533,15 +532,15 @@ namespace MWGui
mTopicsList->addSeparator();
- for(std::list::iterator it = mKeywords.begin(); it != mKeywords.end(); ++it)
+ for(std::string& keyword : mKeywords)
{
- mTopicsList->addItem(*it);
+ mTopicsList->addItem(keyword);
- Topic* t = new Topic(*it);
+ Topic* t = new Topic(keyword);
t->eventTopicActivated += MyGUI::newDelegate(this, &DialogueWindow::onTopicActivated);
- mTopicLinks[Misc::StringUtils::lowerCase(*it)] = t;
+ mTopicLinks[Misc::StringUtils::lowerCase(keyword)] = t;
- mKeywordSearch.seed(Misc::StringUtils::lowerCase(*it), intptr_t(t));
+ mKeywordSearch.seed(Misc::StringUtils::lowerCase(keyword), intptr_t(t));
}
mTopicsList->adjustSize();
@@ -563,9 +562,8 @@ namespace MWGui
BookTypesetter::Ptr typesetter = BookTypesetter::create (mHistory->getWidth(), std::numeric_limits::max());
- for (std::vector::iterator it = mHistoryContents.begin(); it != mHistoryContents.end(); ++it)
- (*it)->write(typesetter, &mKeywordSearch, mTopicLinks);
-
+ for (DialogueText* text : mHistoryContents)
+ text->write(typesetter, &mKeywordSearch, mTopicLinks);
BookTypesetter::Style* body = typesetter->createStyle("", MyGUI::Colour::White, false);
@@ -573,9 +571,9 @@ namespace MWGui
// choices
const TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
mChoices = MWBase::Environment::get().getDialogueManager()->getChoices();
- for (std::vector >::const_iterator it = mChoices.begin(); it != mChoices.end(); ++it)
+ for (std::pair& choice : mChoices)
{
- Choice* link = new Choice(it->second);
+ Choice* link = new Choice(choice.second);
link->eventChoiceActivated += MyGUI::newDelegate(this, &DialogueWindow::onChoiceActivated);
mLinks.push_back(link);
@@ -583,7 +581,7 @@ namespace MWGui
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()));
+ typesetter->write(questionStyle, to_utf8_span(choice.first.c_str()));
}
mGoodbye = MWBase::Environment::get().getDialogueManager()->isGoodbye();
diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp
index 98980e339..fbdc1bf80 100644
--- a/apps/openmw/mwgui/enchantingdialog.cpp
+++ b/apps/openmw/mwgui/enchantingdialog.cpp
@@ -9,7 +9,10 @@
#include
#include
+#include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"
+#include "../mwbase/world.hpp"
+
#include "../mwworld/class.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/esmstore.hpp"
@@ -345,8 +348,7 @@ namespace MWGui
if (MWBase::Environment::get().getMechanicsManager()->isItemStolenFrom(item.getCellRef().getRefId(), mPtr))
{
std::string msg = MWBase::Environment::get().getWorld()->getStore().get().find("sNotifyMessage49")->mValue.getString();
- if (msg.find("%s") != std::string::npos)
- msg.replace(msg.find("%s"), 2, item.getClass().getName(item));
+ Misc::StringUtils::replace(msg, "%s", item.getClass().getName(item).c_str(), 2);
MWBase::Environment::get().getWindowManager()->messageBox(msg);
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, item, mPtr, 1);
diff --git a/apps/openmw/mwgui/formatting.cpp b/apps/openmw/mwgui/formatting.cpp
index 78359608e..fca05b05c 100644
--- a/apps/openmw/mwgui/formatting.cpp
+++ b/apps/openmw/mwgui/formatting.cpp
@@ -4,15 +4,11 @@
#include
#include
#include
-#include
// correctBookartPath
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
-#include
-#include
-
#include
#include
#include
@@ -30,7 +26,7 @@ namespace MWGui
MWScript::InterpreterContext interpreterContext(nullptr, MWWorld::Ptr()); // empty arguments, because there is no locals or actor
mText = Interpreter::fixDefinesBook(mText, interpreterContext);
- boost::algorithm::replace_all(mText, "\r", "");
+ Misc::StringUtils::replaceAll(mText, "\r", "");
// vanilla game does not show any text after the last EOL tag.
const std::string lowerText = Misc::StringUtils::lowerCase(mText);
diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp
index de85f296d..de6629515 100644
--- a/apps/openmw/mwgui/hud.cpp
+++ b/apps/openmw/mwgui/hud.cpp
@@ -25,7 +25,6 @@
#include "itemmodel.hpp"
#include "draganddrop.hpp"
-#include "itemmodel.hpp"
#include "itemwidget.hpp"
namespace MWGui
@@ -262,7 +261,7 @@ namespace MWGui
if (mode == GM_Console)
MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object);
- else if ((mode == GM_Container) || (mode == GM_Inventory))
+ else //if ((mode == GM_Container) || (mode == GM_Inventory))
{
// pick up object
if (!object.isEmpty())
diff --git a/apps/openmw/mwgui/inventoryitemmodel.cpp b/apps/openmw/mwgui/inventoryitemmodel.cpp
index c9f55d352..d74819a89 100644
--- a/apps/openmw/mwgui/inventoryitemmodel.cpp
+++ b/apps/openmw/mwgui/inventoryitemmodel.cpp
@@ -37,9 +37,9 @@ size_t InventoryItemModel::getItemCount()
ItemModel::ModelIndex InventoryItemModel::getIndex (ItemStack item)
{
size_t i = 0;
- for (std::vector::iterator it = mItems.begin(); it != mItems.end(); ++it)
+ for (ItemStack& itemStack : mItems)
{
- if (*it == item)
+ if (itemStack == item)
return i;
++i;
}
diff --git a/apps/openmw/mwgui/itemchargeview.cpp b/apps/openmw/mwgui/itemchargeview.cpp
index 10c36c73f..44fa94f3a 100644
--- a/apps/openmw/mwgui/itemchargeview.cpp
+++ b/apps/openmw/mwgui/itemchargeview.cpp
@@ -130,13 +130,13 @@ namespace MWGui
{
int currentY = 0;
- for (Lines::const_iterator iter = mLines.begin(); iter != mLines.end(); ++iter)
+ for (Line& line : mLines)
{
- iter->mText->setCoord(8, currentY, mScrollView->getWidth()-8, 18);
+ line.mText->setCoord(8, currentY, mScrollView->getWidth()-8, 18);
currentY += 19;
- iter->mIcon->setCoord(16, currentY, 32, 32);
- iter->mCharge->setCoord(72, currentY+2, std::max(199, mScrollView->getWidth()-72-38), 20);
+ line.mIcon->setCoord(16, currentY, 32, 32);
+ line.mCharge->setCoord(72, currentY+2, std::max(199, mScrollView->getWidth()-72-38), 20);
currentY += 32 + 4;
}
diff --git a/apps/openmw/mwgui/itemmodel.cpp b/apps/openmw/mwgui/itemmodel.cpp
index c7c10e8e4..08c5bff35 100644
--- a/apps/openmw/mwgui/itemmodel.cpp
+++ b/apps/openmw/mwgui/itemmodel.cpp
@@ -1,13 +1,9 @@
#include "itemmodel.hpp"
-#include
-
#include "../mwworld/class.hpp"
#include "../mwworld/containerstore.hpp"
-#include "../mwworld/store.hpp"
#include "../mwworld/esmstore.hpp"
-#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"
diff --git a/apps/openmw/mwgui/itemwidget.cpp b/apps/openmw/mwgui/itemwidget.cpp
index ba3039a16..5ab69e722 100644
--- a/apps/openmw/mwgui/itemwidget.cpp
+++ b/apps/openmw/mwgui/itemwidget.cpp
@@ -156,12 +156,19 @@ namespace MWGui
void SpellWidget::setSpellIcon(const std::string& icon)
{
- if (mFrame)
+ if (mFrame && !mCurrentFrame.empty())
+ {
+ mCurrentFrame.clear();
mFrame->setImageTexture("");
- if (mItemShadow)
- mItemShadow->setImageTexture(icon);
- if (mItem)
- mItem->setImageTexture(icon);
+ }
+ if (mCurrentIcon != icon)
+ {
+ mCurrentIcon = icon;
+ if (mItemShadow)
+ mItemShadow->setImageTexture(icon);
+ if (mItem)
+ mItem->setImageTexture(icon);
+ }
}
}
diff --git a/apps/openmw/mwgui/jailscreen.cpp b/apps/openmw/mwgui/jailscreen.cpp
index 1761e1346..e04ceac7a 100644
--- a/apps/openmw/mwgui/jailscreen.cpp
+++ b/apps/openmw/mwgui/jailscreen.cpp
@@ -78,8 +78,7 @@ namespace MWGui
MWWorld::Ptr player = MWMechanics::getPlayer();
- for (int i=0; irest(true);
+ MWBase::Environment::get().getMechanicsManager()->rest(mDays * 24, true);
MWBase::Environment::get().getWorld()->advanceTime(mDays * 24);
std::set skills;
@@ -103,24 +102,18 @@ namespace MWGui
else
message = gmst.find("sNotifyMessage43")->mValue.getString();
- std::stringstream dayStr;
- dayStr << mDays;
- if (message.find("%d") != std::string::npos)
- message.replace(message.find("%d"), 2, dayStr.str());
+ Misc::StringUtils::replace(message, "%d", std::to_string(mDays).c_str(), 2);
- for (std::set::iterator it = skills.begin(); it != skills.end(); ++it)
+ for (const int& skill : skills)
{
- std::string skillName = gmst.find(ESM::Skill::sSkillNameIds[*it])->mValue.getString();
- std::stringstream skillValue;
- skillValue << player.getClass().getNpcStats(player).getSkill(*it).getBase();
+ std::string skillName = gmst.find(ESM::Skill::sSkillNameIds[skill])->mValue.getString();
+ int skillValue = player.getClass().getNpcStats(player).getSkill(skill).getBase();
std::string skillMsg = gmst.find("sNotifyMessage44")->mValue.getString();
- if (*it == ESM::Skill::Sneak || *it == ESM::Skill::Security)
+ if (skill == ESM::Skill::Sneak || skill == ESM::Skill::Security)
skillMsg = gmst.find("sNotifyMessage39")->mValue.getString();
- if (skillMsg.find("%s") != std::string::npos)
- skillMsg.replace(skillMsg.find("%s"), 2, skillName);
- if (skillMsg.find("%d") != std::string::npos)
- skillMsg.replace(skillMsg.find("%d"), 2, skillValue.str());
+ Misc::StringUtils::replace(skillMsg, "%s", skillName.c_str(), 2);
+ Misc::StringUtils::replace(skillMsg, "%d", std::to_string(skillValue).c_str(), 2);
message += "\n" + skillMsg;
}
diff --git a/apps/openmw/mwgui/journalbooks.cpp b/apps/openmw/mwgui/journalbooks.cpp
index 4302740f6..065a503e6 100644
--- a/apps/openmw/mwgui/journalbooks.cpp
+++ b/apps/openmw/mwgui/journalbooks.cpp
@@ -1,7 +1,5 @@
#include "journalbooks.hpp"
-#include
-
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp
index a2f6ea142..095d74e8a 100644
--- a/apps/openmw/mwgui/journalwindow.cpp
+++ b/apps/openmw/mwgui/journalwindow.cpp
@@ -1,6 +1,5 @@
#include "journalwindow.hpp"
-#include
#include
#include
#include
@@ -554,7 +553,7 @@ namespace
mQuestMode = true;
setVisible (LeftTopicIndex, false);
- setVisible (CenterTopicIndex, true);
+ setVisible (CenterTopicIndex, false);
setVisible (RightTopicIndex, false);
setVisible (TopicsList, false);
setVisible (QuestsList, true);
@@ -631,7 +630,7 @@ namespace
if (page+2 < book->pageCount())
{
- MWBase::Environment::get().getWindowManager()->playSound("book page", true);
+ MWBase::Environment::get().getWindowManager()->playSound("book page");
page += 2;
updateShowingPages ();
@@ -649,7 +648,7 @@ namespace
if(page >= 2)
{
- MWBase::Environment::get().getWindowManager()->playSound("book page", true);
+ MWBase::Environment::get().getWindowManager()->playSound("book page");
page -= 2;
updateShowingPages ();
diff --git a/apps/openmw/mwgui/layout.cpp b/apps/openmw/mwgui/layout.cpp
index 3035adebb..ae1c09659 100644
--- a/apps/openmw/mwgui/layout.cpp
+++ b/apps/openmw/mwgui/layout.cpp
@@ -21,11 +21,11 @@ namespace MWGui
mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix, _parent);
const std::string main_name = mPrefix + MAIN_WINDOW;
- for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin(); iter!=mListWindowRoot.end(); ++iter)
+ for (MyGUI::Widget* widget : mListWindowRoot)
{
- if ((*iter)->getName() == main_name)
+ if (widget->getName() == main_name)
{
- mMainWidget = (*iter);
+ mMainWidget = widget;
break;
}
}
@@ -66,10 +66,9 @@ namespace MWGui
MyGUI::Widget* Layout::getWidget(const std::string &_name)
{
- for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin();
- iter!=mListWindowRoot.end(); ++iter)
+ for (MyGUI::Widget* widget : mListWindowRoot)
{
- MyGUI::Widget* find = (*iter)->findWidget(mPrefix + _name);
+ MyGUI::Widget* find = widget->findWidget(mPrefix + _name);
if (nullptr != find)
{
return find;
diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp
index 286405f79..415c8e31c 100644
--- a/apps/openmw/mwgui/levelupdialog.cpp
+++ b/apps/openmw/mwgui/levelupdialog.cpp
@@ -12,7 +12,6 @@
#include "../mwbase/soundmanager.hpp"
#include "../mwworld/class.hpp"
-#include "../mwworld/esmstore.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwmechanics/creaturestats.hpp"
diff --git a/apps/openmw/mwgui/loadingscreen.hpp b/apps/openmw/mwgui/loadingscreen.hpp
index e74a60206..c054f3bbd 100644
--- a/apps/openmw/mwgui/loadingscreen.hpp
+++ b/apps/openmw/mwgui/loadingscreen.hpp
@@ -1,6 +1,8 @@
#ifndef MWGUI_LOADINGSCREEN_H
#define MWGUI_LOADINGSCREEN_H
+#include
+
#include
#include
diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp
index 1b9e024ba..2c2bd84df 100644
--- a/apps/openmw/mwgui/mainmenu.cpp
+++ b/apps/openmw/mwgui/mainmenu.cpp
@@ -253,45 +253,44 @@ namespace MWGui
// Create new buttons if needed
std::vector allButtons { "return", "newgame", "savegame", "loadgame", "options", "credits", "exitgame"};
- for (std::vector::iterator it = allButtons.begin(); it != allButtons.end(); ++it)
+ for (std::string& buttonId : allButtons)
{
- if (mButtons.find(*it) == mButtons.end())
+ if (mButtons.find(buttonId) == mButtons.end())
{
Gui::ImageButton* button = mButtonBox->createWidget
("ImageBox", MyGUI::IntCoord(0, curH, 0, 0), MyGUI::Align::Default);
- button->setProperty("ImageHighlighted", "textures\\menu_" + *it + "_over.dds");
- button->setProperty("ImageNormal", "textures\\menu_" + *it + ".dds");
- button->setProperty("ImagePushed", "textures\\menu_" + *it + "_pressed.dds");
+ button->setProperty("ImageHighlighted", "textures\\menu_" + buttonId + "_over.dds");
+ button->setProperty("ImageNormal", "textures\\menu_" + buttonId + ".dds");
+ button->setProperty("ImagePushed", "textures\\menu_" + buttonId + "_pressed.dds");
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::onButtonClicked);
- button->setUserData(std::string(*it));
- mButtons[*it] = button;
+ button->setUserData(std::string(buttonId));
+ mButtons[buttonId] = button;
}
}
// Start by hiding all buttons
int maxwidth = 0;
- for (std::map::iterator it = mButtons.begin(); it != mButtons.end(); ++it)
+ for (auto& buttonPair : mButtons)
{
- it->second->setVisible(false);
- MyGUI::IntSize requested = it->second->getRequestedSize();
+ buttonPair.second->setVisible(false);
+ MyGUI::IntSize requested = buttonPair.second->getRequestedSize();
if (requested.width > maxwidth)
maxwidth = requested.width;
}
// Now show and position the ones we want
- for (std::vector::iterator it = buttons.begin(); it != buttons.end(); ++it)
+ for (std::string& buttonId : buttons)
{
- assert(mButtons.find(*it) != mButtons.end());
- Gui::ImageButton* button = mButtons[*it];
+ assert(mButtons.find(buttonId) != mButtons.end());
+ Gui::ImageButton* button = mButtons[buttonId];
button->setVisible(true);
MyGUI::IntSize requested = button->getRequestedSize();
+ button->setImageCoord(MyGUI::IntCoord(0, 0, requested.width, requested.height));
// Trim off some of the excessive padding
// TODO: perhaps do this within ImageButton?
- int trim = 8;
- button->setImageCoord(MyGUI::IntCoord(0, trim, requested.width, requested.height-trim));
- int height = requested.height-trim*2;
+ int height = requested.height-16;
button->setImageTile(MyGUI::IntSize(requested.width, height));
button->setCoord((maxwidth-requested.width) / 2, curH, requested.width, height);
curH += height;
diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp
index b9b59965d..5f4c9971c 100644
--- a/apps/openmw/mwgui/mapwindow.cpp
+++ b/apps/openmw/mwgui/mapwindow.cpp
@@ -213,8 +213,7 @@ namespace MWGui
map->setNeedMouseFocus(false);
fog->setNeedMouseFocus(false);
- mMapWidgets.push_back(map);
- mFogWidgets.push_back(fog);
+ mMaps.emplace_back(map, fog);
}
}
}
@@ -234,36 +233,37 @@ namespace MWGui
void LocalMapBase::applyFogOfWar()
{
- TextureVector fogTextures;
for (int mx=0; mxsetImageTexture("");
+ entry.mFogTexture.reset();
continue;
}
osg::ref_ptr tex = mLocalMapRender->getFogOfWarTexture(x, y);
if (tex)
{
- std::shared_ptr myguitex (new osgMyGUI::OSGTexture(tex));
- fog->setRenderItemTexture(myguitex.get());
+ entry.mFogTexture.reset(new osgMyGUI::OSGTexture(tex));
+ fog->setRenderItemTexture(entry.mFogTexture.get());
fog->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 1.f, 1.f, 0.f));
- fogTextures.push_back(myguitex);
}
else
+ {
fog->setImageTexture("black");
+ entry.mFogTexture.reset();
+ }
}
}
- // Move the textures we just set into mFogTextures, and move the previous textures into fogTextures, for deletion when this function ends.
- // Note, above we need to ensure that all widgets are getting a new texture set, lest we delete textures that are still in use.
- mFogTextures.swap(fogTextures);
redraw();
}
@@ -312,8 +312,8 @@ namespace MWGui
void LocalMapBase::updateCustomMarkers()
{
- for (std::vector::iterator it = mCustomMarkerWidgets.begin(); it != mCustomMarkerWidgets.end(); ++it)
- MyGUI::Gui::getInstance().destroyWidget(*it);
+ for (MyGUI::Widget* widget : mCustomMarkerWidgets)
+ MyGUI::Gui::getInstance().destroyWidget(widget);
mCustomMarkerWidgets.clear();
for (int dX = -mCellDistance; dX <= mCellDistance; ++dX)
@@ -369,7 +369,6 @@ namespace MWGui
applyFogOfWar();
// Update the map textures
- TextureVector textures;
for (int mx=0; mx texture = mLocalMapRender->getMapTexture(mapX, mapY);
if (texture)
{
- std::shared_ptr guiTex (new osgMyGUI::OSGTexture(texture));
- textures.push_back(guiTex);
- box->setRenderItemTexture(guiTex.get());
+ entry.mMapTexture.reset(new osgMyGUI::OSGTexture(texture));
+ box->setRenderItemTexture(entry.mMapTexture.get());
box->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f, 1.f, 1.f));
}
else
+ {
box->setRenderItemTexture(nullptr);
+ entry.mMapTexture.reset();
+ }
}
}
- mMapTextures.swap(textures);
// Delay the door markers update until scripts have been given a chance to run.
// If we don't do this, door markers that should be disabled will still appear on the map.
@@ -487,9 +488,9 @@ namespace MWGui
}
int counter = 0;
- for (std::vector::iterator it = markers.begin(); it != markers.end(); ++it)
+ for (const MWWorld::Ptr& ptr : markers)
{
- const ESM::Position& worldPos = it->getRefData().getPosition();
+ const ESM::Position& worldPos = ptr.getRefData().getPosition();
MarkerUserData markerPos (mLocalMapRender);
MyGUI::IntPoint widgetPos = getMarkerPosition(worldPos.pos[0], worldPos.pos[1], markerPos);
MyGUI::IntCoord widgetCoord(widgetPos.left - 4,
@@ -526,8 +527,8 @@ namespace MWGui
void LocalMapBase::updateDoorMarkers()
{
// clear all previous door markers
- for (std::vector::iterator it = mDoorMarkerWidgets.begin(); it != mDoorMarkerWidgets.end(); ++it)
- MyGUI::Gui::getInstance().destroyWidget(*it);
+ for (MyGUI::Widget* widget : mDoorMarkerWidgets)
+ MyGUI::Gui::getInstance().destroyWidget(widget);
mDoorMarkerWidgets.clear();
MWBase::World* world = MWBase::Environment::get().getWorld();
@@ -553,10 +554,8 @@ namespace MWGui
// Create a widget for each marker
int counter = 0;
- for (std::vector::iterator it = doors.begin(); it != doors.end(); ++it)
+ for (MWBase::World::DoorMarker& marker : doors)
{
- MWBase::World::DoorMarker marker = *it;
-
std::vector destNotes;
CustomMarkerCollection::RangeType markers = mCustomMarkers.getMarkers(marker.dest);
for (CustomMarkerCollection::ContainerType::const_iterator iter = markers.first; iter != markers.second; ++iter)
@@ -589,8 +588,8 @@ namespace MWGui
void LocalMapBase::updateMagicMarkers()
{
// clear all previous markers
- for (std::vector::iterator it = mMagicMarkerWidgets.begin(); it != mMagicMarkerWidgets.end(); ++it)
- MyGUI::Gui::getInstance().destroyWidget(*it);
+ for (MyGUI::Widget* widget : mMagicMarkerWidgets)
+ MyGUI::Gui::getInstance().destroyWidget(widget);
mMagicMarkerWidgets.clear();
addDetectionMarkers(MWBase::World::Detect_Creature);
@@ -839,22 +838,13 @@ namespace MWGui
void MapWindow::cellExplored(int x, int y)
{
- mQueuedToExplore.push_back(std::make_pair(x,y));
+ mGlobalMapRender->cleanupCameras();
+ mGlobalMapRender->exploreCell(x, y, mLocalMapRender->getMapTexture(x, y));
}
void MapWindow::onFrame(float dt)
{
LocalMapBase::onFrame(dt);
-
- mGlobalMapRender->cleanupCameras();
-
- for (std::vector::iterator it = mQueuedToExplore.begin(); it != mQueuedToExplore.end(); ++it)
- {
- mGlobalMapRender->exploreCell(it->first, it->second, mLocalMapRender->getMapTexture(it->first, it->second));
- }
-
- mQueuedToExplore.clear();
-
NoDrop::onFrame(dt);
}
@@ -888,11 +878,11 @@ namespace MWGui
{
LocalMapBase::updateCustomMarkers();
- for (std::map, MyGUI::Widget*>::iterator widgetIt = mGlobalMapMarkers.begin(); widgetIt != mGlobalMapMarkers.end(); ++widgetIt)
+ for (auto& widgetPair : mGlobalMapMarkers)
{
- int x = widgetIt->first.first;
- int y = widgetIt->first.second;
- MyGUI::Widget* markerWidget = widgetIt->second;
+ int x = widgetPair.first.first;
+ int y = widgetPair.first.second;
+ MyGUI::Widget* markerWidget = widgetPair.second;
setGlobalMapMarkerTooltip(markerWidget, x, y);
}
}
@@ -1017,8 +1007,8 @@ namespace MWGui
mGlobalMapRender->clear();
mChanged = true;
- for (std::map, MyGUI::Widget*>::iterator it = mGlobalMapMarkers.begin(); it != mGlobalMapMarkers.end(); ++it)
- MyGUI::Gui::getInstance().destroyWidget(it->second);
+ for (auto& widgetPair : mGlobalMapMarkers)
+ MyGUI::Gui::getInstance().destroyWidget(widgetPair.second);
mGlobalMapMarkers.clear();
}
@@ -1043,11 +1033,11 @@ namespace MWGui
mGlobalMapRender->read(map);
- for (std::set::iterator it = map.mMarkers.begin(); it != map.mMarkers.end(); ++it)
+ for (const ESM::GlobalMap::CellId& cellId : map.mMarkers)
{
- const ESM::Cell* cell = MWBase::Environment::get().getWorld()->getStore().get().search(it->first, it->second);
+ const ESM::Cell* cell = MWBase::Environment::get().getWorld()->getStore().get().search(cellId.first, cellId.second);
if (cell && !cell->mName.empty())
- addVisitedLocation(cell->mName, it->first, it->second);
+ addVisitedLocation(cell->mName, cellId.first, cellId.second);
}
}
}
@@ -1057,8 +1047,8 @@ namespace MWGui
NoDrop::setAlpha(alpha);
// can't allow showing map with partial transparency, as the fog of war will also go transparent
// and reveal parts of the map you shouldn't be able to see
- for (std::vector::iterator it = mMapWidgets.begin(); it != mMapWidgets.end(); ++it)
- (*it)->setVisible(alpha == 1);
+ for (MapEntry& entry : mMaps)
+ entry.mMapWidget->setVisible(alpha == 1);
}
void MapWindow::customMarkerCreated(MyGUI::Widget *marker)
diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp
index ed6e4874f..4104a7824 100644
--- a/apps/openmw/mwgui/mapwindow.hpp
+++ b/apps/openmw/mwgui/mapwindow.hpp
@@ -2,6 +2,7 @@
#define MWGUI_MAPWINDOW_H
#include
+#include
#include "windowpinnablebase.hpp"
@@ -125,12 +126,17 @@ namespace MWGui
// Stores markers that were placed by a player. May be shared between multiple map views.
CustomMarkerCollection& mCustomMarkers;
- std::vector mMapWidgets;
- std::vector mFogWidgets;
+ struct MapEntry
+ {
+ MapEntry(MyGUI::ImageBox* mapWidget, MyGUI::ImageBox* fogWidget)
+ : mMapWidget(mapWidget), mFogWidget(fogWidget) {}
- typedef std::vector > TextureVector;
- TextureVector mMapTextures;
- TextureVector mFogTextures;
+ MyGUI::ImageBox* mMapWidget;
+ MyGUI::ImageBox* mFogWidget;
+ std::shared_ptr mMapTexture;
+ std::shared_ptr mFogTexture;
+ };
+ std::vector mMaps;
// Keep track of created marker widgets, just to easily remove them later.
std::vector mDoorMarkerWidgets;
@@ -260,10 +266,6 @@ namespace MWGui
typedef std::pair CellId;
std::set mMarkers;
- // Cells that should be explored in the next frame (i.e. their map revealed on the global map)
- // We can't do this immediately, because the map update is not immediate either (see mNeedMapUpdate in scene.cpp)
- std::vector mQueuedToExplore;
-
MyGUI::Button* mEventBoxGlobal;
MyGUI::Button* mEventBoxLocal;
diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp
index 6c2d85dd9..d64ec9c37 100644
--- a/apps/openmw/mwgui/messagebox.cpp
+++ b/apps/openmw/mwgui/messagebox.cpp
@@ -28,10 +28,9 @@ namespace MWGui
MessageBoxManager::~MessageBoxManager ()
{
- std::vector::iterator it(mMessageBoxes.begin());
- for (; it != mMessageBoxes.end(); ++it)
+ for (MessageBox* messageBox : mMessageBoxes)
{
- delete *it;
+ delete messageBox;
}
}
@@ -50,12 +49,11 @@ namespace MWGui
mInterMessageBoxe = nullptr;
}
- std::vector::iterator it(mMessageBoxes.begin());
- for (; it != mMessageBoxes.end(); ++it)
+ for (MessageBox* messageBox : mMessageBoxes)
{
- if (*it == mStaticMessageBox)
+ if (messageBox == mStaticMessageBox)
mStaticMessageBox = nullptr;
- delete *it;
+ delete messageBox;
}
mMessageBoxes.clear();
@@ -81,9 +79,9 @@ namespace MWGui
it = mMessageBoxes.begin();
while(it != mMessageBoxes.end())
{
- (*it)->update(static_cast(height));
- height += (*it)->getHeight();
- ++it;
+ (*it)->update(static_cast(height));
+ height += (*it)->getHeight();
+ ++it;
}
if(mInterMessageBoxe != nullptr && mInterMessageBoxe->mMarkedToDelete) {
@@ -114,10 +112,10 @@ namespace MWGui
}
int height = 0;
- for(std::vector::iterator it = mMessageBoxes.begin(); it != mMessageBoxes.end(); ++it)
+ for (MessageBox* messageBox : mMessageBoxes)
{
- (*it)->update(height);
- height += (*it)->getHeight();
+ messageBox->update(height);
+ height += messageBox->getHeight();
}
}
@@ -240,14 +238,14 @@ namespace MWGui
int buttonHeight = 0;
MyGUI::IntCoord dummyCoord(0, 0, 0, 0);
- for(std::vector::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
+ for(const std::string& buttonId : buttons)
{
MyGUI::Button* button = mButtonsWidget->createWidget(
MyGUI::WidgetStyle::Child,
std::string("MW_Button"),
dummyCoord,
MyGUI::Align::Default);
- button->setCaptionWithReplacing(*it);
+ button->setCaptionWithReplacing(buttonId);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &InteractiveMessageBox::mousePressed);
@@ -300,16 +298,16 @@ namespace MWGui
MyGUI::IntSize buttonSize(0, buttonHeight);
int left = (mainWidgetSize.width - buttonsWidth)/2;
- for(std::vector::const_iterator button = mButtons.begin(); button != mButtons.end(); ++button)
+ for(MyGUI::Button* button : mButtons)
{
buttonCord.left = left;
buttonCord.top = messageWidgetCoord.top + textSize.height + textButtonPadding;
- buttonSize.width = (*button)->getTextSize().width + 2*buttonLabelLeftPadding;
- buttonSize.height = (*button)->getTextSize().height + 2*buttonLabelTopPadding;
+ buttonSize.width = button->getTextSize().width + 2*buttonLabelLeftPadding;
+ buttonSize.height = button->getTextSize().height + 2*buttonLabelTopPadding;
- (*button)->setCoord(buttonCord);
- (*button)->setSize(buttonSize);
+ button->setCoord(buttonCord);
+ button->setSize(buttonSize);
left += buttonSize.width + buttonLeftPadding;
}
@@ -329,16 +327,16 @@ namespace MWGui
int top = textPadding + textSize.height + textButtonPadding;
- for(std::vector::const_iterator button = mButtons.begin(); button != mButtons.end(); ++button)
+ for(MyGUI::Button* button : mButtons)
{
- buttonSize.width = (*button)->getTextSize().width + buttonLabelLeftPadding*2;
- buttonSize.height = (*button)->getTextSize().height + buttonLabelTopPadding*2;
+ buttonSize.width = button->getTextSize().width + buttonLabelLeftPadding*2;
+ buttonSize.height = button->getTextSize().height + buttonLabelTopPadding*2;
buttonCord.top = top;
buttonCord.left = (mainWidgetSize.width - buttonSize.width)/2;
- (*button)->setCoord(buttonCord);
- (*button)->setSize(buttonSize);
+ button->setCoord(buttonCord);
+ button->setSize(buttonSize);
top += buttonSize.height + buttonTopPadding;
}
@@ -368,13 +366,13 @@ namespace MWGui
MyGUI::Widget* InteractiveMessageBox::getDefaultKeyFocus()
{
std::vector keywords { "sOk", "sYes" };
- for(std::vector::const_iterator button = mButtons.begin(); button != mButtons.end(); ++button)
+ for(MyGUI::Button* button : mButtons)
{
for (const std::string& keyword : keywords)
{
- if(Misc::StringUtils::ciEqual(MyGUI::LanguageManager::getInstance().replaceTags("#{" + keyword + "}"), (*button)->getCaption()))
+ if(Misc::StringUtils::ciEqual(MyGUI::LanguageManager::getInstance().replaceTags("#{" + keyword + "}"), button->getCaption()))
{
- return *button;
+ return button;
}
}
}
@@ -390,10 +388,9 @@ namespace MWGui
{
mMarkedToDelete = true;
int index = 0;
- std::vector::const_iterator button;
- for(button = mButtons.begin(); button != mButtons.end(); ++button)
+ for(const MyGUI::Button* button : mButtons)
{
- if(*button == pressed)
+ if(button == pressed)
{
mButtonPressed = index;
mMessageBoxManager.onButtonPressed(mButtonPressed);
diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp
index 23ad87fd6..6ac1f2b63 100644
--- a/apps/openmw/mwgui/quickkeysmenu.cpp
+++ b/apps/openmw/mwgui/quickkeysmenu.cpp
@@ -540,32 +540,32 @@ namespace MWGui
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
int i=0;
- for (std::vector::const_iterator it = keys.mKeys.begin(); it != keys.mKeys.end(); ++it)
+ for (ESM::QuickKeys::QuickKey& quickKey : keys.mKeys)
{
if (i >= 10)
return;
mSelected = &mKey[i];
- switch (it->mType)
+ switch (quickKey.mType)
{
case Type_Magic:
- if (MWBase::Environment::get().getWorld()->getStore().get().search(it->mId))
- onAssignMagic(it->mId);
+ if (MWBase::Environment::get().getWorld()->getStore().get().search(quickKey.mId))
+ onAssignMagic(quickKey.mId);
break;
case Type_Item:
case Type_MagicItem:
{
// Find the item by id
- MWWorld::Ptr item = store.findReplacement(it->mId);
+ MWWorld::Ptr item = store.findReplacement(quickKey.mId);
if (item.isEmpty())
unassign(mSelected);
else
{
- if (it->mType == Type_Item)
+ if (quickKey.mType == Type_Item)
onAssignItem(item);
- else // if (it->mType == Type_MagicItem)
+ else // if (quickKey.mType == Type_MagicItem)
onAssignMagicItem(item);
}
diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp
index be0dff660..cf69ecca3 100644
--- a/apps/openmw/mwgui/race.cpp
+++ b/apps/openmw/mwgui/race.cpp
@@ -290,9 +290,8 @@ namespace MWGui
const MWWorld::Store &store =
MWBase::Environment::get().getWorld()->getStore().get();
- for (MWWorld::Store::iterator it = store.begin(); it != store.end(); ++it)
+ for (const ESM::BodyPart& bodypart : store)
{
- const ESM::BodyPart& bodypart = *it;
if (bodypart.mData.mFlags & ESM::BodyPart::BPF_NotPlayable)
continue;
if (bodypart.mData.mType != ESM::BodyPart::MT_Skin)
@@ -353,22 +352,21 @@ namespace MWGui
MWBase::Environment::get().getWorld()->getStore().get();
std::vector > items; // ID, name
- MWWorld::Store::iterator it = races.begin();
- for (; it != races.end(); ++it)
+ for (const ESM::Race& race : races)
{
- bool playable = it->mData.mFlags & ESM::Race::Playable;
+ bool playable = race.mData.mFlags & ESM::Race::Playable;
if (!playable) // Only display playable races
continue;
- items.push_back(std::make_pair(it->mId, it->mName));
+ items.push_back(std::make_pair(race.mId, race.mName));
}
std::sort(items.begin(), items.end(), sortRaces);
int index = 0;
- for (std::vector >::const_iterator iter = items.begin(); iter != items.end(); ++iter)
+ for (auto& item : items)
{
- mRaceList->addItem(iter->second, iter->first);
- if (Misc::StringUtils::ciEqual(iter->first, mCurrentRaceId))
+ mRaceList->addItem(item.second, item.first);
+ if (Misc::StringUtils::ciEqual(item.first, mCurrentRaceId))
mRaceList->setIndexSelected(index);
++index;
}
@@ -376,9 +374,9 @@ namespace MWGui
void RaceDialog::updateSkills()
{
- for (std::vector::iterator it = mSkillItems.begin(); it != mSkillItems.end(); ++it)
+ for (MyGUI::Widget* widget : mSkillItems)
{
- MyGUI::Gui::getInstance().destroyWidget(*it);
+ MyGUI::Gui::getInstance().destroyWidget(widget);
}
mSkillItems.clear();
@@ -413,9 +411,9 @@ namespace MWGui
void RaceDialog::updateSpellPowers()
{
- for (std::vector::iterator it = mSpellPowerItems.begin(); it != mSpellPowerItems.end(); ++it)
+ for (MyGUI::Widget* widget : mSpellPowerItems)
{
- MyGUI::Gui::getInstance().destroyWidget(*it);
+ MyGUI::Gui::getInstance().destroyWidget(widget);
}
mSpellPowerItems.clear();
@@ -428,11 +426,9 @@ namespace MWGui
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.get().find(mCurrentRaceId);
- std::vector::const_iterator it = race->mPowers.mList.begin();
- std::vector::const_iterator end = race->mPowers.mList.end();
- for (int i = 0; it != end; ++it)
+ int i = 0;
+ for (const std::string& spellpower : race->mPowers.mList)
{
- const std::string &spellpower = *it;
Widgets::MWSpellPtr spellPowerWidget = mSpellPowerList->createWidget("MW_StatName", coord, MyGUI::Align::Default, std::string("SpellPower") + MyGUI::utility::toString(i));
spellPowerWidget->setSpellId(spellpower);
spellPowerWidget->setUserString("ToolTipType", "Spell");
diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp
index c9e31d42d..0fa4fdec5 100644
--- a/apps/openmw/mwgui/race.hpp
+++ b/apps/openmw/mwgui/race.hpp
@@ -1,6 +1,8 @@
#ifndef MWGUI_RACE_H
#define MWGUI_RACE_H
+#include
+
#include "windowbase.hpp"
#include
diff --git a/apps/openmw/mwgui/recharge.cpp b/apps/openmw/mwgui/recharge.cpp
index 56bd97d5e..e42db715b 100644
--- a/apps/openmw/mwgui/recharge.cpp
+++ b/apps/openmw/mwgui/recharge.cpp
@@ -1,7 +1,5 @@
#include "recharge.hpp"
-#include
-
#include
#include
@@ -179,7 +177,8 @@ void Recharge::onItemClicked(MyGUI::Widget *sender, const MWWorld::Ptr& item)
if (gem.getRefData().getCount() == 0)
{
std::string message = MWBase::Environment::get().getWorld()->getStore().get().find("sNotifyMessage51")->mValue.getString();
- message = boost::str(boost::format(message) % gem.getClass().getName(gem));
+ Misc::StringUtils::replace(message, "%s", gem.getClass().getName(gem).c_str(), 2);
+
MWBase::Environment::get().getWindowManager()->messageBox(message);
// special case: readd Azura's Star
diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp
index f2f1cf892..e76cbe770 100644
--- a/apps/openmw/mwgui/review.cpp
+++ b/apps/openmw/mwgui/review.cpp
@@ -228,11 +228,9 @@ namespace MWGui
std::set skillSet;
std::copy(major.begin(), major.end(), std::inserter(skillSet, skillSet.begin()));
std::copy(minor.begin(), minor.end(), std::inserter(skillSet, skillSet.begin()));
- boost::array::const_iterator end = ESM::Skill::sSkillIds.end();
mMiscSkills.clear();
- for (boost::array::const_iterator it = ESM::Skill::sSkillIds.begin(); it != end; ++it)
+ for (const int skill : ESM::Skill::sSkillIds)
{
- int skill = *it;
if (skillSet.find(skill) == skillSet.end())
mMiscSkills.push_back(skill);
}
@@ -327,11 +325,9 @@ namespace MWGui
addGroup(MWBase::Environment::get().getWindowManager()->getGameSettingString(titleId, titleDefault), coord1, coord2);
- SkillList::const_iterator end = skills.end();
- for (SkillList::const_iterator it = skills.begin(); it != end; ++it)
+ for (const int& skillId : skills)
{
- int skillId = *it;
- if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
+ if (skillId < 0 || skillId >= ESM::Skill::Length) // Skip unknown skill indexes
continue;
assert(skillId >= 0 && skillId < ESM::Skill::Length);
const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
@@ -357,9 +353,9 @@ namespace MWGui
void ReviewDialog::updateSkillArea()
{
- for (std::vector::iterator it = mSkillWidgets.begin(); it != mSkillWidgets.end(); ++it)
+ for (MyGUI::Widget* skillWidget : mSkillWidgets)
{
- MyGUI::Gui::getInstance().destroyWidget(*it);
+ MyGUI::Gui::getInstance().destroyWidget(skillWidget);
}
mSkillWidgets.clear();
@@ -392,19 +388,18 @@ namespace MWGui
attributes[i] = mAttributeWidgets[i]->getAttributeValue().getBase();
std::vector selectedSpells = MWMechanics::autoCalcPlayerSpells(skills, attributes, race);
- for (std::vector::iterator iter = selectedSpells.begin(); iter != selectedSpells.end(); ++iter)
+ for (std::string& spellId : selectedSpells)
{
- std::string lower = Misc::StringUtils::lowerCase(*iter);
+ std::string lower = Misc::StringUtils::lowerCase(spellId);
if (std::find(spells.begin(), spells.end(), lower) == spells.end())
spells.push_back(lower);
}
if (race)
{
- for (std::vector::const_iterator iter = race->mPowers.mList.begin();
- iter != race->mPowers.mList.end(); ++iter)
+ for (const std::string& spellId : race->mPowers.mList)
{
- std::string lower = Misc::StringUtils::lowerCase(*iter);
+ std::string lower = Misc::StringUtils::lowerCase(spellId);
if (std::find(spells.begin(), spells.end(), lower) == spells.end())
spells.push_back(lower);
}
@@ -413,10 +408,9 @@ namespace MWGui
if (!mBirthSignId.empty())
{
const ESM::BirthSign* sign = MWBase::Environment::get().getWorld()->getStore().get().find(mBirthSignId);
- for (std::vector::const_iterator iter = sign->mPowers.mList.begin();
- iter != sign->mPowers.mList.end(); ++iter)
+ for (const std::string& spellId : sign->mPowers.mList)
{
- std::string lower = Misc::StringUtils::lowerCase(*iter);
+ std::string lower = Misc::StringUtils::lowerCase(spellId);
if (std::find(spells.begin(), spells.end(), lower) == spells.end())
spells.push_back(lower);
}
@@ -425,27 +419,27 @@ namespace MWGui
if (!mSkillWidgets.empty())
addSeparator(coord1, coord2);
addGroup(MWBase::Environment::get().getWindowManager()->getGameSettingString("sTypeAbility", "Abilities"), coord1, coord2);
- for (std::vector::const_iterator iter = spells.begin(); iter != spells.end(); ++iter)
+ for (std::string& spellId : spells)
{
- const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(*iter);
+ const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(spellId);
if (spell->mData.mType == ESM::Spell::ST_Ability)
addItem(spell, coord1, coord2);
}
addSeparator(coord1, coord2);
addGroup(MWBase::Environment::get().getWindowManager()->getGameSettingString("sTypePower", "Powers"), coord1, coord2);
- for (std::vector::const_iterator iter = spells.begin(); iter != spells.end(); ++iter)
+ for (std::string& spellId : spells)
{
- const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(*iter);
+ const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(spellId);
if (spell->mData.mType == ESM::Spell::ST_Power)
addItem(spell, coord1, coord2);
}
addSeparator(coord1, coord2);
addGroup(MWBase::Environment::get().getWindowManager()->getGameSettingString("sTypeSpell", "Spells"), coord1, coord2);
- for (std::vector::const_iterator iter = spells.begin(); iter != spells.end(); ++iter)
+ for (std::string& spellId : spells)
{
- const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(*iter);
+ const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(spellId);
if (spell->mData.mType == ESM::Spell::ST_Spell)
addItem(spell, coord1, coord2);
}
diff --git a/apps/openmw/mwgui/savegamedialog.hpp b/apps/openmw/mwgui/savegamedialog.hpp
index 0a87b6600..a9915ee9d 100644
--- a/apps/openmw/mwgui/savegamedialog.hpp
+++ b/apps/openmw/mwgui/savegamedialog.hpp
@@ -1,6 +1,8 @@
#ifndef OPENMW_MWGUI_SAVEGAMEDIALOG_H
#define OPENMW_MWGUI_SAVEGAMEDIALOG_H
+#include
+
#include "windowbase.hpp"
namespace MWState
diff --git a/apps/openmw/mwgui/screenfader.hpp b/apps/openmw/mwgui/screenfader.hpp
index 79bea30e5..aa17ed4e8 100644
--- a/apps/openmw/mwgui/screenfader.hpp
+++ b/apps/openmw/mwgui/screenfader.hpp
@@ -2,6 +2,7 @@
#define OPENMW_MWGUI_SCREENFADER_H
#include
+#include
#include "windowbase.hpp"
diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp
index 6e6924f28..deb1116d0 100644
--- a/apps/openmw/mwgui/settingswindow.cpp
+++ b/apps/openmw/mwgui/settingswindow.cpp
@@ -8,11 +8,12 @@
#include
#include
-#include
#include
#include
+#include
+#include
#include
#include
@@ -58,7 +59,7 @@ namespace
std::string getAspect (int x, int y)
{
- int gcd = boost::math::gcd (x, y);
+ int gcd = Misc::gcd (x, y);
int xaspect = x / gcd;
int yaspect = y / gcd;
// special case: 8 : 5 is usually referred to as 16:10
@@ -125,7 +126,8 @@ namespace MWGui
{
MyGUI::ScrollBar* scroll = current->castType();
std::string valueStr;
- if (getSettingValueType(current) == "Float")
+ std::string valueType = getSettingValueType(current);
+ if (valueType == "Float" || valueType == "Integer")
{
// TODO: ScrollBar isn't meant for this. should probably use a dedicated FloatSlider widget
float min,max;
@@ -159,7 +161,7 @@ namespace MWGui
MyGUI::TextBox* textBox;
getWidget(textBox, labelWidgetName);
std::string labelCaption = scroller->getUserString("SettingLabelCaption");
- boost::algorithm::replace_all(labelCaption, "%s", value);
+ Misc::StringUtils::replaceAll(labelCaption, "%s", value.c_str(), 2);
textBox->setCaptionWithReplacing(labelCaption);
}
}
@@ -184,6 +186,7 @@ namespace MWGui
getWidget(mKeyboardSwitch, "KeyboardButton");
getWidget(mControllerSwitch, "ControllerButton");
getWidget(mWaterTextureSize, "WaterTextureSize");
+ getWidget(mWaterReflectionDetail, "WaterReflectionDetail");
#ifndef WIN32
// hide gamma controls since it currently does not work under Linux
@@ -207,6 +210,7 @@ namespace MWGui
mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected);
mWaterTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWaterTextureSizeChanged);
+ mWaterReflectionDetail->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWaterReflectionDetailChanged);
mKeyboardSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onKeyboardSwitchClicked);
mControllerSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onControllerSwitchClicked);
@@ -226,11 +230,10 @@ namespace MWGui
resolutions.push_back(std::make_pair(mode.w, mode.h));
}
std::sort(resolutions.begin(), resolutions.end(), sortResolutions);
- for (std::vector < std::pair >::const_iterator it=resolutions.begin();
- it!=resolutions.end(); ++it)
+ for (std::pair& resolution : resolutions)
{
- std::string str = MyGUI::utility::toString(it->first) + " x " + MyGUI::utility::toString(it->second)
- + " (" + getAspect(it->first,it->second) + ")";
+ std::string str = MyGUI::utility::toString(resolution.first) + " x " + MyGUI::utility::toString(resolution.second)
+ + " (" + getAspect(resolution.first, resolution.second) + ")";
if (mResolutionList->findItemIndexWith(str) == MyGUI::ITEM_NONE)
mResolutionList->addItem(str);
@@ -240,7 +243,7 @@ namespace MWGui
std::string tmip = Settings::Manager::getString("texture mipmap", "General");
mTextureFilteringButton->setCaption(textureMipmappingToStr(tmip));
- int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water");
+ int waterTextureSize = Settings::Manager::getInt("rtt size", "Water");
if (waterTextureSize >= 512)
mWaterTextureSize->setIndexSelected(0);
if (waterTextureSize >= 1024)
@@ -248,6 +251,10 @@ namespace MWGui
if (waterTextureSize >= 2048)
mWaterTextureSize->setIndexSelected(2);
+ int waterReflectionDetail = Settings::Manager::getInt("reflection detail", "Water");
+ waterReflectionDetail = std::min(4, std::max(0, waterReflectionDetail));
+ mWaterReflectionDetail->setIndexSelected(waterReflectionDetail);
+
mWindowBorderButton->setEnabled(!Settings::Manager::getBool("fullscreen", "Video"));
mKeyboardSwitch->setStateSelected(true);
@@ -327,6 +334,13 @@ namespace MWGui
apply();
}
+ void SettingsWindow::onWaterReflectionDetailChanged(MyGUI::ComboBox* _sender, size_t pos)
+ {
+ unsigned int level = std::min((unsigned int)4, (unsigned int)pos);
+ Settings::Manager::setInt("reflection detail", "Water", level);
+ apply();
+ }
+
void SettingsWindow::onButtonToggled(MyGUI::Widget* _sender)
{
std::string on = MWBase::Environment::get().getWindowManager()->getGameSettingString("sOn", "On");
@@ -410,14 +424,18 @@ namespace MWGui
if (getSettingType(scroller) == "Slider")
{
std::string valueStr;
- if (getSettingValueType(scroller) == "Float")
+ std::string valueType = getSettingValueType(scroller);
+ if (valueType == "Float" || valueType == "Integer")
{
float value = pos / float(scroller->getScrollRange()-1);
float min,max;
getSettingMinMax(scroller, min, max);
value = min + (max-min) * value;
- Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value);
+ if (valueType == "Float")
+ Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value);
+ else
+ Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), (int)value);
valueStr = MyGUI::utility::toString(int(value));
}
else
@@ -475,17 +493,17 @@ namespace MWGui
else
actions = MWBase::Environment::get().getInputManager()->getActionControllerSorting();
- for (std::vector::const_iterator it = actions.begin(); it != actions.end(); ++it)
+ for (const int& action : actions)
{
- std::string desc = MWBase::Environment::get().getInputManager()->getActionDescription (*it);
+ std::string desc = MWBase::Environment::get().getInputManager()->getActionDescription (action);
if (desc == "")
continue;
std::string binding;
if(mKeyboardMode)
- binding = MWBase::Environment::get().getInputManager()->getActionKeyBindingName(*it);
+ binding = MWBase::Environment::get().getInputManager()->getActionKeyBindingName(action);
else
- binding = MWBase::Environment::get().getInputManager()->getActionControllerBindingName(*it);
+ binding = MWBase::Environment::get().getInputManager()->getActionControllerBindingName(action);
Gui::SharedStateButton* leftText = mControlsBox->createWidget