forked from teamnwah/openmw-tes3coop
[Fix] Some PVS-Studio and cppcheck fixes
This commit is contained in:
parent
d4d1703bcf
commit
d310d36ea3
10 changed files with 27 additions and 24 deletions
|
@ -22,8 +22,6 @@ CSMPrefs::BoolSetting& CSMPrefs::BoolSetting::setTooltip (const std::string& too
|
|||
|
||||
std::pair<QWidget *, QWidget *> CSMPrefs::BoolSetting::makeWidgets (QWidget *parent)
|
||||
{
|
||||
if (mWidget != nullptr)
|
||||
delete mWidget;
|
||||
mWidget = new QCheckBox (QString::fromUtf8 (getLabel().c_str()), parent);
|
||||
mWidget->setCheckState (mDefault ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
|||
bool isDeleted = false;
|
||||
|
||||
// hack to initialise mindex
|
||||
while (!(mref.mRefNum.mIndex == 0) && ESM::Cell::getNextRef(reader, ref, isDeleted, true, &mref))
|
||||
while (!(mref.mRefNum.mIndex = 0) && ESM::Cell::getNextRef(reader, ref, isDeleted, true, &mref))
|
||||
{
|
||||
// Keep mOriginalCell empty when in modified (as an indicator that the
|
||||
// original cell will always be equal the current cell).
|
||||
|
|
|
@ -1373,7 +1373,7 @@ QVariant CSMWorld::CreatureAttackRefIdAdapter::getNestedData (const RefIdColumn
|
|||
|
||||
if (subColIndex == 0)
|
||||
return subRowIndex + 1;
|
||||
else // 1 or 2
|
||||
else if (subColIndex < 3) // 1 or 2
|
||||
return creature.mData.mAttack[(subRowIndex * 2) + (subColIndex - 1)];
|
||||
}
|
||||
|
||||
|
|
|
@ -558,7 +558,7 @@ namespace
|
|||
if (mAllQuests)
|
||||
{
|
||||
SetNamesInactive setInactive(list);
|
||||
mModel->visitQuestNames(false, setInactive);
|
||||
mModel->visitQuestNames(!mAllQuests, setInactive);
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page");
|
||||
|
|
|
@ -532,11 +532,12 @@ namespace MWGui
|
|||
assignWidget(mBarTextWidget, "BarText");
|
||||
}
|
||||
|
||||
MWScrollBar::MWScrollBar() : mIsIncreasing(true)
|
||||
MWScrollBar::MWScrollBar()
|
||||
: mEnableRepeat(true)
|
||||
, mRepeatTriggerTime(0.5f)
|
||||
, mRepeatStepTime(0.1f)
|
||||
, mIsIncreasing(true)
|
||||
{
|
||||
mEnableRepeat = true;
|
||||
mRepeatTriggerTime = 0.5f;
|
||||
mRepeatStepTime = 0.1f;
|
||||
#if MYGUI_VERSION >= MYGUI_DEFINE_VERSION(3,2,2)
|
||||
ScrollBar::setRepeatEnabled(false);
|
||||
#endif
|
||||
|
|
|
@ -315,6 +315,9 @@ namespace MWGui
|
|||
virtual void initialiseOverride();
|
||||
void repeatClick(MyGUI::Widget* _widget, MyGUI::ControllerItem* _controller);
|
||||
|
||||
bool mEnableRepeat;
|
||||
float mRepeatTriggerTime;
|
||||
float mRepeatStepTime;
|
||||
bool mIsIncreasing;
|
||||
|
||||
private:
|
||||
|
|
|
@ -314,14 +314,17 @@ namespace MWMechanics
|
|||
{
|
||||
const ESM::Pathgrid::Point oldStart(*getPath().begin());
|
||||
buildPath(startPoint, endPoint, cell, pathgridGraph);
|
||||
// if 2nd waypoint of new path == 1st waypoint of old,
|
||||
// delete 1st waypoint of new path.
|
||||
std::list<ESM::Pathgrid::Point>::iterator iter = ++mPath.begin();
|
||||
if (iter->mX == oldStart.mX
|
||||
&& iter->mY == oldStart.mY
|
||||
&& iter->mZ == oldStart.mZ)
|
||||
if (mPath.size() >= 2)
|
||||
{
|
||||
mPath.pop_front();
|
||||
// if 2nd waypoint of new path == 1st waypoint of old,
|
||||
// delete 1st waypoint of new path.
|
||||
std::list<ESM::Pathgrid::Point>::iterator iter = ++mPath.begin();
|
||||
if (iter->mX == oldStart.mX
|
||||
&& iter->mY == oldStart.mY
|
||||
&& iter->mZ == oldStart.mZ)
|
||||
{
|
||||
mPath.pop_front();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
MWState::QuickSaveManager::QuickSaveManager(std::string &saveName, unsigned int maxSaves)
|
||||
: mSaveName(saveName)
|
||||
, mMaxSaves(maxSaves)
|
||||
, mOldestSlotVisited(NULL)
|
||||
, mSlotsVisited(0)
|
||||
{
|
||||
this->mMaxSaves = maxSaves;
|
||||
this->mOldestSlotVisited = NULL;
|
||||
this->mSlotsVisited = 0;
|
||||
}
|
||||
|
||||
void MWState::QuickSaveManager::visitSave(const Slot *saveSlot)
|
||||
|
|
|
@ -677,7 +677,6 @@ namespace MWWorld
|
|||
if (mCell->mData.mFlags & ESM::Cell::Interior && mCell->mData.mFlags & ESM::Cell::HasWater)
|
||||
mWaterLevel = state.mWaterLevel;
|
||||
|
||||
mWaterLevel = state.mWaterLevel;
|
||||
mLastRespawn = MWWorld::TimeStamp(state.mLastRespawn);
|
||||
}
|
||||
|
||||
|
@ -685,10 +684,9 @@ namespace MWWorld
|
|||
{
|
||||
state.mId = mCell->getCellId();
|
||||
|
||||
// if (mCell->mData.mFlags & ESM::Cell::Interior && mCell->mData.mFlags & ESM::Cell::HasWater)
|
||||
// state.mWaterLevel = mWaterLevel;
|
||||
if (mCell->mData.mFlags & ESM::Cell::Interior && mCell->mData.mFlags & ESM::Cell::HasWater)
|
||||
state.mWaterLevel = mWaterLevel;
|
||||
|
||||
state.mWaterLevel = mWaterLevel;
|
||||
state.mHasFogOfWar = (mFogState.get() ? 1 : 0);
|
||||
state.mLastRespawn = mLastRespawn.toEsm();
|
||||
}
|
||||
|
|
|
@ -448,7 +448,7 @@ namespace Gui
|
|||
MyGUI::FontCodeType::Enum type;
|
||||
if(i == 0)
|
||||
type = MyGUI::FontCodeType::Selected;
|
||||
else
|
||||
else // if (i == 1)
|
||||
type = MyGUI::FontCodeType::SelectedBack;
|
||||
|
||||
MyGUI::xml::ElementPtr cursorCode = codes->createChild("Code");
|
||||
|
|
Loading…
Reference in a new issue