From 7dc30a01cd71dc0b8c00e48ebe75d61213510903 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 31 Jul 2013 18:46:32 +0200 Subject: [PATCH] Some changes suggested by cppcheck --- apps/openmw/engine.cpp | 4 + apps/openmw/main.cpp | 4 +- apps/openmw/mwclass/creature.cpp | 6 +- apps/openmw/mwclass/npc.cpp | 6 +- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 3 - apps/openmw/mwdialogue/dialoguemanagerimp.hpp | 1 - apps/openmw/mwgui/alchemywindow.cpp | 4 +- apps/openmw/mwgui/bookpage.cpp | 8 +- apps/openmw/mwgui/bookwindow.cpp | 1 + apps/openmw/mwgui/charactercreation.cpp | 3 + apps/openmw/mwgui/class.cpp | 3 + apps/openmw/mwgui/console.cpp | 10 +- apps/openmw/mwgui/formatting.cpp | 2 +- apps/openmw/mwgui/inventorywindow.cpp | 1 + apps/openmw/mwgui/itemselection.cpp | 2 + apps/openmw/mwgui/itemview.cpp | 1 + apps/openmw/mwgui/keywordsearch.hpp | 2 +- apps/openmw/mwgui/loadingscreen.cpp | 4 + apps/openmw/mwgui/mapwindow.cpp | 6 - apps/openmw/mwgui/messagebox.cpp | 5 +- apps/openmw/mwgui/quickkeysmenu.cpp | 1 + apps/openmw/mwgui/race.cpp | 1 + apps/openmw/mwgui/review.cpp | 5 +- apps/openmw/mwgui/review.hpp | 1 - apps/openmw/mwgui/spellicons.cpp | 2 +- apps/openmw/mwgui/spellicons.hpp | 6 +- apps/openmw/mwgui/statswindow.cpp | 8 +- apps/openmw/mwgui/statswindow.hpp | 1 - apps/openmw/mwgui/tooltips.cpp | 1 - apps/openmw/mwgui/tradewindow.cpp | 3 + apps/openmw/mwgui/waitdialog.cpp | 2 + apps/openmw/mwgui/widgets.cpp | 1 + apps/openmw/mwmechanics/aiescort.cpp | 4 + apps/openmw/mwmechanics/aitravel.cpp | 2 + apps/openmw/mwmechanics/aiwander.cpp | 7 ++ apps/openmw/mwmechanics/character.cpp | 6 +- apps/openmw/mwmechanics/creaturestats.cpp | 2 +- apps/openmw/mwmechanics/enchanting.cpp | 6 +- .../mwmechanics/mechanicsmanagerimp.cpp | 4 +- apps/openmw/mwmechanics/pathfinding.cpp | 2 +- apps/openmw/mwrender/actors.hpp | 1 + apps/openmw/mwrender/animation.cpp | 16 +-- apps/openmw/mwrender/camera.cpp | 2 + apps/openmw/mwrender/characterpreview.cpp | 5 +- apps/openmw/mwrender/globalmap.cpp | 10 +- apps/openmw/mwrender/npcanimation.cpp | 6 +- apps/openmw/mwrender/objects.cpp | 4 +- apps/openmw/mwrender/objects.hpp | 7 +- apps/openmw/mwrender/occlusionquery.cpp | 2 +- apps/openmw/mwrender/videoplayer.cpp | 2 + apps/openmw/mwrender/water.hpp | 2 + apps/openmw/mwscript/interpretercontext.cpp | 2 +- apps/openmw/mwsound/openal_output.cpp | 12 +- apps/openmw/mwsound/soundmanagerimp.cpp | 20 ++-- apps/openmw/mwworld/cellstore.cpp | 6 +- apps/openmw/mwworld/containerstore.cpp | 2 +- apps/openmw/mwworld/physicssystem.cpp | 2 +- apps/openmw/mwworld/store.cpp | 2 +- apps/openmw/mwworld/store.hpp | 4 +- apps/openmw/mwworld/worldimp.cpp | 11 +- apps/openmw/mwworld/worldimp.hpp | 7 -- components/bsa/bsa_archive.cpp | 8 +- components/compiler/lineparser.cpp | 2 +- components/compiler/scanner.cpp | 2 +- components/esm/esmreader.cpp | 3 + components/esm/loadland.cpp | 3 +- components/esm/loadpgrd.cpp | 4 +- components/interpreter/defines.cpp | 4 +- components/interpreter/runtime.cpp | 2 +- components/nifbullet/bulletnifloader.cpp | 42 +++---- components/nifbullet/bulletnifloader.hpp | 13 ++- extern/oics/ICSControl.cpp | 2 +- extern/oics/ICSControl.h | 6 +- extern/sdl4ogre/sdlcursormanager.hpp | 1 - libs/openengine/bullet/BtOgre.cpp | 4 +- libs/openengine/bullet/physic.cpp | 7 +- libs/openengine/gui/manager.cpp | 6 +- libs/openengine/input/dispatch_map.hpp | 75 ------------- libs/openengine/input/dispatcher.hpp | 78 ------------- libs/openengine/input/func_binder.hpp | 106 ------------------ libs/openengine/input/poller.hpp | 46 -------- libs/openengine/input/tests/Makefile | 18 --- .../input/tests/dispatch_map_test.cpp | 54 --------- libs/openengine/input/tests/funcbind_test.cpp | 47 -------- .../input/tests/output/dispatch_map_test.out | 18 --- .../input/tests/output/funcbind_test.out | 15 --- .../input/tests/output/sdl_binder_test.out | 4 - .../input/tests/output/sdl_driver_test.out | 4 - .../input/tests/sdl_binder_test.cpp | 71 ------------ .../input/tests/sdl_driver_test.cpp | 31 ----- libs/openengine/input/tests/test.sh | 18 --- libs/openengine/ogre/renderer.cpp | 4 +- 92 files changed, 214 insertions(+), 750 deletions(-) delete mode 100644 libs/openengine/input/dispatch_map.hpp delete mode 100644 libs/openengine/input/dispatcher.hpp delete mode 100644 libs/openengine/input/func_binder.hpp delete mode 100644 libs/openengine/input/poller.hpp delete mode 100644 libs/openengine/input/tests/Makefile delete mode 100644 libs/openengine/input/tests/dispatch_map_test.cpp delete mode 100644 libs/openengine/input/tests/funcbind_test.cpp delete mode 100644 libs/openengine/input/tests/output/dispatch_map_test.out delete mode 100644 libs/openengine/input/tests/output/funcbind_test.out delete mode 100644 libs/openengine/input/tests/output/sdl_binder_test.out delete mode 100644 libs/openengine/input/tests/output/sdl_driver_test.out delete mode 100644 libs/openengine/input/tests/sdl_binder_test.cpp delete mode 100644 libs/openengine/input/tests/sdl_driver_test.cpp delete mode 100755 libs/openengine/input/tests/test.sh diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 1050c17174..b35d693a6b 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -141,6 +141,10 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager) , mFSStrict (false) , mScriptConsoleMode (false) , mCfgMgr(configurationManager) + , mEncoding(ToUTF8::WINDOWS_1252) + , mEncoder(NULL) + , mActivationDistanceOverride(-1) + { std::srand ( std::time(NULL) ); MWClass::registerClasses(); diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index f11d153b4a..27afd734ae 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -54,7 +54,7 @@ void validate(boost::any &v, std::vector const &tokens, FallbackMap FallbackMap *map = boost::any_cast(&v); std::map::iterator mapIt; - for(std::vector::const_iterator it=tokens.begin(); it != tokens.end(); it++) + for(std::vector::const_iterator it=tokens.begin(); it != tokens.end(); ++it) { int sep = it->find(","); if(sep < 1 || sep == (int)it->length()-1) @@ -204,7 +204,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat // fallback archives StringsVector archives = variables["fallback-archive"].as(); - for (StringsVector::const_iterator it = archives.begin(); it != archives.end(); it++) + for (StringsVector::const_iterator it = archives.begin(); it != archives.end(); ++it) { engine.addArchive(*it); } diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index d142801df8..911d049d26 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -376,13 +376,13 @@ namespace MWClass MWWorld::Store::iterator sound = store.begin(); while(sound != store.end()) { - if(type == sound->mType && sound->mCreature.size() > 0 && + if(type == sound->mType && !sound->mCreature.empty() && Misc::StringUtils::ciEqual(ptrid.substr(0, sound->mCreature.size()), sound->mCreature)) sounds.push_back(&*sound); - sound++; + ++sound; } - if(sounds.size() > 0) + if(!sounds.empty()) return sounds[(int)(rand()/(RAND_MAX+1.0)*sounds.size())]->mSound; } diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index f2bfd1814c..cb68bb3c35 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -272,10 +272,10 @@ namespace MWClass ptr.get(); assert(ref->mBase != NULL); - std::string headID = ref->mBase->mHead; + //std::string headID = ref->mBase->mHead; - int end = headID.find_last_of("head_") - 4; - std::string bodyRaceID = headID.substr(0, end); + //int end = headID.find_last_of("head_") - 4; + //std::string bodyRaceID = headID.substr(0, end); std::string model = "meshes\\base_anim.nif"; const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get().find(ref->mBase->mRace); diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 06a6e335dc..52493bf765 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -172,7 +172,6 @@ namespace MWDialogue win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext)); executeScript (info->mResultScript); mLastTopic = Misc::StringUtils::lowerCase(it->mId); - mLastDialogue = *info; break; } } @@ -293,7 +292,6 @@ namespace MWDialogue executeScript (info->mResultScript); mLastTopic = topic; - mLastDialogue = *info; } else { @@ -455,7 +453,6 @@ namespace MWDialogue MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse (Interpreter::fixDefinesDialog(text, interpreterContext)); MWBase::Environment::get().getJournal()->addTopic (mLastTopic, info->mId); executeScript (info->mResultScript); - mLastDialogue = *info; } } } diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.hpp b/apps/openmw/mwdialogue/dialoguemanagerimp.hpp index 13bab4dae1..1b7abed45a 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.hpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.hpp @@ -31,7 +31,6 @@ namespace MWDialogue int mChoice; std::string mLastTopic; - ESM::DialInfo mLastDialogue; bool mIsInChoice; float mTemporaryDispositionChange; diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 136cb7c981..5faafbfff2 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -47,6 +47,8 @@ namespace MWGui , mIngredients (4) , mSortModel(NULL) { + mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); + getWidget(mCreateButton, "CreateButton"); getWidget(mCancelButton, "CancelButton"); getWidget(mIngredients[0], "Ingredient1"); @@ -150,8 +152,6 @@ namespace MWGui mNameEdit->setCaption(""); - mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); - int index = 0; for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools()); diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 94f834a4d2..694970e23d 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -108,7 +108,7 @@ struct TypesetBookImpl : TypesetBook { Contents::iterator i = mContents.insert (mContents.end (), Content (text.first, text.second)); - if (i->size () == 0) + if (i->empty()) return Range (Utf8Point (NULL), Utf8Point (NULL)); Utf8Point begin = &i->front (); @@ -768,6 +768,11 @@ public: PageDisplay () { mPage = -1; + mViewTop = 0; + mViewBottom = 0; + mFocusItem = NULL; + mItemActive = false; + mNode = NULL; } void dirtyFocusItem () @@ -1093,7 +1098,6 @@ class BookPageImpl : public BookPage MYGUI_RTTI_DERIVED(BookPage) public: - void showPage (TypesetBook::Ptr book, size_t page) { if (PageDisplay* pd = dynamic_cast (getSubWidgetText ())) diff --git a/apps/openmw/mwgui/bookwindow.cpp b/apps/openmw/mwgui/bookwindow.cpp index 849f6052be..efe089689b 100644 --- a/apps/openmw/mwgui/bookwindow.cpp +++ b/apps/openmw/mwgui/bookwindow.cpp @@ -19,6 +19,7 @@ namespace MWGui : WindowBase("openmw_book.layout") , mTakeButtonShow(true) , mTakeButtonAllowed(true) + , mCurrentPage(0) { getWidget(mCloseButton, "CloseButton"); mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked); diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index d1e103dd35..816f42e3d1 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -70,6 +70,9 @@ namespace MWGui , mGenerateClassStep(0) { mCreationStage = CSE_NotStarted; + mGenerateClassSpecializations[0] = 0; + mGenerateClassSpecializations[1] = 0; + mGenerateClassSpecializations[2] = 0; } void CharacterCreation::setValue (const std::string& id, const MWMechanics::Stat& value) diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index 2f00918b00..c33e54d6b4 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -372,6 +372,8 @@ namespace MWGui , mAttribDialog(NULL) , mSkillDialog(NULL) , mDescDialog(NULL) + , mAffectedAttribute(NULL) + , mAffectedSkill(NULL) { // Centre dialog center(); @@ -718,6 +720,7 @@ namespace MWGui SelectAttributeDialog::SelectAttributeDialog() : WindowModal("openmw_chargen_select_attribute.layout") + , mAttributeId(ESM::Attribute::Strength) { // Centre dialog center(); diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 3bc0de4cb3..ff774b531e 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -217,7 +217,7 @@ namespace MWGui mCommandLine->setCaption(complete( mCommandLine->getCaption(), matches )); #if 0 int i = 0; - for(std::vector::iterator it=matches.begin(); it < matches.end(); it++,i++ ) + for(std::vector::iterator it=matches.begin(); it < matches.end(); ++it,++i ) { printOK( *it ); if( i == 50 ) @@ -237,7 +237,7 @@ namespace MWGui if(mCurrent != mCommandHistory.begin()) { - mCurrent--; + --mCurrent; mCommandLine->setCaption(*mCurrent); } } @@ -245,7 +245,7 @@ namespace MWGui { if(mCurrent != mCommandHistory.end()) { - mCurrent++; + --mCurrent; if(mCurrent != mCommandHistory.end()) mCommandLine->setCaption(*mCurrent); @@ -333,7 +333,7 @@ namespace MWGui continue; /* Is the beginning of the string different from the input string? If yes skip it. */ - for( std::string::iterator iter=tmp.begin(), iter2=(*it).begin(); iter < tmp.end();iter++, iter2++) { + for( std::string::iterator iter=tmp.begin(), iter2=(*it).begin(); iter < tmp.end();++iter, ++iter2) { if( tolower(*iter) != tolower(*iter2) ) { string_different=true; break; @@ -372,7 +372,7 @@ namespace MWGui /* Check if all matching strings match further than input. If yes complete to this match. */ int i = tmp.length(); - for(std::string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) { + for(std::string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); ++iter, ++i) { for(std::vector::iterator it=matches.begin(); it < matches.end();++it) { if( tolower((*it)[i]) != tolower(*iter) ) { /* Append the longest match to the end of the output string*/ diff --git a/apps/openmw/mwgui/formatting.cpp b/apps/openmw/mwgui/formatting.cpp index 58d963ce83..bd75c078c0 100644 --- a/apps/openmw/mwgui/formatting.cpp +++ b/apps/openmw/mwgui/formatting.cpp @@ -78,7 +78,7 @@ namespace return string.getChar(0); } - bool is_not_empty(const std::string s) { + bool is_not_empty(const std::string& s) { std::string temp = s; boost::algorithm::trim(temp); return !temp.empty(); diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 9fa87c4b85..76e2e6baac 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -36,6 +36,7 @@ namespace MWGui , mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ()) , mPreviewDirty(true) , mDragAndDrop(dragAndDrop) + , mSelectedItem(-1) { static_cast(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize); diff --git a/apps/openmw/mwgui/itemselection.cpp b/apps/openmw/mwgui/itemselection.cpp index a57c6d81f1..01ea3429c3 100644 --- a/apps/openmw/mwgui/itemselection.cpp +++ b/apps/openmw/mwgui/itemselection.cpp @@ -9,6 +9,8 @@ namespace MWGui ItemSelectionDialog::ItemSelectionDialog(const std::string &label) : WindowModal("openmw_itemselection_dialog.layout") + , mSortModel(NULL) + , mModel(NULL) { getWidget(mItemView, "ItemView"); mItemView->eventItemClicked += MyGUI::newDelegate(this, &ItemSelectionDialog::onSelectedItem); diff --git a/apps/openmw/mwgui/itemview.cpp b/apps/openmw/mwgui/itemview.cpp index 5155d27120..466ecbdcc0 100644 --- a/apps/openmw/mwgui/itemview.cpp +++ b/apps/openmw/mwgui/itemview.cpp @@ -32,6 +32,7 @@ namespace MWGui ItemView::ItemView() : mModel(NULL) + , mScrollView(NULL) { } diff --git a/apps/openmw/mwgui/keywordsearch.hpp b/apps/openmw/mwgui/keywordsearch.hpp index 13d3318e59..a9fb6daaba 100644 --- a/apps/openmw/mwgui/keywordsearch.hpp +++ b/apps/openmw/mwgui/keywordsearch.hpp @@ -101,7 +101,7 @@ public: candidates.push_back(std::make_pair((j-i), candidate)); } - if (!candidates.size()) + if (candidates.empty()) continue; // didn't match enough to disambiguate, on to next character // shorter candidates will be added to the vector first. however, we want to check against longer candidates first diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index d4b06b2ab6..547d2fe29d 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -24,6 +24,10 @@ namespace MWGui , mLastWallpaperChangeTime(0.f) , mFirstLoad(true) , mTotalRefsLoading(0) + , mCurrentCellLoading(0) + , mTotalCellsLoading(0) + , mCurrentRefLoading(0) + , mCurrentRefList(0) { getWidget(mLoadingText, "LoadingText"); getWidget(mProgressBar, "ProgressBar"); diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index 7098853af8..0ccfb7e88c 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -89,9 +89,6 @@ namespace MWGui { for (int my=0; my<3; ++my) { - std::string name = "Map_" + boost::lexical_cast(mx) + "_" - + boost::lexical_cast(my); - std::string image = mPrefix+"_"+ boost::lexical_cast(mCurX + (mx-1)) + "_" + boost::lexical_cast(mCurY + (-1*(my-1))); MyGUI::ImageBox* fog = mFogWidgets[my + 3*mx]; @@ -135,9 +132,6 @@ namespace MWGui std::string image = mPrefix+"_"+ boost::lexical_cast(x + (mx-1)) + "_" + boost::lexical_cast(y + (-1*(my-1))); - std::string name = "Map_" + boost::lexical_cast(mx) + "_" - + boost::lexical_cast(my); - MyGUI::ImageBox* box = mMapWidgets[my + 3*mx]; if (MyGUI::RenderManager::getInstance().getTexture(image) != 0) diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp index 3a969c7ca3..45da1bf17e 100644 --- a/apps/openmw/mwgui/messagebox.cpp +++ b/apps/openmw/mwgui/messagebox.cpp @@ -49,7 +49,7 @@ namespace MWGui else { (*it2)->update(height); height += (*it2)->getHeight(); - it2++; + ++it2; } } } @@ -57,7 +57,7 @@ namespace MWGui } else { - it++; + ++it; } } @@ -226,6 +226,7 @@ namespace MWGui : WindowModal("openmw_interactive_messagebox.layout") , mMessageBoxManager(parMessageBoxManager) , mButtonPressed(-1) + , mTextButtonPadding(0) { WindowModal::open(); diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index 877f7b7003..a5fc2ca5d7 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -44,6 +44,7 @@ namespace MWGui , mAssignDialog(0) , mItemSelectionDialog(0) , mMagicSelectionDialog(0) + , mSelectedIndex(-1) { getWidget(mOkButton, "OKButton"); getWidget(mInstructionLabel, "InstructionLabel"); diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index ba06c8d105..2c73226e3d 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -33,6 +33,7 @@ namespace MWGui , mHairIndex(0) , mCurrentAngle(0) , mPreviewDirty(true) + , mPreview(NULL) { // Centre dialog center(); diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index 824929b67e..dfc86a547b 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -18,7 +18,6 @@ namespace MWGui ReviewDialog::ReviewDialog() : WindowModal("openmw_chargen_review.layout") - , mLastPos(0) { // Centre dialog center(); @@ -321,9 +320,7 @@ namespace MWGui if (!mMiscSkills.empty()) addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2); - mClientHeight = coord1.top; - - mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), mClientHeight)); + mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top)); } // widget controls diff --git a/apps/openmw/mwgui/review.hpp b/apps/openmw/mwgui/review.hpp index 87d6fedfa7..1c24fec745 100644 --- a/apps/openmw/mwgui/review.hpp +++ b/apps/openmw/mwgui/review.hpp @@ -79,7 +79,6 @@ namespace MWGui MyGUI::TextBox *mNameWidget, *mRaceWidget, *mClassWidget, *mBirthSignWidget; MyGUI::ScrollView* mSkillView; - int mLastPos, mClientHeight; Widgets::MWDynamicStatPtr mHealth, mMagicka, mFatigue; diff --git a/apps/openmw/mwgui/spellicons.cpp b/apps/openmw/mwgui/spellicons.cpp index e762cc6105..5e7ed498d3 100644 --- a/apps/openmw/mwgui/spellicons.cpp +++ b/apps/openmw/mwgui/spellicons.cpp @@ -139,7 +139,7 @@ namespace MWGui if (adjustSize) { int s = effects.size() * 16+4; - if (!effects.size()) + if (effects.empty()) s = 0; int diff = parent->getWidth() - s; parent->setSize(s, parent->getHeight()); diff --git a/apps/openmw/mwgui/spellicons.hpp b/apps/openmw/mwgui/spellicons.hpp index af600e3474..818d67b5bb 100644 --- a/apps/openmw/mwgui/spellicons.hpp +++ b/apps/openmw/mwgui/spellicons.hpp @@ -22,7 +22,11 @@ namespace MWGui // information about a single magic effect source as required for display in the tooltip struct MagicEffectInfo { - MagicEffectInfo() : mPermanent(false) {} + MagicEffectInfo() + : mPermanent(false) + , mMagnitude(0) + , mRemainingTime(0) + {} std::string mSource; // display name for effect source (e.g. potion name) MWMechanics::EffectKey mKey; int mMagnitude; diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index 1134767f14..79c94b27e2 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -21,7 +21,6 @@ namespace MWGui StatsWindow::StatsWindow () : WindowPinnableBase("openmw_stats_window.layout") , mSkillView(NULL) - , mClientHeight(0) , mMajorSkills() , mMinorSkills() , mMiscSkills() @@ -82,7 +81,7 @@ namespace MWGui { mLeftPane->setCoord( MyGUI::IntCoord(0, 0, 0.44*window->getSize().width, window->getSize().height) ); mRightPane->setCoord( MyGUI::IntCoord(0.44*window->getSize().width, 0, 0.56*window->getSize().width, window->getSize().height) ); - mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), mClientHeight)); + mSkillView->setCanvasSize (mSkillView->getWidth(), mSkillView->getCanvasSize().height); } void StatsWindow::setBar(const std::string& name, const std::string& tname, int val, int max) @@ -422,7 +421,6 @@ namespace MWGui mSkillWidgets.clear(); mSkillView->setViewOffset (MyGUI::IntPoint(0,0)); - mClientHeight = 0; const int valueSize = 40; MyGUI::IntCoord coord1(10, 0, mSkillView->getWidth() - (10 + valueSize) - 24, 18); @@ -565,9 +563,7 @@ namespace MWGui mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sCrimeHelp}"); } - mClientHeight = coord1.top; - - mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), mClientHeight)); + mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top)); } void StatsWindow::onPinToggled() diff --git a/apps/openmw/mwgui/statswindow.hpp b/apps/openmw/mwgui/statswindow.hpp index bec42d029b..ac8319bdcd 100644 --- a/apps/openmw/mwgui/statswindow.hpp +++ b/apps/openmw/mwgui/statswindow.hpp @@ -57,7 +57,6 @@ namespace MWGui MyGUI::Widget* mRightPane; MyGUI::ScrollView* mSkillView; - int mLastPos, mClientHeight; SkillList mMajorSkills, mMinorSkills, mMiscSkills; std::map > mSkillValues; diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index ad5418ebd5..5e65c762de 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -149,7 +149,6 @@ namespace MWGui } std::string type = focus->getUserString("ToolTipType"); - std::string text = focus->getUserString("ToolTipText"); if (type == "") { diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index 01f7e2419f..498fbace87 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -36,6 +36,9 @@ namespace MWGui , mBalanceButtonsState(BBS_None) , mBalanceChangePause(0.0) , mItemToSell(-1) + , mTradeModel(NULL) + , mSortModel(NULL) + , mCurrentMerchantOffer(0) { getWidget(mFilterAll, "AllButton"); getWidget(mFilterWeapon, "WeaponButton"); diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp index 63419d4dd7..e159a826ec 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -47,6 +47,8 @@ namespace MWGui , mSleeping(false) , mHours(1) , mRemainingTime(0.05) + , mCurHour(0) + , mManualHours(1) { getWidget(mDateTimeText, "DateTimeText"); getWidget(mRestText, "RestText"); diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index 04ef0e7cbb..dea64ae8cf 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -899,6 +899,7 @@ namespace MWGui : mEnableRepeat(true) , mRepeatTriggerTime(0.5) , mRepeatStepTime(0.1) + , mIsIncreasing(true) { } diff --git a/apps/openmw/mwmechanics/aiescort.cpp b/apps/openmw/mwmechanics/aiescort.cpp index 6af87e8bd2..556e0b1267 100644 --- a/apps/openmw/mwmechanics/aiescort.cpp +++ b/apps/openmw/mwmechanics/aiescort.cpp @@ -29,6 +29,8 @@ namespace MWMechanics { AiEscort::AiEscort(const std::string &actorId, int duration, float x, float y, float z) : mActorId(actorId), mX(x), mY(y), mZ(z), mDuration(duration) + , cellX(std::numeric_limits::max()) + , cellY(std::numeric_limits::max()) { mMaxDist = 470; @@ -46,6 +48,8 @@ namespace MWMechanics AiEscort::AiEscort(const std::string &actorId, const std::string &cellId,int duration, float x, float y, float z) : mActorId(actorId), mCellId(cellId), mX(x), mY(y), mZ(z), mDuration(duration) + , cellX(std::numeric_limits::max()) + , cellY(std::numeric_limits::max()) { mMaxDist = 470; diff --git a/apps/openmw/mwmechanics/aitravel.cpp b/apps/openmw/mwmechanics/aitravel.cpp index 90365c16b6..6b43a36f69 100644 --- a/apps/openmw/mwmechanics/aitravel.cpp +++ b/apps/openmw/mwmechanics/aitravel.cpp @@ -21,6 +21,8 @@ namespace MWMechanics { AiTravel::AiTravel(float x, float y, float z) : mX(x),mY(y),mZ(z),mPathFinder() + , cellX(std::numeric_limits::max()) + , cellY(std::numeric_limits::max()) { } diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index 8f79262360..12ac480a4d 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -24,6 +24,13 @@ namespace MWMechanics { AiWander::AiWander(int distance, int duration, int timeOfDay, const std::vector& idle, bool repeat): mDistance(distance), mDuration(duration), mTimeOfDay(timeOfDay), mIdle(idle), mRepeat(repeat) + , mCellX(std::numeric_limits::max()) + , mCellY(std::numeric_limits::max()) + , mXCell(0) + , mYCell(0) + , mX(0) + , mY(0) + , mZ(0) { for(unsigned short counter = 0; counter < mIdle.size(); counter++) { diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 5bfdcf0a71..b8ad228d69 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -699,7 +699,7 @@ void CharacterController::update(float duration, Movement &movement) if(movestate != CharState_None) clearAnimQueue(); - if(mAnimQueue.size() == 0) + if(mAnimQueue.empty()) idlestate = (inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle)); else if(mAnimQueue.size() > 1) { @@ -765,7 +765,7 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int else { count = std::max(count, 1); - if(mode != 0 || mAnimQueue.size() == 0) + if(mode != 0 || mAnimQueue.empty()) { clearAnimQueue(); mAnimQueue.push_back(std::make_pair(groupname, count-1)); @@ -801,7 +801,7 @@ bool CharacterController::isAnimPlaying(const std::string &groupName) void CharacterController::clearAnimQueue() { - if(mAnimQueue.size() > 0) + if(!mAnimQueue.empty()) mAnimation->disable(mAnimQueue.front().first); mAnimQueue.clear(); } diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index 5b4621905d..9f1f1fa31c 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -13,7 +13,7 @@ namespace MWMechanics : mLevel (0), mLevelHealthBonus(0.f), mDead (false), mDied (false), mFriendlyHits (0), mTalkedTo (false), mAlarmed (false), mAttacked (false), mHostile (false), - mAttackingOrSpell(false) + mAttackingOrSpell(false), mAttackType(AT_Chop) { for (int i=0; i<4; ++i) mAiSettings[i] = 0; diff --git a/apps/openmw/mwmechanics/enchanting.cpp b/apps/openmw/mwmechanics/enchanting.cpp index faa450df7a..e1b416efba 100644 --- a/apps/openmw/mwmechanics/enchanting.cpp +++ b/apps/openmw/mwmechanics/enchanting.cpp @@ -11,8 +11,10 @@ namespace MWMechanics { - Enchanting::Enchanting(): - mCastStyle(ESM::Enchantment::CastOnce) + Enchanting::Enchanting() + : mCastStyle(ESM::Enchantment::CastOnce) + , mSelfEnchanting(false) + , mOldItemCount(0) {} void Enchanting::setOldItem(MWWorld::Ptr oldItem) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 29880291d2..7aa347d6ef 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -416,7 +416,7 @@ namespace MWMechanics if (playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(npcFaction)) != playerNpcStats.getFactionRanks().end()) { for(std::vector::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.begin(); - it != MWBase::Environment::get().getWorld()->getStore().get().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end(); it++) + it != MWBase::Environment::get().getWorld()->getStore().get().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end(); ++it) { if(Misc::StringUtils::lowerCase(it->mFaction) == Misc::StringUtils::lowerCase(npcFaction)) reaction = it->mReaction; } @@ -425,7 +425,7 @@ namespace MWMechanics else if (npcFaction != "") { for(std::vector::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.begin(); - it != MWBase::Environment::get().getWorld()->getStore().get().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end();it++) + it != MWBase::Environment::get().getWorld()->getStore().get().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end();++it) { if(playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(it->mFaction)) != playerNpcStats.getFactionRanks().end() ) { diff --git a/apps/openmw/mwmechanics/pathfinding.cpp b/apps/openmw/mwmechanics/pathfinding.cpp index 986595a9af..da9d52e446 100644 --- a/apps/openmw/mwmechanics/pathfinding.cpp +++ b/apps/openmw/mwmechanics/pathfinding.cpp @@ -119,7 +119,7 @@ namespace boost::predecessor_map(&p[0]).distance_map(&d[0]).visitor(goalVisited(end))); } - catch(found_path fg) + catch(found_path& fg) { for(PointID v = end; ; v = p[v]) { diff --git a/apps/openmw/mwrender/actors.hpp b/apps/openmw/mwrender/actors.hpp index bba2d945c2..af58883983 100644 --- a/apps/openmw/mwrender/actors.hpp +++ b/apps/openmw/mwrender/actors.hpp @@ -31,6 +31,7 @@ namespace MWRender Actors(OEngine::Render::OgreRenderer& _rend, MWRender::RenderingManager* rendering) : mRend(_rend) , mRendering(rendering) + , mRootNode(NULL) {} ~Actors(); diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 843e5367e7..0bb7485723 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -74,7 +74,7 @@ Animation::~Animation() void Animation::setObjectRoot(Ogre::SceneNode *node, const std::string &model, bool baseonly) { - OgreAssert(mAnimSources.size() == 0, "Setting object root while animation sources are set!"); + OgreAssert(mAnimSources.empty(), "Setting object root while animation sources are set!"); if(!mInsert) mInsert = node->createChildSceneNode(); @@ -126,7 +126,7 @@ void Animation::setObjectRoot(Ogre::SceneNode *node, const std::string &model, b else { mSkelBase->attachObjectToBone(iter->second, iter->first); - iter++; + ++iter; } } } @@ -214,7 +214,7 @@ void Animation::addAnimSource(const std::string &model) std::vector > ctrls; Ogre::SharedPtr animsrc(OGRE_NEW AnimSource); NifOgre::Loader::createKfControllers(mSkelBase, kfname, animsrc->mTextKeys, ctrls); - if(animsrc->mTextKeys.size() == 0 || ctrls.size() == 0) + if(animsrc->mTextKeys.empty() || ctrls.empty()) return; mAnimSources.push_back(animsrc); @@ -497,7 +497,7 @@ bool Animation::reset(AnimState &state, const NifOgre::TextKeyMap &keys, const s void Animation::handleTextKey(AnimState &state, const std::string &groupname, const NifOgre::TextKeyMap::const_iterator &key) { - float time = key->first; + //float time = key->first; const std::string &evt = key->second; if(evt.compare(0, 7, "sound: ") == 0) @@ -550,7 +550,7 @@ void Animation::handleTextKey(AnimState &state, const std::string &groupname, co void Animation::play(const std::string &groupname, int priority, int groups, bool autodisable, float speedmult, const std::string &start, const std::string &stop, float startpoint, size_t loops) { - if(!mSkelBase || mAnimSources.size() == 0) + if(!mSkelBase || mAnimSources.empty()) return; if(groupname.empty()) @@ -567,7 +567,7 @@ void Animation::play(const std::string &groupname, int priority, int groups, boo if(stateiter->second.mPriority == priority) mStates.erase(stateiter++); else - stateiter++; + ++stateiter; } stateiter = mStates.find(groupname); @@ -642,7 +642,7 @@ void Animation::resetActiveGroups() AnimStateMap::const_iterator active = mStates.end(); AnimStateMap::const_iterator state = mStates.begin(); - for(;state != mStates.end();state++) + for(;state != mStates.end();++state) { if(!(state->second.mGroups&(1<mLandData->mHeights[vertexY * ESM::Land::LAND_SIZE + vertexX]; - + const float landHeight = land->mLandData->mHeights[vertexY * ESM::Land::LAND_SIZE + vertexX]; + const float mountainHeight = 15000.f; + const float hillHeight = 2500.f; if (landHeight >= 0) { diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index df95e9f472..e63a101602 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -286,7 +286,7 @@ void NpcAnimation::updateParts(bool forceupdate) { typedef std::multimap BodyPartMapType; static BodyPartMapType sBodyPartMap; - if(sBodyPartMap.size() == 0) + if(sBodyPartMap.empty()) { sBodyPartMap.insert(std::make_pair(ESM::BodyPart::MP_Neck, ESM::PRT_Neck)); sBodyPartMap.insert(std::make_pair(ESM::BodyPart::MP_Chest, ESM::PRT_Cuirass)); @@ -345,7 +345,7 @@ void NpcAnimation::updateParts(bool forceupdate) { if(!parts[bIt->second]) parts[bIt->second] = &*it; - bIt++; + ++bIt; } } continue; @@ -354,7 +354,7 @@ void NpcAnimation::updateParts(bool forceupdate) while(bIt != sBodyPartMap.end() && bIt->first == bodypart.mData.mPart) { parts[bIt->second] = &*it; - bIt++; + ++bIt; } } } diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index 3456e1c16a..b92b17ba80 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -159,7 +159,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool } if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") || - anyTransparency || objects.mParticles.size() > 0) + anyTransparency || !objects.mParticles.empty()) { for(size_t i = 0;i < objects.mEntities.size();i++) { @@ -233,7 +233,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool (*iter)->detachFromParent(); mRenderer.getScene()->destroyEntity(*iter); - iter++; + ++iter; } } diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index cfe5243061..d428aae96f 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -71,7 +71,12 @@ class Objects{ ///< Remove all movable objects from \a node. public: - Objects(OEngine::Render::OgreRenderer& renderer, MWWorld::Fallback* fallback): mRenderer (renderer), mIsStatic(false), mFallback(fallback) {} + Objects(OEngine::Render::OgreRenderer& renderer, MWWorld::Fallback* fallback) + : mRenderer (renderer) + , mIsStatic(false) + , mFallback(fallback) + , mRootNode(NULL) + {} ~Objects(){} void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_); void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool light=false); diff --git a/apps/openmw/mwrender/occlusionquery.cpp b/apps/openmw/mwrender/occlusionquery.cpp index 477e382154..a69511acd7 100644 --- a/apps/openmw/mwrender/occlusionquery.cpp +++ b/apps/openmw/mwrender/occlusionquery.cpp @@ -32,7 +32,7 @@ OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNod mSupported = (mSunTotalAreaQuery != 0) && (mSunVisibleAreaQuery != 0); } - catch (Ogre::Exception e) + catch (Ogre::Exception& e) { mSupported = false; } diff --git a/apps/openmw/mwrender/videoplayer.cpp b/apps/openmw/mwrender/videoplayer.cpp index bc9bef5311..8c557ee998 100644 --- a/apps/openmw/mwrender/videoplayer.cpp +++ b/apps/openmw/mwrender/videoplayer.cpp @@ -1042,6 +1042,8 @@ VideoPlayer::VideoPlayer(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* windo , mNode(NULL) , mAllowSkipping(false) , mWindow(window) + , mWidth(0) + , mHeight(0) { mVideoMaterial = Ogre::MaterialManager::getSingleton().getByName("VideoMaterial", "General"); if (mVideoMaterial.isNull ()) diff --git a/apps/openmw/mwrender/water.hpp b/apps/openmw/mwrender/water.hpp index a21d03ad6a..bc15b4980a 100644 --- a/apps/openmw/mwrender/water.hpp +++ b/apps/openmw/mwrender/water.hpp @@ -43,6 +43,8 @@ namespace MWRender { Reflection(Ogre::SceneManager* sceneManager) : mSceneMgr(sceneManager) , mIsUnderwater(false) + , mCamera(NULL) + , mParentCamera(NULL) {} virtual ~Reflection() {} diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index bba5cb4ade..b8fc9ed477 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -297,7 +297,7 @@ namespace MWScript std::map ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks(); - if (ranks.size()) + if (!ranks.empty()) { std::map::const_iterator it = ranks.begin(); diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index 690b07331c..bb05eaccc5 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -225,7 +225,7 @@ struct OpenAL_Output::StreamThread { if((*iter)->process() == false) iter = mStreams.erase(iter); else - iter++; + ++iter; } mMutex.unlock(); boost::this_thread::sleep(boost::posix_time::milliseconds(50)); @@ -797,7 +797,7 @@ ALuint OpenAL_Output::getBuffer(const std::string &fname) if(nameiter->second == oldbuf) mBufferCache.erase(nameiter++); else - nameiter++; + ++nameiter; } bufsize = 0; @@ -951,9 +951,9 @@ void OpenAL_Output::pauseSounds(int types) if(sound && sound->mSource && (sound->getPlayType()&types)) sources.push_back(sound->mSource); } - iter++; + ++iter; } - if(sources.size() > 0) + if(!sources.empty()) { alSourcePausev(sources.size(), &sources[0]); throwALerror(); @@ -978,9 +978,9 @@ void OpenAL_Output::resumeSounds(int types) if(sound && sound->mSource && (sound->getPlayType()&types)) sources.push_back(sound->mSource); } - iter++; + ++iter; } - if(sources.size() > 0) + if(!sources.empty()) { alSourcePlayv(sources.size(), &sources[0]); throwALerror(); diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index c820a7e161..1c66e0c474 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -173,7 +173,7 @@ namespace MWSound { if(snditer->second.first == ptr && snditer->second.second == id) return snditer->first->isPlaying(); - snditer++; + ++snditer; } return false; } @@ -298,7 +298,7 @@ namespace MWSound mActiveSounds.erase(snditer++); } else - snditer++; + ++snditer; } } @@ -380,7 +380,7 @@ namespace MWSound mActiveSounds.erase(snditer++); } else - snditer++; + ++snditer; } } @@ -395,7 +395,7 @@ namespace MWSound mActiveSounds.erase(snditer++); } else - snditer++; + ++snditer; } } @@ -411,7 +411,7 @@ namespace MWSound mActiveSounds.erase(snditer++); } else - snditer++; + ++snditer; } } @@ -427,7 +427,7 @@ namespace MWSound mActiveSounds.erase(snditer++); } else - snditer++; + ++snditer; } } @@ -490,7 +490,7 @@ namespace MWSound while(soundIter != regn->mSoundList.end()) { total += (int)soundIter->mChance; - soundIter++; + ++soundIter; } if(total == 0) return; @@ -509,7 +509,7 @@ namespace MWSound } pos += soundIter->mChance; - soundIter++; + ++soundIter; } } @@ -557,7 +557,7 @@ namespace MWSound snditer->first->setPosition(objpos); } snditer->first->update(); - snditer++; + ++snditer; } } } @@ -584,7 +584,7 @@ namespace MWSound { snditer->first->mBaseVolume = volumeFromType(snditer->first->getPlayType()); snditer->first->update(); - snditer++; + ++snditer; } if(mMusic) { diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index baf4fea324..44915a7c5b 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -80,7 +80,7 @@ namespace MWWorld { assert (mCell); - if (mCell->mContextList.size() == 0) + if (mCell->mContextList.empty()) return; // this is a dynamically generated cell -> skipping. // Load references from all plugins that do something with this cell. @@ -113,7 +113,7 @@ namespace MWWorld { assert (mCell); - if (mCell->mContextList.size() == 0) + if (mCell->mContextList.empty()) return; // this is a dynamically generated cell -> skipping. // Load references from all plugins that do something with this cell. @@ -174,7 +174,7 @@ namespace MWWorld } // Load moved references, from separately tracked list. - for (ESM::CellRefTracker::const_iterator it = mCell->mLeasedRefs.begin(); it != mCell->mLeasedRefs.end(); it++) + for (ESM::CellRefTracker::const_iterator it = mCell->mLeasedRefs.begin(); it != mCell->mLeasedRefs.end(); ++it) { // Doesn't seem to work in one line... huh? Too sleepy to check... ESM::CellRef &ref = const_cast(*it); diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 6682f072a4..a9d57c128f 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -237,7 +237,7 @@ void MWWorld::ContainerStore::addInitialItem (const std::string& id, const std:: } } - if (!candidates.size()) + if (candidates.empty()) return; std::string item = candidates[std::rand()%candidates.size()]; addInitialItem(item, owner, count, failChance, false); diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index a5b43b4fcd..60fa8d82b4 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -510,7 +510,7 @@ namespace MWWorld bool PhysicsSystem::toggleCollisionMode() { - for(std::map::iterator it = mEngine->mActorMap.begin(); it != mEngine->mActorMap.end();it++) + for(std::map::iterator it = mEngine->mActorMap.begin(); it != mEngine->mActorMap.end();++it) { if (it->first=="player") { diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index ebc7ef03f6..512883f1a3 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -74,7 +74,7 @@ void Store::load(ESM::ESMReader &esm, const std::string &id) // copy list into new cell cell->mContextList = oldcell->mContextList; // merge lists of leased references, use newer data in case of conflict - for (ESM::MovedCellRefTracker::const_iterator it = cell->mMovedRefs.begin(); it != cell->mMovedRefs.end(); it++) { + for (ESM::MovedCellRefTracker::const_iterator it = cell->mMovedRefs.begin(); it != cell->mMovedRefs.end(); ++it) { // remove reference from current leased ref tracker and add it to new cell ESM::MovedCellRefTracker::iterator itold = std::find(oldcell->mMovedRefs.begin(), oldcell->mMovedRefs.end(), it->mRefnum); if (itold != oldcell->mMovedRefs.end()) { diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 4ccd0e6892..8ee71474fc 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -49,7 +49,7 @@ namespace MWWorld SharedIterator operator++(int) { SharedIterator iter = *this; - mIter++; + ++mIter; return iter; } @@ -61,7 +61,7 @@ namespace MWWorld SharedIterator operator--(int) { SharedIterator iter = *this; - mIter--; + --mIter; return iter; } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 2514a5dfe0..d35847f3b0 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -165,8 +165,9 @@ namespace MWWorld ToUTF8::Utf8Encoder* encoder, const std::map& fallbackMap, int mActivationDistanceOverride) : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), mSky (true), mCells (mStore, mEsm), - mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride), - mFallback(fallbackMap), mPlayIntro(0), mTeleportEnabled(true) + mActivationDistanceOverride (mActivationDistanceOverride), + mFallback(fallbackMap), mPlayIntro(0), mTeleportEnabled(true), + mFacedDistance(FLT_MAX) { mPhysics = new PhysicsSystem(renderer); mPhysEngine = mPhysics->getEngine(); @@ -1117,7 +1118,7 @@ namespace MWWorld bool World::castRay (float x1, float y1, float z1, float x2, float y2, float z2) { - Ogre::Vector3 a(x1,y1,z1);std::cout << x1 << " " << x2; + Ogre::Vector3 a(x1,y1,z1); Ogre::Vector3 b(x2,y2,z2); return mPhysics->castRay(a,b,false,true); } @@ -1329,7 +1330,7 @@ namespace MWWorld ++it; } - if (results.size() == 0) + if (results.empty()) { mFacedHandle = ""; mFacedDistance = FLT_MAX; @@ -1717,8 +1718,6 @@ namespace MWWorld void World::getContainersOwnedBy (const MWWorld::Ptr& npc, std::vector& out) { - std::string refId = npc.getCellRef().mRefID; - const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells(); for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt) { diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 252248e406..6d8caad219 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -77,13 +77,6 @@ namespace MWWorld int mActivationDistanceOverride; std::string mFacedHandle; float mFacedDistance; - Ptr mFaced1; - Ptr mFaced2; - std::string mFaced1Name; - std::string mFaced2Name; - float mFaced1Distance; - float mFaced2Distance; - int mNumFacing; std::map mDoorStates; ///< only holds doors that are currently moving. 0 means closing, 1 opening diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 7d3df15908..8f07b9e503 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -130,7 +130,7 @@ public: { std::string normalizedPattern = normalize_path(pattern.begin(), pattern.end()); StringVectorPtr ptr = StringVectorPtr(new StringVector()); - for(index::const_iterator iter = mIndex.begin();iter != mIndex.end();iter++) + for(index::const_iterator iter = mIndex.begin();iter != mIndex.end();++iter) { if(Ogre::StringUtil::match(iter->first, normalizedPattern) || (recursive && Ogre::StringUtil::match(iter->first, "*/"+normalizedPattern))) @@ -169,7 +169,7 @@ public: } else { - for(index::const_iterator iter = mIndex.begin();iter != mIndex.end();iter++) + for(index::const_iterator iter = mIndex.begin();iter != mIndex.end();++iter) { if(Ogre::StringUtil::match(iter->first, normalizedPattern) || (recursive && Ogre::StringUtil::match(iter->first, "*/"+normalizedPattern))) @@ -249,7 +249,7 @@ public: std::string normalizedPattern = normalize_path(pattern.begin(), pattern.end()); const Bsa::BSAFile::FileList &filelist = arc.getList(); StringVectorPtr ptr = StringVectorPtr(new StringVector()); - for(Bsa::BSAFile::FileList::const_iterator iter = filelist.begin();iter != filelist.end();iter++) + for(Bsa::BSAFile::FileList::const_iterator iter = filelist.begin();iter != filelist.end();++iter) { std::string ent = normalize_path(iter->name, iter->name+std::strlen(iter->name)); if(Ogre::StringUtil::match(ent, normalizedPattern) || @@ -266,7 +266,7 @@ public: FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList()); const Bsa::BSAFile::FileList &filelist = arc.getList(); - for(Bsa::BSAFile::FileList::const_iterator iter = filelist.begin();iter != filelist.end();iter++) + for(Bsa::BSAFile::FileList::const_iterator iter = filelist.begin();iter != filelist.end();++iter) { std::string ent = normalize_path(iter->name, iter->name+std::strlen(iter->name)); if(Ogre::StringUtil::match(ent, normalizedPattern) || diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index 40462c4881..3d9ac0a93a 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -52,7 +52,7 @@ namespace Compiler Literals& literals, std::vector& code, bool allowExpression) : Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code), mState (BeginState), mExprParser (errorHandler, context, locals, literals), - mAllowExpression (allowExpression) + mAllowExpression (allowExpression), mButtons(0), mType(0) {} bool LineParser::parseInt (int value, const TokenLoc& loc, Scanner& scanner) diff --git a/components/compiler/scanner.cpp b/components/compiler/scanner.cpp index 08791d0eae..816443c447 100644 --- a/components/compiler/scanner.cpp +++ b/components/compiler/scanner.cpp @@ -509,7 +509,7 @@ namespace Compiler Scanner::Scanner (ErrorHandler& errorHandler, std::istream& inputStream, const Extensions *extensions) : mErrorHandler (errorHandler), mStream (inputStream), mExtensions (extensions), - mPutback (Putback_None) + mPutback (Putback_None), mPutbackCode(0), mPutbackInteger(0), mPutbackFloat(0) { } diff --git a/components/esm/esmreader.cpp b/components/esm/esmreader.cpp index 0a4c1a3fee..51d86a2eeb 100644 --- a/components/esm/esmreader.cpp +++ b/components/esm/esmreader.cpp @@ -18,6 +18,9 @@ ESM_Context ESMReader::getContext() ESMReader::ESMReader() : mBuffer(50*1024) , mRecordFlags(0) + , mIdx(0) + , mGlobalReaderList(NULL) + , mEncoder(NULL) { } diff --git a/components/esm/loadland.cpp b/components/esm/loadland.cpp index 89b48c27d8..60c475040f 100644 --- a/components/esm/loadland.cpp +++ b/components/esm/loadland.cpp @@ -66,10 +66,11 @@ Land::Land() , mX(0) , mY(0) , mEsm(NULL) -// , hasData(false) , mDataTypes(0) , mDataLoaded(false) , mLandData(NULL) + , mPlugin(0) + , mHasData(false) { } diff --git a/components/esm/loadpgrd.cpp b/components/esm/loadpgrd.cpp index 56c2f8c74f..882addcb9d 100644 --- a/components/esm/loadpgrd.cpp +++ b/components/esm/loadpgrd.cpp @@ -56,14 +56,14 @@ void Pathgrid::load(ESMReader &esm) std::vector::const_iterator rawIt = rawConnections.begin(); int pointIndex = 0; mEdges.reserve(edgeCount); - for(PointList::const_iterator it = mPoints.begin(); it != mPoints.end(); it++, pointIndex++) + for(PointList::const_iterator it = mPoints.begin(); it != mPoints.end(); ++it, ++pointIndex) { unsigned char connectionNum = (*it).mConnectionNum; for (int i = 0; i < connectionNum; ++i) { Edge edge; edge.mV0 = pointIndex; edge.mV1 = *rawIt; - rawIt++; + ++rawIt; mEdges.push_back(edge); } } diff --git a/components/interpreter/defines.cpp b/components/interpreter/defines.cpp index 52f892b420..5774c96aec 100644 --- a/components/interpreter/defines.cpp +++ b/components/interpreter/defines.cpp @@ -7,7 +7,7 @@ namespace Interpreter{ - bool Check(const std::string str, const std::string escword, unsigned int* i, unsigned int* start){ + bool Check(const std::string& str, const std::string& escword, unsigned int* i, unsigned int* start){ bool retval = str.find(escword) == 0; if(retval){ (*i) += escword.length(); @@ -18,7 +18,7 @@ namespace Interpreter{ std::vector globals; - bool longerStr(const std::string a, const std::string b){ + bool longerStr(const std::string& a, const std::string& b){ return a.length() > b.length(); } diff --git a/components/interpreter/runtime.cpp b/components/interpreter/runtime.cpp index 8814ca7ffc..bb0dffb87f 100644 --- a/components/interpreter/runtime.cpp +++ b/components/interpreter/runtime.cpp @@ -7,7 +7,7 @@ namespace Interpreter { - Runtime::Runtime() : mContext (0), mCode (0), mPC (0) {} + Runtime::Runtime() : mContext (0), mCode (0), mPC (0), mCodeSize(0) {} int Runtime::getPC() const { diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index a1e2cd8d18..9c4fee7a09 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -75,12 +75,12 @@ btVector3 ManualBulletShapeLoader::getbtVector(Ogre::Vector3 const &v) void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) { - cShape = static_cast(resource); - resourceName = cShape->getName(); - cShape->mCollide = false; + mShape = static_cast(resource); + mResourceName = mShape->getName(); + mShape->mCollide = false; mBoundingBox = NULL; - cShape->mBoxTranslation = Ogre::Vector3(0,0,0); - cShape->mBoxRotation = Ogre::Quaternion::IDENTITY; + mShape->mBoxTranslation = Ogre::Vector3(0,0,0); + mShape->mBoxRotation = Ogre::Quaternion::IDENTITY; mHasShape = false; btTriangleMesh* mesh1 = new btTriangleMesh(); @@ -89,7 +89,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) // of the early stages of development. Right now we WANT to catch // every error as early and intrusively as possible, as it's most // likely a sign of incomplete code rather than faulty input. - Nif::NIFFile::ptr pnif (Nif::NIFFile::create (resourceName.substr(0, resourceName.length()-7))); + Nif::NIFFile::ptr pnif (Nif::NIFFile::create (mResourceName.substr(0, mResourceName.length()-7))); Nif::NIFFile & nif = *pnif.get (); if (nif.numRoots() < 1) { @@ -108,29 +108,29 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) return; } - cShape->mHasCollisionNode = hasRootCollisionNode(node); + mShape->mHasCollisionNode = hasRootCollisionNode(node); //do a first pass handleNode(mesh1, node,0,false,false,false); if(mBoundingBox != NULL) { - cShape->mCollisionShape = mBoundingBox; + mShape->mCollisionShape = mBoundingBox; delete mesh1; } - else if (mHasShape && cShape->mCollide) + else if (mHasShape && mShape->mCollide) { - cShape->mCollisionShape = new TriangleMeshShape(mesh1,true); + mShape->mCollisionShape = new TriangleMeshShape(mesh1,true); } else delete mesh1; //second pass which create a shape for raycasting. - resourceName = cShape->getName(); - cShape->mCollide = false; + mResourceName = mShape->getName(); + mShape->mCollide = false; mBoundingBox = NULL; - cShape->mBoxTranslation = Ogre::Vector3(0,0,0); - cShape->mBoxRotation = Ogre::Quaternion::IDENTITY; + mShape->mBoxTranslation = Ogre::Vector3(0,0,0); + mShape->mBoxRotation = Ogre::Quaternion::IDENTITY; mHasShape = false; btTriangleMesh* mesh2 = new btTriangleMesh(); @@ -139,12 +139,12 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource) if(mBoundingBox != NULL) { - cShape->mRaycastingShape = mBoundingBox; + mShape->mRaycastingShape = mBoundingBox; delete mesh2; } else if (mHasShape) { - cShape->mRaycastingShape = new TriangleMeshShape(mesh2,true); + mShape->mRaycastingShape = new TriangleMeshShape(mesh2,true); } else delete mesh2; @@ -224,18 +224,18 @@ void ManualBulletShapeLoader::handleNode(btTriangleMesh* mesh, const Nif::Node * } } - if ( (isCollisionNode || (!cShape->mHasCollisionNode && !raycasting)) - && (!isMarker || (cShape->mHasCollisionNode && !raycasting))) + if ( (isCollisionNode || (!mShape->mHasCollisionNode && !raycasting)) + && (!isMarker || (mShape->mHasCollisionNode && !raycasting))) { if(node->hasBounds) { - cShape->mBoxTranslation = node->boundPos; - cShape->mBoxRotation = node->boundRot; + mShape->mBoxTranslation = node->boundPos; + mShape->mBoxRotation = node->boundRot; mBoundingBox = new btBoxShape(getbtVector(node->boundXYZ)); } else if(node->recType == Nif::RC_NiTriShape) { - cShape->mCollide = !(flags&0x800); + mShape->mCollide = !(flags&0x800); handleNiTriShape(mesh, static_cast(node), flags, node->getWorldTransform(), raycasting); } } diff --git a/components/nifbullet/bulletnifloader.hpp b/components/nifbullet/bulletnifloader.hpp index 7958f3b7cb..d1e8763053 100644 --- a/components/nifbullet/bulletnifloader.hpp +++ b/components/nifbullet/bulletnifloader.hpp @@ -50,7 +50,13 @@ namespace NifBullet class ManualBulletShapeLoader : public OEngine::Physic::BulletShapeLoader { public: - ManualBulletShapeLoader():resourceGroup("General"){} + ManualBulletShapeLoader() + : mShape(NULL) + , mBoundingBox(NULL) + , mHasShape(false) + { + } + virtual ~ManualBulletShapeLoader(); void warn(const std::string &msg) @@ -94,10 +100,9 @@ private: */ void handleNiTriShape(btTriangleMesh* mesh, const Nif::NiTriShape *shape, int flags, const Ogre::Matrix4 &transform, bool raycasting); - std::string resourceName; - std::string resourceGroup; + std::string mResourceName; - OEngine::Physic::BulletShape* cShape;//current shape + OEngine::Physic::BulletShape* mShape;//current shape btBoxShape *mBoundingBox; bool mHasShape; diff --git a/extern/oics/ICSControl.cpp b/extern/oics/ICSControl.cpp index d43733727f..934c661c93 100644 --- a/extern/oics/ICSControl.cpp +++ b/extern/oics/ICSControl.cpp @@ -30,7 +30,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace ICS { - Control::Control(const std::string name, bool autoChangeDirectionOnLimitsAfterStop, bool autoReverseToInitialValue + Control::Control(const std::string& name, bool autoChangeDirectionOnLimitsAfterStop, bool autoReverseToInitialValue , float initialValue, float stepSize, float stepsPerSeconds, bool axisBindable) : mName(name) , mValue(initialValue) diff --git a/extern/oics/ICSControl.h b/extern/oics/ICSControl.h index 73f1d5494b..7939c86b95 100644 --- a/extern/oics/ICSControl.h +++ b/extern/oics/ICSControl.h @@ -35,7 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace ICS { - class DllExport Control + class DllExport Control { public: @@ -44,7 +44,7 @@ namespace ICS DECREASE = -1, STOP = 0, INCREASE = 1 }; - Control(const std::string name, bool autoChangeDirectionOnLimitsAfterStop = false, bool autoReverseToInitialValue = false, float initialValue = 0.5, float stepSize = 0.1, float stepsPerSeconds = 2.0, bool axisBindable = true); + Control(const std::string& name, bool autoChangeDirectionOnLimitsAfterStop = false, bool autoReverseToInitialValue = false, float initialValue = 0.5, float stepSize = 0.1, float stepsPerSeconds = 2.0, bool axisBindable = true); ~Control(); void setChangingDirection(ControlChangingDirection direction); @@ -104,4 +104,4 @@ namespace ICS } -#endif \ No newline at end of file +#endif diff --git a/extern/sdl4ogre/sdlcursormanager.hpp b/extern/sdl4ogre/sdlcursormanager.hpp index 3dae42f42f..8940220d41 100644 --- a/extern/sdl4ogre/sdlcursormanager.hpp +++ b/extern/sdl4ogre/sdlcursormanager.hpp @@ -31,7 +31,6 @@ namespace SFO typedef std::map CursorMap; CursorMap mCursorMap; - SDL_Cursor* mDebugCursor; std::string mCurrentCursor; bool mEnabled; bool mInitialized; diff --git a/libs/openengine/bullet/BtOgre.cpp b/libs/openengine/bullet/BtOgre.cpp index f504651592..b0fa07fd60 100644 --- a/libs/openengine/bullet/BtOgre.cpp +++ b/libs/openengine/bullet/BtOgre.cpp @@ -293,7 +293,7 @@ namespace BtOgre { { const Ogre::Vector3 sz = getSize(); - assert((sz.x > 0.0) && (sz.y > 0.0) && (sz.y > 0.0) && + assert((sz.x > 0.0) && (sz.y > 0.0) && (sz.z > 0.0) && ("Size of box must be greater than zero on all axes")); btBoxShape* shape = new btBoxShape(Convert::toBullet(sz * 0.5)); @@ -308,7 +308,7 @@ namespace BtOgre { { const Ogre::Vector3 sz = getSize(); - assert((sz.x > 0.0) && (sz.y > 0.0) && (sz.y > 0.0) && + assert((sz.x > 0.0) && (sz.y > 0.0) && (sz.z > 0.0) && ("Size of Cylinder must be greater than zero on all axes")); btCylinderShape* shape = new btCylinderShapeX(Convert::toBullet(sz * 0.5)); diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 114eacfe6b..968d2fbe7d 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -150,7 +150,7 @@ namespace Physic void PhysicActor::enableCollisionBody() { - mEngine->dynamicsWorld->addRigidBody(mBody); + mEngine->dynamicsWorld->addRigidBody(mBody,CollisionType_Actor,CollisionType_World|CollisionType_HeightMap); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -178,6 +178,7 @@ namespace Physic PhysicEngine::PhysicEngine(BulletShapeLoader* shapeLoader) : mDebugActive(0) + , mSceneMgr(NULL) { // Set up the collision configuration and dispatcher collisionConfiguration = new btDefaultCollisionConfiguration(); @@ -620,7 +621,6 @@ namespace Physic std::string name = ""; float d = -1; - float d1 = 10000.; btCollisionWorld::ClosestRayResultCallback resultCallback1(from, to); if(raycastingObjectOnly) resultCallback1.m_collisionFilterMask = CollisionType_Raycasting; @@ -633,8 +633,7 @@ namespace Physic if (resultCallback1.hasHit()) { name = static_cast(*resultCallback1.m_collisionObject).mName; - d1 = resultCallback1.m_closestHitFraction; - d = d1; + d = resultCallback1.m_closestHitFraction;; } return std::pair(name,d); diff --git a/libs/openengine/gui/manager.cpp b/libs/openengine/gui/manager.cpp index 9fd57e2c15..91937d24bc 100644 --- a/libs/openengine/gui/manager.cpp +++ b/libs/openengine/gui/manager.cpp @@ -91,7 +91,11 @@ public: mRenderSystem(nullptr), mIsInitialise(false), mManualRender(false), - mCountBatch(0) + mCountBatch(0), + mVertexProgramNoTexture(NULL), + mFragmentProgramNoTexture(NULL), + mVertexProgramOneTexture(NULL), + mFragmentProgramOneTexture(NULL) { } diff --git a/libs/openengine/input/dispatch_map.hpp b/libs/openengine/input/dispatch_map.hpp deleted file mode 100644 index be13e7f018..0000000000 --- a/libs/openengine/input/dispatch_map.hpp +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef OENGINE_INPUT_DISPATCHMAP_H -#define OENGINE_INPUT_DISPATCHMAP_H - -#include -#include -#include - -namespace OEngine { -namespace Input { - -/** - DispatchMap is a simple connection system that connects incomming - signals with outgoing signals. - - The signals can be connected one-to-one, many-to-one, one-to-many - or many-to-many. - - The dispatch map is completely system agnostic. It is a pure data - structure and all signals are just integer indices. It does not - delegate any actions, but used together with Dispatcher it can be - used to build an event system. - */ -struct DispatchMap -{ - typedef std::set OutList; - typedef std::map InMap; - - typedef OutList::iterator Oit; - typedef InMap::iterator Iit; - - InMap map; - - void bind(int in, int out) - { - map[in].insert(out); - } - - void unbind(int in, int out) - { - Iit it = map.find(in); - if(it != map.end()) - { - it->second.erase(out); - - // If there are no more elements, then remove the entire list - if(it->second.empty()) - map.erase(it); - } - } - - /// Check if a given input is bound to anything - bool isBound(int in) const - { - return map.find(in) != map.end(); - } - - /** - Get the list of outputs bound to the given input. Only call this - on inputs that you know are bound to something. - - The returned set is only intended for immediate iteration. Do not - store references to it. - */ - const OutList &getList(int in) const - { - assert(isBound(in)); - InMap::const_iterator it = map.find(in); - assert(it != map.end()); - const OutList &out = it->second; - assert(!out.empty()); - return out; - } -}; -}} -#endif diff --git a/libs/openengine/input/dispatcher.hpp b/libs/openengine/input/dispatcher.hpp deleted file mode 100644 index a8d480d4b0..0000000000 --- a/libs/openengine/input/dispatcher.hpp +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef OENGINE_INPUT_DISPATCHER_H -#define OENGINE_INPUT_DISPATCHER_H - -#include -#include - -#include - -#include "dispatch_map.hpp" -#include "func_binder.hpp" - -namespace OEngine { -namespace Input { - -struct Dispatcher : Mangle::Input::Event -{ - DispatchMap map; - FuncBinder funcs; - - /** - Constructor. Takes the number of actions and passes it to - FuncBinder. - */ - Dispatcher(int actions) : funcs(actions) {} - - void bind(unsigned int action, int key) - { - assert(action < funcs.getSize()); - map.bind(key, action); - } - void unbind(unsigned int action, int key) - { - assert(action < funcs.getSize()); - map.unbind(key, action); - } - bool isBound(int key) const { return map.isBound(key); } - - /** - Instigate an event. It is translated through the dispatch map and - sent to the function bindings. - */ - typedef DispatchMap::OutList _O; - void event(Type type, int index, const void* p) - { - // No bindings, nothing happens - if(!isBound(index)) - return; - - // Get the mapped actions and execute them - const _O &list = map.getList(index); - _O::const_iterator it; - for(it = list.begin(); it != list.end(); it++) - { - //catch exceptions thrown in the input handlers so that pressing a key - //doesn't cause OpenMw to crash - try - { - funcs.call(*it, p); - } - catch(const std::exception& e) - { - std::cerr << "Exception in input handler: " << e.what() << std::endl; - } - catch(...) - { - std::cerr << "Unknown exception in input handler" << std::endl; - } - - } - } -}; - -// This helps us play nice with Mangle's EventPtr, but it should -// really be defined for all the classes in OEngine. - typedef boost::shared_ptr DispatcherPtr; - -}} -#endif diff --git a/libs/openengine/input/func_binder.hpp b/libs/openengine/input/func_binder.hpp deleted file mode 100644 index a815ba0ceb..0000000000 --- a/libs/openengine/input/func_binder.hpp +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef OENGINE_INPUT_FUNCBINDER_H -#define OENGINE_INPUT_FUNCBINDER_H - -#include -#include -#include -#include - -namespace OEngine { -namespace Input { - -/** - An Action defines the user defined action corresponding to a - binding. - - The first parameter is the action index that invoked this call. You - can assign the same function to multiple actions, and this can help - you keep track of which action was invoked. - - The second parameter is an optional user-defined parameter, - represented by a void pointer. In many cases it is practical to - point this to temporaries (stack values), so make sure not to store - permanent references to it unless you've planning for this on the - calling side as well. - */ -typedef boost::function Action; - -/** - The FuncBinder is a simple struct that binds user-defined indices - to functions. It is useful for binding eg. keyboard events to - specific actions in your program, but can potentially have many - other uses as well. - */ -class FuncBinder -{ - struct FuncBinding - { - std::string name; - Action action; - }; - - std::vector bindings; - -public: - /** - Constructor. Initialize the struct by telling it how many action - indices you intend to bind. - - The indices you use should be 0 <= i < number. - */ - FuncBinder(int number) : bindings(number) {} - - unsigned int getSize() { return bindings.size(); } - - /** - Bind an action to an index. - */ - void bind(int index, Action action, const std::string &name="") - { - assert(index >= 0 && index < (int)bindings.size()); - - FuncBinding &fb = bindings[index]; - fb.action = action; - fb.name = name; - } - - /** - Unbind an index, reverting a previous bind(). - */ - void unbind(int index) - { - assert(index >= 0 && index < (int)bindings.size()); - - bindings[index] = FuncBinding(); - } - - /** - Call a specific action. Takes an optional parameter that is - passed to the action. - */ - void call(int index, const void *p=NULL) const - { - assert(index >= 0 && index < (int)bindings.size()); - - const FuncBinding &fb = bindings[index]; - if(fb.action) fb.action(index, p); - } - - /// Check if a given index is bound to anything - bool isBound(int index) const - { - assert(index >= 0 && index < (int)bindings.size()); - - return !bindings[index].action.empty(); - } - - /// Return the name associated with an action (empty if not bound) - const std::string &getName(int index) const - { - assert(index >= 0 && index < (int)bindings.size()); - - return bindings[index].name; - } -}; -}} -#endif diff --git a/libs/openengine/input/poller.hpp b/libs/openengine/input/poller.hpp deleted file mode 100644 index c544aed529..0000000000 --- a/libs/openengine/input/poller.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef OENGINE_INPUT_POLLER_H -#define OENGINE_INPUT_POLLER_H - -#include "dispatch_map.hpp" -#include - -namespace OEngine { -namespace Input { - -/** The poller is used to check (poll) for keys rather than waiting - for events. */ -struct Poller -{ - DispatchMap map; - Mangle::Input::Driver &input; - - Poller(Mangle::Input::Driver &drv) - : input(drv) {} - - /** Bind or unbind a given action with a key. The action is the first - parameter, the key is the second. - */ - void bind(int in, int out) { map.bind(in, out); } - void unbind(int in, int out) { map.unbind(in, out); } - bool isBound(int in) const { return map.isBound(in); } - - /// Check whether a given action button is currently pressed. - typedef DispatchMap::OutList _O; - bool isDown(int index) const - { - // No bindings, no action - if(!isBound(index)) - return false; - - // Get all the keys bound to this action, and check them. - const _O &list = map.getList(index); - _O::const_iterator it; - for(it = list.begin(); it != list.end(); it++) - // If there's any match, we're good to go. - if(input.isDown(*it)) return true; - - return false; - } -}; -}} -#endif diff --git a/libs/openengine/input/tests/Makefile b/libs/openengine/input/tests/Makefile deleted file mode 100644 index 91a0b26636..0000000000 --- a/libs/openengine/input/tests/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -GCC=g++ - -all: funcbind_test dispatch_map_test sdl_driver_test sdl_binder_test - -funcbind_test: funcbind_test.cpp ../func_binder.hpp - $(GCC) $< -o $@ - -dispatch_map_test: dispatch_map_test.cpp ../dispatch_map.hpp - $(GCC) $< -o $@ - -sdl_driver_test: sdl_driver_test.cpp - $(GCC) $< ../../mangle/input/servers/sdl_driver.cpp -o $@ -I/usr/include/SDL/ -lSDL -I../../ - -sdl_binder_test: sdl_binder_test.cpp - $(GCC) $< ../../mangle/input/servers/sdl_driver.cpp -o $@ -I/usr/include/SDL/ -lSDL -I../../ - -clean: - rm *_test diff --git a/libs/openengine/input/tests/dispatch_map_test.cpp b/libs/openengine/input/tests/dispatch_map_test.cpp deleted file mode 100644 index 5f262494e5..0000000000 --- a/libs/openengine/input/tests/dispatch_map_test.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include -using namespace std; - -#include "../dispatch_map.hpp" - -using namespace OEngine::Input; - -typedef DispatchMap::OutList OutList; -typedef OutList::const_iterator Cit; - -void showList(const DispatchMap::OutList &out) -{ - for(Cit it = out.begin(); - it != out.end(); it++) - { - cout << " " << *it << endl; - } -} - -void showAll(DispatchMap &map) -{ - cout << "\nPrinting everything:\n"; - for(DispatchMap::Iit it = map.map.begin(); - it != map.map.end(); it++) - { - cout << it->first << ":\n"; - showList(map.getList(it->first)); - } -} - -int main() -{ - cout << "Testing the dispatch map\n"; - - DispatchMap dsp; - - dsp.bind(1,9); - dsp.bind(2,-5); - dsp.bind(2,9); - dsp.bind(3,10); - dsp.bind(3,12); - dsp.bind(3,10); - - showAll(dsp); - - dsp.unbind(1,9); - dsp.unbind(5,8); - dsp.unbind(3,11); - dsp.unbind(3,12); - dsp.unbind(3,12); - - showAll(dsp); - return 0; -} diff --git a/libs/openengine/input/tests/funcbind_test.cpp b/libs/openengine/input/tests/funcbind_test.cpp deleted file mode 100644 index bb4ad34e18..0000000000 --- a/libs/openengine/input/tests/funcbind_test.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -using namespace std; - -#include "../func_binder.hpp" - -void f1(int i, const void *p) -{ - cout << " F1 i=" << i << endl; - - if(p) - cout << " Got a nice gift: " - << *((const float*)p) << endl; -} - -void f2(int i, const void *p) -{ - cout << " F2 i=" << i << endl; -} - -using namespace OEngine::Input; - -int main() -{ - cout << "This will test the function binding system\n"; - - FuncBinder bnd(5); - - bnd.bind(0, &f1, "This is action 1"); - bnd.bind(1, &f2); - bnd.bind(2, &f1, "This is action 3"); - bnd.bind(3, &f2, "This is action 4"); - - bnd.unbind(2); - - for(int i=0; i<5; i++) - { - cout << "Calling " << i << ": '" << bnd.getName(i) << "'\n"; - bnd.call(i); - if(!bnd.isBound(i)) cout << " (not bound)\n"; - } - - cout << "\nCalling with parameter:\n"; - float f = 3.1415; - bnd.call(0, &f); - - return 0; -} diff --git a/libs/openengine/input/tests/output/dispatch_map_test.out b/libs/openengine/input/tests/output/dispatch_map_test.out deleted file mode 100644 index 01aa9d9d93..0000000000 --- a/libs/openengine/input/tests/output/dispatch_map_test.out +++ /dev/null @@ -1,18 +0,0 @@ -Testing the dispatch map - -Printing everything: -1: - 9 -2: - -5 - 9 -3: - 10 - 12 - -Printing everything: -2: - -5 - 9 -3: - 10 diff --git a/libs/openengine/input/tests/output/funcbind_test.out b/libs/openengine/input/tests/output/funcbind_test.out deleted file mode 100644 index 862c5c9729..0000000000 --- a/libs/openengine/input/tests/output/funcbind_test.out +++ /dev/null @@ -1,15 +0,0 @@ -This will test the function binding system -Calling 0: 'This is action 1' - F1 i=0 -Calling 1: '' - F2 i=1 -Calling 2: '' - (not bound) -Calling 3: 'This is action 4' - F2 i=3 -Calling 4: '' - (not bound) - -Calling with parameter: - F1 i=0 - Got a nice gift: 3.1415 diff --git a/libs/openengine/input/tests/output/sdl_binder_test.out b/libs/openengine/input/tests/output/sdl_binder_test.out deleted file mode 100644 index fd4eb90e3e..0000000000 --- a/libs/openengine/input/tests/output/sdl_binder_test.out +++ /dev/null @@ -1,4 +0,0 @@ -Hold the Q key to quit: -You are running in script mode, aborting. Run this test with a parameter (any at all) to test the input loop properly - -Bye bye! diff --git a/libs/openengine/input/tests/output/sdl_driver_test.out b/libs/openengine/input/tests/output/sdl_driver_test.out deleted file mode 100644 index fd4eb90e3e..0000000000 --- a/libs/openengine/input/tests/output/sdl_driver_test.out +++ /dev/null @@ -1,4 +0,0 @@ -Hold the Q key to quit: -You are running in script mode, aborting. Run this test with a parameter (any at all) to test the input loop properly - -Bye bye! diff --git a/libs/openengine/input/tests/sdl_binder_test.cpp b/libs/openengine/input/tests/sdl_binder_test.cpp deleted file mode 100644 index 7de5f5d4fd..0000000000 --- a/libs/openengine/input/tests/sdl_binder_test.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include "../dispatcher.hpp" -#include "../poller.hpp" - -using namespace std; -using namespace Mangle::Input; -using namespace OEngine::Input; - -enum Actions - { - A_Quit, - A_Left, - A_Right, - - A_LAST - }; - -bool quit=false; - -void doExit(int,const void*) -{ - quit = true; -} - -void goLeft(int,const void*) -{ - cout << "Going left\n"; -} - -int main(int argc, char** argv) -{ - SDL_Init(SDL_INIT_VIDEO); - SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE); - SDLDriver input; - Dispatcher *disp = new Dispatcher(A_LAST); - Poller poll(input); - - input.setEvent(EventPtr(disp)); - - disp->funcs.bind(A_Quit, &doExit); - disp->funcs.bind(A_Left, &goLeft); - - disp->bind(A_Quit, SDLK_q); - disp->bind(A_Left, SDLK_a); - disp->bind(A_Left, SDLK_LEFT); - - poll.bind(A_Right, SDLK_d); - poll.bind(A_Right, SDLK_RIGHT); - - cout << "Hold the Q key to quit:\n"; - //input->setEvent(&mycb); - while(!quit) - { - input.capture(); - if(poll.isDown(A_Right)) - cout << "We're going right!\n"; - SDL_Delay(20); - - if(argc == 1) - { - cout << "You are running in script mode, aborting. Run this test with a parameter (any at all) to test the input loop properly\n"; - break; - } - } - cout << "\nBye bye!\n"; - - SDL_Quit(); - return 0; -} diff --git a/libs/openengine/input/tests/sdl_driver_test.cpp b/libs/openengine/input/tests/sdl_driver_test.cpp deleted file mode 100644 index 1771bcfe40..0000000000 --- a/libs/openengine/input/tests/sdl_driver_test.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include - -using namespace std; -using namespace Mangle::Input; - -int main(int argc, char** argv) -{ - SDL_Init(SDL_INIT_VIDEO); - SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE); - SDLDriver input; - - cout << "Hold the Q key to quit:\n"; - //input->setEvent(&mycb); - while(!input.isDown(SDLK_q)) - { - input.capture(); - SDL_Delay(20); - - if(argc == 1) - { - cout << "You are running in script mode, aborting. Run this test with a parameter (any at all) to test the input loop properly\n"; - break; - } - } - cout << "\nBye bye!\n"; - - SDL_Quit(); - return 0; -} diff --git a/libs/openengine/input/tests/test.sh b/libs/openengine/input/tests/test.sh deleted file mode 100755 index 2d07708adc..0000000000 --- a/libs/openengine/input/tests/test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -make || exit - -mkdir -p output - -PROGS=*_test - -for a in $PROGS; do - if [ -f "output/$a.out" ]; then - echo "Running $a:" - ./$a | diff output/$a.out - - else - echo "Creating $a.out" - ./$a > "output/$a.out" - git add "output/$a.out" - fi -done diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index cda35b16c4..b3caa29afb 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -108,12 +108,12 @@ void OgreRenderer::loadPlugins() void OgreRenderer::unloadPlugins() { std::vector::iterator ei; - for(ei = mEmitterFactories.begin();ei != mEmitterFactories.end();ei++) + for(ei = mEmitterFactories.begin();ei != mEmitterFactories.end();++ei) OGRE_DELETE (*ei); mEmitterFactories.clear(); std::vector::iterator ai; - for(ai = mAffectorFactories.begin();ai != mAffectorFactories.end();ai++) + for(ai = mAffectorFactories.begin();ai != mAffectorFactories.end();++ai) OGRE_DELETE (*ai); mAffectorFactories.clear();