fixed some cppcheck issues

actorid
scrawl 13 years ago
parent dfac5f26c3
commit c85c794c86

@ -8,7 +8,9 @@
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
MwIniImporter::MwIniImporter() { MwIniImporter::MwIniImporter()
: mVerbose(false)
{
const char *map[][2] = const char *map[][2] =
{ {
{ "fps", "General:Show FPS" }, { "fps", "General:Show FPS" },
@ -124,9 +126,9 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(std::string filename) {
void MwIniImporter::merge(multistrmap &cfg, multistrmap &ini) { void MwIniImporter::merge(multistrmap &cfg, multistrmap &ini) {
multistrmap::iterator cfgIt; multistrmap::iterator cfgIt;
multistrmap::iterator iniIt; 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()) { if((iniIt = ini.find(it->second)) != ini.end()) {
for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); vc++) { for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); ++vc) {
cfg.erase(it->first); cfg.erase(it->first);
insertMultistrmap(cfg, it->first, *vc); insertMultistrmap(cfg, it->first, *vc);
} }
@ -139,9 +141,9 @@ void MwIniImporter::mergeFallback(multistrmap &cfg, multistrmap &ini) {
multistrmap::iterator cfgIt; multistrmap::iterator cfgIt;
multistrmap::iterator iniIt; multistrmap::iterator iniIt;
for(std::vector<std::string>::iterator it=mMergeFallback.begin(); it!=mMergeFallback.end(); it++) { for(std::vector<std::string>::iterator it=mMergeFallback.begin(); it!=mMergeFallback.end(); ++it) {
if((iniIt = ini.find(*it)) != ini.end()) { if((iniIt = ini.find(*it)) != ini.end()) {
for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); vc++) { for(std::vector<std::string>::iterator vc = iniIt->second.begin(); vc != iniIt->second.end(); ++vc) {
std::string value(*it); std::string value(*it);
std::replace( value.begin(), value.end(), ' ', '_' ); std::replace( value.begin(), value.end(), ' ', '_' );
std::replace( value.begin(), value.end(), ':', '_' ); std::replace( value.begin(), value.end(), ':', '_' );
@ -176,7 +178,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) {
break; break;
} }
for(std::vector<std::string>::iterator entry = it->second.begin(); entry!=it->second.end(); entry++) { for(std::vector<std::string>::iterator entry = it->second.begin(); entry!=it->second.end(); ++entry) {
std::string filetype(entry->substr(entry->length()-4, 3)); std::string filetype(entry->substr(entry->length()-4, 3));
std::transform(filetype.begin(), filetype.end(), filetype.begin(), ::tolower); std::transform(filetype.begin(), filetype.end(), filetype.begin(), ::tolower);
@ -194,22 +196,22 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) {
cfg.erase("master"); cfg.erase("master");
cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("master", std::vector<std::string>() ) ); cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("master", std::vector<std::string>() ) );
for(std::vector<std::string>::iterator it=esmFiles.begin(); it!=esmFiles.end(); it++) { for(std::vector<std::string>::iterator it=esmFiles.begin(); it!=esmFiles.end(); ++it) {
cfg["master"].push_back(*it); cfg["master"].push_back(*it);
} }
cfg.erase("plugin"); cfg.erase("plugin");
cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("plugin", std::vector<std::string>() ) ); cfg.insert( std::make_pair<std::string, std::vector<std::string> > ("plugin", std::vector<std::string>() ) );
for(std::vector<std::string>::iterator it=espFiles.begin(); it!=espFiles.end(); it++) { for(std::vector<std::string>::iterator it=espFiles.begin(); it!=espFiles.end(); ++it) {
cfg["plugin"].push_back(*it); cfg["plugin"].push_back(*it);
} }
} }
void MwIniImporter::writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, multistrmap &cfg) { void MwIniImporter::writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, multistrmap &cfg) {
for(multistrmap::iterator it=cfg.begin(); it != cfg.end(); it++) { for(multistrmap::iterator it=cfg.begin(); it != cfg.end(); ++it) {
for(std::vector<std::string>::iterator entry=it->second.begin(); entry != it->second.end(); entry++) { for(std::vector<std::string>::iterator entry=it->second.begin(); entry != it->second.end(); ++entry) {
out << (it->first) << "=" << (*entry) << std::endl; out << (it->first) << "=" << (*entry) << std::endl;
} }
} }

@ -607,7 +607,7 @@ namespace MWDialogue
void DialogueManager::parseText(std::string text) void DialogueManager::parseText(std::string text)
{ {
std::list<std::string>::iterator it; std::list<std::string>::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); size_t pos = find_str_ci(text,*it,0);
if(pos !=std::string::npos) if(pos !=std::string::npos)

@ -117,6 +117,7 @@ CharacterCreation::CharacterCreation(WindowManager* _wm)
, mCreateClassDialog(0) , mCreateClassDialog(0)
, mBirthSignDialog(0) , mBirthSignDialog(0)
, mReviewDialog(0) , mReviewDialog(0)
, mGenerateClassStep(0)
, mWM(_wm) , mWM(_wm)
{ {
mCreationStage = CSE_NotStarted; mCreationStage = CSE_NotStarted;

@ -581,8 +581,7 @@ void CreateClassDialog::onDialogCancel()
void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender) void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
{ {
if (specDialog) delete specDialog;
delete specDialog;
specDialog = new SelectSpecializationDialog(mWindowManager); specDialog = new SelectSpecializationDialog(mWindowManager);
specDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel); specDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
specDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected); specDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected);
@ -613,8 +612,7 @@ void CreateClassDialog::setSpecialization(int id)
void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender) void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
{ {
if (attribDialog) delete attribDialog;
delete attribDialog;
attribDialog = new SelectAttributeDialog(mWindowManager); attribDialog = new SelectAttributeDialog(mWindowManager);
attribDialog->setAffectedWidget(_sender); attribDialog->setAffectedWidget(_sender);
attribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel); attribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
@ -645,8 +643,7 @@ void CreateClassDialog::onAttributeSelected()
void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender) void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
{ {
if (skillDialog) delete skillDialog;
delete skillDialog;
skillDialog = new SelectSkillDialog(mWindowManager); skillDialog = new SelectSkillDialog(mWindowManager);
skillDialog->setAffectedWidget(_sender); skillDialog->setAffectedWidget(_sender);
skillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel); skillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);

@ -268,7 +268,7 @@ namespace MWGui
/* Are there quotation marks? */ /* Are there quotation marks? */
if( tmp.find('"') != string::npos ) { if( tmp.find('"') != string::npos ) {
int numquotes=0; 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 == '"' ) if( *it == '"' )
numquotes++; numquotes++;
} }
@ -311,7 +311,7 @@ namespace MWGui
} }
/* Iterate through the vector. */ /* Iterate through the vector. */
for(vector<string>::iterator it=mNames.begin(); it < mNames.end();it++) { for(vector<string>::iterator it=mNames.begin(); it < mNames.end();++it) {
bool string_different=false; bool string_different=false;
/* Is the string shorter than the input string? If yes skip it. */ /* Is the string shorter than the input string? If yes skip it. */
@ -359,7 +359,7 @@ namespace MWGui
int i = tmp.length(); int i = tmp.length();
for(string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) { for(string::iterator iter=matches.front().begin()+tmp.length(); iter < matches.front().end(); iter++, i++) {
for(vector<string>::iterator it=matches.begin(); it < matches.end();it++) { for(vector<string>::iterator it=matches.begin(); it < matches.end();++it) {
if( tolower((*it)[i]) != tolower(*iter) ) { if( tolower((*it)[i]) != tolower(*iter) ) {
/* Append the longest match to the end of the output string*/ /* Append the longest match to the end of the output string*/
output.append(matches.front().substr( 0, i)); output.append(matches.front().substr( 0, i));

@ -361,9 +361,6 @@ void ContainerBase::drawItems()
int y = 0; int y = 0;
int maxHeight = mItemView->getSize().height - 58; int maxHeight = mItemView->getSize().height - 58;
int index = 0;
bool onlyMagic = false; bool onlyMagic = false;
int categories; int categories;
if (mFilter == Filter_All) if (mFilter == Filter_All)
@ -459,7 +456,6 @@ void ContainerBase::drawItems()
for (std::vector< std::pair<MWWorld::Ptr, ItemState> >::const_iterator it=items.begin(); for (std::vector< std::pair<MWWorld::Ptr, ItemState> >::const_iterator it=items.begin();
it != items.end(); ++it) it != items.end(); ++it)
{ {
index++;
const MWWorld::Ptr* iter = &((*it).first); const MWWorld::Ptr* iter = &((*it).first);
int displayCount = iter->getRefData().getCount(); int displayCount = iter->getRefData().getCount();

@ -156,7 +156,7 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
if (anyService) if (anyService)
topicsList->addSeparator(); topicsList->addSeparator();
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); it++) for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); ++it)
{ {
topicsList->addItem(*it); topicsList->addItem(*it);
} }

@ -131,7 +131,7 @@ void MWGui::JournalWindow::open()
book journal; book journal;
journal.endLine = 0; journal.endLine = 0;
for(std::deque<MWDialogue::StampedJournalEntry>::const_iterator it = MWBase::Environment::get().getJournal()->begin();it!=MWBase::Environment::get().getJournal()->end();it++) for(std::deque<MWDialogue::StampedJournalEntry>::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()); std::string a = it->getText(MWBase::Environment::get().getWorld()->getStore());
journal = formatText(a,journal,10,17); 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::string a = MWBase::Environment::get().getJournal()->begin()->getText(MWBase::Environment::get().getWorld()->getStore());
//std::list<std::string> journal = formatText(a,10,20,1); //std::list<std::string> journal = formatText(a,10,20,1);
bool left = true; bool left = true;
for(std::list<std::string>::iterator it = journal.pages.begin(); it != journal.pages.end();it++) for(std::list<std::string>::iterator it = journal.pages.begin(); it != journal.pages.end();++it)
{ {
if(left) if(left)
{ {

@ -257,7 +257,7 @@ void ReviewDialog::addGroup(const std::string &label, MyGUI::IntCoord &coord1, M
coord2.top += lineHeight; 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* skillNameWidget;
MyGUI::TextBox* skillValueWidget; MyGUI::TextBox* skillValueWidget;
@ -280,7 +280,7 @@ MyGUI::TextBox* ReviewDialog::addValueItem(const std::string text, const std::st
return skillValueWidget; 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; MyGUI::TextBox* skillNameWidget;

@ -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 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 addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
void addGroup(const std::string &label, 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::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 addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
void updateScroller(); void updateScroller();
void updateSkillArea(); void updateSkillArea();

@ -340,7 +340,7 @@ MyGUI::TextBox* StatsWindow::addValueItem(const std::string& text, const std::st
return skillValueWidget; 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; MyGUI::TextBox* skillNameWidget;

@ -47,7 +47,7 @@ namespace MWGui
void addSeparator(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); 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::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 updateScroller();
void setFactions (const FactionList& factions); void setFactions (const FactionList& factions);

@ -142,7 +142,6 @@ void ToolTips::onFrame(float frameDuration)
std::string type = focus->getUserString("ToolTipType"); std::string type = focus->getUserString("ToolTipType");
std::string text = focus->getUserString("ToolTipText"); std::string text = focus->getUserString("ToolTipText");
ToolTipInfo info;
if (type == "") if (type == "")
{ {
return; return;

@ -767,7 +767,7 @@ void MWDynamicStat::setValue(int cur, int max_)
static_cast<MyGUI::TextBox*>(barTextWidget)->setCaption(""); static_cast<MyGUI::TextBox*>(barTextWidget)->setCaption("");
} }
} }
void MWDynamicStat::setTitle(const std::string text) void MWDynamicStat::setTitle(const std::string& text)
{ {
if (textWidget) if (textWidget)
static_cast<MyGUI::TextBox*>(textWidget)->setCaption(text); static_cast<MyGUI::TextBox*>(textWidget)->setCaption(text);

@ -282,7 +282,7 @@ namespace MWGui
MWDynamicStat(); MWDynamicStat();
void setValue(int value, int max); void setValue(int value, int max);
void setTitle(const std::string text); void setTitle(const std::string& text);
int getValue() const { return value; } int getValue() const { return value; }
int getMax() const { return max; } int getMax() const { return max; }

@ -39,7 +39,7 @@
using namespace MWGui; using namespace MWGui;
WindowManager::WindowManager( 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) : mGuiManager(NULL)
, hud(NULL) , hud(NULL)
, map(NULL) , map(NULL)
@ -657,7 +657,7 @@ void WindowManager::pushGuiMode(GuiMode mode)
void WindowManager::popGuiMode() void WindowManager::popGuiMode()
{ {
if (mGuiModes.size()) if (!mGuiModes.empty())
mGuiModes.pop_back(); mGuiModes.pop_back();
bool gameMode = !isGuiMode(); bool gameMode = !isGuiMode();

@ -98,7 +98,7 @@ namespace MWGui
typedef std::vector<Faction> FactionList; typedef std::vector<Faction> FactionList;
typedef std::vector<int> SkillList; typedef std::vector<int> 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(); virtual ~WindowManager();
/** /**
@ -141,7 +141,7 @@ namespace MWGui
updateVisible(); updateVisible();
} }
bool isAllowed(GuiWindow wnd) bool isAllowed(GuiWindow wnd) const
{ {
return allowed & wnd; return allowed & wnd;
} }

@ -68,7 +68,7 @@ ManualObject *Debugging::createPathgridLines(const ESM::Pathgrid *pathgrid)
result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST); result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST);
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->edges.begin(); for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->edges.begin();
it != pathgrid->edges.end(); it != pathgrid->edges.end();
it++) ++it)
{ {
const ESM::Pathgrid::Edge &edge = *it; const ESM::Pathgrid::Edge &edge = *it;
const ESM::Pathgrid::Point &p1 = pathgrid->points[edge.v0], &p2 = pathgrid->points[edge.v1]; 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 // add path grid meshes to already loaded cells
mPathGridRoot = mMwRoot->createChildSceneNode(); 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); enableCellPathgrid(*it);
} }
@ -205,7 +205,7 @@ void Debugging::togglePathgrid()
else else
{ {
// remove path grid meshes from already loaded cells // 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); disableCellPathgrid(*it);
} }

@ -528,7 +528,7 @@ void NpcAnimation::insertFootPart(int type, const std::string &mesh){
} }
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string suffix){ std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string& suffix){
std::string meshNumbered = mesh + getUniqueID(mesh + suffix) + suffix; std::string meshNumbered = mesh + getUniqueID(mesh + suffix) + suffix;
NIFLoader::load(meshNumbered); NIFLoader::load(meshNumbered);

@ -84,7 +84,7 @@ private:
NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv); NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv);
virtual ~NpcAnimation(); virtual ~NpcAnimation();
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename); Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string suffix); std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string& suffix);
void insertFootPart(int type, const std::string &mesh); void insertFootPart(int type, const std::string &mesh);
virtual void runAnimation(float timepassed); virtual void runAnimation(float timepassed);
void updateParts(); void updateParts();

@ -39,7 +39,8 @@ struct LightInfo
LightInfo() : LightInfo() :
flickerVariation(0), resetTime(0.5), 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. ///< Remove all movable objects from \a node.
public: public:
Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer) {} Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer), mIsStatic(false) {}
~Objects(){} ~Objects(){}
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_); void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh); void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);

@ -167,7 +167,7 @@ namespace Ogre
class ShaderHelper : public TerrainAlloc class ShaderHelper : public TerrainAlloc
{ {
public: public:
ShaderHelper() {} ShaderHelper() : mShadowSamplerStartHi(0), mShadowSamplerStartLo(0) {}
virtual ~ShaderHelper() {} virtual ~ShaderHelper() {}
virtual HighLevelGpuProgramPtr generateVertexProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt); virtual HighLevelGpuProgramPtr generateVertexProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt);
virtual HighLevelGpuProgramPtr generateFragmentProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt); virtual HighLevelGpuProgramPtr generateFragmentProgram(const SM2Profile* prof, const Terrain* terrain, TechniqueType tt);

@ -46,7 +46,7 @@ namespace MWSound
public: public:
virtual ~Sound_Output() { } virtual ~Sound_Output() { }
bool isInitialized() { return mInitialized; } bool isInitialized() const { return mInitialized; }
friend class OpenAL_Output; friend class OpenAL_Output;
friend class SoundManager; friend class SoundManager;

@ -32,6 +32,7 @@ namespace MWWorld
PhysicsSystem::~PhysicsSystem() PhysicsSystem::~PhysicsSystem()
{ {
delete mEngine; delete mEngine;
delete playerphysics;
} }
OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine() OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine()

@ -107,7 +107,7 @@ namespace MWWorld
return *mClass; return *mClass;
} }
bool getAutoMove() bool getAutoMove() const
{ {
return mAutoMove; return mAutoMove;
} }

@ -38,7 +38,8 @@ const float WeatherGlobals::mThunderSoundDelay = 0.25;
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering) : WeatherManager::WeatherManager(MWRender::RenderingManager* rendering) :
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0), 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; mRendering = rendering;

@ -93,12 +93,12 @@ class DirArchive: public Ogre::FileSystemArchive
return true; return true;
std::string folder; std::string folder;
int delimiter = 0; //int delimiter = 0;
size_t lastSlash = copy.rfind('/'); size_t lastSlash = copy.rfind('/');
if (lastSlash != std::string::npos) if (lastSlash != std::string::npos)
{ {
folder = copy.substr(0, lastSlash); folder = copy.substr(0, lastSlash);
delimiter = lastSlash+1; //delimiter = lastSlash+1;
} }
std::vector<std::string> current; std::vector<std::string> current;

@ -727,7 +727,7 @@ namespace Compiler
opStopScript (code); 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()) if (id.empty())
{ {
@ -746,7 +746,7 @@ namespace Compiler
opGetSecondsPassed (code); 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()) 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()) 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()) if (id.empty())
{ {

@ -109,15 +109,15 @@ namespace Compiler
void stopScript (CodeContainer& code); 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 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);
} }
} }

@ -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; } 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 getAuthor() { return mCtx.header.author.toString(); }
const std::string getDesc() { return mCtx.header.desc.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 MasterList &getMasters() { return mMasters; }
const NAME &retSubName() { return mCtx.subName; } 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 u; getRecHeader(u); }
void getRecHeader(uint32_t &flags); void getRecHeader(uint32_t &flags);
bool hasMoreRecs() { return mCtx.leftFile > 0; } bool hasMoreRecs() const { return mCtx.leftFile > 0; }
bool hasMoreSubs() { return mCtx.leftRec > 0; } bool hasMoreSubs() const { return mCtx.leftRec > 0; }
/************************************************************************* /*************************************************************************

@ -11,7 +11,7 @@ namespace Files
bool containsVectorString(const StringVector& list, const std::string& str) bool containsVectorString(const StringVector& list, const std::string& str)
{ {
for (StringVector::const_iterator iter = list.begin(); for (StringVector::const_iterator iter = list.begin();
iter != list.end(); iter++) iter != list.end(); ++iter)
{ {
if (*iter == str) if (*iter == str)
return true; return true;
@ -112,7 +112,7 @@ namespace Files
void FileLibrary::printSections() void FileLibrary::printSections()
{ {
for(StringPathContMap::const_iterator mapIter = mMap.begin(); for(StringPathContMap::const_iterator mapIter = mMap.begin();
mapIter != mMap.end(); mapIter++) mapIter != mMap.end(); ++mapIter)
{ {
std::cout << mapIter->first <<std::endl; std::cout << mapIter->first <<std::endl;
} }

@ -684,11 +684,11 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou
Property *pr = &list[i]; Property *pr = &list[i];
if (pr->recType == RC_NiTexturingProperty) if (pr->recType == RC_NiTexturingProperty)
t = (NiTexturingProperty*)pr; t = static_cast<NiTexturingProperty*>(pr);
else if (pr->recType == RC_NiMaterialProperty) else if (pr->recType == RC_NiMaterialProperty)
m = (NiMaterialProperty*)pr; m = static_cast<NiMaterialProperty*>(pr);
else if (pr->recType == RC_NiAlphaProperty) else if (pr->recType == RC_NiAlphaProperty)
a = (NiAlphaProperty*)pr; a = static_cast<NiAlphaProperty*>(pr);
} }
// Texture // Texture

@ -121,8 +121,7 @@ OISDriver::OISDriver(Ogre::RenderWindow *window, bool exclusive)
OISDriver::~OISDriver() OISDriver::~OISDriver()
{ {
// Delete the listener object // Delete the listener object
if(listener) delete listener;
delete listener;
if(inputMgr == NULL) return; if(inputMgr == NULL) return;

@ -11,6 +11,8 @@ namespace Physic
{ {
CMotionState::CMotionState(PhysicEngine* eng,std::string name) CMotionState::CMotionState(PhysicEngine* eng,std::string name)
: isPC(false)
, isNPC(true)
{ {
pEng = eng; pEng = eng;
tr.setIdentity(); tr.setIdentity();

@ -36,7 +36,7 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
void MyGUIManager::shutdown() void MyGUIManager::shutdown()
{ {
if(mGui) delete mGui; delete mGui;
if(mPlatform) if(mPlatform)
{ {
mPlatform->shutdown(); mPlatform->shutdown();

@ -17,11 +17,10 @@ using namespace OEngine::Render;
void OgreRenderer::cleanup() void OgreRenderer::cleanup()
{ {
if (mFader) delete mFader;
delete mFader; mFader = NULL;
if(mRoot) OGRE_DELETE mRoot;
delete mRoot;
mRoot = NULL; mRoot = NULL;
} }
@ -30,7 +29,7 @@ void OgreRenderer::start()
mRoot->startRendering(); mRoot->startRendering();
} }
bool OgreRenderer::loadPlugins() bool OgreRenderer::loadPlugins() const
{ {
#ifdef ENABLE_PLUGIN_GL #ifdef ENABLE_PLUGIN_GL
mGLPlugin = new Ogre::GLPlugin(); mGLPlugin = new Ogre::GLPlugin();
@ -125,7 +124,7 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings&
Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE); 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(mRoot);
assert(mWindow); assert(mWindow);

@ -119,7 +119,7 @@ namespace OEngine
void createWindow(const std::string &title, const WindowSettings& settings); void createWindow(const std::string &title, const WindowSettings& settings);
/// Set up the scene manager, camera and viewport /// 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 fov=55, // Field of view angle
float nearClip=5 // Near clip distance float nearClip=5 // Near clip distance
); );
@ -132,7 +132,7 @@ namespace OEngine
/// Start the main rendering loop /// Start the main rendering loop
void start(); void start();
bool loadPlugins(); bool loadPlugins() const;
void update(float dt); void update(float dt);

Loading…
Cancel
Save