From 6a3ff5ed81dadd8057f59c8fd9e502a537421d6a Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 16 May 2018 10:10:42 +0400 Subject: [PATCH 1/5] Fix compiler warning in getNestedData --- apps/opencs/model/world/refidadapterimp.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp index ba67b4e14..46d1e5748 100644 --- a/apps/opencs/model/world/refidadapterimp.cpp +++ b/apps/opencs/model/world/refidadapterimp.cpp @@ -1368,13 +1368,15 @@ QVariant CSMWorld::CreatureAttackRefIdAdapter::getNestedData (const RefIdColumn const ESM::Creature& creature = record.get(); - if (subRowIndex < 0 || subRowIndex > 2 || subColIndex < 0 || subColIndex > 2) + if (subRowIndex < 0 || subRowIndex > 2) throw std::runtime_error ("index out of range"); if (subColIndex == 0) return subRowIndex + 1; - else if (subColIndex < 3) // 1 or 2 + else if (subColIndex == 1 || subColIndex == 2) return creature.mData.mAttack[(subRowIndex * 2) + (subColIndex - 1)]; + else + throw std::runtime_error ("index out of range"); } void CSMWorld::CreatureAttackRefIdAdapter::setNestedData (const RefIdColumn *column, From 164e3d12feb079f1d043aea51a7075a013c0834f Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 16 May 2018 11:18:22 +0400 Subject: [PATCH 2/5] Display weapon reach on tooltips in feet. --- apps/openmw/mwclass/weapon.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 9fb4a9767..e59567aac 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -325,7 +325,10 @@ namespace MWClass // add reach and attack speed for melee weapon if (ref->mBase->mData.mType < 9 && Settings::Manager::getBool("show melee info", "Game")) { - text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mReach, "#{sRange}"); + // 64 game units = 1 yard = 3 ft, display value in feet + const float combatDistance = store.get().find("fCombatDistance")->getFloat() * ref->mBase->mData.mReach; + text += MWGui::ToolTips::getWeightString(combatDistance*3/64, "#{sRange}"); + text += " #{sFeet}"; text += MWGui::ToolTips::getPercentString(ref->mBase->mData.mSpeed, "#{sAttributeSpeed}"); } From df459199dd2bfedbc6580d009b3e85c13e85509e Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 16 May 2018 12:59:05 +0400 Subject: [PATCH 3/5] Avoid left shift of negative value --- apps/openmw/mwrender/globalmap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp index 24f6de6ce..af2bb101a 100644 --- a/apps/openmw/mwrender/globalmap.cpp +++ b/apps/openmw/mwrender/globalmap.cpp @@ -125,7 +125,7 @@ namespace MWRender { for (int cellX=0; cellX(float(cellX)/float(mCellSize) * 9); + int vertexX = static_cast(float(cellX) / float(mCellSize) * 9); int vertexY = static_cast(float(cellY) / float(mCellSize) * 9); int texelX = (x-mMinX) * mCellSize + cellX; @@ -135,9 +135,9 @@ namespace MWRender float y2 = 0; if (land && (land->mDataTypes & ESM::Land::DATA_WNAM)) - y2 = (land->mWnam[vertexY * 9 + vertexX] << 4) / 2048.f; + y2 = land->mWnam[vertexY * 9 + vertexX] / 128.f; else - y2 = (SCHAR_MIN << 4) / 2048.f; + y2 = SCHAR_MIN / 128.f; if (y2 < 0) { r = static_cast(14 * y2 + 38); From e5db5e2651c9843843524aba28c5a8450b2d1b54 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 16 May 2018 16:13:22 +0400 Subject: [PATCH 4/5] Fix 'maybe-uninitialized' warning in openal_output --- apps/openmw/mwsound/openal_output.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index 829c001e5..a8a541704 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -951,10 +951,11 @@ std::pair OpenAL_Output::loadSound(const std::string &fname getALError(); std::vector data; - ALenum format; + ALenum format = AL_NONE; int srate; - try { + try + { DecoderPtr decoder = mManager.getDecoder(); // Workaround: Bethesda at some point converted some of the files to mp3, but the references were kept as .wav. if(decoder->mResourceMgr->exists(fname)) @@ -974,7 +975,8 @@ std::pair OpenAL_Output::loadSound(const std::string &fname format = getALFormat(chans, type); if(format) decoder->readAll(data); } - catch(std::exception &e) { + catch(std::exception &e) + { std::cerr<< "Failed to load audio from "< Date: Wed, 16 May 2018 16:34:58 +0400 Subject: [PATCH 5/5] Initialize srate variable in openal_output --- apps/openmw/mwsound/openal_output.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index a8a541704..31d46ce31 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -952,7 +952,7 @@ std::pair OpenAL_Output::loadSound(const std::string &fname std::vector data; ALenum format = AL_NONE; - int srate; + int srate = 0; try {