1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

Merge pull request #3071 from akortunov/master

Fix an another batch of MSVC complaints
This commit is contained in:
Bret Curtis 2021-04-20 07:31:56 +02:00 committed by GitHub
commit c6c92b5712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 29 additions and 27 deletions

View file

@ -608,7 +608,6 @@ if (WIN32)
5204 # Class has virtual functions, but its trivial destructor is not virtual
# caused by MyGUI
4275 # non dll-interface class 'std::exception' used as base for dll-interface class 'MyGUI::Exception'
4297 # function assumed not to throw an exception but does
# OpenMW specific warnings
@ -644,6 +643,12 @@ if (WIN32)
)
endif()
if( "${MyGUI_VERSION}" VERSION_LESS_EQUAL "3.4.1" )
set(WARNINGS_DISABLE ${WARNINGS_DISABLE}
4275 # non dll-interface class 'MyGUI::delegates::IDelegateUnlink' used as base for dll-interface class 'MyGUI::Widget'
)
endif()
foreach(d ${WARNINGS_DISABLE})
set(WARNINGS "${WARNINGS} /wd${d}")
endforeach(d)

View file

@ -151,7 +151,7 @@ void CSVRender::CellArrow::buildShape()
osg::Vec4Array *colours = new osg::Vec4Array;
for (int i=0; i<6; ++i)
colours->push_back (osg::Vec4f (0.11, 0.6f, 0.95f, 1.0f));
colours->push_back (osg::Vec4f (0.11f, 0.6f, 0.95f, 1.0f));
for (int i=0; i<6; ++i)
colours->push_back (osg::Vec4f (0.08f, 0.44f, 0.7f, 1.0f));

View file

@ -606,7 +606,7 @@ void CSVRender::TerrainTextureMode::createTexture(std::string textureFileName)
newId = CSMWorld::LandTexture::createUniqueRecordId(0, counter);
if (ltexTable.getRecord(newId).isDeleted() == 0) counter = (counter + 1) % maxCounter;
}
catch (const std::exception& e)
catch (const std::exception&)
{
newId = CSMWorld::LandTexture::createUniqueRecordId(0, counter);
freeIndexFound = true;

View file

@ -17,7 +17,7 @@ namespace MWDialogue
std::vector<Token> parseHyperText(const std::string & text)
{
std::vector<Token> result;
size_t pos_end, iteration_pos = 0;
size_t pos_end = std::string::npos, iteration_pos = 0;
for(;;)
{
size_t pos_begin = text.find('@', iteration_pos);

View file

@ -148,7 +148,7 @@ namespace MWGui
// We need this copy for when @# hyperlinks are replaced
std::string text = mText;
size_t pos_end;
size_t pos_end = std::string::npos;
for(;;)
{
size_t pos_begin = text.find('@');

View file

@ -129,7 +129,7 @@ struct JournalViewModelImpl : JournalViewModel
utf8text.replace(pos_begin, pos_end+1-pos_begin, displayName);
intptr_t value;
intptr_t value = 0;
if (mModel->mKeywordSearch.containsKeyword(topicName, value))
mHyperLinks[std::make_pair(pos_begin, pos_begin+displayName.size())] = value;
}

View file

@ -93,7 +93,7 @@ namespace MWGui
int windowHeight = window->getSize().height;
//initial values defined in openmw_stats_window.layout, if custom options are not present in .layout, a default is loaded
float leftPaneRatio = 0.44;
float leftPaneRatio = 0.44f;
if (mLeftPane->isUserString("LeftPaneRatio"))
leftPaneRatio = MyGUI::utility::parseFloat(mLeftPane->getUserString("LeftPaneRatio"));

View file

@ -23,7 +23,7 @@ bool MWMechanics::AiBreathe::execute (const MWWorld::Ptr& actor, CharacterContro
actorClass.getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, true);
actorClass.getMovementSettings(actor).mPosition[1] = 1;
smoothTurn(actor, -osg::PI / 2, 0);
smoothTurn(actor, static_cast<float>(-osg::PI_2), 0);
return false;
}

View file

@ -531,7 +531,7 @@ namespace MWMechanics
// Otherwise apply a random side step (kind of dodging) with some probability
// if actor is within range of target's weapon.
if (std::abs(angleToTarget) > osg::PI / 4)
moveDuration = 0.2;
moveDuration = 0.2f;
else if (distToTarget <= rangeAttackOfTarget && Misc::Rng::rollClosedProbability() < 0.25)
moveDuration = 0.1f + 0.1f * Misc::Rng::rollClosedProbability();
if (moveDuration > 0)

View file

@ -17,10 +17,10 @@ namespace MWPhysics
// Arbitrary number. To prevent infinite loops. They shouldn't happen but it's good to be prepared.
static constexpr int sMaxIterations = 8;
// Allows for more precise movement solving without getting stuck or snagging too easily.
static constexpr float sCollisionMargin = 0.1;
static constexpr float sCollisionMargin = 0.1f;
// Allow for a small amount of penetration to prevent numerical precision issues from causing the "unstuck"ing code to run unnecessarily
// Currently set to 0 because having the "unstuck"ing code run whenever possible prevents some glitchy snagging issues
static constexpr float sAllowedPenetration = 0.0;
static constexpr float sAllowedPenetration = 0.0f;
}
#endif

View file

@ -60,7 +60,7 @@ namespace MWPhysics
// attempt 3: further, less tall fixed distance movement, same as above
// If you're making a full conversion you should purge the logic for attempts 2 and 3. Attempts 2 and 3 just try to work around problems with vanilla Morrowind assets.
int attempt = 0;
float downStepSize;
float downStepSize = 0;
while(attempt < 3)
{
attempt++;

View file

@ -433,7 +433,7 @@ namespace MWRender
void Camera::setPitch(float angle)
{
const float epsilon = 0.000001f;
float limit = osg::PI_2 - epsilon;
float limit = static_cast<float>(osg::PI_2) - epsilon;
mPitch = osg::clampBetween(angle, -limit, limit);
}

View file

@ -402,7 +402,7 @@ namespace MWRender
refs[ref.mRefNum] = ref;
}
}
catch (std::exception& e)
catch (std::exception&)
{
continue;
}

View file

@ -860,8 +860,7 @@ namespace MWRender
{
RenderingManager::RayResult result;
result.mHit = false;
result.mHitRefnum.mContentFile = -1;
result.mHitRefnum.mIndex = -1;
result.mHitRefnum.unset();
result.mRatio = 0;
if (intersector->containsIntersections())
{

View file

@ -84,7 +84,7 @@ namespace MWWorld
mTerrain->cacheCell(mTerrainView.get(), mX, mY);
mPreloadedObjects.insert(mLandManager->getLand(mX, mY));
}
catch(std::exception& e)
catch(std::exception&)
{
}
}
@ -127,7 +127,7 @@ namespace MWWorld
mPreloadedObjects.insert(mBulletShapeManager->getShape(mesh));
}
catch (std::exception& e)
catch (std::exception&)
{
// ignore error for now, would spam the log too much
// error will be shown when visiting the cell

View file

@ -965,7 +965,7 @@ namespace MWWorld
{
mSceneManager->getTemplate(mMesh);
}
catch (std::exception& e)
catch (std::exception&)
{
}
}
@ -1049,7 +1049,7 @@ namespace MWWorld
exteriorPositions.emplace_back(pos, gridCenterToBounds(getNewGridCenter(pos)));
}
}
catch (std::exception& e)
catch (std::exception&)
{
// ignore error for now, would spam the log too much
}

View file

@ -3895,7 +3895,7 @@ namespace MWWorld
if (!model.empty())
scene->preload(model, ref.getPtr().getClass().useAnim());
}
catch(std::exception& e)
catch(std::exception&)
{
}
}

View file

@ -178,8 +178,6 @@ namespace Crash
sInstance->handleVectoredException(info);
_Exit(1);
return EXCEPTION_CONTINUE_SEARCH;
}
void CrashCatcher::handleVectoredException(PEXCEPTION_POINTERS info)

View file

@ -238,7 +238,7 @@ namespace NifOsg
std::string mFilename;
unsigned int mVersion, mUserVersion, mBethVersion;
size_t mFirstRootTextureIndex = -1;
size_t mFirstRootTextureIndex{~0u};
bool mFoundFirstRootTexturingProperty = false;
bool mHasNightDayLabel = false;

View file

@ -77,7 +77,7 @@ namespace Resource
mTarget.mTextKeys.emplace(parseTimeSignature(line), parseTextKey(line));
}
}
catch (std::exception& e)
catch (std::exception&)
{
Log(Debug::Warning) << "No textkey file found for " << mNormalized;
}

View file

@ -132,7 +132,7 @@ namespace SceneUtil
if (value[0] < 0)
{
positiveColor *= -1.0;
signBit = -1;
signBit = ~0u;
}
unsigned int packedColor = asRGBA(positiveColor);
std::memcpy(&(*mData)[getOffset(index, Diffuse)], &packedColor, sizeof(unsigned int));

View file

@ -142,7 +142,7 @@ namespace SceneUtil
osg::Vec3f dir = toPos - fromPos;
dir.normalize();
osg::Quat rot = osg::Quat(-osg::PI / 2, osg::Vec3(0, 0, 1));
osg::Quat rot(static_cast<float>(-osg::PI_2), osg::Vec3f(0, 0, 1));
dir = rot * dir;
unsigned short diamondIndex = 0;