Attempt to fix Clang warnings

deque
scrawl 10 years ago
parent 58571f7ac2
commit e9ed0211c9

@ -322,7 +322,8 @@ namespace MWGui
if (i == pos) if (i == pos)
mCurrentSlot = &*it; mCurrentSlot = &*it;
} }
assert(mCurrentSlot && "Can't find selected slot"); if (!mCurrentSlot)
throw std::runtime_error("Can't find selected slot");
std::stringstream text; std::stringstream text;
time_t time = mCurrentSlot->mTimeStamp; time_t time = mCurrentSlot->mTimeStamp;

@ -76,6 +76,8 @@ void WindowModal::close()
NoDrop::NoDrop(DragAndDrop *drag, MyGUI::Widget *widget) NoDrop::NoDrop(DragAndDrop *drag, MyGUI::Widget *widget)
: mDrag(drag), mWidget(widget), mTransparent(false) : mDrag(drag), mWidget(widget), mTransparent(false)
{ {
if (!mWidget)
throw std::runtime_error("NoDrop needs a non-NULL widget!");
} }
void NoDrop::onFrame(float dt) void NoDrop::onFrame(float dt)

@ -92,7 +92,11 @@ namespace MWMechanics
if(distanceBetweenResult <= mMaxDist * mMaxDist) if(distanceBetweenResult <= mMaxDist * mMaxDist)
{ {
if(pathTo(actor,ESM::Pathgrid::Point(mX,mY,mZ),duration)) //Returns true on path complete ESM::Pathgrid::Point point(mX,mY,mZ);
point.mAutogenerated = 0;
point.mConnectionNum = 0;
point.mUnknown = 0;
if(pathTo(actor,point,duration)) //Returns true on path complete
return true; return true;
mMaxDist = 450; mMaxDist = 450;
} }

@ -220,7 +220,7 @@ namespace MWMechanics
if (spell->mData.mFlags & ESM::Spell::F_Always) if (spell->mData.mFlags & ESM::Spell::F_Always)
return 100.f; return 100.f;
float skillTerm; float skillTerm = 0;
if (effectiveSchool != -1) if (effectiveSchool != -1)
skillTerm = 2.f * actorSkills[mapSchoolToSkill(effectiveSchool)]; skillTerm = 2.f * actorSkills[mapSchoolToSkill(effectiveSchool)];
else else

@ -1611,7 +1611,7 @@ void CharacterController::update(float duration)
if(mMovementAnimationControlled && mPtr.getClass().isActor()) if(mMovementAnimationControlled && mPtr.getClass().isActor())
world->queueMovement(mPtr, moved); world->queueMovement(mPtr, moved);
} }
else if (mAnimation) else
mAnimation->updateEffects(duration); mAnimation->updateEffects(duration);
mSkipAnim = false; mSkipAnim = false;

@ -385,7 +385,6 @@ namespace MWWorld
if(tracer.mFraction >= 1.0f) if(tracer.mFraction >= 1.0f)
{ {
newPosition = tracer.mEndPos; // ok to move, so set newPosition newPosition = tracer.mEndPos; // ok to move, so set newPosition
remainingTime *= (1.0f-tracer.mFraction); // FIXME: remainingTime is no longer used so don't set it?
break; break;
} }
else else
@ -406,7 +405,6 @@ namespace MWWorld
// precision can be lost due to any math Bullet does internally). Since we // precision can be lost due to any math Bullet does internally). Since we
// aren't performing any collision detection, we want to reject the next // aren't performing any collision detection, we want to reject the next
// position, so that we don't slowly move inside another object. // position, so that we don't slowly move inside another object.
remainingTime *= (1.0f-tracer.mFraction); // FIXME: remainingTime is no longer used so don't set it?
break; break;
} }

@ -498,7 +498,8 @@ void WeatherManager::update(float duration)
else if (sound == 1) soundName = &mThunderSoundID1; else if (sound == 1) soundName = &mThunderSoundID1;
else if (sound == 2) soundName = &mThunderSoundID2; else if (sound == 2) soundName = &mThunderSoundID2;
else if (sound == 3) soundName = &mThunderSoundID3; else if (sound == 3) soundName = &mThunderSoundID3;
MWBase::Environment::get().getSoundManager()->playSound(*soundName, 1.0, 1.0); if (soundName)
MWBase::Environment::get().getSoundManager()->playSound(*soundName, 1.0, 1.0);
mThunderSoundDelay = 1000; mThunderSoundDelay = 1000;
} }

@ -1045,7 +1045,7 @@ namespace MWWorld
CellStore *currCell = ptr.isInCell() ? ptr.getCell() : NULL; // currCell == NULL should only happen for player, during initial startup CellStore *currCell = ptr.isInCell() ? ptr.getCell() : NULL; // currCell == NULL should only happen for player, during initial startup
bool isPlayer = ptr == mPlayer->getPlayer(); bool isPlayer = ptr == mPlayer->getPlayer();
bool haveToMove = isPlayer || mWorldScene->isCellActive(*currCell); bool haveToMove = isPlayer || (currCell && mWorldScene->isCellActive(*currCell));
if (currCell != newCell) if (currCell != newCell)
{ {

@ -147,8 +147,8 @@ namespace ESMTerrain
Ogre::Vector3 normal; Ogre::Vector3 normal;
Ogre::ColourValue color; Ogre::ColourValue color;
float vertY; float vertY = 0;
float vertX; float vertX = 0;
float vertY_ = 0; // of current cell corner float vertY_ = 0; // of current cell corner
for (int cellY = startY; cellY < startY + std::ceil(size); ++cellY) for (int cellY = startY; cellY < startY + std::ceil(size); ++cellY)

@ -197,8 +197,17 @@ namespace Gui
MyGUI::IntCoord widgetCoord; MyGUI::IntCoord widgetCoord;
widgetCoord.left = curX; widgetCoord.left = curX;
widgetCoord.top = mPadding + (getSize().height-mPadding*2 - height) / 2; widgetCoord.top = mPadding + (getSize().height-mPadding*2 - height) / 2;
int width = sizes[i].second ? sizes[i].first.width + (getSize().width-mPadding*2 - total_width)/h_stretched_count
: sizes[i].first.width; int width = 0;
if (sizes[i].second)
{
if (h_stretched_count == 0)
throw std::logic_error("unexpected");
width = sizes[i].first.width + (getSize().width-mPadding*2 - total_width)/h_stretched_count;
}
else
width = sizes[i].first.width;
widgetCoord.width = width; widgetCoord.width = width;
widgetCoord.height = height; widgetCoord.height = height;
w->setCoord(widgetCoord); w->setCoord(widgetCoord);
@ -334,8 +343,17 @@ namespace Gui
MyGUI::IntCoord widgetCoord; MyGUI::IntCoord widgetCoord;
widgetCoord.top = curY; widgetCoord.top = curY;
widgetCoord.left = mPadding + (getSize().width-mPadding*2 - width) / 2; widgetCoord.left = mPadding + (getSize().width-mPadding*2 - width) / 2;
int height = sizes[i].second ? sizes[i].first.height + (getSize().height-mPadding*2 - total_height)/v_stretched_count
: sizes[i].first.height; int height = 0;
if (sizes[i].second)
{
if (v_stretched_count == 0)
throw std::logic_error("unexpected");
height = sizes[i].first.height + (getSize().height-mPadding*2 - total_height)/v_stretched_count;
}
else
height = sizes[i].first.height;
widgetCoord.height = height; widgetCoord.height = height;
widgetCoord.width = width; widgetCoord.width = width;
w->setCoord(widgetCoord); w->setCoord(widgetCoord);

Loading…
Cancel
Save