1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 07:23:53 +00:00

Reduce includes

This commit is contained in:
scrawl 2015-01-10 01:00:52 +01:00
parent 66e7e04807
commit eb99ed697b
11 changed files with 63 additions and 40 deletions

View file

@ -1,7 +1,6 @@
#include "alchemywindow.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
@ -9,6 +8,7 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/magiceffects.hpp"
#include "../mwmechanics/alchemy.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
@ -27,6 +27,7 @@ namespace MWGui
, mApparatus (4)
, mIngredients (4)
, mSortModel(NULL)
, mAlchemy(new MWMechanics::Alchemy())
{
getWidget(mCreateButton, "CreateButton");
getWidget(mCancelButton, "CancelButton");
@ -66,7 +67,7 @@ namespace MWGui
std::string name = mNameEdit->getCaption();
boost::algorithm::trim(name);
MWMechanics::Alchemy::Result result = mAlchemy.create (mNameEdit->getCaption ());
MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getCaption ());
if (result == MWMechanics::Alchemy::Result_NoName)
{
@ -121,7 +122,7 @@ namespace MWGui
void AlchemyWindow::open()
{
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
mAlchemy->setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr());
mSortModel = new SortFilterItemModel(model);
@ -132,10 +133,10 @@ namespace MWGui
int index = 0;
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
mAlchemy->setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools());
iter!=mAlchemy.endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index)
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy->beginTools());
iter!=mAlchemy->endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index)
{
mApparatus.at (index)->setItem(*iter);
mApparatus.at (index)->clearUserStrings();
@ -150,7 +151,7 @@ namespace MWGui
}
void AlchemyWindow::exit() {
mAlchemy.clear();
mAlchemy->clear();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory);
}
@ -164,7 +165,7 @@ namespace MWGui
void AlchemyWindow::onSelectedItem(int index)
{
MWWorld::Ptr item = mSortModel->getItem(index).mBase;
int res = mAlchemy.addIngredient(item);
int res = mAlchemy->addIngredient(item);
if (res != -1)
{
@ -177,20 +178,20 @@ namespace MWGui
void AlchemyWindow::update()
{
std::string suggestedName = mAlchemy.suggestPotionName();
std::string suggestedName = mAlchemy->suggestPotionName();
if (suggestedName != mSuggestedPotionName)
mNameEdit->setCaptionWithReplacing(suggestedName);
mSuggestedPotionName = suggestedName;
mSortModel->clearDragItems();
MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy.beginIngredients ();
MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy->beginIngredients ();
for (int i=0; i<4; ++i)
{
ItemWidget* ingredient = mIngredients[i];
MWWorld::Ptr item;
if (it != mAlchemy.endIngredients ())
if (it != mAlchemy->endIngredients ())
{
item = *it;
++it;
@ -217,7 +218,7 @@ namespace MWGui
mItemView->update();
std::set<MWMechanics::EffectKey> effectIds = mAlchemy.listEffects();
std::set<MWMechanics::EffectKey> effectIds = mAlchemy->listEffects();
Widgets::SpellEffectList list;
for (std::set<MWMechanics::EffectKey>::iterator it = effectIds.begin(); it != effectIds.end(); ++it)
{
@ -252,7 +253,7 @@ namespace MWGui
{
for (int i=0; i<4; ++i)
if (mIngredients[i] == ingredient)
mAlchemy.removeIngredient (i);
mAlchemy->removeIngredient (i);
update();
}

View file

@ -3,11 +3,14 @@
#include <vector>
#include "../mwmechanics/alchemy.hpp"
#include "widgets.hpp"
#include "windowbase.hpp"
namespace MWMechanics
{
class Alchemy;
}
namespace MWGui
{
class ItemView;
@ -45,7 +48,7 @@ namespace MWGui
void update();
MWMechanics::Alchemy mAlchemy;
std::auto_ptr<MWMechanics::Alchemy> mAlchemy;
std::vector<ItemWidget*> mApparatus;
std::vector<ItemWidget*> mIngredients;

View file

@ -1,19 +1,25 @@
#include "charactercreation.hpp"
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/fallback.hpp"
#include "../mwworld/esmstore.hpp"
#include "textinput.hpp"
#include "race.hpp"
#include "class.hpp"
#include "birth.hpp"
#include "review.hpp"
#include "inventorywindow.hpp"
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/fallback.hpp"
#include "../mwworld/esmstore.hpp"
namespace
{

View file

@ -4,8 +4,9 @@
#include <components/esm/loadskil.hpp>
#include <components/esm/loadclas.hpp>
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include <vector>
#include "../mwmechanics/stat.hpp"
namespace MWGui
{

View file

@ -1,7 +1,9 @@
#ifndef MWGUI_TravelWINDOW_H
#define MWGUI_TravelWINDOW_H
#include "container.hpp"
#include "windowbase.hpp"
#include "referenceinterface.hpp"
namespace MyGUI
{

View file

@ -1,5 +1,7 @@
#include "videowidget.hpp"
#include <extern/ogre-ffmpeg-videoplayer/videoplayer.hpp>
#include "../mwsound/movieaudiofactory.hpp"
namespace MWGui
@ -7,40 +9,41 @@ namespace MWGui
VideoWidget::VideoWidget()
{
mPlayer.reset(new Video::VideoPlayer());
setNeedKeyFocus(true);
}
void VideoWidget::playVideo(const std::string &video)
{
mPlayer.setAudioFactory(new MWSound::MovieAudioFactory());
mPlayer.playVideo(video);
mPlayer->setAudioFactory(new MWSound::MovieAudioFactory());
mPlayer->playVideo(video);
setImageTexture(mPlayer.getTextureName());
setImageTexture(mPlayer->getTextureName());
}
int VideoWidget::getVideoWidth()
{
return mPlayer.getVideoWidth();
return mPlayer->getVideoWidth();
}
int VideoWidget::getVideoHeight()
{
return mPlayer.getVideoHeight();
return mPlayer->getVideoHeight();
}
bool VideoWidget::update()
{
return mPlayer.update();
return mPlayer->update();
}
void VideoWidget::stop()
{
mPlayer.close();
mPlayer->close();
}
bool VideoWidget::hasAudioStream()
{
return mPlayer.hasAudioStream();
return mPlayer->hasAudioStream();
}
}

View file

@ -3,7 +3,10 @@
#include <MyGUI_ImageBox.h>
#include <extern/ogre-ffmpeg-videoplayer/videoplayer.hpp>
namespace Video
{
class VideoPlayer;
}
namespace MWGui
{
@ -33,7 +36,7 @@ namespace MWGui
void stop();
private:
Video::VideoPlayer mPlayer;
std::auto_ptr<Video::VideoPlayer> mPlayer;
};
}

View file

@ -43,7 +43,6 @@ namespace ESM
namespace MWWorld
{
class Ptr;
class ContainerStore;
class InventoryStore;
class PhysicsSystem;

View file

@ -18,6 +18,7 @@
#include <components/esm/loadweap.hpp>
#include "ptr.hpp"
#include "cellreflist.hpp"
namespace ESM
{

View file

@ -4,13 +4,17 @@
#include <vector>
#include "contentloader.hpp"
#include "components/esm/esmreader.hpp"
namespace ToUTF8
{
class Utf8Encoder;
}
namespace ESM
{
class ESMReader;
}
namespace MWWorld
{

View file

@ -6,7 +6,7 @@
#include <string>
#include <sstream>
#include "cellreflist.hpp"
#include "livecellref.hpp"
namespace MWWorld
{