1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 08:06:45 +00:00

a bit more random cleanup

This commit is contained in:
Marc Zinnschlag 2012-09-09 21:08:57 +02:00
parent 06677a0fc8
commit 9c49ca1468
2 changed files with 6 additions and 8 deletions

View file

@ -23,7 +23,6 @@ namespace MWGui
SpellBuyingWindow::SpellBuyingWindow(MWBase::WindowManager& parWindowManager) : SpellBuyingWindow::SpellBuyingWindow(MWBase::WindowManager& parWindowManager) :
WindowBase("openmw_spell_buying_window.layout", parWindowManager) WindowBase("openmw_spell_buying_window.layout", parWindowManager)
, ContainerBase(NULL) // no drag&drop , ContainerBase(NULL) // no drag&drop
, mSpellsWidgetMap()
, mCurrentY(0) , mCurrentY(0)
, mLastPos(0) , mLastPos(0)
{ {
@ -58,7 +57,7 @@ namespace MWGui
mSelect->getHeight()); mSelect->getHeight());
} }
void SpellBuyingWindow::addSpell(std::string spellId) void SpellBuyingWindow::addSpell(const std::string& spellId)
{ {
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId); const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
int price = spell->data.cost*MWBase::Environment::get().getWorld()->getStore().gameSettings.search("fSpellValueMult")->f; int price = spell->data.cost*MWBase::Environment::get().getWorld()->getStore().gameSettings.search("fSpellValueMult")->f;
@ -85,7 +84,7 @@ namespace MWGui
mSpellsWidgetMap.clear(); mSpellsWidgetMap.clear();
} }
void SpellBuyingWindow::startSpellBuying(MWWorld::Ptr actor) void SpellBuyingWindow::startSpellBuying(const MWWorld::Ptr& actor)
{ {
center(); center();
mActor = actor; mActor = actor;
@ -94,7 +93,7 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWMechanics::Spells& playerSpells = stats.getSpells(); MWMechanics::Spells& playerSpells = stats.getSpells();
/// \todo get spell list via class interface /// \todo get spell list via MWWorld::Class interface
std::vector<std::string> spellList = actor.get<ESM::NPC>()->base->spells.list; std::vector<std::string> spellList = actor.get<ESM::NPC>()->base->spells.list;
for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it) for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it)
{ {
@ -172,8 +171,7 @@ namespace MWGui
return; return;
mLastPos = pos; mLastPos = pos;
unsigned int i; for (unsigned int i=0;i<mSpellsClientWidget->getChildCount();i++)
for (i=0;i<mSpellsClientWidget->getChildCount();i++)
{ {
MyGUI::Widget* toMove; MyGUI::Widget* toMove;
toMove = mSpellsClientWidget->getChildAt(i); toMove = mSpellsClientWidget->getChildAt(i);

View file

@ -25,7 +25,7 @@ namespace MWGui
public: public:
SpellBuyingWindow(MWBase::WindowManager& parWindowManager); SpellBuyingWindow(MWBase::WindowManager& parWindowManager);
void startSpellBuying(MWWorld::Ptr actor); void startSpellBuying(const MWWorld::Ptr& actor);
protected: protected:
MyGUI::Button* mCancelButton; MyGUI::Button* mCancelButton;
@ -45,7 +45,7 @@ namespace MWGui
void updateScroller(); void updateScroller();
void onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos); void onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos);
void onMouseWheel(MyGUI::Widget* _sender, int _rel); void onMouseWheel(MyGUI::Widget* _sender, int _rel);
void addSpell(std::string spellID); void addSpell(const std::string& spellID);
void clearSpells(); void clearSpells();
int mLastPos,mCurrentY; int mLastPos,mCurrentY;