From 8e96871acdbb6a5784e634a0f1481ea63bf1f2d4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 3 Jun 2012 18:40:10 +0200 Subject: [PATCH 01/10] remove something unused --- apps/openmw/mwgui/dialogue.cpp | 3 --- apps/openmw/mwgui/dialogue.hpp | 1 - 2 files changed, 4 deletions(-) diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index ce687424c..17552b09d 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -140,7 +140,6 @@ void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName) setTitle(npcName); topicsList->clear(); - pTopicsText.clear(); history->eraseText(0,history->getTextLength()); updateOptions(); } @@ -169,7 +168,6 @@ void DialogueWindow::removeKeyword(std::string keyWord) if(topicsList->hasItem(keyWord)) { topicsList->removeItem(keyWord); - pTopicsText.erase(keyWord); } topicsList->adjustSize(); } @@ -245,7 +243,6 @@ void DialogueWindow::updateOptions() { //Clear the list of topics topicsList->clear(); - pTopicsText.clear(); history->eraseText(0,history->getTextLength()); pDispositionBar->setProgressRange(100); diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index 8e9aba003..aa66cd579 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -77,7 +77,6 @@ namespace MWGui Widgets::MWList* topicsList; MyGUI::ProgressPtr pDispositionBar; MyGUI::EditPtr pDispositionText; - std::map pTopicsText;// this map links keyword and "real" text. }; } #endif From d56defd4f4c013587ffd628d299b7bdb1196e4b0 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 3 Jun 2012 21:19:48 +0200 Subject: [PATCH 02/10] set input focus to console after selecting objects in console mode --- apps/openmw/mwgui/console.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 2f8a95306..8e6dd8019 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -384,6 +384,7 @@ namespace MWGui setTitle("#{sConsoleTitle} (" + mPtr.getCellRef().refID + ")"); else setTitle("#{sConsoleTitle}"); + MyGUI::InputManager::getInstance().setKeyFocusWidget(command); } void Console::onReferenceUnavailable() From 1ecc6f97ed2529ae7c9b22f1fdd85dd829e7f99d Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 4 Jun 2012 20:56:13 +0200 Subject: [PATCH 03/10] alchemy effect fix --- apps/openmw/mwgui/widgets.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/widgets.hpp b/apps/openmw/mwgui/widgets.hpp index c66bf5dd0..04866b176 100644 --- a/apps/openmw/mwgui/widgets.hpp +++ b/apps/openmw/mwgui/widgets.hpp @@ -54,9 +54,20 @@ namespace MWGui bool operator==(const SpellEffectParams& other) const { - return (other.mEffectID == mEffectID - && other.mSkill == mSkill - && other.mAttribute == mAttribute); + if (mEffectID != other.mEffectID) + return false; + + bool involvesAttribute = (mEffectID == 74 // restore attribute + || mEffectID == 85 // absorb attribute + || mEffectID == 17 // drain attribute + || mEffectID == 79 // fortify attribute + || mEffectID == 22); // damage attribute + bool involvesSkill = (mEffectID == 78 // restore skill + || mEffectID == 89 // absorb skill + || mEffectID == 21 // drain skill + || mEffectID == 83 // fortify skill + || mEffectID == 26); // damage skill + return ((other.mSkill == mSkill) || !involvesSkill) && ((other.mAttribute == mAttribute) && !involvesAttribute); } }; From ea8e3ca1c8809aa5625dc9af4b5d6e05be2b67b2 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 4 Jun 2012 21:09:51 +0200 Subject: [PATCH 04/10] fix item duplication bug when picking up object with the mouse and immediately dropping again --- apps/openmw/mwgui/inventorywindow.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index f75c9afdc..7409aed72 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -311,17 +311,23 @@ namespace MWGui MWBase::Environment::get().getSoundManager()->playSound(sound, 1, 1); int count = object.getRefData().getCount(); - MWWorld::ActionTake action(object); - action.execute(); + + // add to player inventory + // can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object + MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); + MWWorld::Ptr newObject = *MWWorld::Class::get (player).getContainerStore (player).add (object); + // remove from world + MWBase::Environment::get().getWorld()->deleteObject (object); + mDragAndDrop->mIsOnDragAndDrop = true; mDragAndDrop->mDraggedCount = count; std::string path = std::string("icons\\"); - path += MWWorld::Class::get(object).getInventoryIcon(object); + path += MWWorld::Class::get(newObject).getInventoryIcon(newObject); MyGUI::ImageBox* baseWidget = mContainerWidget->createWidget("ImageBox", MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default); baseWidget->detachFromWidget(); baseWidget->attachToWidget(mDragAndDrop->mDragAndDropWidget); - baseWidget->setUserData(object); + baseWidget->setUserData(newObject); mDragAndDrop->mDraggedWidget = baseWidget; ImageBox* image = baseWidget->createWidget("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default); int pos = path.rfind("."); From dfac5f26c3a504a20377271525af89c819b4fde8 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 4 Jun 2012 21:48:20 +0200 Subject: [PATCH 05/10] fixed some issues: - probes were not showing up in inventory category "misc" - lights, probes, lockpicks were not equippable - weapons could not be picked up --- apps/openmw/mwclass/light.cpp | 8 ++++++++ apps/openmw/mwclass/light.hpp | 4 ++++ apps/openmw/mwclass/lockpick.cpp | 8 ++++++++ apps/openmw/mwclass/lockpick.hpp | 4 ++++ apps/openmw/mwclass/probe.cpp | 8 ++++++++ apps/openmw/mwclass/probe.hpp | 4 ++++ apps/openmw/mwgui/container.cpp | 2 +- apps/openmw/mwgui/inventorywindow.cpp | 1 + 8 files changed, 38 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index 12ae517ef..154033433 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -9,6 +9,7 @@ #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" +#include "../mwworld/actionequip.hpp" #include "../mwworld/nullaction.hpp" #include "../mwworld/inventorystore.hpp" #include "../mwworld/world.hpp" @@ -176,4 +177,11 @@ namespace MWClass return info; } + + boost::shared_ptr Light::use (const MWWorld::Ptr& ptr) const + { + MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0); + + return boost::shared_ptr(new MWWorld::ActionEquip(ptr)); + } } diff --git a/apps/openmw/mwclass/light.hpp b/apps/openmw/mwclass/light.hpp index cd963d842..91193dfdc 100644 --- a/apps/openmw/mwclass/light.hpp +++ b/apps/openmw/mwclass/light.hpp @@ -48,6 +48,10 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; ///< Return name of inventory icon. + + virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + const; + ///< Generate action for using via inventory menu }; } diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index 5bb677646..27e292bc0 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -9,6 +9,7 @@ #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" +#include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" #include "../mwworld/world.hpp" #include "../mwgui/window_manager.hpp" @@ -155,4 +156,11 @@ namespace MWClass return info; } + + boost::shared_ptr Lockpick::use (const MWWorld::Ptr& ptr) const + { + MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0); + + return boost::shared_ptr(new MWWorld::ActionEquip(ptr)); + } } diff --git a/apps/openmw/mwclass/lockpick.hpp b/apps/openmw/mwclass/lockpick.hpp index b8683c5e9..26aab584c 100644 --- a/apps/openmw/mwclass/lockpick.hpp +++ b/apps/openmw/mwclass/lockpick.hpp @@ -48,6 +48,10 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; ///< Return name of inventory icon. + + virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + const; + ///< Generate action for using via inventory menu }; } diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index 1e713f0a5..0b256d729 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -9,6 +9,7 @@ #include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" +#include "../mwworld/actionequip.hpp" #include "../mwworld/inventorystore.hpp" #include "../mwworld/world.hpp" #include "../mwgui/window_manager.hpp" @@ -154,4 +155,11 @@ namespace MWClass return info; } + + boost::shared_ptr Probe::use (const MWWorld::Ptr& ptr) const + { + MWBase::Environment::get().getSoundManager()->playSound (getUpSoundId(ptr), 1.0, 1.0); + + return boost::shared_ptr(new MWWorld::ActionEquip(ptr)); + } } diff --git a/apps/openmw/mwclass/probe.hpp b/apps/openmw/mwclass/probe.hpp index 5e0059e14..51b046fda 100644 --- a/apps/openmw/mwclass/probe.hpp +++ b/apps/openmw/mwclass/probe.hpp @@ -48,6 +48,10 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; ///< Return name of inventory icon. + + virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + const; + ///< Generate action for using via inventory menu }; } diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index eb5cbc92b..6ba4923d9 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -384,7 +384,7 @@ void ContainerBase::drawItems() categories = MWWorld::ContainerStore::Type_Miscellaneous + MWWorld::ContainerStore::Type_Book + MWWorld::ContainerStore::Type_Ingredient + MWWorld::ContainerStore::Type_Repair + MWWorld::ContainerStore::Type_Lockpick + MWWorld::ContainerStore::Type_Light - + MWWorld::ContainerStore::Type_Apparatus; + + MWWorld::ContainerStore::Type_Apparatus + MWWorld::ContainerStore::Type_Probe; } else if (mFilter == Filter_Ingredients) categories = MWWorld::ContainerStore::Type_Ingredient; diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 7409aed72..a26a958bd 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -303,6 +303,7 @@ namespace MWGui && (type != typeid(ESM::Tool).name()) && (type != typeid(ESM::Probe).name()) && (type != typeid(ESM::Repair).name()) + && (type != typeid(ESM::Weapon).name()) && (type != typeid(ESM::Potion).name())) return; From c85c794c869080d778b99efe14b6bdc5c4e3c359 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 6 Jun 2012 20:29:30 +0200 Subject: [PATCH 06/10] fixed some cppcheck issues --- apps/mwiniimporter/importer.cpp | 22 ++++++++++++---------- apps/openmw/mwdialogue/dialoguemanager.cpp | 2 +- apps/openmw/mwgui/charactercreation.cpp | 1 + apps/openmw/mwgui/class.cpp | 9 +++------ apps/openmw/mwgui/console.cpp | 6 +++--- apps/openmw/mwgui/container.cpp | 4 ---- apps/openmw/mwgui/dialogue.cpp | 2 +- apps/openmw/mwgui/journalwindow.cpp | 4 ++-- apps/openmw/mwgui/review.cpp | 4 ++-- apps/openmw/mwgui/review.hpp | 4 ++-- apps/openmw/mwgui/stats_window.cpp | 2 +- apps/openmw/mwgui/stats_window.hpp | 2 +- apps/openmw/mwgui/tooltips.cpp | 1 - apps/openmw/mwgui/widgets.cpp | 2 +- apps/openmw/mwgui/widgets.hpp | 2 +- apps/openmw/mwgui/window_manager.cpp | 4 ++-- apps/openmw/mwgui/window_manager.hpp | 4 ++-- apps/openmw/mwrender/debugging.cpp | 6 +++--- apps/openmw/mwrender/npcanimation.cpp | 2 +- apps/openmw/mwrender/npcanimation.hpp | 2 +- apps/openmw/mwrender/objects.hpp | 5 +++-- apps/openmw/mwrender/terrainmaterial.hpp | 2 +- apps/openmw/mwsound/sound_output.hpp | 2 +- apps/openmw/mwworld/physicssystem.cpp | 1 + apps/openmw/mwworld/player.hpp | 2 +- apps/openmw/mwworld/weather.cpp | 3 ++- components/bsa/bsa_archive.cpp | 4 ++-- components/compiler/generator.cpp | 8 ++++---- components/compiler/generator.hpp | 8 ++++---- components/esm/esm_reader.hpp | 12 ++++++------ components/files/filelibrary.cpp | 4 ++-- components/nifogre/ogre_nif_loader.cpp | 6 +++--- libs/mangle/input/servers/ois_driver.cpp | 3 +-- libs/openengine/bullet/CMotionState.cpp | 2 ++ libs/openengine/gui/manager.cpp | 2 +- libs/openengine/ogre/renderer.cpp | 11 +++++------ libs/openengine/ogre/renderer.hpp | 4 ++-- 37 files changed, 81 insertions(+), 83 deletions(-) diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index 5503a7c1a..d396df648 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -8,7 +8,9 @@ #include #include -MwIniImporter::MwIniImporter() { +MwIniImporter::MwIniImporter() + : mVerbose(false) +{ const char *map[][2] = { { "fps", "General:Show FPS" }, @@ -124,9 +126,9 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(std::string filename) { void MwIniImporter::merge(multistrmap &cfg, multistrmap &ini) { multistrmap::iterator cfgIt; multistrmap::iterator iniIt; - for(strmap::iterator it=mMergeMap.begin(); it!=mMergeMap.end(); it++) { + for(strmap::iterator it=mMergeMap.begin(); it!=mMergeMap.end(); ++it) { if((iniIt = ini.find(it->second)) != ini.end()) { - for(std::vector::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); vc++) { + for(std::vector::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); ++vc) { cfg.erase(it->first); insertMultistrmap(cfg, it->first, *vc); } @@ -139,9 +141,9 @@ void MwIniImporter::mergeFallback(multistrmap &cfg, multistrmap &ini) { multistrmap::iterator cfgIt; multistrmap::iterator iniIt; - for(std::vector::iterator it=mMergeFallback.begin(); it!=mMergeFallback.end(); it++) { + for(std::vector::iterator it=mMergeFallback.begin(); it!=mMergeFallback.end(); ++it) { if((iniIt = ini.find(*it)) != ini.end()) { - for(std::vector::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); vc++) { + for(std::vector::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); ++vc) { std::string value(*it); std::replace( value.begin(), value.end(), ' ', '_' ); std::replace( value.begin(), value.end(), ':', '_' ); @@ -176,7 +178,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) { break; } - for(std::vector::iterator entry = it->second.begin(); entry!=it->second.end(); entry++) { + for(std::vector::iterator entry = it->second.begin(); entry!=it->second.end(); ++entry) { std::string filetype(entry->substr(entry->length()-4, 3)); std::transform(filetype.begin(), filetype.end(), filetype.begin(), ::tolower); @@ -194,22 +196,22 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) { cfg.erase("master"); cfg.insert( std::make_pair > ("master", std::vector() ) ); - for(std::vector::iterator it=esmFiles.begin(); it!=esmFiles.end(); it++) { + for(std::vector::iterator it=esmFiles.begin(); it!=esmFiles.end(); ++it) { cfg["master"].push_back(*it); } cfg.erase("plugin"); cfg.insert( std::make_pair > ("plugin", std::vector() ) ); - for(std::vector::iterator it=espFiles.begin(); it!=espFiles.end(); it++) { + for(std::vector::iterator it=espFiles.begin(); it!=espFiles.end(); ++it) { cfg["plugin"].push_back(*it); } } void MwIniImporter::writeToFile(boost::iostreams::stream &out, multistrmap &cfg) { - for(multistrmap::iterator it=cfg.begin(); it != cfg.end(); it++) { - for(std::vector::iterator entry=it->second.begin(); entry != it->second.end(); entry++) { + for(multistrmap::iterator it=cfg.begin(); it != cfg.end(); ++it) { + for(std::vector::iterator entry=it->second.begin(); entry != it->second.end(); ++entry) { out << (it->first) << "=" << (*entry) << std::endl; } } diff --git a/apps/openmw/mwdialogue/dialoguemanager.cpp b/apps/openmw/mwdialogue/dialoguemanager.cpp index 716f472a0..a19356d07 100644 --- a/apps/openmw/mwdialogue/dialoguemanager.cpp +++ b/apps/openmw/mwdialogue/dialoguemanager.cpp @@ -607,7 +607,7 @@ namespace MWDialogue void DialogueManager::parseText(std::string text) { std::list::iterator it; - for(it = actorKnownTopics.begin();it != actorKnownTopics.end();it++) + for(it = actorKnownTopics.begin();it != actorKnownTopics.end();++it) { size_t pos = find_str_ci(text,*it,0); if(pos !=std::string::npos) diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index 31696230c..3f9a94e2d 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -117,6 +117,7 @@ CharacterCreation::CharacterCreation(WindowManager* _wm) , mCreateClassDialog(0) , mBirthSignDialog(0) , mReviewDialog(0) + , mGenerateClassStep(0) , mWM(_wm) { mCreationStage = CSE_NotStarted; diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index a7e5b8674..0961f6327 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -581,8 +581,7 @@ void CreateClassDialog::onDialogCancel() void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender) { - if (specDialog) - delete specDialog; + delete specDialog; specDialog = new SelectSpecializationDialog(mWindowManager); specDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel); specDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected); @@ -613,8 +612,7 @@ void CreateClassDialog::setSpecialization(int id) void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender) { - if (attribDialog) - delete attribDialog; + delete attribDialog; attribDialog = new SelectAttributeDialog(mWindowManager); attribDialog->setAffectedWidget(_sender); attribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel); @@ -645,8 +643,7 @@ void CreateClassDialog::onAttributeSelected() void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender) { - if (skillDialog) - delete skillDialog; + delete skillDialog; skillDialog = new SelectSkillDialog(mWindowManager); skillDialog->setAffectedWidget(_sender); skillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel); diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 8e6dd8019..8115835f4 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -268,7 +268,7 @@ namespace MWGui /* Are there quotation marks? */ if( tmp.find('"') != string::npos ) { int numquotes=0; - for(string::iterator it=tmp.begin(); it < tmp.end(); it++) { + for(string::iterator it=tmp.begin(); it < tmp.end(); ++it) { if( *it == '"' ) numquotes++; } @@ -311,7 +311,7 @@ namespace MWGui } /* Iterate through the vector. */ - for(vector::iterator it=mNames.begin(); it < mNames.end();it++) { + for(vector::iterator it=mNames.begin(); it < mNames.end();++it) { bool string_different=false; /* Is the string shorter than the input string? If yes skip it. */ @@ -359,7 +359,7 @@ namespace MWGui int i = tmp.length(); for(string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) { - for(vector::iterator it=matches.begin(); it < matches.end();it++) { + for(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*/ output.append(matches.front().substr( 0, i)); diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 6ba4923d9..6775fa643 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -361,9 +361,6 @@ void ContainerBase::drawItems() int y = 0; int maxHeight = mItemView->getSize().height - 58; - int index = 0; - - bool onlyMagic = false; int categories; if (mFilter == Filter_All) @@ -459,7 +456,6 @@ void ContainerBase::drawItems() for (std::vector< std::pair >::const_iterator it=items.begin(); it != items.end(); ++it) { - index++; const MWWorld::Ptr* iter = &((*it).first); int displayCount = iter->getRefData().getCount(); diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index 17552b09d..79b2d68ba 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -156,7 +156,7 @@ void DialogueWindow::setKeywords(std::list keyWords) if (anyService) topicsList->addSeparator(); - for(std::list::iterator it = keyWords.begin(); it != keyWords.end(); it++) + for(std::list::iterator it = keyWords.begin(); it != keyWords.end(); ++it) { topicsList->addItem(*it); } diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index e4c38496d..7f9000bc7 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -131,7 +131,7 @@ void MWGui::JournalWindow::open() book journal; journal.endLine = 0; - for(std::deque::const_iterator it = MWBase::Environment::get().getJournal()->begin();it!=MWBase::Environment::get().getJournal()->end();it++) + for(std::deque::const_iterator it = MWBase::Environment::get().getJournal()->begin();it!=MWBase::Environment::get().getJournal()->end();++it) { std::string a = it->getText(MWBase::Environment::get().getWorld()->getStore()); journal = formatText(a,journal,10,17); @@ -141,7 +141,7 @@ void MWGui::JournalWindow::open() //std::string a = MWBase::Environment::get().getJournal()->begin()->getText(MWBase::Environment::get().getWorld()->getStore()); //std::list journal = formatText(a,10,20,1); bool left = true; - for(std::list::iterator it = journal.pages.begin(); it != journal.pages.end();it++) + for(std::list::iterator it = journal.pages.begin(); it != journal.pages.end();++it) { if(left) { diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index 67b6cc24a..97a3a6e15 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -257,7 +257,7 @@ void ReviewDialog::addGroup(const std::string &label, MyGUI::IntCoord &coord1, M coord2.top += lineHeight; } -MyGUI::TextBox* ReviewDialog::addValueItem(const std::string text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) +MyGUI::TextBox* ReviewDialog::addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) { MyGUI::TextBox* skillNameWidget; MyGUI::TextBox* skillValueWidget; @@ -280,7 +280,7 @@ MyGUI::TextBox* ReviewDialog::addValueItem(const std::string text, const std::st return skillValueWidget; } -void ReviewDialog::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) +void ReviewDialog::addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) { MyGUI::TextBox* skillNameWidget; diff --git a/apps/openmw/mwgui/review.hpp b/apps/openmw/mwgui/review.hpp index bae4dc459..6118168d5 100644 --- a/apps/openmw/mwgui/review.hpp +++ b/apps/openmw/mwgui/review.hpp @@ -74,8 +74,8 @@ namespace MWGui void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); - MyGUI::TextBox* addValueItem(const std::string text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); - void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); + MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); + void addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void updateScroller(); void updateSkillArea(); diff --git a/apps/openmw/mwgui/stats_window.cpp b/apps/openmw/mwgui/stats_window.cpp index 75159f4db..3584af7c7 100644 --- a/apps/openmw/mwgui/stats_window.cpp +++ b/apps/openmw/mwgui/stats_window.cpp @@ -340,7 +340,7 @@ MyGUI::TextBox* StatsWindow::addValueItem(const std::string& text, const std::st return skillValueWidget; } -MyGUI::Widget* StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) +MyGUI::Widget* StatsWindow::addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) { MyGUI::TextBox* skillNameWidget; diff --git a/apps/openmw/mwgui/stats_window.hpp b/apps/openmw/mwgui/stats_window.hpp index bbd916585..10b794cc0 100644 --- a/apps/openmw/mwgui/stats_window.hpp +++ b/apps/openmw/mwgui/stats_window.hpp @@ -47,7 +47,7 @@ namespace MWGui void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); - MyGUI::Widget* addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); + MyGUI::Widget* addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void updateScroller(); void setFactions (const FactionList& factions); diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 1f614d56b..7ec444168 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -142,7 +142,6 @@ void ToolTips::onFrame(float frameDuration) std::string type = focus->getUserString("ToolTipType"); std::string text = focus->getUserString("ToolTipText"); - ToolTipInfo info; if (type == "") { return; diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index b85074805..65de7ce0a 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -767,7 +767,7 @@ void MWDynamicStat::setValue(int cur, int max_) static_cast(barTextWidget)->setCaption(""); } } -void MWDynamicStat::setTitle(const std::string text) +void MWDynamicStat::setTitle(const std::string& text) { if (textWidget) static_cast(textWidget)->setCaption(text); diff --git a/apps/openmw/mwgui/widgets.hpp b/apps/openmw/mwgui/widgets.hpp index 04866b176..5d00baf87 100644 --- a/apps/openmw/mwgui/widgets.hpp +++ b/apps/openmw/mwgui/widgets.hpp @@ -282,7 +282,7 @@ namespace MWGui MWDynamicStat(); void setValue(int value, int max); - void setTitle(const std::string text); + void setTitle(const std::string& text); int getValue() const { return value; } int getMax() const { return max; } diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index 800125f27..5b963d3ae 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -39,7 +39,7 @@ using namespace MWGui; WindowManager::WindowManager( - const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath) + const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string& logpath) : mGuiManager(NULL) , hud(NULL) , map(NULL) @@ -657,7 +657,7 @@ void WindowManager::pushGuiMode(GuiMode mode) void WindowManager::popGuiMode() { - if (mGuiModes.size()) + if (!mGuiModes.empty()) mGuiModes.pop_back(); bool gameMode = !isGuiMode(); diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index 19ad7702a..37f30c59a 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -98,7 +98,7 @@ namespace MWGui typedef std::vector FactionList; typedef std::vector SkillList; - WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath); + WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string& logpath); virtual ~WindowManager(); /** @@ -141,7 +141,7 @@ namespace MWGui updateVisible(); } - bool isAllowed(GuiWindow wnd) + bool isAllowed(GuiWindow wnd) const { return allowed & wnd; } diff --git a/apps/openmw/mwrender/debugging.cpp b/apps/openmw/mwrender/debugging.cpp index be8afbae6..9086a9bc4 100644 --- a/apps/openmw/mwrender/debugging.cpp +++ b/apps/openmw/mwrender/debugging.cpp @@ -68,7 +68,7 @@ ManualObject *Debugging::createPathgridLines(const ESM::Pathgrid *pathgrid) result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST); for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->edges.begin(); it != pathgrid->edges.end(); - it++) + ++it) { const ESM::Pathgrid::Edge &edge = *it; const ESM::Pathgrid::Point &p1 = pathgrid->points[edge.v0], &p2 = pathgrid->points[edge.v1]; @@ -197,7 +197,7 @@ void Debugging::togglePathgrid() // add path grid meshes to already loaded cells mPathGridRoot = mMwRoot->createChildSceneNode(); - for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); it++) + for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); ++it) { enableCellPathgrid(*it); } @@ -205,7 +205,7 @@ void Debugging::togglePathgrid() else { // remove path grid meshes from already loaded cells - for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); it++) + for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); ++it) { disableCellPathgrid(*it); } diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index c35fff1ce..5ceafca36 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -528,7 +528,7 @@ void NpcAnimation::insertFootPart(int type, const std::string &mesh){ } -std::pair*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string suffix){ +std::pair*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string& suffix){ std::string meshNumbered = mesh + getUniqueID(mesh + suffix) + suffix; NIFLoader::load(meshNumbered); diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index a37becc26..8f4f8181d 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -84,7 +84,7 @@ private: NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv); virtual ~NpcAnimation(); Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename); - std::pair*> insertFreePart(const std::string &mesh, const std::string suffix); + std::pair*> insertFreePart(const std::string &mesh, const std::string& suffix); void insertFootPart(int type, const std::string &mesh); virtual void runAnimation(float timepassed); void updateParts(); diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index fb26808b9..6132879e6 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -39,7 +39,8 @@ struct LightInfo LightInfo() : flickerVariation(0), resetTime(0.5), - flickerSlowVariation(0), time(0), interior(true) + flickerSlowVariation(0), time(0), interior(true), + type(LT_Normal), radius(1.0) { } }; @@ -68,7 +69,7 @@ class Objects{ ///< Remove all movable objects from \a node. public: - Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer) {} + Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer), mIsStatic(false) {} ~Objects(){} void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_); void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh); diff --git a/apps/openmw/mwrender/terrainmaterial.hpp b/apps/openmw/mwrender/terrainmaterial.hpp index db916bf25..e94e20b7e 100644 --- a/apps/openmw/mwrender/terrainmaterial.hpp +++ b/apps/openmw/mwrender/terrainmaterial.hpp @@ -167,7 +167,7 @@ namespace Ogre class ShaderHelper : public TerrainAlloc { public: - ShaderHelper() {} + ShaderHelper() : mShadowSamplerStartHi(0), mShadowSamplerStartLo(0) {} virtual ~ShaderHelper() {} virtual HighLevelGpuProgramPtr generateVertexProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt); virtual HighLevelGpuProgramPtr generateFragmentProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt); diff --git a/apps/openmw/mwsound/sound_output.hpp b/apps/openmw/mwsound/sound_output.hpp index 7efed8129..100b2208c 100644 --- a/apps/openmw/mwsound/sound_output.hpp +++ b/apps/openmw/mwsound/sound_output.hpp @@ -46,7 +46,7 @@ namespace MWSound public: virtual ~Sound_Output() { } - bool isInitialized() { return mInitialized; } + bool isInitialized() const { return mInitialized; } friend class OpenAL_Output; friend class SoundManager; diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 5598ff3c0..7c1ff31b4 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -32,6 +32,7 @@ namespace MWWorld PhysicsSystem::~PhysicsSystem() { delete mEngine; + delete playerphysics; } OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine() diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 166d4cfee..a5c5ff308 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -107,7 +107,7 @@ namespace MWWorld return *mClass; } - bool getAutoMove() + bool getAutoMove() const { return mAutoMove; } diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 316463f53..3d6547d6a 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -38,7 +38,8 @@ const float WeatherGlobals::mThunderSoundDelay = 0.25; WeatherManager::WeatherManager(MWRender::RenderingManager* rendering) : mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0), - mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0) + mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0), + mRemainingTransitionTime(0), mMonth(0), mDay(0) { mRendering = rendering; diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index fa197d960..d3b75d4ae 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -93,12 +93,12 @@ class DirArchive: public Ogre::FileSystemArchive return true; std::string folder; - int delimiter = 0; + //int delimiter = 0; size_t lastSlash = copy.rfind('/'); if (lastSlash != std::string::npos) { folder = copy.substr(0, lastSlash); - delimiter = lastSlash+1; + //delimiter = lastSlash+1; } std::vector current; diff --git a/components/compiler/generator.cpp b/components/compiler/generator.cpp index ee9876a14..26a80387b 100644 --- a/components/compiler/generator.cpp +++ b/components/compiler/generator.cpp @@ -727,7 +727,7 @@ namespace Compiler opStopScript (code); } - void getDistance (CodeContainer& code, Literals& literals, const std::string id) + void getDistance (CodeContainer& code, Literals& literals, const std::string& id) { if (id.empty()) { @@ -746,7 +746,7 @@ namespace Compiler opGetSecondsPassed (code); } - void getDisabled (CodeContainer& code, Literals& literals, const std::string id) + void getDisabled (CodeContainer& code, Literals& literals, const std::string& id) { if (id.empty()) { @@ -760,7 +760,7 @@ namespace Compiler } } - void enable (CodeContainer& code, Literals& literals, const std::string id) + void enable (CodeContainer& code, Literals& literals, const std::string& id) { if (id.empty()) { @@ -774,7 +774,7 @@ namespace Compiler } } - void disable (CodeContainer& code, Literals& literals, const std::string id) + void disable (CodeContainer& code, Literals& literals, const std::string& id) { if (id.empty()) { diff --git a/components/compiler/generator.hpp b/components/compiler/generator.hpp index fd1f954ca..89e198431 100644 --- a/components/compiler/generator.hpp +++ b/components/compiler/generator.hpp @@ -109,15 +109,15 @@ namespace Compiler void stopScript (CodeContainer& code); - void getDistance (CodeContainer& code, Literals& literals, const std::string id); + void getDistance (CodeContainer& code, Literals& literals, const std::string& id); void getSecondsPassed (CodeContainer& code); - void getDisabled (CodeContainer& code, Literals& literals, const std::string id); + void getDisabled (CodeContainer& code, Literals& literals, const std::string& id); - void enable (CodeContainer& code, Literals& literals, const std::string id); + void enable (CodeContainer& code, Literals& literals, const std::string& id); - void disable (CodeContainer& code, Literals& literals, const std::string id); + void disable (CodeContainer& code, Literals& literals, const std::string& id); } } diff --git a/components/esm/esm_reader.hpp b/components/esm/esm_reader.hpp index 0420f37cd..340482891 100644 --- a/components/esm/esm_reader.hpp +++ b/components/esm/esm_reader.hpp @@ -152,15 +152,15 @@ public: * *************************************************************************/ - int getVer() { return mCtx.header.version; } + int getVer() const { return mCtx.header.version; } float getFVer() { if(mCtx.header.version == VER_12) return 1.2; else return 1.3; } - int getSpecial() { return mSpf; } + int getSpecial() const { return mSpf; } const std::string getAuthor() { return mCtx.header.author.toString(); } const std::string getDesc() { return mCtx.header.desc.toString(); } - const SaveData &getSaveData() { return mSaveData; } + const SaveData &getSaveData() const { return mSaveData; } const MasterList &getMasters() { return mMasters; } const NAME &retSubName() { return mCtx.subName; } - uint32_t getSubSize() { return mCtx.leftSub; } + uint32_t getSubSize() const { return mCtx.leftSub; } /************************************************************************* * @@ -323,8 +323,8 @@ public: void getRecHeader() { uint32_t u; getRecHeader(u); } void getRecHeader(uint32_t &flags); - bool hasMoreRecs() { return mCtx.leftFile > 0; } - bool hasMoreSubs() { return mCtx.leftRec > 0; } + bool hasMoreRecs() const { return mCtx.leftFile > 0; } + bool hasMoreSubs() const { return mCtx.leftRec > 0; } /************************************************************************* diff --git a/components/files/filelibrary.cpp b/components/files/filelibrary.cpp index c11415929..ce67f0c66 100644 --- a/components/files/filelibrary.cpp +++ b/components/files/filelibrary.cpp @@ -11,7 +11,7 @@ namespace Files bool containsVectorString(const StringVector& list, const std::string& str) { for (StringVector::const_iterator iter = list.begin(); - iter != list.end(); iter++) + iter != list.end(); ++iter) { if (*iter == str) return true; @@ -112,7 +112,7 @@ namespace Files void FileLibrary::printSections() { for(StringPathContMap::const_iterator mapIter = mMap.begin(); - mapIter != mMap.end(); mapIter++) + mapIter != mMap.end(); ++mapIter) { std::cout << mapIter->first <recType == RC_NiTexturingProperty) - t = (NiTexturingProperty*)pr; + t = static_cast(pr); else if (pr->recType == RC_NiMaterialProperty) - m = (NiMaterialProperty*)pr; + m = static_cast(pr); else if (pr->recType == RC_NiAlphaProperty) - a = (NiAlphaProperty*)pr; + a = static_cast(pr); } // Texture diff --git a/libs/mangle/input/servers/ois_driver.cpp b/libs/mangle/input/servers/ois_driver.cpp index acca69df4..b8e4f5eb9 100644 --- a/libs/mangle/input/servers/ois_driver.cpp +++ b/libs/mangle/input/servers/ois_driver.cpp @@ -121,8 +121,7 @@ OISDriver::OISDriver(Ogre::RenderWindow *window, bool exclusive) OISDriver::~OISDriver() { // Delete the listener object - if(listener) - delete listener; + delete listener; if(inputMgr == NULL) return; diff --git a/libs/openengine/bullet/CMotionState.cpp b/libs/openengine/bullet/CMotionState.cpp index 5ddef5175..d7746cbc5 100644 --- a/libs/openengine/bullet/CMotionState.cpp +++ b/libs/openengine/bullet/CMotionState.cpp @@ -11,6 +11,8 @@ namespace Physic { CMotionState::CMotionState(PhysicEngine* eng,std::string name) + : isPC(false) + , isNPC(true) { pEng = eng; tr.setIdentity(); diff --git a/libs/openengine/gui/manager.cpp b/libs/openengine/gui/manager.cpp index 1bf8ec325..022c5efb5 100644 --- a/libs/openengine/gui/manager.cpp +++ b/libs/openengine/gui/manager.cpp @@ -36,7 +36,7 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool void MyGUIManager::shutdown() { - if(mGui) delete mGui; + delete mGui; if(mPlatform) { mPlatform->shutdown(); diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index a5eca76ed..fadfa8d8c 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -17,11 +17,10 @@ using namespace OEngine::Render; void OgreRenderer::cleanup() { - if (mFader) - delete mFader; + delete mFader; + mFader = NULL; - if(mRoot) - delete mRoot; + OGRE_DELETE mRoot; mRoot = NULL; } @@ -30,7 +29,7 @@ void OgreRenderer::start() mRoot->startRendering(); } -bool OgreRenderer::loadPlugins() +bool OgreRenderer::loadPlugins() const { #ifdef ENABLE_PLUGIN_GL mGLPlugin = new Ogre::GLPlugin(); @@ -125,7 +124,7 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings& Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE); } -void OgreRenderer::createScene(const std::string camName, float fov, float nearClip) +void OgreRenderer::createScene(const std::string& camName, float fov, float nearClip) { assert(mRoot); assert(mWindow); diff --git a/libs/openengine/ogre/renderer.hpp b/libs/openengine/ogre/renderer.hpp index f4ea8fbc8..f188e2051 100644 --- a/libs/openengine/ogre/renderer.hpp +++ b/libs/openengine/ogre/renderer.hpp @@ -119,7 +119,7 @@ namespace OEngine void createWindow(const std::string &title, const WindowSettings& settings); /// Set up the scene manager, camera and viewport - void createScene(const std::string camName="Camera",// Camera name + void createScene(const std::string& camName="Camera",// Camera name float fov=55, // Field of view angle float nearClip=5 // Near clip distance ); @@ -132,7 +132,7 @@ namespace OEngine /// Start the main rendering loop void start(); - bool loadPlugins(); + bool loadPlugins() const; void update(float dt); From 42e44ac1b5d095f6d0ecd7760b2f4597759bb983 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 6 Jun 2012 21:08:20 +0200 Subject: [PATCH 07/10] fixed some leaks --- apps/openmw/mwrender/renderingmanager.cpp | 4 +++- libs/openengine/bullet/physic.cpp | 15 ++++++++++++--- libs/openengine/bullet/physic.hpp | 10 ++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index a6f10fcd2..a771eb12e 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -97,7 +97,6 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const mTerrainManager = new TerrainManager(mRendering.getScene(), this); - //mSkyManager = 0; mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera()); mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode()); @@ -116,10 +115,13 @@ RenderingManager::~RenderingManager () delete mPlayer; delete mSkyManager; delete mDebugging; + delete mShaderHelper; + delete mShadows; delete mTerrainManager; delete mLocalMap; delete mOcclusionQuery; delete mCompositors; + delete mWater; } MWRender::SkyManager* RenderingManager::getSkyManager() diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index d30d5e9f1..a94434e5b 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -300,7 +300,13 @@ namespace Physic body->collide = true; body->getWorldTransform().setOrigin(btVector3( (x+0.5)*triSize*(sqrtVerts-1), (y+0.5)*triSize*(sqrtVerts-1), (maxh+minh)/2.f)); - addRigidBody(body); + HeightField hf; + hf.mBody = body; + hf.mShape = hfShape; + + mHeightFieldMap [name] = hf; + + dynamicsWorld->addRigidBody(body,COL_WORLD,COL_WORLD|COL_ACTOR_INTERNAL|COL_ACTOR_EXTERNAL); } void PhysicEngine::removeHeightField(int x, int y) @@ -309,8 +315,11 @@ namespace Physic + boost::lexical_cast(x) + "_" + boost::lexical_cast(y); - removeRigidBody(name); - deleteRigidBody(name); + HeightField hf = mHeightFieldMap [name]; + + dynamicsWorld->removeRigidBody(hf.mBody); + delete hf.mShape; + delete hf.mBody; } RigidBody* PhysicEngine::createRigidBody(std::string mesh,std::string name,float scale) diff --git a/libs/openengine/bullet/physic.hpp b/libs/openengine/bullet/physic.hpp index ba241b2b7..811572320 100644 --- a/libs/openengine/bullet/physic.hpp +++ b/libs/openengine/bullet/physic.hpp @@ -15,6 +15,7 @@ class btSequentialImpulseConstraintSolver; class btCollisionDispatcher; class btDiscreteDynamicsWorld; class btKinematicCharacterController; +class btHeightfieldTerrainShape; namespace BtOgre { @@ -115,6 +116,12 @@ namespace Physic bool collide; }; + struct HeightField + { + btHeightfieldTerrainShape* mShape; + RigidBody* mBody; + }; + /** * The PhysicEngine class contain everything which is needed for Physic. * It's needed that Ogre Resources are set up before the PhysicEngine is created. @@ -240,6 +247,9 @@ namespace Physic //the NIF file loader. BulletShapeLoader* mShapeLoader; + typedef std::map HeightFieldContainer; + HeightFieldContainer mHeightFieldMap; + typedef std::map RigidBodyContainer; RigidBodyContainer RigidBodyMap; From 6ec2a2091c6a5d63349542a182cef502fc9ba78a Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 7 Jun 2012 12:16:03 +0200 Subject: [PATCH 08/10] Issue #305: Allow the use of = as a synonym for == --- components/compiler/scanner.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/compiler/scanner.cpp b/components/compiler/scanner.cpp index 080ca7d98..d0397e8cf 100644 --- a/components/compiler/scanner.cpp +++ b/components/compiler/scanner.cpp @@ -368,8 +368,10 @@ namespace Compiler special = S_cmpEQ; else { + special = S_cmpEQ; putback (c); - return false; +// return false; +// Allow = as synonym for ==. \todo optionally disable for post-1.0 scripting improvements. } } else From ff84fbbfa70725daadee5b22d9e73124dd67888a Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 7 Jun 2012 12:36:51 +0200 Subject: [PATCH 09/10] Added DontSaveObject script instruction We are ignoring it for now and unless users protest we will probably keep it that way. --- apps/openmw/mwscript/docs/vmformat.txt | 1 + apps/openmw/mwscript/miscextensions.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index de7248c0c..4423f17cf 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -146,4 +146,5 @@ op 0x200014f: ForceGreeting op 0x2000150: ForceGreeting, explicit reference op 0x2000151: ToggleFullHelp op 0x2000152: Goodbye +op 0x2000153: DontSaveObject (left unimplemented) opcodes 0x2000154-0x3ffffff unused diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 4ba523937..c7569ccdd 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -194,6 +194,17 @@ namespace MWScript } }; + class OpDontSaveObject : public Interpreter::Opcode0 + { + public: + + virtual void execute (Interpreter::Runtime& runtime) + { + // We are ignoring the DontSaveObject statement for now. Probably not worth + /// bothering with. The incompatibility we are creating should be marginal at most. + } + }; + const int opcodeXBox = 0x200000c; const int opcodeOnActivate = 0x200000d; const int opcodeActivate = 0x2000075; @@ -208,6 +219,7 @@ namespace MWScript const int opcodeFadeTo = 0x200013e; const int opcodeToggleWater = 0x2000144; const int opcodeTogglePathgrid = 0x2000146; + const int opcodeDontSaveObject = 0x2000153; void registerExtensions (Compiler::Extensions& extensions) { @@ -229,6 +241,7 @@ namespace MWScript extensions.registerInstruction ("twa", "", opcodeToggleWater); extensions.registerInstruction ("togglepathgrid", "", opcodeTogglePathgrid); extensions.registerInstruction ("tpg", "", opcodeTogglePathgrid); + extensions.registerInstruction ("dontsaveobject", "", opcodeDontSaveObject); } void installOpcodes (Interpreter::Interpreter& interpreter) @@ -247,6 +260,7 @@ namespace MWScript interpreter.installSegment5 (opcodeFadeTo, new OpFadeTo); interpreter.installSegment5 (opcodeTogglePathgrid, new OpTogglePathgrid); interpreter.installSegment5 (opcodeToggleWater, new OpToggleWater); + interpreter.installSegment5 (opcodeDontSaveObject, new OpDontSaveObject); } } } From 447158e9d62540f9386fdc024460e493afbfc7f4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 9 Jun 2012 19:15:11 +0200 Subject: [PATCH 10/10] shutdown crash fix --- apps/openmw/mwrender/renderingmanager.cpp | 2 ++ apps/openmw/mwrender/water.cpp | 3 +++ libs/openengine/ogre/renderer.cpp | 5 +++++ libs/openengine/ogre/renderer.hpp | 1 + 4 files changed, 11 insertions(+) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index a771eb12e..266362f9b 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -112,6 +112,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const RenderingManager::~RenderingManager () { + mRendering.removeWindowEventListener(this); + delete mPlayer; delete mSkyManager; delete mDebugging; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index b4486a0ca..dc9e1fbee 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -114,6 +114,9 @@ Water::~Water() { MeshManager::getSingleton().remove("water"); + if (mReflectionTarget) + mReflectionTexture->getBuffer()->getRenderTarget()->removeListener(this); + mWaterNode->detachObject(mWater); mSceneManager->destroyEntity(mWater); mSceneManager->destroySceneNode(mWaterNode); diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index fadfa8d8c..7c0f88bd7 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -156,6 +156,11 @@ void OgreRenderer::setWindowEventListener(Ogre::WindowEventListener* listener) Ogre::WindowEventUtilities::addWindowEventListener(mWindow, listener); } +void OgreRenderer::removeWindowEventListener(Ogre::WindowEventListener* listener) +{ + Ogre::WindowEventUtilities::removeWindowEventListener(mWindow, listener); +} + void OgreRenderer::setFov(float fov) { mCamera->setFOVy(Degree(fov)); diff --git a/libs/openengine/ogre/renderer.hpp b/libs/openengine/ogre/renderer.hpp index f188e2051..f1520a3db 100644 --- a/libs/openengine/ogre/renderer.hpp +++ b/libs/openengine/ogre/renderer.hpp @@ -106,6 +106,7 @@ namespace OEngine ~OgreRenderer() { cleanup(); } void setWindowEventListener(Ogre::WindowEventListener* listener); + void removeWindowEventListener(Ogre::WindowEventListener* listener); /** Configure the renderer. This will load configuration files and set up the Root and logging classes. */