Fix cppcheck issues

pull/293/head
scrawl 10 years ago
parent 790e0150b1
commit 7252cb63a6

File diff suppressed because it is too large Load Diff

@ -412,7 +412,7 @@ void Record<ESM::Armor>::print()
std::cout << " Armor: " << mData.mData.mArmor << std::endl; std::cout << " Armor: " << mData.mData.mArmor << std::endl;
std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl; std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl;
std::vector<ESM::PartReference>::iterator pit; std::vector<ESM::PartReference>::iterator pit;
for (pit = mData.mParts.mParts.begin(); pit != mData.mParts.mParts.end(); pit++) for (pit = mData.mParts.mParts.begin(); pit != mData.mParts.mParts.end(); ++pit)
{ {
std::cout << " Body Part: " << bodyPartLabel(pit->mPart) std::cout << " Body Part: " << bodyPartLabel(pit->mPart)
<< " (" << (int)(pit->mPart) << ")" << std::endl; << " (" << (int)(pit->mPart) << ")" << std::endl;
@ -484,7 +484,7 @@ void Record<ESM::BirthSign>::print()
std::cout << " Texture: " << mData.mTexture << std::endl; std::cout << " Texture: " << mData.mTexture << std::endl;
std::cout << " Description: " << mData.mDescription << std::endl; std::cout << " Description: " << mData.mDescription << std::endl;
std::vector<std::string>::iterator pit; std::vector<std::string>::iterator pit;
for (pit = mData.mPowers.mList.begin(); pit != mData.mPowers.mList.end(); pit++) for (pit = mData.mPowers.mList.begin(); pit != mData.mPowers.mList.end(); ++pit)
std::cout << " Power: " << *pit << std::endl; std::cout << " Power: " << *pit << std::endl;
} }
@ -554,7 +554,7 @@ void Record<ESM::Clothing>::print()
std::cout << " Value: " << mData.mData.mValue << std::endl; std::cout << " Value: " << mData.mData.mValue << std::endl;
std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl; std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl;
std::vector<ESM::PartReference>::iterator pit; std::vector<ESM::PartReference>::iterator pit;
for (pit = mData.mParts.mParts.begin(); pit != mData.mParts.mParts.end(); pit++) for (pit = mData.mParts.mParts.begin(); pit != mData.mParts.mParts.end(); ++pit)
{ {
std::cout << " Body Part: " << bodyPartLabel(pit->mPart) std::cout << " Body Part: " << bodyPartLabel(pit->mPart)
<< " (" << (int)(pit->mPart) << ")" << std::endl; << " (" << (int)(pit->mPart) << ")" << std::endl;
@ -574,7 +574,7 @@ void Record<ESM::Container>::print()
std::cout << " Flags: " << containerFlags(mData.mFlags) << std::endl; std::cout << " Flags: " << containerFlags(mData.mFlags) << std::endl;
std::cout << " Weight: " << mData.mWeight << std::endl; std::cout << " Weight: " << mData.mWeight << std::endl;
std::vector<ESM::ContItem>::iterator cit; std::vector<ESM::ContItem>::iterator cit;
for (cit = mData.mInventory.mList.begin(); cit != mData.mInventory.mList.end(); cit++) for (cit = mData.mInventory.mList.begin(); cit != mData.mInventory.mList.end(); ++cit)
std::cout << " Inventory: Count: " << boost::format("%4d") % cit->mCount std::cout << " Inventory: Count: " << boost::format("%4d") % cit->mCount
<< " Item: " << cit->mItem.toString() << std::endl; << " Item: " << cit->mItem.toString() << std::endl;
} }
@ -619,12 +619,12 @@ void Record<ESM::Creature>::print()
std::cout << " Gold: " << mData.mData.mGold << std::endl; std::cout << " Gold: " << mData.mData.mGold << std::endl;
std::vector<ESM::ContItem>::iterator cit; std::vector<ESM::ContItem>::iterator cit;
for (cit = mData.mInventory.mList.begin(); cit != mData.mInventory.mList.end(); cit++) for (cit = mData.mInventory.mList.begin(); cit != mData.mInventory.mList.end(); ++cit)
std::cout << " Inventory: Count: " << boost::format("%4d") % cit->mCount std::cout << " Inventory: Count: " << boost::format("%4d") % cit->mCount
<< " Item: " << cit->mItem.toString() << std::endl; << " Item: " << cit->mItem.toString() << std::endl;
std::vector<std::string>::iterator sit; std::vector<std::string>::iterator sit;
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); sit++) for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
std::cout << " Spell: " << *sit << std::endl; std::cout << " Spell: " << *sit << std::endl;
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl; std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
@ -639,7 +639,7 @@ void Record<ESM::Creature>::print()
std::cout << " AI Services:" << boost::format("0x%08X") % mData.mAiData.mServices << std::endl; std::cout << " AI Services:" << boost::format("0x%08X") % mData.mAiData.mServices << std::endl;
std::vector<ESM::AIPackage>::iterator pit; std::vector<ESM::AIPackage>::iterator pit;
for (pit = mData.mAiPackage.mList.begin(); pit != mData.mAiPackage.mList.end(); pit++) for (pit = mData.mAiPackage.mList.begin(); pit != mData.mAiPackage.mList.end(); ++pit)
printAIPackage(*pit); printAIPackage(*pit);
} }
@ -706,7 +706,7 @@ void Record<ESM::Faction>::print()
<< mData.mData.mRankData[i].mFactReaction << std::endl; << mData.mData.mRankData[i].mFactReaction << std::endl;
} }
std::map<std::string, int>::iterator rit; std::map<std::string, int>::iterator rit;
for (rit = mData.mReactions.begin(); rit != mData.mReactions.end(); rit++) for (rit = mData.mReactions.begin(); rit != mData.mReactions.end(); ++rit)
std::cout << " Reaction: " << rit->second << " = " << rit->first << std::endl; std::cout << " Reaction: " << rit->second << " = " << rit->first << std::endl;
} }
@ -763,7 +763,7 @@ void Record<ESM::DialInfo>::print()
std::cout << " Unknown2: " << (int)mData.mData.mUnknown2 << std::endl; std::cout << " Unknown2: " << (int)mData.mData.mUnknown2 << std::endl;
std::vector<ESM::DialInfo::SelectStruct>::iterator sit; std::vector<ESM::DialInfo::SelectStruct>::iterator sit;
for (sit = mData.mSelects.begin(); sit != mData.mSelects.end(); sit++) for (sit = mData.mSelects.begin(); sit != mData.mSelects.end(); ++sit)
std::cout << " Select Rule: " << ruleString(*sit) << std::endl; std::cout << " Select Rule: " << ruleString(*sit) << std::endl;
if (mData.mResultScript != "") if (mData.mResultScript != "")
@ -835,7 +835,7 @@ void Record<ESM::CreatureLevList>::print()
std::cout << " Flags: " << creatureListFlags(mData.mFlags) << std::endl; std::cout << " Flags: " << creatureListFlags(mData.mFlags) << std::endl;
std::cout << " Number of items: " << mData.mList.size() << std::endl; std::cout << " Number of items: " << mData.mList.size() << std::endl;
std::vector<ESM::LeveledListBase::LevelItem>::iterator iit; std::vector<ESM::LeveledListBase::LevelItem>::iterator iit;
for (iit = mData.mList.begin(); iit != mData.mList.end(); iit++) for (iit = mData.mList.begin(); iit != mData.mList.end(); ++iit)
std::cout << " Creature: Level: " << iit->mLevel std::cout << " Creature: Level: " << iit->mLevel
<< " Creature: " << iit->mId << std::endl; << " Creature: " << iit->mId << std::endl;
} }
@ -847,7 +847,7 @@ void Record<ESM::ItemLevList>::print()
std::cout << " Flags: " << itemListFlags(mData.mFlags) << std::endl; std::cout << " Flags: " << itemListFlags(mData.mFlags) << std::endl;
std::cout << " Number of items: " << mData.mList.size() << std::endl; std::cout << " Number of items: " << mData.mList.size() << std::endl;
std::vector<ESM::LeveledListBase::LevelItem>::iterator iit; std::vector<ESM::LeveledListBase::LevelItem>::iterator iit;
for (iit = mData.mList.begin(); iit != mData.mList.end(); iit++) for (iit = mData.mList.begin(); iit != mData.mList.end(); ++iit)
std::cout << " Inventory: Level: " << iit->mLevel std::cout << " Inventory: Level: " << iit->mLevel
<< " Item: " << iit->mId << std::endl; << " Item: " << iit->mId << std::endl;
} }
@ -1031,16 +1031,16 @@ void Record<ESM::NPC>::print()
} }
std::vector<ESM::ContItem>::iterator cit; std::vector<ESM::ContItem>::iterator cit;
for (cit = mData.mInventory.mList.begin(); cit != mData.mInventory.mList.end(); cit++) for (cit = mData.mInventory.mList.begin(); cit != mData.mInventory.mList.end(); ++cit)
std::cout << " Inventory: Count: " << boost::format("%4d") % cit->mCount std::cout << " Inventory: Count: " << boost::format("%4d") % cit->mCount
<< " Item: " << cit->mItem.toString() << std::endl; << " Item: " << cit->mItem.toString() << std::endl;
std::vector<std::string>::iterator sit; std::vector<std::string>::iterator sit;
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); sit++) for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
std::cout << " Spell: " << *sit << std::endl; std::cout << " Spell: " << *sit << std::endl;
std::vector<ESM::NPC::Dest>::iterator dit; std::vector<ESM::NPC::Dest>::iterator dit;
for (dit = mData.mTransport.begin(); dit != mData.mTransport.end(); dit++) for (dit = mData.mTransport.begin(); dit != mData.mTransport.end(); ++dit)
{ {
std::cout << " Destination Position: " std::cout << " Destination Position: "
<< boost::format("%12.3f") % dit->mPos.pos[0] << "," << boost::format("%12.3f") % dit->mPos.pos[0] << ","
@ -1066,7 +1066,7 @@ void Record<ESM::NPC>::print()
std::cout << " AI Services:" << boost::format("0x%08X") % mData.mAiData.mServices << std::endl; std::cout << " AI Services:" << boost::format("0x%08X") % mData.mAiData.mServices << std::endl;
std::vector<ESM::AIPackage>::iterator pit; std::vector<ESM::AIPackage>::iterator pit;
for (pit = mData.mAiPackage.mList.begin(); pit != mData.mAiPackage.mList.end(); pit++) for (pit = mData.mAiPackage.mList.begin(); pit != mData.mAiPackage.mList.end(); ++pit)
printAIPackage(*pit); printAIPackage(*pit);
} }
@ -1140,7 +1140,7 @@ void Record<ESM::Race>::print()
<< mData.mData.mBonus[i].mBonus << std::endl; << mData.mData.mBonus[i].mBonus << std::endl;
std::vector<std::string>::iterator sit; std::vector<std::string>::iterator sit;
for (sit = mData.mPowers.mList.begin(); sit != mData.mPowers.mList.end(); sit++) for (sit = mData.mPowers.mList.begin(); sit != mData.mPowers.mList.end(); ++sit)
std::cout << " Power: " << *sit << std::endl; std::cout << " Power: " << *sit << std::endl;
} }
@ -1164,7 +1164,7 @@ void Record<ESM::Region>::print()
if (mData.mSleepList != "") if (mData.mSleepList != "")
std::cout << " Sleep List: " << mData.mSleepList << std::endl; std::cout << " Sleep List: " << mData.mSleepList << std::endl;
std::vector<ESM::Region::SoundRef>::iterator sit; std::vector<ESM::Region::SoundRef>::iterator sit;
for (sit = mData.mSoundList.begin(); sit != mData.mSoundList.end(); sit++) for (sit = mData.mSoundList.begin(); sit != mData.mSoundList.end(); ++sit)
std::cout << " Sound: " << (int)sit->mChance << " = " << sit->mSound.toString() << std::endl; std::cout << " Sound: " << (int)sit->mChance << " = " << sit->mSound.toString() << std::endl;
} }
@ -1181,12 +1181,12 @@ void Record<ESM::Script>::print()
std::vector<std::string>::iterator vit; std::vector<std::string>::iterator vit;
for (vit = mData.mVarNames.begin(); vit != mData.mVarNames.end(); vit++) for (vit = mData.mVarNames.begin(); vit != mData.mVarNames.end(); ++vit)
std::cout << " Variable: " << *vit << std::endl; std::cout << " Variable: " << *vit << std::endl;
std::cout << " ByteCode: "; std::cout << " ByteCode: ";
std::vector<unsigned char>::iterator cit; std::vector<unsigned char>::iterator cit;
for (cit = mData.mScriptData.begin(); cit != mData.mScriptData.end(); cit++) for (cit = mData.mScriptData.begin(); cit != mData.mScriptData.end(); ++cit)
std::cout << boost::format("%02X") % (int)(*cit); std::cout << boost::format("%02X") % (int)(*cit);
std::cout << std::endl; std::cout << std::endl;

@ -15,6 +15,7 @@ namespace bfs = boost::filesystem;
MwIniImporter::MwIniImporter() MwIniImporter::MwIniImporter()
: mVerbose(false) : mVerbose(false)
, mEncoding(ToUTF8::WINDOWS_1250)
{ {
const char *map[][2] = const char *map[][2] =
{ {
@ -709,8 +710,7 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::string& filenam
continue; continue;
} }
multistrmap::iterator it; if(map.find(key) == map.end()) {
if((it = map.find(key)) == map.end()) {
map.insert( std::make_pair (key, std::vector<std::string>() ) ); map.insert( std::make_pair (key, std::vector<std::string>() ) );
} }
map[key].push_back(value); map[key].push_back(value);
@ -746,8 +746,7 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::string& filenam
std::string key(line.substr(0,pos)); std::string key(line.substr(0,pos));
std::string value(line.substr(pos+1)); std::string value(line.substr(pos+1));
multistrmap::iterator it; if(map.find(key) == map.end()) {
if((it = map.find(key)) == map.end()) {
map.insert( std::make_pair (key, std::vector<std::string>() ) ); map.insert( std::make_pair (key, std::vector<std::string>() ) );
} }
map[key].push_back(value); map[key].push_back(value);

@ -37,6 +37,8 @@ public:
char **get() const { return const_cast<char **>(argv); } char **get() const { return const_cast<char **>(argv); }
private: private:
utf8argv(const utf8argv&);
utf8argv& operator=(const utf8argv&);
const char **argv; const char **argv;
std::vector<std::string> args; std::vector<std::string> args;

@ -103,11 +103,6 @@ namespace CSMDoc
if (state==CSMWorld::RecordBase::State_Modified || if (state==CSMWorld::RecordBase::State_Modified ||
state==CSMWorld::RecordBase::State_ModifiedOnly) state==CSMWorld::RecordBase::State_ModifiedOnly)
{ {
std::string type;
for (int i=0; i<4; ++i)
/// \todo make endianess agnostic (change ESMWriter interface?)
type += reinterpret_cast<const char *> (&mCollection.getRecord (stage).mModified.sRecordId)[i];
mState.getWriter().startRecord (mCollection.getRecord (stage).mModified.sRecordId); mState.getWriter().startRecord (mCollection.getRecord (stage).mModified.sRecordId);
mState.getWriter().writeHNCString ("NAME", mCollection.getId (stage)); mState.getWriter().writeHNCString ("NAME", mCollection.getId (stage));
mCollection.getRecord (stage).mModified.save (mState.getWriter()); mCollection.getRecord (stage).mModified.save (mState.getWriter());

@ -11,9 +11,14 @@ float CSVRender::Navigation::getFactor (bool mouse) const
return factor; return factor;
} }
CSVRender::Navigation::Navigation()
: mFastModeFactor(1)
{
}
CSVRender::Navigation::~Navigation() {} CSVRender::Navigation::~Navigation() {}
void CSVRender::Navigation::setFastModeFactor (float factor) void CSVRender::Navigation::setFastModeFactor (float factor)
{ {
mFastModeFactor = factor; mFastModeFactor = factor;
} }

@ -20,6 +20,7 @@ namespace CSVRender
public: public:
Navigation();
virtual ~Navigation(); virtual ~Navigation();
void setFastModeFactor (float factor); void setFastModeFactor (float factor);

@ -361,11 +361,6 @@ namespace CSVRender
} }
} }
int SceneWidget::getFastFactor() const
{
return mFast ? mFastFactor : 1;
}
void SceneWidget::setLighting (Lighting *lighting) void SceneWidget::setLighting (Lighting *lighting)
{ {
if (mLighting) if (mLighting)

@ -80,8 +80,6 @@ namespace CSVRender
void updateOgreWindow(); void updateOgreWindow();
int getFastFactor() const;
void setLighting (Lighting *lighting); void setLighting (Lighting *lighting);
///< \attention The ownership of \a lighting is not transferred to *this. ///< \attention The ownership of \a lighting is not transferred to *this.

@ -38,7 +38,7 @@ void CSVWorld::DataDisplayDelegate::buildPixmaps ()
} }
} }
void CSVWorld::DataDisplayDelegate::setIconSize(const QSize size) void CSVWorld::DataDisplayDelegate::setIconSize(const QSize& size)
{ {
mIconSize = size; mIconSize = size;
buildPixmaps(); buildPixmaps();

@ -50,7 +50,7 @@ namespace CSVWorld
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
/// pass a QSize defining height / width of icon. Default is QSize (16,16). /// pass a QSize defining height / width of icon. Default is QSize (16,16).
void setIconSize (const QSize icon); void setIconSize (const QSize& icon);
/// offset the horizontal position of the icon from the left edge of the cell. Default is 3 pixels. /// offset the horizontal position of the icon from the left edge of the cell. Default is 3 pixels.
void setIconLeftOffset (int offset); void setIconLeftOffset (int offset);

@ -127,7 +127,6 @@ static int (*cc_user_info)(char*, char*);
static void gdb_info(pid_t pid) static void gdb_info(pid_t pid)
{ {
char respfile[64]; char respfile[64];
char cmd_buf[128];
FILE *f; FILE *f;
int fd; int fd;
@ -156,6 +155,7 @@ static void gdb_info(pid_t pid)
fclose(f); fclose(f);
/* Run gdb and print process info. */ /* Run gdb and print process info. */
char cmd_buf[128];
snprintf(cmd_buf, sizeof(cmd_buf), "gdb --quiet --batch --command=%s", respfile); snprintf(cmd_buf, sizeof(cmd_buf), "gdb --quiet --batch --command=%s", respfile);
printf("Executing: %s\n", cmd_buf); printf("Executing: %s\n", cmd_buf);
fflush(stdout); fflush(stdout);

@ -62,7 +62,6 @@ void validate(boost::any &v, std::vector<std::string> const &tokens, FallbackMap
FallbackMap *map = boost::any_cast<FallbackMap>(&v); FallbackMap *map = boost::any_cast<FallbackMap>(&v);
std::map<std::string,std::string>::iterator mapIt;
for(std::vector<std::string>::const_iterator it=tokens.begin(); it != tokens.end(); ++it) for(std::vector<std::string>::const_iterator it=tokens.begin(); it != tokens.end(); ++it)
{ {
int sep = it->find(","); int sep = it->find(",");
@ -76,7 +75,7 @@ void validate(boost::any &v, std::vector<std::string> const &tokens, FallbackMap
std::string key(it->substr(0,sep)); std::string key(it->substr(0,sep));
std::string value(it->substr(sep+1)); std::string value(it->substr(sep+1));
if((mapIt = map->mMap.find(key)) == map->mMap.end()) if(map->mMap.find(key) == map->mMap.end())
{ {
map->mMap.insert(std::make_pair (key,value)); map->mMap.insert(std::make_pair (key,value));
} }

@ -225,7 +225,6 @@ namespace MWBase
virtual void showCrosshair(bool show) = 0; virtual void showCrosshair(bool show) = 0;
virtual bool getSubtitlesEnabled() = 0; virtual bool getSubtitlesEnabled() = 0;
virtual void toggleHud() = 0;
virtual bool toggleGui() = 0; virtual bool toggleGui() = 0;
virtual void disallowMouse() = 0; virtual void disallowMouse() = 0;

@ -1188,13 +1188,6 @@ namespace MWClass
+ shield; + shield;
} }
void Npc::adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const
{
y = 0;
x = 0;
}
void Npc::adjustScale(const MWWorld::Ptr &ptr, float &scale) const void Npc::adjustScale(const MWWorld::Ptr &ptr, float &scale) const
{ {
MWWorld::LiveCellRef<ESM::NPC> *ref = MWWorld::LiveCellRef<ESM::NPC> *ref =

@ -139,8 +139,6 @@ namespace MWClass
virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType, float extraFactor=1.f) const; virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType, float extraFactor=1.f) const;
///< Inform actor \a ptr that a skill use has succeeded. ///< Inform actor \a ptr that a skill use has succeeded.
virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const;
virtual bool isEssential (const MWWorld::Ptr& ptr) const; virtual bool isEssential (const MWWorld::Ptr& ptr) const;
///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable) ///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable)

@ -729,10 +729,10 @@ namespace MWDialogue
{ {
std::vector<HyperTextToken> result; std::vector<HyperTextToken> result;
MyGUI::UString utext(text); MyGUI::UString utext(text);
size_t pos_begin, pos_end, iteration_pos = 0; size_t pos_end, iteration_pos = 0;
for(;;) for(;;)
{ {
pos_begin = utext.find('@', iteration_pos); size_t pos_begin = utext.find('@', iteration_pos);
if (pos_begin != std::string::npos) if (pos_begin != std::string::npos)
pos_end = utext.find('#', pos_begin); pos_end = utext.find('#', pos_begin);
@ -758,12 +758,12 @@ namespace MWDialogue
size_t RemovePseudoAsterisks(std::string& phrase) size_t RemovePseudoAsterisks(std::string& phrase)
{ {
size_t pseudoAsterisksCount = 0; size_t pseudoAsterisksCount = 0;
const char specialPseudoAsteriskCharacter = 127;
if( !phrase.empty() ) if( !phrase.empty() )
{ {
std::string::reverse_iterator rit = phrase.rbegin(); std::string::reverse_iterator rit = phrase.rbegin();
const char specialPseudoAsteriskCharacter = 127;
while( rit != phrase.rend() && *rit == specialPseudoAsteriskCharacter ) while( rit != phrase.rend() && *rit == specialPseudoAsteriskCharacter )
{ {
pseudoAsterisksCount++; pseudoAsterisksCount++;

@ -277,7 +277,6 @@ namespace MWGui
InfoBoxDialog::InfoBoxDialog() InfoBoxDialog::InfoBoxDialog()
: WindowModal("openmw_infobox.layout") : WindowModal("openmw_infobox.layout")
, mCurrentButton(-1)
{ {
getWidget(mTextBox, "TextBox"); getWidget(mTextBox, "TextBox");
getWidget(mText, "Text"); getWidget(mText, "Text");
@ -306,7 +305,6 @@ namespace MWGui
MyGUI::Gui::getInstance().destroyWidget(*it); MyGUI::Gui::getInstance().destroyWidget(*it);
} }
this->mButtons.clear(); this->mButtons.clear();
mCurrentButton = -1;
// TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget // TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget
MyGUI::Button* button; MyGUI::Button* button;
@ -336,11 +334,6 @@ namespace MWGui
center(); center();
} }
int InfoBoxDialog::getChosenButton() const
{
return mCurrentButton;
}
void InfoBoxDialog::onButtonClicked(MyGUI::Widget* _sender) void InfoBoxDialog::onButtonClicked(MyGUI::Widget* _sender)
{ {
std::vector<MyGUI::Button*>::const_iterator end = mButtons.end(); std::vector<MyGUI::Button*>::const_iterator end = mButtons.end();
@ -349,7 +342,6 @@ namespace MWGui
{ {
if (*it == _sender) if (*it == _sender)
{ {
mCurrentButton = i;
eventButtonSelected(i); eventButtonSelected(i);
return; return;
} }

@ -24,7 +24,6 @@ namespace MWGui
void setButtons(ButtonList &buttons); void setButtons(ButtonList &buttons);
virtual void open(); virtual void open();
int getChosenButton() const;
// Events // Events
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int; typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
@ -41,7 +40,6 @@ namespace MWGui
void fitToText(MyGUI::TextBox* widget); void fitToText(MyGUI::TextBox* widget);
void layoutVertically(MyGUI::Widget* widget, int margin); void layoutVertically(MyGUI::Widget* widget, int margin);
int mCurrentButton;
MyGUI::Widget* mTextBox; MyGUI::Widget* mTextBox;
MyGUI::TextBox* mText; MyGUI::TextBox* mText;
MyGUI::Widget* mButtonBar; MyGUI::Widget* mButtonBar;

@ -155,11 +155,6 @@ namespace MWGui
mCommandLine->setFontName(fntName); mCommandLine->setFontName(fntName);
} }
void Console::clearHistory()
{
mHistory->setCaption("");
}
void Console::print(const std::string &msg) void Console::print(const std::string &msg)
{ {
mHistory->addText(msg); mHistory->addText(msg);

@ -48,8 +48,6 @@ namespace MWGui
void onResChange(int width, int height); void onResChange(int width, int height);
void clearHistory();
// Print a message to the console. Messages may contain color // Print a message to the console. Messages may contain color
// code, eg. "#FFFFFF this is white". // code, eg. "#FFFFFF this is white".
void print(const std::string &msg); void print(const std::string &msg);

@ -125,10 +125,10 @@ namespace MWGui
// We need this copy for when @# hyperlinks are replaced // We need this copy for when @# hyperlinks are replaced
std::string text = mText; std::string text = mText;
size_t pos_begin, pos_end; size_t pos_end;
for(;;) for(;;)
{ {
pos_begin = text.find('@'); size_t pos_begin = text.find('@');
if (pos_begin != std::string::npos) if (pos_begin != std::string::npos)
pos_end = text.find('#', pos_begin); pos_end = text.find('#', pos_begin);

@ -183,10 +183,9 @@ namespace MWGui
paper->setNeedMouseFocus(false); paper->setNeedMouseFocus(false);
BookTextParser parser(markup); BookTextParser parser(markup);
BookTextParser::Events event;
for (;;) for (;;)
{ {
event = parser.next(); BookTextParser::Events event = parser.next();
if (event == BookTextParser::Event_BrTag || event == BookTextParser::Event_PTag) if (event == BookTextParser::Event_BrTag || event == BookTextParser::Event_PTag)
continue; continue;

@ -36,7 +36,8 @@ namespace MWGui
Misc::StringUtils::toLower(currentGMSTID); Misc::StringUtils::toLower(currentGMSTID);
// Don't bother checking this GMST if it's not a sMagicBound* one. // Don't bother checking this GMST if it's not a sMagicBound* one.
if (currentGMSTID.find("smagicbound") != 0) const std::string& toFind = "smagicbound";
if (currentGMSTID.compare(0, toFind.length(), toFind) != 0)
continue; continue;
// All sMagicBound* GMST's should be of type string // All sMagicBound* GMST's should be of type string

@ -113,10 +113,10 @@ struct JournalViewModelImpl : JournalViewModel
utf8text = getText (); utf8text = getText ();
size_t pos_begin, pos_end; size_t pos_end = 0;
for(;;) for(;;)
{ {
pos_begin = utf8text.find('@'); size_t pos_begin = utf8text.find('@');
if (pos_begin != std::string::npos) if (pos_begin != std::string::npos)
pos_end = utf8text.find('#', pos_begin); pos_end = utf8text.find('#', pos_begin);
@ -223,15 +223,6 @@ struct JournalViewModelImpl : JournalViewModel
} }
} }
void visitQuestName (QuestId questId, boost::function <void (Utf8Span)> visitor) const
{
MWDialogue::Quest const * quest = reinterpret_cast <MWDialogue::Quest const *> (questId);
std::string name = quest->getName ();
visitor (toUtf8Span (name));
}
template <typename iterator_t> template <typename iterator_t>
struct JournalEntryImpl : BaseEntry <iterator_t, JournalEntry> struct JournalEntryImpl : BaseEntry <iterator_t, JournalEntry>
{ {
@ -301,11 +292,6 @@ struct JournalViewModelImpl : JournalViewModel
} }
} }
void visitTopics (boost::function <void (TopicId, Utf8Span)> visitor) const
{
throw std::runtime_error ("not implemented");
}
void visitTopicName (TopicId topicId, boost::function <void (Utf8Span)> visitor) const void visitTopicName (TopicId topicId, boost::function <void (Utf8Span)> visitor) const
{ {
MWDialogue::Topic const & topic = * reinterpret_cast <MWDialogue::Topic const *> (topicId); MWDialogue::Topic const & topic = * reinterpret_cast <MWDialogue::Topic const *> (topicId);

@ -67,9 +67,6 @@ namespace MWGui
/// returns true if their are no journal entries to display /// returns true if their are no journal entries to display
virtual bool isEmpty () const = 0; virtual bool isEmpty () const = 0;
/// provides access to the name of the quest with the specified identifier
virtual void visitQuestName (TopicId topicId, boost::function <void (Utf8Span)> visitor) const = 0;
/// walks the active and optionally completed, quests providing the name /// walks the active and optionally completed, quests providing the name
virtual void visitQuestNames (bool active_only, boost::function <void (const std::string&)> visitor) const = 0; virtual void visitQuestNames (bool active_only, boost::function <void (const std::string&)> visitor) const = 0;

@ -393,18 +393,6 @@ namespace
popBook (); popBook ();
} }
void showList (char const * listId, char const * pageId, Book book)
{
std::pair <int, int> size = book->getSize ();
getPage (pageId)->showPage (book, 0);
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
getWidget <MyGUI::ScrollView> (listId)->setVisibleVScroll(false);
getWidget <MyGUI::ScrollView> (listId)->setCanvasSize (size.first, size.second);
getWidget <MyGUI::ScrollView> (listId)->setVisibleVScroll(true);
}
void notifyIndexLinkClicked (MWGui::TypesetBook::InteractiveId character) void notifyIndexLinkClicked (MWGui::TypesetBook::InteractiveId character)
{ {
setVisible (LeftTopicIndex, false); setVisible (LeftTopicIndex, false);

@ -140,7 +140,7 @@ namespace MWGui
// Vanilla uses thief.dds for custom classes. // Vanilla uses thief.dds for custom classes.
// Choosing Stealth specialization and Speed/Agility as attributes, if possible. Otherwise fall back to first class found. // Choosing Stealth specialization and Speed/Agility as attributes, if possible. Otherwise fall back to first class found.
MWWorld::SharedIterator<ESM::Class> it = world->getStore().get<ESM::Class>().begin(); MWWorld::SharedIterator<ESM::Class> it = world->getStore().get<ESM::Class>().begin();
for(; it != world->getStore().get<ESM::Class>().end(); it++) for(; it != world->getStore().get<ESM::Class>().end(); ++it)
{ {
if(it->mData.mIsPlayable && it->mData.mSpecialization == 2 && it->mData.mAttribute[0] == 4 && it->mData.mAttribute[1] == 3) if(it->mData.mIsPlayable && it->mData.mSpecialization == 2 && it->mData.mAttribute[0] == 4 && it->mData.mAttribute[1] == 3)
break; break;

@ -139,11 +139,6 @@ namespace MWGui
return false; return false;
} }
void MessageBoxManager::setMessageBoxSpeed (int speed)
{
mMessageBoxSpeed = speed;
}
int MessageBoxManager::readPressedButton () int MessageBoxManager::readPressedButton ()
{ {
int pressed = mLastButtonPressed; int pressed = mLastButtonPressed;
@ -218,7 +213,6 @@ namespace MWGui
MyGUI::IntSize gameWindowSize = MyGUI::RenderManager::getInstance().getViewSize(); MyGUI::IntSize gameWindowSize = MyGUI::RenderManager::getInstance().getViewSize();
int biggestButtonWidth = 0; int biggestButtonWidth = 0;
int buttonWidth = 0;
int buttonsWidth = 0; int buttonsWidth = 0;
int buttonsHeight = 0; int buttonsHeight = 0;
int buttonHeight = 0; int buttonHeight = 0;
@ -241,7 +235,7 @@ namespace MWGui
if (buttonsWidth != 0) if (buttonsWidth != 0)
buttonsWidth += buttonLeftPadding; buttonsWidth += buttonLeftPadding;
buttonWidth = button->getTextSize().width + 2*buttonPadding; int buttonWidth = button->getTextSize().width + 2*buttonPadding;
buttonsWidth += buttonWidth; buttonsWidth += buttonWidth;
buttonHeight = button->getTextSize().height + 2*buttonPadding; buttonHeight = button->getTextSize().height + 2*buttonPadding;

@ -34,7 +34,6 @@ namespace MWGui
void clear(); void clear();
bool removeMessageBox (MessageBox *msgbox); bool removeMessageBox (MessageBox *msgbox);
void setMessageBoxSpeed (int speed);
int readPressedButton (); int readPressedButton ();

@ -393,7 +393,6 @@ namespace MWGui
if (mCurrentRaceId.empty()) if (mCurrentRaceId.empty())
return; return;
Widgets::MWSpellPtr spellPowerWidget;
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18); MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18);
@ -405,7 +404,7 @@ namespace MWGui
for (int i = 0; it != end; ++it) for (int i = 0; it != end; ++it)
{ {
const std::string &spellpower = *it; const std::string &spellpower = *it;
spellPowerWidget = mSpellPowerList->createWidget<Widgets::MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("SpellPower") + boost::lexical_cast<std::string>(i)); Widgets::MWSpellPtr spellPowerWidget = mSpellPowerList->createWidget<Widgets::MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("SpellPower") + boost::lexical_cast<std::string>(i));
spellPowerWidget->setSpellId(spellpower); spellPowerWidget->setSpellId(spellpower);
spellPowerWidget->setUserString("ToolTipType", "Spell"); spellPowerWidget->setUserString("ToolTipType", "Spell");
spellPowerWidget->setUserString("Spell", spellpower); spellPowerWidget->setUserString("Spell", spellpower);

@ -362,8 +362,7 @@ namespace MWGui
void SettingsWindow::onShaderModeToggled(MyGUI::Widget* _sender) void SettingsWindow::onShaderModeToggled(MyGUI::Widget* _sender)
{ {
std::string val = _sender->castType<MyGUI::Button>()->getCaption(); std::string val = hlslGlsl();
val = hlslGlsl();
_sender->castType<MyGUI::Button>()->setCaption(val); _sender->castType<MyGUI::Button>()->setCaption(val);

@ -39,6 +39,7 @@ namespace MWGui
EditEffectDialog::EditEffectDialog() EditEffectDialog::EditEffectDialog()
: WindowModal("openmw_edit_effect.layout") : WindowModal("openmw_edit_effect.layout")
, mEditing(false) , mEditing(false)
, mMagicEffect(NULL)
{ {
getWidget(mCancelButton, "CancelButton"); getWidget(mCancelButton, "CancelButton");
getWidget(mOkButton, "OkButton"); getWidget(mOkButton, "OkButton");
@ -181,7 +182,7 @@ namespace MWGui
{ {
mAreaBox->setPosition(mAreaBox->getPosition().left, curY); mAreaBox->setPosition(mAreaBox->getPosition().left, curY);
mAreaBox->setVisible (true); mAreaBox->setVisible (true);
curY += mAreaBox->getSize().height; //curY += mAreaBox->getSize().height;
} }
} }

@ -158,8 +158,6 @@ namespace MWGui
MyGUI::Button* mCancelButton; MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPriceLabel; MyGUI::TextBox* mPriceLabel;
Widgets::MWEffectList* mUsedEffectsList;
ESM::Spell mSpell; ESM::Spell mSpell;
}; };

@ -225,11 +225,10 @@ namespace MWGui
const ESM::Spell *spell = store.get<ESM::Spell>().search(mId); const ESM::Spell *spell = store.get<ESM::Spell>().search(mId);
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found"); MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
MWSpellEffectPtr effect = NULL;
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end(); std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != end; ++it) for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != end; ++it)
{ {
effect = creator->createWidget<MWSpellEffect>("MW_EffectImage", coord, MyGUI::Align::Default); MWSpellEffectPtr effect = creator->createWidget<MWSpellEffect>("MW_EffectImage", coord, MyGUI::Align::Default);
SpellEffectParams params; SpellEffectParams params;
params.mEffectID = it->mEffectID; params.mEffectID = it->mEffectID;
params.mSkill = it->mSkill; params.mSkill = it->mSkill;
@ -565,22 +564,6 @@ namespace MWGui
} }
} }
void MWScrollBar::setEnableRepeat(bool enable)
{
mEnableRepeat = enable;
}
bool MWScrollBar::getEnableRepeat()
{
return mEnableRepeat;
}
void MWScrollBar::getRepeat(float &trigger, float &step)
{
trigger = mRepeatTriggerTime;
step = mRepeatStepTime;
}
void MWScrollBar::setRepeat(float trigger, float step) void MWScrollBar::setRepeat(float trigger, float step)
{ {
mRepeatTriggerTime = trigger; mRepeatTriggerTime = trigger;

@ -307,9 +307,6 @@ namespace MWGui
MWScrollBar(); MWScrollBar();
virtual ~MWScrollBar(); virtual ~MWScrollBar();
void setEnableRepeat(bool enable);
bool getEnableRepeat();
void getRepeat(float &trigger, float &step);
void setRepeat(float trigger, float step); void setRepeat(float trigger, float step);
protected: protected:

@ -1348,12 +1348,6 @@ namespace MWGui
return mSubtitlesEnabled; return mSubtitlesEnabled;
} }
void WindowManager::toggleHud ()
{
mHudEnabled = !mHudEnabled;
mHud->setVisible (mHudEnabled);
}
bool WindowManager::toggleGui() bool WindowManager::toggleGui()
{ {
mGuiEnabled = !mGuiEnabled; mGuiEnabled = !mGuiEnabled;
@ -1669,7 +1663,7 @@ namespace MWGui
WindowModal* WindowManager::getCurrentModal() const WindowModal* WindowManager::getCurrentModal() const
{ {
if(mCurrentModals.size() > 0) if(!mCurrentModals.empty())
return mCurrentModals.top(); return mCurrentModals.top();
else else
return NULL; return NULL;
@ -1679,7 +1673,7 @@ namespace MWGui
{ {
// Only remove the top if it matches the current pointer. A lot of things hide their visibility before showing it, // Only remove the top if it matches the current pointer. A lot of things hide their visibility before showing it,
//so just popping the top would cause massive issues. //so just popping the top would cause massive issues.
if(mCurrentModals.size() > 0) if(!mCurrentModals.empty())
if(input == mCurrentModals.top()) if(input == mCurrentModals.top())
mCurrentModals.pop(); mCurrentModals.pop();
} }

@ -222,7 +222,6 @@ namespace MWGui
virtual void showCrosshair(bool show); virtual void showCrosshair(bool show);
virtual bool getSubtitlesEnabled(); virtual bool getSubtitlesEnabled();
virtual void toggleHud();
/// Turn visibility of *all* GUI elements on or off (HUD and all windows, except the console) /// Turn visibility of *all* GUI elements on or off (HUD and all windows, except the console)
virtual bool toggleGui(); virtual bool toggleGui();

@ -1232,14 +1232,14 @@ namespace MWMechanics
} }
static float sneakTimer = 0.f; // times update of sneak icon static float sneakTimer = 0.f; // times update of sneak icon
static float sneakSkillTimer = 0.f; // times sneak skill progress from "avoid notice"
// if player is in sneak state see if anyone detects him // if player is in sneak state see if anyone detects him
if (player.getClass().getCreatureStats(player).getMovementFlag(MWMechanics::CreatureStats::Flag_Sneak)) if (player.getClass().getCreatureStats(player).getMovementFlag(MWMechanics::CreatureStats::Flag_Sneak))
{ {
static float sneakSkillTimer = 0.f; // times sneak skill progress from "avoid notice"
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const int radius = esmStore.get<ESM::GameSetting>().find("fSneakUseDist")->getInt(); const int radius = esmStore.get<ESM::GameSetting>().find("fSneakUseDist")->getInt();
bool detected = false;
static float fSneakUseDelay = esmStore.get<ESM::GameSetting>().find("fSneakUseDelay")->getFloat(); static float fSneakUseDelay = esmStore.get<ESM::GameSetting>().find("fSneakUseDelay")->getFloat();
@ -1251,6 +1251,8 @@ namespace MWMechanics
// Set when an NPC is within line of sight and distance, but is still unaware. Used for skill progress. // Set when an NPC is within line of sight and distance, but is still unaware. Used for skill progress.
bool avoidedNotice = false; bool avoidedNotice = false;
bool detected = false;
for (PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter) for (PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
{ {
if (iter->first == player) // not the player if (iter->first == player) // not the player
@ -1418,7 +1420,7 @@ namespace MWMechanics
std::list<MWWorld::Ptr> Actors::getActorsFollowing(const MWWorld::Ptr& actor) std::list<MWWorld::Ptr> Actors::getActorsFollowing(const MWWorld::Ptr& actor)
{ {
std::list<MWWorld::Ptr> list; std::list<MWWorld::Ptr> list;
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();iter++) for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
{ {
const MWWorld::Class &cls = iter->first.getClass(); const MWWorld::Class &cls = iter->first.getClass();
CreatureStats &stats = cls.getCreatureStats(iter->first); CreatureStats &stats = cls.getCreatureStats(iter->first);
@ -1450,7 +1452,7 @@ namespace MWMechanics
getObjectsInRange(position, getObjectsInRange(position,
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fAlarmRadius")->getFloat(), MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fAlarmRadius")->getFloat(),
neighbors); //only care about those within the alarm disance neighbors); //only care about those within the alarm disance
for(std::vector<MWWorld::Ptr>::iterator iter(neighbors.begin());iter != neighbors.end();iter++) for(std::vector<MWWorld::Ptr>::iterator iter(neighbors.begin());iter != neighbors.end();++iter)
{ {
const MWWorld::Class &cls = iter->getClass(); const MWWorld::Class &cls = iter->getClass();
CreatureStats &stats = cls.getCreatureStats(*iter); CreatureStats &stats = cls.getCreatureStats(*iter);

@ -35,8 +35,6 @@ namespace MWMechanics
private: private:
std::string mObjectId; std::string mObjectId;
int mCellX;
int mCellY;
}; };
} }
#endif // GAME_MWMECHANICS_AIACTIVATE_H #endif // GAME_MWMECHANICS_AIACTIVATE_H

@ -64,7 +64,7 @@ bool MWMechanics::AiAvoidDoor::execute (const MWWorld::Ptr& actor,float duration
// Make all nearby actors also avoid the door // Make all nearby actors also avoid the door
std::vector<MWWorld::Ptr> actors; std::vector<MWWorld::Ptr> actors;
MWBase::Environment::get().getMechanicsManager()->getActorsInRange(Ogre::Vector3(pos.pos[0],pos.pos[1],pos.pos[2]),100,actors); MWBase::Environment::get().getMechanicsManager()->getActorsInRange(Ogre::Vector3(pos.pos[0],pos.pos[1],pos.pos[2]),100,actors);
for(std::vector<MWWorld::Ptr>::iterator it = actors.begin(); it != actors.end(); it++) { for(std::vector<MWWorld::Ptr>::iterator it = actors.begin(); it != actors.end(); ++it) {
if(*it != MWBase::Environment::get().getWorld()->getPlayerPtr()) { //Not the player if(*it != MWBase::Environment::get().getWorld()->getPlayerPtr()) { //Not the player
MWMechanics::AiSequence& seq = it->getClass().getCreatureStats(*it).getAiSequence(); MWMechanics::AiSequence& seq = it->getClass().getCreatureStats(*it).getAiSequence();
if(seq.getTypeId() != MWMechanics::AiPackage::TypeIdAvoidDoor) { //Only add it once if(seq.getTypeId() != MWMechanics::AiPackage::TypeIdAvoidDoor) { //Only add it once

@ -301,18 +301,20 @@ namespace MWMechanics
if (!target.isEmpty() && target.getClass().getCreatureStats(target).getAttribute(effect.mAttribute).getModified() <= 0) if (!target.isEmpty() && target.getClass().getCreatureStats(target).getAttribute(effect.mAttribute).getModified() <= 0)
return 0.f; return 0.f;
{ {
const float attributePriorities[ESM::Attribute::Length] = {
1.f, // Strength
0.5, // Intelligence
0.6, // Willpower
0.7, // Agility
0.5, // Speed
0.8, // Endurance
0.7, // Personality
0.3 // Luck
};
if (effect.mAttribute >= 0 && effect.mAttribute < ESM::Attribute::Length) if (effect.mAttribute >= 0 && effect.mAttribute < ESM::Attribute::Length)
{
const float attributePriorities[ESM::Attribute::Length] = {
1.f, // Strength
0.5, // Intelligence
0.6, // Willpower
0.7, // Agility
0.5, // Speed
0.8, // Endurance
0.7, // Personality
0.3 // Luck
};
rating *= attributePriorities[effect.mAttribute]; rating *= attributePriorities[effect.mAttribute];
}
} }
break; break;

@ -54,6 +54,7 @@ namespace MWMechanics
, mCellY(std::numeric_limits<int>::max()) , mCellY(std::numeric_limits<int>::max())
, mCellId(escort->mCellId) , mCellId(escort->mCellId)
, mRemainingDuration(escort->mRemainingDuration) , mRemainingDuration(escort->mRemainingDuration)
, mMaxDist(450)
{ {
} }

@ -69,7 +69,6 @@ namespace MWMechanics
PathFinder mPathFinder; PathFinder mPathFinder;
ObstacleCheck mObstacleCheck; ObstacleCheck mObstacleCheck;
float mDoorCheckDuration;
float mTimer; float mTimer;
float mStuckTimer; float mStuckTimer;

@ -41,8 +41,6 @@ namespace MWMechanics
private: private:
int mTargetActorId; // The actor to pursue int mTargetActorId; // The actor to pursue
int mCellX;
int mCellY;
}; };
} }
#endif #endif

@ -31,9 +31,11 @@ void AiSequence::copy (const AiSequence& sequence)
AiSequence::AiSequence() : mDone (false), mLastAiPackage(-1) {} AiSequence::AiSequence() : mDone (false), mLastAiPackage(-1) {}
AiSequence::AiSequence (const AiSequence& sequence) : mDone (false) AiSequence::AiSequence (const AiSequence& sequence)
{ {
copy (sequence); copy (sequence);
mDone = sequence.mDone;
mLastAiPackage = sequence.mLastAiPackage;
} }
AiSequence& AiSequence::operator= (const AiSequence& sequence) AiSequence& AiSequence::operator= (const AiSequence& sequence)
@ -43,6 +45,7 @@ AiSequence& AiSequence::operator= (const AiSequence& sequence)
clear(); clear();
copy (sequence); copy (sequence);
mDone = sequence.mDone; mDone = sequence.mDone;
mLastAiPackage = sequence.mLastAiPackage;
} }
return *this; return *this;
@ -120,33 +123,6 @@ bool AiSequence::isInCombat(const MWWorld::Ptr &actor) const
return false; return false;
} }
bool AiSequence::canAddTarget(const ESM::Position& actorPos, float distToTarget) const
{
bool firstCombatFound = false;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
for(std::list<AiPackage*>::const_iterator it = mPackages.begin(); it != mPackages.end(); ++it)
{
if ((*it)->getTypeId() == AiPackage::TypeIdCombat)
{
firstCombatFound = true;
const AiCombat *combat = static_cast<const AiCombat *>(*it);
if (combat->getTarget() != player ) return false; // only 1 non-player target allowed
else
{
// add new target only if current target (player) is farther
const ESM::Position &targetPos = combat->getTarget().getRefData().getPosition();
float distToCurrTarget = (Ogre::Vector3(targetPos.pos) - Ogre::Vector3(actorPos.pos)).length();
return (distToCurrTarget > distToTarget);
}
}
else if (firstCombatFound) break; // assumes combat packages go one-by-one in packages list
}
return true;
}
void AiSequence::stopCombat() void AiSequence::stopCombat()
{ {
while (getTypeId() == AiPackage::TypeIdCombat) while (getTypeId() == AiPackage::TypeIdCombat)
@ -295,11 +271,6 @@ void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor)
mPackages.push_front (package.clone()); mPackages.push_front (package.clone());
} }
void AiSequence::queue (const AiPackage& package)
{
mPackages.push_back (package.clone());
}
AiPackage* MWMechanics::AiSequence::getActivePackage() AiPackage* MWMechanics::AiSequence::getActivePackage()
{ {
if(mPackages.empty()) if(mPackages.empty())

@ -98,10 +98,6 @@ namespace MWMechanics
@param actor The actor that owns this AiSequence **/ @param actor The actor that owns this AiSequence **/
void stack (const AiPackage& package, const MWWorld::Ptr& actor); void stack (const AiPackage& package, const MWWorld::Ptr& actor);
/// Add \a package to the end of the sequence
/** Executed after all other packages have been completed **/
void queue (const AiPackage& package);
/// Return the current active package. /// Return the current active package.
/** If there is no active package, it will throw an exception **/ /** If there is no active package, it will throw an exception **/
AiPackage* getActivePackage(); AiPackage* getActivePackage();

@ -686,16 +686,15 @@ namespace MWMechanics
} }
AiWander::AiWander (const ESM::AiSequence::AiWander* wander) AiWander::AiWander (const ESM::AiSequence::AiWander* wander)
: mDistance(wander->mData.mDistance)
, mDuration(wander->mData.mDuration)
, mStartTime(MWWorld::TimeStamp(wander->mStartTime))
, mTimeOfDay(wander->mData.mTimeOfDay)
, mRepeat(wander->mData.mShouldRepeat)
{ {
mDistance = wander->mData.mDistance;
mDuration = wander->mData.mDuration;
mStartTime = MWWorld::TimeStamp(wander->mStartTime);
mTimeOfDay = wander->mData.mTimeOfDay;
for (int i=0; i<8; ++i) for (int i=0; i<8; ++i)
mIdle.push_back(wander->mData.mIdle[i]); mIdle.push_back(wander->mData.mIdle[i]);
mRepeat = wander->mData.mShouldRepeat;
init(); init();
} }
} }

@ -27,6 +27,11 @@
#include "creaturestats.hpp" #include "creaturestats.hpp"
#include "npcstats.hpp" #include "npcstats.hpp"
MWMechanics::Alchemy::Alchemy()
: mValue(0)
{
}
std::set<MWMechanics::EffectKey> MWMechanics::Alchemy::listEffects() const std::set<MWMechanics::EffectKey> MWMechanics::Alchemy::listEffects() const
{ {
std::map<EffectKey, int> effects; std::map<EffectKey, int> effects;

@ -22,6 +22,8 @@ namespace MWMechanics
{ {
public: public:
Alchemy();
typedef std::vector<MWWorld::Ptr> TToolsContainer; typedef std::vector<MWWorld::Ptr> TToolsContainer;
typedef TToolsContainer::const_iterator TToolsIterator; typedef TToolsContainer::const_iterator TToolsIterator;

@ -193,13 +193,11 @@ namespace MWMechanics
return; return;
} }
float damage = 0.0f;
float fDamageStrengthBase = gmst.find("fDamageStrengthBase")->getFloat(); float fDamageStrengthBase = gmst.find("fDamageStrengthBase")->getFloat();
float fDamageStrengthMult = gmst.find("fDamageStrengthMult")->getFloat(); float fDamageStrengthMult = gmst.find("fDamageStrengthMult")->getFloat();
const unsigned char* attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop; const unsigned char* attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop;
damage = attack[0] + ((attack[1]-attack[0])*attackerStats.getAttackStrength()); // Bow/crossbow damage float damage = attack[0] + ((attack[1]-attack[0])*attackerStats.getAttackStrength()); // Bow/crossbow damage
if (weapon != projectile) if (weapon != projectile)
{ {
// Arrow/bolt damage // Arrow/bolt damage

@ -120,11 +120,6 @@ namespace MWMechanics
return mSpells; return mSpells;
} }
void CreatureStats::setSpells(const Spells &spells)
{
mSpells = spells;
}
ActiveSpells &CreatureStats::getActiveSpells() ActiveSpells &CreatureStats::getActiveSpells()
{ {
return mActiveSpells; return mActiveSpells;
@ -200,11 +195,6 @@ namespace MWMechanics
mLevel = level; mLevel = level;
} }
void CreatureStats::setActiveSpells(const ActiveSpells &active)
{
mActiveSpells = active;
}
void CreatureStats::modifyMagicEffects(const MagicEffects &effects) void CreatureStats::modifyMagicEffects(const MagicEffects &effects)
{ {
if (effects.get(ESM::MagicEffect::FortifyMaximumMagicka).getModifier() if (effects.get(ESM::MagicEffect::FortifyMaximumMagicka).getModifier()
@ -536,7 +526,6 @@ namespace MWMechanics
mLastRestock = MWWorld::TimeStamp(state.mTradeTime); mLastRestock = MWWorld::TimeStamp(state.mTradeTime);
mGoldPool = state.mGoldPool; mGoldPool = state.mGoldPool;
mFallHeight = state.mFallHeight;
mDead = state.mDead; mDead = state.mDead;
mDied = state.mDied; mDied = state.mDied;

@ -40,7 +40,6 @@ namespace MWMechanics
bool mTalkedTo; bool mTalkedTo;
bool mAlarmed; bool mAlarmed;
bool mAttacked; bool mAttacked;
bool mHostile;
bool mAttackingOrSpell; bool mAttackingOrSpell;
bool mKnockdown; bool mKnockdown;
bool mKnockdownOneFrame; bool mKnockdownOneFrame;
@ -138,10 +137,6 @@ namespace MWMechanics
void setDynamic (int index, const DynamicStat<float> &value); void setDynamic (int index, const DynamicStat<float> &value);
void setSpells(const Spells &spells);
void setActiveSpells(const ActiveSpells &active);
/// Set Modifier for each magic effect according to \a effects. Does not touch Base values. /// Set Modifier for each magic effect according to \a effects. Does not touch Base values.
void modifyMagicEffects(const MagicEffects &effects); void modifyMagicEffects(const MagicEffects &effects);

@ -166,16 +166,15 @@ namespace MWMechanics
float enchantmentCost = 0; float enchantmentCost = 0;
int effectsLeftCnt = mEffects.size(); int effectsLeftCnt = mEffects.size();
float baseCost, magnitudeCost, areaCost;
int magMin, magMax, area;
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it) for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
{ {
baseCost = (store.get<ESM::MagicEffect>().find(it->mEffectID))->mData.mBaseCost; float baseCost = (store.get<ESM::MagicEffect>().find(it->mEffectID))->mData.mBaseCost;
// To reflect vanilla behavior // To reflect vanilla behavior
magMin = (it->mMagnMin == 0) ? 1 : it->mMagnMin; int magMin = (it->mMagnMin == 0) ? 1 : it->mMagnMin;
magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax; int magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
area = (it->mArea == 0) ? 1 : it->mArea; int area = (it->mArea == 0) ? 1 : it->mArea;
float magnitudeCost = 0;
if (mCastStyle == ESM::Enchantment::ConstantEffect) if (mCastStyle == ESM::Enchantment::ConstantEffect)
{ {
magnitudeCost = (magMin + magMax) * baseCost * 2.5; magnitudeCost = (magMin + magMax) * baseCost * 2.5;
@ -187,7 +186,7 @@ namespace MWMechanics
magnitudeCost *= 1.5; magnitudeCost *= 1.5;
} }
areaCost = area * 0.025 * baseCost; float areaCost = area * 0.025 * baseCost;
if (it->mRange == ESM::RT_Target) if (it->mRange == ESM::RT_Target)
areaCost *= 1.5; areaCost *= 1.5;

@ -283,13 +283,6 @@ namespace MWMechanics
return Ogre::Radian(Ogre::Math::ACos(directionY / directionResult) * sgn(Ogre::Math::ASin(directionX / directionResult))).valueDegrees(); return Ogre::Radian(Ogre::Math::ACos(directionY / directionResult) * sgn(Ogre::Math::ASin(directionX / directionResult))).valueDegrees();
} }
// Used by AiCombat, use Euclidean distance
float PathFinder::getDistToNext(float x, float y, float z)
{
ESM::Pathgrid::Point nextPoint = *mPath.begin();
return distance(nextPoint, x, y, z);
}
bool PathFinder::checkWaypoint(float x, float y, float z) bool PathFinder::checkWaypoint(float x, float y, float z)
{ {
if(mPath.empty()) if(mPath.empty())

@ -47,8 +47,6 @@ namespace MWMechanics
float getZAngleToNext(float x, float y) const; float getZAngleToNext(float x, float y) const;
float getDistToNext(float x, float y, float z);
bool isPathConstructed() const bool isPathConstructed() const
{ {
return mIsPathConstructed; return mIsPathConstructed;

@ -521,7 +521,7 @@ float Animation::getVelocity(const std::string &groupname) const
{ {
/* Look in reverse; last-inserted source has priority. */ /* Look in reverse; last-inserted source has priority. */
AnimSourceList::const_reverse_iterator animsrc(mAnimSources.rbegin()); AnimSourceList::const_reverse_iterator animsrc(mAnimSources.rbegin());
for(;animsrc != mAnimSources.rend();animsrc++) for(;animsrc != mAnimSources.rend();++animsrc)
{ {
const NifOgre::TextKeyMap &keys = (*animsrc)->mTextKeys; const NifOgre::TextKeyMap &keys = (*animsrc)->mTextKeys;
if(findGroupStart(keys, groupname) != keys.end()) if(findGroupStart(keys, groupname) != keys.end())
@ -831,8 +831,7 @@ void Animation::handleTextKey(AnimState &state, const std::string &groupname, co
void Animation::changeGroups(const std::string &groupname, int groups) void Animation::changeGroups(const std::string &groupname, int groups)
{ {
AnimStateMap::iterator stateiter = mStates.begin(); AnimStateMap::iterator stateiter = mStates.find(groupname);
stateiter = mStates.find(groupname);
if(stateiter != mStates.end()) if(stateiter != mStates.end())
{ {
if(stateiter->second.mGroups != groups) if(stateiter->second.mGroups != groups)

@ -26,7 +26,6 @@ namespace MWRender
mNearest(30.f), mNearest(30.f),
mFurthest(800.f), mFurthest(800.f),
mIsNearest(false), mIsNearest(false),
mIsFurthest(false),
mHeight(128.f), mHeight(128.f),
mCameraDistance(300.f), mCameraDistance(300.f),
mDistanceAdjusted(false), mDistanceAdjusted(false),
@ -292,7 +291,6 @@ namespace MWRender
if(mFirstPersonView && !mPreviewMode && !mVanity.enabled) if(mFirstPersonView && !mPreviewMode && !mVanity.enabled)
return; return;
mIsFurthest = false;
mIsNearest = false; mIsNearest = false;
Ogre::Vector3 v(0.f, 0.f, dist); Ogre::Vector3 v(0.f, 0.f, dist);
@ -301,7 +299,6 @@ namespace MWRender
} }
if (v.z >= mFurthest) { if (v.z >= mFurthest) {
v.z = mFurthest; v.z = mFurthest;
mIsFurthest = true;
} else if (!override && v.z < 10.f) { } else if (!override && v.z < 10.f) {
v.z = 10.f; v.z = 10.f;
} else if (override && v.z <= mNearest) { } else if (override && v.z <= mNearest) {
@ -389,9 +386,4 @@ namespace MWRender
{ {
return mIsNearest; return mIsNearest;
} }
bool Camera::isFurthest()
{
return mIsFurthest;
}
} }

@ -36,7 +36,6 @@ namespace MWRender
float mNearest; float mNearest;
float mFurthest; float mFurthest;
bool mIsNearest; bool mIsNearest;
bool mIsFurthest;
struct { struct {
bool enabled, allowed; bool enabled, allowed;
@ -118,8 +117,6 @@ namespace MWRender
bool isVanityOrPreviewModeEnabled(); bool isVanityOrPreviewModeEnabled();
bool isNearest(); bool isNearest();
bool isFurthest();
}; };
} }

@ -281,9 +281,9 @@ namespace MWRender
RaceSelectionPreview::RaceSelectionPreview() RaceSelectionPreview::RaceSelectionPreview()
: CharacterPreview(MWBase::Environment::get().getWorld()->getPlayerPtr(), : CharacterPreview(MWBase::Environment::get().getWorld()->getPlayerPtr(),
512, 512, "CharacterHeadPreview", Ogre::Vector3(0, 6, -35), Ogre::Vector3(0,125,0)) 512, 512, "CharacterHeadPreview", Ogre::Vector3(0, 6, -35), Ogre::Vector3(0,125,0))
, mBase (*mCharacter.get<ESM::NPC>()->mBase)
, mRef(&mBase) , mRef(&mBase)
{ {
mBase = *mCharacter.get<ESM::NPC>()->mBase;
mCharacter = MWWorld::Ptr(&mRef, NULL); mCharacter = MWWorld::Ptr(&mRef, NULL);
} }

@ -150,7 +150,7 @@ void CreatureWeaponAnimation::updatePart(NifOgre::ObjectScenePtr& scene, int slo
} }
std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(scene->mControllers.begin()); std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(scene->mControllers.begin());
for(;ctrl != scene->mControllers.end();ctrl++) for(;ctrl != scene->mControllers.end();++ctrl)
{ {
if(ctrl->getSource().isNull()) if(ctrl->getSource().isNull())
{ {

@ -106,13 +106,13 @@ namespace MWRender
if (land) if (land)
{ {
const float landHeight = land->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) if (landHeight >= 0)
{ {
const float hillHeight = 2500.f;
if (landHeight >= hillHeight) if (landHeight >= hillHeight)
{ {
const float mountainHeight = 15000.f;
float factor = std::min(1.f, float(landHeight-hillHeight)/mountainHeight); float factor = std::min(1.f, float(landHeight-hillHeight)/mountainHeight);
r = (hillColour.r * (1-factor) + mountainColour.r * factor) * 255; r = (hillColour.r * (1-factor) + mountainColour.r * factor) * 255;
g = (hillColour.g * (1-factor) + mountainColour.g * factor) * 255; g = (hillColour.g * (1-factor) + mountainColour.g * factor) * 255;

@ -410,15 +410,18 @@ void NpcAnimation::updateParts()
// Remember body parts so we only have to search through the store once for each race/gender/viewmode combination // Remember body parts so we only have to search through the store once for each race/gender/viewmode combination
static std::map< std::pair<std::string,int>,std::vector<const ESM::BodyPart*> > sRaceMapping; static std::map< std::pair<std::string,int>,std::vector<const ESM::BodyPart*> > sRaceMapping;
static const int Flag_Female = 1<<0;
static const int Flag_FirstPerson = 1<<1;
bool isWerewolf = (mNpcType == Type_Werewolf); bool isWerewolf = (mNpcType == Type_Werewolf);
int flags = (isWerewolf ? -1 : 0); int flags = (isWerewolf ? -1 : 0);
if(!mNpc->isMale()) if(!mNpc->isMale())
{
static const int Flag_Female = 1<<0;
flags |= Flag_Female; flags |= Flag_Female;
}
if(mViewMode == VM_FirstPerson) if(mViewMode == VM_FirstPerson)
{
static const int Flag_FirstPerson = 1<<1;
flags |= Flag_FirstPerson; flags |= Flag_FirstPerson;
}
std::string race = (isWerewolf ? "werewolf" : Misc::StringUtils::lowerCase(mNpc->mRace)); std::string race = (isWerewolf ? "werewolf" : Misc::StringUtils::lowerCase(mNpc->mRace));
std::pair<std::string, int> thisCombination = std::make_pair(race, flags); std::pair<std::string, int> thisCombination = std::make_pair(race, flags);
@ -604,7 +607,7 @@ Ogre::Vector3 NpcAnimation::runAnimation(float timepassed)
if (mObjectParts[i].isNull()) if (mObjectParts[i].isNull())
continue; continue;
std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(mObjectParts[i]->mControllers.begin()); std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(mObjectParts[i]->mControllers.begin());
for(;ctrl != mObjectParts[i]->mControllers.end();ctrl++) for(;ctrl != mObjectParts[i]->mControllers.end();++ctrl)
ctrl->update(); ctrl->update();
Ogre::Entity *ent = mObjectParts[i]->mSkelBase; Ogre::Entity *ent = mObjectParts[i]->mSkelBase;
@ -678,7 +681,7 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
} }
std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(mObjectParts[type]->mControllers.begin()); std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(mObjectParts[type]->mControllers.begin());
for(;ctrl != mObjectParts[type]->mControllers.end();ctrl++) for(;ctrl != mObjectParts[type]->mControllers.end();++ctrl)
{ {
if(ctrl->getSource().isNull()) if(ctrl->getSource().isNull())
{ {
@ -715,7 +718,7 @@ void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM::
const char *ext = (mViewMode == VM_FirstPerson) ? ".1st" : ""; const char *ext = (mViewMode == VM_FirstPerson) ? ".1st" : "";
std::vector<ESM::PartReference>::const_iterator part(parts.begin()); std::vector<ESM::PartReference>::const_iterator part(parts.begin());
for(;part != parts.end();part++) for(;part != parts.end();++part)
{ {
const ESM::BodyPart *bodypart = 0; const ESM::BodyPart *bodypart = 0;
if(!mNpc->isMale() && !part->mFemale.empty()) if(!mNpc->isMale() && !part->mFemale.empty())

@ -574,24 +574,6 @@ void RenderingManager::configureAmbient(MWWorld::CellStore &mCell)
sunEnable(false); sunEnable(false);
} }
} }
// Switch through lighting modes.
void RenderingManager::toggleLight()
{
if (mAmbientMode==2)
mAmbientMode = 0;
else
++mAmbientMode;
switch (mAmbientMode)
{
case 0: std::cout << "Setting lights to normal\n"; break;
case 1: std::cout << "Turning the lights up\n"; break;
case 2: std::cout << "Turning the lights to full\n"; break;
}
setAmbientMode();
}
void RenderingManager::setSunColour(const Ogre::ColourValue& colour) void RenderingManager::setSunColour(const Ogre::ColourValue& colour)
{ {
@ -695,11 +677,6 @@ void RenderingManager::enableLights(bool sun)
sunEnable(sun); sunEnable(sun);
} }
Shadows* RenderingManager::getShadows()
{
return mShadows;
}
void RenderingManager::notifyWorldSpaceChanged() void RenderingManager::notifyWorldSpaceChanged()
{ {
mEffectManager->clear(); mEffectManager->clear();

@ -93,7 +93,6 @@ public:
MWRender::Camera* getCamera() const; MWRender::Camera* getCamera() const;
void toggleLight();
bool toggleRenderMode(int mode); bool toggleRenderMode(int mode);
void removeCell (MWWorld::CellStore *store); void removeCell (MWWorld::CellStore *store);
@ -157,8 +156,6 @@ public:
float getTerrainHeightAt (Ogre::Vector3 worldPos); float getTerrainHeightAt (Ogre::Vector3 worldPos);
Shadows* getShadows();
void notifyWorldSpaceChanged(); void notifyWorldSpaceChanged();
void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches); void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches);

@ -41,6 +41,9 @@ public:
void updateEmitterPtr (const MWWorld::Ptr& old, const MWWorld::Ptr& ptr); void updateEmitterPtr (const MWWorld::Ptr& old, const MWWorld::Ptr& ptr);
private: private:
RippleSimulation(const RippleSimulation&);
RippleSimulation& operator=(const RippleSimulation&);
std::vector<Emitter> mEmitters; std::vector<Emitter> mEmitters;
Ogre::RenderTexture* mRenderTargets[4]; Ogre::RenderTexture* mRenderTargets[4];

@ -186,13 +186,3 @@ PSSMShadowCameraSetup* Shadows::getPSSMSetup()
{ {
return mPSSMSetup; return mPSSMSetup;
} }
float Shadows::getShadowFar() const
{
return mShadowFar;
}
float Shadows::getFadeStart() const
{
return mFadeStart;
}

@ -23,8 +23,6 @@ namespace MWRender
void recreate(); void recreate();
Ogre::PSSMShadowCameraSetup* getPSSMSetup(); Ogre::PSSMShadowCameraSetup* getPSSMSetup();
float getShadowFar() const;
float getFadeStart() const;
protected: protected:
OEngine::Render::OgreRenderer* mRendering; OEngine::Render::OgreRenderer* mRendering;

@ -188,11 +188,6 @@ void Moon::setPhase(const Moon::Phase& phase)
mPhase = phase; mPhase = phase;
} }
Moon::Phase Moon::getPhase() const
{
return mPhase;
}
unsigned int Moon::getPhaseInt() const unsigned int Moon::getPhaseInt() const
{ {
if (mPhase == Moon::Phase_New) return 0; if (mPhase == Moon::Phase_New) return 0;
@ -418,7 +413,6 @@ void SkyManager::updateRain(float dt)
// Spawn new rain // Spawn new rain
float rainFrequency = mRainFrequency; float rainFrequency = mRainFrequency;
float startHeight = 700;
if (mRainEnabled) if (mRainEnabled)
{ {
mRainTimer += dt; mRainTimer += dt;
@ -434,6 +428,7 @@ void SkyManager::updateRain(float dt)
// Create a separate node to control the offset, since a node with setInheritOrientation(false) will still // Create a separate node to control the offset, since a node with setInheritOrientation(false) will still
// consider the orientation of the parent node for its position, just not for its orientation // consider the orientation of the parent node for its position, just not for its orientation
float startHeight = 700;
Ogre::SceneNode* offsetNode = sceneNode->createChildSceneNode(Ogre::Vector3(xOffs,yOffs,startHeight)); Ogre::SceneNode* offsetNode = sceneNode->createChildSceneNode(Ogre::Vector3(xOffs,yOffs,startHeight));
NifOgre::ObjectScenePtr objects = NifOgre::Loader::createObjects(offsetNode, mRainEffect); NifOgre::ObjectScenePtr objects = NifOgre::Loader::createObjects(offsetNode, mRainEffect);
@ -752,16 +747,6 @@ void SkyManager::setLightningStrength(const float factor)
else else
mLightning->setVisible(false); mLightning->setVisible(false);
} }
void SkyManager::setLightningEnabled(bool enabled)
{
/// \todo
}
void SkyManager::setLightningDirection(const Ogre::Vector3& dir)
{
if (!mCreated) return;
mLightning->setDirection (dir);
}
void SkyManager::setMasserFade(const float fade) void SkyManager::setMasserFade(const float fade)
{ {

@ -103,7 +103,6 @@ namespace MWRender
void setPhase(const Phase& phase); void setPhase(const Phase& phase);
void setType(const Type& type); void setType(const Type& type);
Phase getPhase() const;
unsigned int getPhaseInt() const; unsigned int getPhaseInt() const;
private: private:
@ -169,8 +168,6 @@ namespace MWRender
void secundaDisable(); void secundaDisable();
void setLightningStrength(const float factor); void setLightningStrength(const float factor);
void setLightningDirection(const Ogre::Vector3& dir);
void setLightningEnabled(bool enabled); ///< disable prior to map render
void setGlare(const float glare); void setGlare(const float glare);
void setGlareEnabled(bool enabled); void setGlareEnabled(bool enabled);

@ -864,7 +864,6 @@ void VideoState::video_thread_loop(VideoState *self)
AVPacket pkt1, *packet = &pkt1; AVPacket pkt1, *packet = &pkt1;
int frameFinished; int frameFinished;
AVFrame *pFrame; AVFrame *pFrame;
double pts;
pFrame = av_frame_alloc(); pFrame = av_frame_alloc();
@ -879,7 +878,7 @@ void VideoState::video_thread_loop(VideoState *self)
if(avcodec_decode_video2((*self->video_st)->codec, pFrame, &frameFinished, packet) < 0) if(avcodec_decode_video2((*self->video_st)->codec, pFrame, &frameFinished, packet) < 0)
throw std::runtime_error("Error decoding video frame"); throw std::runtime_error("Error decoding video frame");
pts = 0; double pts = 0;
if(IS_NOTEQ_NOPTS_VAL(packet->dts)) if(IS_NOTEQ_NOPTS_VAL(packet->dts))
pts = packet->dts; pts = packet->dts;
else if(pFrame->opaque && IS_NOTEQ_NOPTS_VAL_PTR(pFrame->opaque)) else if(pFrame->opaque && IS_NOTEQ_NOPTS_VAL_PTR(pFrame->opaque))
@ -1232,11 +1231,6 @@ int VideoPlayer::getVideoHeight()
return height; return height;
} }
void VideoPlayer::stopVideo ()
{
close();
}
void VideoPlayer::close() void VideoPlayer::close()
{ {
if(mState) if(mState)

@ -21,7 +21,6 @@ namespace MWRender
void update(); void update();
void close(); void close();
void stopVideo();
bool isPlaying(); bool isPlaying();
@ -32,9 +31,6 @@ namespace MWRender
private: private:
VideoState* mState; VideoState* mState;
int mWidth;
int mHeight;
}; };
} }

@ -480,12 +480,6 @@ namespace MWScript
mActivationHandled = true; mActivationHandled = true;
} }
void InterpreterContext::clearActivation()
{
mActivated = MWWorld::Ptr();
mActivationHandled = false;
}
float InterpreterContext::getSecondsPassed() const float InterpreterContext::getSecondsPassed() const
{ {
return MWBase::Environment::get().getFrameDuration(); return MWBase::Environment::get().getFrameDuration();

@ -146,9 +146,6 @@ namespace MWScript
void executeActivation(MWWorld::Ptr ptr, MWWorld::Ptr actor); void executeActivation(MWWorld::Ptr ptr, MWWorld::Ptr actor);
///< Execute the activation action for this ptr. If ptr is mActivated, mark activation as handled. ///< Execute the activation action for this ptr. If ptr is mActivated, mark activation as handled.
void clearActivation();
///< Discard the action defined by the last activate call.
virtual float getSecondsPassed() const; virtual float getSecondsPassed() const;
virtual bool isDisabled (const std::string& id = "") const; virtual bool isDisabled (const std::string& id = "") const;

@ -43,13 +43,12 @@ namespace MWScript
mParser.reset(); mParser.reset();
mErrorHandler.reset(); mErrorHandler.reset();
bool Success = true;
if (const ESM::Script *script = mStore.get<ESM::Script>().find (name)) if (const ESM::Script *script = mStore.get<ESM::Script>().find (name))
{ {
if (mVerbose) if (mVerbose)
std::cout << "compiling script: " << name << std::endl; std::cout << "compiling script: " << name << std::endl;
bool Success = true;
try try
{ {
std::istringstream input (script->mScriptText); std::istringstream input (script->mScriptText);

@ -83,7 +83,7 @@ bool FFmpeg_Decoder::getNextPacket()
bool FFmpeg_Decoder::getAVAudioData() bool FFmpeg_Decoder::getAVAudioData()
{ {
int got_frame, len; int got_frame;
if((*mStream)->codec->codec_type != AVMEDIA_TYPE_AUDIO) if((*mStream)->codec->codec_type != AVMEDIA_TYPE_AUDIO)
return false; return false;
@ -93,6 +93,7 @@ bool FFmpeg_Decoder::getAVAudioData()
return false; return false;
/* Decode some data, and check for errors */ /* Decode some data, and check for errors */
int len = 0;
if((len=avcodec_decode_audio4((*mStream)->codec, mFrame, &got_frame, &mPacket)) < 0) if((len=avcodec_decode_audio4((*mStream)->codec, mFrame, &got_frame, &mPacket)) < 0)
return false; return false;

@ -303,10 +303,6 @@ namespace MWWorld
{ {
} }
void Class::adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const
{
}
std::string Class::getModel(const MWWorld::Ptr &ptr) const std::string Class::getModel(const MWWorld::Ptr &ptr) const
{ {
return ""; return "";

@ -267,8 +267,6 @@ namespace MWWorld
virtual void adjustScale(const MWWorld::Ptr& ptr,float& scale) const; virtual void adjustScale(const MWWorld::Ptr& ptr,float& scale) const;
virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const;
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const; virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
///< Determine whether or not \a item can be sold to an npc with the given \a npcServices ///< Determine whether or not \a item can be sold to an npc with the given \a npcServices

@ -73,15 +73,14 @@ MWWorld::InventoryStore::InventoryStore()
} }
MWWorld::InventoryStore::InventoryStore (const InventoryStore& store) MWWorld::InventoryStore::InventoryStore (const InventoryStore& store)
: ContainerStore (store) : ContainerStore (store)
, mSelectedEnchantItem(end()) , mSelectedEnchantItem(end())
, mMagicEffects(store.mMagicEffects)
, mFirstAutoEquip(store.mFirstAutoEquip)
, mListener(store.mListener)
, mUpdatesEnabled(store.mUpdatesEnabled)
, mPermanentMagicEffectMagnitudes(store.mPermanentMagicEffectMagnitudes)
{ {
mMagicEffects = store.mMagicEffects;
mFirstAutoEquip = store.mFirstAutoEquip;
mListener = store.mListener;
mUpdatesEnabled = store.mUpdatesEnabled;
mPermanentMagicEffectMagnitudes = store.mPermanentMagicEffectMagnitudes;
copySlots (store); copySlots (store);
} }
@ -218,8 +217,6 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
// Equipping weapons is handled by AiCombat. Anything else (lockpicks, probes) can't be used by NPCs anyway (yet) // Equipping weapons is handled by AiCombat. Anything else (lockpicks, probes) can't be used by NPCs anyway (yet)
continue; continue;
bool use = false;
if (slots_.at (*iter2)!=end()) if (slots_.at (*iter2)!=end())
{ {
Ptr old = *slots_.at (*iter2); Ptr old = *slots_.at (*iter2);
@ -227,6 +224,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
// check skill // check skill
int oldSkill = old.getClass().getEquipmentSkill (old); int oldSkill = old.getClass().getEquipmentSkill (old);
bool use = false;
if (testSkill!=-1 && oldSkill==-1) if (testSkill!=-1 && oldSkill==-1)
use = true; use = true;
else if (testSkill!=-1 && oldSkill!=-1 && testSkill!=oldSkill) else if (testSkill!=-1 && oldSkill!=-1 && testSkill!=oldSkill)

@ -268,8 +268,6 @@ namespace MWWorld
loadingListener->setLabel(loadingExteriorText); loadingListener->setLabel(loadingExteriorText);
CellStoreCollection::iterator active = mActiveCells.begin(); CellStoreCollection::iterator active = mActiveCells.begin();
active = mActiveCells.begin();
while (active!=mActiveCells.end()) while (active!=mActiveCells.end())
{ {
if ((*active)->getCell()->isExterior()) if ((*active)->getCell()->isExterior())
@ -414,12 +412,9 @@ namespace MWWorld
std::cout << "Changing to interior\n"; std::cout << "Changing to interior\n";
// remove active
CellStoreCollection::iterator active = mActiveCells.begin();
// unload // unload
int current = 0; int current = 0;
active = mActiveCells.begin(); CellStoreCollection::iterator active = mActiveCells.begin();
while (active!=mActiveCells.end()) while (active!=mActiveCells.end())
{ {
unloadCell (active++); unloadCell (active++);

@ -1315,7 +1315,7 @@ namespace MWWorld
const PtrVelocityList &results = mPhysics->applyQueuedMovement(duration); const PtrVelocityList &results = mPhysics->applyQueuedMovement(duration);
PtrVelocityList::const_iterator player(results.end()); PtrVelocityList::const_iterator player(results.end());
for(PtrVelocityList::const_iterator iter(results.begin());iter != results.end();iter++) for(PtrVelocityList::const_iterator iter(results.begin());iter != results.end();++iter)
{ {
if(iter->first.getRefData().getHandle() == "player") if(iter->first.getRefData().getHandle() == "player")
{ {

@ -105,11 +105,6 @@ namespace
code.push_back (Compiler::Generator::segment5 (17)); code.push_back (Compiler::Generator::segment5 (17));
} }
void opFloatToInt1 (Compiler::Generator::CodeContainer& code)
{
code.push_back (Compiler::Generator::segment5 (18));
}
void opSquareRoot (Compiler::Generator::CodeContainer& code) void opSquareRoot (Compiler::Generator::CodeContainer& code)
{ {
code.push_back (Compiler::Generator::segment5 (19)); code.push_back (Compiler::Generator::segment5 (19));
@ -606,16 +601,6 @@ namespace Compiler
jump (code, offset); jump (code, offset);
} }
void jumpOnNonZero (CodeContainer& code, int offset)
{
opSkipOnZero (code);
if (offset<0)
--offset; // compensate for skip instruction
jump (code, offset);
}
void compare (CodeContainer& code, char op, char valueType1, char valueType2) void compare (CodeContainer& code, char op, char valueType1, char valueType2)
{ {
if (valueType1=='l' && valueType2=='l') if (valueType1=='l' && valueType2=='l')

@ -89,8 +89,6 @@ namespace Compiler
void jumpOnZero (CodeContainer& code, int offset); void jumpOnZero (CodeContainer& code, int offset);
void jumpOnNonZero (CodeContainer& code, int offset);
void compare (CodeContainer& code, char op, char valueType1, char valueType2); void compare (CodeContainer& code, char op, char valueType1, char valueType2);
void menuMode (CodeContainer& code); void menuMode (CodeContainer& code);

@ -57,7 +57,7 @@ namespace Compiler
Literals& literals, std::vector<Interpreter::Type_Code>& code, bool allowExpression) Literals& literals, std::vector<Interpreter::Type_Code>& code, bool allowExpression)
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code), : Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code),
mState (BeginState), mExprParser (errorHandler, context, locals, literals), mState (BeginState), mExprParser (errorHandler, context, locals, literals),
mAllowExpression (allowExpression), mButtons(0), mType(0) mAllowExpression (allowExpression), mButtons(0), mType(0), mReferenceMember(false)
{} {}
bool LineParser::parseInt (int value, const TokenLoc& loc, Scanner& scanner) bool LineParser::parseInt (int value, const TokenLoc& loc, Scanner& scanner)
@ -295,8 +295,6 @@ namespace Compiler
mExplicit.clear(); mExplicit.clear();
} }
int optionals = 0;
try try
{ {
// workaround for broken positioncell instructions. // workaround for broken positioncell instructions.
@ -306,7 +304,7 @@ namespace Compiler
errorDowngrade.reset (new ErrorDowngrade (getErrorHandler())); errorDowngrade.reset (new ErrorDowngrade (getErrorHandler()));
std::vector<Interpreter::Type_Code> code; std::vector<Interpreter::Type_Code> code;
optionals = mExprParser.parseArguments (argumentType, scanner, code); int optionals = mExprParser.parseArguments (argumentType, scanner, code);
mCode.insert (mCode.end(), code.begin(), code.end()); mCode.insert (mCode.end(), code.begin(), code.end());
extensions->generateInstructionCode (keyword, mCode, mLiterals, extensions->generateInstructionCode (keyword, mCode, mLiterals,
mExplicit, optionals); mExplicit, optionals);

@ -21,13 +21,6 @@ namespace Compiler
throw SourceException(); throw SourceException();
} }
// Report the error
void Parser::reportError (const std::string& message, const TokenLoc& loc)
{
mErrorHandler.error (message, loc);
}
// Report the warning without throwing an exception. // Report the warning without throwing an exception.
void Parser::reportWarning (const std::string& message, const TokenLoc& loc) void Parser::reportWarning (const std::string& message, const TokenLoc& loc)

@ -26,9 +26,6 @@ namespace Compiler
void reportSeriousError (const std::string& message, const TokenLoc& loc); void reportSeriousError (const std::string& message, const TokenLoc& loc);
///< Report the error and throw a exception. ///< Report the error and throw a exception.
void reportError (const std::string& message, const TokenLoc& loc);
///< Report the error
void reportWarning (const std::string& message, const TokenLoc& loc); void reportWarning (const std::string& message, const TokenLoc& loc);
///< Report the warning without throwing an exception. ///< Report the warning without throwing an exception.

@ -276,7 +276,6 @@ bool ContentSelectorModel::ContentModel::setData(const QModelIndex &index, const
case Qt::CheckStateRole: case Qt::CheckStateRole:
{ {
int checkValue = value.toInt(); int checkValue = value.toInt();
bool success = false;
bool setState = false; bool setState = false;
if ((checkValue==Qt::Checked) && !isChecked(file->filePath())) if ((checkValue==Qt::Checked) && !isChecked(file->filePath()))
{ {

@ -250,14 +250,6 @@ void ESMReader::skipRecord()
mCtx.leftRec = 0; mCtx.leftRec = 0;
} }
void ESMReader::skipHRecord()
{
if (!mCtx.leftFile)
return;
getRecHeader();
skipRecord();
}
void ESMReader::getRecHeader(uint32_t &flags) void ESMReader::getRecHeader(uint32_t &flags)
{ {
// General error checking // General error checking

@ -216,9 +216,6 @@ public:
// already been read // already been read
void skipRecord(); void skipRecord();
// Skip an entire record, including the header (but not the name)
void skipHRecord();
/* Read record header. This updatesleftFile BEYOND the data that /* Read record header. This updatesleftFile BEYOND the data that
follows the header, ie beyond the entire record. You should use follows the header, ie beyond the entire record. You should use
leftRec to orient yourself inside the record itself. leftRec to orient yourself inside the record itself.

@ -6,7 +6,12 @@
namespace ESM namespace ESM
{ {
ESMWriter::ESMWriter() : mEncoder (0), mRecordCount (0), mCounting (true) {} ESMWriter::ESMWriter()
: mEncoder (0)
, mRecordCount (0)
, mCounting (true)
, mStream(NULL)
{}
unsigned int ESMWriter::getVersion() const unsigned int ESMWriter::getVersion() const
{ {

@ -113,11 +113,6 @@ void Cell::loadData(ESMReader &esm)
esm.getHNT(mData, "DATA", 12); esm.getHNT(mData, "DATA", 12);
} }
void Cell::preLoad(ESMReader &esm) //Can't be "load" because it conflicts with function in esmtool
{
this->load(esm, false);
}
void Cell::postLoad(ESMReader &esm) void Cell::postLoad(ESMReader &esm)
{ {
// Save position of the cell references and move on // Save position of the cell references and move on

@ -104,7 +104,6 @@ struct Cell
CellRefTracker mLeasedRefs; CellRefTracker mLeasedRefs;
MovedCellRefTracker mMovedRefs; MovedCellRefTracker mMovedRefs;
void preLoad(ESMReader &esm);
void postLoad(ESMReader &esm); void postLoad(ESMReader &esm);
// This method is left in for compatibility with esmtool. Parsing moved references currently requires // This method is left in for compatibility with esmtool. Parsing moved references currently requires

@ -19,14 +19,14 @@ void Land::LandData::save(ESMWriter &esm)
offsets.mUnk1 = mUnk1; offsets.mUnk1 = mUnk1;
offsets.mUnk2 = mUnk2; offsets.mUnk2 = mUnk2;
float prevY = mHeights[0], prevX; float prevY = mHeights[0];
int number = 0; // avoid multiplication int number = 0; // avoid multiplication
for (int i = 0; i < LAND_SIZE; ++i) { for (int i = 0; i < LAND_SIZE; ++i) {
float diff = (mHeights[number] - prevY) / HEIGHT_SCALE; float diff = (mHeights[number] - prevY) / HEIGHT_SCALE;
offsets.mHeightData[number] = offsets.mHeightData[number] =
(diff >= 0) ? (int8_t) (diff + 0.5) : (int8_t) (diff - 0.5); (diff >= 0) ? (int8_t) (diff + 0.5) : (int8_t) (diff - 0.5);
prevX = prevY = mHeights[number]; float prevX = prevY = mHeights[number];
++number; ++number;
for (int j = 1; j < LAND_SIZE; ++j) { for (int j = 1; j < LAND_SIZE; ++j) {

@ -18,7 +18,7 @@ NIFFile::NIFFile(const std::string &name)
NIFFile::~NIFFile() NIFFile::~NIFFile()
{ {
for (std::vector<Record*>::iterator it = records.begin() ; it != records.end(); it++) for (std::vector<Record*>::iterator it = records.begin() ; it != records.end(); ++it)
{ {
delete *it; delete *it;
} }

@ -29,12 +29,6 @@ class NIFMaterialLoader {
std::cerr << "NIFMaterialLoader: Warn: " << msg << std::endl; std::cerr << "NIFMaterialLoader: Warn: " << msg << std::endl;
} }
static void fail(const std::string &msg)
{
std::cerr << "NIFMaterialLoader: Fail: "<< msg << std::endl;
abort();
}
static std::map<size_t,std::string> sMaterialMap; static std::map<size_t,std::string> sMaterialMap;
public: public:

@ -1048,7 +1048,7 @@ class NIFObjectLoader
{ {
std::string::const_iterator last = str.end(); std::string::const_iterator last = str.end();
do { do {
last--; --last;
} while(last != str.begin() && ::isspace(*last)); } while(last != str.begin() && ::isspace(*last));
nextpos = std::distance(str.begin(), ++last); nextpos = std::distance(str.begin(), ++last);
} }

@ -130,8 +130,8 @@ public:
NifEmitter(Ogre::ParticleSystem *psys) NifEmitter(Ogre::ParticleSystem *psys)
: Ogre::ParticleEmitter(psys) : Ogre::ParticleEmitter(psys)
, mEmitterBones(Ogre::any_cast<NiNodeHolder>(psys->getUserObjectBindings().getUserAny()).mBones)
{ {
mEmitterBones = Ogre::any_cast<NiNodeHolder>(psys->getUserObjectBindings().getUserAny()).mBones;
assert (!mEmitterBones.empty()); assert (!mEmitterBones.empty());
Ogre::TagPoint* tag = static_cast<Ogre::TagPoint*>(mParent->getParentNode()); Ogre::TagPoint* tag = static_cast<Ogre::TagPoint*>(mParent->getParentNode());
mParticleBone = static_cast<Ogre::Bone*>(tag->getParent()); mParticleBone = static_cast<Ogre::Bone*>(tag->getParent());

@ -45,7 +45,7 @@ namespace
LogListener(const std::string &path) LogListener(const std::string &path)
: file((bfs::path(path))) : file((bfs::path(path)))
{ {
memset(buffer, sizeof(buffer), 0); memset(buffer, 0, sizeof(buffer));
} }
void timestamp() void timestamp()

@ -70,9 +70,9 @@ namespace Terrain
private: private:
// Called from a background worker thread // Called from a background worker thread
Ogre::WorkQueue::Response* handleRequest(const Ogre::WorkQueue::Request* req, const Ogre::WorkQueue* srcQ); virtual Ogre::WorkQueue::Response* handleRequest(const Ogre::WorkQueue::Request* req, const Ogre::WorkQueue* srcQ);
// Called from the main thread // Called from the main thread
void handleResponse(const Ogre::WorkQueue::Response* res, const Ogre::WorkQueue* srcQ); virtual void handleResponse(const Ogre::WorkQueue::Response* res, const Ogre::WorkQueue* srcQ);
Ogre::uint16 mWorkQueueChannel; Ogre::uint16 mWorkQueueChannel;
bool mVisible; bool mVisible;

@ -15,6 +15,8 @@ World::World(Ogre::SceneManager* sceneMgr,
, mShaders(shaders) , mShaders(shaders)
, mAlign(align) , mAlign(align)
, mCache(storage->getCellVertices()) , mCache(storage->getCellVertices())
, mShadows(false)
, mSplitShadows(false)
{ {
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save