mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-22 11:23:27 -04:00
Merge pull request #2596 from akortunov/coverity
Fix some issues, found by CoverityScan
This commit is contained in:
commit
1c810b06fb
@ -712,7 +712,7 @@ std::string creatureFlags(int flags)
|
|||||||
if (flags & ESM::Creature::Respawn) properties += "Respawn ";
|
if (flags & ESM::Creature::Respawn) properties += "Respawn ";
|
||||||
if (flags & ESM::Creature::Weapon) properties += "Weapon ";
|
if (flags & ESM::Creature::Weapon) properties += "Weapon ";
|
||||||
if (flags & ESM::Creature::Essential) properties += "Essential ";
|
if (flags & ESM::Creature::Essential) properties += "Essential ";
|
||||||
int unused = (0xFF ^
|
int unused = (0xFFFFFFFF ^
|
||||||
(ESM::Creature::Base|
|
(ESM::Creature::Base|
|
||||||
ESM::Creature::Walks|
|
ESM::Creature::Walks|
|
||||||
ESM::Creature::Swims|
|
ESM::Creature::Swims|
|
||||||
|
@ -1227,7 +1227,7 @@ void CSVRender::TerrainShapeMode::createNewLandData(const CSMWorld::CellCoordina
|
|||||||
|
|
||||||
++averageDivider;
|
++averageDivider;
|
||||||
downCellSampleHeight = landDownShapePointer[ESM::Land::LAND_SIZE / 2];
|
downCellSampleHeight = landDownShapePointer[ESM::Land::LAND_SIZE / 2];
|
||||||
if(paged->getCellAlteredHeight(cellLeftCoords, ESM::Land::LAND_SIZE / 2, 0))
|
if(paged->getCellAlteredHeight(cellDownCoords, ESM::Land::LAND_SIZE / 2, 0))
|
||||||
downCellSampleHeight += *paged->getCellAlteredHeight(cellDownCoords, ESM::Land::LAND_SIZE / 2, 0);
|
downCellSampleHeight += *paged->getCellAlteredHeight(cellDownCoords, ESM::Land::LAND_SIZE / 2, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -730,8 +730,12 @@ void CSVRender::TerrainTextureMode::setBrushShape(int brushShape)
|
|||||||
selectionCenterY += value.second;
|
selectionCenterY += value.second;
|
||||||
++selectionAmount;
|
++selectionAmount;
|
||||||
}
|
}
|
||||||
selectionCenterX /= selectionAmount;
|
|
||||||
selectionCenterY /= selectionAmount;
|
if (selectionAmount != 0)
|
||||||
|
{
|
||||||
|
selectionCenterX /= selectionAmount;
|
||||||
|
selectionCenterY /= selectionAmount;
|
||||||
|
}
|
||||||
|
|
||||||
mCustomBrushShape.clear();
|
mCustomBrushShape.clear();
|
||||||
for (auto const& value: terrainSelection)
|
for (auto const& value: terrainSelection)
|
||||||
|
@ -149,7 +149,7 @@ float BookWindowBase::adjustButton (char const * name)
|
|||||||
Gui::ImageButton* button;
|
Gui::ImageButton* button;
|
||||||
WindowBase::getWidget (button, name);
|
WindowBase::getWidget (button, name);
|
||||||
MyGUI::IntSize requested = button->getRequestedSize();
|
MyGUI::IntSize requested = button->getRequestedSize();
|
||||||
float scale = requested.height / button->getSize().height;
|
float scale = float(requested.height) / button->getSize().height;
|
||||||
MyGUI::IntSize newSize = requested;
|
MyGUI::IntSize newSize = requested;
|
||||||
newSize.width /= scale;
|
newSize.width /= scale;
|
||||||
newSize.height /= scale;
|
newSize.height /= scale;
|
||||||
|
@ -21,6 +21,7 @@ namespace MWMechanics
|
|||||||
Enchanting::Enchanting()
|
Enchanting::Enchanting()
|
||||||
: mCastStyle(ESM::Enchantment::CastOnce)
|
: mCastStyle(ESM::Enchantment::CastOnce)
|
||||||
, mSelfEnchanting(false)
|
, mSelfEnchanting(false)
|
||||||
|
, mWeaponType(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Enchanting::setOldItem(const MWWorld::Ptr& oldItem)
|
void Enchanting::setOldItem(const MWWorld::Ptr& oldItem)
|
||||||
|
@ -539,7 +539,7 @@ std::string NpcAnimation::getShieldMesh(MWWorld::ConstPtr shield) const
|
|||||||
{
|
{
|
||||||
const ESM::BodyPart *bodypart = 0;
|
const ESM::BodyPart *bodypart = 0;
|
||||||
bodypart = partStore.search(bodypartName);
|
bodypart = partStore.search(bodypartName);
|
||||||
if (bodypart->mData.mType != ESM::BodyPart::MT_Armor)
|
if (bodypart == nullptr || bodypart->mData.mType != ESM::BodyPart::MT_Armor)
|
||||||
return "";
|
return "";
|
||||||
else if (!bodypart->mModel.empty())
|
else if (!bodypart->mModel.empty())
|
||||||
mesh = "meshes\\" + bodypart->mModel;
|
mesh = "meshes\\" + bodypart->mModel;
|
||||||
|
@ -528,6 +528,8 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
|
|||||||
// Add animated textures
|
// Add animated textures
|
||||||
std::vector<osg::ref_ptr<osg::Texture2D> > textures;
|
std::vector<osg::ref_ptr<osg::Texture2D> > textures;
|
||||||
int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount");
|
int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount");
|
||||||
|
frameCount = std::min(std::max(frameCount, 0), 320);
|
||||||
|
|
||||||
const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture");
|
const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture");
|
||||||
for (int i=0; i<frameCount; ++i)
|
for (int i=0; i<frameCount; ++i)
|
||||||
{
|
{
|
||||||
@ -644,6 +646,8 @@ Water::~Water()
|
|||||||
void Water::listAssetsToPreload(std::vector<std::string> &textures)
|
void Water::listAssetsToPreload(std::vector<std::string> &textures)
|
||||||
{
|
{
|
||||||
int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount");
|
int frameCount = Fallback::Map::getInt("Water_SurfaceFrameCount");
|
||||||
|
frameCount = std::min(std::max(frameCount, 0), 320);
|
||||||
|
|
||||||
const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture");
|
const std::string& texture = Fallback::Map::getString("Water_SurfaceTexture");
|
||||||
for (int i=0; i<frameCount; ++i)
|
for (int i=0; i<frameCount; ++i)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
|||||||
std::string fname = mast.name;
|
std::string fname = mast.name;
|
||||||
int index = ~0;
|
int index = ~0;
|
||||||
for (int i = 0; i < esm.getIndex(); i++) {
|
for (int i = 0; i < esm.getIndex(); i++) {
|
||||||
const std::string &candidate = allPlugins->at(i).getContext().filename;
|
const std::string candidate = allPlugins->at(i).getContext().filename;
|
||||||
std::string fnamecandidate = boost::filesystem::path(candidate).filename().string();
|
std::string fnamecandidate = boost::filesystem::path(candidate).filename().string();
|
||||||
if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) {
|
if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) {
|
||||||
index = i;
|
index = i;
|
||||||
|
@ -347,8 +347,6 @@ namespace Compiler
|
|||||||
scanner.putbackName (name, loc);
|
scanner.putbackName (name, loc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Parser::parseName (name, loc, scanner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExprParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner)
|
bool ExprParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner)
|
||||||
|
@ -301,7 +301,7 @@ namespace NifOsg
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Vec3Interpolator mData;
|
Vec3Interpolator mData;
|
||||||
TargetColor mTargetColor;
|
TargetColor mTargetColor = Ambient;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FlipController : public SceneUtil::StateSetUpdater, public SceneUtil::Controller
|
class FlipController : public SceneUtil::StateSetUpdater, public SceneUtil::Controller
|
||||||
|
@ -66,6 +66,8 @@ namespace SceneUtil
|
|||||||
void ShadowManager::disableShadowsForStateSet(osg::ref_ptr<osg::StateSet> stateset)
|
void ShadowManager::disableShadowsForStateSet(osg::ref_ptr<osg::StateSet> stateset)
|
||||||
{
|
{
|
||||||
int numberOfShadowMapsPerLight = Settings::Manager::getInt("number of shadow maps", "Shadows");
|
int numberOfShadowMapsPerLight = Settings::Manager::getInt("number of shadow maps", "Shadows");
|
||||||
|
numberOfShadowMapsPerLight = std::max(1, std::min(numberOfShadowMapsPerLight, 8));
|
||||||
|
|
||||||
int baseShadowTextureUnit = 8 - numberOfShadowMapsPerLight;
|
int baseShadowTextureUnit = 8 - numberOfShadowMapsPerLight;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Image> fakeShadowMapImage = new osg::Image();
|
osg::ref_ptr<osg::Image> fakeShadowMapImage = new osg::Image();
|
||||||
|
@ -36,7 +36,6 @@ namespace Terrain
|
|||||||
|
|
||||||
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags);
|
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags);
|
||||||
|
|
||||||
void setCullingActive(bool active) { mCullingActive = active; }
|
|
||||||
void setCompositeMapSize(unsigned int size) { mCompositeMapSize = size; }
|
void setCompositeMapSize(unsigned int size) { mCompositeMapSize = size; }
|
||||||
void setCompositeMapLevel(float level) { mCompositeMapLevel = level; }
|
void setCompositeMapLevel(float level) { mCompositeMapLevel = level; }
|
||||||
void setMaxCompositeGeometrySize(float maxCompGeometrySize) { mMaxCompGeometrySize = maxCompGeometrySize; }
|
void setMaxCompositeGeometrySize(float maxCompGeometrySize) { mMaxCompGeometrySize = maxCompGeometrySize; }
|
||||||
@ -65,8 +64,6 @@ namespace Terrain
|
|||||||
unsigned int mCompositeMapSize;
|
unsigned int mCompositeMapSize;
|
||||||
float mCompositeMapLevel;
|
float mCompositeMapLevel;
|
||||||
float mMaxCompGeometrySize;
|
float mMaxCompGeometrySize;
|
||||||
|
|
||||||
bool mCullingActive;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user