mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-26 00:11:33 +00:00
Fix some static analysis issues (coverity)
This commit is contained in:
parent
1b9209df4a
commit
f931ba2efc
31 changed files with 298 additions and 256 deletions
|
@ -149,6 +149,8 @@ int extract(Bsa::BSAFile& bsa, Arguments& info);
|
||||||
int extractAll(Bsa::BSAFile& bsa, Arguments& info);
|
int extractAll(Bsa::BSAFile& bsa, Arguments& info);
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Arguments info;
|
Arguments info;
|
||||||
if(!parseOptions (argc, argv, info))
|
if(!parseOptions (argc, argv, info))
|
||||||
|
@ -156,16 +158,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
Bsa::BSAFile bsa;
|
Bsa::BSAFile bsa;
|
||||||
try
|
|
||||||
{
|
|
||||||
bsa.open(info.filename);
|
bsa.open(info.filename);
|
||||||
}
|
|
||||||
catch(std::exception &e)
|
|
||||||
{
|
|
||||||
std::cout << "ERROR reading BSA archive '" << info.filename
|
|
||||||
<< "'\nDetails:\n" << e.what() << std::endl;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.mode == "list")
|
if (info.mode == "list")
|
||||||
return list(bsa, info);
|
return list(bsa, info);
|
||||||
|
@ -179,6 +172,12 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "ERROR reading BSA archive\nDetails:\n" << e.what() << std::endl;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int list(Bsa::BSAFile& bsa, Arguments& info)
|
int list(Bsa::BSAFile& bsa, Arguments& info)
|
||||||
{
|
{
|
||||||
|
@ -189,9 +188,11 @@ int list(Bsa::BSAFile& bsa, Arguments& info)
|
||||||
if(info.longformat)
|
if(info.longformat)
|
||||||
{
|
{
|
||||||
// Long format
|
// Long format
|
||||||
|
std::ios::fmtflags f(std::cout.flags());
|
||||||
std::cout << std::setw(50) << std::left << files[i].name;
|
std::cout << std::setw(50) << std::left << files[i].name;
|
||||||
std::cout << std::setw(8) << std::left << std::dec << files[i].fileSize;
|
std::cout << std::setw(8) << std::left << std::dec << files[i].fileSize;
|
||||||
std::cout << "@ 0x" << std::hex << files[i].offset << std::endl;
|
std::cout << "@ 0x" << std::hex << files[i].offset << std::endl;
|
||||||
|
std::cout.flags(f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << files[i].name << std::endl;
|
std::cout << files[i].name << std::endl;
|
||||||
|
|
|
@ -202,6 +202,8 @@ int clone(Arguments& info);
|
||||||
int comp(Arguments& info);
|
int comp(Arguments& info);
|
||||||
|
|
||||||
int main(int argc, char**argv)
|
int main(int argc, char**argv)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Arguments info;
|
Arguments info;
|
||||||
if(!parseOptions (argc, argv, info))
|
if(!parseOptions (argc, argv, info))
|
||||||
|
@ -218,6 +220,12 @@ int main(int argc, char**argv)
|
||||||
std::cout << "Invalid or no mode specified, dying horribly. Have a nice day." << std::endl;
|
std::cout << "Invalid or no mode specified, dying horribly. Have a nice day." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "ERROR: " << e.what() << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -273,8 +281,10 @@ void printRaw(ESM::ESMReader &esm)
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
esm.skipHSub();
|
esm.skipHSub();
|
||||||
n = esm.retSubName();
|
n = esm.retSubName();
|
||||||
|
std::ios::fmtflags f(std::cout.flags());
|
||||||
std::cout << " " << n.toString() << " - " << esm.getSubSize()
|
std::cout << " " << n.toString() << " - " << esm.getSubSize()
|
||||||
<< " bytes @ 0x" << std::hex << offs << "\n";
|
<< " bytes @ 0x" << std::hex << offs << "\n";
|
||||||
|
std::cout.flags(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "maindialog.hpp"
|
#include "maindialog.hpp"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
|
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
|
||||||
SDL_SetMainReady();
|
SDL_SetMainReady();
|
||||||
|
@ -65,3 +67,9 @@ int main(int argc, char *argv[])
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "ERROR: " << e.what() << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,9 @@ int wmain(int argc, wchar_t *wargv[]) {
|
||||||
char **argv = converter.get();
|
char **argv = converter.get();
|
||||||
boost::filesystem::path::imbue(boost::locale::generator().generate(""));
|
boost::filesystem::path::imbue(boost::locale::generator().generate(""));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
bpo::options_description desc("Syntax: mwiniimporter <options> inifile configfile\nAllowed options");
|
bpo::options_description desc("Syntax: mwiniimporter <options> inifile configfile\nAllowed options");
|
||||||
bpo::positional_options_description p_desc;
|
bpo::positional_options_description p_desc;
|
||||||
desc.add_options()
|
desc.add_options()
|
||||||
|
@ -76,25 +79,12 @@ int wmain(int argc, wchar_t *wargv[]) {
|
||||||
|
|
||||||
bpo::variables_map vm;
|
bpo::variables_map vm;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bpo::parsed_options parsed = bpo::command_line_parser(argc, argv)
|
bpo::parsed_options parsed = bpo::command_line_parser(argc, argv)
|
||||||
.options(desc)
|
.options(desc)
|
||||||
.positional(p_desc)
|
.positional(p_desc)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
bpo::store(parsed, vm);
|
bpo::store(parsed, vm);
|
||||||
}
|
|
||||||
catch(boost::program_options::unknown_option & x)
|
|
||||||
{
|
|
||||||
std::cerr << "ERROR: " << x.what() << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch(boost::program_options::invalid_command_line_syntax & x)
|
|
||||||
{
|
|
||||||
std::cerr << "ERROR: " << x.what() << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(vm.count("help") || !vm.count("ini") || !vm.count("cfg")) {
|
if(vm.count("help") || !vm.count("ini") || !vm.count("cfg")) {
|
||||||
std::cout << desc;
|
std::cout << desc;
|
||||||
|
@ -143,6 +133,10 @@ int wmain(int argc, wchar_t *wargv[]) {
|
||||||
std::cout << "write to: " << outputFile << std::endl;
|
std::cout << "write to: " << outputFile << std::endl;
|
||||||
bfs::ofstream file((bfs::path(outputFile)));
|
bfs::ofstream file((bfs::path(outputFile)));
|
||||||
importer.writeToFile(file, cfg);
|
importer.writeToFile(file, cfg);
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "ERROR: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ class Application : public QApplication
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE (resources);
|
Q_INIT_RESOURCE (resources);
|
||||||
|
|
||||||
|
@ -87,6 +89,12 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
shinyFactory = editor.setupGraphics();
|
shinyFactory = editor.setupGraphics();
|
||||||
|
|
||||||
return editor.run();
|
return editor.run();
|
||||||
}
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "ERROR: " << e.what() << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "adjusterwidget.hpp"
|
#include "adjusterwidget.hpp"
|
||||||
|
|
||||||
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
||||||
QDialog(parent), mSelector (0), mFileWidget (0), mAdjusterWidget (0), mDialogBuilt(false)
|
QDialog(parent), mSelector (0), mFileWidget (0), mAdjusterWidget (0), mDialogBuilt(false), mAction(ContentAction_Undefined)
|
||||||
{
|
{
|
||||||
ui.setupUi (this);
|
ui.setupUi (this);
|
||||||
resize(400, 400);
|
resize(400, 400);
|
||||||
|
|
|
@ -61,7 +61,7 @@ bool CSVRender::Cell::addObjects (int start, int end)
|
||||||
|
|
||||||
CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
|
CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
|
||||||
const std::string& id, boost::shared_ptr<CSVWorld::PhysicsSystem> physics, const Ogre::Vector3& origin)
|
const std::string& id, boost::shared_ptr<CSVWorld::PhysicsSystem> physics, const Ogre::Vector3& origin)
|
||||||
: mData (data), mId (Misc::StringUtils::lowerCase (id)), mSceneMgr(sceneManager), mPhysics(physics)
|
: mData (data), mId (Misc::StringUtils::lowerCase (id)), mSceneMgr(sceneManager), mPhysics(physics), mX(0), mY(0)
|
||||||
{
|
{
|
||||||
mCellNode = sceneManager->getRootSceneNode()->createChildSceneNode();
|
mCellNode = sceneManager->getRootSceneNode()->createChildSceneNode();
|
||||||
mCellNode->setPosition (origin);
|
mCellNode->setPosition (origin);
|
||||||
|
@ -76,16 +76,15 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
|
||||||
const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
|
const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
|
||||||
int landIndex = land.searchId(mId);
|
int landIndex = land.searchId(mId);
|
||||||
if (landIndex != -1)
|
if (landIndex != -1)
|
||||||
|
{
|
||||||
|
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
|
||||||
|
if(esmLand)
|
||||||
{
|
{
|
||||||
mTerrain.reset(new Terrain::TerrainGrid(sceneManager, new TerrainStorage(mData), Element_Terrain, true,
|
mTerrain.reset(new Terrain::TerrainGrid(sceneManager, new TerrainStorage(mData), Element_Terrain, true,
|
||||||
Terrain::Align_XY));
|
Terrain::Align_XY));
|
||||||
|
|
||||||
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
|
|
||||||
mTerrain->loadCell(esmLand->mX,
|
mTerrain->loadCell(esmLand->mX,
|
||||||
esmLand->mY);
|
esmLand->mY);
|
||||||
|
|
||||||
if(esmLand)
|
|
||||||
{
|
|
||||||
float verts = ESM::Land::LAND_SIZE;
|
float verts = ESM::Land::LAND_SIZE;
|
||||||
float worldsize = ESM::Land::REAL_SIZE;
|
float worldsize = ESM::Land::REAL_SIZE;
|
||||||
mX = esmLand->mX;
|
mX = esmLand->mX;
|
||||||
|
@ -98,6 +97,7 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
|
||||||
|
|
||||||
CSVRender::Cell::~Cell()
|
CSVRender::Cell::~Cell()
|
||||||
{
|
{
|
||||||
|
if (mTerrain.get())
|
||||||
mPhysics->removeHeightField(mSceneMgr, mX, mY);
|
mPhysics->removeHeightField(mSceneMgr, mX, mY);
|
||||||
|
|
||||||
for (std::map<std::string, Object *>::iterator iter (mObjects.begin());
|
for (std::map<std::string, Object *>::iterator iter (mObjects.begin());
|
||||||
|
|
|
@ -346,7 +346,7 @@ namespace CSVRender
|
||||||
//plane X, upvector Y, mOffset x : x-z plane, wheel closer/further
|
//plane X, upvector Y, mOffset x : x-z plane, wheel closer/further
|
||||||
std::pair<Ogre::Vector3, Ogre::Vector3> MouseState::planeAxis()
|
std::pair<Ogre::Vector3, Ogre::Vector3> MouseState::planeAxis()
|
||||||
{
|
{
|
||||||
bool screenCoord = true;
|
const bool screenCoord = true;
|
||||||
Ogre::Vector3 dir = getCamera()->getDerivedDirection();
|
Ogre::Vector3 dir = getCamera()->getDerivedDirection();
|
||||||
|
|
||||||
QString wheelDir = "Closer/Further";
|
QString wheelDir = "Closer/Further";
|
||||||
|
|
|
@ -639,7 +639,8 @@ namespace
|
||||||
MyGUI::Vertex* vertices, RenderXform const & renderXform) :
|
MyGUI::Vertex* vertices, RenderXform const & renderXform) :
|
||||||
mZ(Z), mOrigin (left, top),
|
mZ(Z), mOrigin (left, top),
|
||||||
mFont (font), mVertices (vertices),
|
mFont (font), mVertices (vertices),
|
||||||
mRenderXform (renderXform)
|
mRenderXform (renderXform),
|
||||||
|
mC(0)
|
||||||
{
|
{
|
||||||
mVertexColourType = MyGUI::RenderManager::getInstance().getVertexFormat();
|
mVertexColourType = MyGUI::RenderManager::getInstance().getVertexFormat();
|
||||||
}
|
}
|
||||||
|
|
|
@ -770,6 +770,7 @@ namespace MWGui
|
||||||
|
|
||||||
SelectSkillDialog::SelectSkillDialog()
|
SelectSkillDialog::SelectSkillDialog()
|
||||||
: WindowModal("openmw_chargen_select_skill.layout")
|
: WindowModal("openmw_chargen_select_skill.layout")
|
||||||
|
, mSkillId(ESM::Skill::Block)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
|
|
@ -60,7 +60,7 @@ void ItemView::layoutWidgets()
|
||||||
|
|
||||||
int rows = maxHeight/42;
|
int rows = maxHeight/42;
|
||||||
rows = std::max(rows, 1);
|
rows = std::max(rows, 1);
|
||||||
bool showScrollbar = std::ceil(dragArea->getChildCount()/float(rows)) > mScrollView->getWidth()/42;
|
bool showScrollbar = int(std::ceil(dragArea->getChildCount()/float(rows))) > mScrollView->getWidth()/42;
|
||||||
if (showScrollbar)
|
if (showScrollbar)
|
||||||
maxHeight -= 18;
|
maxHeight -= 18;
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,8 @@ namespace MWGui
|
||||||
int screenHeight = viewSize.height;
|
int screenHeight = viewSize.height;
|
||||||
mVideoBackground->setSize(screenWidth, screenHeight);
|
mVideoBackground->setSize(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
if (mVideo->getVideoHeight() > 0)
|
||||||
|
{
|
||||||
double imageaspect = static_cast<double>(mVideo->getVideoWidth())/mVideo->getVideoHeight();
|
double imageaspect = static_cast<double>(mVideo->getVideoWidth())/mVideo->getVideoHeight();
|
||||||
|
|
||||||
int leftPadding = std::max(0.0, (screenWidth - screenHeight * imageaspect) / 2);
|
int leftPadding = std::max(0.0, (screenWidth - screenHeight * imageaspect) / 2);
|
||||||
|
@ -183,6 +185,7 @@ namespace MWGui
|
||||||
|
|
||||||
mVideo->setCoord(leftPadding, topPadding,
|
mVideo->setCoord(leftPadding, topPadding,
|
||||||
screenWidth - leftPadding*2, screenHeight - topPadding*2);
|
screenWidth - leftPadding*2, screenHeight - topPadding*2);
|
||||||
|
}
|
||||||
|
|
||||||
mVideo->setVisible(true);
|
mVideo->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,7 @@ namespace MWGui
|
||||||
mOkButton->setEnabled(pos != MyGUI::ITEM_NONE || mSaving);
|
mOkButton->setEnabled(pos != MyGUI::ITEM_NONE || mSaving);
|
||||||
mDeleteButton->setEnabled(pos != MyGUI::ITEM_NONE);
|
mDeleteButton->setEnabled(pos != MyGUI::ITEM_NONE);
|
||||||
|
|
||||||
if (pos == MyGUI::ITEM_NONE)
|
if (pos == MyGUI::ITEM_NONE || !mCurrentCharacter)
|
||||||
{
|
{
|
||||||
mCurrentSlot = NULL;
|
mCurrentSlot = NULL;
|
||||||
mInfoText->setCaption("");
|
mInfoText->setCaption("");
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace MWGui
|
||||||
Spell()
|
Spell()
|
||||||
: mSelected(false)
|
: mSelected(false)
|
||||||
, mActive(false)
|
, mActive(false)
|
||||||
|
, mType(Type_Spell)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1691,6 +1691,8 @@ namespace MWGui
|
||||||
// Use black bars to correct aspect ratio
|
// Use black bars to correct aspect ratio
|
||||||
mVideoBackground->setSize(screenWidth, screenHeight);
|
mVideoBackground->setSize(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
if (mVideoWidget->getVideoHeight() > 0)
|
||||||
|
{
|
||||||
double imageaspect = static_cast<double>(mVideoWidget->getVideoWidth())/mVideoWidget->getVideoHeight();
|
double imageaspect = static_cast<double>(mVideoWidget->getVideoWidth())/mVideoWidget->getVideoHeight();
|
||||||
|
|
||||||
int leftPadding = std::max(0.0, (screenWidth - screenHeight * imageaspect) / 2);
|
int leftPadding = std::max(0.0, (screenWidth - screenHeight * imageaspect) / 2);
|
||||||
|
@ -1699,6 +1701,7 @@ namespace MWGui
|
||||||
mVideoWidget->setCoord(leftPadding, topPadding,
|
mVideoWidget->setCoord(leftPadding, topPadding,
|
||||||
screenWidth - leftPadding*2, screenHeight - topPadding*2);
|
screenWidth - leftPadding*2, screenHeight - topPadding*2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WindowModal* WindowManager::getCurrentModal() const
|
WindowModal* WindowManager::getCurrentModal() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -286,6 +286,7 @@ void MWMechanics::Alchemy::addPotion (const std::string& name)
|
||||||
if (!iter->isEmpty())
|
if (!iter->isEmpty())
|
||||||
newRecord.mData.mWeight += iter->get<ESM::Ingredient>()->mBase->mData.mWeight;
|
newRecord.mData.mWeight += iter->get<ESM::Ingredient>()->mBase->mData.mWeight;
|
||||||
|
|
||||||
|
if (countIngredients() > 0)
|
||||||
newRecord.mData.mWeight /= countIngredients();
|
newRecord.mData.mWeight /= countIngredients();
|
||||||
|
|
||||||
newRecord.mData.mValue = mValue;
|
newRecord.mData.mValue = mValue;
|
||||||
|
|
|
@ -1644,7 +1644,7 @@ void CharacterController::update(float duration)
|
||||||
world->queueMovement(mPtr, Ogre::Vector3(0.0f));
|
world->queueMovement(mPtr, Ogre::Vector3(0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mAnimation && !mSkipAnim)
|
if(!mSkipAnim)
|
||||||
{
|
{
|
||||||
Ogre::Vector3 moved = mAnimation->runAnimation(duration);
|
Ogre::Vector3 moved = mAnimation->runAnimation(duration);
|
||||||
if(duration > 0.0f)
|
if(duration > 0.0f)
|
||||||
|
@ -1762,10 +1762,7 @@ bool CharacterController::kill()
|
||||||
|
|
||||||
playRandomDeath();
|
playRandomDeath();
|
||||||
|
|
||||||
if(mAnimation)
|
|
||||||
{
|
|
||||||
mAnimation->disable(mCurrentIdle);
|
mAnimation->disable(mCurrentIdle);
|
||||||
}
|
|
||||||
|
|
||||||
mIdleState = CharState_None;
|
mIdleState = CharState_None;
|
||||||
mCurrentIdle.clear();
|
mCurrentIdle.clear();
|
||||||
|
|
|
@ -687,12 +687,11 @@ namespace MWMechanics
|
||||||
|
|
||||||
// Failure sound
|
// Failure sound
|
||||||
int school = 0;
|
int school = 0;
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt (enchantment->mEffects.mList.begin());
|
if (!enchantment->mEffects.mList.empty())
|
||||||
effectIt!=enchantment->mEffects.mList.end(); ++effectIt)
|
|
||||||
{
|
{
|
||||||
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectIt->mEffectID);
|
short effectId = enchantment->mEffects.mList.front().mEffectID;
|
||||||
|
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectId);
|
||||||
school = magicEffect->mData.mSchool;
|
school = magicEffect->mData.mSchool;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
static const std::string schools[] = {
|
static const std::string schools[] = {
|
||||||
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"
|
"alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration"
|
||||||
|
|
|
@ -330,7 +330,10 @@ namespace MWRender
|
||||||
void RaceSelectionPreview::updateCamera()
|
void RaceSelectionPreview::updateCamera()
|
||||||
{
|
{
|
||||||
Ogre::Vector3 scale = mNode->getScale();
|
Ogre::Vector3 scale = mNode->getScale();
|
||||||
Ogre::Vector3 headOffset = mAnimation->getNode("Bip01 Head")->_getDerivedPosition();
|
Ogre::Node* headNode = mAnimation->getNode("Bip01 Head");
|
||||||
|
if (!headNode)
|
||||||
|
return;
|
||||||
|
Ogre::Vector3 headOffset = headNode->_getDerivedPosition();
|
||||||
headOffset = mNode->convertLocalToWorldPosition(headOffset);
|
headOffset = mNode->convertLocalToWorldPosition(headOffset);
|
||||||
|
|
||||||
mCamera->setPosition(headOffset + mPosition * scale);
|
mCamera->setPosition(headOffset + mPosition * scale);
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
using namespace Ogre;
|
using namespace Ogre;
|
||||||
|
|
||||||
LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManager* rendering) :
|
LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManager* rendering)
|
||||||
mInterior(false)
|
: mInterior(false)
|
||||||
|
, mAngle(0.f)
|
||||||
{
|
{
|
||||||
mRendering = rend;
|
mRendering = rend;
|
||||||
mRenderingManager = rendering;
|
mRenderingManager = rendering;
|
||||||
|
|
|
@ -104,7 +104,7 @@ BillboardObject::BillboardObject( const String& textureName,
|
||||||
}
|
}
|
||||||
|
|
||||||
BillboardObject::BillboardObject()
|
BillboardObject::BillboardObject()
|
||||||
: mNode(NULL), mMaterial(NULL), mEntity(NULL)
|
: mNode(NULL), mMaterial(NULL), mEntity(NULL), mVisibility(1.f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,6 +186,7 @@ Moon::Moon( const String& textureName,
|
||||||
SceneNode* rootNode,
|
SceneNode* rootNode,
|
||||||
const std::string& material)
|
const std::string& material)
|
||||||
: BillboardObject(textureName, initialSize, position, rootNode, material)
|
: BillboardObject(textureName, initialSize, position, rootNode, material)
|
||||||
|
, mType(Type_Masser)
|
||||||
{
|
{
|
||||||
setVisibility(1.0);
|
setVisibility(1.0);
|
||||||
|
|
||||||
|
|
|
@ -283,10 +283,13 @@ namespace MWWorld
|
||||||
return position;
|
return position;
|
||||||
|
|
||||||
OEngine::Physic::PhysicActor *physicActor = engine->getCharacter(ptr.getRefData().getHandle());
|
OEngine::Physic::PhysicActor *physicActor = engine->getCharacter(ptr.getRefData().getHandle());
|
||||||
|
if (!physicActor)
|
||||||
|
return position;
|
||||||
|
|
||||||
// Reset per-frame data
|
// Reset per-frame data
|
||||||
physicActor->setWalkingOnWater(false);
|
physicActor->setWalkingOnWater(false);
|
||||||
/* Anything to collide with? */
|
/* Anything to collide with? */
|
||||||
if(!physicActor || !physicActor->getCollisionMode())
|
if(!physicActor->getCollisionMode())
|
||||||
{
|
{
|
||||||
return position + (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) *
|
return position + (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) *
|
||||||
Ogre::Quaternion(Ogre::Radian(refpos.rot[0]), Ogre::Vector3::NEGATIVE_UNIT_X))
|
Ogre::Quaternion(Ogre::Radian(refpos.rot[0]), Ogre::Vector3::NEGATIVE_UNIT_X))
|
||||||
|
|
|
@ -630,9 +630,6 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Cell *searchOrCreate(int x, int y) {
|
const ESM::Cell *searchOrCreate(int x, int y) {
|
||||||
ESM::Cell cell;
|
|
||||||
cell.mData.mX = x, cell.mData.mY = y;
|
|
||||||
|
|
||||||
std::pair<int, int> key(x, y);
|
std::pair<int, int> key(x, y);
|
||||||
DynamicExt::const_iterator it = mExt.find(key);
|
DynamicExt::const_iterator it = mExt.find(key);
|
||||||
if (it != mExt.end()) {
|
if (it != mExt.end()) {
|
||||||
|
@ -644,13 +641,15 @@ namespace MWWorld
|
||||||
return &dit->second;
|
return &dit->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
ESM::Cell *newCell = new ESM::Cell;
|
ESM::Cell newCell;
|
||||||
newCell->mData.mX = x;
|
newCell.mData.mX = x;
|
||||||
newCell->mData.mY = y;
|
newCell.mData.mY = y;
|
||||||
mExt[std::make_pair(x, y)] = *newCell;
|
newCell.mData.mFlags = ESM::Cell::HasWater;
|
||||||
delete newCell;
|
newCell.mAmbi.mAmbient = 0;
|
||||||
|
newCell.mAmbi.mSunlight = 0;
|
||||||
return &mExt[std::make_pair(x, y)];
|
newCell.mAmbi.mFog = 0;
|
||||||
|
newCell.mAmbi.mFogDensity = 0;
|
||||||
|
return &mExt.insert(std::make_pair(key, newCell)).first->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Cell *find(const std::string &id) const {
|
const ESM::Cell *find(const std::string &id) const {
|
||||||
|
@ -853,6 +852,11 @@ namespace MWWorld
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Store<ESM::Pathgrid>()
|
||||||
|
: mCells(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void setCells(Store<ESM::Cell>& cells)
|
void setCells(Store<ESM::Cell>& cells)
|
||||||
{
|
{
|
||||||
mCells = &cells;
|
mCells = &cells;
|
||||||
|
|
|
@ -2554,7 +2554,7 @@ namespace MWWorld
|
||||||
|
|
||||||
if (!selectedSpell.empty())
|
if (!selectedSpell.empty())
|
||||||
{
|
{
|
||||||
const ESM::Spell* spell = getStore().get<ESM::Spell>().search(selectedSpell);
|
const ESM::Spell* spell = getStore().get<ESM::Spell>().find(selectedSpell);
|
||||||
|
|
||||||
// Check mana
|
// Check mana
|
||||||
MWMechanics::DynamicStat<float> magicka = stats.getMagicka();
|
MWMechanics::DynamicStat<float> magicka = stats.getMagicka();
|
||||||
|
@ -2641,7 +2641,7 @@ namespace MWWorld
|
||||||
|
|
||||||
if (!selectedSpell.empty())
|
if (!selectedSpell.empty())
|
||||||
{
|
{
|
||||||
const ESM::Spell* spell = getStore().get<ESM::Spell>().search(selectedSpell);
|
const ESM::Spell* spell = getStore().get<ESM::Spell>().find(selectedSpell);
|
||||||
|
|
||||||
// A power can be used once per 24h
|
// A power can be used once per 24h
|
||||||
if (spell->mData.mType == ESM::Spell::ST_Power)
|
if (spell->mData.mType == ESM::Spell::ST_Power)
|
||||||
|
|
|
@ -177,7 +177,6 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
|
||||||
return file->fileProperty(static_cast<const EsmFile::FileProperty>(column));
|
return file->fileProperty(static_cast<const EsmFile::FileProperty>(column));
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::TextAlignmentRole:
|
case Qt::TextAlignmentRole:
|
||||||
|
@ -193,8 +192,6 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
|
||||||
default:
|
default:
|
||||||
return Qt::AlignLeft + Qt::AlignVCenter;
|
return Qt::AlignLeft + Qt::AlignVCenter;
|
||||||
}
|
}
|
||||||
return QVariant();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
|
@ -203,7 +200,6 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
return file->toolTip();
|
return file->toolTip();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::CheckStateRole:
|
case Qt::CheckStateRole:
|
||||||
|
@ -212,8 +208,6 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
return mCheckStates[file->filePath()];
|
return mCheckStates[file->filePath()];
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::UserRole:
|
case Qt::UserRole:
|
||||||
|
@ -229,7 +223,6 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
|
||||||
|
|
||||||
case Qt::UserRole + 1:
|
case Qt::UserRole + 1:
|
||||||
return isChecked(file->filePath());
|
return isChecked(file->filePath());
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,6 +242,8 @@ bool Cell::getNextMVRF(ESMReader &esm, MovedCellRef &mref)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id.mWorldspace = Misc::StringUtils::lowerCase (mName);
|
id.mWorldspace = Misc::StringUtils::lowerCase (mName);
|
||||||
|
id.mIndex.mX = 0;
|
||||||
|
id.mIndex.mY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -928,6 +928,8 @@ class NIFObjectLoader
|
||||||
particledata = static_cast<const Nif::NiAutoNormalParticles*>(partnode)->data.getPtr();
|
particledata = static_cast<const Nif::NiAutoNormalParticles*>(partnode)->data.getPtr();
|
||||||
else if(partnode->recType == Nif::RC_NiRotatingParticles)
|
else if(partnode->recType == Nif::RC_NiRotatingParticles)
|
||||||
particledata = static_cast<const Nif::NiRotatingParticles*>(partnode)->data.getPtr();
|
particledata = static_cast<const Nif::NiRotatingParticles*>(partnode)->data.getPtr();
|
||||||
|
else
|
||||||
|
throw std::runtime_error("Unexpected particle node type");
|
||||||
|
|
||||||
std::string fullname = name+"@index="+Ogre::StringConverter::toString(partnode->recIndex);
|
std::string fullname = name+"@index="+Ogre::StringConverter::toString(partnode->recIndex);
|
||||||
if(partnode->name.length() > 0)
|
if(partnode->name.length() > 0)
|
||||||
|
|
|
@ -319,7 +319,9 @@ void Utf8Encoder::copyFromArray2(const char*& chp, char* &out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ios::fmtflags f(std::cout.flags());
|
||||||
std::cout << "Could not find glyph " << std::hex << (int)ch << " " << (int)ch2 << " " << (int)ch3 << std::endl;
|
std::cout << "Could not find glyph " << std::hex << (int)ch << " " << (int)ch2 << " " << (int)ch3 << std::endl;
|
||||||
|
std::cout.flags(f);
|
||||||
|
|
||||||
*(out++) = ch; // Could not find glyph, just put whatever
|
*(out++) = ch; // Could not find glyph, just put whatever
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,7 +299,7 @@ namespace ICS
|
||||||
{
|
{
|
||||||
if(it->second.find(axis) != it->second.end())
|
if(it->second.find(axis) != it->second.end())
|
||||||
{
|
{
|
||||||
mControlsJoystickPOVBinderMap[deviceId].find(index)->second.erase( it->second.find(axis) );
|
it->second.erase( it->second.find(axis) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
extern/sdl4ogre/sdlinputwrapper.cpp
vendored
6
extern/sdl4ogre/sdlinputwrapper.cpp
vendored
|
@ -28,7 +28,9 @@ namespace SFO
|
||||||
mWantGrab(false),
|
mWantGrab(false),
|
||||||
mWantRelative(false),
|
mWantRelative(false),
|
||||||
mWantMouseVisible(false),
|
mWantMouseVisible(false),
|
||||||
mAllowGrab(grab)
|
mAllowGrab(grab),
|
||||||
|
mWarpX(0),
|
||||||
|
mWarpY(0)
|
||||||
{
|
{
|
||||||
_setupOISKeys();
|
_setupOISKeys();
|
||||||
}
|
}
|
||||||
|
@ -117,7 +119,9 @@ namespace SFO
|
||||||
case SDL_CLIPBOARDUPDATE:
|
case SDL_CLIPBOARDUPDATE:
|
||||||
break; // We don't need this event, clipboard is retrieved on demand
|
break; // We don't need this event, clipboard is retrieved on demand
|
||||||
default:
|
default:
|
||||||
|
std::ios::fmtflags f(std::cerr.flags());
|
||||||
std::cerr << "Unhandled SDL event of type 0x" << std::hex << evt.type << std::endl;
|
std::cerr << "Unhandled SDL event of type 0x" << std::hex << evt.type << std::endl;
|
||||||
|
std::cerr.flags(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue