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

Issue #107: World is accessed only through the interface class from now on; some include cleanup

This commit is contained in:
Marc Zinnschlag 2012-07-03 12:30:50 +02:00
parent 035c1c4b6e
commit 4c39fefd1e
85 changed files with 331 additions and 279 deletions

View file

@ -47,7 +47,7 @@ add_openmw_dir (mwsound
) )
add_openmw_dir (mwworld add_openmw_dir (mwworld
refdata world physicssystem scene globals class action nullaction actionteleport refdata worldimp physicssystem scene globals class action nullaction actionteleport
containerstore actiontalk actiontake manualref player cellfunctors containerstore actiontalk actiontake manualref player cellfunctors
cells localscripts customdata weather inventorystore ptr actionopen actionread cells localscripts customdata weather inventorystore ptr actionopen actionread
actionequip timestamp actionalchemy cellstore actionequip timestamp actionalchemy cellstore

View file

@ -38,10 +38,10 @@
#include "mwsound/soundmanager.hpp" #include "mwsound/soundmanager.hpp"
#include "mwworld/world.hpp"
#include "mwworld/class.hpp" #include "mwworld/class.hpp"
#include "mwworld/player.hpp" #include "mwworld/player.hpp"
#include "mwworld/cellstore.hpp" #include "mwworld/cellstore.hpp"
#include "mwworld/worldimp.hpp"
#include "mwclass/classes.hpp" #include "mwclass/classes.hpp"
@ -51,6 +51,7 @@
#include "mwmechanics/mechanicsmanager.hpp" #include "mwmechanics/mechanicsmanager.hpp"
#include "mwbase/environment.hpp" #include "mwbase/environment.hpp"
#include "mwbase/world.hpp"
void OMW::Engine::executeLocalScripts() void OMW::Engine::executeLocalScripts()

View file

@ -9,13 +9,13 @@
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "../mwworld/world.hpp"
#include "../mwdialogue/dialoguemanager.hpp" #include "../mwdialogue/dialoguemanager.hpp"
#include "../mwdialogue/journal.hpp" #include "../mwdialogue/journal.hpp"
#include "../mwmechanics/mechanicsmanager.hpp" #include "../mwmechanics/mechanicsmanager.hpp"
#include "world.hpp"
MWBase::Environment *MWBase::Environment::sThis = 0; MWBase::Environment *MWBase::Environment::sThis = 0;
MWBase::Environment::Environment() MWBase::Environment::Environment()
@ -32,7 +32,7 @@ MWBase::Environment::~Environment()
sThis = 0; sThis = 0;
} }
void MWBase::Environment::setWorld (MWWorld::World *world) void MWBase::Environment::setWorld (World *world)
{ {
mWorld = world; mWorld = world;
} }
@ -77,7 +77,7 @@ void MWBase::Environment::setFrameDuration (float duration)
mFrameDuration = duration; mFrameDuration = duration;
} }
MWWorld::World *MWBase::Environment::getWorld() const MWBase::World *MWBase::Environment::getWorld() const
{ {
assert (mWorld); assert (mWorld);
return mWorld; return mWorld;

View file

@ -32,13 +32,10 @@ namespace MWInput
struct MWInputManager; struct MWInputManager;
} }
namespace MWWorld
{
class World;
}
namespace MWBase namespace MWBase
{ {
class World;
/// \brief Central hub for mw-subsystems /// \brief Central hub for mw-subsystems
/// ///
/// This class allows each mw-subsystem to access any others subsystem's top-level manager class. /// This class allows each mw-subsystem to access any others subsystem's top-level manager class.
@ -49,7 +46,7 @@ namespace MWBase
{ {
static Environment *sThis; static Environment *sThis;
MWWorld::World *mWorld; World *mWorld;
MWSound::SoundManager *mSoundManager; MWSound::SoundManager *mSoundManager;
MWScript::ScriptManager *mScriptManager; MWScript::ScriptManager *mScriptManager;
MWGui::WindowManager *mWindowManager; MWGui::WindowManager *mWindowManager;
@ -71,7 +68,7 @@ namespace MWBase
~Environment(); ~Environment();
void setWorld (MWWorld::World *world); void setWorld (World *world);
void setSoundManager (MWSound::SoundManager *soundManager); void setSoundManager (MWSound::SoundManager *soundManager);
@ -90,7 +87,7 @@ namespace MWBase
void setFrameDuration (float duration); void setFrameDuration (float duration);
///< Set length of current frame in seconds. ///< Set length of current frame in seconds.
MWWorld::World *getWorld() const; World *getWorld() const;
MWSound::SoundManager *getSoundManager() const; MWSound::SoundManager *getSoundManager() const;

View file

@ -4,11 +4,11 @@
#include <components/esm/loadappa.hpp> #include <components/esm/loadappa.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/actionalchemy.hpp" #include "../mwworld/actionalchemy.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwrender/objects.hpp" #include "../mwrender/objects.hpp"

View file

@ -5,15 +5,15 @@
#include <components/esm/loadskil.hpp> #include <components/esm/loadskil.hpp>
#include <components/esm/loadgmst.hpp> #include <components/esm/loadgmst.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp" #include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwrender/objects.hpp" #include "../mwrender/objects.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -4,10 +4,10 @@
#include <components/esm/loadbook.hpp> #include <components/esm/loadbook.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actionread.hpp" #include "../mwworld/actionread.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwrender/objects.hpp" #include "../mwrender/objects.hpp"

View file

@ -4,12 +4,12 @@
#include <components/esm/loadclot.hpp> #include <components/esm/loadclot.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp" #include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/tooltips.hpp" #include "../mwgui/tooltips.hpp"

View file

@ -4,12 +4,12 @@
#include <components/esm/loadcont.hpp> #include <components/esm/loadcont.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/nullaction.hpp" #include "../mwworld/nullaction.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/customdata.hpp" #include "../mwworld/customdata.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -4,12 +4,12 @@
#include <components/esm/loaddoor.hpp> #include <components/esm/loaddoor.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/nullaction.hpp" #include "../mwworld/nullaction.hpp"
#include "../mwworld/actionteleport.hpp" #include "../mwworld/actionteleport.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -4,10 +4,10 @@
#include <components/esm/loadingr.hpp> #include <components/esm/loadingr.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -4,13 +4,13 @@
#include <components/esm/loadligh.hpp> #include <components/esm/loadligh.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp" #include "../mwworld/actionequip.hpp"
#include "../mwworld/nullaction.hpp" #include "../mwworld/nullaction.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -4,12 +4,12 @@
#include <components/esm/loadlocks.hpp> #include <components/esm/loadlocks.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp" #include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -6,10 +6,10 @@
#include <components/esm/loadmisc.hpp> #include <components/esm/loadmisc.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -9,6 +9,9 @@
#include <components/esm/loadnpc.hpp> #include <components/esm/loadnpc.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/movement.hpp" #include "../mwmechanics/movement.hpp"
@ -16,13 +19,12 @@
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontalk.hpp" #include "../mwworld/actiontalk.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/customdata.hpp" #include "../mwworld/customdata.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwrender/actors.hpp"
#include "../mwbase/environment.hpp" #include "../mwgui/window_manager.hpp"
namespace namespace
{ {

View file

@ -4,10 +4,10 @@
#include <components/esm/loadalch.hpp> #include <components/esm/loadalch.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -4,12 +4,12 @@
#include <components/esm/loadlocks.hpp> #include <components/esm/loadlocks.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp" #include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -4,10 +4,10 @@
#include <components/esm/loadlocks.hpp> #include <components/esm/loadlocks.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -4,12 +4,12 @@
#include <components/esm/loadweap.hpp> #include <components/esm/loadweap.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp" #include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -10,9 +10,9 @@
#include <components/esm_store/store.hpp> #include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/refdata.hpp" #include "../mwworld/refdata.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
@ -121,24 +121,24 @@ namespace
} }
template<typename T> template<typename T>
bool checkGlobal (char comp, const std::string& name, T value, MWWorld::World& world) bool checkGlobal (char comp, const std::string& name, T value)
{ {
switch (world.getGlobalVariableType (name)) switch (MWBase::Environment::get().getWorld()->getGlobalVariableType (name))
{ {
case 's': case 's':
return selectCompare (comp, world.getGlobalVariable (name).mShort, value); return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mShort, value);
case 'l': case 'l':
return selectCompare (comp, world.getGlobalVariable (name).mLong, value); return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mLong, value);
case 'f': case 'f':
return selectCompare (comp, world.getGlobalVariable (name).mFloat, value); return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat, value);
case ' ': case ' ':
world.getGlobalVariable (name); // trigger exception MWBase::Environment::get().getWorld()->getGlobalVariable (name); // trigger exception
break; break;
default: default:
@ -309,12 +309,12 @@ namespace MWDialogue
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int || if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
select.type==ESM::VT_Long) select.type==ESM::VT_Long)
{ {
if (!checkGlobal (comp, toLower (name), select.i, *MWBase::Environment::get().getWorld())) if (!checkGlobal (comp, toLower (name), select.i))
return false; return false;
} }
else if (select.type==ESM::VT_Float) else if (select.type==ESM::VT_Float)
{ {
if (!checkGlobal (comp, toLower (name), select.f, *MWBase::Environment::get().getWorld())) if (!checkGlobal (comp, toLower (name), select.f))
return false; return false;
} }
else else

View file

@ -2,12 +2,11 @@
#include "journal.hpp" #include "journal.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"
#include "../mwgui/messagebox.hpp" #include "../mwgui/messagebox.hpp"
#include "../mwworld/world.hpp"
namespace MWDialogue namespace MWDialogue
{ {
Quest& Journal::getQuest (const std::string& id) Quest& Journal::getQuest (const std::string& id)
@ -30,14 +29,13 @@ namespace MWDialogue
void Journal::addEntry (const std::string& id, int index) void Journal::addEntry (const std::string& id, int index)
{ {
StampedJournalEntry entry = StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index);
StampedJournalEntry::makeFromQuest (id, index, *MWBase::Environment::get().getWorld());
mJournal.push_back (entry); mJournal.push_back (entry);
Quest& quest = getQuest (id); Quest& quest = getQuest (id);
quest.addEntry (entry, *MWBase::Environment::get().getWorld()); // we are doing slicing on purpose here quest.addEntry (entry); // we are doing slicing on purpose here
std::vector<std::string> empty; std::vector<std::string> empty;
std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str; std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str;
@ -48,7 +46,7 @@ namespace MWDialogue
{ {
Quest& quest = getQuest (id); Quest& quest = getQuest (id);
quest.setIndex (index, *MWBase::Environment::get().getWorld()); quest.setIndex (index);
} }
void Journal::addTopic (const std::string& topicId, const std::string& infoId) void Journal::addTopic (const std::string& topicId, const std::string& infoId)
@ -63,7 +61,7 @@ namespace MWDialogue
iter = result.first; iter = result.first;
} }
iter->second.addEntry (JournalEntry (topicId, infoId), *MWBase::Environment::get().getWorld()); iter->second.addEntry (JournalEntry (topicId, infoId));
} }
int Journal::getJournalIndex (const std::string& id) const int Journal::getJournalIndex (const std::string& id) const

View file

@ -5,7 +5,8 @@
#include <components/esm_store/store.hpp> #include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
namespace MWDialogue namespace MWDialogue
{ {
@ -27,16 +28,14 @@ namespace MWDialogue
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic); throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
} }
JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index, JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index)
const MWWorld::World& world)
{ {
return JournalEntry (topic, idFromIndex (topic, index, world)); return JournalEntry (topic, idFromIndex (topic, index));
} }
std::string JournalEntry::idFromIndex (const std::string& topic, int index, std::string JournalEntry::idFromIndex (const std::string& topic, int index)
const MWWorld::World& world)
{ {
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (topic); const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (topic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) iter!=dialogue->mInfo.end(); ++iter)
@ -57,13 +56,12 @@ namespace MWDialogue
: JournalEntry (topic, infoId), mDay (day), mMonth (month), mDayOfMonth (dayOfMonth) : JournalEntry (topic, infoId), mDay (day), mMonth (month), mDayOfMonth (dayOfMonth)
{} {}
StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index, StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index)
const MWWorld::World& world)
{ {
int day = world.getGlobalVariable ("dayspassed").mLong; int day = MWBase::Environment::get().getWorld()->getGlobalVariable ("dayspassed").mLong;
int month = world.getGlobalVariable ("day").mLong; int month = MWBase::Environment::get().getWorld()->getGlobalVariable ("day").mLong;
int dayOfMonth = world.getGlobalVariable ("month").mLong; int dayOfMonth = MWBase::Environment::get().getWorld()->getGlobalVariable ("month").mLong;
return StampedJournalEntry (topic, idFromIndex (topic, index, world), day, month, dayOfMonth); return StampedJournalEntry (topic, idFromIndex (topic, index), day, month, dayOfMonth);
} }
} }

View file

@ -8,11 +8,6 @@ namespace ESMS
struct ESMStore; struct ESMStore;
} }
namespace MWWorld
{
class World;
}
namespace MWDialogue namespace MWDialogue
{ {
/// \brief A quest or dialogue entry /// \brief A quest or dialogue entry
@ -27,11 +22,9 @@ namespace MWDialogue
std::string getText (const ESMS::ESMStore& store) const; std::string getText (const ESMS::ESMStore& store) const;
static JournalEntry makeFromQuest (const std::string& topic, int index, static JournalEntry makeFromQuest (const std::string& topic, int index);
const MWWorld::World& world);
static std::string idFromIndex (const std::string& topic, int index, static std::string idFromIndex (const std::string& topic, int index);
const MWWorld::World& world);
}; };
/// \biref A quest entry with a timestamp. /// \biref A quest entry with a timestamp.
@ -46,8 +39,7 @@ namespace MWDialogue
StampedJournalEntry (const std::string& topic, const std::string& infoId, StampedJournalEntry (const std::string& topic, const std::string& infoId,
int day, int month, int dayOfMonth); int day, int month, int dayOfMonth);
static StampedJournalEntry makeFromQuest (const std::string& topic, int index, static StampedJournalEntry makeFromQuest (const std::string& topic, int index);
const MWWorld::World& world);
}; };
} }

View file

@ -3,7 +3,8 @@
#include <components/esm_store/store.hpp> #include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
namespace MWDialogue namespace MWDialogue
{ {
@ -15,9 +16,9 @@ namespace MWDialogue
: Topic (topic), mIndex (0), mFinished (false) : Topic (topic), mIndex (0), mFinished (false)
{} {}
const std::string Quest::getName (const MWWorld::World& world) const const std::string Quest::getName() const
{ {
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (mTopic); const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) iter!=dialogue->mInfo.end(); ++iter)
@ -32,9 +33,9 @@ namespace MWDialogue
return mIndex; return mIndex;
} }
void Quest::setIndex (int index, const MWWorld::World& world) void Quest::setIndex (int index)
{ {
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (mTopic); const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) iter!=dialogue->mInfo.end(); ++iter)
@ -58,11 +59,11 @@ namespace MWDialogue
return mFinished; return mFinished;
} }
void Quest::addEntry (const JournalEntry& entry, const MWWorld::World& world) void Quest::addEntry (const JournalEntry& entry)
{ {
int index = -1; int index = -1;
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (entry.mTopic); const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (entry.mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin()); for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter) iter!=dialogue->mInfo.end(); ++iter)
@ -75,7 +76,7 @@ namespace MWDialogue
if (index==-1) if (index==-1)
throw std::runtime_error ("unknown journal entry for topic " + mTopic); throw std::runtime_error ("unknown journal entry for topic " + mTopic);
setIndex (index, world); setIndex (index);
for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter) for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter)
if (*iter==entry.mInfoId) if (*iter==entry.mInfoId)

View file

@ -17,17 +17,17 @@ namespace MWDialogue
Quest (const std::string& topic); Quest (const std::string& topic);
const std::string getName (const MWWorld::World& world) const; const std::string getName() const;
///< May be an empty string ///< May be an empty string
int getIndex() const; int getIndex() const;
void setIndex (int index, const MWWorld::World& world); void setIndex (int index);
///< Calling this function with a non-existant index while throw an exception. ///< Calling this function with a non-existant index while throw an exception.
bool isFinished() const; bool isFinished() const;
virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world); virtual void addEntry (const JournalEntry& entry);
///< Add entry and adjust index accordingly. ///< Add entry and adjust index accordingly.
/// ///
/// \note Redundant entries are ignored, but the index is still adjusted. /// \note Redundant entries are ignored, but the index is still adjusted.

View file

@ -3,8 +3,6 @@
#include <components/esm_store/store.hpp> #include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp"
namespace MWDialogue namespace MWDialogue
{ {
Topic::Topic() Topic::Topic()
@ -17,7 +15,7 @@ namespace MWDialogue
Topic::~Topic() Topic::~Topic()
{} {}
void Topic::addEntry (const JournalEntry& entry, const MWWorld::World& world) void Topic::addEntry (const JournalEntry& entry)
{ {
if (entry.mTopic!=mTopic) if (entry.mTopic!=mTopic)
throw std::runtime_error ("topic does not match: " + mTopic); throw std::runtime_error ("topic does not match: " + mTopic);

View file

@ -6,11 +6,6 @@
#include "journalentry.hpp" #include "journalentry.hpp"
namespace MWWorld
{
class World;
}
namespace MWDialogue namespace MWDialogue
{ {
/// \brief Collection of seen responses for a topic /// \brief Collection of seen responses for a topic
@ -34,7 +29,7 @@ namespace MWDialogue
virtual ~Topic(); virtual ~Topic();
virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world); virtual void addEntry (const JournalEntry& entry);
///< Add entry ///< Add entry
/// ///
/// \note Redundant entries are ignored. /// \note Redundant entries are ignored.

View file

@ -3,10 +3,12 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"

View file

@ -3,10 +3,12 @@
#include "window_manager.hpp" #include "window_manager.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/world.hpp"
#include "../mwmechanics/mechanicsmanager.hpp" #include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
#include "../mwworld/world.hpp"
#include <components/esm_store/store.hpp>
namespace MWGui namespace MWGui
{ {

View file

@ -3,7 +3,7 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
namespace MWGui namespace MWGui
{ {

View file

@ -3,6 +3,9 @@
#include <algorithm> #include <algorithm>
#include <components/esm_store/reclists.hpp>
#include <components/esm_store/store.hpp>
#include <components/compiler/exception.hpp> #include <components/compiler/exception.hpp>
#include "../mwscript/extensions.hpp" #include "../mwscript/extensions.hpp"

View file

@ -3,19 +3,23 @@
#include <cmath> #include <cmath>
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <assert.h> #include <cassert>
#include <iostream> #include <iostream>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwclass/container.hpp" #include "../mwclass/container.hpp"
#include "../mwinput/inputmanager.hpp" #include "../mwinput/inputmanager.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"

View file

@ -3,7 +3,7 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
namespace MWGui namespace MWGui
{ {
@ -77,7 +77,7 @@ namespace MWGui
{ {
if (_sender->getCaption() == "") if (_sender->getCaption() == "")
return; return;
unsigned int count; unsigned int count;
try try
{ {

View file

@ -7,11 +7,13 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwsound/soundmanager.hpp"
#include "inventorywindow.hpp" #include "inventorywindow.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"
#include "container.hpp" #include "container.hpp"
@ -239,7 +241,7 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender)
// drop item into the gameworld // drop item into the gameworld
MWWorld::Ptr object = *mDragAndDrop->mDraggedWidget->getUserData<MWWorld::Ptr>(); MWWorld::Ptr object = *mDragAndDrop->mDraggedWidget->getUserData<MWWorld::Ptr>();
MWWorld::World* world = MWBase::Environment::get().getWorld(); MWBase::World* world = MWBase::Environment::get().getWorld();
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize(); MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition(); MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition();
@ -308,7 +310,7 @@ void HUD::onWorldMouseOver(MyGUI::Widget* _sender, int x, int y)
float mouseX = cursorPosition.left / float(viewSize.width); float mouseX = cursorPosition.left / float(viewSize.width);
float mouseY = cursorPosition.top / float(viewSize.height); float mouseY = cursorPosition.top / float(viewSize.height);
MWWorld::World* world = MWBase::Environment::get().getWorld(); MWBase::World* world = MWBase::Environment::get().getWorld();
// if we can't drop the object at the wanted position, show the "drop on ground" cursor. // if we can't drop the object at the wanted position, show the "drop on ground" cursor.
bool canDrop = world->canPlaceObject(mouseX, mouseY); bool canDrop = world->canPlaceObject(mouseX, mouseY);

View file

@ -3,21 +3,24 @@
#include <cmath> #include <cmath>
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <assert.h> #include <cassert>
#include <iostream>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "../mwclass/container.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "../mwclass/container.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"
#include "widgets.hpp" #include "widgets.hpp"
#include "bookwindow.hpp" #include "bookwindow.hpp"
@ -171,7 +174,7 @@ namespace MWGui
/// \todo scripts /// \todo scripts
boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(ptr).use(ptr); boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(ptr).use(ptr);
action->execute(); action->execute();
// this is necessary for books/scrolls: if they are already in the player's inventory, // this is necessary for books/scrolls: if they are already in the player's inventory,

View file

@ -1,11 +1,14 @@
#include "journalwindow.hpp" #include "journalwindow.hpp"
#include "window_manager.hpp"
#include "../mwdialogue/journal.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
#include "../mwdialogue/journal.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "window_manager.hpp"
namespace namespace
{ {
struct book struct book

View file

@ -1,9 +1,10 @@
#include "referenceinterface.hpp" #include "referenceinterface.hpp"
#include "../mwworld/player.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/player.hpp"
namespace MWGui namespace MWGui
{ {
ReferenceInterface::ReferenceInterface() ReferenceInterface::ReferenceInterface()

View file

@ -11,8 +11,12 @@
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
#include "../mwrender/renderingmanager.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "../mwinput/inputmanager.hpp" #include "../mwinput/inputmanager.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"

View file

@ -4,13 +4,18 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include "../mwworld/world.hpp" #include <components/esm_store/store.hpp>
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwmechanics/spells.hpp" #include "../mwmechanics/spells.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/spellsuccess.hpp" #include "../mwmechanics/spellsuccess.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"

View file

@ -6,10 +6,13 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/class.hpp"
#include "../mwmechanics/mechanicsmanager.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"
#include "tooltips.hpp" #include "tooltips.hpp"
@ -539,7 +542,7 @@ void StatsWindow::updateSkillArea()
skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipLayout", "TextToolTip"); skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipLayout", "TextToolTip");
skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sSkillsMenuReputationHelp}"); skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sSkillsMenuReputationHelp}");
} }
addValueItem(mWindowManager.getGameSettingString("sBounty", "Bounty"), addValueItem(mWindowManager.getGameSettingString("sBounty", "Bounty"),
boost::lexical_cast<std::string>(static_cast<int>(bounty)), "normal", coord1, coord2); boost::lexical_cast<std::string>(static_cast<int>(bounty)), "normal", coord1, coord2);

View file

@ -1,15 +1,17 @@
#include "tooltips.hpp" #include "tooltips.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/environment.hpp"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/class.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
using namespace MWGui; using namespace MWGui;
using namespace MyGUI; using namespace MyGUI;
@ -392,7 +394,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
/** /**
* \todo * \todo
* the various potion effects should appear in the tooltip depending if the player * the various potion effects should appear in the tooltip depending if the player
* has enough skill in alchemy to know about the effects of this potion. * has enough skill in alchemy to know about the effects of this potion.
*/ */

View file

@ -3,7 +3,8 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"

View file

@ -3,9 +3,10 @@
#include <cstdlib> #include <cstdlib>
#include "../mwbase/environment.hpp" #include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
namespace MWMechanics namespace MWMechanics
{ {

View file

@ -3,14 +3,14 @@
#include <components/esm_store/store.hpp> #include <components/esm_store/store.hpp>
#include "../mwgui/window_manager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwgui/window_manager.hpp"
namespace MWMechanics namespace MWMechanics
{ {
void MechanicsManager::buildPlayer() void MechanicsManager::buildPlayer()

View file

@ -1,11 +1,12 @@
#include "spells.hpp" #include "spells.hpp"
#include <components/esm_store/store.hpp>
#include <components/esm/loadspel.hpp> #include <components/esm/loadspel.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/world.hpp"
#include "magiceffects.hpp" #include "magiceffects.hpp"

View file

@ -1,9 +1,11 @@
#ifndef MWMECHANICS_SPELLSUCCESS_H #ifndef MWMECHANICS_SPELLSUCCESS_H
#define MWMECHANICS_SPELLSUCCESS_H #define MWMECHANICS_SPELLSUCCESS_H
#include "../mwworld/ptr.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/class.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include "npcstats.hpp" #include "npcstats.hpp"

View file

@ -1,7 +1,7 @@
#include "creatureanimation.hpp" #include "creatureanimation.hpp"
#include "renderconst.hpp" #include "renderconst.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
using namespace Ogre; using namespace Ogre;
using namespace NifOgre; using namespace NifOgre;

View file

@ -1,18 +1,22 @@
#include "debugging.hpp" #include "debugging.hpp"
#include <assert.h> #include <cassert>
#include <OgreNode.h> #include <OgreNode.h>
#include <OgreSceneManager.h> #include <OgreSceneManager.h>
#include <OgreMaterial.h> #include <OgreMaterial.h>
#include <OgreMaterialManager.h> #include <OgreMaterialManager.h>
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwbase/environment.hpp"
#include "../mwworld/ptr.hpp"
#include <components/esm/loadstat.hpp> #include <components/esm/loadstat.hpp>
#include <components/esm/loadpgrd.hpp> #include <components/esm/loadpgrd.hpp>
#include <components/esm_store/store.hpp>
#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwbase/environment.hpp"
#include "../mwworld/ptr.hpp"
#include "player.hpp" #include "player.hpp"
using namespace Ogre; using namespace Ogre;
@ -162,11 +166,11 @@ Debugging::~Debugging()
bool Debugging::toggleRenderMode (int mode){ bool Debugging::toggleRenderMode (int mode){
switch (mode) switch (mode)
{ {
case MWWorld::World::Render_CollisionDebug: case MWBase::World::Render_CollisionDebug:
return mEngine->toggleDebugRendering(); return mEngine->toggleDebugRendering();
case MWWorld::World::Render_Pathgrid: case MWBase::World::Render_Pathgrid:
togglePathgrid(); togglePathgrid();
return mPathgridEnabled; return mPathgridEnabled;
} }

View file

@ -1,14 +1,16 @@
#include "localmap.hpp" #include "localmap.hpp"
#include "renderingmanager.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwgui/window_manager.hpp"
#include "renderconst.hpp"
#include <OgreOverlayManager.h> #include <OgreOverlayManager.h>
#include <OgreMaterialManager.h> #include <OgreMaterialManager.h>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwgui/window_manager.hpp"
#include "renderconst.hpp"
#include "renderingmanager.hpp"
using namespace MWRender; using namespace MWRender;
using namespace Ogre; using namespace Ogre;

View file

@ -1,8 +1,9 @@
#include "npcanimation.hpp" #include "npcanimation.hpp"
#include "../mwworld/world.hpp"
#include "renderconst.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "renderconst.hpp"
using namespace Ogre; using namespace Ogre;
using namespace NifOgre; using namespace NifOgre;

View file

@ -1,6 +1,6 @@
#include "renderingmanager.hpp" #include "renderingmanager.hpp"
#include <assert.h> #include <cassert>
#include "OgreRoot.h" #include "OgreRoot.h"
#include "OgreRenderWindow.h" #include "OgreRenderWindow.h"
@ -9,22 +9,24 @@
#include "OgreCamera.h" #include "OgreCamera.h"
#include "OgreTextureManager.h" #include "OgreTextureManager.h"
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwworld/ptr.hpp"
#include "../mwworld/player.hpp"
#include "../mwbase/environment.hpp"
#include <components/esm/loadstat.hpp> #include <components/esm/loadstat.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwbase/environment.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/player.hpp"
#include "../mwgui/window_manager.hpp" // FIXME
#include "../mwinput/inputmanager.hpp" // FIXME
#include "shadows.hpp" #include "shadows.hpp"
#include "shaderhelper.hpp" #include "shaderhelper.hpp"
#include "localmap.hpp" #include "localmap.hpp"
#include "water.hpp" #include "water.hpp"
#include "compositors.hpp" #include "compositors.hpp"
#include "../mwgui/window_manager.hpp" // FIXME
#include "../mwinput/inputmanager.hpp" // FIXME
using namespace MWRender; using namespace MWRender;
using namespace Ogre; using namespace Ogre;
@ -298,9 +300,9 @@ void RenderingManager::skySetMoonColour (bool red){
bool RenderingManager::toggleRenderMode(int mode) bool RenderingManager::toggleRenderMode(int mode)
{ {
if (mode == MWWorld::World::Render_CollisionDebug || mode == MWWorld::World::Render_Pathgrid) if (mode == MWBase::World::Render_CollisionDebug || mode == MWBase::World::Render_Pathgrid)
return mDebugging->toggleRenderMode(mode); return mDebugging->toggleRenderMode(mode);
else if (mode == MWWorld::World::Render_Wireframe) else if (mode == MWBase::World::Render_Wireframe)
{ {
if (mRendering.getCamera()->getPolygonMode() == PM_SOLID) if (mRendering.getCamera()->getPolygonMode() == PM_SOLID)
{ {

View file

@ -11,7 +11,8 @@
#include <components/nifogre/ogre_nif_loader.hpp> #include <components/nifogre/ogre_nif_loader.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
#include "renderconst.hpp" #include "renderconst.hpp"
#include "renderingmanager.hpp" #include "renderingmanager.hpp"

View file

@ -1,16 +1,18 @@
#include <OgreTerrain.h>
#include <OgreTerrainGroup.h>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "../mwworld/world.hpp" #include <OgreTerrain.h>
#include <OgreTerrainGroup.h>
#include <components/settings/settings.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "terrainmaterial.hpp" #include "terrainmaterial.hpp"
#include "terrain.hpp" #include "terrain.hpp"
#include "renderconst.hpp" #include "renderconst.hpp"
#include "shadows.hpp" #include "shadows.hpp"
#include <components/settings/settings.hpp> #include "renderingmanager.hpp"
using namespace Ogre; using namespace Ogre;

View file

@ -16,6 +16,8 @@ namespace Ogre{
namespace MWRender{ namespace MWRender{
class RenderingManager;
/** /**
* Implements the Morrowind terrain using the Ogre Terrain Component * Implements the Morrowind terrain using the Ogre Terrain Component
* *

View file

@ -7,6 +7,8 @@
#include <components/interpreter/runtime.hpp> #include <components/interpreter/runtime.hpp>
#include <components/interpreter/opcodes.hpp> #include <components/interpreter/opcodes.hpp>
#include "../mwworld/class.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include "interpretercontext.hpp" #include "interpretercontext.hpp"

View file

@ -9,7 +9,7 @@
#include <components/interpreter/runtime.hpp> #include <components/interpreter/runtime.hpp>
#include <components/interpreter/opcodes.hpp> #include <components/interpreter/opcodes.hpp>
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
#include "interpretercontext.hpp" #include "interpretercontext.hpp"
#include "ref.hpp" #include "ref.hpp"

View file

@ -1,6 +1,8 @@
#include "cellextensions.hpp" #include "cellextensions.hpp"
#include <components/esm_store/store.hpp>
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>
#include <components/interpreter/interpreter.hpp> #include <components/interpreter/interpreter.hpp>
@ -8,8 +10,8 @@
#include <components/interpreter/opcodes.hpp> #include <components/interpreter/opcodes.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "interpretercontext.hpp" #include "interpretercontext.hpp"

View file

@ -1,9 +1,13 @@
#include "compilercontext.hpp" #include "compilercontext.hpp"
#include "../mwbase/environment.hpp" #include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/class.hpp"
#include "scriptmanager.hpp" #include "scriptmanager.hpp"

View file

@ -10,6 +10,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/class.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"

View file

@ -3,6 +3,9 @@
#include <cassert> #include <cassert>
#include <components/esm_store/reclists.hpp>
#include <components/esm_store/store.hpp>
#include "interpretercontext.hpp" #include "interpretercontext.hpp"
#include "scriptmanager.hpp" #include "scriptmanager.hpp"

View file

@ -3,13 +3,13 @@
#include <cmath> #include <cmath>
#include <stdexcept> #include <stdexcept>
#include <iostream>
#include <components/interpreter/types.hpp> #include <components/interpreter/types.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/world.hpp" #include "../mwworld/class.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"

View file

@ -5,8 +5,9 @@
#include <components/interpreter/context.hpp> #include <components/interpreter/context.hpp>
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/action.hpp" #include "../mwworld/action.hpp"
namespace MWSound namespace MWSound

View file

@ -1,6 +1,8 @@
#include "miscextensions.hpp" #include "miscextensions.hpp"
#include <libs/openengine/ogre/fader.hpp>
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>
#include <components/interpreter/interpreter.hpp> #include <components/interpreter/interpreter.hpp>
@ -102,7 +104,7 @@ namespace MWScript
static_cast<InterpreterContext&> (runtime.getContext()); static_cast<InterpreterContext&> (runtime.getContext());
bool enabled = bool enabled =
MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_CollisionDebug); MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_CollisionDebug);
context.report (enabled ? context.report (enabled ?
"Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off"); "Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off");
@ -119,7 +121,7 @@ namespace MWScript
static_cast<InterpreterContext&> (runtime.getContext()); static_cast<InterpreterContext&> (runtime.getContext());
bool enabled = bool enabled =
MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Wireframe); MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_Wireframe);
context.report (enabled ? context.report (enabled ?
"Wireframe Rendering -> On" : "Wireframe Rendering -> Off"); "Wireframe Rendering -> On" : "Wireframe Rendering -> Off");
@ -135,7 +137,7 @@ namespace MWScript
static_cast<InterpreterContext&> (runtime.getContext()); static_cast<InterpreterContext&> (runtime.getContext());
bool enabled = bool enabled =
MWBase::Environment::get().getWorld()->toggleRenderMode (MWWorld::World::Render_Pathgrid); MWBase::Environment::get().getWorld()->toggleRenderMode (MWBase::World::Render_Pathgrid);
context.report (enabled ? context.report (enabled ?
"Path Grid rendering -> On" : "Path Grid Rendering -> Off"); "Path Grid rendering -> On" : "Path Grid Rendering -> Off");

View file

@ -6,9 +6,9 @@
#include <components/interpreter/runtime.hpp> #include <components/interpreter/runtime.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/world.hpp"
#include "interpretercontext.hpp" #include "interpretercontext.hpp"

View file

@ -8,8 +8,7 @@
#include <components/interpreter/opcodes.hpp> #include <components/interpreter/opcodes.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/world.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"

View file

@ -9,10 +9,12 @@
#include <components/esm_store/store.hpp> #include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwrender/player.hpp"
#include "sound_output.hpp" #include "sound_output.hpp"
#include "sound_decoder.hpp" #include "sound_decoder.hpp"
#include "sound.hpp" #include "sound.hpp"

View file

@ -1,9 +1,11 @@
#include "actionequip.hpp" #include "actionequip.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/player.hpp" #include "inventorystore.hpp"
#include "player.hpp"
#include "class.hpp"
namespace MWWorld namespace MWWorld
{ {
@ -14,7 +16,7 @@ namespace MWWorld
void ActionEquip::execute () void ActionEquip::execute ()
{ {
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
MWWorld::InventoryStore& invStore = static_cast<MWWorld::InventoryStore&>(MWWorld::Class::get(player).getContainerStore(player)); MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
// slots that this item can be equipped in // slots that this item can be equipped in
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(mObject).getEquipmentSlots(mObject); std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(mObject).getEquipmentSlots(mObject);
@ -51,4 +53,3 @@ namespace MWWorld
} }
} }
} }

View file

@ -1,13 +1,14 @@
#include "actionopen.hpp" #include "actionopen.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "class.hpp"
#include "world.hpp"
#include "containerstore.hpp"
#include "../mwclass/container.hpp" #include "../mwclass/container.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"
#include "../mwgui/container.hpp" #include "../mwgui/container.hpp"
#include "class.hpp"
#include "containerstore.hpp"
namespace MWWorld namespace MWWorld
{ {
ActionOpen::ActionOpen (const MWWorld::Ptr& container) : mContainer (container) { ActionOpen::ActionOpen (const MWWorld::Ptr& container) : mContainer (container) {

View file

@ -2,10 +2,11 @@
#include "actiontake.hpp" #include "actiontake.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"
#include "class.hpp" #include "class.hpp"
#include "world.hpp"
#include "containerstore.hpp" #include "containerstore.hpp"
namespace MWWorld namespace MWWorld

View file

@ -2,8 +2,7 @@
#include "actionteleport.hpp" #include "actionteleport.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "world.hpp"
namespace MWWorld namespace MWWorld
{ {

View file

@ -4,7 +4,9 @@
#include <algorithm> #include <algorithm>
#include "world.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "class.hpp" #include "class.hpp"
#include "containerstore.hpp" #include "containerstore.hpp"
@ -85,8 +87,8 @@ MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, Ptr::CellS
return ptr; return ptr;
} }
MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader, MWWorld::World& world) MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader)
: mStore (store), mReader (reader), mWorld (world), : mStore (store), mReader (reader),
mIdCache (20, std::pair<std::string, Ptr::CellStore *> ("", 0)), /// \todo make cache size configurable mIdCache (20, std::pair<std::string, Ptr::CellStore *> ("", 0)), /// \todo make cache size configurable
mIdCacheIndex (0) mIdCacheIndex (0)
{} {}
@ -111,11 +113,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
record.water = 0; record.water = 0;
record.mapColor = 0; record.mapColor = 0;
cell = mWorld.createRecord (record); cell = MWBase::Environment::get().getWorld()->createRecord (record);
} }
result = mExteriors.insert (std::make_pair ( result = mExteriors.insert (std::make_pair (
std::make_pair (x, y), Ptr::CellStore (cell))).first; std::make_pair (x, y), CellStore (cell))).first;
} }
if (result->second.mState!=Ptr::CellStore::State_Loaded) if (result->second.mState!=Ptr::CellStore::State_Loaded)

View file

@ -18,39 +18,36 @@ namespace ESM
namespace MWWorld namespace MWWorld
{ {
class World;
/// \brief Cell container /// \brief Cell container
class Cells class Cells
{ {
const ESMS::ESMStore& mStore; const ESMS::ESMStore& mStore;
ESM::ESMReader& mReader; ESM::ESMReader& mReader;
std::map<std::string, Ptr::CellStore> mInteriors; std::map<std::string, CellStore> mInteriors;
std::map<std::pair<int, int>, Ptr::CellStore> mExteriors; std::map<std::pair<int, int>, CellStore> mExteriors;
MWWorld::World& mWorld; std::vector<std::pair<std::string, CellStore *> > mIdCache;
std::vector<std::pair<std::string, Ptr::CellStore *> > mIdCache;
std::size_t mIdCacheIndex; std::size_t mIdCacheIndex;
Cells (const Cells&); Cells (const Cells&);
Cells& operator= (const Cells&); Cells& operator= (const Cells&);
Ptr::CellStore *getCellStore (const ESM::Cell *cell); CellStore *getCellStore (const ESM::Cell *cell);
void fillContainers (Ptr::CellStore& cellStore); void fillContainers (CellStore& cellStore);
Ptr getPtrAndCache (const std::string& name, Ptr::CellStore& cellStore); Ptr getPtrAndCache (const std::string& name, CellStore& cellStore);
public: public:
Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader, MWWorld::World& world); Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader);
///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole ///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole
/// world /// world
Ptr::CellStore *getExterior (int x, int y); CellStore *getExterior (int x, int y);
Ptr::CellStore *getInterior (const std::string& name); CellStore *getInterior (const std::string& name);
Ptr getPtr (const std::string& name, Ptr::CellStore& cellStore); Ptr getPtr (const std::string& name, CellStore& cellStore);
Ptr getPtr (const std::string& name); Ptr getPtr (const std::string& name);
}; };

View file

@ -10,7 +10,7 @@
#include <components/esm/loadcont.hpp> #include <components/esm/loadcont.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp" #include "../mwbase/world.hpp"
#include "manualref.hpp" #include "manualref.hpp"
#include "refdata.hpp" #include "refdata.hpp"

View file

@ -7,8 +7,7 @@
#include <components/esm/loadench.hpp> #include <components/esm/loadench.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/world.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"

View file

@ -1,18 +1,19 @@
#include "physicssystem.hpp"
#include <stdexcept> #include <stdexcept>
#include "physicssystem.hpp" #include <OgreRoot.h>
#include "../mwworld/ptr.hpp" #include <OgreRenderWindow.h>
#include "../mwworld/world.hpp" // FIXME #include <OgreSceneManager.h>
#include <OgreViewport.h>
#include <OgreCamera.h>
#include <OgreTextureManager.h>
#include <components/nifbullet/bullet_nif_loader.hpp> #include <components/nifbullet/bullet_nif_loader.hpp>
#include "OgreRoot.h" #include "../mwbase/world.hpp" // FIXME
#include "OgreRenderWindow.h"
#include "OgreSceneManager.h"
#include "OgreViewport.h"
#include "OgreCamera.h"
#include "OgreTextureManager.h"
#include "ptr.hpp"
using namespace Ogre; using namespace Ogre;
namespace MWWorld namespace MWWorld

View file

@ -1,18 +1,20 @@
#include "player.hpp" #include "player.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwrender/player.hpp" #include "../mwrender/player.hpp"
#include "../mwmechanics/movement.hpp" #include "../mwmechanics/movement.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "world.hpp"
#include "class.hpp" #include "class.hpp"
namespace MWWorld namespace MWWorld
{ {
Player::Player (MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world) : Player::Player (MWRender::Player *renderer, const ESM::NPC *player, const MWBase::World& world) :
mCellStore (0), mRenderer (renderer), mWorld (world), mClass (0), mCellStore (0), mRenderer (renderer), mClass (0),
mAutoMove (false), mForwardBackward (0) mAutoMove (false), mForwardBackward (0)
{ {
mPlayer.base = player; mPlayer.base = player;
@ -36,8 +38,8 @@ namespace MWWorld
void Player::setPos(float x, float y, float z) void Player::setPos(float x, float y, float z)
{ {
/// \todo This fcuntion should be removed during the mwrender-refactoring. /// \todo This fcuntion should be removed during the mwrender-refactoring.
mWorld.moveObject (getPlayer(), x, y, z); MWBase::Environment::get().getWorld()->moveObject (getPlayer(), x, y, z);
} }
void Player::setRot(float x, float y, float z) void Player::setRot(float x, float y, float z)
@ -90,14 +92,13 @@ namespace MWWorld
MWWorld::Class::get (ptr).getMovementSettings (ptr).mForwardBackward = value; MWWorld::Class::get (ptr).getMovementSettings (ptr).mForwardBackward = value;
} }
void Player::setUpDown(int value)
{
MWWorld::Ptr ptr = getPlayer();
void Player::setUpDown(int value)
{
MWWorld::Ptr ptr = getPlayer();
MWWorld::Class::get (ptr).getMovementSettings (ptr).mUpDown = value; MWWorld::Class::get (ptr).getMovementSettings (ptr).mUpDown = value;
} }
void Player::toggleRunning() void Player::toggleRunning()
{ {

View file

@ -9,6 +9,11 @@
#include "../mwmechanics/drawstate.hpp" #include "../mwmechanics/drawstate.hpp"
namespace MWBase
{
class World;
}
namespace MWRender namespace MWRender
{ {
class Player; class Player;
@ -16,15 +21,12 @@ namespace MWRender
namespace MWWorld namespace MWWorld
{ {
class World;
/// \brief NPC object representing the player and additional player data /// \brief NPC object representing the player and additional player data
class Player class Player
{ {
LiveCellRef<ESM::NPC> mPlayer; LiveCellRef<ESM::NPC> mPlayer;
MWWorld::Ptr::CellStore *mCellStore; MWWorld::Ptr::CellStore *mCellStore;
MWRender::Player *mRenderer; MWRender::Player *mRenderer;
MWWorld::World& mWorld;
std::string mName; std::string mName;
bool mMale; bool mMale;
std::string mRace; std::string mRace;
@ -34,7 +36,7 @@ namespace MWWorld
int mForwardBackward; int mForwardBackward;
public: public:
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world); Player(MWRender::Player *renderer, const ESM::NPC *player, const MWBase::World& world);
~Player(); ~Player();

View file

@ -1,7 +1,7 @@
#include "scene.hpp" #include "scene.hpp"
#include "world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" /// FIXME
#include "../mwmechanics/mechanicsmanager.hpp" #include "../mwmechanics/mechanicsmanager.hpp"
@ -9,12 +9,12 @@
#include "../mwgui/window_manager.hpp" #include "../mwgui/window_manager.hpp"
#include "../mwworld/world.hpp" /// FIXME
#include "../mwworld/manualref.hpp" /// FIXME #include "../mwworld/manualref.hpp" /// FIXME
#include "ptr.hpp" #include "ptr.hpp"
#include "player.hpp" #include "player.hpp"
#include "class.hpp" #include "class.hpp"
#include "localscripts.hpp"
#include "cellfunctors.hpp" #include "cellfunctors.hpp"
@ -86,7 +86,7 @@ namespace MWWorld
if (!((*iter)->cell->data.flags & ESM::Cell::Interior)) if (!((*iter)->cell->data.flags & ESM::Cell::Interior))
{ {
ESM::Land* land = mWorld->getStore().lands.search((*iter)->cell->data.gridX,(*iter)->cell->data.gridY); ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search((*iter)->cell->data.gridX,(*iter)->cell->data.gridY);
if (land) if (land)
mPhysics->removeHeightField( (*iter)->cell->data.gridX, (*iter)->cell->data.gridY ); mPhysics->removeHeightField( (*iter)->cell->data.gridX, (*iter)->cell->data.gridY );
} }
@ -95,7 +95,7 @@ namespace MWWorld
mRendering.removeCell(*iter); mRendering.removeCell(*iter);
//mPhysics->removeObject("Unnamed_43"); //mPhysics->removeObject("Unnamed_43");
mWorld->getLocalScripts().clearCell (*iter); MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter);
MWBase::Environment::get().getMechanicsManager()->dropActors (*iter); MWBase::Environment::get().getMechanicsManager()->dropActors (*iter);
MWBase::Environment::get().getSoundManager()->stopSound (*iter); MWBase::Environment::get().getSoundManager()->stopSound (*iter);
mActiveCells.erase(*iter); mActiveCells.erase(*iter);
@ -107,7 +107,7 @@ namespace MWWorld
void Scene::loadCell (Ptr::CellStore *cell) void Scene::loadCell (Ptr::CellStore *cell)
{ {
// register local scripts // register local scripts
mWorld->getLocalScripts().addCell (cell); MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);
@ -124,7 +124,7 @@ namespace MWWorld
if (!(cell->cell->data.flags & ESM::Cell::Interior)) if (!(cell->cell->data.flags & ESM::Cell::Interior))
{ {
ESM::Land* land = mWorld->getStore().lands.search(cell->cell->data.gridX,cell->cell->data.gridY); ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cell->cell->data.gridX,cell->cell->data.gridY);
if (land) if (land)
mPhysics->addHeightField (land->landData->heights, mPhysics->addHeightField (land->landData->heights,
cell->cell->data.gridX, cell->cell->data.gridY, cell->cell->data.gridX, cell->cell->data.gridY,
@ -146,14 +146,14 @@ namespace MWWorld
mPhysics->setCurrentWater(hasWater, cell->cell->water); mPhysics->setCurrentWater(hasWater, cell->cell->water);
if (adjustPlayerPos) if (adjustPlayerPos)
{ {
mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]); MWBase::Environment::get().getWorld()->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]);
mWorld->getPlayer().setRot (position.rot[0], position.rot[1], position.rot[2]); MWBase::Environment::get().getWorld()->getPlayer().setRot (position.rot[0], position.rot[1], position.rot[2]);
} }
mWorld->getPlayer().setCell (cell); MWBase::Environment::get().getWorld()->getPlayer().setCell (cell);
MWBase::Environment::get().getMechanicsManager()->addActor (mWorld->getPlayer().getPlayer()); MWBase::Environment::get().getMechanicsManager()->addActor (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
MWBase::Environment::get().getMechanicsManager()->watchActor (mWorld->getPlayer().getPlayer()); MWBase::Environment::get().getMechanicsManager()->watchActor (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
MWBase::Environment::get().getWindowManager()->changeCell( mCurrentCell ); MWBase::Environment::get().getWindowManager()->changeCell( mCurrentCell );
} }
@ -163,7 +163,7 @@ namespace MWWorld
mRendering.preCellChange(mCurrentCell); mRendering.preCellChange(mCurrentCell);
// remove active // remove active
MWBase::Environment::get().getMechanicsManager()->removeActor (mWorld->getPlayer().getPlayer()); MWBase::Environment::get().getMechanicsManager()->removeActor (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
CellStoreCollection::iterator active = mActiveCells.begin(); CellStoreCollection::iterator active = mActiveCells.begin();
@ -202,7 +202,7 @@ namespace MWWorld
if (iter==mActiveCells.end()) if (iter==mActiveCells.end())
{ {
Ptr::CellStore *cell = mWorld->getExterior(x, y); CellStore *cell = MWBase::Environment::get().getWorld()->getExterior(x, y);
loadCell (cell); loadCell (cell);
} }
@ -228,10 +228,10 @@ namespace MWWorld
// adjust player // adjust player
playerCellChange (mWorld->getExterior(X, Y), position, adjustPlayerPos); playerCellChange (MWBase::Environment::get().getWorld()->getExterior(X, Y), position, adjustPlayerPos);
// Sky system // Sky system
mWorld->adjustSky(); MWBase::Environment::get().getWorld()->adjustSky();
mRendering.switchToExterior(); mRendering.switchToExterior();
@ -239,9 +239,8 @@ namespace MWWorld
} }
//We need the ogre renderer and a scene node. //We need the ogre renderer and a scene node.
Scene::Scene (World *world, MWRender::RenderingManager& rendering, PhysicsSystem *physics) Scene::Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics)
: mCurrentCell (0), mCellChanged (false), mWorld(world), : mCurrentCell (0), mCellChanged (false), mPhysics(physics), mRendering(rendering)
mPhysics(physics), mRendering(rendering)
{ {
} }
@ -263,7 +262,7 @@ namespace MWWorld
{ {
std::cout << "Changing to interior\n"; std::cout << "Changing to interior\n";
Ptr::CellStore *cell = mWorld->getInterior(cellName); CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
// remove active // remove active
CellStoreCollection::iterator active = mActiveCells.begin(); CellStoreCollection::iterator active = mActiveCells.begin();
@ -287,7 +286,7 @@ namespace MWWorld
mRendering.configureFog(*cell); mRendering.configureFog(*cell);
// Sky system // Sky system
mWorld->adjustSky(); MWBase::Environment::get().getWorld()->adjustSky();
mCellChanged = true; mCellChanged = true;
} }
@ -297,7 +296,7 @@ namespace MWWorld
int x = 0; int x = 0;
int y = 0; int y = 0;
mWorld->positionToIndex (position.pos[0], position.pos[1], x, y); MWBase::Environment::get().getWorld()->positionToIndex (position.pos[0], position.pos[1], x, y);
changeCell (x, y, position, true); changeCell (x, y, position, true);
} }

View file

@ -59,7 +59,6 @@ namespace MWWorld
Ptr::CellStore* mCurrentCell; // the cell, the player is in Ptr::CellStore* mCurrentCell; // the cell, the player is in
CellStoreCollection mActiveCells; CellStoreCollection mActiveCells;
bool mCellChanged; bool mCellChanged;
World *mWorld;
PhysicsSystem *mPhysics; PhysicsSystem *mPhysics;
MWRender::RenderingManager& mRendering; MWRender::RenderingManager& mRendering;
@ -69,7 +68,7 @@ namespace MWWorld
public: public:
Scene (World *world, MWRender::RenderingManager& rendering, PhysicsSystem *physics); Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics);
~Scene(); ~Scene();

View file

@ -1,9 +1,4 @@
#include "weather.hpp" #include "weather.hpp"
#include "world.hpp"
#include "player.hpp"
#include "../mwrender/renderingmanager.hpp"
#include "../mwsound/soundmanager.hpp"
#include <ctime> #include <ctime>
#include <cstdlib> #include <cstdlib>
@ -12,6 +7,13 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwrender/renderingmanager.hpp"
#include "../mwsound/soundmanager.hpp"
#include "player.hpp"
using namespace Ogre; using namespace Ogre;
using namespace MWWorld; using namespace MWWorld;

View file

@ -1,4 +1,4 @@
#include "world.hpp" #include "worldimp.hpp"
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
@ -179,7 +179,7 @@ namespace MWWorld
const std::string& master, const boost::filesystem::path& resDir, bool newGame, const std::string& master, const boost::filesystem::path& resDir, bool newGame,
const std::string& encoding, std::map<std::string,std::string> fallbackMap) const std::string& encoding, std::map<std::string,std::string> fallbackMap)
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm, *this), mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm),
mNumFacing(0) mNumFacing(0)
{ {
mPhysics = new PhysicsSystem(renderer); mPhysics = new PhysicsSystem(renderer);
@ -211,7 +211,7 @@ namespace MWWorld
mGlobalVariables->setInt ("chargenstate", 1); mGlobalVariables->setInt ("chargenstate", 1);
} }
mWorldScene = new Scene(this, *mRendering, mPhysics); mWorldScene = new Scene(*mRendering, mPhysics);
setFallbackValues(fallbackMap); setFallbackValues(fallbackMap);

View file

@ -1,5 +1,5 @@
#ifndef GAME_MWWORLD_WORLD_H #ifndef GAME_MWWORLD_WORLDIMP_H
#define GAME_MWWORLD_WORLD_H #define GAME_MWWORLD_WORLDIMP_H
#include <vector> #include <vector>
#include <map> #include <map>

View file

@ -4,7 +4,6 @@
#include <btBulletDynamicsCommon.h> #include <btBulletDynamicsCommon.h>
#include <btBulletCollisionCommon.h> #include <btBulletCollisionCommon.h>
#include <components/nifbullet/bullet_nif_loader.hpp> #include <components/nifbullet/bullet_nif_loader.hpp>
//#include <apps\openmw\mwworld\world.hpp>
namespace OEngine { namespace OEngine {
namespace Physic namespace Physic

View file

@ -3,7 +3,6 @@
#include <btBulletCollisionCommon.h> #include <btBulletCollisionCommon.h>
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h> #include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
#include <components/nifbullet/bullet_nif_loader.hpp> #include <components/nifbullet/bullet_nif_loader.hpp>
//#include <apps\openmw\mwworld\world.hpp>
#include "CMotionState.h" #include "CMotionState.h"
#include "OgreRoot.h" #include "OgreRoot.h"
#include "btKinematicCharacterController.h" #include "btKinematicCharacterController.h"
@ -286,7 +285,7 @@ namespace Physic
minh = h; minh = h;
maxh = h; maxh = h;
} }
if (h>maxh) maxh = h; if (h>maxh) maxh = h;
if (h<minh) minh = h; if (h<minh) minh = h;
} }

View file

@ -5,12 +5,11 @@
#include <btBulletDynamicsCommon.h> #include <btBulletDynamicsCommon.h>
#include <btBulletCollisionCommon.h> #include <btBulletCollisionCommon.h>
#include <components/nifbullet/bullet_nif_loader.hpp> #include <components/nifbullet/bullet_nif_loader.hpp>
//#include <apps\openmw\mwworld\world.hpp>
#include <openengine/bullet/pmove.h> #include <openengine/bullet/pmove.h>
#include <openengine/bullet/physic.hpp> #include <openengine/bullet/physic.hpp>
enum traceWorldType enum traceWorldType
{ {
collisionWorldTrace = 1, collisionWorldTrace = 1,
@ -33,7 +32,7 @@ struct NewPhysTraceResults
float fraction; float fraction;
bool startSolid; bool startSolid;
//const Object* hitObj; //const Object* hitObj;
}; };
struct traceResults struct traceResults
{ {
Ogre::Vector3 endpos; Ogre::Vector3 endpos;