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

View file

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

View file

@ -1,19 +1,25 @@
#include "charactercreation.hpp" #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 "textinput.hpp"
#include "race.hpp" #include "race.hpp"
#include "class.hpp" #include "class.hpp"
#include "birth.hpp" #include "birth.hpp"
#include "review.hpp" #include "review.hpp"
#include "inventorywindow.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 namespace
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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